Swap API

Intent Solver solve#

POST /solve#

Receives an auction and returns one or more solutions.

The response includes the objective value of the best solution(s) the solver can find, but does not include calldata. After Autopilot determines the winner, it will call the /settle endpoint to instruct the winning solver to execute its solution.

Notes#

  • Solvers should respond quickly: multi-order auctions require a response time of ≤ 8s, and single-order auctions require ≤ 2s. Timeouts are treated as forfeiting that auction round (network latency included).
  • Autopilot will call this endpoint at most once for the same auction ID.
  • If an RWA single-order auction cannot be solved in the first round, the unsolved orders will be batched together with other normal orders in the next round.
http
POST /solve
Content-Type: application/json

Request Parameters (SolveRequest)#

ParameterTypeRequiredDescriptionExample
chainIndexStringYesChain ID1-eth
auctionIdStringYesUnique auction ID12345
settlementContractStringYesSettlement contract address used to settle this auction0xabcd...
deadlineTimestampYesDeadline timestamp by which a response is expected172120120102
stressTestBooleanNoWhen true, the order is a stress test order. Skip simulation validation for /solve and return results in solutionstrue
ordersArray<Order>YesSolvable orders included in this auction
┗ orderUidStringYesUnique order identifier (56 bytes, 0x-prefixed hex)0x30cff40d...76a6
┗ ownerStringYesOrder owner address0x1234...5678
┗ fromTokenAddressStringYesSell token address0xa0b8...eb48
┗ toTokenAddressStringYesBuy token address0xdac1...1ec7
┗ fromTokenAmountStringYesSell amount (in smallest units)1000000000
┗ toTokenAmountStringYesBuy amount (in smallest units)990000000
┗ swapModeStringYesOrder kind: exactIn / exactOut. OKX currently only supports exactInexactIn
┗ partiallyFillableBooleanYesWhether partial fills are allowed. OKX currently does not support partial fillsfalse
┗ validToStringYesOrder expiry (Unix timestamp, seconds)1737400518
┗ appDataHashStringYesApp data hash (32 bytes, 0x-prefixed hex)0x0000...0000
┗ signatureStringYesSignature (0x-prefixed hex)0x1234...
┗ signingSchemeStringYesSigning scheme: eip712 / ethsign / presign / eip1271eip712
┗ receiverStringYesReceiver address0x1234...5678
┗ createTimeStringYesOrder creation time (epoch seconds)1737396918
┗ commissionInfosArrayNoCommission info list
┗┗ feePercentStringYesUp to 9 decimal places are allowed. If more decimals are provided, the system will round up automatically20000000
┗┗ feeAmountStringNoCommission fee amount100000
┗┗ referrerWalletAddressStringYesCommission recipient address0x1234...
┗┗ feeDirectionBooleanYesFee side: true = charge fromToken, false = charge toTokentrue
┗┗ commissionTypeStringYesCommission type: okx = OKX platform fee, parent = parent-node commission, child = child-node commissionokx
┗┗ toBBooleanYesOrder type: true = ToB, false = ToCfalse
tokensArrayYesToken data used in the auction (includes WETH price info)
┗ addressStringYesToken address0x1234...5611
┗ priceStringNoReference price (denominated in USD, up to 18 decimal places), used to calculate surplus1000000000000000000
┗ decimalsStringNoToken decimals18
┗ tagsArrayNoToken tag list["RWA_ONDO","RWA"]

Response Parameters#

