Links
🏗️

Rango API Reference

The ultimate way for cross-chain swaps and relaying messages

Introduction

Rango API enables you to get the best cross-chain route for converting a token on the source blockchain to another token in the destination blockchain. It also enables dApps to relay an arbitrary message to the destination blockchain without any difficulties.
We have currently two versions of APIs / SDKs which are maintained and actively under development. Here is a brief comparison between them:
Feature
Basic API (Single-step TX)
Main API (Multi-step TXs)
Support all the blockchains
Relaying arbitray message
call your contract on destination chain
Pros. & Cons.
  • Only one TX needed
  • No gas required on the destination
  • Better UX
  • Easier to integrate
  • Multiple TXs are needed to be signed
  • May need the gas on the destination or middle networks
Price
  • Optimal price for 95% scenarios
  • Sub-optimal price for 5% scenarios
  • Covers 85% of routes
  • Best rates for all paths
Referral
SDK NPM Package
rango-sdk
Github Link
To summarize, if you are only interested in single-step TXs or you want to use our message relaying features, you need to use Basic SDK. Otherwise, if you want the best rates for the price and like multi-steps routes, SDK v1 is suitable for you.
For almost all the scenarios, we recommend you to use Basic API except if you have a special requirement.

1. Basic API (Single-Step TX)

If you are only interested in one-step (single-tx) routes (one action by user), this is what you need.
Besides basic single step routes for the different blockchains (EVM, TRON, Solana, Cosmos, ...), it also supports aggregated cross-chain swaps for EVM blockchains in which users could perform a multistep route (dex-bridge-dex) in a single transaction.
It's a popular use case in the multi-chain areas to perform a cross-chain swap. By cross-chain swap, we mean: [dex swap on source chain] + bridge + [dex swap on destination chain]
You can also relay your own custom message from the source chain to the destination and call your contract in the destination chain in case of success or error. So you can build a fully cross-chain dApp on top of Rango.

2. Main API (Multi-Step TXs)

If you like multi-steps routes which you might already see in the Rango dApp, this version of API/SDK is suitable for you.
Sample multistep route by Rango
As you see in the picture above, Rango API gives a 5 steps route to the user for swapping ETH.StarkNet to SOL.Solana and the user needs to sign at least one transaction for each step to complete this route. Users also need to have enough network fees on all middle chains. (If the route goes through some middle blockchains other than the source and the destination blockchains.)