diff --git a/explorer-nextjs/src/app/page.tsx b/explorer-nextjs/src/app/page.tsx index 91847493d5..e621804faa 100644 --- a/explorer-nextjs/src/app/page.tsx +++ b/explorer-nextjs/src/app/page.tsx @@ -59,6 +59,8 @@ export default async function Home() { + + @@ -67,6 +69,8 @@ export default async function Home() { + + diff --git a/explorer-nextjs/src/components/nodeTable/NodeTable.tsx b/explorer-nextjs/src/components/nodeTable/NodeTable.tsx index ee5d9a80f1..0661295b3f 100644 --- a/explorer-nextjs/src/components/nodeTable/NodeTable.tsx +++ b/explorer-nextjs/src/components/nodeTable/NodeTable.tsx @@ -45,54 +45,48 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => { nodeId: number; identityKey: string; }>(); - const [favorites] = useLocalStorage("nym-node-favorites", []); - const { isWalletConnected } = useChain(COSMOS_KIT_USE_CHAIN); - const handleStakeOnNode = async ({ - nodeId, - amount, - }: { - nodeId: number; - amount: string; - }) => { - const amountToDelegate = (Number(amount) * 1_000_000).toString(); - const uNymFunds = [{ amount: amountToDelegate, denom: "unym" }]; + const handleStakeOnNode = useCallback( + async ({ nodeId, amount }: { nodeId: number; amount: string }) => { + const amountToDelegate = (Number(amount) * 1_000_000).toString(); + const uNymFunds = [{ amount: amountToDelegate, denom: "unym" }]; - setIsLoading(true); - setSelectedNodeForStaking(undefined); - try { - const tx = await nymClient?.delegate( - { nodeId }, - fee, - "Delegation from Nym Explorer V2", - uNymFunds, - ); - console.log({ tx }); + setIsLoading(true); setSelectedNodeForStaking(undefined); - setInfoModalProps({ - open: true, - title: "Success", - message: "This operation can take up to one hour to process", - tx: tx?.transactionHash, + try { + const tx = await nymClient?.delegate( + { nodeId }, + fee, + "Delegation from Nym Explorer V2", + uNymFunds, + ); + setSelectedNodeForStaking(undefined); + setInfoModalProps({ + open: true, + title: "Success", + message: "This operation can take up to one hour to process", + tx: tx?.transactionHash, - onClose: () => setInfoModalProps({ open: false }), - }); - } catch (e) { - const errorMessage = - e instanceof Error ? e.message : "An error occurred while staking"; - setInfoModalProps({ - open: true, - title: "Error", - message: errorMessage, - onClose: () => { - setInfoModalProps({ open: false }); - }, - }); - } - setIsLoading(false); - }; + onClose: () => setInfoModalProps({ open: false }), + }); + } catch (e) { + const errorMessage = + e instanceof Error ? e.message : "An error occurred while staking"; + setInfoModalProps({ + open: true, + title: "Error", + message: errorMessage, + onClose: () => { + setInfoModalProps({ open: false }); + }, + }); + } + setIsLoading(false); + }, + [nymClient], + ); const handleOnSelectStake = useCallback( (node: MappedNymNode) => { @@ -140,7 +134,7 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => { id: "node", header: "", Header: Node, - accessorKey: "bondInformation.node.identity_key", + accessorKey: "identity_key", Cell: ({ row }) => ( {row.original.nodeId} @@ -152,7 +146,7 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => { id: "qos", header: "Quality of Service", align: "center", - accessorKey: "qos", + accessorKey: "qualityOfService", Header: Quality of Service, Cell: ({ row }) => ( @@ -163,7 +157,7 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => { { id: "location", header: "Location", - accessorKey: "location.country_name", + accessorKey: "countryName", Header: Location, Cell: ({ row }) => row.original.countryCode && row.original.countryName ? ( @@ -207,6 +201,7 @@ const NodeTable = ({ nodes }: { nodes: MappedNymNodes }) => { accessorKey: "Action", Header: Action, hidden: !isWalletConnected, + enableColumnFilter: false, Cell: ({ row }) => (