Skip to content

dex.watchOrderCancelled

Watches for order cancelled events on the Stablecoin DEX.

Usage

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

const unwatch = Actions.dex.watchOrderCancelled(config, {
  onOrderCancelled(args, log) {
    console.log('Order cancelled:', args.orderId)
  },
})

// Later, stop watching
unwatch()
ts
import { createConfig, http } from 'wagmi'
import { tempo } from 'wagmi/chains'
import { tempoWallet } from 'wagmi/tempo'

export const config = createConfig({
  connectors: [tempoWallet()],
  chains: [tempo],
  multiInjectedProviderDiscovery: false,
  transports: {
    [tempo.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.