File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -318,13 +318,23 @@ export async function getUserStakeBalances(
318318 }
319319 ) ;
320320
321- const stakedPools = ( data ?. pools ?? [ ] ) ?. map ( ( i : any ) => i . pool_id ) ;
321+ const { data : stakingData } = await axios . get (
322+ `https://staking-pools-api.neartreasury.com/v1/account/${ account_id } /staking` ,
323+
324+ ) ;
325+
326+ // Combine pools from both API calls and get unique pool IDs
327+ const fastnearPools = ( data ?. pools ?? [ ] ) . map ( ( i : any ) => i . pool_id ) ;
328+ const treasuryPools = ( stakingData ?. pools ?? [ ] ) . map ( ( i : any ) => i . pool_id ) ;
329+
330+ const uniqueStakedPools = [ ...new Set ( [ ...fastnearPools , ...treasuryPools ] ) ] ;
331+
322332 const results : number [ ] = new Array ( blockHeights . length ) . fill ( 0 ) ; // Store total balance per blockHeight
323333
324334 await Promise . all (
325335 blockHeights . map ( async ( block_id , index ) => {
326336 const balances = await Promise . all (
327- stakedPools . map ( async ( pool : string ) => {
337+ uniqueStakedPools . map ( async ( pool : string ) => {
328338 const cacheKey = `${ account_id } -${ block_id } -${ pool } ` ;
329339
330340 const cachedBalance = cache . get ( cacheKey ) ;
You can’t perform that action at this time.
0 commit comments