Buy Basenji on Base
A step-by-step guide to buy basenji on base using cross-chain swaps.
Prerequisites
Ensure you have the following:
- An Aarc API key from the developer dashboard
- Basic understanding of blockchain transactions and web3 development
Setup
- Create a new project directory and initialize it:
- Install required dependencies:
- Create a
.env
file with your Aarc API key:
- Create an
index.js
file for your implementation:
Implementation Steps
Setup Environment
First, set up your development environment with the necessary configurations:
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 swapdepositAddress
: Where to send fundsamount
: How much to send (in fromToken decimals)depositTokenDetails
: Symbol, decimals, etc.executionTime
: Estimated timegasFee
: Estimated gas cost
The deposit address generated will be active only for 30 minutes.
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.
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.