Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

submitConditionalOrder

Submit a single trigger-based conditional perps order.

Conditional orders are reduce-only by construction — they fire as a market order once the oracle price crosses triggerPrice in the chosen direction. maxSlippage is bounded at submission by the per-pair max_market_slippage cap; if governance later tightens that cap, a stale conditional is cancelled with reason = SlippageCapTightened. See protocol book: perps/2-order-matching §3b.

Signature

function submitConditionalOrder(
  client: Client<Signer>,
  parameters: {
    sender: Address
    pairId: string
    size?: string
    triggerPrice: string
    triggerDirection: "above" | "below"
    maxSlippage: string
  },
): Promise<{ hash: Uint8Array } & TxData>

Example

import { createSignerClient, createTransport, testnet, PrivateKeySigner } from "@left-curve/sdk"
import type { Address } from "@left-curve/sdk"
 
const client = createSignerClient({
  chain: testnet,
  transport: createTransport(),
  signer: PrivateKeySigner.fromMnemonic(process.env.DANGO_MNEMONIC!),
})
const sender: Address = "0x1234567890abcdef1234567890abcdef12345678"
 
await client.submitConditionalOrder({
  sender,
  pairId: "BTC-PERP",
  size: "0.1",
  triggerPrice: "70000",
  triggerDirection: "above",
  maxSlippage: "0.005",
})

Parameters

senderAddress. The trader.

pairIdstring. Perps pair identifier.

sizestring, optional. Position size (positive long, negative short). Omit to size against the current position at trigger time.

triggerPricestring. Price that activates the order.

triggerDirection"above" | "below". Direction the oracle price must cross to fire.

maxSlippagestring. Dimensionless ratio applied when the triggered market order executes. Must satisfy ≤ pair.max_market_slippage at submission time.

Returns

{ hash: Uint8Array } & TxData — see broadcastTxSync.

See also