diff --git a/explorer-nextjs/src/app/nym-node/[id]/page.tsx b/explorer-nextjs/src/app/nym-node/[id]/page.tsx
index 9d3c84d64a..c4177e4956 100644
--- a/explorer-nextjs/src/app/nym-node/[id]/page.tsx
+++ b/explorer-nextjs/src/app/nym-node/[id]/page.tsx
@@ -1,5 +1,5 @@
-import type { IBondInfo, INodeDescription } from "@/app/api";
-import { NYM_NODE_BONDED, NYM_NODE_DESCRIPTION } from "@/app/api/urls";
+import type NodeData from "@/app/api/types";
+import { NYM_NODES } from "@/app/api/urls";
import { ContentLayout } from "@/components/contentLayout/ContentLayout";
import SectionHeading from "@/components/headings/SectionHeading";
import { BasicInfoCard } from "@/components/nymNodePageComponents/BasicInfoCard";
@@ -13,11 +13,11 @@ import { Box, Grid2 } from "@mui/material";
export default async function NymNode({
params,
}: {
- params: Promise<{ id: string }>;
+ params: Promise<{ id: string; account?: string }>;
}) {
const id = Number((await params).id);
- const descriptionData = await fetch(NYM_NODE_DESCRIPTION, {
+ const response = await fetch(NYM_NODES, {
headers: {
Accept: "application/json",
"Content-Type": "application/json; charset=utf-8",
@@ -25,70 +25,86 @@ export default async function NymNode({
next: { revalidate: 60 },
// refresh event list cache at given interval
});
- const nymNodesDescription = await descriptionData.json();
- const bondedData = await fetch(NYM_NODE_BONDED, {
- headers: {
- Accept: "application/json",
- "Content-Type": "application/json; charset=utf-8",
- },
- next: { revalidate: 60 },
- // refresh event list cache at given interval
- });
- const nymbondedData = await bondedData.json();
+ const nymNodes: NodeData[] = await response.json();
- if (!bondedData || !nymNodesDescription) {
+ if (!nymNodes) {
return null;
}
- const nodeBondInfo = nymbondedData.data.filter(
- (item: IBondInfo) => item.bond_information.node_id === id,
- );
+ const nymNode = nymNodes.find((node) => node.node_id === id);
- const nodeDescriptionInfo = nymNodesDescription.data.filter(
- (item: INodeDescription) => item.node_id === id,
- );
+ if (!nymNode) {
+ return null;
+ }
return (
-
-
-
-
-
+
+
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
diff --git a/explorer-nextjs/src/components/nymNodePageComponents/BasicInfoCard.tsx b/explorer-nextjs/src/components/nymNodePageComponents/BasicInfoCard.tsx
index 70b003243c..5e3777d316 100644
--- a/explorer-nextjs/src/components/nymNodePageComponents/BasicInfoCard.tsx
+++ b/explorer-nextjs/src/components/nymNodePageComponents/BasicInfoCard.tsx
@@ -1,4 +1,8 @@
-import type { IBondInfo, INodeDescription } from "@/app/api";
+import type {
+ BondInformation,
+ NodeDescription,
+ RewardingDetails,
+} from "@/app/api/types";
import { Stack, Typography } from "@mui/material";
import { format } from "date-fns";
import ExplorerCard from "../cards/ExplorerCard";
@@ -6,19 +10,20 @@ import CopyToClipboard from "../copyToClipboard/CopyToClipboard";
import ExplorerListItem from "../list/ListItem";
interface IBasicInfoCardProps {
- bondInfo: IBondInfo;
- nodeDescription: INodeDescription;
+ bondInfo: BondInformation;
+ nodeDescription: NodeDescription;
+ rewardDetails: RewardingDetails;
}
export const BasicInfoCard = (props: IBasicInfoCardProps) => {
- const { bondInfo, nodeDescription } = props;
+ const { bondInfo, nodeDescription, rewardDetails } = props;
const timeBonded = format(
- new Date(nodeDescription.description.build_information.build_timestamp),
+ new Date(nodeDescription.build_information.build_timestamp),
"dd/MM/yyyy",
);
- const selfBond = Number(bondInfo.rewarding_details.unit_delegation) / 1000000;
+ const selfBond = Number(rewardDetails.unit_delegation) / 1_000_000;
const selfBondFormated = `${selfBond} NYM`;
return (
@@ -34,10 +39,8 @@ export const BasicInfoCard = (props: IBasicInfoCardProps) => {
justifyContent="space-between"
width="100%"
>
-
- {bondInfo.bond_information.owner}
-
-
+ {bondInfo.owner}
+
}
/>
@@ -53,11 +56,9 @@ export const BasicInfoCard = (props: IBasicInfoCardProps) => {
width="100%"
>
- {bondInfo.bond_information.node.identity_key}
+ {bondInfo.node.identity_key}
-
+
}
/>
@@ -66,7 +67,7 @@ export const BasicInfoCard = (props: IBasicInfoCardProps) => {
row
divider
label="Nr. of stakes"
- value={bondInfo.rewarding_details.unique_delegations.toString()}
+ value={rewardDetails.unique_delegations.toString()}
/>
diff --git a/explorer-nextjs/src/components/nymNodePageComponents/NodeMetricsCard.tsx b/explorer-nextjs/src/components/nymNodePageComponents/NodeMetricsCard.tsx
index b8f5d40a26..8c60fa4479 100644
--- a/explorer-nextjs/src/components/nymNodePageComponents/NodeMetricsCard.tsx
+++ b/explorer-nextjs/src/components/nymNodePageComponents/NodeMetricsCard.tsx
@@ -1,32 +1,33 @@
-import type { INodeDescription } from "@/app/api";
+import type { NodeDescription } from "@/app/api/types";
import ExplorerCard from "../cards/ExplorerCard";
import ExplorerListItem from "../list/ListItem";
interface INodeMetricsCardProps {
- nodeDescription: INodeDescription;
+ nodeDescription: NodeDescription;
+ nodeId: number;
}
export const NodeMetricsCard = (props: INodeMetricsCardProps) => {
- const { nodeDescription } = props;
+ const { nodeDescription, nodeId } = props;
return (
diff --git a/explorer-nextjs/src/components/nymNodePageComponents/NodeProfileCard.tsx b/explorer-nextjs/src/components/nymNodePageComponents/NodeProfileCard.tsx
index fbd38be5eb..a52ba7783b 100644
--- a/explorer-nextjs/src/components/nymNodePageComponents/NodeProfileCard.tsx
+++ b/explorer-nextjs/src/components/nymNodePageComponents/NodeProfileCard.tsx
@@ -1,30 +1,23 @@
"use client";
-import type { IBondInfo, INodeDescription } from "@/app/api";
+import type { BondInformation, NodeDescription } from "@/app/api/types";
import { Box, Button, Stack, Typography } from "@mui/material";
import { RandomAvatar } from "react-random-avatars";
import ExplorerCard from "../cards/ExplorerCard";
import CountryFlag from "../countryFlag/CountryFlag";
interface INodeProfileCardProps {
- bondInfo: IBondInfo;
- nodeDescription: INodeDescription;
+ bondInfo: BondInformation;
+ nodeDescription: NodeDescription;
}
export const NodeProfileCard = (props: INodeProfileCardProps) => {
const { bondInfo, nodeDescription } = props;
- console.log("nodeDescription :>> ", nodeDescription);
- console.log("bondInfo :>> ", bondInfo);
-
return (
-
+
{
{"Moniker"}
Team of professional validators with best digital solutions. Please
diff --git a/explorer-nextjs/src/components/nymNodePageComponents/NodeRewardsCard.tsx b/explorer-nextjs/src/components/nymNodePageComponents/NodeRewardsCard.tsx
index c13b2e550d..a674393381 100644
--- a/explorer-nextjs/src/components/nymNodePageComponents/NodeRewardsCard.tsx
+++ b/explorer-nextjs/src/components/nymNodePageComponents/NodeRewardsCard.tsx
@@ -1,33 +1,30 @@
-import type { IBondInfo } from "@/app/api";
+import type { RewardingDetails } from "@/app/api/types";
import ExplorerCard from "../cards/ExplorerCard";
import ExplorerListItem from "../list/ListItem";
interface INodeRewardsCardProps {
- bondInfo: IBondInfo;
+ rewardDetails: RewardingDetails;
}
export const NodeRewardsCard = (props: INodeRewardsCardProps) => {
- const { bondInfo } = props;
+ const { rewardDetails } = props;
- const totalRewards =
- Number(bondInfo.rewarding_details.total_unit_reward) / 1000000;
+ const totalRewards = Number(rewardDetails.total_unit_reward) / 1000000;
const totalRewardsFormated = `${totalRewards} NYM`;
- const operatorRewards = Number(bondInfo.rewarding_details.operator) / 1000000;
+ const operatorRewards = Number(rewardDetails.operator) / 1000000;
const operatorRewardsFormated = `${operatorRewards} NYM`;
- const stakerRewards = Number(bondInfo.rewarding_details.delegates) / 1000000;
+ const stakerRewards = Number(rewardDetails.delegates) / 1000000;
const stakerRewardsFormated = `${stakerRewards} NYM`;
const profitMarginPercent =
- Number(bondInfo.rewarding_details.cost_params.profit_margin_percent) * 100;
+ Number(rewardDetails.cost_params.profit_margin_percent) * 100;
const profitMarginPercentFormated = `${profitMarginPercent}%`;
const operatingCosts =
- Number(
- bondInfo.rewarding_details.cost_params.interval_operating_cost.amount,
- ) / 1000000;
+ Number(rewardDetails.cost_params.interval_operating_cost.amount) / 1000000;
const operatingCostsFormated = `${operatingCosts.toString()} NYM`;
return (
diff --git a/explorer-nextjs/src/components/nymNodePageComponents/QualityIndicatorsCard.tsx b/explorer-nextjs/src/components/nymNodePageComponents/QualityIndicatorsCard.tsx
index 2c3766406d..3b5cdacdd2 100644
--- a/explorer-nextjs/src/components/nymNodePageComponents/QualityIndicatorsCard.tsx
+++ b/explorer-nextjs/src/components/nymNodePageComponents/QualityIndicatorsCard.tsx
@@ -1,10 +1,10 @@
-import type { INodeDescription } from "@/app/api";
+import type { NodeDescription } from "@/app/api/types";
import ExplorerCard from "../cards/ExplorerCard";
import ExplorerListItem from "../list/ListItem";
import StarRating from "../starRating/StarRating";
interface IQualityIndicatorsCardProps {
- nodeDescription: INodeDescription;
+ nodeDescription: NodeDescription;
}
interface IDeclaredRoles {
@@ -39,7 +39,7 @@ export const QualityIndicatorsCard = (props: IQualityIndicatorsCardProps) => {
const { nodeDescription } = props;
const nodeRoles = getNodeRoles({
- declared_role: nodeDescription.description.declared_role,
+ declared_role: nodeDescription.declared_role,
});
return (