Quote API
We highly recommand using Mayan SDK for integration as it simplfies the process for you.
Before performing a swap we need find the best route and get the swap rate for the token pair using quote API.
API Reference
Example:
The request to get the quote for swapping BNB tokens from Binance Smart Chain (BSC) to receive USDC tokens on Solana would be like this:
Request:
List of request parameters:
Parameter | Type | Required | Description |
---|---|---|---|
solanaProgram | String | Yes | address of corresponding Solana program |
amountIn | Number | Yes | Human readable amount of input token (e.g for 100 USDC it should be 100) |
fromToken | String | Yes | Token address of input token |
fromChain | String | Yes | Wormhole chain id of source network |
toToken | String | Yes | Token address of output Token |
toChain | String | Yes | Wormhole chain id of destination network |
slippageBps | Number | Yes | The slippage % in BPS. If the output token amount exceeds the slippage the swap will refund |
referrer | String | No | Referrer address that receives the referrer fee |
gasDrop | Number | No | Default is 0. the amount of gas drop that must be delivered to user on delivered on destination network |
Response:
Response fields:
The following table shows the common fields of response:
Field | Type | Description |
---|---|---|
type | String | Determines the bridge method which can be "WH", "SWIFT" or "MCTP" |
effectiveAmountIn | Number | The actual input amount that will be dedcuted from user's wallet |
expectedAmountOut | Number | Expected output amount that user receives |
minAmountOut | Number | Minimum output amount of auction |
minReceived | Number | The minimum amount that user receives after deducting relayer fees |
price | Number | The amount of output token that user receives per 1 unit of input token |
solanaRelayerFee | Number | For "WH" type this fee is denominated in input token. For "MCTP" type the fee is denominated in USDC. For "SWIFT" type the fee is zero. |
redeemRelayerFee | Number | For "WH" type this fee is denominated in output token. For "MCTP" type the fee is denominated in USDC. For "SWIFT" type the fee is zero. |
RefundRelayerFee | Number | For "WH" and "SWIFT" types this fee is denominated in input token. For "MCTP" type the fee is denominated in USDC. |
clientRelayerFeeSuccess | Number | Total dollar value of relayer fees in the success scenario |
clientRelayerFeeRefund | Number | Total dolalr value of relayer fee in the refund scenario |
eta | Number | estimated time of arrival in minutes |
client eta | String | human readable string of eta |
fromToken | Object | Input token details |
fromChain | String | Source network name |
toToken | Object | Output token details |
toChain | String | Destination network name |
Token List
You can get list of supported tokens using Token API:
Example:
To get the aggregated list of tokens from all chains remove chain
from in the query .
Chain List
To get the list of supported chains you can use Chain API:
Example:
Last updated