Last active
June 2, 2022 09:07
-
-
Save SpotLabsNET/c053e9938a598618a4162f9a0f56ce35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"contact": { | |
"email": "[email protected]" | |
}, | |
"license": { | |
"name": "Apache 2.0", | |
"url": "http://www.apache.org/licenses/LICENSE-2.0.html" | |
}, | |
"title": "ParaSwap API v5", | |
"version": "1.0" | |
}, | |
"host": "apiv5.paraswap.io", | |
"basePath": "/", | |
"schemes": [ | |
"https" | |
], | |
"paths": { | |
"/prices": { | |
"get": { | |
"produces": [ | |
"application/json" | |
], | |
"parameters": [ | |
{ | |
"description": "Source Token Address or Token Symbol (for tokens from /tokens).", | |
"in": "query", | |
"name": "srcToken", | |
"required": true, | |
"type": "string", | |
"x-example": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" | |
}, | |
{ | |
"description": "Source Token Decimals; can be omitted if Symbol is provided for `srcToken`.", | |
"in": "query", | |
"minimum": 0, | |
"name": "srcDecimals", | |
"required": false, | |
"type": "integer", | |
"x-example": 18 | |
}, | |
{ | |
"description": "Destination Token Address or Token Symbol (for tokens from /tokens).", | |
"in": "query", | |
"name": "destToken", | |
"required": true, | |
"type": "string", | |
"x-example": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" | |
}, | |
{ | |
"description": "Destination Token Decimals; can be omitted if Symbol is provided for `destToken`.", | |
"in": "query", | |
"minimum": 0, | |
"name": "destDecimals", | |
"required": false, | |
"type": "integer", | |
"x-example": 6 | |
}, | |
{ | |
"description": "Amount in the Denomination of Source Token", | |
"in": "query", | |
"name": "amount", | |
"pattern": "^\\d+$", | |
"required": true, | |
"type": "string", | |
"x-example": "1000000000000000000" | |
}, | |
{ | |
"description": "Side of the swap.", | |
"enum": [ | |
"SELL", | |
"BUY" | |
], | |
"in": "query", | |
"name": "side", | |
"required": true, | |
"type": "string" | |
}, | |
{ | |
"description": "ID of the blockchain network.", | |
"in": "query", | |
"name": "network", | |
"required": false | |
}, | |
{ | |
"description": "_If provided_, **others** object is filled in the response with price quotes from other exchanges (if available for comparison).", | |
"in": "query", | |
"name": "otherExchangePrices", | |
"required": false, | |
"type": "boolean" | |
}, | |
{ | |
"collectionFormat": "csv", | |
"description": "Comma Separated List of DEXs to include without spaces.", | |
"in": "query", | |
"items": { | |
"$ref": "#/definitions/DEXs" | |
}, | |
"name": "includeDEXS", | |
"required": false, | |
"type": "array" | |
}, | |
{ | |
"collectionFormat": "csv", | |
"description": "Comma Separated List of DEXs to exclude without spaces.", | |
"in": "query", | |
"items": { | |
"$ref": "#/definitions/DEXs" | |
}, | |
"name": "excludeDEXS", | |
"required": false, | |
"type": "array" | |
}, | |
{ | |
"collectionFormat": "csv", | |
"description": "Comma Separated List of Contract Methods to include without spaces.", | |
"in": "query", | |
"items": { | |
"$ref": "#/definitions/ContractMethod" | |
}, | |
"name": "includeContractMethods", | |
"required": false, | |
"type": "array" | |
}, | |
{ | |
"collectionFormat": "csv", | |
"description": "Comma Separated List of Contract Methods to exclude without spaces.", | |
"in": "query", | |
"items": { | |
"$ref": "#/definitions/ContractMethod" | |
}, | |
"name": "excludeContractMethods", | |
"required": false, | |
"type": "array" | |
}, | |
{ | |
"description": "User Wallet Address.", | |
"in": "query", | |
"name": "userAddress", | |
"required": false, | |
"type": "string" | |
}, | |
{ | |
"description": "Dash (-) separated list of tokens (addresses or symbols from /tokens) to comprise the price route. Max 4 tokens", | |
"examples": { | |
"": { | |
"value": null | |
}, | |
"ETH-USDC": { | |
"value": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" | |
} | |
}, | |
"in": "query", | |
"name": "route", | |
"required": false, | |
"type": "string" | |
}, | |
{ | |
"description": "partner string", | |
"in": "query", | |
"name": "partner", | |
"required": false, | |
"type": "string" | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Successful prices response", | |
"schema": { | |
"properties": { | |
"priceRoute": { | |
"$ref": "#/definitions/PriceRoute" | |
} | |
}, | |
"type": "object" | |
} | |
}, | |
"400": { | |
"description": "Price Error", | |
"schema": {} | |
} | |
}, | |
"tags": [ | |
"prices" | |
], | |
"summary": "Request prices." | |
} | |
}, | |
"/tokens": { | |
"get": { | |
"produces": [ | |
"application/json" | |
], | |
"parameters": [], | |
"responses": { | |
"200": { | |
"description": "List of available tokens", | |
"examples": { | |
"application/json": { | |
"tokens": [ | |
{ | |
"address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"decimals": 18, | |
"img": "https://img.paraswap.network/ETH.png", | |
"network": 1, | |
"symbol": "ETH" | |
}, | |
{ | |
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7", | |
"decimals": 6, | |
"img": "https://img.paraswap.network/USDT.png", | |
"network": 1, | |
"symbol": "USDT" | |
} | |
] | |
} | |
}, | |
"schema": { | |
"$ref": "#/definitions/TokensList" | |
} | |
} | |
}, | |
"tags": [ | |
"tokens" | |
], | |
"description": "alias for /tokens/1" | |
} | |
}, | |
"/tokens/{network}": { | |
"get": { | |
"produces": [ | |
"application/json" | |
], | |
"parameters": [ | |
{ | |
"description": "ID of the network. (Mainnet - 1, Ropsten - 3, Polygon - 56, BSC - 137).", | |
"in": "path", | |
"name": "network", | |
"required": true | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "List of available tokens", | |
"examples": { | |
"application/json": { | |
"tokens": [ | |
{ | |
"address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"decimals": 18, | |
"img": "https://img.paraswap.network/ETH.png", | |
"network": 1, | |
"symbol": "ETH" | |
}, | |
{ | |
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7", | |
"decimals": 6, | |
"img": "https://img.paraswap.network/USDT.png", | |
"network": 1, | |
"symbol": "USDT" | |
} | |
] | |
} | |
}, | |
"schema": { | |
"$ref": "#/definitions/TokensList" | |
} | |
} | |
}, | |
"tags": [ | |
"tokens" | |
] | |
} | |
}, | |
"/transactions/{network}": { | |
"post": { | |
"consumes": [ | |
"application/json" | |
], | |
"produces": [ | |
"application/json" | |
], | |
"parameters": [ | |
{ | |
"description": "ID of the network. (Mainnet - 1, Ropsten - 3, Polygon - 56, BSC - 137).", | |
"in": "path", | |
"name": "network", | |
"required": true | |
}, | |
{ | |
"description": "The set gas-price for the transaction in wei.", | |
"examples": { | |
"": { | |
"value": null | |
}, | |
"fast": { | |
"value": "50000000000" | |
} | |
}, | |
"in": "query", | |
"name": "gasPrice", | |
"required": false, | |
"type": "string" | |
}, | |
{ | |
"description": "Allows the API to skip performing onchain checks such as balances, allowances, as well as transaction simulations.\n<b>Note:</b> The response does not contain <b><u>gas</u></b> parameter when <i>ignoreChecks</i> is set to `true`.\n", | |
"in": "query", | |
"name": "ignoreChecks", | |
"required": false, | |
"type": "boolean" | |
}, | |
{ | |
"description": "Allows the API to skip gas checks <b>Note:</b> The response does not contain <b><u>gas</u></b> parameter when <i>ignoreGasEstimate</i> is set to `true`.", | |
"in": "query", | |
"name": "ignoreGasEstimate", | |
"required": false, | |
"type": "boolean" | |
}, | |
{ | |
"description": "Allows the API to return the contract parameters only.", | |
"in": "query", | |
"name": "onlyParams", | |
"required": false, | |
"type": "boolean" | |
}, | |
{ | |
"description": "Checkout `schemas/TransactionsRequestPayload` to infer what parameters are required to be parsed in the responseBody. (<b>Note</b>: The priceRoute object should be directly parsed without any change.)", | |
"in": "body", | |
"name": "body", | |
"required": true, | |
"schema": { | |
"$ref": "#/definitions/TransactionsRequestPayload" | |
} | |
} | |
], | |
"responses": { | |
"200": { | |
"description": "Ethereum transaction request object.<br/>\n`gas` is included only if neither of `ignoreChecks` and `ignoreGasEstimate` are true<br/>\nWhen `onlyParams=true` `schemas/RouterParametersExample` is returned\n", | |
"schema": {} | |
}, | |
"400": { | |
"description": "Transaction Building Error", | |
"schema": { | |
"$ref": "#/definitions/TransactionsError" | |
} | |
} | |
}, | |
"tags": [ | |
"transactions" | |
], | |
"summary": "Build Transaction to be sent to the blockchain." | |
} | |
} | |
}, | |
"definitions": { | |
"ContractMethod": { | |
"enum": [ | |
"swapOnUniswap", | |
"buyOnUniswap", | |
"swapOnUniswapFork", | |
"buyOnUniswapFork", | |
"swapOnUniswapV2Fork", | |
"buyOnUniswapV2Fork", | |
"simpleBuy", | |
"simpleSwap", | |
"multiSwap", | |
"megaSwap", | |
"protectedMultiSwap", | |
"protectedMegaSwap", | |
"protectedSimpleSwap", | |
"protectedSimpleBuy", | |
"swapOnZeroXv2", | |
"swapOnZeroXv4", | |
"buy" | |
], | |
"type": "string" | |
}, | |
"DEXs": { | |
"description": "Supported DEXs. The list may change", | |
"enum": [ | |
"Uniswap", | |
"Kyber", | |
"Bancor", | |
"Oasis", | |
"Compound", | |
"Fulcrum", | |
"0x", | |
"MakerDAO", | |
"Chai", | |
"ParaSwapPool", | |
"Aave", | |
"Aave2", | |
"MultiPath", | |
"MegaPath", | |
"Curve", | |
"Curve3", | |
"Saddle", | |
"IronV2", | |
"BDai", | |
"idle", | |
"Weth", | |
"Beth", | |
"UniswapV2", | |
"Balancer", | |
"0xRFQt", | |
"ParaSwapPool2", | |
"ParaSwapPool3", | |
"ParaSwapPool4", | |
"ParaSwapPool5", | |
"ParaSwapPool6", | |
"SushiSwap", | |
"LINKSWAP", | |
"Synthetix", | |
"DefiSwap", | |
"Swerve", | |
"CoFiX", | |
"Shell", | |
"DODOV1", | |
"DODOV2", | |
"OnChainPricing", | |
"PancakeSwap", | |
"PancakeSwapV2", | |
"ApeSwap", | |
"Wbnb", | |
"acryptos", | |
"streetswap", | |
"bakeryswap", | |
"julswap", | |
"vswap", | |
"vpegswap", | |
"beltfi", | |
"ellipsis", | |
"QuickSwap", | |
"COMETH", | |
"Wmatic", | |
"Nerve", | |
"Dfyn", | |
"UniswapV3", | |
"Smoothy", | |
"PantherSwap", | |
"OMM1", | |
"OneInchLP", | |
"CurveV2", | |
"mStable", | |
"WaultFinance", | |
"MDEX", | |
"ShibaSwap", | |
"CoinSwap", | |
"SakeSwap", | |
"JetSwap", | |
"Biswap", | |
"BProtocol" | |
], | |
"example": "SushiSwap", | |
"type": "string" | |
}, | |
"Network": { | |
"enum": [ | |
1, | |
3, | |
56, | |
137 | |
], | |
"type": "number" | |
}, | |
"OptimalRoute": { | |
"properties": { | |
"percent": { | |
"example": 100, | |
"type": "number" | |
}, | |
"swaps": { | |
"items": { | |
"$ref": "#/definitions/OptimalSwap" | |
}, | |
"type": "array" | |
} | |
}, | |
"required": [ | |
"percent", | |
"swaps" | |
], | |
"type": "object" | |
}, | |
"OptimalSwap": { | |
"properties": { | |
"destDecimals": { | |
"$ref": "#/definitions/TokenDecimals" | |
}, | |
"destToken": { | |
"example": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", | |
"type": "string" | |
}, | |
"srcDecimals": { | |
"$ref": "#/definitions/TokenDecimals" | |
}, | |
"srcToken": { | |
"example": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"type": "string" | |
}, | |
"swapExchanges": { | |
"items": { | |
"$ref": "#/definitions/OptimalSwapExchange" | |
}, | |
"type": "array" | |
} | |
}, | |
"required": [ | |
"srcToken", | |
"srcDecimals", | |
"destToken", | |
"destDecimals", | |
"swapExchanges" | |
], | |
"type": "object" | |
}, | |
"OptimalSwapExchange": { | |
"properties": { | |
"data": { | |
"example": { | |
"$ref": "#/x-components/examples/ExchangeDataExample/value" | |
}, | |
"type": "object" | |
}, | |
"destAmount": { | |
"example": "1000000000000000000", | |
"type": "string" | |
}, | |
"exchange": { | |
"example": "UniswapV2", | |
"type": "string" | |
}, | |
"percent": { | |
"example": 100, | |
"type": "number" | |
}, | |
"srcAmount": { | |
"example": "1000000000000000000", | |
"type": "string" | |
} | |
}, | |
"required": [ | |
"exchange", | |
"srcAmount", | |
"destAmount", | |
"percent" | |
], | |
"type": "object" | |
}, | |
"OptionalRate": { | |
"properties": { | |
"data": { | |
"example": { | |
"$ref": "#/x-components/examples/ExchangeDataExample/value" | |
}, | |
"type": "object" | |
}, | |
"destAmount": { | |
"example": "3255989380", | |
"type": "string" | |
}, | |
"exchange": { | |
"example": "UniswapV2", | |
"type": "string" | |
}, | |
"srcAmount": { | |
"example": "1000000000000000000", | |
"type": "string" | |
}, | |
"unit": { | |
"example": "3255989380", | |
"type": "string" | |
} | |
}, | |
"required": [ | |
"exchange", | |
"srcAmount", | |
"destAmount" | |
], | |
"type": "object" | |
}, | |
"PriceError": { | |
"example": { | |
"error": "computePrice Error" | |
}, | |
"properties": { | |
"error": { | |
"$ref": "#/definitions/PriceErrorMessage" | |
} | |
}, | |
"required": [ | |
"error" | |
], | |
"type": "object" | |
}, | |
"PriceErrorMessage": { | |
"enum": [ | |
"Invalid tokens", | |
"Invalid route, from token should be the first token of the route", | |
"Invalid route, to token should be the last token of the route", | |
"Token not found", | |
"Price Timeout", | |
"computePrice Error", | |
"Bad USD price", | |
"ERROR_GETTING_PRICES", | |
"An error has occurred, please try again later or contact our support" | |
], | |
"type": "string" | |
}, | |
"PriceRoute": { | |
"description": "Response Body returned from `/prices` endpoint.", | |
"properties": { | |
"bestRoute": { | |
"$ref": "#/definitions/OptimalRoute" | |
}, | |
"blockNumber": { | |
"example": 13015909, | |
"minimum": 0, | |
"type": "integer" | |
}, | |
"contractAddress": { | |
"example": "0x485D2446711E141D2C8a94bC24BeaA5d5A110D74", | |
"type": "string" | |
}, | |
"contractMethod": { | |
"example": "swapOnUniswap", | |
"type": "string" | |
}, | |
"destAmount": { | |
"example": "1000000000000000000", | |
"type": "string" | |
}, | |
"destDecimals": { | |
"$ref": "#/definitions/TokenDecimals" | |
}, | |
"destToken": { | |
"description": "Destination Token Address", | |
"example": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", | |
"type": "string" | |
}, | |
"destUSD": { | |
"example": "3218.9300566052", | |
"type": "string" | |
}, | |
"gasCost": { | |
"example": "111435", | |
"type": "string" | |
}, | |
"gasCostUSD": { | |
"example": "11.947163", | |
"type": "string" | |
}, | |
"hmac": { | |
"example": "319c5cf83098a07aeebb11bed6310db51311201f", | |
"type": "string" | |
}, | |
"maxImpactReached": { | |
"example": false, | |
"type": "boolean" | |
}, | |
"network": { | |
"$ref": "#/definitions/Network" | |
}, | |
"others": { | |
"allOf": [ | |
{ | |
"description": "Available if `/prices` endpoint was called with `otherExchangePrices=true` in query" | |
}, | |
{ | |
"$ref": "#/definitions/OptionalRate" | |
} | |
] | |
}, | |
"partner": { | |
"example": "paraswap.io", | |
"type": "string" | |
}, | |
"partnerFee": { | |
"example": 0, | |
"minimum": 0, | |
"type": "integer" | |
}, | |
"side": { | |
"$ref": "#/definitions/SwapSide" | |
}, | |
"srcAmount": { | |
"example": "1000000000000000000", | |
"type": "string" | |
}, | |
"srcDecimals": { | |
"$ref": "#/definitions/TokenDecimals" | |
}, | |
"srcToken": { | |
"description": "Source Token Address", | |
"example": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"type": "string" | |
}, | |
"srcUSD": { | |
"example": "3230.3000000000", | |
"type": "string" | |
}, | |
"tokenTransferProxy": { | |
"example": "0x3e7d31751347BAacf35945074a4a4A41581B2271", | |
"type": "string" | |
} | |
}, | |
"required": [ | |
"blockNumber", | |
"network", | |
"srcToken", | |
"srcDecimals", | |
"srcAmount", | |
"destToken", | |
"destDecimals", | |
"destAmount", | |
"bestRoute", | |
"gasCost", | |
"gasCostUSD", | |
"side", | |
"tokenTransferProxy", | |
"contractAddress", | |
"contractMethod", | |
"srcUSD", | |
"destUSD", | |
"partner", | |
"partnerFee", | |
"maxImpactReached", | |
"hmac" | |
], | |
"type": "object" | |
}, | |
"PriceRouteWithError": { | |
"properties": { | |
"error": { | |
"enum": [ | |
"ESTIMATED_LOSS_GREATER_THAN_MAX_IMPACT" | |
], | |
"type": "string" | |
}, | |
"priceRoute": { | |
"$ref": "#/definitions/PriceRoute" | |
}, | |
"value": { | |
"description": "price impact %", | |
"example": "99%", | |
"pattern": "^\\d+(\\.\\d+)?%$", | |
"type": "string" | |
} | |
}, | |
"required": [ | |
"error", | |
"value", | |
"priceRoute" | |
], | |
"type": "object" | |
}, | |
"RouterParameters": { | |
"description": "returned when `/tarnsactions` is called with `onlyParams=true`", | |
"example": { | |
"$ref": "#/x-components/examples/RouterParametersExample/value" | |
}, | |
"items": {}, | |
"type": "array" | |
}, | |
"SwapSide": { | |
"enum": [ | |
"SELL", | |
"BUY" | |
], | |
"type": "string" | |
}, | |
"Token": { | |
"properties": { | |
"address": { | |
"type": "string" | |
}, | |
"connectors": { | |
"items": { | |
"type": "string" | |
}, | |
"type": "array" | |
}, | |
"decimals": { | |
"$ref": "#/definitions/TokenDecimals" | |
}, | |
"img": { | |
"type": "string" | |
}, | |
"name": { | |
"type": "string" | |
}, | |
"network": { | |
"$ref": "#/definitions/Network" | |
}, | |
"newToken": { | |
"default": false, | |
"type": "boolean" | |
}, | |
"symbol": { | |
"type": "string" | |
}, | |
"tokenType": { | |
"enum": [ | |
"ETH", | |
"ERC20", | |
"SYNTH", | |
"cToken", | |
"iToken", | |
"aToken", | |
"aToken2", | |
"idleToken", | |
"Chai", | |
"bDAI" | |
], | |
"type": "string" | |
} | |
}, | |
"required": [ | |
"symbol", | |
"address", | |
"decimals", | |
"img", | |
"network", | |
"newToken", | |
"connectors", | |
"tokenType" | |
], | |
"type": "object" | |
}, | |
"TokenDecimals": { | |
"minimum": 0, | |
"type": "integer" | |
}, | |
"TokensList": { | |
"properties": { | |
"tokens": { | |
"items": { | |
"$ref": "#/definitions/Token" | |
}, | |
"type": "array" | |
} | |
}, | |
"type": "object" | |
}, | |
"TransactionsBuildResponse": { | |
"properties": { | |
"chainId": { | |
"$ref": "#/definitions/Network" | |
}, | |
"data": { | |
"example": "0xf566103400000000000000000000000075e48c954594d64ef9613aeef97ad85370f13807b2b53dca60cae1d1f93f64d80703b888689f28b63c483459183f2f4271fa0308000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000001c2354900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7", | |
"type": "string" | |
}, | |
"from": { | |
"example": "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8", | |
"type": "string" | |
}, | |
"gas": { | |
"description": "`gas` is included only if neither of `ignoreChecks` and `ignoreGasEstimate` are true", | |
"example": "197142", | |
"type": "string" | |
}, | |
"gasPrice": { | |
"example": "42452400000", | |
"type": "string" | |
}, | |
"to": { | |
"example": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57", | |
"type": "string" | |
}, | |
"value": { | |
"example": "10000000000000000", | |
"type": "string" | |
} | |
}, | |
"type": "object" | |
}, | |
"TransactionsError": { | |
"example": { | |
"error": "Unable to process the transaction" | |
}, | |
"properties": { | |
"error": { | |
"$ref": "#/definitions/TransactionsErrorMessage" | |
} | |
}, | |
"required": [ | |
"error" | |
], | |
"type": "object" | |
}, | |
"TransactionsErrorMessage": { | |
"enum": [ | |
"Unable to check price impact", | |
"It seems like the rate has changed, please re-query the latest Price", | |
"The rate has changed, please re-query the latest Price", | |
"It seems like your wallet doesn't contain enough ETH to cover the gas fees.", | |
"It seems like your wallet doesn't contain enough BNB to cover the gas fees.", | |
"It seems like your wallet doesn't contain enough MATIC to cover the gas fees.", | |
"Not enough <TOKEN_ADDRESS or TOKEN_SYMBOL> balance", | |
"Not enough <TOKEN_ADDRESS or TOKEN_SYMBOL> allowance given to TokenTransferProxy(<CONTRACT_ADDRESS>)", | |
"Network Mismatch", | |
"Missing srcAmount", | |
"Missing destAmount", | |
"Cannot specify both slippage and srcAmount", | |
"Cannot specify both slippage and destAmount", | |
"Missing slippage or srcAmount", | |
"Missing slippage or destAmount", | |
"Source Amount Mismatch", | |
"Destination Amount Mismatch", | |
"Source Token Mismatch", | |
"Destination Token Mismatch", | |
"Error Parsing params", | |
"priceRoute must be unmodified as sent by the price endpoint", | |
"Unable to process the transaction", | |
"ERROR_BUILDING_TRANSACTION", | |
"An error has occurred, please try again later or contact our support" | |
], | |
"type": "string" | |
}, | |
"TransactionsRequestPayload": { | |
"example": { | |
"$ref": "#/x-components/examples/TransactionsRequestBodyExample/value" | |
}, | |
"properties": { | |
"deadline": { | |
"description": "Timestamp (10 digit/seconds precision) till when the given transaction is valid. Eg: 1629214486. For a 5 minute, `deadline` could be calculated as `Date.now()/1000 + 300.`", | |
"type": "integer" | |
}, | |
"destAmount": { | |
"description": "Amount in the Denomination of `destToken` as returned from the `/prices` end-point.Required if `side=SELL`. Could only be ommitted if slippage & srcAmount is provided when `side=SELL`", | |
"example": 1000000000000000000, | |
"type": "integer" | |
}, | |
"destDecimals": { | |
"description": "Destination Token Decimals; can be omitted if Symbol is provided for `destToken`.", | |
"example": 6, | |
"type": "integer" | |
}, | |
"destToken": { | |
"description": "Destination Token Address. Only Token Symbol could be specified for tokens from `/tokens`.", | |
"example": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", | |
"type": "string" | |
}, | |
"partner": { | |
"description": "Partner string. If `partnerAddress` not provided, partnerFeePercent is matched against known partners", | |
"example": "metamask", | |
"type": "string" | |
}, | |
"partnerAddress": { | |
"description": "Partner Address. If provided takes precedence over `partner`", | |
"type": "string" | |
}, | |
"partnerFeePercent": { | |
"description": "Used together with `partner` if provided. Should be parsed in Basis Points. Look at `slippage` parameter description to understand better.", | |
"maximum": 10000, | |
"minimum": 0, | |
"type": "integer" | |
}, | |
"permit": { | |
"description": "Permit-hash (hex-string) to omit approving the user before swap. Helps in saving gas.", | |
"type": "string" | |
}, | |
"priceRoute": { | |
"$ref": "#/definitions/PriceRoute" | |
}, | |
"receiver": { | |
"description": "Address of the Receiver.", | |
"type": "string" | |
}, | |
"slippage": { | |
"description": "Slippage percentage (represented in basis points). Eg: for 2.5% slippage, set the value to 0.025 * 10000 = 250; for 10% = 1000. <b>slippage</b> could be passed instead of `destAmount` when `side=SELL` or `srcAmount` when `side=BUY`", | |
"maximum": 10000, | |
"minimum": 0, | |
"type": "integer" | |
}, | |
"srcAmount": { | |
"description": "Amount in the Denomination of `srcToken` as returned from the `/prices` end-point. Required if `side=SELL`. Could only be ommitted if slippage & destAmount is provided when `side=BUY`", | |
"example": 1000000000000000000, | |
"type": "integer" | |
}, | |
"srcDecimals": { | |
"description": "Source Token Decimals; can be omitted if Symbol is provided for `srcToken`.", | |
"example": 18, | |
"type": "integer" | |
}, | |
"srcToken": { | |
"description": "Source Token Address. Only Token Symbol could be specified for tokens from `/tokens`.", | |
"example": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"type": "string" | |
}, | |
"txOrigin": { | |
"description": "Whenever msg.sender (userAddress) is different than the address calling the paraswap contract, `txOrigin` must be passed along with `userAddress`.", | |
"type": "string" | |
}, | |
"userAddress": { | |
"description": "Address of the Signer", | |
"example": "0xF7B2F3cD946052f8b397F801299b80F053515AF9", | |
"type": "string" | |
} | |
}, | |
"required": [ | |
"srcToken", | |
"destToken", | |
"userAddress", | |
"priceRoute" | |
], | |
"type": "object" | |
} | |
}, | |
"tags": [ | |
{ | |
"description": "Return tokens list from Paraswap", | |
"name": "tokens" | |
}, | |
{ | |
"description": "Get swap path and pricing.", | |
"name": "prices" | |
}, | |
{ | |
"description": "Build parameters for a transaction", | |
"name": "transactions" | |
} | |
], | |
"externalDocs": { | |
"description": "Paraswap Website", | |
"url": "http://paraswap.io" | |
}, | |
"x-components": { | |
"parameters": { | |
"Network": { | |
"description": "ID of the network. (Mainnet - 1, Ropsten - 3, Polygon - 56, BSC - 137).", | |
"in": "path", | |
"name": "network", | |
"required": true | |
} | |
}, | |
"responses": { | |
"PricesErrorResponse": { | |
"content": { | |
"application/json": { | |
"examples": { | |
"PriceError": { | |
"value": { | |
"error": "computePrice Error" | |
} | |
}, | |
"PriceRoute with Error": { | |
"$ref": "#/x-components/examples/PriceRouteWithErrorExample" | |
} | |
}, | |
"schema": { | |
"oneOf": [ | |
{ | |
"$ref": "#/definitions/PriceError" | |
}, | |
{ | |
"$ref": "#/definitions/PriceRouteWithError" | |
} | |
] | |
} | |
} | |
}, | |
"description": "Price Error" | |
}, | |
"PricesSuccessResponse": { | |
"content": { | |
"application/json": { | |
"schema": { | |
"properties": { | |
"priceRoute": { | |
"$ref": "#/definitions/PriceRoute" | |
} | |
}, | |
"type": "object" | |
} | |
} | |
}, | |
"description": "Successful prices response" | |
}, | |
"TokensResponse": { | |
"content": { | |
"application/json": { | |
"example": { | |
"tokens": [ | |
{ | |
"address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"decimals": 18, | |
"img": "https://img.paraswap.network/ETH.png", | |
"network": 1, | |
"symbol": "ETH" | |
}, | |
{ | |
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7", | |
"decimals": 6, | |
"img": "https://img.paraswap.network/USDT.png", | |
"network": 1, | |
"symbol": "USDT" | |
} | |
] | |
}, | |
"schema": { | |
"$ref": "#/definitions/TokensList" | |
} | |
} | |
}, | |
"description": "List of available tokens" | |
}, | |
"TransactionsBuildErrorResponse": { | |
"content": { | |
"application/json": { | |
"schema": { | |
"$ref": "#/definitions/TransactionsError" | |
} | |
} | |
}, | |
"description": "Transaction Building Error" | |
}, | |
"TransactionsBuildSuccessResponse": { | |
"content": { | |
"application/json": { | |
"examples": { | |
"RouterParameters": { | |
"$ref": "#/x-components/examples/RouterParametersExample" | |
}, | |
"TransactionResponse": { | |
"$ref": "#/x-components/examples/TransactionResponseExample" | |
} | |
}, | |
"schema": { | |
"oneOf": [ | |
{ | |
"$ref": "#/definitions/TransactionsBuildResponse" | |
}, | |
{ | |
"$ref": "#/definitions/RouterParameters" | |
} | |
] | |
} | |
} | |
}, | |
"description": "Ethereum transaction request object.<br/>\n`gas` is included only if neither of `ignoreChecks` and `ignoreGasEstimate` are true<br/>\nWhen `onlyParams=true` `schemas/RouterParametersExample` is returned\n" | |
} | |
}, | |
"examples": { | |
"ExchangeDataExample": { | |
"summary": "Example of Exchange data", | |
"value": { | |
"factory": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", | |
"feeFactor": 10000, | |
"gasUSD": "13.227195", | |
"initCode": "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f", | |
"path": [ | |
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", | |
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" | |
], | |
"pools": [ | |
{ | |
"address": "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc", | |
"direction": false, | |
"fee": 30 | |
} | |
], | |
"router": "0x0000000000000000000000000000000000000000" | |
} | |
}, | |
"PriceRouteWithErrorExample": { | |
"value": { | |
"error": "ESTIMATED_LOSS_GREATER_THAN_MAX_IMPACT", | |
"priceRoute": { | |
"bestRoute": [ | |
{ | |
"percent": 100, | |
"swaps": [ | |
{ | |
"destDecimals": 6, | |
"destToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", | |
"srcDecimals": 18, | |
"srcToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"swapExchanges": [ | |
{ | |
"data": { | |
"factory": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", | |
"feeFactor": 10000, | |
"gasUSD": "11.730851", | |
"initCode": "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f", | |
"path": [ | |
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", | |
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" | |
], | |
"pools": [ | |
{ | |
"address": "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc", | |
"direction": false, | |
"fee": 30 | |
} | |
], | |
"router": "0x0000000000000000000000000000000000000000" | |
}, | |
"destAmount": "3273085640", | |
"exchange": "UniswapV2", | |
"percent": 100, | |
"srcAmount": "1000000000000000000" | |
} | |
] | |
} | |
] | |
} | |
], | |
"blockNumber": 13042705, | |
"contractAddress": "0x0000000000000000000000000000000000000000", | |
"contractMethod": "swapOnUniswap", | |
"destAmount": "3273085640", | |
"destDecimals": 6, | |
"destToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", | |
"destUSD": "3269.3903263124", | |
"gasCost": "111435", | |
"gasCostUSD": "16.340342", | |
"hmac": "69e1761ab652327e16470d2be0b77b3c66f35004", | |
"maxImpactReached": false, | |
"network": 1, | |
"others": [ | |
{ | |
"data": { | |
"factory": "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", | |
"feeFactor": 10000, | |
"gasUSD": "11.730851", | |
"initCode": "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f", | |
"path": [ | |
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", | |
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" | |
], | |
"pools": [ | |
{ | |
"address": "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc", | |
"direction": false, | |
"fee": 30 | |
} | |
], | |
"router": "0x0000000000000000000000000000000000000000" | |
}, | |
"destAmount": "3273085640", | |
"exchange": "UniswapV2", | |
"srcAmount": "1000000000000000000", | |
"unit": "3273085640" | |
}, | |
{ | |
"data": { | |
"gasUSD": "29.327128", | |
"path": [ | |
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"0xb1CD6e4153B2a390Cf00A6556b0fC1458C4A5533", | |
"0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C", | |
"0x874d8dE5b26c9D9f6aA8d7bab283F9A9c6f777f4", | |
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" | |
] | |
}, | |
"destAmount": "3270223905", | |
"exchange": "Bancor", | |
"srcAmount": "1000000000000000000", | |
"unit": "3270223905" | |
}, | |
{ | |
"data": { | |
"exchange": "0x9AAb3f75489902f3a48495025729a0AF77d4b11e", | |
"gasUSD": "41.057979" | |
}, | |
"destAmount": "3275792116", | |
"exchange": "Kyber", | |
"srcAmount": "1000000000000000000", | |
"unit": "3275792116" | |
} | |
], | |
"partner": "paraswap.io", | |
"partnerFee": 0, | |
"side": "SELL", | |
"srcAmount": "1000000000000000000", | |
"srcDecimals": 18, | |
"srcToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"srcUSD": "3276.8800000000", | |
"tokenTransferProxy": "0x0000000000000000000000000000000000000000" | |
}, | |
"value": "99.85%" | |
} | |
}, | |
"RouterParametersExample": { | |
"value": [ | |
"0x115934131916C8b277DD010Ee02de363c09d037c", | |
"0x65d1a3b1e46c6e4f1be1ad5f99ef14dc488ae0549dc97db9b30afe2241ce1c7a", | |
"10000000000000000", | |
"29504841", | |
[ | |
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"0xdac17f958d2ee523a2206206994597c13d831ec7" | |
] | |
] | |
}, | |
"TransactionResponseExample": { | |
"summary": "TransactionRequest to sign and send to the blockchain", | |
"value": { | |
"chainId": 1, | |
"data": "0xf566103400000000000000000000000075e48c954594d64ef9613aeef97ad85370f13807b2b53dca60cae1d1f93f64d80703b888689f28b63c483459183f2f4271fa0308000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000001c2354900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7", | |
"from": "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8", | |
"gas": "197142", | |
"gasPrice": "47490307239", | |
"to": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57", | |
"value": "10000000000000000" | |
} | |
}, | |
"TransactionsRequestBodyExample": { | |
"summary": "Example of request.body sent to /transactions", | |
"value": { | |
"destAmount": "29504841", | |
"destDecimals": 6, | |
"destToken": "0xdac17f958d2ee523a2206206994597c13d831ec7", | |
"partner": "paraswap.io", | |
"priceRoute": { | |
"bestRoute": [ | |
{ | |
"percent": 100, | |
"swaps": [ | |
{ | |
"destDecimals": 6, | |
"destToken": "0xdac17f958d2ee523a2206206994597c13d831ec7", | |
"srcDecimals": 18, | |
"srcToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"swapExchanges": [ | |
{ | |
"data": { | |
"factory": "0x75e48C954594d64ef9613AeEF97Ad85370F13807", | |
"feeFactor": 10000, | |
"gasUSD": "16.005884", | |
"initCode": "0xb2b53dca60cae1d1f93f64d80703b888689f28b63c483459183f2f4271fa0308", | |
"path": [ | |
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", | |
"0xdac17f958d2ee523a2206206994597c13d831ec7" | |
], | |
"pools": [ | |
{ | |
"address": "0xE2E5Aca8E483a4C057892EE1f03BEBc9BfA1F9C2", | |
"direction": true, | |
"fee": 30 | |
} | |
], | |
"router": "0xF9234CB08edb93c0d4a4d4c70cC3FfD070e78e07" | |
}, | |
"destAmount": "30708775", | |
"exchange": "SakeSwap", | |
"percent": 100, | |
"srcAmount": "10000000000000000" | |
} | |
] | |
} | |
] | |
} | |
], | |
"blockNumber": 13056637, | |
"contractAddress": "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57", | |
"contractMethod": "swapOnUniswapFork", | |
"destAmount": "30708775", | |
"destDecimals": 6, | |
"destToken": "0xdac17f958d2ee523a2206206994597c13d831ec7", | |
"destUSD": "30.7087750000", | |
"gasCost": "111435", | |
"gasCostUSD": "17.836157", | |
"hmac": "1ea308b9bcd027b4c89cebc260b550e812873191", | |
"maxImpactReached": false, | |
"network": 1, | |
"partner": "paraswap.io", | |
"partnerFee": 0, | |
"side": "SELL", | |
"srcAmount": "10000000000000000", | |
"srcDecimals": 18, | |
"srcToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"srcUSD": "30.7085000000", | |
"tokenTransferProxy": "0x216b4b4ba9f3e719726886d34a177484278bfcae" | |
}, | |
"srcAmount": "10000000000000000", | |
"srcDecimals": 18, | |
"srcToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", | |
"userAddress": "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8" | |
} | |
} | |
}, | |
"requestBodies": { | |
"TransactionsRequestBody": { | |
"content": { | |
"application/json": { | |
"examples": { | |
"body": { | |
"$ref": "#/x-components/examples/TransactionsRequestBodyExample" | |
} | |
}, | |
"schema": { | |
"$ref": "#/definitions/TransactionsRequestPayload" | |
} | |
} | |
}, | |
"description": "Checkout `schemas/TransactionsRequestPayload` to infer what parameters are required to be parsed in the responseBody. (<b>Note</b>: The priceRoute object should be directly parsed without any change.)", | |
"required": true | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment