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

batchUpdateOrders

Create and/or cancel multiple limit orders in a single transaction.

Signature

function batchUpdateOrders(
  client: Client<Signer>,
  parameters: {
    sender: Address
    funds?: Coins
    creates?: CreateOrderRequest[]
    cancels?: CancelOrderRequest
  },
): 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.batchUpdateOrders({
  sender,
  funds: { "bridge/usdc": "100000000" },
  creates: [
    {
      baseDenom: "dango",
      quoteDenom: "bridge/usdc",
      amount: { bid: { quote: "100000000" } },
      price: { limit: "0.5" },
      timeInForce: "GTC",
    },
  ],
  cancels: { some: ["123", "456"] },
})

Parameters

senderAddress. The trader.

fundsCoins, optional. Coins to attach for new bids/asks.

createsCreateOrderRequest[], optional. New orders. Each entry has baseDenom, quoteDenom, amount ({ bid } or { ask }), price ({ limit } or { market }), and timeInForce ("GTC" or "IOC").

cancelsCancelOrderRequest, optional. "all" or { some: OrderId[] }.

Returns

{ hash: Uint8Array } & TxData — see broadcastTxSync.

Notes

  • The EIP-712 typed-data structure is built dynamically based on whether the first create order is a bid/ask and limit/market. Mixed-side or mixed-style batches may need a custom typedData passed at the execute layer.

See also