diff --git a/docs/sdk.droperc1155claimconditions.md b/docs/sdk.droperc1155claimconditions.md
index 881f2a4cf..a1a894586 100644
--- a/docs/sdk.droperc1155claimconditions.md
+++ b/docs/sdk.droperc1155claimconditions.md
@@ -26,6 +26,7 @@ export declare class DropErc1155ClaimConditions
| [getActive(tokenId)](./sdk.droperc1155claimconditions.getactive.md) | | Get the currently active claim condition |
| [getAll(tokenId)](./sdk.droperc1155claimconditions.getall.md) | | Get all the claim conditions |
| [getClaimIneligibilityReasons(tokenId, quantity, addressToCheck)](./sdk.droperc1155claimconditions.getclaimineligibilityreasons.md) | | For any claim conditions that a particular wallet is violating, this function returns human-readable information about the breaks in the condition that can be used to inform the user. |
-| [set(tokenId, claimConditionInputs, resetClaimEligibilityForAll)](./sdk.droperc1155claimconditions.set.md) | | Set public mint conditions on a NFT |
+| [set(tokenId, claimConditionInputs, resetClaimEligibilityForAll)](./sdk.droperc1155claimconditions.set.md) | | Set claim conditions on a single NFT |
+| [setBatch(tokenIds, claimConditionInputs, resetClaimEligibilityForAll)](./sdk.droperc1155claimconditions.setbatch.md) | | Set claim conditions on multiple NFTs at once |
| [update(tokenId, index, claimConditionInput)](./sdk.droperc1155claimconditions.update.md) | | Update a single claim condition with new data. |
diff --git a/docs/sdk.droperc1155claimconditions.set.md b/docs/sdk.droperc1155claimconditions.set.md
index 26d91ce75..d7823ce55 100644
--- a/docs/sdk.droperc1155claimconditions.set.md
+++ b/docs/sdk.droperc1155claimconditions.set.md
@@ -4,7 +4,7 @@
## DropErc1155ClaimConditions.set() method
-Set public mint conditions on a NFT
+Set claim conditions on a single NFT
Signature:
@@ -26,7 +26,7 @@ Promise<[TransactionResult](./sdk.transactionresult.md)>
## Remarks
-Sets the public mint conditions that need to be fulfilled by users to claim a particular NFT in this bundle.
+Sets the public mint conditions that need to be fulfilled by users to claim a particular NFT in this contract.
## Example
diff --git a/docs/sdk.droperc1155claimconditions.setbatch.md b/docs/sdk.droperc1155claimconditions.setbatch.md
new file mode 100644
index 000000000..f3ad054ed
--- /dev/null
+++ b/docs/sdk.droperc1155claimconditions.setbatch.md
@@ -0,0 +1,55 @@
+
+
+[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [DropErc1155ClaimConditions](./sdk.droperc1155claimconditions.md) > [setBatch](./sdk.droperc1155claimconditions.setbatch.md)
+
+## DropErc1155ClaimConditions.setBatch() method
+
+Set claim conditions on multiple NFTs at once
+
+Signature:
+
+```typescript
+setBatch(tokenIds: BigNumberish[], claimConditionInputs: ClaimConditionInput[], resetClaimEligibilityForAll?: boolean): Promise<{
+ receipt: ethers.providers.TransactionReceipt;
+ }>;
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| tokenIds | BigNumberish\[\] | the token ids to set the claim conditions on |
+| claimConditionInputs | [ClaimConditionInput](./sdk.claimconditioninput.md)\[\] | The claim conditions |
+| resetClaimEligibilityForAll | boolean | (Optional) Whether to reset the state of who already claimed NFTs previously |
+
+Returns:
+
+Promise<{ receipt: ethers.providers.TransactionReceipt; }>
+
+## Remarks
+
+Sets the claim conditions that need to be fulfilled by users to claim the given NFTs in this contract.
+
+## Example
+
+
+```javascript
+const presaleStartTime = new Date();
+const publicSaleStartTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
+const claimConditions = [
+ {
+ startTime: presaleStartTime, // start the presale now
+ maxQuantity: 2, // limit how many mints for this presale
+ price: 0.01, // presale price
+ snapshot: ['0x...', '0x...'], // limit minting to only certain addresses
+ },
+ {
+ startTime: publicSaleStartTime, // 24h after presale, start public sale
+ price: 0.08, // public sale price
+ }
+]);
+
+const tokenIds = [0,1,2]; // the ids of the NFTs to set claim conditions on
+await dropContract.claimConditions.setBatch(tokenIds, claimConditions);
+```
+
diff --git a/etc/sdk.api.md b/etc/sdk.api.md
index 2645533cf..e5c08163c 100644
--- a/etc/sdk.api.md
+++ b/etc/sdk.api.md
@@ -935,6 +935,9 @@ export class DropErc1155ClaimConditions {
getAll(tokenId: BigNumberish): Promise;
getClaimIneligibilityReasons(tokenId: BigNumberish, quantity: BigNumberish, addressToCheck?: string): Promise;
set(tokenId: BigNumberish, claimConditionInputs: ClaimConditionInput[], resetClaimEligibilityForAll?: boolean): Promise;
+ setBatch(tokenIds: BigNumberish[], claimConditionInputs: ClaimConditionInput[], resetClaimEligibilityForAll?: boolean): Promise<{
+ receipt: ethers.providers.TransactionReceipt;
+ }>;
update(tokenId: BigNumberish, index: number, claimConditionInput: ClaimConditionInput): Promise;
}
diff --git a/src/core/classes/drop-erc1155-claim-conditions.ts b/src/core/classes/drop-erc1155-claim-conditions.ts
index 4205e0781..ef330a9bf 100644
--- a/src/core/classes/drop-erc1155-claim-conditions.ts
+++ b/src/core/classes/drop-erc1155-claim-conditions.ts
@@ -267,9 +267,9 @@ export class DropErc1155ClaimConditions {
*****************************************/
/**
- * Set public mint conditions on a NFT
+ * Set claim conditions on a single NFT
*
- * @remarks Sets the public mint conditions that need to be fulfilled by users to claim a particular NFT in this bundle.
+ * @remarks Sets the public mint conditions that need to be fulfilled by users to claim a particular NFT in this contract.
*
* @example
* ```javascript
@@ -301,6 +301,48 @@ export class DropErc1155ClaimConditions {
claimConditionInputs: ClaimConditionInput[],
resetClaimEligibilityForAll = false,
): Promise {
+ return this.setBatch(
+ [tokenId],
+ claimConditionInputs,
+ resetClaimEligibilityForAll,
+ );
+ }
+
+ /**
+ * Set claim conditions on multiple NFTs at once
+ *
+ * @remarks Sets the claim conditions that need to be fulfilled by users to claim the given NFTs in this contract.
+ *
+ * @example
+ * ```javascript
+ * const presaleStartTime = new Date();
+ * const publicSaleStartTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
+ * const claimConditions = [
+ * {
+ * startTime: presaleStartTime, // start the presale now
+ * maxQuantity: 2, // limit how many mints for this presale
+ * price: 0.01, // presale price
+ * snapshot: ['0x...', '0x...'], // limit minting to only certain addresses
+ * },
+ * {
+ * startTime: publicSaleStartTime, // 24h after presale, start public sale
+ * price: 0.08, // public sale price
+ * }
+ * ]);
+ *
+ * const tokenIds = [0,1,2]; // the ids of the NFTs to set claim conditions on
+ * await dropContract.claimConditions.setBatch(tokenIds, claimConditions);
+ * ```
+ *
+ * @param tokenIds - the token ids to set the claim conditions on
+ * @param claimConditionInputs - The claim conditions
+ * @param resetClaimEligibilityForAll - Whether to reset the state of who already claimed NFTs previously
+ */
+ public async setBatch(
+ tokenIds: BigNumberish[],
+ claimConditionInputs: ClaimConditionInput[],
+ resetClaimEligibilityForAll = false,
+ ) {
// process inputs
const { snapshotInfos, sortedConditions } =
await processClaimConditionInputs(
@@ -340,13 +382,14 @@ export class DropErc1155ClaimConditions {
);
}
- encoded.push(
- this.contractWrapper.readContract.interface.encodeFunctionData(
- "setClaimConditions",
- [tokenId, sortedConditions, resetClaimEligibilityForAll],
- ),
- );
-
+ tokenIds.forEach((tokenId) => {
+ encoded.push(
+ this.contractWrapper.readContract.interface.encodeFunctionData(
+ "setClaimConditions",
+ [tokenId, sortedConditions, resetClaimEligibilityForAll],
+ ),
+ );
+ });
return {
receipt: await this.contractWrapper.multiCall(encoded),
};
diff --git a/test/edition-drop.test.ts b/test/edition-drop.test.ts
index 2711bd7f1..bddce7895 100644
--- a/test/edition-drop.test.ts
+++ b/test/edition-drop.test.ts
@@ -376,6 +376,29 @@ describe("Edition Drop Contract", async () => {
await bdContract.claim("0", 1);
});
+ it("should set multiple claim conditions at once", async () => {
+ await bdContract.createBatch([
+ {
+ name: "test1",
+ description: "test1",
+ },
+ {
+ name: "test2",
+ description: "test2",
+ },
+ ]);
+ await bdContract.claimConditions.setBatch(
+ [0, 1],
+ [
+ {
+ price: 1,
+ },
+ ],
+ );
+ await bdContract.claim("0", 1);
+ await bdContract.claim("1", 1);
+ });
+
describe("eligibility", () => {
beforeEach(async () => {
await bdContract.createBatch([