Skip to content

Commit

Permalink
fix: remove fetch duplicate nft metadata batch on Starknet (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
YohanTz authored Jun 24, 2024
1 parent c45eeca commit 5da174a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions apps/web/src/server/api/routers/bridgeRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,17 @@ export const bridgeRequestRouter = createTRPCRouter({
};
}, {});
} else {
const bridgeRequestsTokens = bridgeRequests.map((bridgeRequest) => ({
contract_address: bridgeRequest.req.collection_src,
token_id: bridgeRequest.token_ids[0],
}));
const requestMetadatas = await getL2NftsMetadataBatch(
bridgeRequests.map((bridgeRequest) => ({
contract_address: bridgeRequest.req.collection_src,
token_id: bridgeRequest.token_ids[0],
}))
Object.values(
bridgeRequestsTokens.reduce((acc, token) => {
acc[token.token_id] = token;
return acc;
}, {} as Record<string, { contract_address: string; token_id: string }>)
)
);
requestMetadataByReqHash = requestMetadatas.result.reduce(
(acc, current) => {
Expand Down

0 comments on commit 5da174a

Please sign in to comment.