You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add EIP-3770 chain-prefixed address support with validation (#15)
* feat: Add EIP-3770 chain-prefixed address support with validation
Add comprehensive support for EIP-3770 chain-prefixed addresses across
all address input fields. Users can now use either plain addresses
(0x...) or chain-prefixed addresses (eth:0x..., matic:0x..., etc.).
When a chain prefix is provided, the system validates that it matches
the current Safe's chain and errors out if there's a mismatch.
Changes:
- Add validateAddressWithChain() and assertAddressWithChain() methods
to ValidationService for EIP-3770 support and chain validation
- Update transaction creation 'To' field to support EIP-3770 format
- Update TransactionBuilder to validate address-type parameters with
chain prefix support
- Update account management commands (open, create, add-owner) to
accept chain-prefixed addresses
- Add 17 comprehensive tests for EIP-3770 validation
- Maintain backward compatibility: plain addresses work as before
All address inputs now show helpful placeholders like "0x... or eth:0x..."
and provide clear error messages on chain mismatch (e.g., "Chain mismatch:
address is for Polygon (matic:) but current Safe is on Ethereum").
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: Wrap assertAddressWithChain in try-catch in validation functions
Validation functions should only return error strings, not throw errors.
The assertAddressWithChain call was duplicated - once inside the validate
function and once after the prompt. This fix wraps the assertion in a
try-catch block inside the validate function to properly handle errors
as return values.
Changes:
- Wrap assertAddressWithChain in try-catch within validation functions
- Add comments to clarify the duplicate check logic
- Keep single assertion after prompt for final processing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: Use ValidationService for address validation in TransactionBuilder
Replace duplicated EIP-3770 validation logic in TransactionBuilder with calls
to ValidationService methods. This eliminates code duplication and ensures
consistent validation behavior across the codebase.
Changes:
- Add ValidationService instance to TransactionBuilder
- Replace parseParameter address logic with assertAddressWithChain()
- Use validateAddressWithChain() directly in validateParameter()
- Remove unused Address import
- Add comments explaining the refactoring
Benefits:
- Single source of truth for address validation
- Reduced maintenance burden
- Consistent error messages
- Better code organization
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments