What is @axelar-network/axelar-gmp-sdk-solidity?
The @axelar-network/axelar-gmp-sdk-solidity package is a software development kit designed to facilitate cross-chain communication and interoperability using the Axelar Network. It provides tools and functionalities for developers to build decentralized applications that can interact across different blockchain networks seamlessly.
What are @axelar-network/axelar-gmp-sdk-solidity's main functionalities?
Cross-Chain Message Passing
This feature allows developers to send messages between different blockchain networks. The code sample demonstrates how to use the AxelarGMPClient to send a message from Ethereum to Binance Smart Chain.
const { AxelarGMPClient } = require('@axelar-network/axelar-gmp-sdk-solidity');
async function sendMessage() {
const client = new AxelarGMPClient();
const tx = await client.sendMessage({
fromChain: 'Ethereum',
toChain: 'BinanceSmartChain',
payload: 'Hello, cross-chain world!'
});
console.log('Transaction:', tx);
}
sendMessage();
Token Transfer
This feature enables the transfer of tokens across different blockchain networks. The code sample shows how to transfer USDC tokens from Ethereum to Polygon using the AxelarGMPClient.
const { AxelarGMPClient } = require('@axelar-network/axelar-gmp-sdk-solidity');
async function transferToken() {
const client = new AxelarGMPClient();
const tx = await client.transferToken({
fromChain: 'Ethereum',
toChain: 'Polygon',
token: 'USDC',
amount: '100'
});
console.log('Token Transfer Transaction:', tx);
}
transferToken();
Other packages similar to @axelar-network/axelar-gmp-sdk-solidity
wormhole-sdk
The wormhole-sdk is a cross-chain interoperability protocol that allows for the transfer of assets and data across different blockchain networks. It is similar to @axelar-network/axelar-gmp-sdk-solidity in that it facilitates cross-chain communication, but it focuses more on providing a decentralized bridge for token transfers and data messaging.
connext
Connext is a protocol for fast, low-cost, and trust-minimized cross-chain communication. It provides similar functionalities to @axelar-network/axelar-gmp-sdk-solidity by enabling developers to build applications that can interact across multiple blockchains. Connext emphasizes speed and cost-efficiency in its cross-chain transactions.
Axelar GMP SDK Solidity
This repository contains all the necessary ingredients for successful cross-chain development
utilizing the Axelar General Message Passing protocol.
Documentation
Build
We recommend using the latest Node.js LTS version.
npm ci
npm run build
npm run test
Pre-compiled bytecodes can be found under Releases.
Furthermore, pre-compiled bytecodes and ABI are shipped in the npm package and can be imported via:
npm install @axelar-network/axelar-gmp-sdk-solidity
const IAxelarExecutable = require('@axelar-network/axelar-gmp-sdk-solidity/interfaces/IAxelarExecutable.json');
const Upgradable = require('@axelar-network/axelar-cgp-solidity/artifacts/contracts/upgradable/Upgradable.sol/Upgradable.json');
Unit tests can also be run against live networks for integration testing, see here.
Development
Check gas usage
REPORT_GAS=true npm run test
Check storage layout of contracts.
STORAGE_LAYOUT=true npm run check
Check contract bytecode size
CHECK_CONTRACT_SIZE=true npm run build
Available contracts
AxelarExecutable
Base interface for validating and executing GMP contract calls.
AxelarExpressExecutable
Interface that allows expediting GMP calls by lending assets and performing execution
before it fully propagates through the Axelar network.
Create2Deployer and Create3Deployer
These contracts are used to deploy your Executable to have the same address on different EVM chains.
This simplifies message validation from peer Executables. You can learn more in the
documentation.
Proxy and Upgradable
Base implementation of upgradable contracts designed to be deployed with Create3Deployer
and to have the same Proxy address on different EVM chains.
AddressString
Allows conversion between string
and address
data types
AddressBytes
Allows conversion between bytes
and address
data types
Bytes32String
Allows conversion between string
and bytes32
data types
for storing strings under 31 bytes into a single storage slot