create static method

TransactionInstruction create({
  1. required Pubkey fundingAccount,
  2. required Pubkey associatedTokenAccount,
  3. required Pubkey associatedTokenAccountOwner,
  4. required Pubkey tokenMint,
})

Creates an associated token account for the given wallet address and token mint.

Returns an error if the account exists.

Keys:

  • [w,s] fundingAccount - Funding account (must be a system account).
  • [w] associatedTokenAccount - Associated token account address to be created.
  • [] associatedTokenAccountOwner - Wallet address for the new associated token account.
  • [] tokenMint - The token mint for the new associated token account.

Implementation

static TransactionInstruction create({
  required final Pubkey fundingAccount,
  required final Pubkey associatedTokenAccount,
  required final Pubkey associatedTokenAccountOwner,
  required final Pubkey tokenMint,
}) {
  return _createInstruction(
    AssociatedTokenInstruction.create,
    fundingAccount: fundingAccount,
    associatedTokenAccount: associatedTokenAccount,
    associatedTokenAccountOwner: associatedTokenAccountOwner,
    tokenMint: tokenMint,
  );
}