@lightprotocol/compressed-token - v0.23.0-beta.8
    Preparing search index...

    Function createTransferInterfaceInstructions

    • Create instructions for a light-token transfer.

      Returns TransactionInstruction[][] -- an array of transaction instruction arrays. Each inner array is one transaction to sign and send.

      • All transactions except the last can be sent in parallel (load/decompress).
      • The last transaction is the transfer and must be sent after all others confirm.
      • For a hot sender or <=8 cold inputs, the result is a single-element array.

      Use sliceLast to separate the parallel prefix from the final transfer:

      const batches = await createTransferInterfaceInstructions(...);
      const { rest, last } = sliceLast(batches);

      When ensureRecipientAta is true (the default), an idempotent associated token account creation instruction is included in the transfer (last) transaction. No extra RPC fetch -- the instruction is a no-op on-chain if the associated token account already exists. Set ensureRecipientAta: false if you manage recipient associated token accounts yourself.

      All transactions require payer + sender as signers.

      Hash uniqueness guarantee: all compressed accounts for the sender are fetched once, then partitioned into non-overlapping chunks by tree version. Each hash appears in exactly one batch. This is enforced at runtime by assertUniqueInputHashes inside _buildLoadBatches.

      Parameters

      • rpc: Rpc

        RPC connection

      • payer: PublicKey

        Fee payer public key

      • mint: PublicKey

        Mint address

      • amount: number | bigint | BN

        Amount to transfer

      • sender: PublicKey

        Sender public key (must sign all transactions)

      • recipient: PublicKey

        Recipient public key

      • Optionaloptions: TransferOptions

        Optional configuration

      Returns Promise<TransactionInstruction[][]>

      TransactionInstruction[][] -- send [0..n-2] in parallel, then [n-1]