Skip to content
Open
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
8 changes: 6 additions & 2 deletions python/ccxt/static_dependencies/ethereum/utils/hexadecimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@


def decode_hex(value: str) -> bytes:
if not is_text(value):
if not isinstance(value, str):
raise TypeError("Value must be an instance of str")
non_prefixed = remove_0x_prefix(HexStr(value))
# Avoid function call overhead by inlining remove_0x_prefix logic
if value.startswith(("0x", "0X")):
non_prefixed = value[2:]
else:
non_prefixed = value
# unhexlify will only accept bytes type someday
ascii_hex = non_prefixed.encode("ascii")
return binascii.unhexlify(ascii_hex)
Expand Down