From EVM to Secret

Learn how to send testnet USDC from EVM to Secret Network using Axelar

Installing the dependencies

Create a new package.json file and install axelarjs

npm init -y && npm i @axelar-network/axelarjs-sdk

Add type "module" to package.json:

{
  "name": "evm-to-secret",
  "type" : "module",
  "version": "1.0.0",
  "main": "evm-to-secret.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    "@axelar-network/axelarjs-sdk": "^0.16.1"
  }
}

Creating the deposit address

Create a new file named evm-to-secret.js (or whatever you would like to name it) and add the following code to create an Axelar deposit address:

import {
    AxelarAssetTransfer,
    CHAINS,
    Environment,
  } from "@axelar-network/axelarjs-sdk";
  
  const sdk = new AxelarAssetTransfer({ environment: "testnet" });
  
  async function createDepositAddress() {
    const fromChain = CHAINS.TESTNET.SEPOLIA,
      toChain = "secret-snip-3",
      destinationAddress = "secret1j7n3xx4sfgjea4unghd78qvnvxdz49cxmrkqlj",
      asset = "uausdc";
  
    const depositAddress = await sdk.getDepositAddress({
      fromChain,
      toChain,
      destinationAddress,
      asset,
    });
    console.log(depositAddress);
  }
  
  createDepositAddress();

Make sure you have the correct asset for testnet. You can either send USDC or AXL cross-chain . Also make sure to update destinationAddress with your Secret testnet wallet address πŸ€—

Run node evm-to-secret to execute createDepositAddress:

node evm-to-secret

A deposit address will be returned in your terminal:

0x1f92fEb04737dd2aE59841a1C3806797086143Da

Sending USDC from EVM to Secret Network

Add the Sepolia USDC token to your wallet. Sepolia USDC token contract address:

0x254d06f33bDc5b8ee05b2ea472107E300226659A

See all USDC token addresses in the Axelar docs.

Fund your wallet with testnet Sepolia USDC by bridging AXL to sepolia USDC.

First, go to the Axelar discord faucet channel and request testnet tokes from the faucet:

!faucet <your wallet address here>

Then, send testnet USDC from your Axelar wallet address to your Sepolia address using Axelar Satelite:

Now, simply send Sepolia USDC from your wallet to the deposit address that you created earlier!

You can track your token transfer's status on Axelarscan

Summary

Congrats! You've successfully sent cross-chain USDC from Sepolia testnet to Secret Network using Axelarjs! If you have any questions, ping dev-issues on Discord and a developer from the Secret community will assist you shortly.

Last updated