ParaSwap · Example Payload

Build Transaction

Example: Build an Ethereum transaction for swapping 0.01 ETH to USDT on Mainnet using the priceRoute from /prices

DeFiDEX AggregatorToken SwapsBlockchainEVMCryptocurrencyLiquiditySmart Contracts

Build Transaction is an example object payload from ParaSwap, with 3 top-level fields. It illustrates the shape of data this provider's APIs accept or return.

Top-level fields

descriptionrequestresponse

Example Payload

Raw ↑
{
  "description": "Example: Build an Ethereum transaction for swapping 0.01 ETH to USDT on Mainnet using the priceRoute from /prices",
  "request": {
    "method": "POST",
    "url": "https://apiv5.paraswap.io/transactions/1",
    "headers": {
      "Content-Type": "application/json"
    },
    "body": {
      "srcToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
      "destToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
      "srcAmount": "10000000000000000",
      "destAmount": "29504841",
      "userAddress": "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8",
      "partner": "paraswap.io",
      "srcDecimals": 18,
      "destDecimals": 6,
      "priceRoute": {
        "blockNumber": 13056637,
        "network": 1,
        "srcToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
        "srcDecimals": 18,
        "srcAmount": "10000000000000000",
        "destToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
        "destDecimals": 6,
        "destAmount": "30708775",
        "bestRoute": [
          {
            "percent": 100,
            "swaps": [
              {
                "srcToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
                "srcDecimals": 18,
                "destToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
                "destDecimals": 6,
                "swapExchanges": [
                  {
                    "exchange": "SakeSwap",
                    "srcAmount": "10000000000000000",
                    "destAmount": "30708775",
                    "percent": 100,
                    "data": {
                      "router": "0xF9234CB08edb93c0d4a4d4c70cC3FfD070e78e07",
                      "path": [
                        "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
                        "0xdac17f958d2ee523a2206206994597c13d831ec7"
                      ],
                      "factory": "0x75e48C954594d64ef9613AeEF97Ad85370F13807",
                      "initCode": "0xb2b53dca60cae1d1f93f64d80703b888689f28b63c483459183f2f4271fa0308",
                      "feeFactor": 10000,
                      "pools": [
                        {
                          "address": "0xE2E5Aca8E483a4C057892EE1f03BEBc9BfA1F9C2",
                          "fee": 30,
                          "direction": true
                        }
                      ],
                      "gasUSD": "16.005884"
                    }
                  }
                ]
              }
            ]
          }
        ],
        "gasCostUSD": "17.836157",
        "gasCost": "111435",
        "side": "SELL",
        "tokenTransferProxy": "0x216b4b4ba9f3e719726886d34a177484278bfcae",
        "contractAddress": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",
        "contractMethod": "swapOnUniswapFork",
        "partnerFee": 0,
        "srcUSD": "30.7085000000",
        "destUSD": "30.7087750000",
        "partner": "paraswap.io",
        "maxImpactReached": false,
        "hmac": "1ea308b9bcd027b4c89cebc260b550e812873191"
      }
    }
  },
  "response": {
    "statusCode": 200,
    "body": {
      "from": "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8",
      "to": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57",
      "value": "10000000000000000",
      "data": "0xf566103400000000000000000000000075e48c954594d64ef9613aeef97ad85370f13807b2b53dca60cae1d1f93f64d80703b888689f28b63c483459183f2f4271fa0308000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000001c2354900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7",
      "gasPrice": "47490307239",
      "gas": "197142",
      "chainId": 1
    }
  }
}