Class Erc1155SignatureMintable

Enables generating dynamic ERC1155 NFTs with rules and an associated signature, which can then be minted by anyone securely

Hierarchy

  • Erc1155SignatureMintable

Implements

  • DetectableFeature

Constructors

Properties

contractWrapper: ContractWrapper<BaseSignatureMintERC1155 | TokenERC1155>
featureName: "ERC1155SignatureMintable" = FEATURE_EDITION_SIGNATURE_MINTABLE.name
mint: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Mint a dynamically generated NFT

      Parameters

      Returns Promise<TResult>

      Remarks

      Mint a dynamic NFT with a previously generated signature.

      Example

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

      // now anyone can mint the NFT
      const tx = contract.erc1155.signature.mint(signedPayload);

      Twfeature

      ERC1155SignatureMintable

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

Type declaration

    • (...args): Promise<TResult>
    • Mint any number of dynamically generated NFT at once

      Parameters

      Returns Promise<TResult>

      Remarks

      Mint multiple dynamic NFTs in one transaction. Note that this is only possible for free mints (cannot batch mints with a price attached to it for security reasons)

      Example

      // see how to craft a batch of payloads to sign in the `generateBatch()` documentation
      const signedPayloads = contract.erc1155.signature.generateBatch(payloads);

      // now anyone can mint the NFT
      const tx = contract.erc1155.signature.mintBatch(signedPayloads);

      Twfeature

      ERC1155SignatureMintable

  • prepare: ((...args) => Promise<Transaction<TransactionResultWithId[]>>)
roles: undefined | ContractRoles<TokenERC1155, "transfer" | "minter" | "admin">
storage: ThirdwebStorage<IpfsUploadBatchOptions>

