Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "index"

Index

Type aliases

PoolAction

PoolAction: { create: BN } | { redeem: BN } | { swap: Basket }

PoolRequest

PoolRequest: { initialize: InitializePoolRequest } | { getBasket: PoolAction } | { execute: PoolAction }

Variables

Const AssetInfo

AssetInfo: Layout<AssetInfo> = struct([publicKey('mint'),publicKey('vaultAddress'),])

Const Basket

Basket: Layout<Basket> = struct([vec(i64(), 'quantities')])

Const InitializePoolRequest

InitializePoolRequest: Layout<InitializePoolRequest> = struct([u8('vaultSignerNonce'),u8('assetsLength'),str('poolName'),u32('feeRate'),vecU8('customData'),])

Const POOL_REQUEST_TAG

POOL_REQUEST_TAG: BN = new BN('220a6cbdcd1cc4cf', 'hex')

Const POOL_STATE_TAG

POOL_STATE_TAG: BN = new BN('16a7874c7fb2301b', 'hex')

Const ParamDesc

ParamDesc: Layout<ParamDesc> = struct([publicKey('address'),bool('writable'),])

Const PoolAction

PoolAction: Layout<PoolAction> = rustEnum([u64('create'),u64('redeem'),Basket.replicate('swap'),])

Const PoolRequest

PoolRequest: Layout<PoolRequest> = tagged(POOL_REQUEST_TAG,rustEnum([InitializePoolRequest.replicate('initialize'),PoolAction.replicate('getBasket'),PoolAction.replicate('execute'),]),)

Const PoolState

PoolState: Layout<PoolState> = tagged(POOL_STATE_TAG,struct([publicKey('poolTokenMint'),vec(AssetInfo, 'assets'),publicKey('vaultSigner'),u8('vaultSignerNonce'),vec(ParamDesc, 'accountParams'),str('name'),publicKey('lqdFeeVault'),publicKey('initializerFeeVault'),u32('feeRate'),option(publicKey(), 'adminKey'),vecU8('customState'),]),)

Functions

decodePoolRequest

decodePoolState

encodePoolRequest

encodePoolState

getPoolBasket

  • Fetch the basket for a creation or redemption.

    For creations, the basket is the quantity of each asset that needs to be paid to the pool to create the given quantity of pool tokens.

    For redemptions, the basket is the quantity of each asset that is received from the pool in return for redeeming the given quantity of pool tokens.

    Parameters

    • connection: Connection

      Connection to use to fetch data.

    • pool: PoolInfo

      Pool to interact with.

    • action: PoolAction

      Creation, redemption, or swap.

    • Default value payer: PublicKey = new PublicKey('H6WR1VVoiwWz1GMSBALwUNNazvE7UhAZEjaYTTSwvV8D',)

      Arbitrary Solana address. Must hold nonzero SOL and not be owned by a program.

    Returns Promise<Basket>

isAdminControlledPool

  • isAdminControlledPool(pool: PoolInfo): boolean

isPoolState

  • isPoolState(data: Buffer): boolean
  • Parameters

    • data: Buffer

    Returns boolean

loadPoolInfo

  • loadPoolInfo(connection: Connection, address: PublicKey): Promise<PoolInfo>
  • Load and decode pool state.

    Throws an error if the pool is not found or invalid.

    Parameters

    • connection: Connection

      Solana connection to use to fetch the pool state.

    • address: PublicKey

      Pool state account address.

    Returns Promise<PoolInfo>

Generated using TypeDoc