Skip to content

Commit bcd51dc

Browse files
authored
Merge pull request #2234 from pyth-network/feat/governance-total
feat: add governance total
2 parents 7d68135 + 0fb6d39 commit bcd51dc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

apps/staking/src/components/Header/stats.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ export const Stats = ({ className, ...props }: HTMLProps<HTMLDivElement>) => {
4747
OIS Rewards Distributed
4848
</div>
4949
</div>
50+
<div className="border-l border-neutral-600/50" />
51+
<div className="flex-1 sm:flex-none">
52+
{state.type === StateType.Loaded ? (
53+
<Tokens className="mb-1 text-xl font-semibold leading-none">
54+
{state.data.totalGovernance}
55+
</Tokens>
56+
) : (
57+
<Loading />
58+
)}
59+
<div className="text-xs leading-none text-pythpurple-400">
60+
Pyth Governance Total Staked
61+
</div>
62+
</div>
5063
</div>
5164
);
5265
};
@@ -57,12 +70,14 @@ const Loading = () => (
5770

5871
const fetchStats = async (connection: Connection) => {
5972
const client = new PythStakingClient({ connection });
60-
const [poolData, rewardCustodyAccount] = await Promise.all([
73+
const [targetAccount, poolData, rewardCustodyAccount] = await Promise.all([
74+
client.getTargetAccount(),
6175
client.getPoolDataAccount(),
6276
client.getRewardCustodyAccount(),
6377
]);
6478

6579
return {
80+
totalGovernance: targetAccount.locked + targetAccount.deltaLocked,
6681
totalStaked:
6782
sumDelegations(poolData.delState) + sumDelegations(poolData.selfDelState),
6883
rewardsDistributed:

0 commit comments

Comments
 (0)