Get ticks

1. Batch get ticks by pool ID

use SDK.Pool.fetchTicks() method

Function input params

  • poolID: The pool object ID.

  • coinTypeA: Coin A type.

  • coinTypeB: Coin B type.

Example

async function betchGetTicksByPoolID() {
  const tickdatas = await TestnetSDK.Pool.fetchTicks({
    pool_id: '0xbed3136f15b0ea649fb94bcdf9d3728fb82ba1c3e189bf6062d78ff547850054',
    coinTypeA: '0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdt::USDT',
    coinTypeB: '0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::cetus::CETUS',
  })
  console.log('fetchTicks: ', tickdatas)
}

// betchGetTicksByPoolID()
/*
fetchTicks:  [
  {
    objectId: '',
    index: -443636,
    sqrtPrice: <BN: 100013b50>,
    liquidityNet: <BN: 1717f11788>,
    liquidityGross: <BN: 1717f11788>,
    feeGrowthOutsideA: <BN: 0>,
    feeGrowthOutsideB: <BN: 0>,
    rewardersGrowthOutside: []
  },
  {
    objectId: '',
    index: -5630,
    sqrtPrice: <BN: c1317f9be7e3624f>,
    liquidityNet: <BN: 210b4a0>,
    liquidityGross: <BN: 210b4a0>,
    feeGrowthOutsideA: <BN: 3fc2189029e0374>,
    feeGrowthOutsideB: <BN: 1f6d28d0924e7fd>,
    rewardersGrowthOutside: [
      '493908213970774732607273',
      '1536244159578954174',
      '1228332157000808067268'
    ]
  },
  ...
]
 */

2. Batch get ticks by tickHandle

use SDK.Pool.fetchTicksByRpc() method

Function input params

  • tickHandle: The tick handle of pool.

Example

Last updated