diff --git a/starknet_py/net/schemas/common.py b/starknet_py/net/schemas/common.py index acb0409df..d0e03d85c 100644 --- a/starknet_py/net/schemas/common.py +++ b/starknet_py/net/schemas/common.py @@ -89,6 +89,15 @@ class Felt(NumberAsHex): REGEX_PATTERN = r"^0x(0|[a-fA-F1-9]{1}[a-fA-F0-9]{0,62})$" +class EthAddress(NumberAsHex): + """ + Field used to serialize and deserialize ETH address type. + """ + + MAX_VALUE = 2**160 + REGEX_PATTERN = r"^0x[a-fA-F0-9]{40}$" + + class Uint64(NumberAsHex): """ Field used to serialize and deserialize RPC u64 type. diff --git a/starknet_py/net/schemas/rpc/transactions.py b/starknet_py/net/schemas/rpc/transactions.py index d08e192a5..f96cc82d2 100644 --- a/starknet_py/net/schemas/rpc/transactions.py +++ b/starknet_py/net/schemas/rpc/transactions.py @@ -27,6 +27,7 @@ ) from starknet_py.net.schemas.common import ( DAModeField, + EthAddress, ExecutionStatusField, Felt, FinalityStatusField, @@ -45,7 +46,7 @@ class L2toL1MessageSchema(Schema): l2_address = Felt(data_key="from_address", required=True) - l1_address = Felt(data_key="to_address", required=True) + l1_address = EthAddress(data_key="to_address", required=True) payload = fields.List(Felt(), data_key="payload", required=True) @post_load