Interchain Unit Tests with Axelar Local Dev

Interchain Unit Tests with Axelar Local Dev

Testing your application is critical before going to production, especially in Web3. Axelar Local Dev allows you to simulate interchain transactions on the Axelar Gateway right on your local machine. This provides a Ganache-like testing experience before officially migrating to testnet.

The following examples are configured for Hardhat based the axelar-examples repo. Feel free to replicate some of these tests in your own interchain applications.

Run the tests

Axelar Local Dev contains tests for the Call Contract, Call Contract With Token, and NFT Linker examples. Make sure you are in the evm directory before running the npx hardhat test command for each example you want to test.

For example, to run the NFT Linker example:

npx hardhat test nft-linker/tests/NftLinker.test.js

Testing interchain contracts

There are a few things to keep in mind when testing contracts with cross-chain functionality:

  • Make sure that you have a local network running for each chain. You can create a new local network with the createNetwork command on Axelar Local Dev.

  • Interchain transactions are triggered with the relay() function. The logic you are testing on the destination chain will not execute until the transaction is relayed.

What's next

Get support

If you have any questions or concerns, open an issue in our support repository. We're here to help.