Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Commit 39dc804

Browse files
authored
Add support for burnable to ERC20, ERC721, and ERC1155 (#540)
* Add initial feature constants * Add burnable interfaces * Replace burn functions with burnable interface and update documentation * Update test cases * Update naming * Update
1 parent f6788a2 commit 39dc804

File tree

67 files changed

+1345
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1345
-145
lines changed

docs/feature_snippets.json

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,85 @@
237237
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155BatchMintable"
238238
}
239239
},
240+
"ERC1155Burnable": {
241+
"name": "Erc1155Burnable",
242+
"summary": "",
243+
"remarks": null,
244+
"examples": {},
245+
"methods": [
246+
{
247+
"name": "batch",
248+
"summary": "Burn a batch of NFTs\n\n",
249+
"remarks": "\n\nBurn the batch NFTs from the connected wallet\n\n",
250+
"examples": {
251+
"javascript": "// The token IDs to burn NFTs of\nconst tokenIds = [0, 1];\n// The amounts of each NFT you want to burn\nconst amounts = [2, 2];\n\nconst result = await contract.edition.burn.batch(tokenIds, amounts);"
252+
},
253+
"reference": {
254+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.batch"
255+
}
256+
},
257+
{
258+
"name": "batchFrom",
259+
"summary": "Burn a batch of NFTs\n\n",
260+
"remarks": "\n\nBurn the batch NFTs from the specified wallet\n\n",
261+
"examples": {
262+
"javascript": "// The address of the wallet to burn NFTS from\nconst account = \"0x...\";\n// The token IDs to burn NFTs of\nconst tokenIds = [0, 1];\n// The amounts of each NFT you want to burn\nconst amounts = [2, 2];\n\nconst result = await contract.edition.burn.batchFrom(account, tokenIds, amounts);"
263+
},
264+
"reference": {
265+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.batchFrom"
266+
}
267+
},
268+
{
269+
"name": "from",
270+
"summary": "Burn a specified amount of a NFTs\n\n",
271+
"remarks": "\n\nBurn the specified NFTs from a specified wallet\n\n",
272+
"examples": {
273+
"javascript": "// The address of the wallet to burn NFTS from\nconst account = \"0x...\";\n// The token ID to burn NFTs of\nconst tokenId = 0;\n// The amount of this NFT you want to burn\nconst amount = 2;\n\nconst result = await contract.edition.burn.from(account, tokenId, amount);"
274+
},
275+
"reference": {
276+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.from"
277+
}
278+
},
279+
{
280+
"name": "tokens",
281+
"summary": "Burn a specified amount of a NFTs\n\n",
282+
"remarks": "\n\nBurn the specified NFTs from the connected wallet\n\n",
283+
"examples": {
284+
"javascript": "// The token ID to burn NFTs of\nconst tokenId = 0;\n// The amount of the NFT you want to burn\nconst amount = 2;\n\nconst result = await contract.edition.burn.tokens(tokenId, amount);"
285+
},
286+
"reference": {
287+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.tokens"
288+
}
289+
}
290+
],
291+
"properties": [],
292+
"reference": {
293+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable"
294+
}
295+
},
296+
"ERC1155Droppable": {
297+
"name": "Erc1155Droppable",
298+
"summary": "",
299+
"remarks": null,
300+
"examples": {},
301+
"methods": [
302+
{
303+
"name": "lazyMint",
304+
"summary": "Create a batch of NFTs to be claimed in the future\n\n",
305+
"remarks": "\n\nCreate batch allows you to create a batch of many NFTs in one transaction.\n\n",
306+
"examples": {
307+
"javascript": "// Custom metadata of the NFTs to create\nconst metadatas = [{\n name: \"Cool NFT\",\n description: \"This is a cool NFT\",\n image: fs.readFileSync(\"path/to/image.png\"), // This can be an image url or file\n}, {\n name: \"Cool NFT\",\n description: \"This is a cool NFT\",\n image: fs.readFileSync(\"path/to/image.png\"),\n}];\n\nconst results = await contract.edition.drop.lazyMint(metadatas); // uploads and creates the NFTs on chain\nconst firstTokenId = results[0].id; // token id of the first created NFT\nconst firstNFT = await results[0].data(); // (optional) fetch details of the first created NFT"
308+
},
309+
"reference": {
310+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Droppable.lazyMint"
311+
}
312+
}
313+
],
314+
"properties": [],
315+
"reference": {
316+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Droppable"
317+
}
318+
},
240319
"ERC1155Enumerable": {
241320
"name": "Erc1155Enumerable",
242321
"summary": "List ERC1155 NFTs\n\n",
@@ -492,6 +571,40 @@
492571
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc20BatchMintable"
493572
}
494573
},
574+
"ERC20Burnable": {
575+
"name": "Erc20Burnable",
576+
"summary": "",
577+
"remarks": null,
578+
"examples": {},
579+
"methods": [
580+
{
581+
"name": "from",
582+
"summary": "Burn Tokens\n\n",
583+
"remarks": "\n\nBurn tokens held by the specified wallet\n\n",
584+
"examples": {
585+
"javascript": "// Address of the wallet sending the tokens\nconst holderAddress = \"{{wallet_address}}\";\n\n// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.token.burn.from(holderAddress, amount);"
586+
},
587+
"reference": {
588+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc20Burnable.from"
589+
}
590+
},
591+
{
592+
"name": "tokens",
593+
"summary": "Burn Tokens\n\n",
594+
"remarks": "\n\nBurn tokens held by the connected wallet\n\n",
595+
"examples": {
596+
"javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.token.burn.tokens(amount);"
597+
},
598+
"reference": {
599+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc20Burnable.tokens"
600+
}
601+
}
602+
],
603+
"properties": [],
604+
"reference": {
605+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc20Burnable"
606+
}
607+
},
495608
"ERC20Mintable": {
496609
"name": "Erc20Mintable",
497610
"summary": "Mint ERC20 Tokens\n\n",
@@ -623,6 +736,29 @@
623736
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc721BatchMintable"
624737
}
625738
},
739+
"ERC721Burnable": {
740+
"name": "Erc721Burnable",
741+
"summary": "",
742+
"remarks": null,
743+
"examples": {},
744+
"methods": [
745+
{
746+
"name": "token",
747+
"summary": "Burn NFTs\n\n",
748+
"remarks": "\n\nBurn NFTs held by the connected wallet\n\n",
749+
"examples": {
750+
"javascript": "// The token ID of the NFT you want to burn\nconst tokenId = 0;\n\nawait contract.nft.burn.token(tokenId);"
751+
},
752+
"reference": {
753+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc721Burnable.token"
754+
}
755+
}
756+
],
757+
"properties": [],
758+
"reference": {
759+
"javascript": "https://docs.thirdweb.com/typescript/sdk.Erc721Burnable"
760+
}
761+
},
626762
"ERC721Claimable": {
627763
"name": "Erc721Claimable",
628764
"summary": "Lazily mint and claim ERC721 NFTs\n\n",

docs/sdk.edition.burn.md renamed to docs/sdk.edition.burntokens.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
22

3-
[Home](./index.md) &gt; [@thirdweb-dev/sdk](./sdk.md) &gt; [Edition](./sdk.edition.md) &gt; [burn](./sdk.edition.burn.md)
3+
[Home](./index.md) &gt; [@thirdweb-dev/sdk](./sdk.md) &gt; [Edition](./sdk.edition.md) &gt; [burnTokens](./sdk.edition.burntokens.md)
44

5-
## Edition.burn() method
5+
## Edition.burnTokens() method
66

77
Burn a specified amount of a NFT
88

99
<b>Signature:</b>
1010

1111
```typescript
12-
burn(tokenId: BigNumberish, amount: BigNumberish): Promise<TransactionResult>;
12+
burnTokens(tokenId: BigNumberish, amount: BigNumberish): Promise<TransactionResult>;
1313
```
1414

1515
## Parameters
@@ -27,6 +27,6 @@ Promise&lt;[TransactionResult](./sdk.transactionresult.md)<!-- -->&gt;
2727

2828

2929
```javascript
30-
const result = await contract.burn(tokenId, amount);
30+
const result = await contract.burnTokens(tokenId, amount);
3131
```
3232

docs/sdk.edition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const contract = sdk.getEdition("{{contract_address}}");
5050

5151
| Method | Modifiers | Description |
5252
| --- | --- | --- |
53-
| [burn(tokenId, amount)](./sdk.edition.burn.md) | | Burn a specified amount of a NFT |
53+
| [burnTokens(tokenId, amount)](./sdk.edition.burntokens.md) | | Burn a specified amount of a NFT |
5454
| [getAll(queryParams)](./sdk.edition.getall.md) | | Get All Minted NFTs |
5555
| [getOwned(walletAddress)](./sdk.edition.getowned.md) | | Get Owned NFTs |
5656
| [getTotalCount()](./sdk.edition.gettotalcount.md) | | Get the number of NFTs minted |

docs/sdk.editiondrop.burn.md renamed to docs/sdk.editiondrop.burntokens.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
22

3-
[Home](./index.md) &gt; [@thirdweb-dev/sdk](./sdk.md) &gt; [EditionDrop](./sdk.editiondrop.md) &gt; [burn](./sdk.editiondrop.burn.md)
3+
[Home](./index.md) &gt; [@thirdweb-dev/sdk](./sdk.md) &gt; [EditionDrop](./sdk.editiondrop.md) &gt; [burnTokens](./sdk.editiondrop.burntokens.md)
44

5-
## EditionDrop.burn() method
5+
## EditionDrop.burnTokens() method
66

77
Burn a specified amount of a NFT
88

99
<b>Signature:</b>
1010

1111
```typescript
12-
burn(tokenId: BigNumberish, amount: BigNumberish): Promise<TransactionResult>;
12+
burnTokens(tokenId: BigNumberish, amount: BigNumberish): Promise<TransactionResult>;
1313
```
1414

1515
## Parameters
@@ -27,6 +27,6 @@ Promise&lt;[TransactionResult](./sdk.transactionresult.md)<!-- -->&gt;
2727

2828

2929
```javascript
30-
const result = await contract.burn(tokenId, amount);
30+
const result = await contract.burnTokens(tokenId, amount);
3131
```
3232

docs/sdk.editiondrop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const contract = sdk.getEditionDrop("{{contract_address}}");
5151

5252
| Method | Modifiers | Description |
5353
| --- | --- | --- |
54-
| [burn(tokenId, amount)](./sdk.editiondrop.burn.md) | | Burn a specified amount of a NFT |
54+
| [burnTokens(tokenId, amount)](./sdk.editiondrop.burntokens.md) | | Burn a specified amount of a NFT |
5555
| [claim(tokenId, quantity, checkERC20Allowance)](./sdk.editiondrop.claim.md) | | Claim a token to the connected wallet |
5656
| [claimTo(destinationAddress, tokenId, quantity, checkERC20Allowance)](./sdk.editiondrop.claimto.md) | | Claim NFTs to a specific Wallet |
5757
| [createBatch(metadatas, options)](./sdk.editiondrop.createbatch.md) | | Create a batch of NFTs to be claimed in the future |

docs/sdk.erc1155.burn.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@thirdweb-dev/sdk](./sdk.md) &gt; [Erc1155](./sdk.erc1155.md) &gt; [burn](./sdk.erc1155.burn.md)
4+
5+
## Erc1155.burn property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
burn: Erc1155Burnable | undefined;
11+
```

docs/sdk.erc1155.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ await contract.edition.transfer(walletAddress, tokenId, quantity);
3535
3636
| Property | Modifiers | Type | Description |
3737
| --- | --- | --- | --- |
38+
| [burn](./sdk.erc1155.burn.md) | | [Erc1155Burnable](./sdk.erc1155burnable.md) \| undefined | |
3839
| [contractWrapper](./sdk.erc1155.contractwrapper.md) | | ContractWrapper&lt;T&gt; | |
39-
| [drop](./sdk.erc1155.drop.md) | | Erc1155Droppable \| undefined | |
40+
| [drop](./sdk.erc1155.drop.md) | | [Erc1155Droppable](./sdk.erc1155droppable.md) \| undefined | |
4041
| [featureName](./sdk.erc1155.featurename.md) | | "ERC1155" | |
4142
| [mint](./sdk.erc1155.mint.md) | | [Erc1155Mintable](./sdk.erc1155mintable.md) \| undefined | |
4243
| [options](./sdk.erc1155.options.md) | | [SDKOptions](./sdk.sdkoptions.md) | |
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@thirdweb-dev/sdk](./sdk.md) &gt; [Erc1155Burnable](./sdk.erc1155burnable.md) &gt; [(constructor)](./sdk.erc1155burnable._constructor_.md)
4+
5+
## Erc1155Burnable.(constructor)
6+
7+
Constructs a new instance of the `Erc1155Burnable` class
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
constructor(contractWrapper: ContractWrapper<IBurnableERC1155>);
13+
```
14+
15+
## Parameters
16+
17+
| Parameter | Type | Description |
18+
| --- | --- | --- |
19+
| contractWrapper | ContractWrapper&lt;IBurnableERC1155&gt; | |
20+