ParameterTypeRequiredDescriptionExample
solutionsArrayNoList of solutions
┗ solutionIdStringYesSolution unique identifier (only needs to be unique within the current auction, not globally). Must be a numeric string with a maximum value of 2^63 - 11
┗ clearingPricesObjectYesMapping from token address to the uniform clearing price (price before fees are deducted)
┗ submissionAddressStringYesAddress used to submit the solution for settlement0xaFe9...3596
┗ ordersArrayYesList of orders included in the solver's solution, including the solver's own JIT orders
┗┗ orderUidStringYesUnique order identifier (56 bytes, 0x-prefixed hex)0xb91949...46e
┗┗ swapModeStringYesOrder kind: exactIn / exactOutexactIn
┗┗ fromTokenAddressStringYesSell token address0xc02a...6cc2
┗┗ toTokenAddressStringYesBuy token address0xdac1...1ec7
┗┗ fromTokenAmountStringYesMaximum amount allowed to sell1750000000000000
┗┗ toTokenAmountStringYesMinimum amount allowed to buy3529500
┗┗ executedFromTokenAmountStringYesActual amount leaving the user's wallet (including all fees)1750000000000000
┗┗ executedToTokenAmountStringYesNet amount the user actually receives (after all fees)3694070
┗┗ solverFeeInfoObjectYesSolver fee information
┗┗┗ feePercentStringYesUp to 9 decimal places are allowed. If more decimals are provided, the system will round up automatically0
┗┗┗ feeAmountStringYesSolver fee amount0
┗┗┗ solverAddressStringYesSolver fee recipient address0xaFe9...3596
┗┗┗ feeDirectionBooleanYesFee side: true = charge fromToken, false = charge toTokenfalse
┗┗ surplusFeeInfoObjectNoSurplus fee information
┗┗┗ feePercentStringYesSurplus fee percentage0
┗┗┗ trimReceiverStringYesRecipient address for the trimmed surplus0xaFe9...3596
┗┗ commissionInfosArrayNoPlatform fee & referral commission information
┗┗┗ feePercentStringYesUp to 9 decimal places are allowed. If more decimals are provided, the system will round up automatically3000000
┗┗┗ feeAmountStringYesCommission fee amount11132
┗┗┗ referrerWalletAddressStringYesCommission recipient address0x29e2...6925
┗┗┗ feeDirectionBooleanYesFee side: true = charge fromToken, false = charge toTokenfalse
┗┗┗ commissionTypeStringYesCommission type: okx = OKX platform fee, parent = parent-node commission, child = child-node commissionokx
┗┗┗ toBBooleanYesOrder type: true = ToB, false = ToCfalse

Request Example#

json
{
  "auctionId": "16979924300771968",
  "chainIndex": "1",
  "deadline": "1773829092242",
  "settlementContract": "0x1a34e1e604d8a55405172c0717b17f7631d5f265",
  "orders": [
    {
      "appDataHash": "0xb44dd4943b8f671e3e555b6e0fb8a882fd4c81d2bf2fbe27bf2bc76794d6f1ce",
      "commissionInfos": [
        {
          "commissionType": "okx",
          "feeDirection": true,
          "feePercent": "3000000",
          "referrerWalletAddress": "0x6ea08ca8f313d860808ef7431fc72c6fbcf4a72d",
          "toB": false
        },
        {
          "commissionType": "child",
          "feeDirection": true,
          "feePercent": "1000000",
          "referrerWalletAddress": "0x2c825edb17c2c04983a481ebd2da2a39424c7cb7",
          "toB": false
        },
        {
          "commissionType": "parent",
          "feeDirection": true,
          "feePercent": "500000",
          "referrerWalletAddress": "0x3474fbbc6e43dcb0398e2eacbe1032cced806742",
          "toB": false
        }
      ],
      "createTime": "1773828838",
      "fromTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "fromTokenAmount": "1000000000000000",
      "orderUid": "0xac46fe143af2afc7e3614f96cfcf660b0e680ca8d9d8f59591b63fbdc4a871413474fbbc6e43dcb0398e2eacbe1032cced80674269ba81ed",
      "owner": "0x3474fbbc6e43dcb0398e2eacbe1032cced806742",
      "partiallyFillable": false,
      "receiver": "0x3474fbbc6e43dcb0398e2eacbe1032cced806742",
      "signature": "0xabe06f2376cd977d47179be4b055df4b4ebb140d48e585c9f742019760fe02f02655eec2b87ae159c7e1a510dfe3524799504c1f6175c5c2cdff35d0ad54b6131c",
      "signingScheme": "eip712",
      "swapMode": "exactIn",
      "toTokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "toTokenAmount": "2262246",
      "validTo": "1773830637"
    }
  ],
  "tokens": [
    {
      "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "price": "2333.904192377223440889",
      "decimals": "18",
      "tags": ["RWA_ONDO", "RWA"]
    },
    {
      "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "price": "0.99998",
      "decimals": "6",
      "tags": ["RWA_ONDO", "RWA"]
    }
  ]
}

