Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web3.is_address no longer requires checksummed addresses #265

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions eth_utils/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ def is_address(value: Any) -> bool:
"""
Is the given string an address in any of the known formats?
"""
if is_hex_address(value):
if _is_checksum_formatted(value):
return is_checksum_address(value)
return True

if is_binary_address(value):
if is_hex_address(value) or is_binary_address(value):
return True

return False
Expand Down
1 change: 1 addition & 0 deletions newsfragments/265.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`Web3.is_address` now returns True for non-checksummed addresses.
2 changes: 1 addition & 1 deletion tests/address-utils/test_address_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
# checksummed - valid
("0x5B2063246F2191f18F2675ceDB8b28102e957458", True, True, False),
(b"0x5B2063246F2191f18F2675ceDB8b28102e957458", False, False, False),
("0x5b2063246F2191f18F2675ceDB8b28102e957458", True, True, False),
# checksummed - invalid
("0x5b2063246F2191f18F2675ceDB8b28102e957458", False, True, False),
(b"0x5b2063246F2191f18F2675ceDB8b28102e957458", False, False, False),
# too short - unprefixed
("c6d9d2cd449a754c494264e1809c50e34d64562", False, False, False),
Expand Down