Orders

This function retrieves open orders using the Limit Order SDK. It constructs a filter object based on specified parameters and queries the orders using the LimitOrder.getOrders() method.

Example:

Filter Parameters

ParameterTypeDescription

wallet_address

string

Wallet address (optional)

maker_asset

string

Maker asset (optional)

taker_asset

string

Taker asset (optional)

maker_amount

string

Maker amount (optional)

taker_amount

string

Taker amount (optional)

order_price

string

Order price (optional)

page

number

Page number (default: 1)

pageSize

number

Page size (default: 10)

import { LimitOrder, getOrdersResponse } from "../../src";
import { ordersFilter } from "../../src";

async function getOrders(): Promise<getOrdersResponse> {
  const limitOrder = new LimitOrder();
  const filters: ordersFilter = {
    wallet_address:
      "signer_address",
    maker_asset:
      "maker_asset_address",
    taker_asset:
      "take_asset_address",
    maker_amount: "200000000000000000",
    taker_amount: "200000000000000000",
    order_price: "100000000000000000",
    page: 1,
    pageSize: 10,
  };
  
  const openOrders: getOrdersResponse = await limitOrder.getOrders(filters);
  
  return openOrders;
}

getOrders();

Response:

PropertyTypeDescription

status

string

Status of the response.

code

number

Status code of the response.

data

Order[]

An array of Order objects representing the orders retrieved by the API call. Each Order object contains details specific to an individual order.

Order Struct:

PropertyTypeDescription

signer

string

The address of the entity that created and signed the order.

maker_asset

string

The asset being offered by the maker in the trade.

taker_asset

string

The asset being requested by the maker from the taker.

maker_amount

number

The amount of the maker_asset being offered.

taker_amount

number

The amount of the taker_asset being requested.

order_price

number

The price at which the order is executed, typically derived from maker_amount and taker_amount.

expiration

number

The timestamp at which the order expires and is no longer valid.

use_solver

boolean

Indicates whether a solver is used to settle the order.

partial_fill

boolean

Allows the order to be filled partially.

order_hash

string

A unique identifier for the order, usually generated by hashing order details.

signature

string[]

An array containing the digital signature(s) that validate the signer's consent to the order.

nonce

number

A unique number used once to ensure the order's uniqueness and prevent replay attacks.

Last updated