docs/sdk.erc1155burnable.batch.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@thirdweb-dev/sdk](./sdk.md) &gt; [Erc1155Burnable](./sdk.erc1155burnable.md) &gt; [batch](./sdk.erc1155burnable.batch.md)
4+
5+
## Erc1155Burnable.batch() method
6+
7+
Burn a batch of NFTs
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
batch(tokenIds: BigNumberish[], amounts: BigNumberish[]): Promise<TransactionResult>;
13+
```
14+
15+
## Parameters
16+
17+
| Parameter | Type | Description |
18+
| --- | --- | --- |
19+
| tokenIds | BigNumberish\[\] | the tokenIds to burn |
20+
| amounts | BigNumberish\[\] | amount of each token to burn |
21+
22+
<b>Returns:</b>
23+
24+
Promise&lt;[TransactionResult](./sdk.transactionresult.md)<!-- -->&gt;
25+
26+
## Remarks
27+
28+
Burn the batch NFTs from the connected wallet
29+
30+
## Example
31+
32+
33+
```javascript
34+
// The token IDs to burn NFTs of
35+
const tokenIds = [0, 1];
36+
// The amounts of each NFT you want to burn
37+
const amounts = [2, 2];
38+
39+
const result = await contract.edition.burn.batch(tokenIds, amounts);
40+
```
41+

docs/sdk.erc1155burnable.batchfrom.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@thirdweb-dev/sdk](./sdk.md) &gt; [Erc1155Burnable](./sdk.erc1155burnable.md) &gt; [batchFrom](./sdk.erc1155burnable.batchfrom.md)
4+
5+
## Erc1155Burnable.batchFrom() method
6+
7+
Burn a batch of NFTs
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
batchFrom(account: string, tokenIds: BigNumberish[], amounts: BigNumberish[]): Promise<TransactionResult>;
13+
```
14+
15+
## Parameters
16+
17+
| Parameter | Type | Description |
18+
| --- | --- | --- |
19+
| account | string | the address to burn NFTs from |
20+
| tokenIds | BigNumberish\[\] | the tokenIds to burn |
21+
| amounts | BigNumberish\[\] | amount of each token to burn |
22+
23+
<b>Returns:</b>
24+
25+
Promise&lt;[TransactionResult](./sdk.transactionresult.md)<!-- -->&gt;
26+
27+
## Remarks
28+
29+
Burn the batch NFTs from the specified wallet
30+
31+
## Example
32+
33+
34+
```javascript
35+
// The address of the wallet to burn NFTS from
36+
const account = "0x...";
37+
// The token IDs to burn NFTs of
38+
const tokenIds = [0, 1];
39+
// The amounts of each NFT you want to burn
40+
const amounts = [2, 2];
41+
42+
const result = await contract.edition.burn.batchFrom(account, tokenIds, amounts);
43+
```
44+

0 commit comments

Comments
 (0)