💱Quotes (Beta)
Overview
This is not a tested version of the routing, so do not use it in production.
This API allows fetching quotes for token swaps and provides transaction data (calldata
) for execution if the parameters slippageTolerance
, deadline
, and recipient
are specified. This enables direct interaction with smart contracts.
This API is an aggregator of various providers and selects the best ones.
Currently, the following external providers are supported:
Kodiak
Endpoint
URL:
https://staging.backend.kodiak.finance/quote
Method:
GET
Content Type:
application/json
Query Parameters
tokenInAddress
✅
Address of the input token for the swap. For native token = BERA
tokenInChainId
✅
Chain ID of the input token.
tokenOutAddress
✅
Address of the output token for the swap. For native token = BERA
tokenOutChainId
✅
Chain ID of the output token.
amount
✅
Amount of tokens to swap in humman terms
type
✅
Type of swap: exactIn
(fixed input amount) or exactOut
(fixed output amount). exactOut
is not supported by most providers, so this is not a recommended method and may show you poor quotes
refCode
❌
Your referral code (received from the Kodiak team)
referrerFeeBps
❌
Your share of fees, the Kodiak team is able to set a maximum threshold. Example: 100 = 1%
recipient
❌
The address of the recipient of the swapped tokens. Required for generating calldata
.
deadline
❌
Time in seconds until the transaction expires.
slippageTolerance
❌
Allowed slippage percentage as an integer (e.g., 1 for 1%).
providers
❌
Case insensitive list of providers separated by commas.
Available options: Kodiak
, OpenOcean
,Magpie
,OogaBooga
,Haiku
For example: kodiak,openocean,oogabooga
Example Request
GET https://staging.backend.kodiak.finance/quote?protocols=v2%2Cv3%2Cmixed&tokenInAddress=BERA&tokenInChainId=80094&tokenOutAddress=0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce&tokenOutChainId=80094&amount=100000000000000000000&type=exactIn&recipient=0x5a1e747482F8773fe52Cca9951E956F456EFd0Bf&deadline=1800&slippageTolerance=1
Example response
{
"methodParameters": {
"calldata": "0x5ae401dc00000000000000000000000000000000000000000000000000000000685a699e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000e45023b4df0000000000000000000000006969696969696969696969696969696969696969000000000000000000000000fcbd14dc51f0a4d49d5e53c2e0950e0bc26d0dce0000000000000000000000000000000000000000000000000000000000000bb800000000000000000000000058b1ff435500d2db580019108daa6d2aad0573650000000000000000000000000000000000000000000000056bc75e2d631000000000000000000000000000000000000000000000000000031fc86d27d1a261e7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000412210e8a00000000000000000000000000000000000000000000000000000000",
"value": "0x031fc86d27d1a261e7",
"to": "0xe301E48F77963D3F7DbD2a4796962Bd7f3867Fb4"
},
"blockNumber": "6814434",
"amount": "100000000000000000000",
"amountDecimals": "100",
"quote": "57059834306371073497",
"quoteDecimals": "57.059834306371073497",
"quoteGasAdjusted": "57059834306403391497",
"quoteGasAdjustedDecimals": "57.059834306403391497",
"gasUseEstimateQuote": "32318000",
"gasUseEstimateQuoteDecimals": "0.000000000032318",
"gasUseEstimate": "113000",
"gasUseEstimateUSD": "0.000000000056810046",
"gasPriceWei": "286",
"provider": "Kodiak",
"params": {
"tokenInAddress": "BERA",
"tokenInChainId": 80094,
"tokenOutAddress": "0xFCBD14DC51f0A4d49d5E53C2E0950e0bC26d0Dce",
"tokenOutChainId": 80094,
"amount": "100000000000000000000",
"type": "exactOut",
"slippageTolerance": 1,
"recipient": "0x5a1e747482F8773fe52Cca9951E956F456EFd0Bf",
"deadline": 1800
}
}
cast send 0x496e305C03909ae382974cAcA4c580E1BF32afBE "0x5ae401dc0000000000000000000000000000000000000000000000000000000067479f3a00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e404e45aaf0000000000000000000000007507c1dc16935b82698e4c63f2746a2fcf994df80000000000000000000000001740f679325ef3686b2f574e392007a92e4bed410000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000a54e745bff14816ec6d323d894e7861b6ef3f2ae0000000000000000000000000000000000000000000008a72716c2895c8a4947000000000000000000000000000000000000000000005f726aca12c4ec97acd7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
Last updated