Magma Developer SDK
  • Getting started
  • Prerequisites
  • Features Available
  • Retrieve clmm pools
  • Retrieve positions
  • Retrieve reward
  • Retrieve ticks
  • Create clmm pool
  • Open position
  • Add liquidity
  • Remove liquidity
  • Close position
  • Collect fees
  • Collect rewards
  • Preswap
  • Swap
  • Partner swap
  • Smart router
  • Price impact
  • Minimum received & Maximum sold
  • Fee
  • Liquidity correlation calculation
  • APR correlation calculation
Powered by GitBook
On this page
  • 1. Batch retrieve ticks by pool ID
  • Example
  • 2. Batch retrieve ticks by tickHandle
  • Example

Retrieve ticks

1. Batch retrieve ticks by pool ID

Method: sdk.Pool.fetchTicks()

Params:

  • poolID: The pool object ID.

  • coinTypeA: Coin A type.

  • coinTypeB: Coin B type.

Example

async function betchRetrievalTicksByPoolID() {
  const tickdatas = await TestnetSDK.Pool.fetchTicks({
    pool_id: '0x11f63063e721a99da6b33df2de0749f564c31d709b3c8689cf20dffcb983232f',
    coinTypeA: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',
    coinTypeB: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',
  })
  console.log('fetchTicks: ', tickdatas)
}

2. Batch retrieve ticks by tickHandle

Method: sdk.Pool.fetchTicksByRpc()

Params:

  • tickHandle: The tick handle of pool.

Example

async function betchFetchTicksByRpc() {
  const pool = await TestnetSDK.Pool.getPool('0x0128aade80123e3f6c5c0eac1a2dee2512bbdc92c9c1b386b0fd66e6cddfaa72')
  const tickdatas = await TestnetSDK.Pool.fetchTicksByRpc(pool.ticks_handle)
  console.log('tick data:', tickdatas)
}
PreviousRetrieve rewardNextCreate clmm pool

Last updated 4 months ago