Methods

  • Generate a signature that can be used to mint an NFT dynamically.

    Parameters

    • payloadToSign: {
          currencyAddress?: string;
          metadata?: string | objectInputType<({ name: ZodNullable<ZodOptional<ZodUnion<[ZodString, ZodNumber]>>>; description: ZodNullable<ZodOptional<ZodNullable<ZodString>>>; ... 5 more ...; attributes: ZodNullable<...>; }), ZodUnion<[ZodEffects<ZodUnion<[ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>, ZodType<BN, ZodTypeDef, BN>]>, string, bigint | BN | BigNumber>, ZodUnknown]>, "strip">;
          mintEndTime?: number | Date;
          mintStartTime?: number | Date;
          price?: string | number;
          primarySaleRecipient?: string;
          quantity: Object;
          royaltyBps?: number;
          royaltyRecipient?: string;
          to: string;
          uid?: string;
      }

      the payload to sign

      • Optional currencyAddress?: string
      • Optional metadata?: string | objectInputType<({ name: ZodNullable<ZodOptional<ZodUnion<[ZodString, ZodNumber]>>>; description: ZodNullable<ZodOptional<ZodNullable<ZodString>>>; ... 5 more ...; attributes: ZodNullable<...>; }), ZodUnion<[ZodEffects<ZodUnion<[ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>, ZodType<BN, ZodTypeDef, BN>]>, string, bigint | BN | BigNumber>, ZodUnknown]>, "strip">
      • Optional mintEndTime?: number | Date
      • Optional mintStartTime?: number | Date
      • Optional price?: string | number
      • Optional primarySaleRecipient?: string
      • quantity: Object
      • Optional royaltyBps?: number
      • Optional royaltyRecipient?: string
      • to: string
      • Optional uid?: string

    Returns Promise<SignedPayload1155>

    the signed payload and the corresponding signature

    Remarks

    Takes in an NFT and some information about how it can be minted, uploads the metadata and signs it with your private key. The generated signature can then be used to mint an NFT using the exact payload and signature generated.

    Example

    const nftMetadata = {
    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
    };

    const startTime = new Date();
    const endTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
    const payload = {
    metadata: nftMetadata, // The NFT to mint
    to: {{wallet_address}}, // Who will receive the NFT
    quantity: 2, // the quantity of NFTs to mint
    price: 0.5, // the price per NFT
    currencyAddress: NATIVE_TOKEN_ADDRESS, // the currency to pay with
    mintStartTime: startTime, // can mint anytime from now
    mintEndTime: endTime, // to 24h from now
    royaltyRecipient: "0x...", // custom royalty recipient for this NFT
    royaltyBps: 100, // custom royalty fees for this NFT (in bps)
    primarySaleRecipient: "0x...", // custom sale recipient for this NFT
    };

    const signedPayload = await contract.erc1155.signature.generate(payload);
    // now anyone can use these to mint the NFT using `contract.erc1155.signature.mint(signedPayload)`

    Twfeature

    ERC1155SignatureMintable

  • Generate a batch of signatures that can be used to mint many new NFTs dynamically.

    Parameters

    • payloadsToSign: {
          currencyAddress?: string;
          metadata?: string | objectInputType<({ name: ZodNullable<ZodOptional<ZodUnion<[ZodString, ZodNumber]>>>; description: ZodNullable<ZodOptional<ZodNullable<ZodString>>>; ... 5 more ...; attributes: ZodNullable<...>; }), ZodUnion<[ZodEffects<ZodUnion<[ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>, ZodType<BN, ZodTypeDef, BN>]>, string, bigint | BN | BigNumber>, ZodUnknown]>, "strip">;
          mintEndTime?: number | Date;
          mintStartTime?: number | Date;
          price?: string | number;
          primarySaleRecipient?: string;
          quantity: Object;
          royaltyBps?: number;
          royaltyRecipient?: string;
          to: string;
          uid?: string;
      }[]

      the payloads to sign

    Returns Promise<SignedPayload1155[]>

    an array of payloads and signatures

    Remarks

    See Erc1155SignatureMintable.generate

    Twfeature

    ERC1155SignatureMintable

  • Generate a batch of signatures that can be used to mint new NFTs or additionally supply to existing NFTs dynamically.

    Parameters

    • payloadsToSign: {
          currencyAddress?: string;
          metadata?: string | objectInputType<({ name: ZodNullable<ZodOptional<ZodUnion<[ZodString, ZodNumber]>>>; description: ZodNullable<ZodOptional<ZodNullable<ZodString>>>; ... 5 more ...; attributes: ZodNullable<...>; }), ZodUnion<[ZodEffects<ZodUnion<[ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>, ZodType<BN, ZodTypeDef, BN>]>, string, bigint | BN | BigNumber>, ZodUnknown]>, "strip">;
          mintEndTime?: number | Date;
          mintStartTime?: number | Date;
          price?: string | number;
          primarySaleRecipient?: string;
          quantity: Object;
          royaltyBps?: number;
          royaltyRecipient?: string;
          to: string;
          tokenId: Object;
          uid?: string;
      }[]

      the payloads to sign with tokenIds specified

    Returns Promise<SignedPayload1155[]>

    an array of payloads and signatures

    Remarks

    See Erc1155SignatureMintable.generateFromTokenId

    Twfeature

    ERC1155SignatureMintable

  • Generate a signature that can be used to mint additionally supply to an existing NFT.

    Parameters

    • payloadToSign: {
          currencyAddress?: string;
          metadata?: string | objectInputType<({ name: ZodNullable<ZodOptional<ZodUnion<[ZodString, ZodNumber]>>>; description: ZodNullable<ZodOptional<ZodNullable<ZodString>>>; ... 5 more ...; attributes: ZodNullable<...>; }), ZodUnion<[ZodEffects<ZodUnion<[ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>, ZodType<BN, ZodTypeDef, BN>]>, string, bigint | BN | BigNumber>, ZodUnknown]>, "strip">;
          mintEndTime?: number | Date;
          mintStartTime?: number | Date;
          price?: string | number;
          primarySaleRecipient?: string;
          quantity: Object;
          royaltyBps?: number;
          royaltyRecipient?: string;
          to: string;
          tokenId: Object;
          uid?: string;
      }

      the payload to sign

      • Optional currencyAddress?: string
      • Optional metadata?: string | objectInputType<({ name: ZodNullable<ZodOptional<ZodUnion<[ZodString, ZodNumber]>>>; description: ZodNullable<ZodOptional<ZodNullable<ZodString>>>; ... 5 more ...; attributes: ZodNullable<...>; }), ZodUnion<[ZodEffects<ZodUnion<[ZodBigInt, ZodType<BigNumber, ZodTypeDef, BigNumber>, ZodType<BN, ZodTypeDef, BN>]>, string, bigint | BN | BigNumber>, ZodUnknown]>, "strip">
      • Optional mintEndTime?: number | Date
      • Optional mintStartTime?: number | Date
      • Optional price?: string | number
      • Optional primarySaleRecipient?: string
      • quantity: Object
      • Optional royaltyBps?: number
      • Optional royaltyRecipient?: string
      • to: string
      • tokenId: Object
      • Optional uid?: string

    Returns Promise<SignedPayload1155>

    the signed payload and the corresponding signature

    Remarks

    Takes in a payload with the token ID of an existing NFT, and signs it with your private key. The generated signature can then be used to mint additional supply to the NFT using the exact payload and signature generated.

    Example

    const nftMetadata = {
    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
    };

    const startTime = new Date();
    const endTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
    const payload = {
    tokenId: 0, // Instead of metadata, we specify the token ID of the NFT to mint supply to
    to: {{wallet_address}}, // Who will receive the NFT (or AddressZero for anyone)
    quantity: 2, // the quantity of NFTs to mint
    price: 0.5, // the price per NFT
    currencyAddress: NATIVE_TOKEN_ADDRESS, // the currency to pay with
    mintStartTime: startTime, // can mint anytime from now
    mintEndTime: endTime, // to 24h from now
    royaltyRecipient: "0x...", // custom royalty recipient for this NFT
    royaltyBps: 100, // custom royalty fees for this NFT (in bps)
    primarySaleRecipient: "0x...", // custom sale recipient for this NFT
    };

    const signedPayload = await contract.erc1155.signature.generateFromTokenId(payload);
    // now anyone can use these to mint the NFT using `contract.erc1155.signature.mint(signedPayload)`

    Twfeature

    ERC1155SignatureMintable

  • Verify that a payload is correctly signed

    Parameters

    Returns Promise<boolean>

    Twfeature

    ERC1155SignatureMintable

    Example

    const nftMetadata = {
    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
    };

    const startTime = new Date();
    const endTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
    const payload = {
    metadata: nftMetadata, // The NFT to mint
    to: {{wallet_address}}, // Who will receive the NFT
    quantity: 2, // the quantity of NFTs to mint
    price: 0.5, // the price per NFT
    currencyAddress: NATIVE_TOKEN_ADDRESS, // the currency to pay with
    mintStartTime: startTime, // can mint anytime from now
    mintEndTime: endTime, // to 24h from now
    royaltyRecipient: "0x...", // custom royalty recipient for this NFT
    royaltyBps: 100, // custom royalty fees for this NFT (in bps)
    primarySaleRecipient: "0x...", // custom sale recipient for this NFT
    };

    const signedPayload = contract.erc1155.signature.generate(payload);
    // Now you can verify that the payload is valid
    const isValid = await contract.erc1155.signature.verify(signedPayload);

Generated using TypeDoc