Skip to content

feat(registry): add Arbitrum Bridge plugin (ETH/ERC20)#259

Open
WuodOdhis wants to merge 4 commits intoEmberAGI:mainfrom
WuodOdhis:main
Open

feat(registry): add Arbitrum Bridge plugin (ETH/ERC20)#259
WuodOdhis wants to merge 4 commits intoEmberAGI:mainfrom
WuodOdhis:main

Conversation

@WuodOdhis
Copy link

Summary

Related Issue(s): Closes #244

Adds a new Arbitrum Bridge plugin to the @emberai/onchain-actions-registry that enables ETH and ERC20 bridging between Ethereum (L1) and Arbitrum (L2). The plugin exposes:

  • Actions (type bridge):
    • bridge-deposit: L1 → L2
    • bridge-withdraw: L2 → L1
  • Queries:
    • getMessageStatus: Inspect cross-chain message lifecycle

Networks: Arbitrum One (42161) and Arbitrum Sepolia (421614)

Type of Change:

  • ✨ New feature (adds functionality)
  • 🔌 Protocol integration (adds support for new DeFi protocol)
  • 🧪 Tests (adding or updating tests)
  • 📚 Documentation (updates to docs)

Key files:

  • typescript/onchain-actions-plugins/registry/src/plugins/arbitrum-bridge/adapter.ts
  • typescript/onchain-actions-plugins/registry/src/plugins/arbitrum-bridge/index.ts
  • typescript/onchain-actions-plugins/registry/src/plugins/arbitrum-bridge/README.md
  • Tests under typescript/onchain-actions-plugins/registry/tests/*arbitrum-bridge*.int.test.ts
  • Vitest config: typescript/onchain-actions-plugins/registry/vitest.config.ts

🧪 Testing

Tests Performed:

  • Integration tests for ETH and ERC20 deposit/withdraw flows
  • Message status query validation
  • Optional verification via L1 Inbox logs during deposit

Test Results:

  • New integration tests passing locally with live Arbitrum RPCs (Tenderly Virtual Nets recommended)

Steps to Run Tests:

  • From repo root or the registry package:
    • Registry package path: typescript/onchain-actions-plugins/registry
  • Set RPCs (Tenderly VNets recommended):
export ETHEREUM_MAINNET_RPC_URL="https://virtual.mainnet.eu.rpc.tenderly.co/<your-id>"
export ARBITRUM_ONE_RPC_URL="https://virtual.arbitrum.eu.rpc.tenderly.co/<your-id>"
  • Run L1→L2 and ERC20 tests:
USE_LIVE_CHILD=1 BRIDGE_TEST_TIMEOUT=600000 pnpm exec vitest run \
  tests/arbitrum-bridge.int.test.ts \
  tests/arbitrum-bridge-erc20.int.test.ts
  • Optional: verify deposit via L1 Inbox logs:
VERIFY_DEPOSIT=1 USE_LIVE_CHILD=1 BRIDGE_TEST_TIMEOUT=600000 pnpm exec vitest run \
  tests/arbitrum-bridge-verify.int.test.ts
  • Optional: run withdraw/L1↔L3 tests if configured:
USE_LIVE_CHILD=1 BRIDGE_TEST_TIMEOUT=600000 pnpm exec vitest run \
  tests/arbitrum-bridge-withdraw.int.test.ts \
  tests/arbitrum-bridge-l1l3.int.test.ts

Checklists

Code Quality

  • Code follows project conventions and style guidelines
  • TypeScript compilation passes (pnpm build)
  • Linting passes (pnpm lint:check)
  • All tests pass (pnpm test)
  • No any types introduced
  • Error handling implemented appropriately
  • Security best practices followed (no exposed secrets/keys)

Documentation

  • Code is self-documenting or includes necessary comments
  • README updated if applicable (added plugin README)
  • API/interface changes documented
  • Breaking changes noted in description

Agent/MCP Specific (if applicable)

  • MCP protocol compliance verified
  • Agent skills and tools properly defined
  • Error handling for external API failures
  • Rate limiting and retry logic implemented
  • Configuration options documented

Deployment Notes

Deployment Considerations:

  • Ships within @emberai/onchain-actions-registry; no special deployment steps

New or Changed Environment Variables:

  • None required for runtime
  • For tests: ETHEREUM_MAINNET_RPC_URL, ARBITRUM_ONE_RPC_URL
  • Optional (tests only): USE_LIVE_CHILD, BRIDGE_TEST_TIMEOUT, VERIFY_DEPOSIT

Breaking Changes or Migration Steps:

  • None

New Dependencies Added:

  • @arbitrum/sdk (used by the bridge adapter to build TransactionPlans)

Additional Context

  • The adapter uses EthBridger and Erc20Bridger from @arbitrum/sdk to construct transaction plans.
  • Registry wiring auto-registers the plugin for 42161 and 421614.
  • Known caveat: Some L2 gateway RPC calls can stall on local L2 forks; prefer a live Arbitrum RPC for tests.

…d bridge plugin actions/queries/schemas\n- Update registry exports and tests\n- Wire vitest config for registry
@WuodOdhis WuodOdhis closed this Oct 14, 2025
@WuodOdhis WuodOdhis reopened this Oct 14, 2025
@WuodOdhis WuodOdhis changed the title chore(repo): replace remote gh content with current workspace\n\n- Ad… feat(registry): add Arbitrum Bridge plugin (ETH/ERC20 L1<->L2 Oct 14, 2025
@WuodOdhis WuodOdhis changed the title feat(registry): add Arbitrum Bridge plugin (ETH/ERC20 L1<->L2 feat(registry): add Arbitrum Bridge plugin (ETH/ERC20 Oct 14, 2025
@WuodOdhis WuodOdhis changed the title feat(registry): add Arbitrum Bridge plugin (ETH/ERC20 feat(registry): add Arbitrum Bridge plugin (ETH/ERC20) Oct 14, 2025
- Implement 5 MCP tools: getSwapQuote, getBestRoute, generateSwapTransaction, validateSwapFeasibility, processSwapIntent
- Add comprehensive Zod schemas for all inputs/outputs
- Implement typed error classes with clear error messages
- Add validation utilities, chain config, and routing helpers
- Support Uniswap v2 and v3 via Universal Router
- Add unit tests and comprehensive documentation
- Follow PR EmberAGI#202 architectural patterns for consistency
- Fix ethers v5 import paths (utils.getAddress, utils.isAddress)
- Fix contract method calls using bracket notation for index signatures
- Fix Uniswap SDK route extraction from trade.swaps structure
- Fix Percent type usage for slippage tolerance
- Fix BigNumber to BigInt conversions
- Fix test address checksum validation
- Add vitest.config.ts for proper test discovery
- Fix linting errors (unused variables, any types)
- All tests passing (17/17)
- Build successful with 0 errors
…README

- Add INTEGRATION.md with step-by-step integration instructions
- Update main MCP tools README to list available servers
- All tests passing (17/17)
- Build successful
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.

feat: Add Arbitrum native bridge MCP server with security enhancements

1 participant