generateMintSignature

Generates a payload and signature for minting ERC721 tokens via a MintableERC721 module.

Example

import { MintableERC20 } from "thirdweb/modules";
// generate the payload and signature, this is typically done on the server
// requires to be generated with a wallet that has the MINTER_ROLE
const { payload, signature } =
await MintableERC721.generateMintSignature({
account,
contract,
nfts: [
{
name: "My NFT",
description: "My NFT",
image: "https://example.com/image.png",
},
],
mintRequest: {
recipient: "0x...",
},
});
// prepare the transaction, this is typically done on the client
// can be executed by any wallet
const transaction = MintableERC20.mintWithSignature({
contract,
payload,
signature,
});
// Send the transaction
await sendTransaction({ transaction, account });
function generateMintSignature(
): Promise<{
payload: {
amount: bigint;
baseURI: string;
data: `0x${string}`;
to: `0x${string}`;
};
signature: `0x${string}`;
}>;

Parameters

The options for generating the payload and signature.

Type

let options: {
account: Account;
contract: ThirdwebContract;
contractType?: "TokenERC1155" | "SignatureMintERC1155";
mintRequest: GeneratePayloadInput;
};

Returns

let returnType: Promise<{
payload: {
amount: bigint;
baseURI: string;
data: `0x${string}`;
to: `0x${string}`;
};
signature: `0x${string}`;
}>;

The payload and signature.