Skip to content

Commit

Permalink
Improve typing for to_0x_hex_str
Browse files Browse the repository at this point in the history
- It's returning an `HexStr`
  • Loading branch information
Uxio0 committed Feb 4, 2025
1 parent 95b1436 commit f8daea1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions safe_eth/util/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import Any, Iterable, Sequence

from eth_typing import HexStr


def chunks(elements: Sequence[Any], n: int) -> Iterable[Any]:
"""
Expand All @@ -11,11 +13,11 @@ def chunks(elements: Sequence[Any], n: int) -> Iterable[Any]:
yield elements[i : i + n]


def to_0x_hex_str(value: bytes) -> str:
def to_0x_hex_str(value: bytes) -> HexStr:
"""
Convert bytes to a 0x-prefixed hex string
:param value: bytes value
:return: 0x-prefixed hex string
"""
return "0x" + value.hex()
return HexStr("0x" + value.hex())

0 comments on commit f8daea1

Please sign in to comment.