Response Example#

json
{
  "code": 0,
  "msg": "success",
  "data": {
    "solutions": [
      {
        "solutionId": "1",
        "clearingPrices": {
          "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": "471600415.188469753892516323455589889089688117",
          "0xdac17f958d2ee523a2206206994597c13d831ec7": "1"
        },
        "submissionAddress": "0xaFe9d55A5a4e90bBBabBa0327BF72196B5683596",
        "orders": [
          {
            "orderUid": "0xb919490fe85e27523f1732fcf09dc398a89deea8f7d9c5fb170cd4f6d6d3bbb729e27c8e9979b9879de65955f172f3623644692569abc46e",
            "swapMode": "exactIn",
            "fromTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "toTokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
            "fromTokenAmount": "1750000000000000",
            "toTokenAmount": "3529500",
            "executedFromTokenAmount": "1750000000000000",
            "executedToTokenAmount": "3694070",
            "solverFeeInfo": {
              "feeAmount": "0",
              "feePercent": "0",
              "feeDirection": false,
              "solverAddress": "0xaFe9d55A5a4e90bBBabBa0327BF72196B5683596"
            },
            "surplusFeeInfo": {
              "feePercent": "0",
              "trimReceiver": "0xaFe9d55A5a4e90bBBabBa0327BF72196B5683596"
            },
            "commissionInfos": [
              {
                "referrerWalletAddress": "0x29e27c8e9979b9879de65955f172f36236446925",
                "feeAmount": "11132",
                "feePercent": "3000000",
                "toB": false,
                "feeDirection": false,
                "commissionType": "okx"
              },
              {
                "referrerWalletAddress": "0x29e27c8e9979b9879de65955f172f36236446925",
                "feeAmount": "3710",
                "feePercent": "1000000",
                "toB": false,
                "feeDirection": false,
                "commissionType": "child"
              },
              {
                "referrerWalletAddress": "0x29e27c8e9979b9879de65955f172f36236446925",
                "feeAmount": "1855",
                "feePercent": "500000",
                "toB": false,
                "feeDirection": false,
                "commissionType": "parent"
              }
            ]
          },
          {
            "orderUid": "0xe2f6bd4af8ca930b391f321d8ec9d6f772748060aa4bf9b9576d97361af7724f29e27c8e9979b9879de65955f172f3623644692569abc471",
            "swapMode": "exactIn",
            "fromTokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
            "toTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
            "fromTokenAmount": "5000000",
            "toTokenAmount": "2340413279781192",
            "executedFromTokenAmount": "5000000",
            "executedToTokenAmount": "2347391066600608",
            "solverFeeInfo": {
              "feeAmount": "0",
              "feePercent": "0",
              "feeDirection": true,
              "solverAddress": "0xaFe9d55A5a4e90bBBabBa0327BF72196B5683596"
            },
            "surplusFeeInfo": {
              "feePercent": "0",
              "trimReceiver": "0xaFe9d55A5a4e90bBBabBa0327BF72196B5683596"
            },
            "commissionInfos": [
              {
                "referrerWalletAddress": "0x29e27c8e9979b9879de65955f172f36236446925",
                "feeAmount": "15000",
                "feePercent": "3000000",
                "toB": false,
                "feeDirection": true,
                "commissionType": "okx"
              },
              {
                "referrerWalletAddress": "0x29e27c8e9979b9879de65955f172f36236446925",
                "feeAmount": "5000",
                "feePercent": "1000000",
                "toB": false,
                "feeDirection": true,
                "commissionType": "child"
              },
              {
                "referrerWalletAddress": "0x29e27c8e9979b9879de65955f172f36236446925",
                "feeAmount": "2500",
                "feePercent": "500000",
                "toB": false,
                "feeDirection": true,
                "commissionType": "parent"
              }
            ]
          }
        ]
      }
    ]
  }
}