feat: add non-EVM blockchain extensions and expand EVM chains#2
feat: add non-EVM blockchain extensions and expand EVM chains#2
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive support for 5 new non-EVM blockchain extensions (Sui, Aptos, Cosmos, Cardano, NEAR) and expands EVM chain support with 45+ chains. The implementation includes extensive test coverage with 474 new tests, including edge case tests with official specification test vectors. The changes also add infrastructure improvements like fallback transport and resilient WebSocket transport for better reliability.
Reviewed changes
Copilot reviewed 61 out of 61 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
reown_signer.dart |
Added signHash method for raw hash signing support |
fallback_transport.dart |
New transport with automatic failover, health tracking, and ranking |
resilient_websocket_transport.dart |
New WebSocket transport with auto-reconnection and subscription restoration |
fallback_transport_test.dart |
Comprehensive tests for fallback transport (278 lines) |
| Hardware wallet signers (Ledger, Trezor, Keystone, MPC) | Added signHash method implementations |
| Sui extension | Complete implementation with types, transactions, client, chains, and tests |
| NEAR extension | Complete implementation with types, transactions, client, chains, and tests |
| Cosmos extension | Complete implementation with types, transactions, client, chains, and tests |
| Cardano extension | Chain configuration and structure |
| Aptos extension | Chain configuration and structure |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b248fcfa7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| final subscriptionId = params['subscription'] as String?; | ||
| if (subscriptionId != null) { | ||
| final info = _subscriptions[subscriptionId]; | ||
| if (info != null && params['result'] is Map<String, dynamic>) { | ||
| info.controller.add(params['result'] as Map<String, dynamic>); |
There was a problem hiding this comment.
Forward non-map subscription payloads
The subscription handler drops any eth_subscription notification whose result is not a Map<String, dynamic>, so subscriptions like newPendingTransactions (which return a transaction hash string) or syncing (which can be a boolean) will never emit events. This makes those subscriptions appear silent even though the node is sending notifications. If the API intends to support generic eth_subscribe topics, the handler should forward non-map results (or change the stream type) instead of ignoring them.
Useful? React with 👍 / 👎.
| /// Gracefully close the connection. | ||
| Future<void> close() async { | ||
| _intentionalClose = true; | ||
| await _channel?.sink.close(); | ||
| _setState(WebSocketConnectionState.disconnected); |
There was a problem hiding this comment.
Cancel pending reconnects on close
Calling close() sets _intentionalClose and closes the socket, but it does not cancel a previously scheduled _reconnectTimer. If the connection had already scheduled a reconnect (via _scheduleReconnect) before close() is invoked, that timer will still fire and call connect(), reopening a connection after an explicit shutdown. This makes it hard to reliably stop the transport and can lead to unexpected network usage.
Useful? React with 👍 / 👎.
Critical/High priority fixes: - Fix EIP-712 domain name/version for EntryPoint v0.8/v0.9 (changed from "Account Abstraction EntryPoint"/"0.8" to "ERC4337"/"1") - Add signHash method to all Signer implementations (Ledger, Trezor, Keystone, MPC, Reown) - Fix simulateValidation ABI encoding to include proper offset for dynamic tuple parameters (v0.6 and v0.7) Medium priority fixes: - Fix ValidationResult.fromBytes to include paymasterValidationData and correct bit layout for unpacking accountValidationData (sigAuthorizer[160] | validUntil[48] | validAfter[48]) - Implement EIP-7702 authorization initCode encoding using RLP Low priority fixes: - Fix PBKDF2 operator precedence bug: (1 << 32 - 1) -> ((1 << 32) - 1) - Add proper userOpHash test vectors for determinism and format verification 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added documentation for additional fixes: - simulateValidation ABI encoding offset (HIGH) - ValidationResult.fromBytes parsing (MEDIUM) - EIP-7702 authorization initCode (MEDIUM) - PBKDF2 operator precedence (LOW) - signHash method in all signers (HIGH) - userOpHash test vectors (LOW) Updated summary: 22 total issues fixed across all modules. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New Features: - FallbackTransport: Multi-provider support with auto-failover - Health monitoring with configurable failure thresholds - Exponential backoff retry strategy - Automatic ranking by latency and stability - Switch events for monitoring transport changes - ResilientWebSocketTransport: Auto-reconnecting WebSocket - Exponential backoff with jitter for reconnection - Keep-alive ping/pong messages - Subscription restoration after reconnect - Connection state events stream - ErrorDecoder: Revert reason parsing - Decodes Error(string) and Panic(uint256) - Custom error support from ABI definitions - RPC error response parsing - Human-readable error messages Tests: - 7 tests for FallbackTransport - 12 tests for ErrorDecoder - 19 ERC-4337 integration tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
FallbackTransport: - Fix unsafe type casting (e as Exception) that could fail on Error types ResilientWebSocketTransport: - Add Completer to prevent concurrent connect() calls (race condition) - Handle both String and binary WebSocket messages - Add try-catch for JSON decode errors - Improve null safety in subscription handling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- FallbackTransport: Add _lastSuccessfulIndex to track switch events correctly - FallbackTransport: Add cooldown check to batchRequest() for consistency - ResilientWebSocketTransport: Add onCancel callback to prevent resource leak - ErrorDecoder: Handle large panic codes that would overflow int safely - Add boundary condition tests for edge cases 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add 5 new non-EVM blockchain extension packages: - dart_web3_sui: Sui/Move blockchain support with BCS encoding - dart_web3_aptos: Aptos blockchain with Move VM support - dart_web3_cosmos: Cosmos SDK chains (Cosmos Hub, Osmosis, etc.) - dart_web3_cardano: Cardano with CIP-19 address spec and Plutus - dart_web3_near: NEAR Protocol with sharding support Each package includes: - Chain configurations (mainnet/testnet) - Type-safe transaction builders - Comprehensive edge case tests with official spec test vectors - Client implementations for RPC interactions Also expand EVM chain support with 45+ chains: - Layer 1: Ethereum, BSC, Polygon, Avalanche, Fantom, etc. - Layer 2: Arbitrum, Optimism, Base, zkSync, Scroll, etc. - Testnets: Sepolia, Holesky, Amoy, BSC Testnet, etc. Test coverage: - Sui: 76 tests (BCS encoding, system addresses, zkLogin) - Aptos: 92 tests (BCS, framework addresses, APT coin type) - Cosmos: 82 tests (Bech32, IBC, multi-chain configs) - Cardano: 113 tests (CIP-19, Plutus data, native scripts) - NEAR: 111 tests (account ID validation, yoctoNEAR scale) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add comprehensive cryptography and encoding implementations: Cryptography (crypto/lib/src/curves.dart): - Ed25519 signature scheme for Sui, Aptos, NEAR, Cardano - Enhanced Secp256k1 with recovery and compact signatures - BIP-32/39/44 HD wallet derivation support Encoding Libraries: - BCS (Binary Canonical Serialization) for Sui and Aptos - Borsh encoding for NEAR protocol - CBOR encoding for Cardano blockchain - Base58/Bech32 address encoding in core package Integration Tests: - Comprehensive tests for all 5 extension packages (Sui, NEAR, Cardano, Cosmos, Aptos) - Tests match actual API implementations - 965+ new test cases covering types, transactions, and builders All extension package tests pass: - Sui: 162 tests - NEAR: 237 tests - Cardano: 240 tests - Cosmos: 157 tests - Aptos: 169 tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename dart_web3_* to web3_universal_* for Sui, NEAR, Cardano, Aptos - Fix integration tests to match exported APIs - Remove cosmos_edge_cases_test (tested unexported types) - Rewrite cosmos integration test for actual exported API Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
c6d0b6b to
bd41e98
Compare
- Forward non-map subscription payloads (P2) - Support newPendingTransactions (tx hash string) - Support syncing (boolean or map) - Change stream type from Map<String,dynamic> to dynamic - Cancel pending reconnects on close (P2) - Cancel _keepAliveTimer and _reconnectTimer in close() - Prevents unexpected reconnection after explicit shutdown - Export FallbackTransport and ResilientWebSocketTransport - Fix test import from dart_web3_provider to web3_universal_provider Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Massive feature addition! 🚀 Impressive scope:
That is nearly 24K lines of new code across 68 files. A few thoughts:
Would you like a code review focused on specific areas? This could use multiple reviewers given the size. Great work pushing the envelope on multi-chain support! 🌉 |
Summary
New Extension Packages
dart_web3_suidart_web3_aptosdart_web3_cosmosdart_web3_cardanodart_web3_nearEVM Chains Added (45+)
Layer 1: Ethereum, BSC, Polygon, Avalanche, Fantom, Cronos, Gnosis, Celo, Moonbeam, Moonriver, Harmony, Klaytn, Aurora, Metis, Boba, Fuse, Evmos, Kava, Canto, Mantle, Linea, opBNB, Manta Pacific
Layer 2: Arbitrum One, Arbitrum Nova, Optimism, Base, zkSync Era, Scroll, Polygon zkEVM, Blast, Mode, Zora
Testnets: Sepolia, Holesky, Amoy, BSC Testnet, Avalanche Fuji, Fantom Testnet, Arbitrum Sepolia, Optimism Sepolia, Base Sepolia
Test Coverage
All packages include:
Total: 474 new tests across all packages
Test plan
🤖 Generated with Claude Code