Skip to content

dex.getTickLevel

Gets the tick level information at a specific tick on the Stablecoin DEX orderbook.

Usage

example.ts
import { client } from './viem.config'
import { Tick } from 'tempo.ts/viem'
 
const level = await client.dex.getTickLevel({
  base: '0x20c0000000000000000000000000000000000001',
  tick: Tick.fromPrice('1.001'),
  isBid: true,
})
 
console.log('Tick level:', level)
Tick level: { head: 1n, tail: 5n, totalLiquidity: 1000000000n }

Return Type

type ReturnType = {
  /** Order ID of the first order at this tick (0 if empty) */
  head: bigint
  /** Order ID of the last order at this tick (0 if empty) */
  tail: bigint
  /** Total liquidity available at this tick level */
  totalLiquidity: bigint
}

Returns the price level information including the order IDs for the head and tail of the FIFO queue at this price level, and the total liquidity available.

Parameters

base

  • Type: Address

Address of the base token.

isBid

  • Type: boolean

Whether to query the bid side (true) or ask side (false).

tick

  • Type: number

Price tick to query. Can be created using Tick.fromPrice().

account (optional)

  • Type: Account | Address

Account that will be used to send the transaction.

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.