From c9375fc33837001918b65587ae42ecd150a667dd Mon Sep 17 00:00:00 2001 From: YanhuiJessica <137126578@qq.com> Date: Sat, 7 Sep 2024 22:43:06 +0800 Subject: [PATCH] fix incompatible code with web3>=7.0.0 --- cheb3/account.py | 2 +- cheb3/contract.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cheb3/account.py b/cheb3/account.py index 5e71b0d..e16ec15 100644 --- a/cheb3/account.py +++ b/cheb3/account.py @@ -120,7 +120,7 @@ def send_transaction( except Exception: estimate_gas = 3000000 tx["gas"] = kwargs.get("gas_limit", estimate_gas) - tx = self.eth_acct.sign_transaction(tx).rawTransaction + tx = self.eth_acct.sign_transaction(tx).raw_transaction tx_hash = self.w3.eth.send_raw_transaction(tx).hex() logger.info(f"Transaction to {to}: {tx_hash}") if not kwargs.get("wait_for_receipt", True): diff --git a/cheb3/contract.py b/cheb3/contract.py index 746da1c..7357f0b 100644 --- a/cheb3/contract.py +++ b/cheb3/contract.py @@ -93,7 +93,7 @@ def deploy(self, *constructor_args, **kwargs) -> None: "accessList": kwargs.get("access_list", []), } ) - ).rawTransaction + ).raw_transaction logger.debug(f"Deploying {type(self).__name__} ...") tx_hash = self.w3.eth.send_raw_transaction(tx).hex() receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash) @@ -115,7 +115,7 @@ def deploy(self, *constructor_args, **kwargs) -> None: "data": proxy_bytecode, } tx["gas"] = kwargs.get("gas_limit", self.w3.eth.estimate_gas(tx) + GAS_BUFFER) - tx = self.signer.sign_transaction(tx).rawTransaction + tx = self.signer.sign_transaction(tx).raw_transaction logger.debug("Deploying the proxy ...") tx_hash = self.w3.eth.send_raw_transaction(tx).hex() receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash) @@ -208,7 +208,7 @@ def __init__( signer=self.signer, contract_abi=self.abi, address=self.address, - function_identifier=func["name"], + abi_element_identifier=func["name"], ), ) @@ -233,7 +233,7 @@ def send_transaction(self, **kwargs) -> TxReceipt: } if kwargs.get("access_list"): tx["accessList"] = kwargs["access_list"] - tx = self.signer.sign_transaction(self.build_transaction(tx)).rawTransaction + tx = self.signer.sign_transaction(self.build_transaction(tx)).raw_transaction tx_hash = self.w3.eth.send_raw_transaction(tx).hex() func_name = self.function_identifier if isinstance(self.function_identifier, str) else self.function_identifier.__name__ logger.info(f"({self.address}).{func_name} transaction hash: {tx_hash}")