axelarnetwork / support

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

Unable to use sendToken to transfer tokens in devnet environment #104

Closed Adw8 closed 5 months ago

Adw8 commented 7 months ago

Hello, I am trying to use the sendToken method from Axelarjs-sdk to send aUSDC tokens between chains. The code for doing this in a testnet environment is available on the docs. I have changed the environment from Environment.TESTNET to Environment.DEVNET, and I am trying to do a token transfer from Avalanche Fuji to Ethereum-Sepolia. I am running into the following error.

Steps to reproduce

const { ethers } = require("ethers");

const { getEvmSigner } = require("./utils");

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

// add values const DESTINATION_ADDRESS = ""; const TOKEN = "aUSDC"; const AMOUNT = "100000"; const PRIVATE_KEY = "";

const test = async () => { const provider = new ethers.providers.JsonRpcProvider("https://avalanche-fuji-c-chain-rpc.publicnode.com/"); const evmSigner = getEvmSigner(PRIVATE_KEY).connect(provider); const requestOptions = { fromChain: CHAINS.TESTNET.AVALANCHE, toChain: CHAINS.TESTNET.SEPOLIA, destinationAddress: DESTINATION_ADDRESS, asset: { symbol: TOKEN }, amountInAtomicUnits: AMOUNT, options: { evmOptions: { signer: evmSigner, provider, approveSendForMe: true, }, }, }; console.log("Sending tokens..."); console.log("address is", await evmSigner.getAddress()); // console.log("balance is", await evmSigner.getBalance()); return api.sendToken(requestOptions); };

test().then((transaction) => { console.log(transaction); });


Error:

adwait@vivobook-m1603qa:~/projects/ds-repos/axelar-dev/src$ node devnet-transfer.js

Sending tokens...

/home/adwait/projects/ds-repos/axelar-dev/node_modules/@axelar-network/axelarjs-sdk/dist/src/utils/validateChain.js:46 throw new Error(Invalid chain identifier for ${chains[i]}. Did you mean ${validations[i].bestMatch}?); ^

Error: Invalid chain identifier for ethereum-sepolia. Did you mean ethereum? at /home/adwait/projects/ds-repos/axelar-dev/node_modules/@axelar-network/axelarjs-sdk/dist/src/utils/validateChain.js:46:23 at Generator.next () at fulfilled (/home/adwait/projects/ds-repos/axelar-dev/node_modules/@axelar-network/axelarjs-sdk/dist/src/utils/validateChain.js:5:58) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.20.1


From the [devnet-chain-config.json](https://axelar-testnet.s3.us-east-2.amazonaws.com/devnet-chain-config.json) map, It seems that the correct chain name is `ethereum`, not `ethereum-sepolia`. So, making the following change in the code: 

toChain: CHAINS.MAINNET.ETHEREUM,

yields the following error

/home/adwait/projects/ds-repos/axelar-dev/node_modules/@axelar-network/axelarjs-sdk/dist/src/libs/AxelarAssetTransfer.js:153 throw new Error("cannot find chain" + fromChain); ^

Error: cannot find chainAvalanche at AxelarAssetTransfer. (/home/adwait/projects/ds-repos/axelar-dev/node_modules/@axelar-network/axelarjs-sdk/dist/src/libs/AxelarAssetTransfer.js:153:23) at Generator.next () at fulfilled (/home/adwait/projects/ds-repos/axelar-dev/node_modules/@axelar-network/axelarjs-sdk/dist/src/libs/AxelarAssetTransfer.js:5:58) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)



Would appreciate if there are any inputs/suggestions, thanks!
Olanetsoft commented 6 months ago

Hey @Adw8, Apologies for the delay here. I saw your Discord messages and realized they differ from this question. I have flagged this internally with the team to confirm if the recent updates to Testnet is yet to be made for Devnet.

I'm curious why you wanted to use DEVNET, not Testnet or Axelar local development, with the Axelar Example repository we created for developers to test multichain development.

I would love to hear your thoughts.

Olanetsoft commented 6 months ago

Friendly bump here ^ @Adw8