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

submitConditionalOrders

Submit a batch of trigger-based conditional perps orders in one transaction.

Each order is reduce-only by construction and fires as a market order once the oracle price crosses its triggerPrice in the chosen direction. See submitConditionalOrder for the per-order mechanics.

Signature

function submitConditionalOrders(
  client: Client<Signer>,
  parameters: {
    sender: Address
    orders: {
      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.submitConditionalOrders({
  sender,
  orders: [
    {
      pairId: "BTC-PERP",
      size: "0.1",
      triggerPrice: "70000",
      triggerDirection: "above",
      maxSlippage: "0.005",
    },
    {
      pairId: "BTC-PERP",
      size: "-0.05",
      triggerPrice: "60000",
      triggerDirection: "below",
      maxSlippage: "0.005",
    },
  ],
})

Parameters

senderAddress. The trader.

orders — array of conditional order specs. See submitConditionalOrder for each field's meaning.

Returns

{ hash: Uint8Array } & TxData — see broadcastTxSync.

Notes

  • Throws Error("submitConditionalOrders requires at least one order") if orders.length === 0.

See also