@somnia-chain/markets-sdk


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

Interface: UnsignedOrder

Defined in: packages/sdk/src/writer.ts:176

A placement expanded into the unsigned calls it actually takes.

Two or one: a placement that escrows an ERC-20 (or outcome tokens) needs an approval before the order call, while a native-base sell and every perp placement need only the order. approval is simply absent when there is nothing to approve — branching on it narrows:

ts
const { order, approval } = await trader.buildPlaceOrder(params);
if (approval) await walletClient.sendTransaction({ ...approval, account });
await walletClient.sendTransaction({ ...order, account });

The approval is RETURNED, never sent — unlike placeOrder, which sends it as a side effect. A caller who skips a needed approval gets an on-chain revert, so check approval rather than assuming it is handled.

approval is present whenever the placement escrows something, without checking the current allowance (that check is an eth_call, which a build-only verb should not make) — so it may be redundant, never short: it approves maxUint256, as the send path does. (A token that demands its allowance be zeroed before being re-set would reject that, same as on the send path.) Pass autoApprove: false to drop it and skip the escrow lookup.

Properties

order

order: UnsignedCall

Defined in: packages/sdk/src/writer.ts:178

The placement call itself.


approval?

optional approval?: UnsignedCall

Defined in: packages/sdk/src/writer.ts:180

The approval the placement needs first; absent when nothing needs approving.