Create a collection of NFTs that lets you mint multiple copies of each NFT.

Example

import { ThirdwebSDK } from "@thirdweb-dev/sdk";

const sdk = new ThirdwebSDK("{{chainName}}");
const contract = await sdk.getContract("{{contract_address}}", "edition");

Hierarchy

Constructors

  • Parameters

    • network: NetworkInput
    • address: string
    • storage: ThirdwebStorage<IpfsUploadBatchOptions>
    • options: undefined | {
          clientId?: string;
          gasSettings?: { maxPriceInGwei?: number | undefined; speed?: "standard" | "fast" | "fastest" | undefined; };
          gasless?: ({ openzeppelin: { relayerUrl: string; relayerForwarderAddress?: string | undefined; useEOAForwarder?: boolean | undefined; domainName?: string | undefined; domainVersion?: string | undefined; }; experimentalChainlessSupport?: boolean | undefined; }) | ({ biconomy: { apiId: string; apiKey: string; deadlineSeconds?: number | undefined; }; });
          gatewayUrls?: string[];
          readonlySettings?: { rpcUrl: string; chainId?: number | undefined; };
          secretKey?: string;
          supportedChains?: ({ rpc: string[]; chainId: number; nativeCurrency: { symbol: string; name: string; decimals: number; }; slug: string; })[];
      } = {}
    • abi: objectInputType<{
          inputs: ZodDefault<ZodArray<ZodObject<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, "strip", ZodAny, objectOutputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">, objectInputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">>, "many">>;
          name: ZodDefault<ZodString>;
          outputs: ZodDefault<ZodArray<ZodObject<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, "strip", ZodAny, objectOutputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">, objectInputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">>, "many">>;
          type: ZodString;
      }, ZodAny, "strip">[]
    • chainId: number
    • contractWrapper: ContractWrapper<TokenERC1155> = ...

    Returns Edition

Properties

abi: objectOutputType<{
    inputs: ZodDefault<ZodArray<ZodObject<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, "strip", ZodAny, objectOutputType<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, ZodAny, "strip">, objectInputType<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, ZodAny, "strip">>, "many">>;
    name: ZodDefault<ZodString>;
    outputs: ZodDefault<ZodArray<ZodObject<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, "strip", ZodAny, objectOutputType<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, ZodAny, "strip">, objectInputType<{
        components: ZodOptional<ZodArray<ZodObject<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            name: ZodDefault<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        stateMutability: ZodOptional<ZodString>;
        type: ZodString;
    }, ZodAny, "strip">>, "many">>;
    type: ZodString;
}, ZodAny, "strip">[]
airdrop: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Airdrop multiple NFTs

      Parameters

      • Rest ...args: [tokenId: BigNumberish, addresses: string[] | {
            address: string;
            quantity?: string | number;
        }[], fromAddress?: string, data: BytesLike]

      Returns Promise<TResult>

      Remarks

      Airdrop one or multiple NFTs to the provided wallet addresses.

      Twfeature

      ERC1155

      Example

      // The token ID of the NFT you want to airdrop
      const tokenId = "0";
      // Array of objects of addresses and quantities to airdrop NFTs to
      const addresses = [
      {
      address: "0x...",
      quantity: 2,
      },
      {
      address: "0x...",
      quantity: 3,
      },
      ];
      await contract.airdrop(tokenId, addresses);

      // You can also pass an array of addresses, it will airdrop 1 NFT per address
      const tokenId = "0";
      const addresses = [
      "0x...", "0x...", "0x...",
      ]
      await contract.airdrop(tokenId, addresses);
  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

        • Rest ...args: [tokenId: BigNumberish, addresses: string[] | {
              address: string;
              quantity?: string | number;
          }[], fromAddress?: string, data: BytesLike]

        Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

app: ContractAppURI<TokenERC1155>
burn: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Burn a specified amount of a NFT

      Parameters

      • Rest ...args: [tokenId: BigNumberish, amount: BigNumberish]

      Returns Promise<TResult>

      Example

      const result = await contract.burnTokens(tokenId, amount);
      
  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

        • Rest ...args: [tokenId: BigNumberish, amount: BigNumberish]

        Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

contractWrapper: ContractWrapper<TokenERC1155>
encoder: ContractEncoder<TokenERC1155>
erc1155: Erc1155<BaseERC1155 | BaseSignatureMintERC1155>
estimator: GasCostEstimator<TokenERC1155>
events: ContractEvents<TokenERC1155>
interceptor: ContractInterceptor<TokenERC1155>
metadata: ContractMetadata<TokenERC1155, {
    deploy: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        platform_fee_basis_points: ZodDefault<ZodNumber>;
        platform_fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        primary_sale_recipient: ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
        trusted_forwarders: ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>, "many">>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: any;
        name: string;
        platform_fee_basis_points: number;
        platform_fee_recipient: string;
        primary_sale_recipient: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
        trusted_forwarders: string[];
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        name: string;
        platform_fee_basis_points?: number;
        platform_fee_recipient?: string;
        primary_sale_recipient: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
        trusted_forwarders?: string[];
    }>;
    input: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: any;
        name: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        name: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
    }>;
    output: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodString>;
        name: ZodString;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: string;
        name: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: string;
        name: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
    }>;
}>

