Requesting Order Creation Transaction

Placing a limit order on the deSwap Liquidity Network 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 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.
After the quote has been consumed and a user formally approves its outcome, it's time to get the transaction that actually places the limit order based on the given quote:
the input amount the user is willing to sell. Mind that this is a value modified by the quote endpoint and includes operating expenses.
the recommended amount of output token. This value should be taken from quote response (see the estimation.dstChainTokenOut.recommendedAmount property)
the address (usually, a user wallet's address) on the source chain who is is authorised to patch the order and receive funds back during order cancellation
the address on the destination chain the dstChainTokenOutAmount of the output token should be transferred to upon successful order fulfillment
the address (usually, a user wallet's address) on the destination chain who is authorised to patch and cancel the order
the address on the source chain where the accrued affiliate fee would be transferred to after the order is being fulfilled and unlocked
Let's call the /v1.0/dln/order/create-tx endpoint with all these parameter values mentioned above:
Keep in mind to setsrcChainOrderAuthorityAddress and dstChainOrderAuthorityAddressto 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 (if that happens).
The result of this request contains two objects. The estimation object has the same name and structure as inside the result of the quote endpoint, you are already familiar with. It may contain values that are slightly different from the previous call, as the prices of crypto assets are highly volatile, so don't be surprised to see a corrected estimation. However, it is important to ensure that the recommended amount of take token has not changed too much. At the time of writing the response contained the following values, indicating that the recommended amount has decreased by 1.5 bps (0.015%), which is acceptable:
"estimation": {
"dstChainTokenOut": {
"address": "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7",
"decimals": 6,
"name": "TetherToken",
"symbol": "USDt",
"chainId": 43114,
"amount": "99623050",
"recommendedAmount": "99642668"
"tx": { ... }
Having a large decrease in the recommended amount can indicate that the order won't be profitable and there won't be anyone willing to fulfill it. This would mean that a user would need to either wait indefinitely until the market conditions get better, or manually cancel an order by submitting a separate transaction on the destination chain.
Important considerations
  1. 1.
    It is advised to expire the quote after 30 seconds since it has been retrieved from the API
  2. 2.
    It is advised to expire the order creation transaction after 30 seconds since it has been retrieved from the API
  3. 3.
    For market orders, it is advised to refresh the quote if the recommended amount has changed significantly and use the recommended amount returned by /create-tx endpoint
EVM chains
The tx object has the following structure and is ready to be signed and broadcasted:
"estimation": { ... }
"tx": {
"data": "0xfbe16ca70000000000000000000000000000000[...truncated...]",
"to": "0xeF4fB24aD0916217251F553c0596F8Edc630EB66",
"value": "5000000000000000"
If the refreshed estimation and the transaction look fine, it's time to submit a transaction to the source blockchain.


For DLN trades coming from Solana the tx object has only one field data: it's hex-encoded VersionedTransaction
"estimation": { ... }
"tx": {
"data": "0x010000000000000000000000000000000000000[...truncated...]",