createIdempotent static method
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.
[writeable,signer]
Funding account (must be a system account)[writeable]
Associated token account address to be created[]
Wallet address for the new associated token account[]
The token mint for the new associated token account[]
System program[]
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,
);
}