Refactor StakeNodeTable to spectreDao api endpoint

This commit is contained in:
Yana
2025-01-13 15:28:09 +02:00
parent 1b757a806c
commit 9fae4f26a1
3 changed files with 13 additions and 15 deletions
@@ -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,
};
});
@@ -138,6 +138,8 @@ const StakeTable = ({ nodes }: { nodes: MappedNymNodes }) => {
[handleUnstake],
);
console.log("delegations :>> ", delegations);
const columns: MRT_ColumnDef<DelegationWithNodeDetails>[] = useMemo(
() => [
{
@@ -151,7 +153,7 @@ const StakeTable = ({ nodes }: { nodes: MappedNymNodes }) => {
{row.original.delegation?.node_id || "-"}
</Typography>
<Typography variant="body5">
{row.original.node?.bondInformation.node.identity_key || "-"}
{row.original.node?.identity_key || "-"}
</Typography>
</Stack>
),
@@ -162,16 +164,12 @@ const StakeTable = ({ nodes }: { nodes: MappedNymNodes }) => {
accessorKey: "location.country_name",
Header: <ColumnHeading>Location</ColumnHeading>,
Cell: ({ row }) =>
row.original.node?.location.two_letter_iso_country_code ? (
<Tooltip title={row.original.node.location.country_name}>
row.original.node?.countryCode ? (
<Tooltip title={row.original.node?.countryName}>
<Box>
<CountryFlag
countryCode={
row.original.node.location.two_letter_iso_country_code
}
countryName={
row.original.node.location.two_letter_iso_country_code
}
countryCode={row.original.node?.countryCode}
countryName={row.original.node?.countryCode}
/>
</Box>
</Tooltip>
@@ -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,
};
});