Skip to content

Commit

Permalink
Add additional Node info to Node Page (#960)
Browse files Browse the repository at this point in the history
  • Loading branch information
pietrodimarco-dfinity authored Sep 24, 2024
1 parent b44c7fd commit 5e6a9c3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export const NodePage: React.FC<NodeProviderPageProps> = ({ nodeProvidersMapping
</Grid>
<Grid item xs={12} md={4}>
<InfoFormatter name={"Node ID"} value={node} />
<InfoFormatter name={"Node Type"} value={mapping.node_metadata_stored.node_type} />
<InfoFormatter name={"Datacenter ID"} value={mapping.node_metadata_stored.dc_id} />
<InfoFormatter name={"Region"} value={mapping.node_metadata_stored.region} />
<Typography gutterBottom variant="subtitle1" component="div">
Node Provider ID
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const NodeProviderPage: React.FC<NodeProviderPageProps> = ({ nodeMetadata
{map.node_id.toText()}
</Link>
</Typography>
))}
))}

</Grid>
<Grid item xs={12}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@ export const NodeProviderRewardsChart: React.FC<NodeProviderRewardsChartProps> =
return <p>No latestNodeRewards</p>;
}

const xdr_conversion_rate = latestProviderRewards.xdr_conversion_rate;
const rewards_xdr_old = latestProviderRewards.rewards_xdr_old;

if (xdr_conversion_rate.length == 0 || rewards_xdr_old.length == 0) {
return <p>No latestNodeRewards</p>;
}


return (
<Grid item xs={12}>
<Box sx={boxStyleWidget('right')}>
<WidgetNumber value={Math.round(Number(latestProviderRewards.rewards_xdr)).toString()} title="Rewards XDR" sxValue={{ color: '#FFCC00' }} />
</Box>
</Grid>
<>
<Grid item xs={12} md={12}>
<Box sx={boxStyleWidget('left')}>
<WidgetNumber value={Math.round(Number(rewards_xdr_old[0]) / 100000000).toString()} title="Last Rewards ICP Received" sxValue={{ color: '#FFCC00' }} />
</Box>
</Grid>
</>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ pub fn coumpute_node_provider_rewards(nodes_rewards: &[NodeRewards]) -> Decimal
let reward_coefficient_percent: Decimal = Decimal::from(node_rewards.node_rate.reward_coefficient_percent.unwrap_or(80)) / dec!(100);
coefficient *= reward_coefficient_percent;

nodes_rewards_xdr_avg * coefficient * Decimal::from_f64(node_rewards.rewards_computation.rewards_percent).unwrap()
nodes_rewards_xdr_avg * coefficient
}
_ => node_rewards.node_rate.xdr_permyriad_per_node_per_month.into(),
};
} * Decimal::from_f64(node_rewards.rewards_computation.rewards_percent).unwrap();
}

rewards_xdr
Expand Down

0 comments on commit 5e6a9c3

Please sign in to comment.