Skip to main content

Quote Best

Using the quote method, you can get a preview of the best route for this cross-chain swap. It goes through all the possible DEXs, bridges and aggregators to find the best possible single-step route based on user experience, fee amount, and swap output. You can check available request params here. Here is an example of quoting swap 1.05 ETH in Ethereum Blockchain for Matic in Polygon Blockchain
const response = await axios.post('https://api-v2.rubic.exchange/api/routes/quoteBest', {
</strong>  params: {
    "dstTokenAddress": "0x0000000000000000000000000000000000000000",
    "dstTokenBlockchain": "POLYGON",
    "referrer": "rubic.exchange",
    "srcTokenAddress": "0x0000000000000000000000000000000000000000",
    "srcTokenAmount": "1.05",
    "srcTokenBlockchain": "ETH"
  }
});
Open Rubic Swagger

Quote All

Using the quote method, you can get a preview of all possible routes for this cross-chain swap. It goes through all the possible DEXs, bridges and aggregators to find and provide all single-step routes based on user experience, fee amount, and swap output. You can check available request params here. Here is an example of quoting swap 1.05 ETH in Ethereum Blockchain for Matic in Polygon Blockchain
const response = await axios.post('https://api-v2.rubic.exchange/api/routes/quoteAll', {
</strong>  params: {
    "dstTokenAddress": "0x0000000000000000000000000000000000000000",
    "dstTokenBlockchain": "POLYGON",
    "referrer": "rubic.exchange",
    "srcTokenAddress": "0x0000000000000000000000000000000000000000",
    "srcTokenAmount": "1.05",
    "srcTokenBlockchain": "ETH"
  }
});
Open Rubic Swagger

Quote request params

Required params

FieldTypeDescriptionExample
srcTokenAddress*stringSource token address0x0000000000000000000000000000000000000000
srcTokenBlockchain*stringSource token blockchainETH
srcTokenAmount*stringSource token amount with decimals1.05
dstTokenAddress*stringDestination token address0x0000000000000000000000000000000000000000
dstTokenBlockchain*stringDestination token blockchainPolygon
referrer*stringReferrer addressrubic.exchange

Optional fields

FieldTypeDescriptionExample
nativeBlackliststring[]Native providers to exclude from calculation[“xy”, “symbiosis”]
showFailedRoutesbooleanShow failed routes in response or notfalse
integratorAddressstringIntegrator address to set feesGet the address from our BD team
slippagenumber minimum: 0.01 maximum: 0.5Slippage tolerance in percents for trade, 0.01 equals 1%0.02
receiverstringWallet address to send tokens to on the destination blockchain0x0000000000000000000000000000000000000000
preferredProviderstringPreferred provider for calculationlifi
foreignBlacklist{lifi?: string[]; rango?: string[];}Foreign providers to exclude from calculation{ lifi: ["stargate"] }
timeoutnumber minimum: 5 maximum: 60Calculation timeout in seconds32
enableTestnetsbooleanInclude testnet in calculationsfalse
fromAddressstringWallet address to send funds from0x0000000000000000000000000000000000000000
showDangerousRoutesbooleanShow routes with priceImpact > 20% and < -5% and with slippage > 20%.false
skipFeeProvidersbooleanSkip providers with fee in route(show only routes where fees.gasTokenFees.provider.fixedAmount = 0)false

Quote response params

FieldTypeDescriptionExample
idstringTrade identifier60e513d5-8a2d-4e0d-b513-6236d86bc7da
quoteQuoteRequestDtoQuote params that you send
swapType’cross-chain’ | ‘on-chain’Type of swapcross-chain
providerTypeCrossChainTradeType | OnChainTradeTypeInner provider which we use to swapRango
feesFeesDtoDifferent fees used for swap
routingRoutingDto[]The path tokens take during the swap process
transactionTransactionDtoTransaction config to perform approve{approvalAddress: string }
warningsErrorDtoSpecific info about quote params provider[ { code: 301,reason: amountTooLow, data: minAmount: 0.1 eth } }]