diff --git a/docs/overview.rst b/docs/overview.rst index a93bdd74f6..0cc9c40e2d 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -101,9 +101,9 @@ Encoding and Decoding Helpers Address Helpers --------------- -- :meth:`Web3.isAddress() ` -- :meth:`Web3.isChecksumAddress() ` -- :meth:`Web3.toChecksumAddress() ` +- :meth:`Web3.is_address() ` +- :meth:`Web3.is_checksum_address() ` +- :meth:`Web3.to_checksum_address() ` Currency Conversions diff --git a/docs/web3.main.rst b/docs/web3.main.rst index 48a0951d9b..07211db695 100644 --- a/docs/web3.main.rst +++ b/docs/web3.main.rst @@ -208,7 +208,7 @@ Currency Conversions Addresses ~~~~~~~~~ -.. py:method:: Web3.isAddress(value) +.. py:method:: Web3.is_address(value) Returns ``True`` if the value is one of the recognized address formats. @@ -218,31 +218,31 @@ Addresses .. code-block:: python - >>> Web3.isAddress('0xd3CdA913deB6f67967B99D67aCDFa1712C293601') + >>> Web3.is_address('0xd3CdA913deB6f67967B99D67aCDFa1712C293601') True -.. py:method:: Web3.isChecksumAddress(value) +.. py:method:: Web3.is_checksum_address(value) Returns ``True`` if the value is a valid `EIP55`_ checksummed address .. code-block:: python - >>> Web3.isChecksumAddress('0xd3CdA913deB6f67967B99D67aCDFa1712C293601') + >>> Web3.is_checksum_address('0xd3CdA913deB6f67967B99D67aCDFa1712C293601') True - >>> Web3.isChecksumAddress('0xd3cda913deb6f67967b99d67acdfa1712c293601') + >>> Web3.is_checksum_address('0xd3cda913deb6f67967b99d67acdfa1712c293601') False -.. py:method:: Web3.toChecksumAddress(value) +.. py:method:: Web3.to_checksum_address(value) Returns the given address with an `EIP55`_ checksum. .. code-block:: python - >>> Web3.toChecksumAddress('0xd3cda913deb6f67967b99d67acdfa1712c293601') + >>> Web3.to_checksum_address('0xd3cda913deb6f67967b99d67acdfa1712c293601') '0xd3CdA913deB6f67967B99D67aCDFa1712C293601' .. _EIP55: https://github.com/ethereum/EIPs/issues/55 diff --git a/newsfragments/2708.breaking.rst b/newsfragments/2708.breaking.rst new file mode 100644 index 0000000000..597685fe5b --- /dev/null +++ b/newsfragments/2708.breaking.rst @@ -0,0 +1 @@ +Snakecase the toAddress, isChecksumAddress, and toChecksumAddress methods \ No newline at end of file diff --git a/web3/_utils/validation.py b/web3/_utils/validation.py index ca36b897fd..a009c3f9ac 100644 --- a/web3/_utils/validation.py +++ b/web3/_utils/validation.py @@ -186,7 +186,7 @@ def validate_address(value: Any) -> None: "The software that gave you this non-checksum address should be " "considered unsafe, please file it as a bug on their platform. " "Try using an ENS name instead. Or, if you must accept lower safety, " - "use Web3.toChecksumAddress(lower_case_address).", + "use Web3.to_checksum_address(lower_case_address).", value, ) else: diff --git a/web3/main.py b/web3/main.py index 915e79f32b..49dce1e003 100644 --- a/web3/main.py +++ b/web3/main.py @@ -216,17 +216,17 @@ def from_wei(number: int, unit: str) -> Union[int, decimal.Decimal]: # Address Utility @staticmethod @wraps(is_address) - def isAddress(value: Any) -> bool: + def is_address(value: Any) -> bool: return is_address(value) @staticmethod @wraps(is_checksum_address) - def isChecksumAddress(value: Any) -> bool: + def is_checksum_address(value: Any) -> bool: return is_checksum_address(value) @staticmethod @wraps(to_checksum_address) - def toChecksumAddress(value: Union[AnyAddress, str, bytes]) -> ChecksumAddress: + def to_checksum_address(value: Union[AnyAddress, str, bytes]) -> ChecksumAddress: return to_checksum_address(value) # mypy Types