Skip to main content

Introduction

The deBridge order management system allows you to track and control your cross-chain orders throughout their lifecycle. You can query order status, retrieve order IDs from transaction hashes, and cancel orders when needed.

Core Operations

The order management system provides three key operations:

Query Status

Check the current status of any order using its order ID.

Get Order ID

Retrieve the order ID from a transaction hash.

Cancel Order

Cancel pending orders before they are fulfilled.

API Endpoints

All order management operations use the DLN Stats API:
  • Base URL: https://stats-api.dln.trade/api
  • Get Order Status: GET /Orders/{orderId}
  • Get Order ID: GET /Transaction/{txHash}/orderIds
  • Get Filtered Orders: POST /Orders/filteredList

Order States

Orders can be in various states throughout their lifecycle:
StateDescription
CreatedOrder has been created on the source chain
FulfilledOrder has been completed successfully
SentUnlockUnlock transaction has been sent
ClaimedUnlockUnlock has been claimed
OrderCancelledOrder was cancelled by the user
The states Fulfilled, SentUnlock, and ClaimedUnlock are all considered fulfilled from the end-user’s perspective.

Utility Functions

The example repository provides utility functions for common order management tasks:
// Get order status by order ID
import { getOrderStatusByOrderId } from "./utils/deBridge"

// Get order ID from transaction hash
import { getOrderIdByTransactionHash } from "./utils/deBridge"

// Get cancel order transaction
import { getCancelOrderTx } from "./utils/deBridge"

Next Steps

1

Query Order Status

Learn how to check the status of your orders using the Query Status guide.
2

Retrieve Order IDs

Convert transaction hashes to order IDs with the Get Order ID guide.
3

Cancel Orders

Understand how to cancel pending orders in the Cancel Order guide.

Common Use Cases

Track Order Progress

You can poll the order status endpoint to track an order’s progress through its lifecycle:
const orderId = "0xa4d57d3156f9d5322542f344ba29fc4cd58d973e2ca8aa94c039ca8b05f869f5";
const status = await getOrderStatusByOrderId(orderId);
console.log(status);

Verify Transaction

After submitting a transaction, retrieve the order ID to track it:
const txHash = "0x24c0dcc5de8b1ab048e10149c410ce59c1e1058d083ffdad6d8b6acb445618f1";
const { orderIds } = await getOrderIdByTransactionHash(txHash);
const orderId = orderIds[0].stringValue;

Emergency Cancellation

If you need to cancel an order that hasn’t been fulfilled yet:
const cancelTx = await getCancelOrderTx(orderId);
// Sign and send the cancellation transaction
You can only cancel orders that are still pending. Once an order is fulfilled, it cannot be cancelled.

Build docs developers (and LLMs) love