Skip to content

Commit

Permalink
Web3.is_address no longer requires checksummed addresses (#265)
Browse files Browse the repository at this point in the history
* `Web3.is_address` no longer requires checksummed addresses

* Newsfragment for #265
  • Loading branch information
reedsa committed Feb 21, 2024
1 parent b90d2fe commit b57da60
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
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

0 comments on commit b57da60

Please sign in to comment.