Skip to main content

Prerequisites

Ensure you have the following:
  • An Aarc API key from the developer dashboard
  • Basic understanding of blockchain transactions and web3 development

Setup

  1. Create a new project directory and initialize it:
  1. Install required dependencies:
  1. Create a .env file with your Aarc API key:
  1. Create an index.js file for your implementation:

Implementation Steps

1

Setup Environment

First, set up your development environment with the necessary configurations:
2

Get Quote and Deposit Address

Before initiating a swap, you’ll need to get a quote and deposit address:
The response includes:
  • requestId: Unique identifier for this swap
  • depositAddress: Where to send funds
  • amount: How much to send (in fromToken decimals)
  • depositTokenDetails: Symbol, decimals, etc.
  • executionTime: Estimated time
  • gasFee: Estimated gas cost
The deposit address generated will be active only for 30 minutes.
3

Handle User Deposit

After getting the deposit details, the user can send funds through various methods:
  • EOA (External Owned Account) wallet
  • Centralized Exchange withdrawal
  • Smart Contract wallet
  • Embedded wallet
  • Any other valid source
Users must send atleast the amount specified in the deposit instructions. Sending less than the required amount will result in a failed transaction.
4

Monitor Transaction Status

After the user has initiated their deposit, implement status polling to track the progress:

Error Handling

Implement proper error handling for various scenarios:

Troubleshooting

Common issues and solutions:
  • Transaction Stuck: Check gas price and limits
  • Invalid Route: Verify token pair is supported
  • High Slippage: Adjust amount or try different route
  • Failed Status: Check transaction details on block explorer
For additional support or questions, refer to our support documentation.