Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PoolTransactions

High-level API for constructing transactions to interact with pools.

For a lower-level API, see PoolInstructions.

Hierarchy

  • PoolTransactions

Index

Methods

Static execute

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

    This is a wrapper around PoolInstructions.execute that handles token delegation.

    The transaction will create a temporary account, delegate tokens to it, and use it in place of the actual owner, to limit the quantity of tokens that the pool can pull from the user's accounts.

    Parameters

    • pool: PoolInfo

      Pool to interact with.

    • action: PoolAction

      Creation, redemption, or swap.

    • user: UserInfo

      Token accounts to pull funds from or send funds to.

    • expectedBasket: Basket

      Expected basket. Used to determine the quantity of tokens to approve.

    Returns TransactionAndSigners

Static getBasket

  • Transaction to get a pool basket, for use with simulateTransaction.

    This is a wrapper around PoolInstructions.getBasket that handles initializing the retbuf account.

    Parameters

    • pool: PoolInfo

      Pool to interact with.

    • action: PoolAction

      Creation, redemption, or swap.

    • payer: PublicKey

      Payer for fees. Must have nonzero SOL but will not be charged if the transaction is only simulated.

    Returns TransactionAndSigners

Static initializeSimplePool

  • Transaction to initialize a simple pool.

    This will:

    • initialize a new pool token mint
    • initialize a pool token account for the creator and mint some tokens to it
    • initialize vault accounts for each of the pool assets
    • transfer assets from the pool creator to the vault accounts
    • initialize the pool

    Parameters

    Returns Promise<[]>

Generated using TypeDoc