freezeAccount static method
Freeze an Initialized account using the Mint's freeze_authority (if set).
Keys:
Single owner
[w]
account
- The account to freeze.[]
mint
- The token mint.[s]
authority
- The mint freeze authority.
Multisignature owner
[w]
account
- The account to freeze.[]
mint
- The token mint.[]
authority
- The mint's multisignature freeze authority.[s]
signers
- The signer accounts.
Implementation
static TransactionInstruction freezeAccount({
required final Pubkey account,
required final Pubkey mint,
required final Pubkey authority,
final List<Pubkey> signers = const [],
}) {
// * Single owner
// 0. `[w]` The account to fress.
// 1. `[w]` The token mint.
// 2. `[s]` The mint freeze authority.
//
// * Multisignature owner
// 0. `[w]` The account to freeze.
// 1. `[w]` The token mint.
// 2. `[]` The mint's multisignature freeze authority.
// 3. `[s]` ..3+M, M signer accounts.
final List<AccountMeta> keys = [
AccountMeta.writable(account),
AccountMeta.writable(mint),
AccountMeta(authority, isSigner: signers.isEmpty),
for (final Pubkey signer in signers) AccountMeta.signer(signer),
];
return _instance.createTransactionIntruction(
TokenInstruction.freezeAccount,
keys: keys,
);
}