Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
cctdaniel committed Mar 6, 2024
1 parent f8a39c9 commit 167034b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions staking/app/api_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,12 @@ export async function getAllMetadataAccounts(
getMetadataAccountAddress(account)
);
// split metadata accounts into chunks of 1000 to avoid hitting the limit
const chunks = metadataAccountAddresses.reduce((resultArray, item, index) => {
const chunkIndex = Math.floor(index / 1000);
if (!resultArray[chunkIndex]) {
resultArray[chunkIndex] = [];
}
resultArray[chunkIndex].push(item);
return resultArray;
}, []);
const chunkSize = 1000;
const chunks = Array.from(
{ length: Math.ceil(metadataAccountAddresses.length / chunkSize) },
(_, i) =>
metadataAccountAddresses.slice(i * chunkSize, i * chunkSize + chunkSize)
);

// for each chunk, fetch the metadata accounts
let allMetadataAccounts: (
Expand Down

0 comments on commit 167034b

Please sign in to comment.