Skip to main content
This example focuses on a client-side application where your UI builds transactions and the connected wallet signs them.

Build transaction data for the wallet

Create a build-only client using addresses instead of private keys. This lets your app use the SDK to construct the correct calldata without submitting through the SDK.
Build the trade request:
If tx.kind === 'eoa', pass it to the wallet:
The same pattern works for getCloseTradeTx(), getModifyOrderTx(), getCancelOrderTx(), and getUpdateCollateralTx().

Stream live position updates

Fetch the current positions once, then stream price-driven updates over WebSocket.
The stream only subscribes to the unique pairId values present in the current positions response, so it is usually lighter than subscribing to the full price feed.

Poll trade status after wallet submission

Once a wallet sends the transaction, poll getOrders() by initiatedTxHashes until the order leaves the pending state.
This is the usual pattern for showing submitted, filled, or cancelled state in the UI after a wallet signature flow.