Type declaration

  • deploy: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        platform_fee_basis_points: ZodDefault<ZodNumber>;
        platform_fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        primary_sale_recipient: ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
        trusted_forwarders: ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>, "many">>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: any;
        name: string;
        platform_fee_basis_points: number;
        platform_fee_recipient: string;
        primary_sale_recipient: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
        trusted_forwarders: string[];
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        name: string;
        platform_fee_basis_points?: number;
        platform_fee_recipient?: string;
        primary_sale_recipient: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
        trusted_forwarders?: string[];
    }>
  • input: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: any;
        name: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        name: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
    }>
  • output: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodString>;
        name: ZodString;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: string;
        name: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: string;
        name: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
    }>
mint: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId<NFT>>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

mintAdditionalSupply: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId<NFT>>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

mintAdditionalSupplyTo: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId<NFT>>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

mintBatch: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId<NFT>[]>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

mintBatchTo: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId<NFT>[]>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Mint Many NFTs with limited supplies

      Parameters

      • Rest ...args: [to: string, metadataWithSupply: {
            metadata: Object;
            supply: Object;
        }[]]

      Returns Promise<TResult>

      Remarks

      Mint many different NFTs with limited supplies to a specified wallet.

      Example

      // Address of the wallet you want to mint the NFT to
      const toAddress = "{{wallet_address}}"

      // Custom metadata and supplies of your NFTs
      const metadataWithSupply = [{
      supply: 50, // The number of this NFT you want to mint
      metadata: {
      name: "Cool NFT #1",
      description: "This is a cool NFT",
      image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
      },
      }, {
      supply: 100,
      metadata: {
      name: "Cool NFT #2",
      description: "This is a cool NFT",
      image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
      },
      }];

      const tx = await contract.mintBatchTo(toAddress, metadataWithSupply);
      const receipt = tx[0].receipt; // same transaction receipt for all minted NFTs
      const firstTokenId = tx[0].id; // token id of the first minted NFT
      const firstNFT = await tx[0].data(); // (optional) fetch details of the first minted NFT
  • prepare: ((...args) => Promise<Transaction<TransactionResultWithId<NFT>[]>>)
mintTo: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId<NFT>>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Mint an NFT with a limited supply

      Parameters

      • Rest ...args: [to: string, metadataWithSupply: {
            metadata: Object;
            supply: Object;
        }]

      Returns Promise<TResult>

      Remarks

      Mint an NFT with a limited supply to a specified wallet.

      Example

      // Address of the wallet you want to mint the NFT to
      const toAddress = "{{wallet_address}}"

      // Custom metadata of the NFT, note that you can fully customize this metadata with other properties.
      const metadata = {
      name: "Cool NFT",
      description: "This is a cool NFT",
      image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
      }

      const metadataWithSupply = {
      metadata,
      supply: 1000, // The number of this NFT you want to mint
      }

      const tx = await contract.mintTo(toAddress, metadataWithSupply);
      const receipt = tx.receipt; // the transaction receipt
      const tokenId = tx.id; // the id of the NFT minted
      const nft = await tx.data(); // (optional) fetch details of minted NFT
  • prepare: ((...args) => Promise<Transaction<TransactionResultWithId<NFT>>>)
owner: ContractOwner<TokenERC1155>
platformFees: ContractPlatformFee<TokenERC1155>
roles: ContractRoles<TokenERC1155, "transfer" | "minter" | "admin">
royalties: ContractRoyalty<TokenERC1155, {
    deploy: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        platform_fee_basis_points: ZodDefault<ZodNumber>;
        platform_fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        primary_sale_recipient: ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
        trusted_forwarders: ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>, "many">>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: any;
        name: string;
        platform_fee_basis_points: number;
        platform_fee_recipient: string;
        primary_sale_recipient: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
        trusted_forwarders: string[];
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        name: string;
        platform_fee_basis_points?: number;
        platform_fee_recipient?: string;
        primary_sale_recipient: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
        trusted_forwarders?: string[];
    }>;
    input: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: any;
        name: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        name: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
    }>;
    output: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodString>;
        name: ZodString;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: string;
        name: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: string;
        name: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
    }>;
}>

Configure royalties

