Skip to content

Commit

Permalink
🔨 Fix total staked amount
Browse files Browse the repository at this point in the history
  • Loading branch information
DonFungible committed Feb 12, 2025
1 parent e85e379 commit aa48231
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/_components/Metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function Metrics({ tokenType }: { tokenType: 'UNLOCKED' | 'LOCKED
title="Total Staked"
data={
stakingPool
? formatLargeMetricsNumber(formatEther(BigInt(stakingPool.pool.bonded_tokens), 'gwei'), {
? formatLargeMetricsNumber(formatEther(BigInt(stakingPool.totalStaked), 'gwei'), {
useSuffix: isSmallDevice,
}) + ' IP'
: undefined
Expand Down
7 changes: 6 additions & 1 deletion src/lib/services/api/networkApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,10 @@ export async function getTokenTotalSupply(params: GetTokenTotalSupplyParams): Pr

export async function getStakingPool(): Promise<GetStakingPoolResponse> {
const response = await stakingDataAxios.get<GetStakingPoolApiResponse>('/staking/pool')
return response.data.msg

const totalStaked = BigInt(response.data.msg.pool.bonded_tokens) + BigInt(response.data.msg.pool.not_bonded_tokens)
return {
...response.data.msg,
totalStaked: totalStaked.toString(),
}
}
1 change: 1 addition & 0 deletions src/lib/types/networkApiTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export type GetStakingPoolResponse = {
not_bonded_tokens: string
bonded_tokens: string
}
totalStaked: string
}

export type GetStakingPoolApiResponse = {
Expand Down

0 comments on commit aa48231

Please sign in to comment.