@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / chains / sendBridgeStep

Function: sendBridgeStep()

sendBridgeStep(client, step, options): Promise<TransactionReceipt>

Defined in: packages/sdk/src/chains/bridge/send.ts:94

Sign one planner transaction locally and send it via Somnia's realtime_sendRawTransaction — the node blocks until the transaction is executed and answers with the receipt, so send + confirm is a single round-trip. On a node without the method (anvil, stock geth) it falls back to eth_sendRawTransaction + a receipt wait, so the same code runs against somniaLocal.

Details

  • client: A public client for the transaction's chain (its request is the wire).
  • step: The planner transaction — plan.approveStep / plan.bridgeStep.
  • options: The local signer, plus optional gas/fee overrides.
  • Returns: The mined receipt, status "success".

Gotchas

  • Throws If the client is on a different chain than the step, if the node rejects the transaction, or if the receipt says "reverted" — the message names the step's description.

Example (Sending a bridge transfer)

ts
import { BridgeToken, ChainId, createBridgeTransfer, sendBridgeStep } from "@somnia-chain/markets-sdk/chains";

const plan = createBridgeTransfer({
  token: BridgeToken.WBTC,
  from: ChainId.somniaShannon,
  to: ChainId.hidekiTestnet,
  amount: 100_000_000n, // 1 WBTC — 8 decimals, not 18
  recipient: account.address,
});

if (plan.approveStep) await sendBridgeStep(client, plan.approveStep, { account });
const receipt = await sendBridgeStep(client, plan.bridgeStep, { account });
receipt.status; // "success" — a reverted receipt throws instead

Each call resolves only once its transaction is CONFIRMED, so the approve-then-bridge ordering above is safe by construction. Fees and gas are fixed, never estimated — the same doctrine as the SDK's trading writes.

Parameters

client

step

BridgeTransaction

options

SendBridgeStepOptions

Returns

Promise<TransactionReceipt>