Skip to main content

JS Kit SDK API Reference / Instructions / _createAtaIdempotentInstruction

Function: _createAtaIdempotentInstruction()

_createAtaIdempotentInstruction(programAddress, payer, ata, owner, mint, systemProgram, splTokenProgram): Instruction

Defined in: instructions/createAtaIdempotentInstruction.ts:32

Creates an idempotent associated-token-account instruction.

The instruction succeeds when the associated token account already exists, allowing callers to include it safely before token transfers.

Parameters​

programAddress​

Address

Associated Token Program address

payer​

Address

Account funding associated token account creation

ata​

Address

Derived associated token account address

owner​

Address

Owner of the associated token account

mint​

Address

Token mint for the associated token account

systemProgram​

Address

Solana System Program address

splTokenProgram​

Address

SPL Token Program address

Returns​

Instruction

Idempotent associated-token-account creation instruction

Example​

const instruction = _createAtaIdempotentInstruction(
ASSOCIATED_TOKEN_PROGRAM_ADDRESS,
payer,
ata,
owner,
mint,
SYSTEM_PROGRAM_ADDRESS,
TOKEN_PROGRAM_ADDRESS,
);