Getting CLMM Pools

1. Get All Pools

Use sdk.Pool.getPoolsWithPage() method to retrieve all pools.

Parameters

  • pagination_args: Default to get all pool lists, supports pagination

Example

async function getAllPools() {
  const pools = await sdk.Pool.getPoolsWithPage()
  console.log(`pool length: ${pools.length}`)
}

2. Batch Get assign Pools

Use sdk.Pool.getAssignPools() method to retrieve specific pools.

Parameters

  • assign_pools: An array of pool ID to get.

Example

const pools = await sdk.Pool.getAssignPools(assign_pools)
console.log(pools)

3. Get Single Pool

Use sdk.Pool.getPool() method to retrieve a specific pool.

Parameters

  • pool_id: Pool address

  • force_refresh: Optional boolean to refresh cache

Example

4. Get Pool by Coin Types

Use sdk.Pool.getPoolByCoins() method to find pools by coin types.

Parameters

  • coins: Array of coin types

  • fee_rate: Optional fee rate number

Example

5. Notes

Some common methods for pool

1. Convert SqrtPrice to Price

Use TickMath.sqrtPriceX64ToPrice() method to convert a given sqrtPrice to a price.

Parameters

  • sqrt_price_x64: The sqrtPrice value to convert.

  • decimals_a: The number of decimals for coin A.

  • decimals_b: The number of decimals for coin B.

Example

Last updated