Skip to content

Commit ee10a35

Browse files
damir-bajramovicgitbook-bot
authored andcommitted
GITBOOK-411: change request with no subject merged in GitBook
1 parent 18d35fa commit ee10a35

File tree

11 files changed

+189
-181
lines changed

11 files changed

+189
-181
lines changed

docs/SUMMARY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
* [API Response](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/creating-an-order/api-response/README.md)
6060
* [JSON Example](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/creating-an-order/api-response/json-example.md)
6161
* [Refreshing Estimates](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/creating-an-order/refreshing-estimates.md)
62-
* [Tracking Order Status](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/tracking-order-status/README.md)
63-
* [Order States](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/tracking-order-status/order-states.md)
62+
* [Monitoring Orders](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/monitoring-orders/README.md)
63+
* [Order States](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/monitoring-orders/order-states.md)
6464
* [Requesting Order Creation Transaction](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/requesting-order-creation-transaction.md)
6565
* [Integrating deBridge hooks](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/integrating-debridge-hooks/README.md)
6666
* [Creating Hook data for Solana](dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/integrating-debridge-hooks/creating-hook-data-for-solana.md)

docs/dln-the-debridge-liquidity-network-protocol/integration-guidelines/affiliate-fees/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To enable affiliate fees for cross-chain swaps, the following [parameters](../in
1919
* A public key on **Solana**
2020
* A wallet address on **EVM chains**
2121

22-
Affiliate fees become available once an order reaches the `ClaimedUnlock` [state](../interacting-with-the-api/tracking-order-status/order-states.md). 
22+
Affiliate fees become available once an order reaches the `ClaimedUnlock` [state](../interacting-with-the-api/monitoring-orders/order-states.md). 
2323

2424
* On **EVM chains**, the affiliate fee is [automatically transferred to the specified recipient when a solver claims the order](../under-the-hood/order-fulfillment/claiming-the-order.md)
2525
* On **Solana**, the fee must be withdrawn manually. Further details on withdrawing affiliate fees are provided [here](withdrawing-affiliate-fees.md).

docs/dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/creating-an-order/api-parameters/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Ensure that the address specified for `dstChainOrderAuthorityAddress` is accessi
3232

3333
Affiliate fee-related settings can be included to specify a percentage of the trade value and the recipient address. More details are available [here](../../../affiliate-fees/).
3434

35-
<table><thead><tr><th width="261">Parameter</th><th width="261">Example value</th><th>Description</th></tr></thead><tbody><tr><td><code>affiliateFeePercent</code></td><td><code>0.1</code></td><td>Input asset amount percentage to cut off in favor of the affiliate fee recipient during order creation.</td></tr><tr><td><code>affiliateFeeRecipient</code></td><td><code>0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045</code> or <code>862oLANNqhdXyUCwLJPBqUHrScrqNR4yoGWGTxjZftKs</code></td><td>Source chain address (EVM) or public key (Solana) where the accrued affiliate fees will be transferred when the order reaches <code>ClaimUnlocked</code> <a href="../../tracking-order-status/order-states.md">state</a>.</td></tr></tbody></table>
35+
<table><thead><tr><th width="261">Parameter</th><th width="261">Example value</th><th>Description</th></tr></thead><tbody><tr><td><code>affiliateFeePercent</code></td><td><code>0.1</code></td><td>Input asset amount percentage to cut off in favor of the affiliate fee recipient during order creation.</td></tr><tr><td><code>affiliateFeeRecipient</code></td><td><code>0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045</code> or <code>862oLANNqhdXyUCwLJPBqUHrScrqNR4yoGWGTxjZftKs</code></td><td>Source chain address (EVM) or public key (Solana) where the accrued affiliate fees will be transferred when the order reaches <code>ClaimUnlocked</code> <a href="../../monitoring-orders/order-states.md">state</a>.</td></tr></tbody></table>
3636

3737
## Referral Code
3838

docs/dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/creating-an-order/api-response/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ An array describing the cost components associated with the trade. Possible entr
6767
* `metadata`&#x20;
6868
* Additional contextual information about the order.
6969
* `orderId`
70-
* A deterministic identifier for the order. The same ID is used on both source and destination chains and can be used to [track order status](../../tracking-order-status/#by-order-id).
70+
* A deterministic identifier for the order. The same ID is used on both source and destination chains and can be used to [track order status](../../monitoring-orders/#by-order-id).
7171
* `fixFee`&#x20;
7272
* [Flat fee](../../../../fees-and-supported-chains.md) charged in the source chain's native currency. This matches `tx.value` for EVM-based chains.&#x20;
7373
* `userPoints`
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# Monitoring Orders
2+
3+
Once an order has been successfully created on-chain, its state can be monitored using several available methods, depending on the use case. For a full overview of order states and their transitions, refer to the [Order States](order-states.md) documentation.&#x20;
4+
5+
## Key Completion States
6+
7+
Orders progress through multiple internal states. However, from the perspective of the end-user experience, the following states indicate successful completion:
8+
9+
* `Fulfilled`&#x20;
10+
* `SentUnlock`&#x20;
11+
* `ClaimedUnlock`
12+
13+
{% hint style="success" %}
14+
Any of these states can be treated as successfully completed final state for application-level logic.
15+
{% endhint %}
16+
17+
## Quick Start
18+
19+
* **Base URL:**`https://stats-api.dln.trade`&#x20;
20+
* **Full endpoint reference:** [Swagger](https://dln-api.debridge.finance/swagger/index.html#/Orders/Orders_GetOrderByCreationTx) and [Redoc](https://stats-api.dln.trade/redoc/index.html?url=/swagger/v1/swagger.json#tag/Orders/operation/Orders_GetOrders)
21+
* **Examples**: See the implementation examples in [this GitHub repository](https://github.com/debridge-finance/api-integrator-example/tree/master/src/scripts/orders/queries).
22+
23+
## Querying Orders
24+
25+
### By Wallet Address
26+
27+
The [`POST /api/Orders/filteredList`](https://stats-api.dln.trade/redoc/index.html?url=/swagger/v1/swagger.json#tag/Orders/operation/Orders_GetOrders) endpoint retrieves the current state and historical data for all orders associated with a wallet address. This endpoint is also used to populate the trade history view in [deExplorer](https://app.debridge.finance/orders), which can serve as a reference implementation. Pagination is supported via `skip` and `take` parameters.
28+
29+
#### Example: Fetching Completed Orders for a Wallet
30+
31+
```typescript
32+
const URL = 'https://stats-api.dln.trade/api/Orders/filteredList';
33+
34+
const requestBody = {
35+
orderStates: ['Fulfilled', 'SentUnlock', 'ClaimedUnlock' ],
36+
externalCallStates: ['NoExtCall'],
37+
skip: 0,
38+
take: 10,
39+
maker: '0x441bc84aa07a71426f4d9a40bc40ac7183d124b9',
40+
};
41+
42+
const data = await post(URL, requestBody);
43+
```
44+
45+
#### Example: Filtering Completed Orders by Destination Chain (e.g. HyperEVM)
46+
47+
```typescript
48+
const requestBody = {
49+
giveChainIds: [],
50+
takeChainIds: [100000022], // HyperEVM Chain Id
51+
orderStates: ['Fulfilled', 'SentUnlock', 'ClaimedUnlock' ],
52+
externalCallStates: ['NoExtCall'],
53+
skip: 0,
54+
take: 10,
55+
maker: '0x441bc84aa07a71426f4d9a40bc40ac7183d124b9',
56+
};
57+
```
58+
59+
## By Transaction Hash
60+
61+
For inspecting a specific order, the [`GET /api/Orders/creationTxHash/{hash}`](https://dln-api.debridge.finance/swagger/index.html#/Orders/Orders_GetOrderByCreationTx) endpoint returns full order details as shown on the [deExplorer order page](https://app.debridge.finance/order?orderId=0x87daf0659e138c13aecb59e1b044c5e296d2811188cd6812c78425273ebd064e).
62+
63+
**Example:**
64+
65+
> [https://stats-api.dln.trade/api/Orders/creationTxHash/0x3fe11542154f53dcf3134eacb30ea5ca586c9e134c223e56bbe1893862469bc5](https://stats-api.dln.trade/api/Orders/creationTxHash/0x3fe11542154f53dcf3134eacb30ea5ca586c9e134c223e56bbe1893862469bc5)
66+
67+
{% hint style="warning" %}
68+
If multiple orders were created in a single transaction, this endpoint returns data only for the first order.
69+
{% endhint %}
70+
71+
### Multiple orders created in the same transaction
72+
73+
In cases where multiple orders are created in a single transaction, retrieve all order IDs using [`GET /api/Transaction/{hash}/orderIds`](https://dln-api.debridge.finance/swagger/index.html#/Orders/Orders_GetOrderByCreationTx) .
74+
75+
For example, the transaction[`0x40ee524d5bb9c4ecd8e55d23c66c5465a3f137be7ae24df366c3fd06daf7de7e`](https://bscscan.com/tx/0x40ee524d5bb9c4ecd8e55d23c66c5465a3f137be7ae24df366c3fd06daf7de7e) has been submitted to the BNB Chain. Calling the endpoint:
76+
77+
> [`https://stats-api.dln.trade/api/Transaction/0x40ee524d5bb9c4ecd8e55d23c66c5465a3f137be7ae24df366c3fd06daf7de7e/orderIds`](https://stats-api.dln.trade/api/Transaction/0x40ee524d5bb9c4ecd8e55d23c66c5465a3f137be7ae24df366c3fd06daf7de7e/orderIds)
78+
79+
The response is an array, even if the transaction resulted in only one order:
80+
81+
```json
82+
{
83+
"orderIds": [
84+
"0x9ee6c3d0aa68a7504e619b02df7c71539d0ce10e27f593bf8604b62e51955a01"
85+
]
86+
}
87+
```
88+
89+
{% hint style="info" %}
90+
An array instead of a single `orderId` is returned because a top-level transaction may perform several calls to DLN, thus leading to multiple orders being created.
91+
{% endhint %}
92+
93+
#### Example:
94+
95+
```typescript
96+
export async function getOrderIdByTransactionHash(txHash: string) {
97+
const URL = `https://stats-api.dln.trade/api/Transaction/${txHash}/orderIds`;
98+
99+
const response = await fetch(URL);
100+
101+
if (!response.ok) {
102+
const errorText = await response.text();
103+
throw new Error(
104+
`Failed to get orderIds by transaction hash: ${response.statusText}. ${errorText}`,
105+
);
106+
}
107+
108+
const data = await response.json();
109+
110+
if (data.error) {
111+
throw new Error(`DeBridge API Error: ${data.error}`);
112+
}
113+
114+
return data;
115+
}
116+
```
117+
118+
## By orderId
119+
120+
The `orderId` is a deterministic identifier returned in the `create-tx` [response ](../creating-an-order/api-response/)or retrievable via the transaction hash.&#x20;
121+
122+
An order state can be monitored directly by using [`GET /api/Orders/{orderId}`](https://stats-api.dln.trade/swagger/index.html#/Orders/Orders_GetOrder) .
123+
124+
**Example:**
125+
126+
> [`https://stats-api.dln.trade/api/Orders/0x9ee6c3d0aa68a7504e619b02df7c71539d0ce10e27f593bf8604b62e51955a01`](https://stats-api.dln.trade/api/Orders/0x9ee6c3d0aa68a7504e619b02df7c71539d0ce10e27f593bf8604b62e51955a01)
127+
128+
**Response:**
129+
130+
```typescript
131+
{
132+
"status": "ClaimedUnlock"
133+
}
134+
```
135+
136+
#### Example:
137+
138+
```typescript
139+
export async function getOrderStatusByOrderId(orderId: string) {
140+
const URL = `https://stats-api.dln.trade/api/Orders/${orderId}`
141+
142+
const response = await fetch(URL);
143+
144+
if (!response.ok) {
145+
const errorText = await response.text();
146+
throw new Error(
147+
`Failed to get order status by orderId: ${response.statusText}. ${errorText}`,
148+
);
149+
}
150+
151+
const data = await response.json();
152+
153+
if (data.error) {
154+
throw new Error(`DeBridge API Error: ${data.error}`);
155+
}
156+
157+
return data;
158+
}
159+
```
160+
161+
## Affiliate Fee Settlement
162+
163+
If set during order creation, the [affiliate fee](../../affiliate-fees/) is automatically transferred to the `affiliateFeeRecipient` once the order reaches the `ClaimedUnlock` status.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
description: Order states explained. Order lifecycle state-machine diagram.
3+
---
4+
5+
# Order States
6+
7+
In the figure below, the order states are represented in a state-machine diagram, with the actions that trigger each state transition.&#x20;
8+
9+
<figure><img src="../../../../.gitbook/assets/image (14).png" alt=""><figcaption><p>Order states, state-machine diagram</p></figcaption></figure>
10+
11+
According to the DLN API, an order must be in one of these states:
12+
13+
<table><thead><tr><th width="197">State</th><th>Description</th></tr></thead><tbody><tr><td><code>Created</code></td><td>An order placed by a user on the DLN is pending fulfillment.</td></tr><tr><td><code>Fulfilled</code></td><td>The order on the destination chain has been completed by a solver. The full amount of the requested assets has been successfully transferred to the <code>dstChainTokenOutRecipient</code></td></tr><tr><td><code>SentUnlock</code></td><td>After fulfilling the order, the solver initiates the <strong>unlock</strong> procedure on the destination chain. A cross-chain message is sent via <a href="broken-reference">DMP </a>to unlock the <a href="../../under-the-hood/bridging-non-reserve-assets.md">input assets locked on the source chain</a>.</td></tr><tr><td><code>ClaimedUnlock</code></td><td>The unlock process is finalized, and the solver receives the <a href="../../under-the-hood/bridging-non-reserve-assets.md">input assets</a>. The affiliate fee is directed to the <code>affiliateFeeRecipient</code> on the source chain. </td></tr><tr><td><code>OrderCancelled</code></td><td>The <code>dstChainOrderAuthorityAddress</code> has started the cancellation process on the destination chain. </td></tr><tr><td><code>SentOrderCancel</code></td><td>A cross-chain message is sent via <a href="broken-reference">DMP</a> from the destination to the source chain. It unlocks the <a href="../../under-the-hood/bridging-non-reserve-assets.md">input assets</a> on the source chain to be claimed by the <code>srcAllowedCancelBeneficiary</code>.</td></tr><tr><td><code>ClaimedOrderCancel</code></td><td>The source chain <a href="../../under-the-hood/bridging-non-reserve-assets.md">input assets</a> have been claimed by the <code>srcAllowedCancelBeneficiary</code>. The cancel procedure is finalized.</td></tr></tbody></table>
14+
15+
{% hint style="success" %}
16+
If an order is either in `Fulfilled`, `SentUnlock`, or `ClaimedUnlock` states, it can be displayed as fulfilled for the end-user.
17+
{% endhint %}

docs/dln-the-debridge-liquidity-network-protocol/integration-guidelines/interacting-with-the-api/tracking-order-status/README.md

Lines changed: 0 additions & 147 deletions
This file was deleted.

0 commit comments

Comments
 (0)