mintTo static method
Mints new tokens to an account. The native mint does not support minting.
Keys:
Single authority
[w]
mint
- The mint.[w]
account
- The account to mint tokens to.[s]
mintAuthority
- The mint's minting authority.
Multisignature authority
[w]
mint
- The mint.[w]
account
- The account to mint tokens to.[]
mintAuthority
- The mint's multisignature mint-tokens authority.[s]
signers
- The signer accounts.
Data:
amount
- The amount of new tokens to mint.
Implementation
static TransactionInstruction mintTo({
// Keys
required final Pubkey mint,
required final Pubkey account,
required final Pubkey mintAuthority,
final List<Pubkey> signers = const [],
// Data
required final bu64 amount,
}) {
// * Single authority
// 0. `[writable]` The mint.
// 1. `[writable]` The account to mint tokens to.
// 2. `[signer]` The mint's minting authority.
//
// * Multisignature authority
// 0. `[writable]` The mint.
// 1. `[writable]` The account to mint tokens to.
// 2. `[]` The mint's multisignature mint-tokens authority.
// 3. ..3+M `[signer]` M signer accounts.
final List<AccountMeta> keys = [
AccountMeta.writable(mint),
AccountMeta.writable(account),
AccountMeta(mintAuthority, isSigner: signers.isEmpty),
for (final Pubkey signer in signers) AccountMeta.signer(signer),
];
final List<Iterable<u8>> data = [
borsh.u64.encode(amount),
];
return _instance.createTransactionIntruction(
TokenInstruction.mintTo,
keys: keys,
data: data,
);
}