@somnia-chain/markets-sdk


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

Interface: BridgeTransfer

Defined in: packages/sdk/src/chains/bridge/types.ts:233

A bridge transfer, expanded into the transactions it actually takes.

Two or one: a collateral transfer needs an ERC-20 approve before the bridge call; native and synthetic transfers do not. approveStep is simply absent when there is nothing to approve — branching on it narrows:

Example (Sending an approval before a transfer)

ts
if (plan.approveStep) {
  await sendBridgeStep(client, plan.approveStep, { account }); // confirmed before the next line
}
await sendBridgeStep(client, plan.bridgeStep, { account });

Everything protocol-derived lives on the transactions themselves or on origin/destination — e.g. a native route's destination-liquidity caveat is BridgeTokenDetails.requiresDestinationLiquidity on destination, and an interchain gas payment is already folded into bridgeStep.value.

Properties

origin

origin: BridgeTokenDetails

Defined in: packages/sdk/src/chains/bridge/types.ts:235

The origin-side token being sent.


destination

destination: BridgeTokenDetails

Defined in: packages/sdk/src/chains/bridge/types.ts:237

The destination-side token that will be received.


amount

amount: bigint

Defined in: packages/sdk/src/chains/bridge/types.ts:239

Amount in base units of origin.decimals.


recipient

recipient: `0x${string}`

Defined in: packages/sdk/src/chains/bridge/types.ts:241

Who receives it on the destination chain.


approveStep?

optional approveStep?: BridgeTransaction

Defined in: packages/sdk/src/chains/bridge/types.ts:247

The ERC-20 approval a collateral route needs first — absent on native and synthetic routes. Confirm it before sending bridgeStep, which spends the allowance.


bridgeStep

bridgeStep: BridgeTransaction

Defined in: packages/sdk/src/chains/bridge/types.ts:254

The transferRemote call on the origin router — the transaction that bridges. Always present, always sent last: it escrows or burns on the origin and dispatches the interchain message. Its value carries the amount on a native route (plus any gasPayment passed in), 0n otherwise.