Skip to content

dex.watchFlipOrderPlaced

Watches for flip order placed events on the Stablecoin DEX.

Usage

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

const  = ..(, {
  (, ) {
    .('args:', )
  },
})

// Later, stop watching
()
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 = () => void

Returns a function to unsubscribe from the event.

Parameters

onFlipOrderPlaced

  • Type: function
ts
declare function onFlipOrderPlaced(args: Args, log: Log): void

type Args = {
  /** ID of the placed order */
  orderId: bigint
  /** Address that placed the order */
  maker: Address
  /** Address of the base token */
  token: Address
  /** Amount of tokens in the order */
  amount: bigint
  /** Whether this is a buy order */
  isBid: boolean
  /** Price tick for the order */
  tick: number
  /** Target tick to flip to when filled */
  flipTick: number
}

Callback to invoke when a flip order is placed.

args (optional)

  • Type: object
ts
type Args = {
  /** Filter by order ID */
  orderId?: bigint | bigint[] | null
  /** Filter by maker address */
  maker?: Address | Address[] | null
  /** Filter by token address */
  token?: Address | Address[] | null
}

Filter parameters for the event subscription.

maker (optional)

  • Type: Address

Address of the maker to filter events.

token (optional)

  • Type: Address

Address of the token to filter events.

fromBlock (optional)

  • Type: bigint

Block to start listening from.

onError (optional)

  • Type: (error: Error) => void

The callback to call when an error occurred when trying to get for a new block.

poll (optional)

  • Type: true

Whether to use polling.

pollingInterval (optional)

  • Type: number

Polling frequency (in ms). Defaults to Client's pollingInterval config.

Viem

Released under the MIT License.