const ethers = require('ethers');
const axios = require('axios');
const API_URL = 'https://li.quest/v1';
// Get a quote for your desired transfer
const getQuote = async (fromChain, toChain, fromToken, toToken, fromAmount, fromAddress) => {
const result = await axios.get(`${API_URL}/quote`, {
// Check the status of your transfer
const getStatus = async (bridge, fromChain, toChain, txHash) => {
const result = await axios.get(`${API_URL}/status`, {
const fromToken = 'USDC';
const fromAmount = '1000000';
const fromAddress = YOUR_WALLET_ADDRESS;
const provider = new ethers.providers.JsonRpcProvider('https://rpc.xdaichain.com/', 100);
const wallet = ethers.Wallet.fromMnemonic(YOUR_PERSONAL_MNEMONIC).connect(
const run = async () => {
const quote = await getQuote(fromChain, toChain, fromToken, toToken, fromAmount, fromAddress);
const tx = await wallet.sendTransaction(quote.transactionRequest);
// Only needed for cross chain transfers
if (fromChain !== toChain) {
result = await getStatus(quote.tool, fromChain, toChain, tx.hash);
} while (result.status !== 'DONE' && result.status !== 'FAILED')