Function getOrCreateAssociatedTokenAccount

  • Get or create an associated token account (ATA)

    Gets the ATA address and if needed, the instruction to create it

    Returns

    Address of the new associated token account and instruction to create it if it doesn't exist

    Parameters

    • connection: Connection

      Solana connection

    • mint: PublicKey

      the mint address

    • owner: PublicKey

      the owner of the ATA

    • Optional allowOwnerOffCurve: boolean

      allow the owner account to be a PDA (Program Derived Address)

    Returns Promise<{
        address: PublicKey;
        info: null | AccountInfo<Buffer>;
        instructions: null | InstructionReturn;
    }>

Generated using TypeDoc