Class Erc721WithQuantitySignatureMintable

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

Hierarchy

  • Erc721WithQuantitySignatureMintable

Implements

  • DetectableFeature

Constructors

Properties

contractWrapper: ContractWrapper<SignatureMintERC721 | TokenERC721>
featureName: "ERC721SignatureMintV2" = FEATURE_NFT_SIGNATURE_MINTABLE_V2.name
mint: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithId>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

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

Type declaration

storage: ThirdwebStorage<IpfsUploadBatchOptions>

Methods

  • Generate a signature that can be used to mint a dynamic NFT

    Parameters

    • mintRequest: {
          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?: string | number | bigint | BigNumber;
          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
      • Optional quantity?: string | number | bigint | BigNumber
      • Optional royaltyBps?: number
      • Optional royaltyRecipient?: string
      • to: string
      • Optional uid?: string

    Returns Promise<SignedPayload721WithQuantitySignature>

    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.erc721.signature.generate(payload);
    // now anyone can use these to mint the NFT using `contract.erc721.signature.mint(signedPayload)`

    Twfeature

    ERC721SignatureMint

  • Genrate a batch of signatures that can be used to mint many dynamic NFTs.

    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?: string | number | bigint | BigNumber;
          royaltyBps?: number;
          royaltyRecipient?: string;
          to: string;
          uid?: string;
      }[]

      the payloads to sign

    Returns Promise<SignedPayload721WithQuantitySignature[]>

    an array of payloads and signatures

    Remarks

    See Erc721WithQuantitySignatureMintable.generate

    Twfeature

    ERC721SignatureMint

  • Parameters

    • mintRequest: {
          currencyAddress: string;
          metadata: Object;
          mintEndTime: BigNumber;
          mintStartTime: BigNumber;
          price: string;
          primarySaleRecipient: string;
          quantity: BigNumber;
          royaltyBps: BigNumber;
          royaltyRecipient: string;
          to: string;
          uid: string;
          uri: string;
      }
      • currencyAddress: string
      • metadata: Object
      • mintEndTime: BigNumber
      • mintStartTime: BigNumber
      • price: string
      • primarySaleRecipient: string
      • quantity: BigNumber
      • royaltyBps: BigNumber
      • royaltyRecipient: string
      • to: string
      • uid: string
      • uri: string

    Returns Promise<MintRequestStructOutput>

  • Verify that a payload is correctly signed

    Parameters

    Returns Promise<boolean>

    Twfeature

    ERC721SignatureMint

    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.erc721.signature.generate(payload);
    // Now you can verify if the signed payload is valid
    const isValid = await contract.erc721.signature.verify(signedPayload);

Generated using TypeDoc