createIdempotent static method

TransactionInstruction createIdempotent({
  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, if it doesn't already exist. Returns an error if the account exists, but with a different owner.

  1. [writeable,signer] Funding account (must be a system account)
  2. [writeable] Associated token account address to be created
  3. [] Wallet address for the new associated token account
  4. [] The token mint for the new associated token account
  5. [] System program
  6. [] SPL Token program

Implementation

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