Skip to content

Commit be43653

Browse files
committed
Use 'Address' NewType in utils.address
1 parent 13421c4 commit be43653

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

eth/utils/address.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import rlp
22

33
from eth_hash.auto import keccak
4+
from eth_typing import Address
45

5-
6-
def force_bytes_to_address(value: bytes) -> bytes:
6+
def force_bytes_to_address(value: bytes) -> Address:
77
trimmed_value = value[-20:]
88
padded_value = trimmed_value.rjust(20, b'\x00')
9-
return padded_value
9+
return Address(padded_value)
1010

1111

12-
def generate_contract_address(address: bytes, nonce: bytes) -> bytes:
13-
return keccak(rlp.encode([address, nonce]))[-20:]
12+
def generate_contract_address(address: Address, nonce: bytes) -> Address:
13+
return Address(keccak(rlp.encode([address, nonce]))[-20:])

0 commit comments

Comments
 (0)