Skip to content

Commit 1921c13

Browse files
committed
Update getBatchesToReveal.ts
1 parent 506764d commit 1921c13

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

packages/thirdweb/src/extensions/erc721/lazyMinting/read/getBatchesToReveal.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ export async function getBatchesToReveal(
8282
tokenId: BigInt(i),
8383
tokenUri: uri,
8484
client: options.contract.client,
85-
});
85+
}).catch(() => undefined);
8686
}),
8787
);
8888

89+
console.log({ tokenMetadatas });
90+
8991
const encryptedUriData = await Promise.all(
9092
Array.from([...uriIndices]).map((i) =>
9193
EncryptedData.encryptedData({
@@ -111,12 +113,18 @@ export async function getBatchesToReveal(
111113
});
112114

113115
return tokenMetadatas
114-
.map((metadata, i) => ({
115-
batchId: BigInt(i),
116-
batchUri: encryptedBaseUris[i] as Hex,
117-
placeholderMetadata: metadata,
118-
}))
119-
.filter((_, index) => (encryptedBaseUris[index]?.length || 0) > 0);
116+
.map((metadata, i) => {
117+
if (metadata === undefined) {
118+
return;
119+
}
120+
return {
121+
batchId: BigInt(i),
122+
batchUri: encryptedBaseUris[i] as Hex,
123+
placeholderMetadata: metadata,
124+
};
125+
})
126+
.filter((_, index) => (encryptedBaseUris[index]?.length || 0) > 0)
127+
.filter((item) => item !== undefined);
120128
}
121129

122130
/**

0 commit comments

Comments
 (0)