EVM Swaps
KyberSwap Aggregator EVM APIs
Last updated
Was this helpful?
KyberSwap Aggregator EVM APIs
Last updated
Was this helpful?
In order to continuously improve the KyberSwap Aggregator, our APIs implement a clientData
or source
field that enables us to understand how the APIs are being utilized. As a developer integrating with our APIs, please add your clientID (i.e. company name) to the clientData
/source
fields to enable us to serve you better.
[V1]GET
clientData={"source":"yourCompanyNameHere"}
[V2]POST
source="yourCompanyNameHere"
Retrieve the information about a Swap between 2 tokens with encoded data to submit to KyberSwap router contract
/{chain}/route/encode
Supported chains:
Address of the input token
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
in case of native token
Address of the output token
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
in case of native token
Amount of the input token (in wei)
false
/0
= route will be based on the maximum output token returned
true
/1
= route will be based on the lowest gas cost (i.e. the least hops)
This is the amount of slippage the user can accept for his trade. The unit is bip. The value is in ranges [0, 2000], 10 means 0.1%. Default value is 50/10000 ~ 0.5%.
if true, fee is taken in BPS
Indicates whether fee is charged by input token currency_in
or output token currency_out
Default is empty whereby no fee is charged
currency_in
, currency_out
Address to receive fee (if chargeFeeBy
is not empty)
Fee amount to be collected
if isInBps
= true
, feeAmount
is the percentage of fees that we will take with base unit = 10000, i.e feeAmount
= 10 and isInBps
= true
then fee = 0.1%
if isInBps
= false
, feeAmount
is the amount of token that we will take as fee, i.e feeAmount
= 10 and isInBps
= 'false' then fee = 10 token weis
Deadline (in Unix time second) for the transaction to be executed. Default will be +20 minute. Cannot be in the past.
1551036863
Address to receive the output token
Json string to present to your client (i.e. clientID)
{"source":"EnterYourClientIdHere"}
Version of Aggregator
Latest
Retrieve the route information about a Swap between 2 tokens. Please use V2 GET
API for a more performant route query. The route returned can then be combined with transaction specific params in the POST
API payload to get the encoded data for submission to the KyberSwap router contract.
/{chain}/api/v1/routes
Supported chains:
Address of the input token
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
in case of native token
Address of the output token
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
in case of native token
Amount of the input token (in wei)
false
/0
= route will be based on the maximum output token returned
true
/1
= route will be based on the lowest gas cost (i.e. the least hops)
DEX IDs included in the route, separated by comma
DEX IDs excluded from the route, separated by comma
Determines whether gas costs are included when searching for route
Estimated price of gas required for swap, in wei units
Fee amount to be collected
if isInBps
= true
, feeAmount
is the percentage of fees that we will take with base unit = 10000, i.e feeAmount
= 10 and isInBps
= true
then fee = 0.1%
if isInBps
= false
, feeAmount
is the amount of token that we will take as fee, i.e feeAmount
= 10 and isInBps
= 'false' then fee = 10 token weis
Indicates whether fee is charged by input token currency_in
or output token currency_out
Default is empty whereby no fee is charged
currency_in
, currency_out
if true, fee is taken in BPS
Address to receive fee (if chargeFeeBy
is not empty)
Get the encoded swap route to be forwarded to the KyberSwap router contract. For simplicity, the request body should contain the routeSummary
returned by [V2] Get Swap Route appended with the additional tx parameters.
/{chain}/api/v1/route/build
Supported chains:
The summarised routing data
Deadline (in Unix time second) for the transaction to be executed. Default will be +20 minute. Cannot be in the past.
This is the amount of slippage the user can accept for his trade. The unit is bip. The value is in ranges [0, 2000], 10 means 0.1%. Default value is 50/10000 ~ 0.5%.
Address which the swap input tokens will be debited from
Address which the swap output tokens will be sent to
String to present to your client (i.e. clientID)
Returns the encoded data without price impact checks. For advanced trades.