Skip to content

Commit 7c17892

Browse files
fix: claim with price and no allowlists (#2795)
1 parent 300e4c8 commit 7c17892

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

.changeset/lovely-houses-flash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fix claiming drops with prices and no allowlists

packages/thirdweb/src/extensions/erc1155/drop1155.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,37 @@ describe.runIf(process.env.TW_SECRET_KEY)(
113113
).resolves.toBe(1n);
114114
});
115115

116+
it("should allow to claim tokens with price", async () => {
117+
await expect(
118+
balanceOf({ contract, owner: TEST_ACCOUNT_A.address, tokenId: 0n }),
119+
).resolves.toBe(1n);
120+
await sendAndConfirmTransaction({
121+
transaction: setClaimConditions({
122+
contract,
123+
phases: [
124+
{
125+
price: "0.001",
126+
},
127+
],
128+
tokenId: 0n,
129+
}),
130+
account: TEST_ACCOUNT_A,
131+
});
132+
const claimTx = claimTo({
133+
contract,
134+
to: TEST_ACCOUNT_A.address,
135+
tokenId: 0n,
136+
quantity: 1n,
137+
});
138+
await sendAndConfirmTransaction({
139+
transaction: claimTx,
140+
account: TEST_ACCOUNT_A,
141+
});
142+
await expect(
143+
balanceOf({ contract, owner: TEST_ACCOUNT_A.address, tokenId: 0n }),
144+
).resolves.toBe(2n);
145+
});
146+
116147
describe("Allowlists", () => {
117148
it("should allow to claim tokens with an allowlist", async () => {
118149
const tokenId = 1n;

packages/thirdweb/src/utils/extensions/drops/get-claim-params.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export async function getClaimParams(options: GetClaimParamsOptions) {
6767
currency: ADDRESS_ZERO,
6868
proof: [],
6969
quantityLimitPerWallet: 0n,
70-
pricePerToken: 0n,
70+
pricePerToken: maxUint256,
7171
} satisfies OverrideProof;
7272
}
7373
// lazy-load the fetchProofsForClaimer function if we need it
@@ -87,7 +87,7 @@ export async function getClaimParams(options: GetClaimParamsOptions) {
8787
currency: ADDRESS_ZERO,
8888
proof: [],
8989
quantityLimitPerWallet: 0n,
90-
pricePerToken: 0n,
90+
pricePerToken: maxUint256,
9191
} satisfies OverrideProof;
9292
}
9393
// otherwise return the proof

0 commit comments

Comments
 (0)