Skip to content

Commit 96daa26

Browse files
committed
[SDK] Update docs for claimTo extensions (#4849)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR enhances the documentation for the `claimTo` function across the `ERC1155`, `ERC20`, and `ERC721` extensions by adding usage examples for drops with allowlists, emphasizing the need to specify the claimer address. ### Detailed summary - Added a "### Basic usage" section to the documentation for `claimTo` in all three extensions. - Introduced a "### For Drops with allowlists" section explaining the need for the `from` parameter. - Provided code examples for using `claimTo` with allowlists in `ERC1155`, `ERC20`, and `ERC721`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent a2ce5f5 commit 96daa26

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

packages/thirdweb/src/extensions/erc1155/drops/write/claimTo.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export type ClaimToParams = {
1919
* @param options - The options for the transaction
2020
* @extension ERC1155
2121
* @example
22+
* ### Basic usage
2223
* ```ts
2324
* import { claimTo } from "thirdweb/extensions/erc1155";
2425
* import { sendTransaction } from "thirdweb";
@@ -32,6 +33,18 @@ export type ClaimToParams = {
3233
*
3334
* await sendTransaction({ transaction, account });
3435
* ```
36+
*
37+
* ### For Drops with allowlists
38+
* You need to specify the claimer address as the `from` param to avoid any issue with the allowlist
39+
* ```ts
40+
* const transaction = claimTo({
41+
* contract,
42+
* to: "0x...",
43+
* tokenId: 0n,
44+
* quantity: 1n,
45+
* from: "0x...", // address of the one claiming
46+
* });
47+
* ```
3548
* @throws If no claim condition is set
3649
* @returns The prepared transaction
3750
*/

packages/thirdweb/src/extensions/erc20/drops/write/claimTo.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export type ClaimToParams = {
2020
* @param options - The options for the transaction
2121
* @extension ERC20
2222
* @example
23+
*
24+
* ### Basic usage
2325
* ```ts
2426
* import { claimTo } from "thirdweb/extensions/erc20";
2527
* import { sendTransaction } from "thirdweb";
@@ -32,6 +34,17 @@ export type ClaimToParams = {
3234
*
3335
* await sendTransaction({ transaction, account });
3436
* ```
37+
*
38+
* ### For Drops with allowlists
39+
* You need to specify the claimer address as the `from` param to avoid any issue with the allowlist
40+
* ```ts
41+
* const transaction = claimTo({
42+
* contract,
43+
* to: "0x...",
44+
* quantity: 100n,
45+
* from: "0x...", // address of the one claiming
46+
* });
47+
* ```
3548
* @throws If no claim condition is set
3649
* @returns A promise that resolves with the submitted transaction hash.
3750
*/

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export type ClaimToParams = {
2323
* @param options - The options for the transaction
2424
* @extension ERC721
2525
* @example
26+
*
27+
* ### Basic usage
2628
* ```ts
2729
* import { claimTo } from "thirdweb/extensions/erc721";
2830
* import { sendTransaction } from "thirdweb";
@@ -35,6 +37,17 @@ export type ClaimToParams = {
3537
*
3638
* await sendTransaction({ transaction, account });
3739
* ```
40+
*
41+
* ### For Drops with allowlists
42+
* You need to specify the claimer address as the `from` param to avoid any issue with the allowlist
43+
* ```ts
44+
* const transaction = claimTo({
45+
* contract,
46+
* to: "0x...",
47+
* quantity: 1n,
48+
* from: "0x...", // address of the one claiming
49+
* });
50+
* ```
3851
* @throws If no claim condition is set
3952
* @returns A promise that resolves with the submitted transaction hash.
4053
*/

0 commit comments

Comments
 (0)