getMintTokensInstructions
function getMintTokensInstructions(args): Instruction<string, readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>[];Create the instructions required to mint tokens to any wallet/owner, including creating their ATA if it does not exist
Example
const mint = await generateKeyPairSigner();
const destination = address("nicktrLHhYzLmoVbuZQzHUTicd2sfP571orwo9jfc8c");
const instructions = getMintTokensInstructions({
mint,
feePayer: signer,
mintAuthority: signer,
amount: 1000, // note: be sure to consider the mint's `decimals` value
// if decimals=2 => this will mint 10.00 tokens
// if decimals=4 => this will mint 0.100 tokens
destination,
// be sure to set the correct token program when getting the `ata`
ata: await getAssociatedTokenAccountAddress(mint, destination, tokenProgram),
// tokenProgram: TOKEN_PROGRAM_ADDRESS, // default
// tokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
});Parameters
| Parameter | Type |
|---|---|
args | GetMintTokensInstructionsArgs |
Returns
Instruction<string, readonly (AccountLookupMeta<string, string> | AccountMeta<string>)[]>[]