Skip to content

dex.watchOrderCancelled

Watches for order cancelled events on the Stablecoin DEX.

Usage

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

const  = ..(, {
  (, ) {
    .('Order cancelled:', .)
  },
})

// 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

onOrderCancelled

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

type Args = {
  /** ID of the cancelled order */
  orderId: bigint
}

Callback to invoke when an order is cancelled.

args (optional)

  • Type: object
ts
type Args = {
  /** Order ID to filter events */
  orderId?: bigint | bigint[] | null
}

Filter options for the event.

orderId (optional)

  • Type: bigint

Order ID to filter events.

fromBlock (optional)

  • Type: bigint

Block to start listening from.

onError (optional)

  • Type: function
ts
declare function onError(error: Error): void

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

poll (optional)

  • Type: true

Enable polling mode.

pollingInterval (optional)

  • Type: number

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

Viem

Released under the MIT License.