Type declaration

  • deploy: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        platform_fee_basis_points: ZodDefault<ZodNumber>;
        platform_fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        primary_sale_recipient: ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
        trusted_forwarders: ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>, "many">>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: any;
        name: string;
        platform_fee_basis_points: number;
        platform_fee_recipient: string;
        primary_sale_recipient: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
        trusted_forwarders: string[];
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        name: string;
        platform_fee_basis_points?: number;
        platform_fee_recipient?: string;
        primary_sale_recipient: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
        trusted_forwarders?: string[];
    }>
  • input: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        name: ZodString;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: any;
        name: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        name: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
    }>
  • output: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        image: ZodOptional<ZodString>;
        name: ZodString;
        seller_fee_basis_points: ZodDefault<ZodNumber>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodDefault<ZodString>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient: string;
        image?: string;
        name: string;
        seller_fee_basis_points: number;
        social_urls?: Record<string, string>;
        symbol: string;
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: string;
        name: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
    }>

Remarks

Set your own royalties for the entire contract or per token

Example

// royalties on the whole contract
contract.royalties.setDefaultRoyaltyInfo({
seller_fee_basis_points: 100, // 1%
fee_recipient: "0x..."
});
// override royalty for a particular token
contract.royalties.setTokenRoyaltyInfo(tokenId, {
seller_fee_basis_points: 500, // 5%
fee_recipient: "0x..."
});

Signature Minting

Remarks

Generate dynamic NFTs with your own signature, and let others mint them using that signature.

Example

// see how to craft a payload to sign in the `contract.signature.generate()` documentation
const signedPayload = contract.signature.generate(payload);

// now anyone can mint the NFT
const tx = contract.signature.mint(signedPayload);
const receipt = tx.receipt; // the mint transaction receipt
const mintedId = tx.id; // the id of the NFT minted
storage: ThirdwebStorage<IpfsUploadBatchOptions>
transfer: {
    prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Transfer an NFT

      Parameters

      • Rest ...args: [to: string, tokenId: BigNumberish, amount: BigNumberish, data: BytesLike]

      Returns Promise<TResult>

      Remarks

      Transfer an NFT from the connected wallet to another wallet.

      Example

      // Address of the wallet you want to send the NFT to
      const toAddress = "{{wallet_address}}";
      const tokenId = "0"; // The token ID of the NFT you want to send
      const amount = 3; // How many copies of the NFTs to transfer
      await contract.transfer(toAddress, tokenId, amount);
  • prepare: ((...args) => Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>)
      • (...args): Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>
      • Parameters

        • Rest ...args: [to: string, tokenId: BigNumberish, amount: BigNumberish, data: BytesLike]

        Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

contractRoles: readonly ["admin", "minter", "transfer"] = NFT_BASE_CONTRACT_ROLES

Accessors

Methods

  • Get NFT Balance

    Parameters

    • address: string
    • tokenId: BigNumberish

    Returns Promise<BigNumber>

    Remarks

    Get a wallets NFT balance (number of NFTs in this contract owned by the wallet).

    Example

    // Address of the wallet to check NFT balance
    const walletAddress = "{{wallet_address}}";
    const tokenId = 0; // Id of the NFT to check
    const balance = await contract.balanceOf(walletAddress, tokenId);
  • Get all NFTs

    Parameters

    • Optional queryParams: {
          count?: number;
          start?: number;
      }

      optional filtering to only fetch a subset of results.

      • Optional count?: number
      • Optional start?: number

    Returns Promise<NFT[]>

    The NFT metadata for all NFTs queried.

    Remarks

    Get all the data associated with every NFT in this contract.

    By default, returns the first 100 NFTs, use queryParams to fetch more.

    Example

    const nfts = await contract.getAll();
    
  • Construct a mint transaction without executing it. This is useful for estimating the gas cost of a mint transaction, overriding transaction options and having fine grained control over the transaction execution.

    Parameters

    • receiver: string

      Address you want to send the token to

    • metadataWithSupply: {
          metadata: Object;
          supply: Object;
      }

      The metadata of the NFT you want to mint

      • metadata: Object
      • supply: Object

    Returns Promise<Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>>

    Deprecated

    contract.mint.prepare(...args)

  • Get all NFTs owned by a specific wallet

    Parameters

    • Optional walletAddress: string
    • Optional queryParams: {
          count?: number;
          start?: number;
      }
      • Optional count?: number
      • Optional start?: number

    Returns Promise<NFT[]>

    The NFT metadata for all NFTs in the contract.

    Remarks

    Get all the data associated with the NFTs owned by a specific wallet.

    Example

    // Address of the wallet to get the NFTs of
    const address = "{{wallet_address}}";
    const nfts = await contract.getOwned(address);

Generated using TypeDoc