Skip to content

dex.watchOrderFilled

Watches for order filled 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

onOrderFilled

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

type Args = {
  /** ID of the filled order */
  orderId: bigint
  /** Address that placed the order */
  maker: Address
  /** Amount of tokens filled */
  amountFilled: bigint
  /** Whether the order was partially filled */
  partialFill: boolean
}

Callback to invoke when an order is filled.

maker (optional)

  • Type: Address

Address of the maker to filter events.

orderId (optional)

  • Type: bigint

Order ID to filter events.

taker (optional)

  • Type: Address

Address of the taker 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

Whether to use polling.

pollingInterval (optional)

  • Type: number

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

Viem

Released under the MIT License.