PerpsClient.placeOrder, which builds the action, authorizes it through the registered provider plugin, and submits it in one call. Order actions use the plugin’s SDK-managed credential, so the user’s wallet is not prompted per trade.
The examples on this page use Hyperliquid (
provider: 'hyperliquid'). The trading API is provider-agnostic — replace the provider value with any supported venue from getProviders(). The placeOrder call shape is identical for every provider; each provider signs with its own configured signer.placeOrder
Once the user has provisioned an agent (see Signing Model and Hyperliquid / Setup), placing an order is a single call:OrderSide, OrderType, TimeInForce, MarginMode, ActionType) are TypeScript enums exported from @lifi/perps-sdk; string literals such as 'BUY' do not typecheck.
Internally this is the create -> authorize -> execute pattern from Action Pattern:
leverage is provided, the backend always prepends an updateLeverage step; both actions are signed and submitted together, so result.results[] has one entry per action. Omit leverage to leave the venue’s current setting untouched (getMarketSettings reads it).
Every provider action fails with
401 / 2012 (TermsNotAccepted) until the address has accepted the current terms version. See Error Handling.placeOrder supports MARKET and LIMIT. Place stop and take-profit orders through the takeProfit / stopLoss fields or placeTriggerOrder.
After a write, the venue’s account, settings, orders and fills reads can return pre-write data for a couple of seconds. Update your UI optimistically and re-read once after a short delay.
Order Types
Market Order
Executes immediately at the best available price. Theprice field acts as a slippage limit.
Limit Order
Rests on the orderbook until filled or cancelled.Formatting prices and sizes
Prices and sizes must sit on the venue’s tick and lot grid, or the order is rejected. Snap them through the market’s own provider. Sizes are truncated, never rounded up.Time in Force options
GTC is accepted on every provider.
Hyperliquid
GTCis the default and rests until filled or cancelled.IOCfills immediately and cancels any unfilled portion.POST_ONLYis maker-only and is cancelled if it would match immediately.GTTneedsexpiresAt. The backend returns a validation error for aGTTorder without it.
GTCis the default and rests until filled or cancelled.IOCfills immediately and cancels any unfilled portion.POST_ONLYis maker-only and is cancelled if it would match immediately.- Any other value falls back to
GTC.
-
GTCis the default for limit orders. -
IOCfills immediately and cancels any unfilled portion. -
POST_ONLYis submitted asGTCwith the post-only flag. -
GTTis rejected. -
Market orders. On Lighter and Ondo, a market order accepts only
IOC(or notimeInForce). On Hyperliquid, a market order withouttimeInForceis sent as a frontend-market order. -
Ondo reduce-only limits. Reduce-only limit orders are coerced to
IOC. -
expiresAt. Only Lighter honours it, and only onGTCandPOST_ONLYorders;IOCand market-style orders withexpiresAtthrow. Hyperliquid ignores it. Ondo rejects it.