Skip to content

Commit

Permalink
Revert some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
guibescos committed Jan 26, 2024
1 parent 85ed14c commit aeb122a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
10 changes: 4 additions & 6 deletions frontend/pages/api/v1/cmc/supply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
getTotalSupply,
getAllMetadataAccounts,
getConfig,
getCustodyAccountAddress,
getAllCustodyAccounts,
} from '@pythnetwork/staking/app/api_utils'
import { getAllStakeAccounts } from 'pages/api/getAllStakingAccounts'

Expand Down Expand Up @@ -56,11 +56,9 @@ export default async function handlerSupply(
allStakeAccounts
)

const allCustodyAccountAddresses = allStakeAccounts.map((account) =>
getCustodyAccountAddress(account)
)
const allCustodyAccounts = await tokenProgram.account.account.fetchMultiple(
allCustodyAccountAddresses
const allCustodyAccounts = await getAllCustodyAccounts(
tokenProgram,
allStakeAccounts
)

const configAccountData = await getConfig(stakingProgram)
Expand Down
10 changes: 10 additions & 0 deletions staking/app/api_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ export async function getAllMetadataAccounts(
);
}

export async function getAllCustodyAccounts(
tokenProgram: any,
stakeAccounts: PublicKey[]
) {
const allCustodyAccountAddresses = stakeAccounts.map((account) =>
getCustodyAccountAddress(account)
);
return tokenProgram.account.account.fetchMultiple(allCustodyAccountAddresses);
}

// ======================================
// Locked accounts
// ======================================
Expand Down
4 changes: 2 additions & 2 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"functions": {
"pages/api/v1/all_locked_accounts.ts": {
"maxDuration": 90
"maxDuration": 30
},
"pages/api/v1/cmc/supply.ts": {
"maxDuration": 90
"maxDuration": 30
}
}
}

0 comments on commit aeb122a

Please sign in to comment.