Integration Guide
Overview
Prerequisites
Step 1: Get a Quote
const BASE_URL = 'https://swap.xoxno.com';
async function getQuote(params) {
const queryParams = new URLSearchParams({
from: params.tokenIn,
to: params.tokenOut,
amountIn: params.amountIn,
slippage: params.slippage || '0.01'
});
const response = await fetch(`${BASE_URL}/api/v1/quote?${queryParams}`);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error || 'Quote request failed');
}
return response.json();
}
// Example usage
const quote = await getQuote({
tokenIn: 'WEGLD-bd4d79',
tokenOut: 'USDC-c76f1f',
amountIn: '1000000000000000000', // 1 EGLD
slippage: 0.01 // 1%
});
console.log(`Expected output: ${quote.amountOutShort} USDC`);
console.log(`Minimum output: ${quote.amountOutMinShort} USDC`);Step 2: Build the Transaction
Step 3: Handle Token Transfers
Step 4: Sign and Submit
Complete Example
Error Handling
Best Practices
Quote Freshness
Gas Estimation
Slippage Protection
Next Steps
Last updated
Was this helpful?