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

    Function wrap

    • Wrap tokens from an SPL/T22 account to a light-token account.

      This is an agnostic action that takes explicit account addresses (spl-token style). Use getAssociatedTokenAddressSync() to derive associated token account addresses if needed.

      Parameters

      • rpc: Rpc

        RPC connection

      • payer: Signer

        Fee payer

      • source: PublicKey

        Source SPL/T22 token account (any token account, not just associated token account)

      • destination: PublicKey

        Destination light-token account

      • owner: Signer

        Owner/authority of the source account (must sign)

      • mint: PublicKey

        Mint address

      • amount: bigint

        Amount to wrap

      • OptionalsplInterfaceInfo: SplInterfaceInfo

        Optional: SPL interface info (will be fetched if not provided)

      • OptionalmaxTopUp: number

        Optional: cap on rent top-up (units of 1k lamports; default no cap)

      • OptionalconfirmOptions: ConfirmOptions

        Optional: Confirm options

      Returns Promise<string>

      Transaction signature

      const splAta = getAssociatedTokenAddressSync(mint, owner.publicKey, false, TOKEN_PROGRAM_ID);
      const ctokenAta = getAssociatedTokenAddressInterface(mint, owner.publicKey); // defaults to light-token

      await wrap(
      rpc,
      payer,
      splAta,
      ctokenAta,
      owner,
      mint,
      1000n,
      );