Skip to content

**feat: user-extensible chain management + 5 new built-in chains**#5

Open
AmpedFinance wants to merge 16 commits into
surfer77:mainfrom
amped-finance:main
Open

**feat: user-extensible chain management + 5 new built-in chains**#5
AmpedFinance wants to merge 16 commits into
surfer77:mainfrom
amped-finance:main

Conversation

@AmpedFinance

Copy link
Copy Markdown

Description

This PR adds the ability for AI agents to add custom EVM chains through natural language, and includes 5 new built-in chains commonly used in DeFi.

What's New

🆕 New Commands (Agent-Friendly)

Command Description
node src/add-chain.js <name> <chainId> <rpc> Add a custom chain
node src/list-chains.js List all available chains
node src/remove-chain.js <name> Remove a user-defined chain

All commands support --json for machine-readable output, making them ideal for AI agent integration.

🔗 5 New Built-in Chains

Chain Native Token Chain ID Notes
Sonic S 146 Sonic mainnet
LightLink ETH 1890 Legacy gas pricing
HyperEVM HYPE 998 Hyperliquid EVM
Avalanche AVAX 43114 C-Chain
BSC BNB 56 BNB Smart Chain

🛠️ User-Extensible Chains

Users can add any EVM chain without waiting for a new release:

# Add Berachain
node src/add-chain.js berachain 80094 https://rpc.berachain.com --native-token BERA --explorer https://berascan.io

# Add a chain with legacy gas (non EIP-1559)
node src/add-chain.js mychain 12345 https://rpc.mychain.io --legacy-gas

Custom chains are stored in ~/.evm-wallet-chains.json and persist across sessions.

🤖 AI Agent Integration

When a user tells their agent:

"Add Berachain with chain ID 80094 and RPC https://rpc.berachain.com"

The agent can run:

node src/add-chain.js berachain 80094 https://rpc.berachain.com --native-token BERA --json

This enables natural language chain management — users don't need to manually edit config files.

Technical Details

  • chains.js now loads user-defined chains from ~/.evm-wallet-chains.json and merges them with built-in chains
  • Added isLegacyGasChain() helper for chains that don't support EIP-1559 (e.g., LightLink)
  • legacyGas: true flag in chain config triggers legacy gas pricing
  • Updated Polygon RPCs to more reliable endpoints

Files Changed

src/lib/chains.js    - Extended with 5 chains + user chain loading
src/add-chain.js     - NEW: Add custom chains via CLI
src/list-chains.js   - NEW: List all available chains  
src/remove-chain.js  - NEW: Remove user-defined chains
README.md            - Updated documentation
SKILL-clawdhub.md    - Updated skill definition with new commands

Backward Compatibility

✅ Fully backward compatible — existing functionality unchanged
✅ All original chains preserved
✅ No breaking changes to existing commands


Testing

# List all chains
node src/list-chains.js

# Add a test chain
node src/add-chain.js testchain 99999 https://rpc.test.io --native-token TEST --json

# Verify it was added
node src/list-chains.js --json

# Remove the test chain
node src/remove-chain.js testchain --yes

# Check balance on new built-in chain
node src/balance.js sonic

Related

This enhancement was developed to support Amped Finance's OpenClaw plugin, which uses evm-wallet-skill for DeFi operations across multiple chains.


Checklist

  • New commands support --json output
  • SKILL-clawdhub.md updated with new tools
  • README updated with new chains and commands
  • Legacy gas support for non EIP-1559 chains
  • User chains persist in ~/.evm-wallet-chains.json
  • Tested locally

danenright and others added 10 commits February 2, 2026 10:39
Add LightLink L2 network configuration:
- Chain ID: 1890
- Native token: ETH
- Explorer: phoenix.lightlink.io
- Primary RPC: replicator.phoenix.lightlink.io/rpc/v1
- Fallback RPCs: thirdweb, omniatech public endpoints

Update README with LightLink in supported chains table.
Update help text and documentation to include LightLink and MegaETH:
- transfer.js: add megaeth, lightlink to chain list in help
- contract.js: add megaeth, lightlink to chain list in help
- SKILL-clawdhub.md: update description and supported chains table
Add legacy gas pricing support for chains like LightLink, with --gas-price
flag for custom overrides including 0 for gasless transactions. Auto-detects
chain type and applies correct pricing model (EIP-1559 vs legacy).
Adds support for all SODAX-compatible EVM chains:
- Sonic (chainId 146) - SODAX hub chain
- Avalanche C-Chain (chainId 43114)
- BNB Smart Chain (chainId 56)
- HyperEVM (chainId 998)

Total supported chains: 11 (was 7)
feat: add SODAX EVM chains (Sonic, Avalanche, BSC, HyperEVM)
- Add 5 new built-in chains: Sonic, LightLink, HyperEVM, Avalanche, BSC
- Add add-chain.js: add custom chains via CLI
- Add list-chains.js: list all available chains
- Add remove-chain.js: remove user-defined chains
- Update chains.js to load user chains from ~/.evm-wallet-chains.json
- Support legacyGas flag for non EIP-1559 chains (e.g., LightLink)
- Update README and SKILL-clawdhub.md with new commands

Users can now add any EVM chain:
  node src/add-chain.js berachain 80094 https://rpc.berachain.com --native-token BERA

AI agents can use this when users ask to add new blockchains.
- Change repo URLs to surfer77/evm-wallet-skill
- Remove Amped Finance attribution (for upstream compatibility)
- Replace unreliable polygon.llamarpc.com
- Use polygon-bor-rpc.publicnode.com, polygon.drpc.org, 1rpc.io/matic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants