From 9fae4f26a1f7d28e3d02fc8aba7dd3d84ed277f1 Mon Sep 17 00:00:00 2001 From: Yana Date: Mon, 13 Jan 2025 15:28:09 +0200 Subject: [PATCH] Refactor StakeNodeTable to spectreDao api endpoint --- .../components/nodeTable/NodeTableWithAction.tsx | 1 - .../src/components/staking/StakeTable.tsx | 16 +++++++--------- .../components/staking/StakeTableWithAction.tsx | 11 ++++++----- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/explorer-nextjs/src/components/nodeTable/NodeTableWithAction.tsx b/explorer-nextjs/src/components/nodeTable/NodeTableWithAction.tsx index 12a23b9941..5c0a7adbc2 100644 --- a/explorer-nextjs/src/components/nodeTable/NodeTableWithAction.tsx +++ b/explorer-nextjs/src/components/nodeTable/NodeTableWithAction.tsx @@ -11,7 +11,6 @@ const mappedNymNodes = (nodes: IObservatoryNode[]) => countryName: node.description.auxiliary_details.location || null, profitMarginPercentage: +node.rewarding_details.cost_params.profit_margin_percent * 100, - owner: node.bonding_address, }; }); diff --git a/explorer-nextjs/src/components/staking/StakeTable.tsx b/explorer-nextjs/src/components/staking/StakeTable.tsx index d5692062a0..7e2a26bc44 100644 --- a/explorer-nextjs/src/components/staking/StakeTable.tsx +++ b/explorer-nextjs/src/components/staking/StakeTable.tsx @@ -138,6 +138,8 @@ const StakeTable = ({ nodes }: { nodes: MappedNymNodes }) => { [handleUnstake], ); + console.log("delegations :>> ", delegations); + const columns: MRT_ColumnDef[] = useMemo( () => [ { @@ -151,7 +153,7 @@ const StakeTable = ({ nodes }: { nodes: MappedNymNodes }) => { {row.original.delegation?.node_id || "-"} - {row.original.node?.bondInformation.node.identity_key || "-"} + {row.original.node?.identity_key || "-"} ), @@ -162,16 +164,12 @@ const StakeTable = ({ nodes }: { nodes: MappedNymNodes }) => { accessorKey: "location.country_name", Header: Location, Cell: ({ row }) => - row.original.node?.location.two_letter_iso_country_code ? ( - + row.original.node?.countryCode ? ( + diff --git a/explorer-nextjs/src/components/staking/StakeTableWithAction.tsx b/explorer-nextjs/src/components/staking/StakeTableWithAction.tsx index 2324275386..6d6139e79b 100644 --- a/explorer-nextjs/src/components/staking/StakeTableWithAction.tsx +++ b/explorer-nextjs/src/components/staking/StakeTableWithAction.tsx @@ -1,16 +1,17 @@ import getNymNodes from "@/actions/getNymNodes"; -import type NymNode from "@/app/api/types"; +import type { IObservatoryNode } from "@/app/api/types"; import StakeTable from "./StakeTable"; -const mappedNymNodes = (nodes: NymNode[]) => +const mappedNymNodes = (nodes: IObservatoryNode[]) => nodes.map((node) => { return { nodeId: node.node_id, - bondInformation: node.bond_information, - location: node.location, + identity_key: node.identity_key, + countryCode: node.description.auxiliary_details.location || null, + countryName: node.description.auxiliary_details.location || null, profitMarginPercentage: +node.rewarding_details.cost_params.profit_margin_percent * 100, - description: node.description, + owner: node.bonding_address, }; });