Skip to content

Commit

Permalink
fix incompatible code with web3>=7.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
YanhuiJessica committed Sep 7, 2024
1 parent 2a421ba commit c9375fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cheb3/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions cheb3/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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"],
),
)

Expand All @@ -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}")
Expand Down

0 comments on commit c9375fc

Please sign in to comment.