Skip to content

Commit fbf459b

Browse files
committed
[SDK] Improve ERC721 claimToBatch
1 parent f40d247 commit fbf459b

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

packages/thirdweb/src/extensions/erc721/drops/write/claimToBatch.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,15 @@ export function claimToBatch(
5959
async function getClaimToBatchParams(
6060
options: BaseTransactionOptions<ClaimToBatchParams>,
6161
) {
62-
const errorIndexTo = options.content.findIndex((o) => !o.to);
63-
if (errorIndexTo !== -1) {
64-
throw new Error(
65-
`Error: Item at index ${errorIndexTo} is missing recipient address ("to")`,
66-
);
67-
}
68-
const errorIndexQuantity = options.content.findIndex((o) => !o.quantity);
69-
if (errorIndexQuantity !== -1) {
70-
throw new Error(
71-
`Error: Item at index ${errorIndexQuantity} is missing claim quantity`,
72-
);
62+
for (let i = 0; i < options.content.length; i++) {
63+
if (!options.content[i]?.quantity) {
64+
throw new Error(`Error: Item at index ${i} is missing claim quantity`);
65+
}
66+
if (!options.content[i]?.to) {
67+
throw new Error(
68+
`Error: Item at index ${i} is missing recipient address ("to")`,
69+
);
70+
}
7371
}
7472
const content = optimizeClaimContent(options.content);
7573
const data = await Promise.all(
@@ -89,6 +87,7 @@ async function getClaimToBatchParams(
8987
pricePerToken: claimParams.pricePerToken,
9088
allowlistProof: claimParams.allowlistProof,
9189
data: claimParams.data,
90+
overrides: claimParams.overrides,
9291
});
9392
}),
9493
);

0 commit comments

Comments
 (0)