@somnia-chain/markets-sdk / index / decodePlaceOrder
Function: decodePlaceOrder()
decodePlaceOrder(
receipt,pool?):DecodedPlacement
Defined in: packages/sdk/src/decode/orders.ts:121
Decode an order placement from its receipt: the resting order id
(OrderPlaced) and the fills (OrderFilled). Works for binary, spot and
perp pools — they share the OrderBook events.
Details
receipt: The mined receipt, from whoever sent the transaction.pool: Decode only the logs this pool emitted. Pass it when the receipt may carry another pool's events (a safe transaction that touched two pools); omit it to accept the OrderBook events of any emitter.
Pure — the same function the sending verbs use, so a call built by
buildPlaceOrder and sent elsewhere decodes to exactly what placeOrder
would have returned.
Example (Decoding a receipt the app obtained itself)
ts
const { order } = await trader.buildPlaceSpotOrder(params);
const receipt = await myAccountLayer.send(order); // your safe, relayer, …
const { orderId, fills } = decodePlaceOrder(receipt, params.pool);
Parameters
receipt
TransactionReceipt
pool?
`0x${string}`