Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PoolInstructions

Low-level API for constructing and encoding pool instructions.

For a higher-level API that handles initializing accounts and approving token transfers, use PoolTransactions.

Hierarchy

  • PoolInstructions

Index

Methods

Static execute

  • Instruction to execute a creation, redemption, or swap.

    Parameters

    • pool: PoolInfo
    • action: PoolAction

      Creation, redemption, or swap.

    • user: UserInfo

      Token accounts to pull funds from or send funds to.

    Returns TransactionInstruction

Static getBasket

  • getBasket(pool: PoolInfo, action: PoolAction, retbufAccount: PublicKey): TransactionInstruction
  • Instruction to get the expected basket for a PoolAction.

    For creations, the basket is the quantity of each asset that need to be sent to the pool to process the creation. For redemptions and swaps, the basket is the quantity of each asset that will be transferred from the pool to the user after the redemption or swap.

    Negative quantities will cause tokens to be transferred in the opposite direction.

    Parameters

    • pool: PoolInfo
    • action: PoolAction

      Creation, redemption, or swap.

    • retbufAccount: PublicKey

      Account to which the basket will be written. Must be owned by the retbuf program.

    Returns TransactionInstruction

Static initialize

  • initialize(poolProgram: PublicKey, poolAccount: PublicKey, poolTokenMint: PublicKey, poolName: string, vaults: PublicKey[], vaultSigner: PublicKey, vaultSignerNonce: number, lqdFeeAccount: PublicKey, initializerFeeAccount: PublicKey, feeRate: number, additionalAccounts?: AccountMeta[], customData?: Buffer): TransactionInstruction
  • Instruction to initialize a pool.

    Parameters

    • poolProgram: PublicKey

      Program ID of the pool program.

    • poolAccount: PublicKey

      Newly-created account to hold the pool state. Must be owned by the pool program.

    • poolTokenMint: PublicKey

      spl-token mint address for the pool token.

    • poolName: string

      User-friendly name for the pool.

    • vaults: PublicKey[]

      spl-token account for each of the assets in the pool.

    • vaultSigner: PublicKey

      Mint authority for poolTokenMint and owner of poolTokenMint.

    • vaultSignerNonce: number

      Nonce used to generate vaultSigner.

    • lqdFeeAccount: PublicKey

      Pool token spl-token account owned by the LQD fee owner.

    • initializerFeeAccount: PublicKey

      Pool token spl-token account owned by the pool initializer.

    • feeRate: number

      Fee rate for creations/redemptions times 10^6.

    • Optional additionalAccounts: AccountMeta[]

      Any custom pool-specific accounts needed to initialize the pool.

    • Optional customData: Buffer

      Any custom pool-specific data needed to initialize the pool

    Returns TransactionInstruction

Generated using TypeDoc