Quote API
Before performing a swap we need find the best route and get the swap rate for the token pair using quote API.
The request to get the quote for swapping BNB tokens from Binance Smart Chain (BSC) to receive USDC tokens on Solana you can use would be like this:
curl 'https://price-api.mayan.finance/quote?amountIn=5&fromToken=0x0000000000000000000000000000000000000000&fromChain=bsc&toToken=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&toChain=solana&slippage=0.05'
{
"effectiveAmountIn":4.99957634,
"expectedAmountOut":1478.182,
"price":295.6,
"priceImpact":0,
"minAmountOut":1404.2729,
"route":[
{
"protocol":"Serum",
"fromToken":"9gP2kCy3wA1ctvYWQk75guqXuHfrEomqydHLtcTCqiLa",
"fromSymbol":"WBNB",
"toToken":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"toSymbol":"USDC",
"address":"4UPUurKveNEJgBqJzqHPyi8DhedvpYsMXi7d43CjAg2f"
}
],
"swapRelayerFee":0.00057634,
"redeemRelayerFee":0,
"refundRelayerFee":0.00115
}
You can get list of supported tokens using this api:
curl -X 'GET' \
'https://price-api.mayan.finance/v1/tokens?chain=solana' \
-H 'accept: application/json'
To get the aggregated list of tokens from all chains you remove
chain
from in the query .Last modified 10d ago