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

getPerpsOrdersByUser

List a user's active perps orders.

Returns only resting limit orders that have not been fully filled or cancelled; the count matches the user's open_order_count and the sum of reserved_margin across these orders equals user_state.reservedMargin.

Signature

function getPerpsOrdersByUser(
  client: Client,
  parameters: {
    user: Address
    height?: number
  },
): Promise<PerpsOrdersByUserResponse>

Example

import { createPublicClient, createTransport, testnet } from "@left-curve/sdk"
import type { Address } from "@left-curve/sdk"
 
const client = createPublicClient({ chain: testnet, transport: createTransport() })
const user: Address = "0x1234567890abcdef1234567890abcdef12345678"
 
const orders = await client.getPerpsOrdersByUser({ user })

Parameters

userAddress. The trader.

heightnumber, optional. Block height. Default 0 (latest).

Returns

PerpsOrdersByUserResponseRecord<string, PerpsOrderByUserItem> keyed by order id.

See also