This guide explains how to integrate the Wormhole Mayan Swift Route from the Wormhole SDK into your application. This Route abstracts the complexity of cross-chain token swaps, handling route discovery, fee estimation, and transaction construction.
Important
Mayan Swap only works on mainnet. Testing on testnet environments will fail.
Ensure you have the following installed:
- Node.js and npm installed on your machine
- A wallet with a private key, funded with native tokens on mainnet for gas fees
Follow these steps to clone the repository, set up environment variables, and perform token transfers.
1. Clone the Repository
git clone https://github.com/wormhole-foundation/demo-mayanswift.git
cd demo-mayanswift
2. Install Dependencies
npm install
3. Set Up Environment Variables
Create a .env
file in the root directory and add your private keys:
ETH_PRIVATE_KEY="INSERT_PRIVATE_KEY"
SOL_PRIVATE_KEY="INSERT_PRIVATE_KEY"
- ETH_PRIVATE_KEY - private key for an Ethereum-compatible wallet
- SOL_PRIVATE_KEY - private key for a Solana wallet
To initiate a token transfer across chains, using the Mayan Swift Route run:
npm run swap
You can customize the following options within the scripts:
- Source and Destination Chains - modify
sendChain
anddestChain
inswap.ts
- Amount and Transfer Settings - adjust
amount
to suit your needs
- Missing environment variables - ensure
.env
is correctly set up and keys are valid - Unsupported platform error - verify that the chains are compatible and supported by the Wormhole SDK