@somnia-chain/markets-sdk / chains / sendBridgeStep
Function: sendBridgeStep()
sendBridgeStep(
client,step,options):Promise<TransactionReceipt>
Defined in: packages/sdk/src/chains/bridge/send.ts:83
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.
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
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
Promise<TransactionReceipt>
The mined receipt, status "success".
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.