Use this file to discover all available pages before exploring further.
Every trade on the Proof Exchange is an action — a signed, MessagePack-encoded payload submitted via client.submitTx() or client.submitTxCommit(). The SDK handles nonce allocation, Ed25519 signing, and routing through the public API gateway automatically. This guide walks through every order action available, from a simple limit order to a multi-leg atomic basket.
A market order crosses immediately against resting liquidity and does not accept a price. Any unfilled quantity is silently dropped (IOC semantics). Listen for a MarketOrderProcessed event to determine how much was actually filled.
// Buy 2 contracts at market price on market 1const result = await client.submitTx({ type: "MarketOrder", data: { market: 1, owner: address, side: Side.Buy, quantity: 2n, clientOrderId: 42n, // optional — echoed in MarketOrderProcessed event },});
A MarketOrderProcessed event is emitted at the end of every market-order transaction. It is the authoritative fill signal: filledQuantity === requestedQuantity means a full fill, filledQuantity === 0n means no counterparty was found.
CancelReplaceOrder atomically cancels a resting order and places its replacement in a single transaction. Both legs succeed or neither does — there is no partial execution.
Cancel by Engine ID
Cancel by Client ID
await client.submitTx({ type: "CancelReplaceOrder", data: { owner: address, cancelOrderId: 1001n, // engine-assigned ID to cancel market: 1, side: Side.Buy, price: 4985000n, // new price quantity: 2n, // new quantity clientOrderId: 99n, // optional — for the replacement postOnly: false, timeInForce: TimeInForce.Gtc, },});
await client.submitTx({ type: "CancelReplaceOrder", data: { owner: address, cancelClientOrderId: 42n, // your own ID to cancel market: 1, side: Side.Buy, price: 4985000n, quantity: 2n, clientOrderId: 43n, // new client ID for the replacement timeInForce: TimeInForce.Gtc, },});
cancelOrderId and cancelClientOrderId are mutually exclusive — provide exactly one.
AmendOrder changes the price or quantity of a resting order in place, preserving the engine order ID and its queue priority for the fields that don’t change.
// Change only the priceawait client.submitTx({ type: "AmendOrder", data: { owner: address, orderId: 1001n, newPrice: 4990000n, // new limit price in cents // newQuantity omitted → keeps current quantity },});// Change only the quantityawait client.submitTx({ type: "AmendOrder", data: { owner: address, orderId: 1001n, // newPrice omitted → keeps current price newQuantity: 3n, },});
Unlike CancelReplaceOrder, AmendOrder does not change the engine-assigned order ID. However, amending a quantity upward may lose queue priority depending on engine version.
ClosePosition submits an opposite-side IOC order at oracle ± spread to close an entire position in one action. It is idempotent — if no position exists the engine returns code 0 without emitting any events.
// Close the entire long position on market 1await client.submitTx({ type: "ClosePosition", data: { market: 1, owner: address, },});
ClosePosition is the recommended way to fully exit a position. It avoids the need to query position size and construct an explicit IOC order manually.
AtomicBasketOrder is a native multi-leg fill-or-kill order. Every leg must fill completely at its specified price or better, or the entire transaction reverts.