A powerful command-line interface for creating and publishing cross-chain intents on EVM, TVM (Tron), and SVM (Solana) blockchains. Built by Eco Protocol for seamless multi-chain interactions.
- π Multi-chain Support: Seamlessly publish intents across EVM, Tron (TVM), and Solana (SVM) chains
- πΈ Quote Integration: Real-time route quotes for optimal pricing and path finding
- π― Interactive Wizards: Intuitive step-by-step guides for intent creation and publishing
- π Secure Key Management: Environment-based private key storage with multi-format support
- π Rich CLI Experience: Beautiful tables, spinners, and colored output for better UX
- β‘ Smart Defaults: Automatic deadline calculation and intelligent configuration
- π Extensible Architecture: Easy integration of new chains and tokens
- π¦ Standalone Operation: Zero external service dependencies
- Node.js >= 18.0.0
- pnpm (recommended) or npm
- Private keys for the chains you want to use
git clone https://github.com/eco/routes-cli.git
cd routes-cli
pnpm install
pnpm buildpnpm link
# Now you can use 'eco-routes-cli' globally- Copy the example environment file:
cp .env.example .env- Add your private keys to
.env:
# Private keys for each chain type
EVM_PRIVATE_KEY=0x...
TVM_PRIVATE_KEY=...
SVM_PRIVATE_KEY=...
# Optional: Custom RPC endpoints
EVM_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/...
TVM_RPC_URL=https://api.trongrid.io
SVM_RPC_URL=https://api.mainnet-beta.solana.com
# Optional: Portal contract addresses
PORTAL_ADDRESS_ETH=0x...
PORTAL_ADDRESS_OPTIMISM=0x...
PORTAL_ADDRESS_TRON=T...
PORTAL_ADDRESS_SOLANA=...-
Set up your environment:
cp .env.example .env # Edit .env with your private keys -
Publish your first intent:
pnpm dev publish # Follow the interactive prompts -
View available chains:
pnpm dev chains
The simplest and most user-friendly way to publish intents:
pnpm dev publish-
π Chain Selection
- Select source chain (where rewards come from)
- Select destination chain (where route executes)
- Automatic quote fetching for optimal routing
-
π° Token Configuration
- Route Token: Choose destination chain token (native or ERC20/TRC20/SPL)
- Route Amount: Specify amount to transfer on destination
- Reward Token: Choose source chain token for prover reward
- Reward Amount: Specify reward amount for proof submission
-
βοΈ Automatic Configuration
- Creator address derived from your wallet
- Prover address from chain configuration
- Portal address from destination chain
- Smart deadline calculation:
- Route deadline: 2 hours from now
- Reward deadline: 3 hours from now
-
β Review & Confirm
- Display complete intent details
- Show estimated gas costs
- Confirm before blockchain submission
Specify chains via command line, configure tokens interactively:
# Mainnet examples
pnpm dev publish --source ethereum --destination optimism
pnpm dev publish --source tron --destination base
pnpm dev publish --source solana --destination ethereum
# Testnet examples
pnpm dev publish --source base-sepolia --destination optimism-sepolia
pnpm dev publish --source tron-shasta --destination base-sepolia| Option | Alias | Description | Example |
|---|---|---|---|
--source |
-s |
Source chain name or ID | ethereum, 1 |
--destination |
-d |
Destination chain name or ID | optimism, 10 |
--verbose |
-v |
Show detailed output |
pnpm dev chains
# Output: Formatted table with chain names, IDs, types, and native currenciespnpm dev tokens
# Output: Table showing token symbols, names, decimals, and chain availabilityAn intent consists of two main parts:
salt: Random 32-byte hex valuedeadline: Unix timestamp for route expirationportal: Portal contract address on destination chainnativeAmount: Native token amount to transfertokens: Array of token transferscalls: Array of contract calls to execute
deadline: Unix timestamp for reward claim deadlinecreator: Address that created the intentprover: Prover contract addressnativeAmount: Native token reward amounttokens: Array of token rewards
Edit src/config/tokens.ts:
export const TOKEN_CONFIGS: Record<string, TokenConfig> = {
// ... existing tokens
MYTOKEN: {
symbol: 'MTK',
name: 'My Token',
decimals: 18,
addresses: {
ethereum: AddressNormalizer.normalize('0x...', ChainType.EVM),
optimism: AddressNormalizer.normalize('0x...', ChainType.EVM),
},
},
};| Script | Description |
|---|---|
pnpm build |
Compile TypeScript to JavaScript |
pnpm dev <command> |
Run in development mode with ts-node |
pnpm start <command> |
Run compiled version |
pnpm clean |
Remove build artifacts |
routes-cli/
βββ src/
β βββ blockchain/ # Chain-specific implementations
β βββ builders/ # Intent builder patterns
β βββ commands/ # CLI command implementations
β βββ config/ # Chain and token configurations
β βββ core/ # Core types and utilities
β βββ scripts/ # Standalone scripts
β βββ utils/ # Helper utilities
βββ dist/ # Compiled output
βββ .env.example # Environment template
βββ package.json # Project dependencies
- UniversalAddress: Chain-agnostic 32-byte address representation enabling cross-chain compatibility
- PortalEncoder: Specialized encoder for intent data across different blockchain types
- AddressNormalizer: Bidirectional converter between chain-native and universal address formats
- IntentBuilder: Fluent builder pattern for constructing complex intents programmatically
- ChainTypeDetector: Automatic chain type detection from configuration
- Quote System: Integration with routing protocols for optimal path finding
- Chain Abstraction: Uniform interface across different blockchain types
- Type Safety: Full TypeScript support with strict typing
- Modularity: Pluggable architecture for easy extension
- User Experience: Interactive wizards with rich CLI feedback
| Chain Type | Format | Example |
|---|---|---|
| EVM | Hex with prefix | 0x1234... (64 hex chars) |
| Tron | Hex without prefix | 1234... (64 hex chars) |
| Solana | Base58 | 5Jd7F... |
| Byte array | [1,2,3,...] |
|
| Comma-separated | 1,2,3,... |
| Issue | Solution |
|---|---|
Invalid address format |
Check address matches chain type requirements |
Insufficient balance |
Ensure wallet has enough tokens and gas |
Chain not found |
Verify chain name/ID in supported list |
RPC timeout |
Check network connection or use custom RPC |
Private key error |
Verify key format matches chain type |
Quote unavailable |
Check source/destination pair compatibility |
# Enable verbose logging
export DEBUG=eco-routes-cli:*
pnpm dev publish --verbose- Never commit
.envfiles - Add to.gitignore - Use environment variables - Don't hardcode private keys
- Hardware wallets recommended - For production environments
- Validate before publishing - Use
--dry-runflag - Audit intent details - Review all parameters before confirmation
- Secure RPC endpoints - Use authenticated endpoints when possible
- Rotate keys regularly - Especially for automated systems
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
- Built with Viem for EVM interactions
- TronWeb for Tron support
- Solana Web3.js for Solana integration
- Commander.js for CLI framework
- Inquirer.js for interactive prompts
- Documentation: Full API Reference
- Issues: GitHub Issues
Made with β€οΈ by Eco Protocol