Skip to main content
Swap via deposit does not require a wallet connection. User should make a deposit by himself.

Retrieving Token Quotes

Now that the wallet is connected, we can request token quotes from Rubic API. Endpoint: POST https://api-v2.rubic.exchange/api/routes/quoteBest
You can get more information about quote endpoint here: Request Quote

Retrieving Data to Execute a Transaction

To perform a token swap through Rubic API, we need to get the necessary data for the transaction. Endpoint: POST https://api-v2.rubic.exchange/api/routes/swap
You can get more information about swap endpoint here: Request Data

Executing a Transaction with the API Response Data

You should display the depositAddress, amountToSend, exchangeId and extraFields fields from the transaction object in your UI. The user should send amount to the received depositAddress from his wallet by himself.
User should pass the extraFields.value field otherwise the transaction may fail.