@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / TransactionOutcomeUnknownError

Class: TransactionOutcomeUnknownError

Defined in: packages/sdk/src/errors.ts:480

A write signed a transaction that may have reached the node, and the SDK did not observe its receipt. The transaction can still mine.

When to use

Catch this before RpcError on every write. Do not send the same write again until you know what happened to hash: read its receipt, or read the state the write changes (for an order, your open orders at chain head). A blind retry can place the order twice.

Details

The built-in executors throw it when the send left the SDK and then the answer was lost: the realtime send timed out or its socket dropped, or the receipt wait after eth_sendRawTransaction or a wallet's sendTransaction failed. A refusal the node answered (nonce too low, insufficient funds, a revert) is a plain RpcError or a ContractRevertError.

  • chainId: the chain the transaction was sent on.
  • operation: the request whose answer was lost (e.g. "eth_sendRawTransactionSync").
  • hash: the transaction hash. Absent only when the protocol gives none before the receipt, as with somnia_sendSessionTransaction. Then read the state the write changes instead.

It extends RpcError, so an existing instanceof RpcError arm still catches it.

Example (Looking up the hash before sending again)

ts
import { TransactionOutcomeUnknownError } from "@somnia-chain/markets-sdk";

try {
  await exchange.trader.placeOrder(params);
} catch (e) {
  if (!(e instanceof TransactionOutcomeUnknownError)) throw e;
  const viem = exchange.client.getViemClient();
  const receipt = e.hash ? await viem.getTransactionReceipt({ hash: e.hash }).catch(() => null) : null;
  if (receipt === null) {
    // Unknown still: read your open orders at chain head before placing again.
  }
}

Extends

Constructors

Constructor

new TransactionOutcomeUnknownError(fields, options?): TransactionOutcomeUnknownError

Defined in: packages/sdk/src/errors.ts:496

Creates an outcome-unknown error.

Details

  • fields.chainId: The chain the transaction was sent on.
  • fields.operation: The request whose answer was lost.
  • fields.hash: The signed transaction's hash, when the protocol gives one.
  • options: Standard cause passthrough — the transport error that lost the answer.

Parameters

fields
chainId

number

operation

string

hash?

`0x${string}`

options?

ErrorOptions

Returns

TransactionOutcomeUnknownError

Overrides

RpcError.constructor

Properties

operation

readonly operation: string

Defined in: packages/sdk/src/errors.ts:422

Inherited from

RpcError.operation


chainId

readonly chainId: number

Defined in: packages/sdk/src/errors.ts:482

The chain the transaction was sent on.

Overrides

RpcError.chainId


hash?

readonly optional hash?: `0x${string}`

Defined in: packages/sdk/src/errors.ts:484

The transaction hash; absent only when the protocol returns none before the receipt.