From 4125acad83fb51b6f9a1b6d1b11a36414cf40ebd Mon Sep 17 00:00:00 2001 From: adam-maj Date: Wed, 10 Aug 2022 11:05:30 -0400 Subject: [PATCH 1/6] Add initial feature constants --- src/constants/contract-features.ts | 10 ++++++++-- src/constants/erc1155-features.ts | 13 +++++++++++++ src/constants/erc20-features.ts | 13 +++++++++++++ src/constants/erc721-features.ts | 13 +++++++++++++ src/core/classes/erc-20-burnable.ts | 14 ++++++++++++++ 5 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 src/core/classes/erc-20-burnable.ts diff --git a/src/constants/contract-features.ts b/src/constants/contract-features.ts index 0a6e17d37..3562f386c 100644 --- a/src/constants/contract-features.ts +++ b/src/constants/contract-features.ts @@ -1,6 +1,7 @@ import { FEATURE_NFT, FEATURE_NFT_BATCH_MINTABLE, + FEATURE_NFT_BURNABLE, FEATURE_NFT_CLAIMABLE, FEATURE_NFT_DROPPABLE, FEATURE_NFT_ENUMERABLE, @@ -12,12 +13,14 @@ import { import { FEATURE_TOKEN, FEATURE_TOKEN_BATCH_MINTABLE, + FEATURE_TOKEN_BURNABLE, FEATURE_TOKEN_MINTABLE, FEATURE_TOKEN_SIGNATURE_MINTABLE, } from "./erc20-features"; import { FEATURE_EDITION, FEATURE_EDITION_BATCH_MINTABLE, + FEATURE_EDITION_BURNABLE, FEATURE_EDITION_DROPPABLE, FEATURE_EDITION_ENUMERABLE, FEATURE_EDITION_MINTABLE, @@ -38,6 +41,8 @@ export type Feature = | typeof FEATURE_TOKEN | typeof FEATURE_TOKEN_MINTABLE | typeof FEATURE_TOKEN_BATCH_MINTABLE + | typeof FEATURE_TOKEN_BURNABLE + | typeof FEATURE_TOKEN_SIGNATURE_MINTABLE | typeof FEATURE_NFT | typeof FEATURE_NFT_SUPPLY | typeof FEATURE_NFT_ENUMERABLE @@ -47,16 +52,17 @@ export type Feature = | typeof FEATURE_NFT_CLAIMABLE | typeof FEATURE_NFT_REVEALABLE | typeof FEATURE_NFT_SIGNATURE_MINTABLE + | typeof FEATURE_NFT_BURNABLE | typeof FEATURE_EDITION | typeof FEATURE_EDITION_ENUMERABLE | typeof FEATURE_EDITION_MINTABLE | typeof FEATURE_EDITION_DROPPABLE | typeof FEATURE_EDITION_BATCH_MINTABLE + | typeof FEATURE_EDITION_BURNABLE + | typeof FEATURE_EDITION_SIGNATURE_MINTABLE | typeof FEATURE_ROYALTY - | typeof FEATURE_TOKEN_SIGNATURE_MINTABLE | typeof FEATURE_PLATFORM_FEE | typeof FEATURE_PRIMARY_SALE - | typeof FEATURE_EDITION_SIGNATURE_MINTABLE | typeof FEATURE_PERMISSIONS | typeof FEATURE_METADATA; diff --git a/src/constants/erc1155-features.ts b/src/constants/erc1155-features.ts index 8a20252a5..8a2f3106c 100644 --- a/src/constants/erc1155-features.ts +++ b/src/constants/erc1155-features.ts @@ -4,6 +4,18 @@ import MulticallAbi from "../../abis/IMulticall.json"; import IMintableERC1155Abi from "../../abis/IMintableERC1155.json"; import ISignatureMintERC1155Abi from "../../abis/ISignatureMintERC1155.json"; import ILazyMintAbi from "../../abis/ILazyMint.json"; +import IBurnableERC1155Abi from "../../abis/IBurnableERC1155.json"; + +export const FEATURE_EDITION_BURNABLE = { + name: "ERC1155Burnable", + namespace: "edition.burn", + docLinks: { + sdk: "sdk.erc1155burnable", + contracts: "IBurnableERC1155", + }, + abis: [Erc1155Abi, IBurnableERC1155Abi], + features: {}, +} as const; export const FEATURE_EDITION_DROPPABLE = { name: "ERC1155Droppable", @@ -71,6 +83,7 @@ export const FEATURE_EDITION = { }, abis: [Erc1155Abi], features: { + [FEATURE_EDITION_BURNABLE.name]: FEATURE_EDITION_BURNABLE, [FEATURE_EDITION_ENUMERABLE.name]: FEATURE_EDITION_ENUMERABLE, [FEATURE_EDITION_MINTABLE.name]: FEATURE_EDITION_MINTABLE, [FEATURE_EDITION_DROPPABLE.name]: FEATURE_EDITION_DROPPABLE, diff --git a/src/constants/erc20-features.ts b/src/constants/erc20-features.ts index a70d59323..991708aaa 100644 --- a/src/constants/erc20-features.ts +++ b/src/constants/erc20-features.ts @@ -2,6 +2,18 @@ import ERC20Abi from "../../abis/IERC20.json"; import IMintableERC20Abi from "../../abis/IMintableERC20.json"; import MulticallAbi from "../../abis/IMulticall.json"; import ISignatureMintERC20Abi from "../../abis/ISignatureMintERC20.json"; +import IBurnableERC20Abi from "../../abis/IBurnableERC20.json"; + +export const FEATURE_TOKEN_BURNABLE = { + name: "ERC20Burnable", + namespace: "token.burn", + docLinks: { + sdk: "sdk.erc20burnable", + contracts: "IBurnableERC20", + }, + abis: [ERC20Abi, IBurnableERC20Abi], + features: {}, +} as const; export const FEATURE_TOKEN_SIGNATURE_MINTABLE = { name: "ERC20SignatureMintable", @@ -47,6 +59,7 @@ export const FEATURE_TOKEN = { }, abis: [ERC20Abi], features: { + [FEATURE_TOKEN_BURNABLE.name]: FEATURE_TOKEN_BURNABLE, [FEATURE_TOKEN_MINTABLE.name]: FEATURE_TOKEN_MINTABLE, [FEATURE_TOKEN_SIGNATURE_MINTABLE.name]: FEATURE_TOKEN_SIGNATURE_MINTABLE, }, diff --git a/src/constants/erc721-features.ts b/src/constants/erc721-features.ts index a6357025d..053bec77e 100644 --- a/src/constants/erc721-features.ts +++ b/src/constants/erc721-features.ts @@ -7,6 +7,18 @@ import DelayedRevealAbi from "../../abis/DelayedReveal.json"; import LazyMintAbi from "../../abis/ILazyMint.json"; import IDropSinglePhase from "../../abis/IDropSinglePhase.json"; import SignatureMintERC721Abi from "../../abis/SignatureMintERC721.json"; +import IBurnableERC721Abi from "../../abis/IBurnableERC721.json"; + +export const FEATURE_NFT_BURNABLE = { + name: "ERC721Burnable", + namespace: "nft.burn", + docLinks: { + sdk: "sdk.erc721burnable", + contracts: "IBurnableERC721", + }, + abis: [Erc721Abi, IBurnableERC721Abi], + features: {}, +} as const; export const FEATURE_NFT_REVEALABLE = { name: "ERC721Revealable", @@ -113,6 +125,7 @@ export const FEATURE_NFT = { }, abis: [Erc721Abi], features: { + [FEATURE_NFT_BURNABLE.name]: FEATURE_NFT_BURNABLE, [FEATURE_NFT_SUPPLY.name]: FEATURE_NFT_SUPPLY, [FEATURE_NFT_MINTABLE.name]: FEATURE_NFT_MINTABLE, [FEATURE_NFT_DROPPABLE.name]: FEATURE_NFT_DROPPABLE, diff --git a/src/core/classes/erc-20-burnable.ts b/src/core/classes/erc-20-burnable.ts new file mode 100644 index 000000000..39cedfa56 --- /dev/null +++ b/src/core/classes/erc-20-burnable.ts @@ -0,0 +1,14 @@ +import { IBurnableERC20 } from "contracts/IBurnableERC20"; +import { FEATURE_TOKEN_BURNABLE } from "../../constants/erc20-features"; +import { DetectableFeature } from "../interfaces/DetectableFeature"; +import { ContractWrapper } from "./contract-wrapper"; + +export class Erc20Burnable implements DetectableFeature { + featureName = FEATURE_TOKEN_BURNABLE.name; + + private contractWrapper: ContractWrapper; + + constructor(contractWrapper: ContractWrapper) { + this.contractWrapper = contractWrapper; + } +} From 1fadc105129f4aecf9de208dec3cd199690ef6c2 Mon Sep 17 00:00:00 2001 From: adam-maj Date: Wed, 10 Aug 2022 12:04:45 -0400 Subject: [PATCH 2/6] Add burnable interfaces --- src/core/classes/erc-1155-burnable.ts | 138 ++++++++++++++++++++++++++ src/core/classes/erc-1155.ts | 16 +++ src/core/classes/erc-20-burnable.ts | 56 ++++++++++- src/core/classes/erc-20.ts | 22 +++- src/core/classes/erc-721-burnable.ts | 35 +++++++ src/core/classes/erc-721.ts | 16 +++ src/core/classes/index.ts | 5 + 7 files changed, 286 insertions(+), 2 deletions(-) create mode 100644 src/core/classes/erc-1155-burnable.ts create mode 100644 src/core/classes/erc-721-burnable.ts diff --git a/src/core/classes/erc-1155-burnable.ts b/src/core/classes/erc-1155-burnable.ts new file mode 100644 index 000000000..f61025796 --- /dev/null +++ b/src/core/classes/erc-1155-burnable.ts @@ -0,0 +1,138 @@ +import { IBurnableERC1155 } from "contracts/IBurnableERC1155"; +import { BigNumberish } from "ethers"; +import { FEATURE_EDITION_BURNABLE } from "../../constants/erc1155-features"; +import { DetectableFeature } from "../interfaces/DetectableFeature"; +import { TransactionResult } from "../types"; +import { ContractWrapper } from "./contract-wrapper"; + +export class Erc1155Burnable implements DetectableFeature { + featureName = FEATURE_EDITION_BURNABLE.name; + + private contractWrapper: ContractWrapper; + + constructor(contractWrapper: ContractWrapper) { + this.contractWrapper = contractWrapper; + } + + /** + * Burn a specified amount of a NFTs + * + * @remarks Burn the specified NFTs from the connected wallet + * + * @param tokenId - the token Id to burn + * @param amount - amount to burn + * + * @example + * ```javascript + * // The token ID to burn NFTs of + * const tokenId = 0; + * // The amount of the NFT you want to burn + * const amount = 2; + * + * const result = await contract.edition.burn.fromSelf(tokenId, amount); + * ``` + */ + public async fromSelf( + tokenId: BigNumberish, + amount: BigNumberish, + ): Promise { + const account = await this.contractWrapper.getSignerAddress(); + return this.from(account, tokenId, amount); + } + + /** + * Burn a specified amount of a NFTs + * + * @remarks Burn the specified NFTs from a specified wallet + * + * @param account - the address to burn NFTs from + * @param tokenId - the tokenId to burn + * @param amount - amount to burn + * + * @example + * ```javascript + * // The address of the wallet to burn NFTS from + * const account = "0x..."; + * // The token ID to burn NFTs of + * const tokenId = 0; + * // The amount of this NFT you want to burn + * const amount = 2; + * + * const result = await contract.edition.burn.from(account, tokenId, amount); + * ``` + */ + public async from( + account: string, + tokenId: BigNumberish, + amount: BigNumberish, + ): Promise { + return { + receipt: await this.contractWrapper.sendTransaction("burn", [ + account, + tokenId, + amount, + ]), + }; + } + + /** + * Burn a batch of NFTs + * + * @remarks Burn the batch NFTs from the connected wallet + * + * @param tokenIds - the tokenIds to burn + * @param amounts - amount of each token to burn + * + * @example + * ```javascript + * // The token IDs to burn NFTs of + * const tokenIds = [0, 1]; + * // The amounts of each NFT you want to burn + * const amounts = [2, 2]; + * + * const result = await contract.edition.burn.batchFromSelf(tokenIds, amounts); + * ``` + */ + public async batchFromSelf( + tokenIds: BigNumberish[], + amounts: BigNumberish[], + ): Promise { + const account = await this.contractWrapper.getSignerAddress(); + return this.batchFrom(account, tokenIds, amounts); + } + + /** + * Burn a batch of NFTs + * + * @remarks Burn the batch NFTs from the specified wallet + * + * @param account - the address to burn NFTs from + * @param tokenIds - the tokenIds to burn + * @param amounts - amount of each token to burn + * + * @example + * ```javascript + * // The address of the wallet to burn NFTS from + * const account = "0x..."; + * // The token IDs to burn NFTs of + * const tokenIds = [0, 1]; + * // The amounts of each NFT you want to burn + * const amounts = [2, 2]; + * + * const result = await contract.edition.burn.batchFrom(account, tokenIds, amounts); + * ``` + */ + public async batchFrom( + account: string, + tokenIds: BigNumberish[], + amounts: BigNumberish[], + ): Promise { + return { + receipt: await this.contractWrapper.sendTransaction("burnBatch", [ + account, + tokenIds, + amounts, + ]), + }; + } +} diff --git a/src/core/classes/erc-1155.ts b/src/core/classes/erc-1155.ts index 87fa2b599..cb82950e9 100644 --- a/src/core/classes/erc-1155.ts +++ b/src/core/classes/erc-1155.ts @@ -1,6 +1,7 @@ import { ContractWrapper } from "./contract-wrapper"; import { DropERC1155, + IBurnableERC1155, IERC1155Enumerable, IMintableERC1155, TokenERC1155, @@ -34,6 +35,7 @@ import { FEATURE_EDITION } from "../../constants/erc1155-features"; import { DetectableFeature } from "../interfaces/DetectableFeature"; import { Erc1155SignatureMintable } from "./erc-1155-signature-mintable"; import { Erc1155Droppable } from "./erc-1155-droppable"; +import { Erc1155Burnable } from "../.."; /** * Standard ERC1155 NFT functions @@ -54,6 +56,7 @@ export class Erc1155< featureName = FEATURE_EDITION.name; public query: Erc1155Enumerable | undefined; public mint: Erc1155Mintable | undefined; + public burn: Erc1155Burnable | undefined; public drop: Erc1155Droppable | undefined; public signature: Erc1155SignatureMintable | undefined; protected contractWrapper: ContractWrapper; @@ -78,6 +81,7 @@ export class Erc1155< } this.query = this.detectErc1155Enumerable(); this.mint = this.detectErc1155Mintable(); + this.burn = this.detectErc1155Burnable(); this.drop = this.detectErc1155Droppable(); this.signature = this.detectErc1155SignatureMintable(); } @@ -347,6 +351,18 @@ export class Erc1155< return undefined; } + private detectErc1155Burnable(): Erc1155Burnable | undefined { + if ( + detectContractFeature( + this.contractWrapper, + "ERC1155Burnable", + ) + ) { + return new Erc1155Burnable(this.contractWrapper); + } + return undefined; + } + private detectErc1155Droppable(): Erc1155Droppable | undefined { if ( detectContractFeature( diff --git a/src/core/classes/erc-20-burnable.ts b/src/core/classes/erc-20-burnable.ts index 39cedfa56..a0526c524 100644 --- a/src/core/classes/erc-20-burnable.ts +++ b/src/core/classes/erc-20-burnable.ts @@ -1,14 +1,68 @@ import { IBurnableERC20 } from "contracts/IBurnableERC20"; import { FEATURE_TOKEN_BURNABLE } from "../../constants/erc20-features"; +import { Amount } from "../../types/currency"; import { DetectableFeature } from "../interfaces/DetectableFeature"; +import { TransactionResult } from "../types"; import { ContractWrapper } from "./contract-wrapper"; +import { Erc20 } from "./erc-20"; export class Erc20Burnable implements DetectableFeature { featureName = FEATURE_TOKEN_BURNABLE.name; + private erc20: Erc20; private contractWrapper: ContractWrapper; - constructor(contractWrapper: ContractWrapper) { + constructor(erc20: Erc20, contractWrapper: ContractWrapper) { + this.erc20 = erc20; this.contractWrapper = contractWrapper; } + + /** + * Burn Tokens + * + * @remarks Burn tokens held by the connected wallet + * + * @example + * ```javascript + * // The amount of this token you want to burn + * const amount = 1.2; + * + * await contract.token.burn.fromSelf(amount); + * ``` + */ + public async fromSelf(amount: Amount): Promise { + return { + receipt: await this.contractWrapper.sendTransaction("burn", [ + await this.erc20.normalizeAmount(amount), + ]), + }; + } + + /** + * Burn Tokens + * + * @remarks Burn tokens held by the specified wallet + * + * @example + * ```javascript + * // Address of the wallet sending the tokens + * const holderAddress = "{{wallet_address}}"; + * + * // The amount of this token you want to burn + * const amount = 1.2; + * + * await contract.token.burn.from(holderAddress, amount); + * ``` + */ + public async from( + holder: string, + amount: Amount, + ): Promise { + return { + receipt: await this.contractWrapper.sendTransaction("burnFrom", [ + holder, + await this.erc20.normalizeAmount(amount), + ]), + }; + } } diff --git a/src/core/classes/erc-20.ts b/src/core/classes/erc-20.ts index d4abf28b2..036cc443a 100644 --- a/src/core/classes/erc-20.ts +++ b/src/core/classes/erc-20.ts @@ -1,5 +1,10 @@ import { ContractWrapper } from "./contract-wrapper"; -import { DropERC20, IMintableERC20, TokenERC20 } from "contracts"; +import { + DropERC20, + IBurnableERC20, + IMintableERC20, + TokenERC20, +} from "contracts"; import { BigNumber, BigNumberish, ethers } from "ethers"; import { IStorage } from "../interfaces"; import { NetworkOrSignerOrProvider, TransactionResult } from "../types"; @@ -18,6 +23,7 @@ import { Erc20Mintable } from "./erc-20-mintable"; import { FEATURE_TOKEN } from "../../constants/erc20-features"; import { DetectableFeature } from "../interfaces/DetectableFeature"; import { Erc20SignatureMintable } from "./erc-20-signature-mintable"; +import { Erc20Burnable } from "./erc-20-burnable"; /** * Standard ERC20 Token functions @@ -40,6 +46,7 @@ export class Erc20< * Mint tokens */ public mint: Erc20Mintable | undefined; + public burn: Erc20Burnable | undefined; public signature: Erc20SignatureMintable | undefined; protected contractWrapper: ContractWrapper; protected storage: IStorage; @@ -62,6 +69,7 @@ export class Erc20< this.options = SDKOptionsSchema.parse({}); } this.mint = this.detectErc20Mintable(); + this.burn = this.detectErc20Burnable(); this.signature = this.detectErc20SignatureMintable(); } @@ -347,6 +355,18 @@ export class Erc20< return undefined; } + private detectErc20Burnable(): Erc20Burnable | undefined { + if ( + detectContractFeature( + this.contractWrapper, + "ERC20Burnable", + ) + ) { + return new Erc20Burnable(this, this.contractWrapper); + } + return undefined; + } + private detectErc20SignatureMintable(): Erc20SignatureMintable | undefined { if ( detectContractFeature( diff --git a/src/core/classes/erc-721-burnable.ts b/src/core/classes/erc-721-burnable.ts new file mode 100644 index 000000000..738e1287c --- /dev/null +++ b/src/core/classes/erc-721-burnable.ts @@ -0,0 +1,35 @@ +import { IBurnableERC721 } from "contracts/IBurnableERC721"; +import { BigNumberish } from "ethers"; +import { FEATURE_NFT_BURNABLE } from "../../constants/erc721-features"; +import { DetectableFeature } from "../interfaces/DetectableFeature"; +import { TransactionResult } from "../types"; +import { ContractWrapper } from "./contract-wrapper"; + +export class Erc721Burnable implements DetectableFeature { + featureName = FEATURE_NFT_BURNABLE.name; + + private contractWrapper: ContractWrapper; + + constructor(contractWrapper: ContractWrapper) { + this.contractWrapper = contractWrapper; + } + + /** + * Burn NFTs + * + * @remarks Burn NFTs held by the connected wallet + * + * @example + * ```javascript + * // The token ID of the NFT you want to burn + * const tokenId = 0; + * + * await contract.nft.burn.fromSelf(tokenId); + * ``` + */ + public async fromSelf(tokenId: BigNumberish): Promise { + return { + receipt: await this.contractWrapper.sendTransaction("burn", [tokenId]), + }; + } +} diff --git a/src/core/classes/erc-721.ts b/src/core/classes/erc-721.ts index b7a49ddec..6a6283ee2 100644 --- a/src/core/classes/erc-721.ts +++ b/src/core/classes/erc-721.ts @@ -13,6 +13,7 @@ import { } from "../../common"; import { DropERC721, + IBurnableERC721, IERC721Supply, IMintableERC721, ISignatureMintERC721, @@ -27,6 +28,7 @@ import { FEATURE_NFT } from "../../constants/erc721-features"; import { DetectableFeature } from "../interfaces/DetectableFeature"; import { Erc721Droppable } from "./erc-721-droppable"; import { Erc721WithQuantitySignatureMintable } from "./erc-721-with-quantity-signature-mintable"; +import { Erc721Burnable } from "../.."; /** * Standard ERC721 NFT functions @@ -50,6 +52,7 @@ export class Erc721< featureName = FEATURE_NFT.name; public query: Erc721Supply | undefined; public mint: Erc721Mintable | undefined; + public burn: Erc721Burnable | undefined; public drop: Erc721Droppable | undefined; public signature: Erc721WithQuantitySignatureMintable | undefined; protected contractWrapper: ContractWrapper; @@ -74,6 +77,7 @@ export class Erc721< } this.query = this.detectErc721Enumerable(); this.mint = this.detectErc721Mintable(); + this.burn = this.detectErc721Burnable(); this.drop = this.detectErc721Droppable(); this.signature = this.detectErc721SignatureMintable(); } @@ -280,6 +284,18 @@ export class Erc721< return undefined; } + private detectErc721Burnable(): Erc721Burnable | undefined { + if ( + detectContractFeature( + this.contractWrapper, + "ERC721Burnable", + ) + ) { + return new Erc721Burnable(this.contractWrapper); + } + return undefined; + } + private detectErc721Droppable(): Erc721Droppable | undefined { if ( detectContractFeature( diff --git a/src/core/classes/index.ts b/src/core/classes/index.ts index 6196b5f40..c25b03ca6 100644 --- a/src/core/classes/index.ts +++ b/src/core/classes/index.ts @@ -14,6 +14,7 @@ export * from "./erc-20-mintable"; export * from "./erc-20-batch-mintable"; export * from "./erc-20-history"; export * from "./erc-20-signature-mintable"; +export * from "./erc-20-burnable"; export * from "./erc-721"; export * from "./erc-721-droppable"; export * from "./erc-721-claimable"; @@ -22,11 +23,15 @@ export * from "./erc-721-supply"; export * from "./erc-721-enumerable"; export * from "./erc-721-mintable"; export * from "./erc-721-batch-mintable"; +export * from "./erc-721-burnable"; +export * from "./erc-721-droppable"; export * from "./erc-1155"; export * from "./erc-1155-enumerable"; export * from "./erc-1155-mintable"; export * from "./erc-1155-batch-mintable"; export * from "./erc-1155-signature-mintable"; +export * from "./erc-1155-burnable"; +export * from "./erc-1155-droppable"; export * from "./marketplace-direct"; export * from "./marketplace-auction"; export * from "./contract-deployer"; From bb9c68feb19394d62441f7ef8e1acaf92cda81c6 Mon Sep 17 00:00:00 2001 From: adam-maj Date: Wed, 10 Aug 2022 13:50:16 -0400 Subject: [PATCH 3/6] Replace burn functions with burnable interface and update documentation --- docs/feature_snippets.json | 136 ++++++++++++++++++ ...on.burn.md => sdk.edition.burnfromself.md} | 8 +- docs/sdk.edition.md | 2 +- ...urn.md => sdk.editiondrop.burnfromself.md} | 8 +- docs/sdk.editiondrop.md | 2 +- docs/sdk.erc1155.burn.md | 11 ++ docs/sdk.erc1155.md | 3 +- docs/sdk.erc1155burnable._constructor_.md | 20 +++ docs/sdk.erc1155burnable.batchfrom.md | 44 ++++++ docs/sdk.erc1155burnable.batchfromself.md | 41 ++++++ docs/sdk.erc1155burnable.featurename.md | 11 ++ docs/sdk.erc1155burnable.from.md | 44 ++++++ docs/sdk.erc1155burnable.fromself.md | 41 ++++++ docs/sdk.erc1155burnable.md | 34 +++++ docs/sdk.erc1155droppable._constructor_.md | 22 +++ docs/sdk.erc1155droppable.featurename.md | 11 ++ docs/sdk.erc1155droppable.lazymint.md | 51 +++++++ docs/sdk.erc1155droppable.md | 31 ++++ docs/sdk.erc20.burn.md | 11 ++ docs/sdk.erc20.md | 1 + docs/sdk.erc20burnable._constructor_.md | 21 +++ docs/sdk.erc20burnable.featurename.md | 11 ++ docs/sdk.erc20burnable.from.md | 42 ++++++ docs/sdk.erc20burnable.fromself.md | 38 +++++ docs/sdk.erc20burnable.md | 32 +++++ docs/sdk.erc721.burn.md | 11 ++ docs/sdk.erc721.md | 1 + docs/sdk.erc721burnable._constructor_.md | 20 +++ docs/sdk.erc721burnable.featurename.md | 11 ++ docs/sdk.erc721burnable.fromself.md | 38 +++++ docs/sdk.erc721burnable.md | 31 ++++ docs/sdk.md | 4 + ...n.md => sdk.nftcollection.burnfromself.md} | 8 +- docs/sdk.nftcollection.md | 2 +- ...op.burn.md => sdk.nftdrop.burnfromself.md} | 8 +- docs/sdk.nftdrop.md | 2 +- ...n.md => sdk.signaturedrop.burnfromself.md} | 8 +- docs/sdk.signaturedrop.md | 2 +- ...oken.burn.md => sdk.token.burnfromself.md} | 8 +- docs/sdk.token.md | 2 +- ....burn.md => sdk.tokendrop.burnfromself.md} | 8 +- docs/sdk.tokendrop.md | 2 +- docs/snippets.json | 62 ++++---- etc/sdk.api.md | 64 +++++++-- src/contracts/edition-drop.ts | 15 +- src/contracts/edition.ts | 15 +- src/contracts/nft-collection.ts | 10 +- src/contracts/nft-drop.ts | 10 +- src/contracts/signature-drop.ts | 10 +- src/contracts/token-drop.ts | 20 +-- src/contracts/token.ts | 19 +-- src/core/classes/erc-1155.ts | 2 +- src/core/classes/erc-721.ts | 2 +- test/custom.test.ts | 64 +++++++++ 54 files changed, 996 insertions(+), 139 deletions(-) rename docs/{sdk.edition.burn.md => sdk.edition.burnfromself.md} (63%) rename docs/{sdk.editiondrop.burn.md => sdk.editiondrop.burnfromself.md} (62%) create mode 100644 docs/sdk.erc1155.burn.md create mode 100644 docs/sdk.erc1155burnable._constructor_.md create mode 100644 docs/sdk.erc1155burnable.batchfrom.md create mode 100644 docs/sdk.erc1155burnable.batchfromself.md create mode 100644 docs/sdk.erc1155burnable.featurename.md create mode 100644 docs/sdk.erc1155burnable.from.md create mode 100644 docs/sdk.erc1155burnable.fromself.md create mode 100644 docs/sdk.erc1155burnable.md create mode 100644 docs/sdk.erc1155droppable._constructor_.md create mode 100644 docs/sdk.erc1155droppable.featurename.md create mode 100644 docs/sdk.erc1155droppable.lazymint.md create mode 100644 docs/sdk.erc1155droppable.md create mode 100644 docs/sdk.erc20.burn.md create mode 100644 docs/sdk.erc20burnable._constructor_.md create mode 100644 docs/sdk.erc20burnable.featurename.md create mode 100644 docs/sdk.erc20burnable.from.md create mode 100644 docs/sdk.erc20burnable.fromself.md create mode 100644 docs/sdk.erc20burnable.md create mode 100644 docs/sdk.erc721.burn.md create mode 100644 docs/sdk.erc721burnable._constructor_.md create mode 100644 docs/sdk.erc721burnable.featurename.md create mode 100644 docs/sdk.erc721burnable.fromself.md create mode 100644 docs/sdk.erc721burnable.md rename docs/{sdk.nftcollection.burn.md => sdk.nftcollection.burnfromself.md} (61%) rename docs/{sdk.nftdrop.burn.md => sdk.nftdrop.burnfromself.md} (63%) rename docs/{sdk.signaturedrop.burn.md => sdk.signaturedrop.burnfromself.md} (60%) rename docs/{sdk.token.burn.md => sdk.token.burnfromself.md} (70%) rename docs/{sdk.tokendrop.burn.md => sdk.tokendrop.burnfromself.md} (69%) diff --git a/docs/feature_snippets.json b/docs/feature_snippets.json index b2390de9b..9ed24bffd 100644 --- a/docs/feature_snippets.json +++ b/docs/feature_snippets.json @@ -237,6 +237,85 @@ "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155BatchMintable" } }, + "ERC1155Burnable": { + "name": "Erc1155Burnable", + "summary": "", + "remarks": null, + "examples": {}, + "methods": [ + { + "name": "batchFrom", + "summary": "Burn a batch of NFTs\n\n", + "remarks": "\n\nBurn the batch NFTs from the specified wallet\n\n", + "examples": { + "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);" + }, + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.batchFrom" + } + }, + { + "name": "batchFromSelf", + "summary": "Burn a batch of NFTs\n\n", + "remarks": "\n\nBurn the batch NFTs from the connected wallet\n\n", + "examples": { + "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.batchFromSelf(tokenIds, amounts);" + }, + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.batchFromSelf" + } + }, + { + "name": "from", + "summary": "Burn a specified amount of a NFTs\n\n", + "remarks": "\n\nBurn the specified NFTs from a specified wallet\n\n", + "examples": { + "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);" + }, + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.from" + } + }, + { + "name": "fromSelf", + "summary": "Burn a specified amount of a NFTs\n\n", + "remarks": "\n\nBurn the specified NFTs from the connected wallet\n\n", + "examples": { + "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.fromSelf(tokenId, amount);" + }, + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.fromSelf" + } + } + ], + "properties": [], + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable" + } + }, + "ERC1155Droppable": { + "name": "Erc1155Droppable", + "summary": "", + "remarks": null, + "examples": {}, + "methods": [ + { + "name": "lazyMint", + "summary": "Create a batch of NFTs to be claimed in the future\n\n", + "remarks": "\n\nCreate batch allows you to create a batch of many NFTs in one transaction.\n\n", + "examples": { + "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" + }, + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Droppable.lazyMint" + } + } + ], + "properties": [], + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Droppable" + } + }, "ERC1155Enumerable": { "name": "Erc1155Enumerable", "summary": "List ERC1155 NFTs\n\n", @@ -492,6 +571,40 @@ "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc20BatchMintable" } }, + "ERC20Burnable": { + "name": "Erc20Burnable", + "summary": "", + "remarks": null, + "examples": {}, + "methods": [ + { + "name": "from", + "summary": "Burn Tokens\n\n", + "remarks": "\n\nBurn tokens held by the specified wallet\n\n", + "examples": { + "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);" + }, + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc20Burnable.from" + } + }, + { + "name": "fromSelf", + "summary": "Burn Tokens\n\n", + "remarks": "\n\nBurn tokens held by the connected wallet\n\n", + "examples": { + "javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.token.burn.fromSelf(amount);" + }, + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc20Burnable.fromSelf" + } + } + ], + "properties": [], + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc20Burnable" + } + }, "ERC20Mintable": { "name": "Erc20Mintable", "summary": "Mint ERC20 Tokens\n\n", @@ -623,6 +736,29 @@ "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc721BatchMintable" } }, + "ERC721Burnable": { + "name": "Erc721Burnable", + "summary": "", + "remarks": null, + "examples": {}, + "methods": [ + { + "name": "fromSelf", + "summary": "Burn NFTs\n\n", + "remarks": "\n\nBurn NFTs held by the connected wallet\n\n", + "examples": { + "javascript": "// The token ID of the NFT you want to burn\nconst tokenId = 0;\n\nawait contract.nft.burn.fromSelf(tokenId);" + }, + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc721Burnable.fromSelf" + } + } + ], + "properties": [], + "reference": { + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc721Burnable" + } + }, "ERC721Claimable": { "name": "Erc721Claimable", "summary": "Lazily mint and claim ERC721 NFTs\n\n", diff --git a/docs/sdk.edition.burn.md b/docs/sdk.edition.burnfromself.md similarity index 63% rename from docs/sdk.edition.burn.md rename to docs/sdk.edition.burnfromself.md index 2681be581..83c818989 100644 --- a/docs/sdk.edition.burn.md +++ b/docs/sdk.edition.burnfromself.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Edition](./sdk.edition.md) > [burn](./sdk.edition.burn.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Edition](./sdk.edition.md) > [burnFromSelf](./sdk.edition.burnfromself.md) -## Edition.burn() method +## Edition.burnFromSelf() method Burn a specified amount of a NFT Signature: ```typescript -burn(tokenId: BigNumberish, amount: BigNumberish): Promise; +burnFromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; ``` ## Parameters @@ -27,6 +27,6 @@ Promise<[TransactionResult](./sdk.transactionresult.md)> ```javascript -const result = await contract.burn(tokenId, amount); +const result = await contract.burnFromSelf(tokenId, amount); ``` diff --git a/docs/sdk.edition.md b/docs/sdk.edition.md index ac7a60262..05511451d 100644 --- a/docs/sdk.edition.md +++ b/docs/sdk.edition.md @@ -50,7 +50,7 @@ const contract = sdk.getEdition("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burn(tokenId, amount)](./sdk.edition.burn.md) | | Burn a specified amount of a NFT | +| [burnFromSelf(tokenId, amount)](./sdk.edition.burnfromself.md) | | Burn a specified amount of a NFT | | [getAll(queryParams)](./sdk.edition.getall.md) | | Get All Minted NFTs | | [getOwned(walletAddress)](./sdk.edition.getowned.md) | | Get Owned NFTs | | [getTotalCount()](./sdk.edition.gettotalcount.md) | | Get the number of NFTs minted | diff --git a/docs/sdk.editiondrop.burn.md b/docs/sdk.editiondrop.burnfromself.md similarity index 62% rename from docs/sdk.editiondrop.burn.md rename to docs/sdk.editiondrop.burnfromself.md index 60be8ebdd..6d29aaa71 100644 --- a/docs/sdk.editiondrop.burn.md +++ b/docs/sdk.editiondrop.burnfromself.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [EditionDrop](./sdk.editiondrop.md) > [burn](./sdk.editiondrop.burn.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [EditionDrop](./sdk.editiondrop.md) > [burnFromSelf](./sdk.editiondrop.burnfromself.md) -## EditionDrop.burn() method +## EditionDrop.burnFromSelf() method Burn a specified amount of a NFT Signature: ```typescript -burn(tokenId: BigNumberish, amount: BigNumberish): Promise; +burnFromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; ``` ## Parameters @@ -27,6 +27,6 @@ Promise<[TransactionResult](./sdk.transactionresult.md)> ```javascript -const result = await contract.burn(tokenId, amount); +const result = await contract.burnFromSelf(tokenId, amount); ``` diff --git a/docs/sdk.editiondrop.md b/docs/sdk.editiondrop.md index 0ac7dba02..0f011b7a4 100644 --- a/docs/sdk.editiondrop.md +++ b/docs/sdk.editiondrop.md @@ -51,7 +51,7 @@ const contract = sdk.getEditionDrop("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burn(tokenId, amount)](./sdk.editiondrop.burn.md) | | Burn a specified amount of a NFT | +| [burnFromSelf(tokenId, amount)](./sdk.editiondrop.burnfromself.md) | | Burn a specified amount of a NFT | | [claim(tokenId, quantity, checkERC20Allowance)](./sdk.editiondrop.claim.md) | | Claim a token to the connected wallet | | [claimTo(destinationAddress, tokenId, quantity, checkERC20Allowance)](./sdk.editiondrop.claimto.md) | | Claim NFTs to a specific Wallet | | [createBatch(metadatas, options)](./sdk.editiondrop.createbatch.md) | | Create a batch of NFTs to be claimed in the future | diff --git a/docs/sdk.erc1155.burn.md b/docs/sdk.erc1155.burn.md new file mode 100644 index 000000000..260198229 --- /dev/null +++ b/docs/sdk.erc1155.burn.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155](./sdk.erc1155.md) > [burn](./sdk.erc1155.burn.md) + +## Erc1155.burn property + +Signature: + +```typescript +burn: Erc1155Burnable | undefined; +``` diff --git a/docs/sdk.erc1155.md b/docs/sdk.erc1155.md index 4baf37206..1ffbc60d3 100644 --- a/docs/sdk.erc1155.md +++ b/docs/sdk.erc1155.md @@ -35,8 +35,9 @@ await contract.edition.transfer(walletAddress, tokenId, quantity); | Property | Modifiers | Type | Description | | --- | --- | --- | --- | +| [burn](./sdk.erc1155.burn.md) | | [Erc1155Burnable](./sdk.erc1155burnable.md) \| undefined | | | [contractWrapper](./sdk.erc1155.contractwrapper.md) | | ContractWrapper<T> | | -| [drop](./sdk.erc1155.drop.md) | | Erc1155Droppable \| undefined | | +| [drop](./sdk.erc1155.drop.md) | | [Erc1155Droppable](./sdk.erc1155droppable.md) \| undefined | | | [featureName](./sdk.erc1155.featurename.md) | | "ERC1155" | | | [mint](./sdk.erc1155.mint.md) | | [Erc1155Mintable](./sdk.erc1155mintable.md) \| undefined | | | [options](./sdk.erc1155.options.md) | | [SDKOptions](./sdk.sdkoptions.md) | | diff --git a/docs/sdk.erc1155burnable._constructor_.md b/docs/sdk.erc1155burnable._constructor_.md new file mode 100644 index 000000000..788ad5284 --- /dev/null +++ b/docs/sdk.erc1155burnable._constructor_.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Burnable](./sdk.erc1155burnable.md) > [(constructor)](./sdk.erc1155burnable._constructor_.md) + +## Erc1155Burnable.(constructor) + +Constructs a new instance of the `Erc1155Burnable` class + +Signature: + +```typescript +constructor(contractWrapper: ContractWrapper); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| contractWrapper | ContractWrapper<IBurnableERC1155> | | + diff --git a/docs/sdk.erc1155burnable.batchfrom.md b/docs/sdk.erc1155burnable.batchfrom.md new file mode 100644 index 000000000..ced68db31 --- /dev/null +++ b/docs/sdk.erc1155burnable.batchfrom.md @@ -0,0 +1,44 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Burnable](./sdk.erc1155burnable.md) > [batchFrom](./sdk.erc1155burnable.batchfrom.md) + +## Erc1155Burnable.batchFrom() method + +Burn a batch of NFTs + +Signature: + +```typescript +batchFrom(account: string, tokenIds: BigNumberish[], amounts: BigNumberish[]): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| account | string | the address to burn NFTs from | +| tokenIds | BigNumberish\[\] | the tokenIds to burn | +| amounts | BigNumberish\[\] | amount of each token to burn | + +Returns: + +Promise<[TransactionResult](./sdk.transactionresult.md)> + +## Remarks + +Burn the batch NFTs from the specified wallet + +## Example + + +```javascript +// The address of the wallet to burn NFTS from +const account = "0x..."; +// The token IDs to burn NFTs of +const tokenIds = [0, 1]; +// The amounts of each NFT you want to burn +const amounts = [2, 2]; + +const result = await contract.edition.burn.batchFrom(account, tokenIds, amounts); +``` + diff --git a/docs/sdk.erc1155burnable.batchfromself.md b/docs/sdk.erc1155burnable.batchfromself.md new file mode 100644 index 000000000..296ac669a --- /dev/null +++ b/docs/sdk.erc1155burnable.batchfromself.md @@ -0,0 +1,41 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Burnable](./sdk.erc1155burnable.md) > [batchFromSelf](./sdk.erc1155burnable.batchfromself.md) + +## Erc1155Burnable.batchFromSelf() method + +Burn a batch of NFTs + +Signature: + +```typescript +batchFromSelf(tokenIds: BigNumberish[], amounts: BigNumberish[]): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| tokenIds | BigNumberish\[\] | the tokenIds to burn | +| amounts | BigNumberish\[\] | amount of each token to burn | + +Returns: + +Promise<[TransactionResult](./sdk.transactionresult.md)> + +## Remarks + +Burn the batch NFTs from the connected wallet + +## Example + + +```javascript +// The token IDs to burn NFTs of +const tokenIds = [0, 1]; +// The amounts of each NFT you want to burn +const amounts = [2, 2]; + +const result = await contract.edition.burn.batchFromSelf(tokenIds, amounts); +``` + diff --git a/docs/sdk.erc1155burnable.featurename.md b/docs/sdk.erc1155burnable.featurename.md new file mode 100644 index 000000000..c3b8fa9e9 --- /dev/null +++ b/docs/sdk.erc1155burnable.featurename.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Burnable](./sdk.erc1155burnable.md) > [featureName](./sdk.erc1155burnable.featurename.md) + +## Erc1155Burnable.featureName property + +Signature: + +```typescript +featureName: "ERC1155Burnable"; +``` diff --git a/docs/sdk.erc1155burnable.from.md b/docs/sdk.erc1155burnable.from.md new file mode 100644 index 000000000..9eddeca02 --- /dev/null +++ b/docs/sdk.erc1155burnable.from.md @@ -0,0 +1,44 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Burnable](./sdk.erc1155burnable.md) > [from](./sdk.erc1155burnable.from.md) + +## Erc1155Burnable.from() method + +Burn a specified amount of a NFTs + +Signature: + +```typescript +from(account: string, tokenId: BigNumberish, amount: BigNumberish): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| account | string | the address to burn NFTs from | +| tokenId | BigNumberish | the tokenId to burn | +| amount | BigNumberish | amount to burn | + +Returns: + +Promise<[TransactionResult](./sdk.transactionresult.md)> + +## Remarks + +Burn the specified NFTs from a specified wallet + +## Example + + +```javascript +// The address of the wallet to burn NFTS from +const account = "0x..."; +// The token ID to burn NFTs of +const tokenId = 0; +// The amount of this NFT you want to burn +const amount = 2; + +const result = await contract.edition.burn.from(account, tokenId, amount); +``` + diff --git a/docs/sdk.erc1155burnable.fromself.md b/docs/sdk.erc1155burnable.fromself.md new file mode 100644 index 000000000..a35927a33 --- /dev/null +++ b/docs/sdk.erc1155burnable.fromself.md @@ -0,0 +1,41 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Burnable](./sdk.erc1155burnable.md) > [fromSelf](./sdk.erc1155burnable.fromself.md) + +## Erc1155Burnable.fromSelf() method + +Burn a specified amount of a NFTs + +Signature: + +```typescript +fromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| tokenId | BigNumberish | the token Id to burn | +| amount | BigNumberish | amount to burn | + +Returns: + +Promise<[TransactionResult](./sdk.transactionresult.md)> + +## Remarks + +Burn the specified NFTs from the connected wallet + +## Example + + +```javascript +// The token ID to burn NFTs of +const tokenId = 0; +// The amount of the NFT you want to burn +const amount = 2; + +const result = await contract.edition.burn.fromSelf(tokenId, amount); +``` + diff --git a/docs/sdk.erc1155burnable.md b/docs/sdk.erc1155burnable.md new file mode 100644 index 000000000..0d6bca081 --- /dev/null +++ b/docs/sdk.erc1155burnable.md @@ -0,0 +1,34 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Burnable](./sdk.erc1155burnable.md) + +## Erc1155Burnable class + +Signature: + +```typescript +export declare class Erc1155Burnable implements DetectableFeature +``` +Implements: DetectableFeature + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(contractWrapper)](./sdk.erc1155burnable._constructor_.md) | | Constructs a new instance of the Erc1155Burnable class | + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [featureName](./sdk.erc1155burnable.featurename.md) | | "ERC1155Burnable" | | + +## Methods + +| Method | Modifiers | Description | +| --- | --- | --- | +| [batchFrom(account, tokenIds, amounts)](./sdk.erc1155burnable.batchfrom.md) | | Burn a batch of NFTs | +| [batchFromSelf(tokenIds, amounts)](./sdk.erc1155burnable.batchfromself.md) | | Burn a batch of NFTs | +| [from(account, tokenId, amount)](./sdk.erc1155burnable.from.md) | | Burn a specified amount of a NFTs | +| [fromSelf(tokenId, amount)](./sdk.erc1155burnable.fromself.md) | | Burn a specified amount of a NFTs | + diff --git a/docs/sdk.erc1155droppable._constructor_.md b/docs/sdk.erc1155droppable._constructor_.md new file mode 100644 index 000000000..02c17462a --- /dev/null +++ b/docs/sdk.erc1155droppable._constructor_.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Droppable](./sdk.erc1155droppable.md) > [(constructor)](./sdk.erc1155droppable._constructor_.md) + +## Erc1155Droppable.(constructor) + +Constructs a new instance of the `Erc1155Droppable` class + +Signature: + +```typescript +constructor(erc1155: Erc1155, contractWrapper: ContractWrapper, storage: IStorage); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| erc1155 | [Erc1155](./sdk.erc1155.md) | | +| contractWrapper | ContractWrapper<BaseDropERC1155> | | +| storage | [IStorage](./sdk.istorage.md) | | + diff --git a/docs/sdk.erc1155droppable.featurename.md b/docs/sdk.erc1155droppable.featurename.md new file mode 100644 index 000000000..4d8aa5497 --- /dev/null +++ b/docs/sdk.erc1155droppable.featurename.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Droppable](./sdk.erc1155droppable.md) > [featureName](./sdk.erc1155droppable.featurename.md) + +## Erc1155Droppable.featureName property + +Signature: + +```typescript +featureName: "ERC1155Droppable"; +``` diff --git a/docs/sdk.erc1155droppable.lazymint.md b/docs/sdk.erc1155droppable.lazymint.md new file mode 100644 index 000000000..5bcbc5252 --- /dev/null +++ b/docs/sdk.erc1155droppable.lazymint.md @@ -0,0 +1,51 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Droppable](./sdk.erc1155droppable.md) > [lazyMint](./sdk.erc1155droppable.lazymint.md) + +## Erc1155Droppable.lazyMint() method + +Create a batch of NFTs to be claimed in the future + +Signature: + +```typescript +lazyMint(metadatas: NFTMetadataOrUri[], options?: { + onProgress: (event: UploadProgressEvent) => void; + }): Promise[]>; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| metadatas | NFTMetadataOrUri\[\] | The metadata to include in the batch. | +| options | { onProgress: (event: [UploadProgressEvent](./sdk.uploadprogressevent.md)) => void; } | (Optional) optional upload progress callback | + +Returns: + +Promise<[TransactionResultWithId](./sdk.transactionresultwithid.md)<[NFTMetadata](./sdk.nftmetadata.md)>\[\]> + +## Remarks + +Create batch allows you to create a batch of many NFTs in one transaction. + +## Example + + +```javascript +// Custom metadata of the NFTs to create +const metadatas = [{ + name: "Cool NFT", + description: "This is a cool NFT", + image: fs.readFileSync("path/to/image.png"), // This can be an image url or file +}, { + name: "Cool NFT", + description: "This is a cool NFT", + image: fs.readFileSync("path/to/image.png"), +}]; + +const results = await contract.edition.drop.lazyMint(metadatas); // uploads and creates the NFTs on chain +const firstTokenId = results[0].id; // token id of the first created NFT +const firstNFT = await results[0].data(); // (optional) fetch details of the first created NFT +``` + diff --git a/docs/sdk.erc1155droppable.md b/docs/sdk.erc1155droppable.md new file mode 100644 index 000000000..1e730431f --- /dev/null +++ b/docs/sdk.erc1155droppable.md @@ -0,0 +1,31 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Droppable](./sdk.erc1155droppable.md) + +## Erc1155Droppable class + +Signature: + +```typescript +export declare class Erc1155Droppable implements DetectableFeature +``` +Implements: DetectableFeature + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(erc1155, contractWrapper, storage)](./sdk.erc1155droppable._constructor_.md) | | Constructs a new instance of the Erc1155Droppable class | + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [featureName](./sdk.erc1155droppable.featurename.md) | | "ERC1155Droppable" | | + +## Methods + +| Method | Modifiers | Description | +| --- | --- | --- | +| [lazyMint(metadatas, options)](./sdk.erc1155droppable.lazymint.md) | | Create a batch of NFTs to be claimed in the future | + diff --git a/docs/sdk.erc20.burn.md b/docs/sdk.erc20.burn.md new file mode 100644 index 000000000..2e41b1aa4 --- /dev/null +++ b/docs/sdk.erc20.burn.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc20](./sdk.erc20.md) > [burn](./sdk.erc20.burn.md) + +## Erc20.burn property + +Signature: + +```typescript +burn: Erc20Burnable | undefined; +``` diff --git a/docs/sdk.erc20.md b/docs/sdk.erc20.md index ea3c07f70..f44af543f 100644 --- a/docs/sdk.erc20.md +++ b/docs/sdk.erc20.md @@ -35,6 +35,7 @@ await contract.token.transfer(walletAddress, amount); | Property | Modifiers | Type | Description | | --- | --- | --- | --- | +| [burn](./sdk.erc20.burn.md) | | [Erc20Burnable](./sdk.erc20burnable.md) \| undefined | | | [contractWrapper](./sdk.erc20.contractwrapper.md) | | ContractWrapper<T> | | | [featureName](./sdk.erc20.featurename.md) | | "ERC20" | | | [mint](./sdk.erc20.mint.md) | | [Erc20Mintable](./sdk.erc20mintable.md) \| undefined | Mint tokens | diff --git a/docs/sdk.erc20burnable._constructor_.md b/docs/sdk.erc20burnable._constructor_.md new file mode 100644 index 000000000..9c4de042c --- /dev/null +++ b/docs/sdk.erc20burnable._constructor_.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc20Burnable](./sdk.erc20burnable.md) > [(constructor)](./sdk.erc20burnable._constructor_.md) + +## Erc20Burnable.(constructor) + +Constructs a new instance of the `Erc20Burnable` class + +Signature: + +```typescript +constructor(erc20: Erc20, contractWrapper: ContractWrapper); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| erc20 | [Erc20](./sdk.erc20.md) | | +| contractWrapper | ContractWrapper<IBurnableERC20> | | + diff --git a/docs/sdk.erc20burnable.featurename.md b/docs/sdk.erc20burnable.featurename.md new file mode 100644 index 000000000..a4b5531d7 --- /dev/null +++ b/docs/sdk.erc20burnable.featurename.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc20Burnable](./sdk.erc20burnable.md) > [featureName](./sdk.erc20burnable.featurename.md) + +## Erc20Burnable.featureName property + +Signature: + +```typescript +featureName: "ERC20Burnable"; +``` diff --git a/docs/sdk.erc20burnable.from.md b/docs/sdk.erc20burnable.from.md new file mode 100644 index 000000000..4df4688f8 --- /dev/null +++ b/docs/sdk.erc20burnable.from.md @@ -0,0 +1,42 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc20Burnable](./sdk.erc20burnable.md) > [from](./sdk.erc20burnable.from.md) + +## Erc20Burnable.from() method + +Burn Tokens + +Signature: + +```typescript +from(holder: string, amount: Amount): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| holder | string | | +| amount | [Amount](./sdk.amount.md) | | + +Returns: + +Promise<[TransactionResult](./sdk.transactionresult.md)> + +## Remarks + +Burn tokens held by the specified wallet + +## Example + + +```javascript +// Address of the wallet sending the tokens +const holderAddress = "{{wallet_address}}"; + +// The amount of this token you want to burn +const amount = 1.2; + +await contract.token.burn.from(holderAddress, amount); +``` + diff --git a/docs/sdk.erc20burnable.fromself.md b/docs/sdk.erc20burnable.fromself.md new file mode 100644 index 000000000..f0ff5ce87 --- /dev/null +++ b/docs/sdk.erc20burnable.fromself.md @@ -0,0 +1,38 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc20Burnable](./sdk.erc20burnable.md) > [fromSelf](./sdk.erc20burnable.fromself.md) + +## Erc20Burnable.fromSelf() method + +Burn Tokens + +Signature: + +```typescript +fromSelf(amount: Amount): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| amount | [Amount](./sdk.amount.md) | | + +Returns: + +Promise<[TransactionResult](./sdk.transactionresult.md)> + +## Remarks + +Burn tokens held by the connected wallet + +## Example + + +```javascript +// The amount of this token you want to burn +const amount = 1.2; + +await contract.token.burn.fromSelf(amount); +``` + diff --git a/docs/sdk.erc20burnable.md b/docs/sdk.erc20burnable.md new file mode 100644 index 000000000..b6357020d --- /dev/null +++ b/docs/sdk.erc20burnable.md @@ -0,0 +1,32 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc20Burnable](./sdk.erc20burnable.md) + +## Erc20Burnable class + +Signature: + +```typescript +export declare class Erc20Burnable implements DetectableFeature +``` +Implements: DetectableFeature + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(erc20, contractWrapper)](./sdk.erc20burnable._constructor_.md) | | Constructs a new instance of the Erc20Burnable class | + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [featureName](./sdk.erc20burnable.featurename.md) | | "ERC20Burnable" | | + +## Methods + +| Method | Modifiers | Description | +| --- | --- | --- | +| [from(holder, amount)](./sdk.erc20burnable.from.md) | | Burn Tokens | +| [fromSelf(amount)](./sdk.erc20burnable.fromself.md) | | Burn Tokens | + diff --git a/docs/sdk.erc721.burn.md b/docs/sdk.erc721.burn.md new file mode 100644 index 000000000..5a3b01dd4 --- /dev/null +++ b/docs/sdk.erc721.burn.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc721](./sdk.erc721.md) > [burn](./sdk.erc721.burn.md) + +## Erc721.burn property + +Signature: + +```typescript +burn: Erc721Burnable | undefined; +``` diff --git a/docs/sdk.erc721.md b/docs/sdk.erc721.md index 262885553..ee934bd1a 100644 --- a/docs/sdk.erc721.md +++ b/docs/sdk.erc721.md @@ -35,6 +35,7 @@ await contract.nft.transfer(walletAddress, tokenId); | Property | Modifiers | Type | Description | | --- | --- | --- | --- | +| [burn](./sdk.erc721.burn.md) | | [Erc721Burnable](./sdk.erc721burnable.md) \| undefined | | | [contractWrapper](./sdk.erc721.contractwrapper.md) | | ContractWrapper<T> | | | [drop](./sdk.erc721.drop.md) | | [Erc721Droppable](./sdk.erc721droppable.md) \| undefined | | | [featureName](./sdk.erc721.featurename.md) | | "ERC721" | | diff --git a/docs/sdk.erc721burnable._constructor_.md b/docs/sdk.erc721burnable._constructor_.md new file mode 100644 index 000000000..0a9586839 --- /dev/null +++ b/docs/sdk.erc721burnable._constructor_.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc721Burnable](./sdk.erc721burnable.md) > [(constructor)](./sdk.erc721burnable._constructor_.md) + +## Erc721Burnable.(constructor) + +Constructs a new instance of the `Erc721Burnable` class + +Signature: + +```typescript +constructor(contractWrapper: ContractWrapper); +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| contractWrapper | ContractWrapper<IBurnableERC721> | | + diff --git a/docs/sdk.erc721burnable.featurename.md b/docs/sdk.erc721burnable.featurename.md new file mode 100644 index 000000000..367241113 --- /dev/null +++ b/docs/sdk.erc721burnable.featurename.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc721Burnable](./sdk.erc721burnable.md) > [featureName](./sdk.erc721burnable.featurename.md) + +## Erc721Burnable.featureName property + +Signature: + +```typescript +featureName: "ERC721Burnable"; +``` diff --git a/docs/sdk.erc721burnable.fromself.md b/docs/sdk.erc721burnable.fromself.md new file mode 100644 index 000000000..663bae57b --- /dev/null +++ b/docs/sdk.erc721burnable.fromself.md @@ -0,0 +1,38 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc721Burnable](./sdk.erc721burnable.md) > [fromSelf](./sdk.erc721burnable.fromself.md) + +## Erc721Burnable.fromSelf() method + +Burn NFTs + +Signature: + +```typescript +fromSelf(tokenId: BigNumberish): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| tokenId | BigNumberish | | + +Returns: + +Promise<[TransactionResult](./sdk.transactionresult.md)> + +## Remarks + +Burn NFTs held by the connected wallet + +## Example + + +```javascript +// The token ID of the NFT you want to burn +const tokenId = 0; + +await contract.nft.burn.fromSelf(tokenId); +``` + diff --git a/docs/sdk.erc721burnable.md b/docs/sdk.erc721burnable.md new file mode 100644 index 000000000..5f4146584 --- /dev/null +++ b/docs/sdk.erc721burnable.md @@ -0,0 +1,31 @@ + + +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc721Burnable](./sdk.erc721burnable.md) + +## Erc721Burnable class + +Signature: + +```typescript +export declare class Erc721Burnable implements DetectableFeature +``` +Implements: DetectableFeature + +## Constructors + +| Constructor | Modifiers | Description | +| --- | --- | --- | +| [(constructor)(contractWrapper)](./sdk.erc721burnable._constructor_.md) | | Constructs a new instance of the Erc721Burnable class | + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [featureName](./sdk.erc721burnable.featurename.md) | | "ERC721Burnable" | | + +## Methods + +| Method | Modifiers | Description | +| --- | --- | --- | +| [fromSelf(tokenId)](./sdk.erc721burnable.fromself.md) | | Burn NFTs | + diff --git a/docs/sdk.md b/docs/sdk.md index 8212f9f21..019ceebe7 100644 --- a/docs/sdk.md +++ b/docs/sdk.md @@ -25,15 +25,19 @@ | [EditionDrop](./sdk.editiondrop.md) | Setup a collection of NFTs with a customizable number of each NFT that are minted as users claim them. | | [Erc1155](./sdk.erc1155.md) | Standard ERC1155 NFT functions | | [Erc1155BatchMintable](./sdk.erc1155batchmintable.md) | Mint Many ERC1155 NFTs at once | +| [Erc1155Burnable](./sdk.erc1155burnable.md) | | +| [Erc1155Droppable](./sdk.erc1155droppable.md) | | | [Erc1155Enumerable](./sdk.erc1155enumerable.md) | List ERC1155 NFTs | | [Erc1155Mintable](./sdk.erc1155mintable.md) | Mint ERC1155 NFTs | | [Erc1155SignatureMintable](./sdk.erc1155signaturemintable.md) | Enables generating dynamic ERC1155 NFTs with rules and an associated signature, which can then be minted by anyone securely | | [Erc20](./sdk.erc20.md) | Standard ERC20 Token functions | | [Erc20BatchMintable](./sdk.erc20batchmintable.md) | Mint Many ERC20 Tokens at once | +| [Erc20Burnable](./sdk.erc20burnable.md) | | | [Erc20Mintable](./sdk.erc20mintable.md) | Mint ERC20 Tokens | | [Erc20SignatureMintable](./sdk.erc20signaturemintable.md) | Enables generating ERC20 Tokens with rules and an associated signature, which can then be minted by anyone securely | | [Erc721](./sdk.erc721.md) | Standard ERC721 NFT functions | | [Erc721BatchMintable](./sdk.erc721batchmintable.md) | Mint Many ERC721 NFTs at once | +| [Erc721Burnable](./sdk.erc721burnable.md) | | | [Erc721Claimable](./sdk.erc721claimable.md) | Lazily mint and claim ERC721 NFTs | | [Erc721Droppable](./sdk.erc721droppable.md) | Lazily mint and claim ERC721 NFTs | | [Erc721Enumerable](./sdk.erc721enumerable.md) | List owned ERC721 NFTs | diff --git a/docs/sdk.nftcollection.burn.md b/docs/sdk.nftcollection.burnfromself.md similarity index 61% rename from docs/sdk.nftcollection.burn.md rename to docs/sdk.nftcollection.burnfromself.md index 3f341ecaf..efb73704b 100644 --- a/docs/sdk.nftcollection.burn.md +++ b/docs/sdk.nftcollection.burnfromself.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [NFTCollection](./sdk.nftcollection.md) > [burn](./sdk.nftcollection.burn.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [NFTCollection](./sdk.nftcollection.md) > [burnFromSelf](./sdk.nftcollection.burnfromself.md) -## NFTCollection.burn() method +## NFTCollection.burnFromSelf() method Burn a single NFT Signature: ```typescript -burn(tokenId: BigNumberish): Promise; +burnFromSelf(tokenId: BigNumberish): Promise; ``` ## Parameters @@ -26,6 +26,6 @@ Promise<[TransactionResult](./sdk.transactionresult.md)> ```javascript -const result = await contract.burn(tokenId); +const result = await contract.burnFromSelf(tokenId); ``` diff --git a/docs/sdk.nftcollection.md b/docs/sdk.nftcollection.md index 24cc391ce..8a678f39f 100644 --- a/docs/sdk.nftcollection.md +++ b/docs/sdk.nftcollection.md @@ -50,7 +50,7 @@ const contract = sdk.getNFTCollection("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burn(tokenId)](./sdk.nftcollection.burn.md) | | Burn a single NFT | +| [burnFromSelf(tokenId)](./sdk.nftcollection.burnfromself.md) | | Burn a single NFT | | [getAll(queryParams)](./sdk.nftcollection.getall.md) | | Get All Minted NFTs | | [getOwned(walletAddress)](./sdk.nftcollection.getowned.md) | | Get Owned NFTs | | [getOwnedTokenIds(walletAddress)](./sdk.nftcollection.getownedtokenids.md) | | Get all token ids of NFTs owned by a specific wallet. | diff --git a/docs/sdk.nftdrop.burn.md b/docs/sdk.nftdrop.burnfromself.md similarity index 63% rename from docs/sdk.nftdrop.burn.md rename to docs/sdk.nftdrop.burnfromself.md index 3fe01d304..89e979d46 100644 --- a/docs/sdk.nftdrop.burn.md +++ b/docs/sdk.nftdrop.burnfromself.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [NFTDrop](./sdk.nftdrop.md) > [burn](./sdk.nftdrop.burn.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [NFTDrop](./sdk.nftdrop.md) > [burnFromSelf](./sdk.nftdrop.burnfromself.md) -## NFTDrop.burn() method +## NFTDrop.burnFromSelf() method Burn a single NFT Signature: ```typescript -burn(tokenId: BigNumberish): Promise; +burnFromSelf(tokenId: BigNumberish): Promise; ``` ## Parameters @@ -26,6 +26,6 @@ Promise<[TransactionResult](./sdk.transactionresult.md)> ```javascript -const result = await contract.burn(tokenId); +const result = await contract.burnFromSelf(tokenId); ``` diff --git a/docs/sdk.nftdrop.md b/docs/sdk.nftdrop.md index d9edb6214..e63d2f4ab 100644 --- a/docs/sdk.nftdrop.md +++ b/docs/sdk.nftdrop.md @@ -51,7 +51,7 @@ const contract = sdk.getNFTDrop("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burn(tokenId)](./sdk.nftdrop.burn.md) | | Burn a single NFT | +| [burnFromSelf(tokenId)](./sdk.nftdrop.burnfromself.md) | | Burn a single NFT | | [claim(quantity, checkERC20Allowance)](./sdk.nftdrop.claim.md) | | Claim NFTs to the connected wallet. | | [claimTo(destinationAddress, quantity, checkERC20Allowance)](./sdk.nftdrop.claimto.md) | | Claim unique NFTs to a specific Wallet | | [createBatch(metadatas, options)](./sdk.nftdrop.createbatch.md) | | Create a batch of unique NFTs to be claimed in the future | diff --git a/docs/sdk.signaturedrop.burn.md b/docs/sdk.signaturedrop.burnfromself.md similarity index 60% rename from docs/sdk.signaturedrop.burn.md rename to docs/sdk.signaturedrop.burnfromself.md index f63445e71..c65d62275 100644 --- a/docs/sdk.signaturedrop.burn.md +++ b/docs/sdk.signaturedrop.burnfromself.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [SignatureDrop](./sdk.signaturedrop.md) > [burn](./sdk.signaturedrop.burn.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [SignatureDrop](./sdk.signaturedrop.md) > [burnFromSelf](./sdk.signaturedrop.burnfromself.md) -## SignatureDrop.burn() method +## SignatureDrop.burnFromSelf() method Burn a single NFT Signature: ```typescript -burn(tokenId: BigNumberish): Promise; +burnFromSelf(tokenId: BigNumberish): Promise; ``` ## Parameters @@ -26,6 +26,6 @@ Promise<[TransactionResult](./sdk.transactionresult.md)> ```javascript -const result = await contract.burn(tokenId, amount); +const result = await contract.burnFromSelf(tokenId, amount); ``` diff --git a/docs/sdk.signaturedrop.md b/docs/sdk.signaturedrop.md index fbee4ff6e..75133455c 100644 --- a/docs/sdk.signaturedrop.md +++ b/docs/sdk.signaturedrop.md @@ -52,7 +52,7 @@ const contract = sdk.getSignatureDrop("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burn(tokenId)](./sdk.signaturedrop.burn.md) | | Burn a single NFT | +| [burnFromSelf(tokenId)](./sdk.signaturedrop.burnfromself.md) | | Burn a single NFT | | [claim(quantity, checkERC20Allowance)](./sdk.signaturedrop.claim.md) | | Claim NFTs to the connected wallet. | | [claimTo(destinationAddress, quantity, checkERC20Allowance)](./sdk.signaturedrop.claimto.md) | | Claim unique NFTs to a specific Wallet | | [createBatch(metadatas, options)](./sdk.signaturedrop.createbatch.md) | | Create a batch of unique NFTs to be claimed in the future | diff --git a/docs/sdk.token.burn.md b/docs/sdk.token.burnfromself.md similarity index 70% rename from docs/sdk.token.burn.md rename to docs/sdk.token.burnfromself.md index a01f78e4d..cb98b22e3 100644 --- a/docs/sdk.token.burn.md +++ b/docs/sdk.token.burnfromself.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Token](./sdk.token.md) > [burn](./sdk.token.burn.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Token](./sdk.token.md) > [burnFromSelf](./sdk.token.burnfromself.md) -## Token.burn() method +## Token.burnFromSelf() method Burn Tokens Signature: ```typescript -burn(amount: Amount): Promise; +burnFromSelf(amount: Amount): Promise; ``` ## Parameters @@ -33,6 +33,6 @@ Burn tokens held by the connected wallet // The amount of this token you want to burn const amount = 1.2; -await contract.burn(amount); +await contract.burnFromSelf(amount); ``` diff --git a/docs/sdk.token.md b/docs/sdk.token.md index 6f65d3f9e..72caa0297 100644 --- a/docs/sdk.token.md +++ b/docs/sdk.token.md @@ -49,8 +49,8 @@ const contract = sdk.getToken("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burn(amount)](./sdk.token.burn.md) | | Burn Tokens | | [burnFrom(holder, amount)](./sdk.token.burnfrom.md) | | Burn Tokens | +| [burnFromSelf(amount)](./sdk.token.burnfromself.md) | | Burn Tokens | | [getDelegation()](./sdk.token.getdelegation.md) | | Get your voting delegatee address | | [getDelegationOf(account)](./sdk.token.getdelegationof.md) | | Get a specific address voting delegatee address | | [getVoteBalance()](./sdk.token.getvotebalance.md) | | Get your wallet voting power for the current checkpoints | diff --git a/docs/sdk.tokendrop.burn.md b/docs/sdk.tokendrop.burnfromself.md similarity index 69% rename from docs/sdk.tokendrop.burn.md rename to docs/sdk.tokendrop.burnfromself.md index 5d3e3bcde..f037157de 100644 --- a/docs/sdk.tokendrop.burn.md +++ b/docs/sdk.tokendrop.burnfromself.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [TokenDrop](./sdk.tokendrop.md) > [burn](./sdk.tokendrop.burn.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [TokenDrop](./sdk.tokendrop.md) > [burnFromSelf](./sdk.tokendrop.burnfromself.md) -## TokenDrop.burn() method +## TokenDrop.burnFromSelf() method Burn Tokens Signature: ```typescript -burn(amount: Amount): Promise; +burnFromSelf(amount: Amount): Promise; ``` ## Parameters @@ -33,6 +33,6 @@ Burn tokens held by the connected wallet // The amount of this token you want to burn const amount = 1.2; -await contract.burn(amount); +await contract.burnFromSelf(amount); ``` diff --git a/docs/sdk.tokendrop.md b/docs/sdk.tokendrop.md index d81b6dc9b..2967ad29a 100644 --- a/docs/sdk.tokendrop.md +++ b/docs/sdk.tokendrop.md @@ -48,8 +48,8 @@ const contract = sdk.getTokenDrop("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burn(amount)](./sdk.tokendrop.burn.md) | | Burn Tokens | | [burnFrom(holder, amount)](./sdk.tokendrop.burnfrom.md) | | Burn Tokens | +| [burnFromSelf(amount)](./sdk.tokendrop.burnfromself.md) | | Burn Tokens | | [claim(amount, checkERC20Allowance)](./sdk.tokendrop.claim.md) | | Claim a certain amount of tokens | | [claimTo(destinationAddress, amount, checkERC20Allowance)](./sdk.tokendrop.claimto.md) | | Claim a certain amount of tokens to a specific Wallet | | [getDelegation()](./sdk.tokendrop.getdelegation.md) | | Get your voting delegatee address | diff --git a/docs/snippets.json b/docs/snippets.json index 226ad2c1e..57f44395e 100644 --- a/docs/snippets.json +++ b/docs/snippets.json @@ -421,13 +421,13 @@ }, "methods": [ { - "name": "burn", + "name": "burnFromSelf", "summary": "Burn a specified amount of a NFT\n\n", "remarks": null, "examples": { - "javascript": "const result = await contract.burn(tokenId, amount);" + "javascript": "const result = await contract.burnFromSelf(tokenId, amount);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.Edition.burn" + "reference": "https://docs.thirdweb.com/typescript/sdk.Edition.burnFromSelf" }, { "name": "getAll", @@ -533,13 +533,13 @@ }, "methods": [ { - "name": "burn", + "name": "burnFromSelf", "summary": "Burn a specified amount of a NFT\n\n", "remarks": null, "examples": { - "javascript": "const result = await contract.burn(tokenId, amount);" + "javascript": "const result = await contract.burnFromSelf(tokenId, amount);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.EditionDrop.burn" + "reference": "https://docs.thirdweb.com/typescript/sdk.EditionDrop.burnFromSelf" }, { "name": "claimTo", @@ -980,13 +980,13 @@ }, "methods": [ { - "name": "burn", + "name": "burnFromSelf", "summary": "Burn a single NFT\n\n", "remarks": null, "examples": { - "javascript": "const result = await contract.burn(tokenId);" + "javascript": "const result = await contract.burnFromSelf(tokenId);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.NFTCollection.burn" + "reference": "https://docs.thirdweb.com/typescript/sdk.NFTCollection.burnFromSelf" }, { "name": "getAll", @@ -1083,13 +1083,13 @@ }, "methods": [ { - "name": "burn", + "name": "burnFromSelf", "summary": "Burn a single NFT\n\n", "remarks": null, "examples": { - "javascript": "const result = await contract.burn(tokenId);" + "javascript": "const result = await contract.burnFromSelf(tokenId);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.NFTDrop.burn" + "reference": "https://docs.thirdweb.com/typescript/sdk.NFTDrop.burnFromSelf" }, { "name": "claimTo", @@ -1371,13 +1371,13 @@ }, "methods": [ { - "name": "burn", + "name": "burnFromSelf", "summary": "Burn a single NFT\n\n", "remarks": null, "examples": { - "javascript": "const result = await contract.burn(tokenId, amount);" + "javascript": "const result = await contract.burnFromSelf(tokenId, amount);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.SignatureDrop.burn" + "reference": "https://docs.thirdweb.com/typescript/sdk.SignatureDrop.burnFromSelf" }, { "name": "claimTo", @@ -1615,22 +1615,22 @@ }, "methods": [ { - "name": "burn", + "name": "burnFrom", "summary": "Burn Tokens\n\n", - "remarks": "\n\nBurn tokens held by the connected wallet\n\n", + "remarks": "\n\nBurn tokens held by the specified wallet\n\n", "examples": { - "javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.burn(amount);" + "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.burnFrom(holderAddress, amount);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.Token.burn" + "reference": "https://docs.thirdweb.com/typescript/sdk.Token.burnFrom" }, { - "name": "burnFrom", + "name": "burnFromSelf", "summary": "Burn Tokens\n\n", - "remarks": "\n\nBurn tokens held by the specified wallet\n\n", + "remarks": "\n\nBurn tokens held by the connected wallet\n\n", "examples": { - "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.burnFrom(holderAddress, amount);" + "javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.burnFromSelf(amount);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.Token.burnFrom" + "reference": "https://docs.thirdweb.com/typescript/sdk.Token.burnFromSelf" }, { "name": "mintBatchTo", @@ -1763,22 +1763,22 @@ }, "methods": [ { - "name": "burn", + "name": "burnFrom", "summary": "Burn Tokens\n\n", - "remarks": "\n\nBurn tokens held by the connected wallet\n\n", + "remarks": "\n\nBurn tokens held by the specified wallet\n\n", "examples": { - "javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.burn(amount);" + "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.burnFrom(holderAddress, amount);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.TokenDrop.burn" + "reference": "https://docs.thirdweb.com/typescript/sdk.TokenDrop.burnFrom" }, { - "name": "burnFrom", + "name": "burnFromSelf", "summary": "Burn Tokens\n\n", - "remarks": "\n\nBurn tokens held by the specified wallet\n\n", + "remarks": "\n\nBurn tokens held by the connected wallet\n\n", "examples": { - "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.burnFrom(holderAddress, amount);" + "javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.burnFromSelf(amount);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.TokenDrop.burnFrom" + "reference": "https://docs.thirdweb.com/typescript/sdk.TokenDrop.burnFromSelf" }, { "name": "claimTo", diff --git a/etc/sdk.api.md b/etc/sdk.api.md index 9b83f82b3..ef7ecb288 100644 --- a/etc/sdk.api.md +++ b/etc/sdk.api.md @@ -1808,7 +1808,7 @@ export class DuplicateLeafsError extends Error { // @public export class Edition extends Erc1155 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burn(tokenId: BigNumberish, amount: BigNumberish): Promise; + burnFromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; // (undocumented) static contractAbi: any; // (undocumented) @@ -1951,7 +1951,7 @@ export class Edition extends Erc1155 { // @public export class EditionDrop extends Erc1155 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burn(tokenId: BigNumberish, amount: BigNumberish): Promise; + burnFromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; claim(tokenId: BigNumberish, quantity: BigNumberish, checkERC20Allowance?: boolean): Promise; claimConditions: DropErc1155ClaimConditions; claimTo(destinationAddress: string, tokenId: BigNumberish, quantity: BigNumberish, checkERC20Allowance?: boolean): Promise; @@ -2397,9 +2397,9 @@ export class Erc1155; balanceOf(address: string, tokenId: BigNumberish): Promise; // (undocumented) + burn: Erc1155Burnable | undefined; + // (undocumented) protected contractWrapper: ContractWrapper; - // Warning: (ae-forgotten-export) The symbol "Erc1155Droppable" needs to be exported by the entry point index.d.ts - // // (undocumented) drop: Erc1155Droppable | undefined; // (undocumented) @@ -2440,6 +2440,29 @@ export class Erc1155BatchMintable implements DetectableFeature { to(to: string, metadataWithSupply: EditionMetadataOrUri[]): Promise[]>; } +// @public (undocumented) +export class Erc1155Burnable implements DetectableFeature { + // Warning: (ae-forgotten-export) The symbol "IBurnableERC1155" needs to be exported by the entry point index.d.ts + constructor(contractWrapper: ContractWrapper); + batchFrom(account: string, tokenIds: BigNumberish[], amounts: BigNumberish[]): Promise; + batchFromSelf(tokenIds: BigNumberish[], amounts: BigNumberish[]): Promise; + // (undocumented) + featureName: "ERC1155Burnable"; + from(account: string, tokenId: BigNumberish, amount: BigNumberish): Promise; + fromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; +} + +// @public (undocumented) +export class Erc1155Droppable implements DetectableFeature { + // Warning: (ae-forgotten-export) The symbol "BaseDropERC1155" needs to be exported by the entry point index.d.ts + constructor(erc1155: Erc1155, contractWrapper: ContractWrapper, storage: IStorage); + // (undocumented) + featureName: "ERC1155Droppable"; + lazyMint(metadatas: NFTMetadataOrUri[], options?: { + onProgress: (event: UploadProgressEvent) => void; + }): Promise[]>; +} + // @public export class Erc1155Enumerable implements DetectableFeature { // Warning: (ae-forgotten-export) The symbol "IERC1155Enumerable" needs to be exported by the entry point index.d.ts @@ -2495,6 +2518,8 @@ export class Erc20; balanceOf(address: string): Promise; // (undocumented) + burn: Erc20Burnable | undefined; + // (undocumented) protected contractWrapper: ContractWrapper; // (undocumented) featureName: "ERC20"; @@ -2530,6 +2555,16 @@ export class Erc20BatchMintable implements DetectableFeature { to(args: TokenMintInput[]): Promise; } +// @public (undocumented) +export class Erc20Burnable implements DetectableFeature { + // Warning: (ae-forgotten-export) The symbol "IBurnableERC20" needs to be exported by the entry point index.d.ts + constructor(erc20: Erc20, contractWrapper: ContractWrapper); + // (undocumented) + featureName: "ERC20Burnable"; + from(holder: string, amount: Amount): Promise; + fromSelf(amount: Amount): Promise; +} + // @public export class Erc20Mintable implements DetectableFeature { constructor(erc20: Erc20, contractWrapper: ContractWrapper); @@ -2567,6 +2602,8 @@ export class Erc721; balanceOf(address: string): Promise; // (undocumented) + burn: Erc721Burnable | undefined; + // (undocumented) protected contractWrapper: ContractWrapper; // (undocumented) drop: Erc721Droppable | undefined; @@ -2609,6 +2646,15 @@ export class Erc721BatchMintable implements DetectableFeature { to(to: string, metadatas: NFTMetadataOrUri[]): Promise[]>; } +// @public (undocumented) +export class Erc721Burnable implements DetectableFeature { + // Warning: (ae-forgotten-export) The symbol "IBurnableERC721" needs to be exported by the entry point index.d.ts + constructor(contractWrapper: ContractWrapper); + // (undocumented) + featureName: "ERC721Burnable"; + fromSelf(tokenId: BigNumberish): Promise; +} + // @public export class Erc721Claimable implements DetectableFeature { constructor(erc721: Erc721, contractWrapper: ContractWrapper, storage: IStorage); @@ -3585,7 +3631,7 @@ export interface NewDirectListing { // @public export class NFTCollection extends Erc721 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burn(tokenId: BigNumberish): Promise; + burnFromSelf(tokenId: BigNumberish): Promise; // (undocumented) static contractAbi: any; // (undocumented) @@ -3742,7 +3788,7 @@ export interface NFTContractDeployMetadata { // @public export class NFTDrop extends Erc721 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burn(tokenId: BigNumberish): Promise; + burnFromSelf(tokenId: BigNumberish): Promise; claim(quantity: BigNumberish, checkERC20Allowance?: boolean): Promise[]>; claimConditions: DropClaimConditions; claimTo(destinationAddress: string, quantity: BigNumberish, checkERC20Allowance?: boolean): Promise[]>; @@ -5713,7 +5759,7 @@ export const Signature721WithQuantityOutput: z.ZodObject { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burn(tokenId: BigNumberish): Promise; + burnFromSelf(tokenId: BigNumberish): Promise; claim(quantity: BigNumberish, checkERC20Allowance?: boolean): Promise[]>; claimConditions: DropClaimConditions; claimTo(destinationAddress: string, quantity: BigNumberish, checkERC20Allowance?: boolean): Promise[]>; @@ -6471,8 +6517,8 @@ export class ThirdwebSDK extends RPCConnectionHandler { // @public export class Token extends Erc20 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burn(amount: Amount): Promise; burnFrom(holder: string, amount: Amount): Promise; + burnFromSelf(amount: Amount): Promise; // (undocumented) static contractAbi: any; // (undocumented) @@ -6607,8 +6653,8 @@ export interface TokenContractDeployMetadata { // @public export class TokenDrop extends Erc20 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burn(amount: Amount): Promise; burnFrom(holder: string, amount: Amount): Promise; + burnFromSelf(amount: Amount): Promise; claim(amount: Amount, checkERC20Allowance?: boolean): Promise; claimConditions: DropClaimConditions; claimTo(destinationAddress: string, amount: Amount, checkERC20Allowance?: boolean): Promise; diff --git a/src/contracts/edition-drop.ts b/src/contracts/edition-drop.ts index 9a94ad40e..a19a154fe 100644 --- a/src/contracts/edition-drop.ts +++ b/src/contracts/edition-drop.ts @@ -35,6 +35,7 @@ import { getRoleHash } from "../common"; import { EditionMetadata, EditionMetadataOwner } from "../schema"; import { uploadOrExtractURIs } from "../common/nft"; import { TransactionTask } from "../core/classes/TransactionTask"; +import { Erc1155Burnable } from "../core/classes/erc-1155-burnable"; /** * Setup a collection of NFTs with a customizable number of each NFT that are minted as users claim them. @@ -60,6 +61,7 @@ export class EditionDrop extends Erc1155 { static schema = DropErc1155ContractSchema; private _query = this.query as Erc1155Enumerable; + private _burn = this.burn as Erc1155Burnable; public sales: ContractPrimarySale; public platformFees: ContractPlatformFee; @@ -402,21 +404,14 @@ export class EditionDrop extends Erc1155 { * * @example * ```javascript - * const result = await contract.burn(tokenId, amount); + * const result = await contract.burnFromSelf(tokenId, amount); * ``` */ - public async burn( + public async burnFromSelf( tokenId: BigNumberish, amount: BigNumberish, ): Promise { - const account = await this.contractWrapper.getSignerAddress(); - return { - receipt: await this.contractWrapper.sendTransaction("burn", [ - account, - tokenId, - amount, - ]), - }; + return this._burn.fromSelf(tokenId, amount); } /** ****************************** diff --git a/src/contracts/edition.ts b/src/contracts/edition.ts index 0083c1a93..c8b03f0b6 100644 --- a/src/contracts/edition.ts +++ b/src/contracts/edition.ts @@ -30,6 +30,7 @@ import { QueryAllParams } from "../types"; import { Erc1155Mintable } from "../core/classes/erc-1155-mintable"; import { Erc1155BatchMintable } from "../core/classes/erc-1155-batch-mintable"; import { Erc1155SignatureMintable } from "../core/classes/erc-1155-signature-mintable"; +import { Erc1155Burnable } from "../core/classes/erc-1155-burnable"; /** * Create a collection of NFTs that lets you mint multiple copies of each NFT. @@ -102,6 +103,7 @@ export class Edition extends Erc1155 { public interceptor: ContractInterceptor; private _query = this.query as Erc1155Enumerable; private _mint = this.mint as Erc1155Mintable; + private _burn = this.burn as Erc1155Burnable; private _batchMint = this._mint.batch as Erc1155BatchMintable; constructor( @@ -348,20 +350,13 @@ export class Edition extends Erc1155 { * * @example * ```javascript - * const result = await contract.burn(tokenId, amount); + * const result = await contract.burnFromSelf(tokenId, amount); * ``` */ - public async burn( + public async burnFromSelf( tokenId: BigNumberish, amount: BigNumberish, ): Promise { - const account = await this.contractWrapper.getSignerAddress(); - return { - receipt: await this.contractWrapper.sendTransaction("burn", [ - account, - tokenId, - amount, - ]), - }; + return this._burn.fromSelf(tokenId, amount); } } diff --git a/src/contracts/nft-collection.ts b/src/contracts/nft-collection.ts index d3b66d2fb..f1157cc62 100644 --- a/src/contracts/nft-collection.ts +++ b/src/contracts/nft-collection.ts @@ -27,6 +27,7 @@ import { NFTMetadataOrUri, NFTMetadataOwner } from "../schema"; import { QueryAllParams } from "../types"; import { GasCostEstimator } from "../core/classes/gas-cost-estimator"; import { Erc721WithQuantitySignatureMintable } from "../core"; +import { Erc721Burnable } from "../core/classes/erc-721-burnable"; /** * Create a collection of one-of-one NFTs. @@ -100,6 +101,7 @@ export class NFTCollection extends Erc721 { public interceptor: ContractInterceptor; private _mint = this.mint as Erc721Mintable; + private _burn = this.burn as Erc721Burnable; private _batchMint = this._mint.batch as Erc721BatchMintable; private _query = this.query as Erc721Supply; private _owned = this._query.owned as Erc721Enumerable; @@ -339,12 +341,10 @@ export class NFTCollection extends Erc721 { * * @example * ```javascript - * const result = await contract.burn(tokenId); + * const result = await contract.burnFromSelf(tokenId); * ``` */ - public async burn(tokenId: BigNumberish): Promise { - return { - receipt: await this.contractWrapper.sendTransaction("burn", [tokenId]), - }; + public async burnFromSelf(tokenId: BigNumberish): Promise { + return this._burn.fromSelf(tokenId); } } diff --git a/src/contracts/nft-drop.ts b/src/contracts/nft-drop.ts index 913f12399..c09992767 100644 --- a/src/contracts/nft-drop.ts +++ b/src/contracts/nft-drop.ts @@ -39,6 +39,7 @@ import { import { UploadProgressEvent } from "../types/events"; import { uploadOrExtractURIs } from "../common/nft"; import { TransactionTask } from "../core/classes/TransactionTask"; +import { Erc721Burnable } from "../core/classes/erc-721-burnable"; /** * Setup a collection of one-of-one NFTs that are minted as users claim them. @@ -150,6 +151,7 @@ export class NFTDrop extends Erc721 { private _query = this.query as Erc721Supply; private _owned = this._query.owned as Erc721Enumerable; + private _burn = this.burn as Erc721Burnable; constructor( network: NetworkOrSignerOrProvider, @@ -554,14 +556,12 @@ export class NFTDrop extends Erc721 { * * @example * ```javascript - * const result = await contract.burn(tokenId); + * const result = await contract.burnFromSelf(tokenId); * ``` * */ - public async burn(tokenId: BigNumberish): Promise { - return { - receipt: await this.contractWrapper.sendTransaction("burn", [tokenId]), - }; + public async burnFromSelf(tokenId: BigNumberish): Promise { + return this._burn.fromSelf(tokenId); } /** ****************************** diff --git a/src/contracts/signature-drop.ts b/src/contracts/signature-drop.ts index 98523aa6b..79084b408 100644 --- a/src/contracts/signature-drop.ts +++ b/src/contracts/signature-drop.ts @@ -38,6 +38,7 @@ import { DelayedReveal, DropClaimConditions } from "../core/index"; import { Erc721WithQuantitySignatureMintable } from "../core/classes/erc-721-with-quantity-signature-mintable"; import { uploadOrExtractURIs } from "../common/nft"; import { TransactionTask } from "../core/classes/TransactionTask"; +import { Erc721Burnable } from "../core/classes/erc-721-burnable"; /** * Setup a collection of NFTs where when it comes to minting, you can authorize @@ -168,6 +169,7 @@ export class SignatureDrop extends Erc721 { private _query = this.query as Erc721Supply; private _owned = this._query.owned as Erc721Enumerable; + private _burn = this.burn as Erc721Burnable; constructor( network: NetworkOrSignerOrProvider, @@ -571,13 +573,11 @@ export class SignatureDrop extends Erc721 { * @param tokenId - the token Id to burn * @example * ```javascript - * const result = await contract.burn(tokenId, amount); + * const result = await contract.burnFromSelf(tokenId, amount); * ``` */ - public async burn(tokenId: BigNumberish): Promise { - return { - receipt: await this.contractWrapper.sendTransaction("burn", [tokenId]), - }; + public async burnFromSelf(tokenId: BigNumberish): Promise { + return this._burn.fromSelf(tokenId); } /** ****************************** diff --git a/src/contracts/token-drop.ts b/src/contracts/token-drop.ts index 40f010f59..dbb9bd21c 100644 --- a/src/contracts/token-drop.ts +++ b/src/contracts/token-drop.ts @@ -18,6 +18,7 @@ import { DropErc20ContractSchema } from "../schema/contracts/drop-erc20"; import { prepareClaim } from "../common/claim-conditions"; import { getRoleHash } from "../common"; +import { Erc20Burnable } from "../core/classes/erc-20-burnable"; /** * Create a Drop contract for a standard crypto token or cryptocurrency. @@ -41,6 +42,8 @@ export class TokenDrop extends Erc20 { */ static schema = DropErc20ContractSchema; + private _burn = this.burn as Erc20Burnable; + public metadata: ContractMetadata; public roles: ContractRoles< DropERC20, @@ -256,15 +259,11 @@ export class TokenDrop extends Erc20 { * // The amount of this token you want to burn * const amount = 1.2; * - * await contract.burn(amount); + * await contract.burnFromSelf(amount); * ``` */ - public async burn(amount: Amount): Promise { - return { - receipt: await this.contractWrapper.sendTransaction("burn", [ - await this.normalizeAmount(amount), - ]), - }; + public async burnFromSelf(amount: Amount): Promise { + return this._burn.fromSelf(amount); } /** @@ -287,12 +286,7 @@ export class TokenDrop extends Erc20 { holder: string, amount: Amount, ): Promise { - return { - receipt: await this.contractWrapper.sendTransaction("burnFrom", [ - holder, - await this.normalizeAmount(amount), - ]), - }; + return this._burn.from(holder, amount); } /** ****************************** diff --git a/src/contracts/token.ts b/src/contracts/token.ts index adfadfa11..33f17790a 100644 --- a/src/contracts/token.ts +++ b/src/contracts/token.ts @@ -23,6 +23,7 @@ import { Erc20Mintable } from "../core/classes/erc-20-mintable"; import { Erc20BatchMintable } from "../core/classes/erc-20-batch-mintable"; import { constants } from "ethers"; import { Erc20SignatureMintable } from "../core/classes/erc-20-signature-mintable"; +import { Erc20Burnable } from "../core/classes/erc-20-burnable"; /** * Create a standard crypto token or cryptocurrency. @@ -73,6 +74,7 @@ export class Token extends Erc20 { public interceptor: ContractInterceptor; private _mint = this.mint as Erc20Mintable; private _batchMint = this._mint.batch as Erc20BatchMintable; + private _burn = this.burn as Erc20Burnable; constructor( network: NetworkOrSignerOrProvider, @@ -239,15 +241,11 @@ export class Token extends Erc20 { * // The amount of this token you want to burn * const amount = 1.2; * - * await contract.burn(amount); + * await contract.burnFromSelf(amount); * ``` */ - public async burn(amount: Amount): Promise { - return { - receipt: await this.contractWrapper.sendTransaction("burn", [ - await this.normalizeAmount(amount), - ]), - }; + public async burnFromSelf(amount: Amount): Promise { + return this._burn.fromSelf(amount); } /** @@ -270,11 +268,6 @@ export class Token extends Erc20 { holder: string, amount: Amount, ): Promise { - return { - receipt: await this.contractWrapper.sendTransaction("burnFrom", [ - holder, - await this.normalizeAmount(amount), - ]), - }; + return this._burn.from(holder, amount); } } diff --git a/src/core/classes/erc-1155.ts b/src/core/classes/erc-1155.ts index cb82950e9..8b3bc50bd 100644 --- a/src/core/classes/erc-1155.ts +++ b/src/core/classes/erc-1155.ts @@ -35,7 +35,7 @@ import { FEATURE_EDITION } from "../../constants/erc1155-features"; import { DetectableFeature } from "../interfaces/DetectableFeature"; import { Erc1155SignatureMintable } from "./erc-1155-signature-mintable"; import { Erc1155Droppable } from "./erc-1155-droppable"; -import { Erc1155Burnable } from "../.."; +import { Erc1155Burnable } from "./erc-1155-burnable"; /** * Standard ERC1155 NFT functions diff --git a/src/core/classes/erc-721.ts b/src/core/classes/erc-721.ts index 6a6283ee2..336af54a8 100644 --- a/src/core/classes/erc-721.ts +++ b/src/core/classes/erc-721.ts @@ -28,7 +28,7 @@ import { FEATURE_NFT } from "../../constants/erc721-features"; import { DetectableFeature } from "../interfaces/DetectableFeature"; import { Erc721Droppable } from "./erc-721-droppable"; import { Erc721WithQuantitySignatureMintable } from "./erc-721-with-quantity-signature-mintable"; -import { Erc721Burnable } from "../.."; +import { Erc721Burnable } from "./erc-721-burnable"; /** * Standard ERC721 NFT functions diff --git a/test/custom.test.ts b/test/custom.test.ts index f1ccb2ad1..c82816958 100644 --- a/test/custom.test.ts +++ b/test/custom.test.ts @@ -241,6 +241,17 @@ describe("Custom Contracts", async () => { ); }); + it("should detect feature: erc20 burnable", async () => { + const c = await sdk.getContract(tokenContractAddress); + invariant(c, "Contract undefined"); + invariant(c.token, "ERC20 undefined"); + invariant(c.token.burn, "ERC20Burnable undefined"); + await c.token.mint?.to(adminWallet.address, 2); + expect((await c.token.balance()).displayValue).to.eq("2.0"); + await c.token.burn.fromSelf(1); + expect((await c.token.balance()).displayValue).to.eq("1.0"); + }); + it("should detect feature: erc721", async () => { const c = await sdk.getContract(nftContractAddress); invariant(c, "Contract undefined"); @@ -255,6 +266,22 @@ describe("Custom Contracts", async () => { expect(nfts[0].metadata.name).to.eq("Custom NFT"); }); + it("should detect feature: erc721 burnable", async () => { + const c = await sdk.getContract(nftContractAddress); + invariant(c, "Contract undefined"); + invariant(c.nft, "ERC721 undefined"); + invariant(c.nft.burn, "ERC721Burnable undefined"); + invariant(c.nft.query, "ERC721 query undefined"); + await c.nft.mint?.to(adminWallet.address, { + name: "Custom NFT", + }); + let balance = await c.nft.balance(); + expect(balance.toString()).to.eq("1"); + await c.nft.burn.fromSelf(0); + balance = await c.nft.balance(); + expect(balance.toString()).to.eq("0"); + }); + it("should detect feature: erc721 lazy mint", async () => { const c = await sdk.getContract(sigDropContractAddress); invariant(c, "Contract undefined"); @@ -313,6 +340,43 @@ describe("Custom Contracts", async () => { expect(nfts[0].metadata.name).to.eq("Custom NFT"); }); + it("should detect feature: erc1155 burnable", async () => { + const c = await sdk.getContract(editionContractAddress); + invariant(c, "Contract undefined"); + invariant(c.edition, "ERC1155 undefined"); + invariant(c.edition.mint, "ERC1155 mintable undefined"); + invariant(c.edition.mint.batch, "ERC1155 batch undefined"); + invariant(c.edition.burn, "ERC1155 burnable undefined"); + invariant(c.edition.query, "ERC1155 query undefined"); + + await c.edition.mint.batch.to(adminWallet.address, [ + { + metadata: { + name: "Custom NFT", + }, + supply: 100, + }, + { + metadata: { + name: "Custom NFT", + }, + supply: 100, + }, + ]); + + let balance = await c.edition.balance(0); + expect(balance.toString()).to.eq("100"); + await c.edition.burn.fromSelf(0, 10); + balance = await c.edition.balance(0); + expect(balance.toString()).to.eq("90"); + + await c.edition.burn.batchFromSelf([0, 1], [10, 10]); + balance = await c.edition.balance(0); + expect(balance.toString()).to.eq("80"); + balance = await c.edition.balance(1); + expect(balance.toString()).to.eq("90"); + }); + it("should detect feature: erc1155 lazy mint", async () => { const c = await sdk.getContract(editionDropContractAddress); From c09d59074050c879147627f9f6064d97d28c0148 Mon Sep 17 00:00:00 2001 From: adam-maj Date: Wed, 10 Aug 2022 14:28:16 -0400 Subject: [PATCH 4/6] Update test cases --- test/nft-drop.test.ts | 2 +- test/nft.test.ts | 4 ++-- test/signature-drop.test.ts | 2 +- test/token.test.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/nft-drop.test.ts b/test/nft-drop.test.ts index e551797f4..9a1d999cc 100644 --- a/test/nft-drop.test.ts +++ b/test/nft-drop.test.ts @@ -287,7 +287,7 @@ describe("NFT Drop Contract", async () => { await dropContract.claim(10); const ts = await dropContract.totalSupply(); expect(ts.toNumber()).to.eq(20); - await dropContract.burn(0); + await dropContract.burnFromSelf(0); const ts2 = await dropContract.totalSupply(); expect(ts2.toNumber()).to.eq(20); }); diff --git a/test/nft.test.ts b/test/nft.test.ts index d711f53eb..323f0411a 100644 --- a/test/nft.test.ts +++ b/test/nft.test.ts @@ -43,7 +43,7 @@ describe("NFT Contract", async () => { const token = await nftContract.mintToSelf({ name: "Test2", }); - await nftContract.burn(token.id); + await nftContract.burnFromSelf(token.id); const nfts = await nftContract.getAll(); expect(nfts).to.be.an("array").length(2); }); @@ -126,7 +126,7 @@ describe("NFT Contract", async () => { const token = await nftContract.mintToSelf({ name: "Test2", }); - await nftContract.burn(token.id); + await nftContract.burnFromSelf(token.id); const nft = await nftContract.get("0"); assert.equal(nft.owner, AddressZero); }); diff --git a/test/signature-drop.test.ts b/test/signature-drop.test.ts index cebf02c9b..8f3b51272 100644 --- a/test/signature-drop.test.ts +++ b/test/signature-drop.test.ts @@ -646,7 +646,7 @@ describe("Signature drop tests", async () => { await signatureDropContract.claim(10); const ts = await signatureDropContract.totalSupply(); expect(ts.toNumber()).to.eq(20); - await signatureDropContract.burn(0); + await signatureDropContract.burnFromSelf(0); const ts2 = await signatureDropContract.totalSupply(); expect(ts2.toNumber()).to.eq(20); }); diff --git a/test/token.test.ts b/test/token.test.ts index cf7e0e851..364517eef 100644 --- a/test/token.test.ts +++ b/test/token.test.ts @@ -91,7 +91,7 @@ describe("Token Contract", async () => { ethers.utils.parseEther("20"), `Wrong balance`, ); - await currencyContract.burn(10); + await currencyContract.burnFromSelf(10); assert.deepEqual( (await currencyContract.balanceOf(adminWallet.address)).value, ethers.utils.parseEther("10"), From abf6349722837501250a3dfae88a023e3f6664c1 Mon Sep 17 00:00:00 2001 From: adam-maj Date: Wed, 10 Aug 2022 23:55:16 -0400 Subject: [PATCH 5/6] Update naming --- src/contracts/edition-drop.ts | 4 ++-- src/contracts/edition.ts | 4 ++-- src/contracts/nft-collection.ts | 6 +++--- src/contracts/nft-drop.ts | 6 +++--- src/contracts/signature-drop.ts | 6 +++--- src/contracts/token-drop.ts | 27 ++------------------------- src/contracts/token.ts | 27 ++------------------------- src/core/classes/erc-721-burnable.ts | 4 ++-- test/custom.test.ts | 2 +- test/nft-drop.test.ts | 2 +- test/nft.test.ts | 4 ++-- test/signature-drop.test.ts | 2 +- test/token.test.ts | 2 +- 13 files changed, 25 insertions(+), 71 deletions(-) diff --git a/src/contracts/edition-drop.ts b/src/contracts/edition-drop.ts index a19a154fe..981aa7977 100644 --- a/src/contracts/edition-drop.ts +++ b/src/contracts/edition-drop.ts @@ -404,10 +404,10 @@ export class EditionDrop extends Erc1155 { * * @example * ```javascript - * const result = await contract.burnFromSelf(tokenId, amount); + * const result = await contract.burnTokens(tokenId, amount); * ``` */ - public async burnFromSelf( + public async burnTokens( tokenId: BigNumberish, amount: BigNumberish, ): Promise { diff --git a/src/contracts/edition.ts b/src/contracts/edition.ts index c8b03f0b6..1e97384cf 100644 --- a/src/contracts/edition.ts +++ b/src/contracts/edition.ts @@ -350,10 +350,10 @@ export class Edition extends Erc1155 { * * @example * ```javascript - * const result = await contract.burnFromSelf(tokenId, amount); + * const result = await contract.burnTokens(tokenId, amount); * ``` */ - public async burnFromSelf( + public async burnTokens( tokenId: BigNumberish, amount: BigNumberish, ): Promise { diff --git a/src/contracts/nft-collection.ts b/src/contracts/nft-collection.ts index f1157cc62..6c55deaa9 100644 --- a/src/contracts/nft-collection.ts +++ b/src/contracts/nft-collection.ts @@ -341,10 +341,10 @@ export class NFTCollection extends Erc721 { * * @example * ```javascript - * const result = await contract.burnFromSelf(tokenId); + * const result = await contract.burnToken(tokenId); * ``` */ - public async burnFromSelf(tokenId: BigNumberish): Promise { - return this._burn.fromSelf(tokenId); + public async burnToken(tokenId: BigNumberish): Promise { + return this._burn.token(tokenId); } } diff --git a/src/contracts/nft-drop.ts b/src/contracts/nft-drop.ts index c09992767..e1bb8ef5a 100644 --- a/src/contracts/nft-drop.ts +++ b/src/contracts/nft-drop.ts @@ -556,12 +556,12 @@ export class NFTDrop extends Erc721 { * * @example * ```javascript - * const result = await contract.burnFromSelf(tokenId); + * const result = await contract.burnToken(tokenId); * ``` * */ - public async burnFromSelf(tokenId: BigNumberish): Promise { - return this._burn.fromSelf(tokenId); + public async burnToken(tokenId: BigNumberish): Promise { + return this._burn.token(tokenId); } /** ****************************** diff --git a/src/contracts/signature-drop.ts b/src/contracts/signature-drop.ts index 79084b408..221084afb 100644 --- a/src/contracts/signature-drop.ts +++ b/src/contracts/signature-drop.ts @@ -573,11 +573,11 @@ export class SignatureDrop extends Erc721 { * @param tokenId - the token Id to burn * @example * ```javascript - * const result = await contract.burnFromSelf(tokenId, amount); + * const result = await contract.burnToken(tokenId); * ``` */ - public async burnFromSelf(tokenId: BigNumberish): Promise { - return this._burn.fromSelf(tokenId); + public async burnToken(tokenId: BigNumberish): Promise { + return this._burn.token(tokenId); } /** ****************************** diff --git a/src/contracts/token-drop.ts b/src/contracts/token-drop.ts index dbb9bd21c..c0f9404f7 100644 --- a/src/contracts/token-drop.ts +++ b/src/contracts/token-drop.ts @@ -259,36 +259,13 @@ export class TokenDrop extends Erc20 { * // The amount of this token you want to burn * const amount = 1.2; * - * await contract.burnFromSelf(amount); + * await contract.burnTokens(amount); * ``` */ - public async burnFromSelf(amount: Amount): Promise { + public async burnTokens(amount: Amount): Promise { return this._burn.fromSelf(amount); } - /** - * Burn Tokens - * - * @remarks Burn tokens held by the specified wallet - * - * @example - * ```javascript - * // Address of the wallet sending the tokens - * const holderAddress = "{{wallet_address}}"; - * - * // The amount of this token you want to burn - * const amount = 1.2; - * - * await contract.burnFrom(holderAddress, amount); - * ``` - */ - public async burnFrom( - holder: string, - amount: Amount, - ): Promise { - return this._burn.from(holder, amount); - } - /** ****************************** * PRIVATE FUNCTIONS *******************************/ diff --git a/src/contracts/token.ts b/src/contracts/token.ts index 33f17790a..02344f78a 100644 --- a/src/contracts/token.ts +++ b/src/contracts/token.ts @@ -241,33 +241,10 @@ export class Token extends Erc20 { * // The amount of this token you want to burn * const amount = 1.2; * - * await contract.burnFromSelf(amount); + * await contract.burnTokens(amount); * ``` */ - public async burnFromSelf(amount: Amount): Promise { + public async burnTokens(amount: Amount): Promise { return this._burn.fromSelf(amount); } - - /** - * Burn Tokens - * - * @remarks Burn tokens held by the specified wallet - * - * @example - * ```javascript - * // Address of the wallet sending the tokens - * const holderAddress = "{{wallet_address}}"; - * - * // The amount of this token you want to burn - * const amount = 1.2; - * - * await contract.burnFrom(holderAddress, amount); - * ``` - */ - public async burnFrom( - holder: string, - amount: Amount, - ): Promise { - return this._burn.from(holder, amount); - } } diff --git a/src/core/classes/erc-721-burnable.ts b/src/core/classes/erc-721-burnable.ts index 738e1287c..a97fbda9e 100644 --- a/src/core/classes/erc-721-burnable.ts +++ b/src/core/classes/erc-721-burnable.ts @@ -24,10 +24,10 @@ export class Erc721Burnable implements DetectableFeature { * // The token ID of the NFT you want to burn * const tokenId = 0; * - * await contract.nft.burn.fromSelf(tokenId); + * await contract.nft.burn.token(tokenId); * ``` */ - public async fromSelf(tokenId: BigNumberish): Promise { + public async token(tokenId: BigNumberish): Promise { return { receipt: await this.contractWrapper.sendTransaction("burn", [tokenId]), }; diff --git a/test/custom.test.ts b/test/custom.test.ts index c82816958..ef4c6d7ec 100644 --- a/test/custom.test.ts +++ b/test/custom.test.ts @@ -277,7 +277,7 @@ describe("Custom Contracts", async () => { }); let balance = await c.nft.balance(); expect(balance.toString()).to.eq("1"); - await c.nft.burn.fromSelf(0); + await c.nft.burn.token(0); balance = await c.nft.balance(); expect(balance.toString()).to.eq("0"); }); diff --git a/test/nft-drop.test.ts b/test/nft-drop.test.ts index 9a1d999cc..b38af50f0 100644 --- a/test/nft-drop.test.ts +++ b/test/nft-drop.test.ts @@ -287,7 +287,7 @@ describe("NFT Drop Contract", async () => { await dropContract.claim(10); const ts = await dropContract.totalSupply(); expect(ts.toNumber()).to.eq(20); - await dropContract.burnFromSelf(0); + await dropContract.burnToken(0); const ts2 = await dropContract.totalSupply(); expect(ts2.toNumber()).to.eq(20); }); diff --git a/test/nft.test.ts b/test/nft.test.ts index 323f0411a..575181ef5 100644 --- a/test/nft.test.ts +++ b/test/nft.test.ts @@ -43,7 +43,7 @@ describe("NFT Contract", async () => { const token = await nftContract.mintToSelf({ name: "Test2", }); - await nftContract.burnFromSelf(token.id); + await nftContract.burnToken(token.id); const nfts = await nftContract.getAll(); expect(nfts).to.be.an("array").length(2); }); @@ -126,7 +126,7 @@ describe("NFT Contract", async () => { const token = await nftContract.mintToSelf({ name: "Test2", }); - await nftContract.burnFromSelf(token.id); + await nftContract.burnToken(token.id); const nft = await nftContract.get("0"); assert.equal(nft.owner, AddressZero); }); diff --git a/test/signature-drop.test.ts b/test/signature-drop.test.ts index 8f3b51272..b6f8eb06b 100644 --- a/test/signature-drop.test.ts +++ b/test/signature-drop.test.ts @@ -646,7 +646,7 @@ describe("Signature drop tests", async () => { await signatureDropContract.claim(10); const ts = await signatureDropContract.totalSupply(); expect(ts.toNumber()).to.eq(20); - await signatureDropContract.burnFromSelf(0); + await signatureDropContract.burnToken(0); const ts2 = await signatureDropContract.totalSupply(); expect(ts2.toNumber()).to.eq(20); }); diff --git a/test/token.test.ts b/test/token.test.ts index 364517eef..000058437 100644 --- a/test/token.test.ts +++ b/test/token.test.ts @@ -91,7 +91,7 @@ describe("Token Contract", async () => { ethers.utils.parseEther("20"), `Wrong balance`, ); - await currencyContract.burnFromSelf(10); + await currencyContract.burnTokens(10); assert.deepEqual( (await currencyContract.balanceOf(adminWallet.address)).value, ethers.utils.parseEther("10"), From 1d8ba473945e39559c772a8794252e5b9dac79ae Mon Sep 17 00:00:00 2001 From: adam-maj Date: Thu, 11 Aug 2022 16:31:45 -0400 Subject: [PATCH 6/6] Update --- docs/feature_snippets.json | 34 +++++++-------- ...nfromself.md => sdk.edition.burntokens.md} | 8 ++-- docs/sdk.edition.md | 2 +- ...mself.md => sdk.editiondrop.burntokens.md} | 8 ++-- docs/sdk.editiondrop.md | 2 +- ...omself.md => sdk.erc1155burnable.batch.md} | 8 ++-- docs/sdk.erc1155burnable.md | 4 +- ...mself.md => sdk.erc1155burnable.tokens.md} | 8 ++-- docs/sdk.erc20burnable.md | 2 +- ...romself.md => sdk.erc20burnable.tokens.md} | 8 ++-- docs/sdk.erc721burnable.md | 2 +- ...romself.md => sdk.erc721burnable.token.md} | 8 ++-- ...self.md => sdk.nftcollection.burntoken.md} | 8 ++-- docs/sdk.nftcollection.md | 2 +- ...rnfromself.md => sdk.nftdrop.burntoken.md} | 8 ++-- docs/sdk.nftdrop.md | 2 +- ...self.md => sdk.signaturedrop.burntoken.md} | 8 ++-- docs/sdk.signaturedrop.md | 2 +- ...urnfromself.md => sdk.token.burntokens.md} | 8 ++-- docs/sdk.token.md | 2 +- ...romself.md => sdk.tokendrop.burntokens.md} | 8 ++-- docs/sdk.tokendrop.md | 2 +- docs/snippets.json | 42 +++++++++---------- etc/sdk.api.md | 22 +++++----- src/contracts/edition-drop.ts | 2 +- src/contracts/edition.ts | 2 +- src/contracts/token-drop.ts | 25 ++++++++++- src/contracts/token.ts | 25 ++++++++++- src/core/classes/erc-1155-burnable.ts | 8 ++-- src/core/classes/erc-20-burnable.ts | 4 +- test/custom.test.ts | 6 +-- 31 files changed, 163 insertions(+), 117 deletions(-) rename docs/{sdk.edition.burnfromself.md => sdk.edition.burntokens.md} (63%) rename docs/{sdk.editiondrop.burnfromself.md => sdk.editiondrop.burntokens.md} (62%) rename docs/{sdk.erc1155burnable.batchfromself.md => sdk.erc1155burnable.batch.md} (66%) rename docs/{sdk.erc1155burnable.fromself.md => sdk.erc1155burnable.tokens.md} (68%) rename docs/{sdk.erc20burnable.fromself.md => sdk.erc20burnable.tokens.md} (68%) rename docs/{sdk.erc721burnable.fromself.md => sdk.erc721burnable.token.md} (66%) rename docs/{sdk.nftcollection.burnfromself.md => sdk.nftcollection.burntoken.md} (61%) rename docs/{sdk.nftdrop.burnfromself.md => sdk.nftdrop.burntoken.md} (63%) rename docs/{sdk.signaturedrop.burnfromself.md => sdk.signaturedrop.burntoken.md} (60%) rename docs/{sdk.token.burnfromself.md => sdk.token.burntokens.md} (70%) rename docs/{sdk.tokendrop.burnfromself.md => sdk.tokendrop.burntokens.md} (69%) diff --git a/docs/feature_snippets.json b/docs/feature_snippets.json index 9ed24bffd..514ba8b1c 100644 --- a/docs/feature_snippets.json +++ b/docs/feature_snippets.json @@ -244,25 +244,25 @@ "examples": {}, "methods": [ { - "name": "batchFrom", + "name": "batch", "summary": "Burn a batch of NFTs\n\n", - "remarks": "\n\nBurn the batch NFTs from the specified wallet\n\n", + "remarks": "\n\nBurn the batch NFTs from the connected wallet\n\n", "examples": { - "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);" + "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);" }, "reference": { - "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.batchFrom" + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.batch" } }, { - "name": "batchFromSelf", + "name": "batchFrom", "summary": "Burn a batch of NFTs\n\n", - "remarks": "\n\nBurn the batch NFTs from the connected wallet\n\n", + "remarks": "\n\nBurn the batch NFTs from the specified wallet\n\n", "examples": { - "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.batchFromSelf(tokenIds, amounts);" + "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);" }, "reference": { - "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.batchFromSelf" + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.batchFrom" } }, { @@ -277,14 +277,14 @@ } }, { - "name": "fromSelf", + "name": "tokens", "summary": "Burn a specified amount of a NFTs\n\n", "remarks": "\n\nBurn the specified NFTs from the connected wallet\n\n", "examples": { - "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.fromSelf(tokenId, amount);" + "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);" }, "reference": { - "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.fromSelf" + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc1155Burnable.tokens" } } ], @@ -589,14 +589,14 @@ } }, { - "name": "fromSelf", + "name": "tokens", "summary": "Burn Tokens\n\n", "remarks": "\n\nBurn tokens held by the connected wallet\n\n", "examples": { - "javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.token.burn.fromSelf(amount);" + "javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.token.burn.tokens(amount);" }, "reference": { - "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc20Burnable.fromSelf" + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc20Burnable.tokens" } } ], @@ -743,14 +743,14 @@ "examples": {}, "methods": [ { - "name": "fromSelf", + "name": "token", "summary": "Burn NFTs\n\n", "remarks": "\n\nBurn NFTs held by the connected wallet\n\n", "examples": { - "javascript": "// The token ID of the NFT you want to burn\nconst tokenId = 0;\n\nawait contract.nft.burn.fromSelf(tokenId);" + "javascript": "// The token ID of the NFT you want to burn\nconst tokenId = 0;\n\nawait contract.nft.burn.token(tokenId);" }, "reference": { - "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc721Burnable.fromSelf" + "javascript": "https://docs.thirdweb.com/typescript/sdk.Erc721Burnable.token" } } ], diff --git a/docs/sdk.edition.burnfromself.md b/docs/sdk.edition.burntokens.md similarity index 63% rename from docs/sdk.edition.burnfromself.md rename to docs/sdk.edition.burntokens.md index 83c818989..193e97401 100644 --- a/docs/sdk.edition.burnfromself.md +++ b/docs/sdk.edition.burntokens.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Edition](./sdk.edition.md) > [burnFromSelf](./sdk.edition.burnfromself.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Edition](./sdk.edition.md) > [burnTokens](./sdk.edition.burntokens.md) -## Edition.burnFromSelf() method +## Edition.burnTokens() method Burn a specified amount of a NFT Signature: ```typescript -burnFromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; +burnTokens(tokenId: BigNumberish, amount: BigNumberish): Promise; ``` ## Parameters @@ -27,6 +27,6 @@ Promise<[TransactionResult](./sdk.transactionresult.md)> ```javascript -const result = await contract.burnFromSelf(tokenId, amount); +const result = await contract.burnTokens(tokenId, amount); ``` diff --git a/docs/sdk.edition.md b/docs/sdk.edition.md index 05511451d..489f43731 100644 --- a/docs/sdk.edition.md +++ b/docs/sdk.edition.md @@ -50,7 +50,7 @@ const contract = sdk.getEdition("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burnFromSelf(tokenId, amount)](./sdk.edition.burnfromself.md) | | Burn a specified amount of a NFT | +| [burnTokens(tokenId, amount)](./sdk.edition.burntokens.md) | | Burn a specified amount of a NFT | | [getAll(queryParams)](./sdk.edition.getall.md) | | Get All Minted NFTs | | [getOwned(walletAddress)](./sdk.edition.getowned.md) | | Get Owned NFTs | | [getTotalCount()](./sdk.edition.gettotalcount.md) | | Get the number of NFTs minted | diff --git a/docs/sdk.editiondrop.burnfromself.md b/docs/sdk.editiondrop.burntokens.md similarity index 62% rename from docs/sdk.editiondrop.burnfromself.md rename to docs/sdk.editiondrop.burntokens.md index 6d29aaa71..9172ccb7a 100644 --- a/docs/sdk.editiondrop.burnfromself.md +++ b/docs/sdk.editiondrop.burntokens.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [EditionDrop](./sdk.editiondrop.md) > [burnFromSelf](./sdk.editiondrop.burnfromself.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [EditionDrop](./sdk.editiondrop.md) > [burnTokens](./sdk.editiondrop.burntokens.md) -## EditionDrop.burnFromSelf() method +## EditionDrop.burnTokens() method Burn a specified amount of a NFT Signature: ```typescript -burnFromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; +burnTokens(tokenId: BigNumberish, amount: BigNumberish): Promise; ``` ## Parameters @@ -27,6 +27,6 @@ Promise<[TransactionResult](./sdk.transactionresult.md)> ```javascript -const result = await contract.burnFromSelf(tokenId, amount); +const result = await contract.burnTokens(tokenId, amount); ``` diff --git a/docs/sdk.editiondrop.md b/docs/sdk.editiondrop.md index 0f011b7a4..726120c1e 100644 --- a/docs/sdk.editiondrop.md +++ b/docs/sdk.editiondrop.md @@ -51,7 +51,7 @@ const contract = sdk.getEditionDrop("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burnFromSelf(tokenId, amount)](./sdk.editiondrop.burnfromself.md) | | Burn a specified amount of a NFT | +| [burnTokens(tokenId, amount)](./sdk.editiondrop.burntokens.md) | | Burn a specified amount of a NFT | | [claim(tokenId, quantity, checkERC20Allowance)](./sdk.editiondrop.claim.md) | | Claim a token to the connected wallet | | [claimTo(destinationAddress, tokenId, quantity, checkERC20Allowance)](./sdk.editiondrop.claimto.md) | | Claim NFTs to a specific Wallet | | [createBatch(metadatas, options)](./sdk.editiondrop.createbatch.md) | | Create a batch of NFTs to be claimed in the future | diff --git a/docs/sdk.erc1155burnable.batchfromself.md b/docs/sdk.erc1155burnable.batch.md similarity index 66% rename from docs/sdk.erc1155burnable.batchfromself.md rename to docs/sdk.erc1155burnable.batch.md index 296ac669a..a206ba5b8 100644 --- a/docs/sdk.erc1155burnable.batchfromself.md +++ b/docs/sdk.erc1155burnable.batch.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Burnable](./sdk.erc1155burnable.md) > [batchFromSelf](./sdk.erc1155burnable.batchfromself.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Burnable](./sdk.erc1155burnable.md) > [batch](./sdk.erc1155burnable.batch.md) -## Erc1155Burnable.batchFromSelf() method +## Erc1155Burnable.batch() method Burn a batch of NFTs Signature: ```typescript -batchFromSelf(tokenIds: BigNumberish[], amounts: BigNumberish[]): Promise; +batch(tokenIds: BigNumberish[], amounts: BigNumberish[]): Promise; ``` ## Parameters @@ -36,6 +36,6 @@ const tokenIds = [0, 1]; // The amounts of each NFT you want to burn const amounts = [2, 2]; -const result = await contract.edition.burn.batchFromSelf(tokenIds, amounts); +const result = await contract.edition.burn.batch(tokenIds, amounts); ``` diff --git a/docs/sdk.erc1155burnable.md b/docs/sdk.erc1155burnable.md index 0d6bca081..edc24296c 100644 --- a/docs/sdk.erc1155burnable.md +++ b/docs/sdk.erc1155burnable.md @@ -27,8 +27,8 @@ export declare class Erc1155Burnable implements DetectableFeature | Method | Modifiers | Description | | --- | --- | --- | +| [batch(tokenIds, amounts)](./sdk.erc1155burnable.batch.md) | | Burn a batch of NFTs | | [batchFrom(account, tokenIds, amounts)](./sdk.erc1155burnable.batchfrom.md) | | Burn a batch of NFTs | -| [batchFromSelf(tokenIds, amounts)](./sdk.erc1155burnable.batchfromself.md) | | Burn a batch of NFTs | | [from(account, tokenId, amount)](./sdk.erc1155burnable.from.md) | | Burn a specified amount of a NFTs | -| [fromSelf(tokenId, amount)](./sdk.erc1155burnable.fromself.md) | | Burn a specified amount of a NFTs | +| [tokens(tokenId, amount)](./sdk.erc1155burnable.tokens.md) | | Burn a specified amount of a NFTs | diff --git a/docs/sdk.erc1155burnable.fromself.md b/docs/sdk.erc1155burnable.tokens.md similarity index 68% rename from docs/sdk.erc1155burnable.fromself.md rename to docs/sdk.erc1155burnable.tokens.md index a35927a33..5f2cb2420 100644 --- a/docs/sdk.erc1155burnable.fromself.md +++ b/docs/sdk.erc1155burnable.tokens.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Burnable](./sdk.erc1155burnable.md) > [fromSelf](./sdk.erc1155burnable.fromself.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc1155Burnable](./sdk.erc1155burnable.md) > [tokens](./sdk.erc1155burnable.tokens.md) -## Erc1155Burnable.fromSelf() method +## Erc1155Burnable.tokens() method Burn a specified amount of a NFTs Signature: ```typescript -fromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; +tokens(tokenId: BigNumberish, amount: BigNumberish): Promise; ``` ## Parameters @@ -36,6 +36,6 @@ const tokenId = 0; // The amount of the NFT you want to burn const amount = 2; -const result = await contract.edition.burn.fromSelf(tokenId, amount); +const result = await contract.edition.burn.tokens(tokenId, amount); ``` diff --git a/docs/sdk.erc20burnable.md b/docs/sdk.erc20burnable.md index b6357020d..41dca911b 100644 --- a/docs/sdk.erc20burnable.md +++ b/docs/sdk.erc20burnable.md @@ -28,5 +28,5 @@ export declare class Erc20Burnable implements DetectableFeature | Method | Modifiers | Description | | --- | --- | --- | | [from(holder, amount)](./sdk.erc20burnable.from.md) | | Burn Tokens | -| [fromSelf(amount)](./sdk.erc20burnable.fromself.md) | | Burn Tokens | +| [tokens(amount)](./sdk.erc20burnable.tokens.md) | | Burn Tokens | diff --git a/docs/sdk.erc20burnable.fromself.md b/docs/sdk.erc20burnable.tokens.md similarity index 68% rename from docs/sdk.erc20burnable.fromself.md rename to docs/sdk.erc20burnable.tokens.md index f0ff5ce87..9f451930c 100644 --- a/docs/sdk.erc20burnable.fromself.md +++ b/docs/sdk.erc20burnable.tokens.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc20Burnable](./sdk.erc20burnable.md) > [fromSelf](./sdk.erc20burnable.fromself.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc20Burnable](./sdk.erc20burnable.md) > [tokens](./sdk.erc20burnable.tokens.md) -## Erc20Burnable.fromSelf() method +## Erc20Burnable.tokens() method Burn Tokens Signature: ```typescript -fromSelf(amount: Amount): Promise; +tokens(amount: Amount): Promise; ``` ## Parameters @@ -33,6 +33,6 @@ Burn tokens held by the connected wallet // The amount of this token you want to burn const amount = 1.2; -await contract.token.burn.fromSelf(amount); +await contract.token.burn.tokens(amount); ``` diff --git a/docs/sdk.erc721burnable.md b/docs/sdk.erc721burnable.md index 5f4146584..597e63fcf 100644 --- a/docs/sdk.erc721burnable.md +++ b/docs/sdk.erc721burnable.md @@ -27,5 +27,5 @@ export declare class Erc721Burnable implements DetectableFeature | Method | Modifiers | Description | | --- | --- | --- | -| [fromSelf(tokenId)](./sdk.erc721burnable.fromself.md) | | Burn NFTs | +| [token(tokenId)](./sdk.erc721burnable.token.md) | | Burn NFTs | diff --git a/docs/sdk.erc721burnable.fromself.md b/docs/sdk.erc721burnable.token.md similarity index 66% rename from docs/sdk.erc721burnable.fromself.md rename to docs/sdk.erc721burnable.token.md index 663bae57b..d31ac38a0 100644 --- a/docs/sdk.erc721burnable.fromself.md +++ b/docs/sdk.erc721burnable.token.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc721Burnable](./sdk.erc721burnable.md) > [fromSelf](./sdk.erc721burnable.fromself.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Erc721Burnable](./sdk.erc721burnable.md) > [token](./sdk.erc721burnable.token.md) -## Erc721Burnable.fromSelf() method +## Erc721Burnable.token() method Burn NFTs Signature: ```typescript -fromSelf(tokenId: BigNumberish): Promise; +token(tokenId: BigNumberish): Promise; ``` ## Parameters @@ -33,6 +33,6 @@ Burn NFTs held by the connected wallet // The token ID of the NFT you want to burn const tokenId = 0; -await contract.nft.burn.fromSelf(tokenId); +await contract.nft.burn.token(tokenId); ``` diff --git a/docs/sdk.nftcollection.burnfromself.md b/docs/sdk.nftcollection.burntoken.md similarity index 61% rename from docs/sdk.nftcollection.burnfromself.md rename to docs/sdk.nftcollection.burntoken.md index efb73704b..a8c7d3f19 100644 --- a/docs/sdk.nftcollection.burnfromself.md +++ b/docs/sdk.nftcollection.burntoken.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [NFTCollection](./sdk.nftcollection.md) > [burnFromSelf](./sdk.nftcollection.burnfromself.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [NFTCollection](./sdk.nftcollection.md) > [burnToken](./sdk.nftcollection.burntoken.md) -## NFTCollection.burnFromSelf() method +## NFTCollection.burnToken() method Burn a single NFT Signature: ```typescript -burnFromSelf(tokenId: BigNumberish): Promise; +burnToken(tokenId: BigNumberish): Promise; ``` ## Parameters @@ -26,6 +26,6 @@ Promise<[TransactionResult](./sdk.transactionresult.md)> ```javascript -const result = await contract.burnFromSelf(tokenId); +const result = await contract.burnToken(tokenId); ``` diff --git a/docs/sdk.nftcollection.md b/docs/sdk.nftcollection.md index 8a678f39f..e33aaac75 100644 --- a/docs/sdk.nftcollection.md +++ b/docs/sdk.nftcollection.md @@ -50,7 +50,7 @@ const contract = sdk.getNFTCollection("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burnFromSelf(tokenId)](./sdk.nftcollection.burnfromself.md) | | Burn a single NFT | +| [burnToken(tokenId)](./sdk.nftcollection.burntoken.md) | | Burn a single NFT | | [getAll(queryParams)](./sdk.nftcollection.getall.md) | | Get All Minted NFTs | | [getOwned(walletAddress)](./sdk.nftcollection.getowned.md) | | Get Owned NFTs | | [getOwnedTokenIds(walletAddress)](./sdk.nftcollection.getownedtokenids.md) | | Get all token ids of NFTs owned by a specific wallet. | diff --git a/docs/sdk.nftdrop.burnfromself.md b/docs/sdk.nftdrop.burntoken.md similarity index 63% rename from docs/sdk.nftdrop.burnfromself.md rename to docs/sdk.nftdrop.burntoken.md index 89e979d46..22b053fac 100644 --- a/docs/sdk.nftdrop.burnfromself.md +++ b/docs/sdk.nftdrop.burntoken.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [NFTDrop](./sdk.nftdrop.md) > [burnFromSelf](./sdk.nftdrop.burnfromself.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [NFTDrop](./sdk.nftdrop.md) > [burnToken](./sdk.nftdrop.burntoken.md) -## NFTDrop.burnFromSelf() method +## NFTDrop.burnToken() method Burn a single NFT Signature: ```typescript -burnFromSelf(tokenId: BigNumberish): Promise; +burnToken(tokenId: BigNumberish): Promise; ``` ## Parameters @@ -26,6 +26,6 @@ Promise<[TransactionResult](./sdk.transactionresult.md)> ```javascript -const result = await contract.burnFromSelf(tokenId); +const result = await contract.burnToken(tokenId); ``` diff --git a/docs/sdk.nftdrop.md b/docs/sdk.nftdrop.md index e63d2f4ab..7edae6bc3 100644 --- a/docs/sdk.nftdrop.md +++ b/docs/sdk.nftdrop.md @@ -51,7 +51,7 @@ const contract = sdk.getNFTDrop("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burnFromSelf(tokenId)](./sdk.nftdrop.burnfromself.md) | | Burn a single NFT | +| [burnToken(tokenId)](./sdk.nftdrop.burntoken.md) | | Burn a single NFT | | [claim(quantity, checkERC20Allowance)](./sdk.nftdrop.claim.md) | | Claim NFTs to the connected wallet. | | [claimTo(destinationAddress, quantity, checkERC20Allowance)](./sdk.nftdrop.claimto.md) | | Claim unique NFTs to a specific Wallet | | [createBatch(metadatas, options)](./sdk.nftdrop.createbatch.md) | | Create a batch of unique NFTs to be claimed in the future | diff --git a/docs/sdk.signaturedrop.burnfromself.md b/docs/sdk.signaturedrop.burntoken.md similarity index 60% rename from docs/sdk.signaturedrop.burnfromself.md rename to docs/sdk.signaturedrop.burntoken.md index c65d62275..fcd420cc4 100644 --- a/docs/sdk.signaturedrop.burnfromself.md +++ b/docs/sdk.signaturedrop.burntoken.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [SignatureDrop](./sdk.signaturedrop.md) > [burnFromSelf](./sdk.signaturedrop.burnfromself.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [SignatureDrop](./sdk.signaturedrop.md) > [burnToken](./sdk.signaturedrop.burntoken.md) -## SignatureDrop.burnFromSelf() method +## SignatureDrop.burnToken() method Burn a single NFT Signature: ```typescript -burnFromSelf(tokenId: BigNumberish): Promise; +burnToken(tokenId: BigNumberish): Promise; ``` ## Parameters @@ -26,6 +26,6 @@ Promise<[TransactionResult](./sdk.transactionresult.md)> ```javascript -const result = await contract.burnFromSelf(tokenId, amount); +const result = await contract.burnToken(tokenId); ``` diff --git a/docs/sdk.signaturedrop.md b/docs/sdk.signaturedrop.md index 75133455c..e05ca6a0d 100644 --- a/docs/sdk.signaturedrop.md +++ b/docs/sdk.signaturedrop.md @@ -52,7 +52,7 @@ const contract = sdk.getSignatureDrop("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | -| [burnFromSelf(tokenId)](./sdk.signaturedrop.burnfromself.md) | | Burn a single NFT | +| [burnToken(tokenId)](./sdk.signaturedrop.burntoken.md) | | Burn a single NFT | | [claim(quantity, checkERC20Allowance)](./sdk.signaturedrop.claim.md) | | Claim NFTs to the connected wallet. | | [claimTo(destinationAddress, quantity, checkERC20Allowance)](./sdk.signaturedrop.claimto.md) | | Claim unique NFTs to a specific Wallet | | [createBatch(metadatas, options)](./sdk.signaturedrop.createbatch.md) | | Create a batch of unique NFTs to be claimed in the future | diff --git a/docs/sdk.token.burnfromself.md b/docs/sdk.token.burntokens.md similarity index 70% rename from docs/sdk.token.burnfromself.md rename to docs/sdk.token.burntokens.md index cb98b22e3..087cde64a 100644 --- a/docs/sdk.token.burnfromself.md +++ b/docs/sdk.token.burntokens.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Token](./sdk.token.md) > [burnFromSelf](./sdk.token.burnfromself.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [Token](./sdk.token.md) > [burnTokens](./sdk.token.burntokens.md) -## Token.burnFromSelf() method +## Token.burnTokens() method Burn Tokens Signature: ```typescript -burnFromSelf(amount: Amount): Promise; +burnTokens(amount: Amount): Promise; ``` ## Parameters @@ -33,6 +33,6 @@ Burn tokens held by the connected wallet // The amount of this token you want to burn const amount = 1.2; -await contract.burnFromSelf(amount); +await contract.burnTokens(amount); ``` diff --git a/docs/sdk.token.md b/docs/sdk.token.md index 72caa0297..16ee2c786 100644 --- a/docs/sdk.token.md +++ b/docs/sdk.token.md @@ -50,7 +50,7 @@ const contract = sdk.getToken("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | | [burnFrom(holder, amount)](./sdk.token.burnfrom.md) | | Burn Tokens | -| [burnFromSelf(amount)](./sdk.token.burnfromself.md) | | Burn Tokens | +| [burnTokens(amount)](./sdk.token.burntokens.md) | | Burn Tokens | | [getDelegation()](./sdk.token.getdelegation.md) | | Get your voting delegatee address | | [getDelegationOf(account)](./sdk.token.getdelegationof.md) | | Get a specific address voting delegatee address | | [getVoteBalance()](./sdk.token.getvotebalance.md) | | Get your wallet voting power for the current checkpoints | diff --git a/docs/sdk.tokendrop.burnfromself.md b/docs/sdk.tokendrop.burntokens.md similarity index 69% rename from docs/sdk.tokendrop.burnfromself.md rename to docs/sdk.tokendrop.burntokens.md index f037157de..e02df32df 100644 --- a/docs/sdk.tokendrop.burnfromself.md +++ b/docs/sdk.tokendrop.burntokens.md @@ -1,15 +1,15 @@ -[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [TokenDrop](./sdk.tokendrop.md) > [burnFromSelf](./sdk.tokendrop.burnfromself.md) +[Home](./index.md) > [@thirdweb-dev/sdk](./sdk.md) > [TokenDrop](./sdk.tokendrop.md) > [burnTokens](./sdk.tokendrop.burntokens.md) -## TokenDrop.burnFromSelf() method +## TokenDrop.burnTokens() method Burn Tokens Signature: ```typescript -burnFromSelf(amount: Amount): Promise; +burnTokens(amount: Amount): Promise; ``` ## Parameters @@ -33,6 +33,6 @@ Burn tokens held by the connected wallet // The amount of this token you want to burn const amount = 1.2; -await contract.burnFromSelf(amount); +await contract.burnTokens(amount); ``` diff --git a/docs/sdk.tokendrop.md b/docs/sdk.tokendrop.md index 2967ad29a..cb56b0aab 100644 --- a/docs/sdk.tokendrop.md +++ b/docs/sdk.tokendrop.md @@ -49,7 +49,7 @@ const contract = sdk.getTokenDrop("{{contract_address}}"); | Method | Modifiers | Description | | --- | --- | --- | | [burnFrom(holder, amount)](./sdk.tokendrop.burnfrom.md) | | Burn Tokens | -| [burnFromSelf(amount)](./sdk.tokendrop.burnfromself.md) | | Burn Tokens | +| [burnTokens(amount)](./sdk.tokendrop.burntokens.md) | | Burn Tokens | | [claim(amount, checkERC20Allowance)](./sdk.tokendrop.claim.md) | | Claim a certain amount of tokens | | [claimTo(destinationAddress, amount, checkERC20Allowance)](./sdk.tokendrop.claimto.md) | | Claim a certain amount of tokens to a specific Wallet | | [getDelegation()](./sdk.tokendrop.getdelegation.md) | | Get your voting delegatee address | diff --git a/docs/snippets.json b/docs/snippets.json index 57f44395e..fb568debc 100644 --- a/docs/snippets.json +++ b/docs/snippets.json @@ -421,13 +421,13 @@ }, "methods": [ { - "name": "burnFromSelf", + "name": "burnTokens", "summary": "Burn a specified amount of a NFT\n\n", "remarks": null, "examples": { - "javascript": "const result = await contract.burnFromSelf(tokenId, amount);" + "javascript": "const result = await contract.burnTokens(tokenId, amount);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.Edition.burnFromSelf" + "reference": "https://docs.thirdweb.com/typescript/sdk.Edition.burnTokens" }, { "name": "getAll", @@ -533,13 +533,13 @@ }, "methods": [ { - "name": "burnFromSelf", + "name": "burnTokens", "summary": "Burn a specified amount of a NFT\n\n", "remarks": null, "examples": { - "javascript": "const result = await contract.burnFromSelf(tokenId, amount);" + "javascript": "const result = await contract.burnTokens(tokenId, amount);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.EditionDrop.burnFromSelf" + "reference": "https://docs.thirdweb.com/typescript/sdk.EditionDrop.burnTokens" }, { "name": "claimTo", @@ -980,13 +980,13 @@ }, "methods": [ { - "name": "burnFromSelf", + "name": "burnToken", "summary": "Burn a single NFT\n\n", "remarks": null, "examples": { - "javascript": "const result = await contract.burnFromSelf(tokenId);" + "javascript": "const result = await contract.burnToken(tokenId);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.NFTCollection.burnFromSelf" + "reference": "https://docs.thirdweb.com/typescript/sdk.NFTCollection.burnToken" }, { "name": "getAll", @@ -1083,13 +1083,13 @@ }, "methods": [ { - "name": "burnFromSelf", + "name": "burnToken", "summary": "Burn a single NFT\n\n", "remarks": null, "examples": { - "javascript": "const result = await contract.burnFromSelf(tokenId);" + "javascript": "const result = await contract.burnToken(tokenId);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.NFTDrop.burnFromSelf" + "reference": "https://docs.thirdweb.com/typescript/sdk.NFTDrop.burnToken" }, { "name": "claimTo", @@ -1371,13 +1371,13 @@ }, "methods": [ { - "name": "burnFromSelf", + "name": "burnToken", "summary": "Burn a single NFT\n\n", "remarks": null, "examples": { - "javascript": "const result = await contract.burnFromSelf(tokenId, amount);" + "javascript": "const result = await contract.burnToken(tokenId);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.SignatureDrop.burnFromSelf" + "reference": "https://docs.thirdweb.com/typescript/sdk.SignatureDrop.burnToken" }, { "name": "claimTo", @@ -1624,13 +1624,13 @@ "reference": "https://docs.thirdweb.com/typescript/sdk.Token.burnFrom" }, { - "name": "burnFromSelf", + "name": "burnTokens", "summary": "Burn Tokens\n\n", "remarks": "\n\nBurn tokens held by the connected wallet\n\n", "examples": { - "javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.burnFromSelf(amount);" + "javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.burnTokens(amount);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.Token.burnFromSelf" + "reference": "https://docs.thirdweb.com/typescript/sdk.Token.burnTokens" }, { "name": "mintBatchTo", @@ -1772,13 +1772,13 @@ "reference": "https://docs.thirdweb.com/typescript/sdk.TokenDrop.burnFrom" }, { - "name": "burnFromSelf", + "name": "burnTokens", "summary": "Burn Tokens\n\n", "remarks": "\n\nBurn tokens held by the connected wallet\n\n", "examples": { - "javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.burnFromSelf(amount);" + "javascript": "// The amount of this token you want to burn\nconst amount = 1.2;\n\nawait contract.burnTokens(amount);" }, - "reference": "https://docs.thirdweb.com/typescript/sdk.TokenDrop.burnFromSelf" + "reference": "https://docs.thirdweb.com/typescript/sdk.TokenDrop.burnTokens" }, { "name": "claimTo", diff --git a/etc/sdk.api.md b/etc/sdk.api.md index 416977c67..fbe46b25f 100644 --- a/etc/sdk.api.md +++ b/etc/sdk.api.md @@ -1808,7 +1808,7 @@ export class DuplicateLeafsError extends Error { // @public export class Edition extends Erc1155 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burnFromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; + burnTokens(tokenId: BigNumberish, amount: BigNumberish): Promise; // (undocumented) static contractAbi: any; // (undocumented) @@ -1951,7 +1951,7 @@ export class Edition extends Erc1155 { // @public export class EditionDrop extends Erc1155 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burnFromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; + burnTokens(tokenId: BigNumberish, amount: BigNumberish): Promise; claim(tokenId: BigNumberish, quantity: BigNumberish, checkERC20Allowance?: boolean): Promise; claimConditions: DropErc1155ClaimConditions; claimTo(destinationAddress: string, tokenId: BigNumberish, quantity: BigNumberish, checkERC20Allowance?: boolean): Promise; @@ -2444,12 +2444,12 @@ export class Erc1155BatchMintable implements DetectableFeature { export class Erc1155Burnable implements DetectableFeature { // Warning: (ae-forgotten-export) The symbol "IBurnableERC1155" needs to be exported by the entry point index.d.ts constructor(contractWrapper: ContractWrapper); + batch(tokenIds: BigNumberish[], amounts: BigNumberish[]): Promise; batchFrom(account: string, tokenIds: BigNumberish[], amounts: BigNumberish[]): Promise; - batchFromSelf(tokenIds: BigNumberish[], amounts: BigNumberish[]): Promise; // (undocumented) featureName: "ERC1155Burnable"; from(account: string, tokenId: BigNumberish, amount: BigNumberish): Promise; - fromSelf(tokenId: BigNumberish, amount: BigNumberish): Promise; + tokens(tokenId: BigNumberish, amount: BigNumberish): Promise; } // @public (undocumented) @@ -2562,7 +2562,7 @@ export class Erc20Burnable implements DetectableFeature { // (undocumented) featureName: "ERC20Burnable"; from(holder: string, amount: Amount): Promise; - fromSelf(amount: Amount): Promise; + tokens(amount: Amount): Promise; } // @public @@ -2652,7 +2652,7 @@ export class Erc721Burnable implements DetectableFeature { constructor(contractWrapper: ContractWrapper); // (undocumented) featureName: "ERC721Burnable"; - fromSelf(tokenId: BigNumberish): Promise; + token(tokenId: BigNumberish): Promise; } // @public @@ -3631,7 +3631,7 @@ export interface NewDirectListing { // @public export class NFTCollection extends Erc721 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burnFromSelf(tokenId: BigNumberish): Promise; + burnToken(tokenId: BigNumberish): Promise; // (undocumented) static contractAbi: any; // (undocumented) @@ -3788,7 +3788,7 @@ export interface NFTContractDeployMetadata { // @public export class NFTDrop extends Erc721 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burnFromSelf(tokenId: BigNumberish): Promise; + burnToken(tokenId: BigNumberish): Promise; claim(quantity: BigNumberish, checkERC20Allowance?: boolean): Promise[]>; claimConditions: DropClaimConditions; claimTo(destinationAddress: string, quantity: BigNumberish, checkERC20Allowance?: boolean): Promise[]>; @@ -5759,7 +5759,7 @@ export const Signature721WithQuantityOutput: z.ZodObject { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); - burnFromSelf(tokenId: BigNumberish): Promise; + burnToken(tokenId: BigNumberish): Promise; claim(quantity: BigNumberish, checkERC20Allowance?: boolean): Promise[]>; claimConditions: DropClaimConditions; claimTo(destinationAddress: string, quantity: BigNumberish, checkERC20Allowance?: boolean): Promise[]>; @@ -6518,7 +6518,7 @@ export class ThirdwebSDK extends RPCConnectionHandler { export class Token extends Erc20 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); burnFrom(holder: string, amount: Amount): Promise; - burnFromSelf(amount: Amount): Promise; + burnTokens(amount: Amount): Promise; // (undocumented) static contractAbi: any; // (undocumented) @@ -6654,7 +6654,7 @@ export interface TokenContractDeployMetadata { export class TokenDrop extends Erc20 { constructor(network: NetworkOrSignerOrProvider, address: string, storage: IStorage, options?: SDKOptions, contractWrapper?: ContractWrapper); burnFrom(holder: string, amount: Amount): Promise; - burnFromSelf(amount: Amount): Promise; + burnTokens(amount: Amount): Promise; claim(amount: Amount, checkERC20Allowance?: boolean): Promise; claimConditions: DropClaimConditions; claimTo(destinationAddress: string, amount: Amount, checkERC20Allowance?: boolean): Promise; diff --git a/src/contracts/edition-drop.ts b/src/contracts/edition-drop.ts index 981aa7977..1ba425b86 100644 --- a/src/contracts/edition-drop.ts +++ b/src/contracts/edition-drop.ts @@ -411,7 +411,7 @@ export class EditionDrop extends Erc1155 { tokenId: BigNumberish, amount: BigNumberish, ): Promise { - return this._burn.fromSelf(tokenId, amount); + return this._burn.tokens(tokenId, amount); } /** ****************************** diff --git a/src/contracts/edition.ts b/src/contracts/edition.ts index 1e97384cf..8780cab1a 100644 --- a/src/contracts/edition.ts +++ b/src/contracts/edition.ts @@ -357,6 +357,6 @@ export class Edition extends Erc1155 { tokenId: BigNumberish, amount: BigNumberish, ): Promise { - return this._burn.fromSelf(tokenId, amount); + return this._burn.tokens(tokenId, amount); } } diff --git a/src/contracts/token-drop.ts b/src/contracts/token-drop.ts index c0f9404f7..14aba00e2 100644 --- a/src/contracts/token-drop.ts +++ b/src/contracts/token-drop.ts @@ -263,7 +263,30 @@ export class TokenDrop extends Erc20 { * ``` */ public async burnTokens(amount: Amount): Promise { - return this._burn.fromSelf(amount); + return this._burn.tokens(amount); + } + + /** + * Burn Tokens + * + * @remarks Burn tokens held by the specified wallet + * + * @example + * ```javascript + * // Address of the wallet sending the tokens + * const holderAddress = "{{wallet_address}}"; + * + * // The amount of this token you want to burn + * const amount = 1.2; + * + * await contract.burnFrom(holderAddress, amount); + * ``` + */ + public async burnFrom( + holder: string, + amount: Amount, + ): Promise { + return this._burn.from(holder, amount); } /** ****************************** diff --git a/src/contracts/token.ts b/src/contracts/token.ts index 02344f78a..1a4750d62 100644 --- a/src/contracts/token.ts +++ b/src/contracts/token.ts @@ -245,6 +245,29 @@ export class Token extends Erc20 { * ``` */ public async burnTokens(amount: Amount): Promise { - return this._burn.fromSelf(amount); + return this._burn.tokens(amount); + } + + /** + * Burn Tokens + * + * @remarks Burn tokens held by the specified wallet + * + * @example + * ```javascript + * // Address of the wallet sending the tokens + * const holderAddress = "{{wallet_address}}"; + * + * // The amount of this token you want to burn + * const amount = 1.2; + * + * await contract.burnFrom(holderAddress, amount); + * ``` + */ + public async burnFrom( + holder: string, + amount: Amount, + ): Promise { + return this._burn.from(holder, amount); } } diff --git a/src/core/classes/erc-1155-burnable.ts b/src/core/classes/erc-1155-burnable.ts index f61025796..59de92800 100644 --- a/src/core/classes/erc-1155-burnable.ts +++ b/src/core/classes/erc-1155-burnable.ts @@ -29,10 +29,10 @@ export class Erc1155Burnable implements DetectableFeature { * // The amount of the NFT you want to burn * const amount = 2; * - * const result = await contract.edition.burn.fromSelf(tokenId, amount); + * const result = await contract.edition.burn.tokens(tokenId, amount); * ``` */ - public async fromSelf( + public async tokens( tokenId: BigNumberish, amount: BigNumberish, ): Promise { @@ -90,10 +90,10 @@ export class Erc1155Burnable implements DetectableFeature { * // The amounts of each NFT you want to burn * const amounts = [2, 2]; * - * const result = await contract.edition.burn.batchFromSelf(tokenIds, amounts); + * const result = await contract.edition.burn.batch(tokenIds, amounts); * ``` */ - public async batchFromSelf( + public async batch( tokenIds: BigNumberish[], amounts: BigNumberish[], ): Promise { diff --git a/src/core/classes/erc-20-burnable.ts b/src/core/classes/erc-20-burnable.ts index a0526c524..90f9e5624 100644 --- a/src/core/classes/erc-20-burnable.ts +++ b/src/core/classes/erc-20-burnable.ts @@ -27,10 +27,10 @@ export class Erc20Burnable implements DetectableFeature { * // The amount of this token you want to burn * const amount = 1.2; * - * await contract.token.burn.fromSelf(amount); + * await contract.token.burn.tokens(amount); * ``` */ - public async fromSelf(amount: Amount): Promise { + public async tokens(amount: Amount): Promise { return { receipt: await this.contractWrapper.sendTransaction("burn", [ await this.erc20.normalizeAmount(amount), diff --git a/test/custom.test.ts b/test/custom.test.ts index ef4c6d7ec..1aff54494 100644 --- a/test/custom.test.ts +++ b/test/custom.test.ts @@ -248,7 +248,7 @@ describe("Custom Contracts", async () => { invariant(c.token.burn, "ERC20Burnable undefined"); await c.token.mint?.to(adminWallet.address, 2); expect((await c.token.balance()).displayValue).to.eq("2.0"); - await c.token.burn.fromSelf(1); + await c.token.burn.tokens(1); expect((await c.token.balance()).displayValue).to.eq("1.0"); }); @@ -366,11 +366,11 @@ describe("Custom Contracts", async () => { let balance = await c.edition.balance(0); expect(balance.toString()).to.eq("100"); - await c.edition.burn.fromSelf(0, 10); + await c.edition.burn.tokens(0, 10); balance = await c.edition.balance(0); expect(balance.toString()).to.eq("90"); - await c.edition.burn.batchFromSelf([0, 1], [10, 10]); + await c.edition.burn.batch([0, 1], [10, 10]); balance = await c.edition.balance(0); expect(balance.toString()).to.eq("80"); balance = await c.edition.balance(1);