Skip to content

waitForOrderOpen

The waitForOrderOpen waits for an order to be open on a SolverNet inbox contract.

Usage

import { waitForOrderOpen } from '@omni-network/core'

import { waitForOrderOpen } from '@omni-network/core'
 
const resolvedOrder = await waitForOrderOpen({
  // ... params
});

Parameters

PropTypeRequiredDescription
clientClientYesThe viem client used to read from the blockchain.

| txHash | Hex | Yes | Transaction hash returned by calling the sendOrder function | | pollinginterval | number | No | Polling interval in milliseconds, defaults to the client polling interval. |

Return

waitForOrderOpen returns the Promise of a ResolvedOrder object.

ResolvedOrder

type ResolvedOrder = {
  user: Address;
  originChainId: bigint;
  openDeadline: number;
  fillDeadline: number;
  maxSpent: Output[];
  minReceived: Output[];
  fillInstructions: FillInstruction[];
}

Output

type Output = {
  token: Address;
  amount: bigint;
  recipient: Address;
  chainId: bigint;
}

FillInstruction

type FillInstruction = {
  destinationChainId: bigint;
  destinationSettler: Address;
  originData: Hex;
}

Example

import { sendOrder, waitForOrderOpen } from '@omni-network/core'
 
const txHash = await sendOrder({
  client: viemClient,
  inboxAddress: contracts.inbox,
  order: orderParams
})
const resolvedOrder = await waitForOrderOpen({
  client: viemClient,
  txHash: txHash,
})