List Trigger Orders

Gets cancelled, pending or executed trigger orders for the provided subaccount and products.

Request

POST [TRIGGER_ENDPOINT]/query

Body


{
  "type": "list_trigger_orders",
  "tx": {
    "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
    "recvTime": "1688768157050"
  },
  "signature": "0x",
  "product_id": 1,
  "pending": false,
  "max_update_time": "1688768157050",
  "limit": 20
}

Request Parameters

Note: max_update_time It's the time that the trigger order last changed state. For example, if a trigger order is placed & pending, the update time = time of placement. If the trigger order is cancelled, then the update time = time of cancellation.

ParameterTypeRequiredDescription

tx

object

Yes

List trigger orders transaction object. See Signing section for details on the transaction fields.

tx.sender

string

Yes

Hex string representing the subaccount's 32 bytes (address + subaccount name) of the tx sender.

tx.recvTime

string

Yes

Encoded time in milliseconds after which the list trigger orders transaction will be ignored. cannot be more than 100 seconds from the time it is received by the server.

signature

string

Yes

Signed transaction. See Signing section for more details.

product_id

number

No

If provided, returns all trigger orders for the given product; otherwise, returns trigger orders for all products.

pending

boolean

Yes

If set to true, returns all pending trigger orders; otherwise, returns all executed and cancelled orders.

max_update_time

number

No

If provided, returns all trigger orders that were last updated up to max_update_time. must be a unix epoch in seconds.

max_digest

string

No

If provided, returns all trigger orders up to the given order digest (exclusive). This can be used for pagination.

digests

string[]

No

If provided, only returns the trigger orders for the associated digests. Note: all other filters are ignored when digests is provided.

limit

number

No

If provided, returns the most recently updated trigger orders up to limit. defaults to 100. max limit is 500.

Signing

See more details and and examples in our signing page.

The solidity typed data struct that needs to be signed is:

struct ListTriggerOrders {
    bytes32 sender;
    uint64 recvTime;
}

sender: a bytes32 sent as a hex string; includes the address and the subaccount identifier

recvTime: the time in milliseconds (a recv_time) after which the transaction should be ignored by the trigger service. cannot be more than 100 seconds from the time it is received by the server.

Note: for signing you should always use the data type specified in the solidity struct which might be different from the type sent in the request e.g: recvTime should be an uint64 for Signing but should be sent as a string in the final payload.

Response

Success

{
  "status": "success",
  "data": {
    "orders": [
      {
        "order": {
          "order": {
            "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
            "priceX18": "1000000000000000000",
            "amount": "1000000000000000000",
            "expiration": "2000000000",
            "nonce": "1",
          },
          "signature": "0x...",
          "product_id": 1,
          "spot_leverage": true,
          "trigger": {
            "price_above": "1000000000000000000"
          },
          "digest": "0x..."
        },
        "status": "pending",
        "updated_at": 1688768157050
      }
    ]
  },
  "request_type": "query_list_trigger_orders"
}

Note: trigger orders can have the following statuses:

  • pending: initial state. trigger criteria has not been met nor has it been cancelled.

  • triggered: trigger criteria was met, and order was submitted for execution.

  • cancelled: trigger order was cancelled due to any of the following: user requested via cancel trigger order, order expired, account becomes unhealthy if order is triggered.

Failure

{
  "status": "failure",
  "signature": {signature}
  "error": "{error_msg}"
  "error_code": {error_code}
  "request_type": "query_list_trigger_orders"
}

Last updated