From 697504302e6165cfd391c9c0e13e9535fb056bd5 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Thu, 30 Oct 2025 13:01:21 -0500 Subject: [PATCH] fix: encode non ascii characters --- genlayer_py/contracts/actions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/genlayer_py/contracts/actions.py b/genlayer_py/contracts/actions.py index 08e69b1..00ca14a 100644 --- a/genlayer_py/contracts/actions.py +++ b/genlayer_py/contracts/actions.py @@ -42,9 +42,14 @@ def get_contract_schema_for_code( if self.chain.id != localnet.id: raise GenLayerError("Contract schema is not supported on this network") + try: + encoded_contract_code = eth_utils.hexadecimal.encode_hex(contract_code) + except: + encoded_contract_code = contract_code + response = self.provider.make_request( method="gen_getContractSchemaForCode", - params=[eth_utils.hexadecimal.encode_hex(contract_code)], + params=[encoded_contract_code], ) return response["result"]