File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
governance/pyth_staking_sdk/src Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ const Loading = () => (
58
58
const fetchStats = async ( connection : Connection ) => {
59
59
const client = new PythStakingClient ( { connection } ) ;
60
60
const poolData = await client . getPoolDataAccount ( ) ;
61
+ const rewardCustodyAccount = await client . getRewardCustodyAccount ( ) ;
61
62
const totalDelegated = sum (
62
63
poolData . delState . map (
63
64
( { totalDelegation, deltaDelegation } ) =>
@@ -73,7 +74,10 @@ const fetchStats = async (connection: Connection) => {
73
74
74
75
return {
75
76
totalStaked : totalDelegated + totalSelfStaked ,
76
- rewardsDistributed : poolData . claimableRewards + INITIAL_REWARD_POOL_SIZE ,
77
+ rewardsDistributed :
78
+ poolData . claimableRewards +
79
+ INITIAL_REWARD_POOL_SIZE -
80
+ rewardCustodyAccount . amount ,
77
81
} ;
78
82
} ;
79
83
Original file line number Diff line number Diff line change @@ -974,4 +974,17 @@ export class PythStakingClient {
974
974
const globalConfig = await this . getGlobalConfig ( ) ;
975
975
return getMint ( this . connection , globalConfig . pythTokenMint ) ;
976
976
}
977
+
978
+ public async getRewardCustodyAccount ( ) : Promise < Account > {
979
+ const poolConfigAddress = getPoolConfigAddress ( ) ;
980
+ const config = await this . getGlobalConfig ( ) ;
981
+
982
+ const rewardCustodyAccountAddress = getAssociatedTokenAddressSync (
983
+ config . pythTokenMint ,
984
+ poolConfigAddress ,
985
+ true ,
986
+ ) ;
987
+
988
+ return getAccount ( this . connection , rewardCustodyAccountAddress ) ;
989
+ }
977
990
}
You can’t perform that action at this time.
0 commit comments