TokenInstruction.mintToChecked constructor
TokenInstruction.mintToChecked({
- required int amount,
- required int decimals,
- required Ed25519HDPublicKey mint,
- required Ed25519HDPublicKey destination,
- required Ed25519HDPublicKey authority,
Mints new tokens to an account. The native mint does not support minting.
This instruction differs from TokenInstruction.mintTo in that the decimals value is checked by the caller. This may be useful when creating transactions offline or within a hardware wallet.
Implementation
factory TokenInstruction.mintToChecked({
required int amount,
required int decimals,
required Ed25519HDPublicKey mint,
required Ed25519HDPublicKey destination,
required Ed25519HDPublicKey authority,
}) =>
TokenInstruction._(
accounts: [
AccountMeta.writeable(pubKey: mint, isSigner: false),
AccountMeta.writeable(pubKey: destination, isSigner: false),
// TODO(IA): this should be readonly unless, it is the fee payer
AccountMeta.writeable(pubKey: authority, isSigner: true),
],
data: ByteArray.merge([
TokenProgram.mintToCheckedInstructionIndex,
ByteArray.u64(amount),
ByteArray.u8(decimals),
]),
);