Skip to content

dex.getOrder

Gets an order's details from the Stablecoin DEX orderbook.

Usage

ts
import {  } from 'wagmi/tempo'
import {  } from './config'

const  = await ..(, {
  : 123n,
})

.('Order details:', )
Order details: { amount: 100000000n, maker: '0x...', isBid: true, ... }
ts
import { createConfig, http } from 'wagmi'
import { tempoTestnet } from 'wagmi/chains'
import { KeyManager, webAuthn } from 'wagmi/tempo'

export const config = createConfig({
  connectors: [
    webAuthn({
      keyManager: KeyManager.localStorage(),
    }),
  ],
  chains: [tempoTestnet],
  multiInjectedProviderDiscovery: false,
  transports: {
    [tempoTestnet.id]: http(),
  },
})

Return Type

ts
type ReturnType = {
  /** Original order amount */
  amount: bigint
  /** Orderbook key (identifies the trading pair) */
  bookKey: Hex
  /** Tick to flip to when fully filled (for flip orders). For bid flips: must be > tick. For ask flips: must be < tick */
  flipTick: number
  /** Whether this is a bid (true) or ask (false) order */
  isBid: boolean
  /** Whether this is a flip order */
  isFlip: boolean
  /** Address of the user who placed this order */
  maker: Address
  /** Next order ID in the doubly linked list (0 if tail) */
  next: bigint
  /** The order ID */
  orderId: bigint
  /** Previous order ID in the doubly linked list (0 if head) */
  prev: bigint
  /** Remaining amount to be filled */
  remaining: bigint
  /** Price tick */
  tick: number
}

Returns the complete order details including the maker's address, order amounts, price tick, linked list pointers, and flip order information.

Parameters

orderId

  • Type: bigint

Order ID to query.

Viem

Released under the MIT License.