Skip to main content
The LBSwapService class provides methods for calculating swap amounts and fees. It is used internally by the LiquidityBookServices class, but can also be used as a standalone service.

Constructor

new LBSwapService

Creates a new instance of the LBSwapService class. Parameters
Program<Idl>
required
The Liquidity Book program instance.
Connection
required
The Solana connection object.

Methods

fromLbConfig

A static method to create a new instance of the LBSwapService class. Parameters
Program<Idl>
required
The Liquidity Book program instance.
Connection
required
The Solana connection object.
Returns
LBSwapService
A new instance of LBSwapService.

getBinArray

Retrieves the bin array for a given pair and bin array index. Parameters
GetBinArrayParams
required
Returns
PublicKey
The public key of the bin array.