Skip to content

Commit

Permalink
GITBOOK-339: Added API Authentication notice
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeychr authored and gitbook-bot committed Jul 10, 2024
1 parent 3eeb5f4 commit 64163e2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
* [Withdrawing Affiliate Fees](dln-the-debridge-liquidity-network-protocol/interacting-with-smart-contracts/withdrawing-affiliate-fees.md)
* [Creating Calldata for Solana](dln-the-debridge-liquidity-network-protocol/interacting-with-smart-contracts/creating-calldata-for-solana.md)
* [Interacting with the API](dln-the-debridge-liquidity-network-protocol/interacting-with-the-api/README.md)
* [Authentication](dln-the-debridge-liquidity-network-protocol/interacting-with-the-api/authentication.md)
* [Quick Start Guide](dln-the-debridge-liquidity-network-protocol/interacting-with-the-api/quick-start-guide.md)
* [Getting a Quote](dln-the-debridge-liquidity-network-protocol/interacting-with-the-api/getting-a-quote.md)
* [Requesting Order Creation Transaction](dln-the-debridge-liquidity-network-protocol/interacting-with-the-api/requesting-order-creation-transaction.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Authentication

{% hint style="warning" %}
Currently, the DLN API is open to everyone and doesn't require authentication. However, to make sure we keep delivering a high-quality service, we're going to introduce a requirement for commercial integrations to authenticate requests with dedicated API keys later in Q4 2024. After a short grace period, we'll limit requests made without such keys.

Please fill in the [Authentication Request form](https://forms.gle/doWLQpr8oemphoaf9) so we can provide you with a dedicated API key and assistance as soon as the authentication requirement would get shipped.

[https://forms.gle/doWLQpr8oemphoaf9](https://forms.gle/doWLQpr8oemphoaf9)
{% endhint %}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The only way to cancel the order is to initiate the cancellation procedure it wa

The cancellation procedure can only be initiated by the `dstChainOrderAuthorityAddress` in a separate transaction on the destination chain. Such transaction can be requested by calling the `/v1.0/dln/order/:id/cancel-tx` endpoint:

> `https://api.dln.trade/v1.0/dln/order/0x9ee6c3d0aa68a7504e619b02df7c71539d0ce10e27f593bf8604b62e51955a01/cancel-tx`
> `https://dln.debridge.finance/v1.0/dln/order/0x9ee6c3d0aa68a7504e619b02df7c71539d0ce10e27f593bf8604b62e51955a01/cancel-tx`
This gives the response with the transaction data ready to be signed and broadcasted to the destination chain:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Getting a Quote

{% hint style="info" %}
The [/quote](https://api.dln.trade/v1.0/#/DLN/DlnOrderControllerV10\_estimateTakeAmountOrder) endpoint of DNL API should be used only to display outcomes of the trades when the address of the user is unknown (e.g. to let the user see prices of cross-chain trades before one connects the wallet to the dApp).
The [`/quote`](https://dln.debridge.finance/v1.0#/DLN/DlnOrderControllerV10\_estimateTakeAmountOrder) endpoint of DNL API should be used only to display outcomes of the trades when the address of the user is unknown (e.g. to let the user see prices of cross-chain trades before one connects the wallet to the dApp).

Whenever an address is known, make sure to call `/create-tx` directly.
{% endhint %}
Expand All @@ -25,7 +25,7 @@ Let's get a quote for our use-case by calling the `/v1.0/dln/order/quote` endpoi

Calling the endpoint:

> `https://api.dln.trade/v1.0/dln/order/quote?srcChainId=56&srcChainTokenIn=0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d&srcChainTokenInAmount=100000000000000000000&dstChainId=43114&dstChainTokenOut=0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7&prependOperatingExpenses=true&affiliateFeePercent=0.1`
> `https://dln.debridge.finance/v1.0/dln/order/quote?srcChainId=56&srcChainTokenIn=0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d&srcChainTokenInAmount=100000000000000000000&dstChainId=43114&dstChainTokenOut=0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7&prependOperatingExpenses=true&affiliateFeePercent=0.1`
gives a response with the recommended amount of input token, and several details describing how it has been calculated. The recommended amount of the output token (USDT in our case) available in the `estimation.dstChainTokenOut.recommendedAmount` property — this is the amount that can be suggested to a user for explicit approval before placing an order.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ description: >-
The DLN API provides developers an effortless way to interact with the DLN protocol and trade across chains in seconds with deep liquidity, limit orders, and protection against slippage and MEV. The API takes the burden off of building complex and sometimes painful interactions with blockchain RPCs and smart contracts by providing a complete set of RESTful endpoints, sufficient to quote, create, and manage trades during their whole lifecycle.

{% hint style="info" %}
The **DLN API** with Swagger resides at [dln.debridge.finance](https://dln.debridge.finance) 
The **DLN API** resides at the domain name `dln.debridge.finance`

The DLN API Swagger could be found at [https://dln.debridge.finance/v1.0](https://dln.debridge.finance/v1.0)

Additionally, a JSON representation of the API can be found here: [dln.debridge.finance/v1.0-json](https://dln.debridge.finance/v1.0-json)
{% endhint %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Placing a trade on the deBridge Liquidity Network (DLN) actually means submitting a data struct to the DLN smart contract on the source chain. The data struct must represent the order, including but not limited to: the give and take offers, recipient, order authorities, and other variables.

There is a [`/v1.0/dln/order/create-tx`](https://api.dln.trade/v1.0/#/DLN/DlnOrderControllerV10\_createOrder) endpoint for that, which takes all the parameters provided to the quote, the give and take parts of the quote, plus several more parameters describing the sender, recipient, and order authorities.
There is a [`/v1.0/dln/order/create-tx`](https://dln.debridge.finance/v1.0#/DLN/DlnOrderControllerV10\_createOrder) endpoint for that, which takes all the parameters provided to the quote, the give and take parts of the quote, plus several more parameters describing the sender, recipient, and order authorities.

To form the trade and get tx data to be signed, prepare the following parameters:

Expand All @@ -17,7 +17,7 @@ To form the trade and get tx data to be signed, prepare the following parameters

Let's call the `/v1.0/dln/order/create-tx` endpoint with all these parameter values mentioned above:

> `https://api.dln.trade/v1.0/dln/order/create-tx?srcChainId=56&srcChainTokenIn=0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d&srcChainTokenInAmount=100722632000000000000&dstChainId=43114&dstChainTokenOut=0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7&dstChainTokenOutAmount=99623050&dstChainTokenOutRecipient=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&srcChainOrderAuthorityAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&dstChainOrderAuthorityAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&affiliateFeePercent=0.1&affiliateFeeRecipient=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045`
> `https://dln.debridge.finance/v1.0/dln/order/create-tx?srcChainId=56&srcChainTokenIn=0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d&srcChainTokenInAmount=100722632000000000000&dstChainId=43114&dstChainTokenOut=0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7&dstChainTokenOutAmount=99623050&dstChainTokenOutRecipient=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&srcChainOrderAuthorityAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&dstChainOrderAuthorityAddress=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&affiliateFeePercent=0.1&affiliateFeeRecipient=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045`
{% hint style="warning" %}
Keep in mind to set`srcChainOrderAuthorityAddress` and `dstChainOrderAuthorityAddress`to the addresses, a user has access to. Otherwise, the order has the risk of being stuck forever or the funds being sent to the wrong address during the [canceling procedure](broken-reference) (if that happens).
Expand Down

0 comments on commit 64163e2

Please sign in to comment.