dex

Create Order

Generates an unsigned limit order message for decentralized trading, specifying parameters for maker/taker assets, amounts, fees, and execution conditions. The endpoint returns EIP-712 domain data, type definitions, and a structured payload (including salt, addresses, and asset data), which must be signed using the Blockdaemon SDK to finalize the order on-chain.

💡 Compute Unit Value: 15 (Fixed)

post/defi/v1/dex/createorder

Request

  • Base URL
    https://svc.blockdaemon.com
  • URL
    https://svc.blockdaemon.com/defi/v1/dex/createorder
  • Auth
    API key in header X-API-Key

Request body

dexId'1900' | '2200' | '2201' | '2202' | '2203' | '2204' | '2205' | '2206'

The unique ID to specify the decentralized exchange (DEX) within a particular blockchain. Find more here.

amountOutMinstring

Minimum acceptable output amount in the token's smallest denomination (base units). Provides slippage protection — the transaction reverts if the output falls below this value. Set to "0" to disable slippage protection. Examples: to require at least 0.99 USDC (6 decimals), use "990000"; to require at least 0.99 WETH (18 decimals), use "990000000000000000".

decayStartTimestring required

The start time for Dutch auction bidding. Provide a UNIX Timestamp.

decayEndTimestring required

The end time for Dutch auction bidding. Provide a UNIX Timestamp.

deadlinestring required

The latest time the transaction is valid before expiration. Provide a UNIX Timestamp.

fromstring required

The wallet address of the token sender.

pathstring[] required

Array of token contract addresses for the order pair. Provide [inputTokenAddress, outputTokenAddress].

amountInstring required

Amount of the input token to provide, specified in the token's smallest denomination (base units). Do not send human-readable decimal values. Examples: to swap 1 WETH (18 decimals), use "1000000000000000000"; to swap 1 USDC (6 decimals), use "1000000".

tostring required

The wallet address of the recipient of the token.

slippagestring

The percentage of the total swap value that is acceptable as slippage. Default: 1%. Valid range: 0% ≤ slippage ≤ 10%.

enableFeeboolean

Flag to include a basis points fee transaction alongside the main transaction when set to true.

makerAssetstring required

The token address of the asset the Maker is offering (selling) in the order.

takerAssetstring required

The token address of the asset the Maker expects to receive (buying) in return.

amountOutstring required

Amount of the output token to receive, specified in the token's smallest denomination (base units). Do not send human-readable decimal values. Examples: 1 WETH (18 decimals) = "1000000000000000000"; 1 USDC (6 decimals) = "1000000".

Example request

{
  "dexId": "1900",
  "amountOutMin": "0",
  "decayStartTime": "1741869257",
  "decayEndTime": "1741969257",
  "deadline": "1707313948",
  "from": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "path": [
    "0x514910771AF9Ca656af840dff83E8264EcF986CA",
    "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
  ],
  "amountIn": "1000000000000000000",
  "to": "0xdAe2F6EdDdA6fb4fb60cc02633DE27e2b431B402",
  "slippage": "10",
  "enableFee": false,
  "makerAsset": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
  "takerAsset": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
  "amountOut": "1000000000000000000"
}

Response

Successful response

statusinteger
msgstring
dataobject

Example response

{
  "status": 200,
  "msg": "success",
  "data": {
    "unsignedCreateOrder": {
      "types": {
        "DSOrder": [
          {
            "name": "orderHash",
            "type": "bytes32"
          },
          {
            "name": "opExpireTime",
            "type": "uint32"
          }
        ],
        "EIP712Domain": [
          {
            "name": "name",
            "type": "string"
          },
          {
            "name": "version",
            "type": "string"
          },
          {
            "name": "chainId",
            "type": "uint256"
          },
          {
            "name": "verifyingContract",
            "type": "address"
          }
        ],
        "Order": [
          {
            "name": "salt",
            "type": "uint256"
          },
          {
            "name": "makerAsset",
            "type": "address"
          },
          {
            "name": "takerAsset",
            "type": "address"
          },
          {
            "name": "maker",
            "type": "address"
          },
          {
            "name": "receiver",
            "type": "address"
          },
          {
            "name": "allowedSender",
            "type": "address"
          },
          {
            "name": "makingAmount",
            "type": "uint256"
          },
          {
            "name": "takingAmount",
            "type": "uint256"
          },
          {
            "name": "feeConfig",
            "type": "uint256"
          },
          {
            "name": "makerAssetData",
            "type": "bytes"
          },
          {
            "name": "takerAssetData",
            "type": "bytes"
          },
          {
            "name": "getMakerAmount",
            "type": "bytes"
          },
          {
            "name": "getTakerAmount",
            "type": "bytes"
          },
          {
            "name": "predicate",
            "type": "bytes"
          },
          {
            "name": "interaction",
            "type": "bytes"
          }
        ]
      },
      "domain": {
        "chainId": "137",
        "name": "Kyber DSLO Protocol",
        "verifyingContract": "0xcab2FA2eeab7065B45CBcF6E3936dDE2506b4f6C",
        "version": "1"
      },
      "primaryType": "Order",
      "message": {
        "allowedSender": "0x0000000000000000000000000000000000000000",
        "feeConfig": "146604093245187877466343990972209337885448885627689",
        "getMakerAmount": "0xf4a215c30000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000007a120",
        "getTakerAmount": "0x296637bf0000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000000007a120",
        "interaction": "0x",
        "maker": "0xdae2f6eddda6fb4fb60cc02633de27e2b431b402",
        "makerAsset": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
        "makerAssetData": "0x",
        "makingAmount": "1000000000000000000",
        "predicate": "0x961d5b1e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000cab2fa2eeab7065b45cbcf6e3936dde2506b4f6c000000000000000000000000cab2fa2eeab7065b45cbcf6e3936dde2506b4f6c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000044cf6fc6e3000000000000000000000000dae2f6eddda6fb4fb60cc02633de27e2b431b402000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002463592c2b000000000000000000000000000000000000000000000000000000006c8b6e2a00000000000000000000000000000000000000000000000000000000",
        "receiver": "0xdae2f6eddda6fb4fb60cc02633de27e2b431b402",
        "salt": "106607874126107032926667449974930188158",
        "takerAsset": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
        "takerAssetData": "0x",
        "takingAmount": "500000"
      }
    },
    "referenceId": "efbbc600a72441fd9390ffc15049a787"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.