axelarnetwork / support

Your source for support with the Axelar Network
3 stars 1 forks source link

Can't get the sendToken in axelarjs working #112

Closed utkarshdagoat closed 2 months ago

utkarshdagoat commented 2 months ago
import { AxelarAssetTransfer, CHAINS, Environment, SendTokenParams } from "@axelar-network/axelarjs-sdk";
import { ethers, Wallet } from "ethers";

const api = new AxelarAssetTransfer({ environment: Environment.TESTNET });

const getSigner = () => {
  const privateKey = PRIVATE_KEY;
  return new Wallet(privateKey);
};

async function test() {
  const provider = new ethers.providers.JsonRpcProvider(
    "https://api.avax-test.network/ext/bc/C/rpc"
  );
  const signer = getSigner().connect(provider);
  const requestOptions: SendTokenParams = {
    fromChain: CHAINS.TESTNET.BASE_SEPOLIA,
    toChain: CHAINS.TESTNET.OSMOSIS,
    destinationAddress: "osmo1x3z2vepjd7fhe30epncxjrk0lehq7xdqe8ltsn",
    asset: { symbol: "aUSDC" },
    amountInAtomicUnits: "5000000",
    options: {
      evmOptions: {
        signer,
        provider,
        txOptions: null as any,
        approveSendForMe: true,
      },
    },
  };
  return api.sendToken(requestOptions);
}

Using this always give the following error image Even if I put in the gasfees parameters I always get insufficent funds while my wallet is topped with both sepolia ETH (around 1) and aUSDC(around 5)