diff --git a/prediction_market_agent_tooling/tools/web3_utils.py b/prediction_market_agent_tooling/tools/web3_utils.py index d98c7df5..cf895c51 100644 --- a/prediction_market_agent_tooling/tools/web3_utils.py +++ b/prediction_market_agent_tooling/tools/web3_utils.py @@ -153,6 +153,9 @@ def _prepare_tx_params( from_checksummed = Web3.to_checksum_address(tx_params_new["from"]) tx_params_new["nonce"] = web3.eth.get_transaction_count(from_checksummed) + if not tx_params_new.get("chainId"): + tx_params_new["chainId"] = web3.eth.chain_id + if access_list is not None: tx_params_new["accessList"] = access_list @@ -297,7 +300,7 @@ def send_xdai_to( from_private_key: PrivateKey, to_address: ChecksumAddress, value: Wei, - data_text: Optional[str] = None, + data_text: Optional[str | bytes] = None, tx_params: Optional[TxParams] = None, timeout: int = 180, ) -> TxReceipt: @@ -305,7 +308,11 @@ def send_xdai_to( tx_params_new: TxParams = {"value": value, "to": to_address} if data_text is not None: - tx_params_new["data"] = Web3.to_bytes(text=data_text) + tx_params_new["data"] = ( + Web3.to_bytes(text=data_text) + if not isinstance(data_text, bytes) + else data_text + ) if tx_params: tx_params_new.update(tx_params) tx_params_new = _prepare_tx_params(web3, from_address, tx_params=tx_params_new) diff --git a/pyproject.toml b/pyproject.toml index fc8209d8..af8ef235 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "prediction-market-agent-tooling" -version = "0.57.4" +version = "0.57.5" description = "Tools to benchmark, deploy and monitor prediction market agents." authors = ["Gnosis"] readme = "README.md"