ondoWsProvider(options) accepts apiUrl and storage. The WebSocket provider reads the session token from the store under apiUrl, so apiUrl must match the apiUrl that the SIWE login used. It defaults to production. storage is the StorageAdapter that holds the session token. It defaults to the SDK’s encrypted localStorageAdapter, the same default as ondoProvider.
SIWE login and addWithdrawalAddress need the user wallet. Pass userWallet at creation, or call setUserWallet() before them; without it they throw an SDKError.
ondoProvider(options) accepts apiUrl (defaults to production) and storage (a StorageAdapter for the session token and API key; defaults to the SDK’s encrypted localStorageAdapter, not raw browser localStorage).
Topics
- Signing Model — The SIWE session, the HMAC-signed trading relay, and the client-only session steps
- Setup — SIWE login, deposit-address provisioning, terms acceptance, trading-key creation, and referral
- Trading — All trading actions with parameters and Ondo’s order constraints
- Withdrawals — The withdrawal address setup, the withdrawable balance, and withdrawal errors
- WebSocket Protocol — The native WebSocket endpoint and how the SDK discovers it
Defaults & assumptions
- Margin mode: cross only. Passing
marginMode: ISOLATEDonplaceOrder/updateLeverageis rejected. - Order types:
LIMITandMARKETonly. A limit order needsprice: the venue rejects a limit order without one, and the backend does not pre-check it.priceis validated on the market’s price grid when present;sizeis validated on the size grid. - Time-in-force:
GTC,IOC, andPOST_ONLY(post-only submits asGTCwith the post-only flag set). - Order expiry: not supported —
expiresAtmust be omitted. - Trigger legs: take-profit / stop-loss execute at market. A leg needs
type: MARKET. ALIMITleg or alimitPriceon a trigger is rejected. - Quote asset: USDC. The provider advertises a single trading category (
ondo). - Deposits:
getDepositFlow()provisions a per-user Ethereum USDC margin-wallet address behind the SIWE session; route to the returnedtoAddress. - Withdrawals:
withdraw()sends USDC from theperpsmargin wallet to the connected wallet address only.
Leverage
Ondo markets are cross-margin only. The maximum leverage of a market is the highestmaxLeverage in the venue marginInfo brackets for that market. When the venue reports no bracket, the provider falls back to 10x, or 20x for US100, US500, XAU, XAG, WTI, and AAPL. The maintenance margin rate is half the initial rate at maximum leverage.
Candle intervals
The provider advertises these OHLCV intervals insupportedIntervals: 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1M. Requesting any other interval raises a validation error.
Unsupported operations
The Ondo provider has nosendAsset, modifyOrder, or updatePositionMargin methods, and it has no choice step in setup — there is no account option to select. Funds move through getDepositFlow() for deposits and withdraw() for withdrawals. See Withdrawals.
Account reads
Every Ondo data read needs an active SIWE session:getPositions, getOrders, getOrder, getFills, getActivity, getPortfolioHistory, getWithdrawableBalances, getAvailableToTrade and getMarketSettings.
- With no session, each data read throws
SetupRequired, and the provider sends no request to Ondo. RunsiweLoginfirst. - When Ondo rejects the stored session token, the provider removes the token and that read throws
Unauthorized. The next read throwsSetupRequired. - Ondo opens the account at the SIWE login, so an Ondo data read does not throw
AccountNotFound. getAccount,accountExists,getDepositFlowandgetWithdrawFloware status reads. They return the logged-out state as a value. See Account access.
getOrdersreturns TWAP parents as orders.getActivityreturns onlyFUNDING,LIQUIDATION,DEPOSIT, andWITHDRAWALitems.
Account figures
PerpsClient.getAccountSummary() builds the AccountSummary totals for Ondo directly from the venue’s account balance:
A logged-out account reads no venue balance and summarizes as zero.
getWithdrawableBalances() reads the venue’s withdrawableMargin figure and exposes it as a row with categoryId: 'ondo' — the only category Ondo advertises.
Related Pages
- Concepts — The action pattern, streaming, and multi-provider support
- SDK / Streaming — Subscribe to live market data and user events via WebSocket
- SDK / Account — Fetch account balances, positions, and fills
- SDK / Trading — Place orders, cancel orders, and query order status
- SDK / Actions — The create → authorize → execute pattern for all operations