Swap params
CAUTION
The public Swap API api.vulpefi.com is deprecated. To continue using the Swap API please migrate to the VULPEFI Developer Portal
Generate data for calling the VulpeFI router for exchange: /api/swap
/api/swap
Description of query parameters
src *
string
contract address of a token to sell
e.g.: 0x...xxx example
dst *
string
contract address of a token to buy
e.g.: 0x...xxx example
amount *
integer
amount of a token to sell, set in minimal divisible units
e.g.:
1.00 DAI
set as 1000000000000000000
51.03 USDC
set as 51030000
from *
string
address of a seller, make sure that this address has approved to spend src in needed amount
e.g.: 0x...xxx example
slippage *
number
limit of price slippage you are willing to accept in percentage, may be set with decimals. &slippage=0.5 means 0.5% slippage is acceptable. Low values increase chances that transaction will fail, high values increase chances of front running. Set values in the range from 0 to 50
protocols
string
specify liquidity protocols. If not set, all liquidity protocols will be used; you can disable any protocol by listing all protocols except those you don't need
e.g.: &protocols=
default: all protocols can be used
receiver
string
recipient address of a purchased token if not set, from will receive a purchased token
includeTokensInfo
boolean
if set to true
, response will include from token and to token info
default: false
includeProtocols
boolean
if set to true
, response will include protocols used in the quote
default: false
referrer
string
referrer's address
fee
number
this percentage of src token amount will be sent to referrer, the rest will be used as input for a swap
min: 0;
max: 3;
default: 0
example to set a fee to 1.5%: &fee=1.5
gasPrice
string
VulpeFI takes in account gas expenses to determine exchange route. It is important to use the same gas price on the quote and swap methods.
Gas price set in wei: 12.5 GWEI
set as 12500000000
default: "fast" from network
permit
string
https://eips.ethereum.org/EIPS/eip-2612
compatibility
boolean
If true, the swap
function will always be used. This helps when the token being traded has a tax or fee on trade or transfer default: false
complexityLevel
string
maximum number of token-connectors to be used in a transaction. The more is used — the longer route estimation will take, the more complex route might be as a result. If not set, two token-connectors may be used
min: 0;
max: 3;
default: 2
connectorTokens
string
token-connectors can be specified via this parameter. The more is set — the longer route estimation will take. If not set, default token-connectors will be used. If a token you want to exchange doesn't have a pool with one of the default token-connectors this parameter will help find the route; should be the same for a quote and swap max: 5;
e.g.: &connectorTokens=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, 0x...xxx example
default: list of default token-connectors
allowPartialFill
boolean
if true, the algorithm can cancel part of the route, if the rate has become less attractive. Unswapped tokens will return to the from
default: true
disableEstimate
boolean
if true, disable most of the checks
default: false
gasLimit
integer
maximum amount of gas for a swap;
should be the same for a quote and swap
default: 11500000;
max: 11500000
mainRouteParts
integer
limit maximum number of main route parts;
should be the same for a quote and swap
default: 20;
max: 50
parts
integer
limit maximum number of parts each main route parts can be split into; should be the same for a quote and swap
default: 20;
max: 100
Description of response parameters
By default only toAmount and the tx object are returned
fromToken
string
parameters of a token to sell
toToken
string
parameters of a token to buy
fromAmount
string
input amount of fromToken
in minimal divisible units
toAmount
string
result amount of toToken
in minimal divisible units
protocols
string
route of the trade
from
string
transactions will be sent from this address
to
string
transactions will be sent to our contract address
data
string
bytes of call data
value
string
amount of ETH (in wei) will be sent to the contract address
gasPrice
string
gas price in wei
gas
string
estimated amount of the gas limit, increase this value by 25%
Last updated