From 5a1f7a9875d72ed8e86e4663a1f09d5ff86fa354 Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Wed, 4 Dec 2024 12:07:50 +0100 Subject: [PATCH 1/3] Allow to accept bytes in send_xdai_to --- prediction_market_agent_tooling/tools/web3_utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/prediction_market_agent_tooling/tools/web3_utils.py b/prediction_market_agent_tooling/tools/web3_utils.py index d98c7df5..d3decaf2 100644 --- a/prediction_market_agent_tooling/tools/web3_utils.py +++ b/prediction_market_agent_tooling/tools/web3_utils.py @@ -297,7 +297,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 +305,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) From ed88661f9c1bf754a965a1eaed3f3f63d053ffe8 Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Wed, 4 Dec 2024 13:29:44 +0100 Subject: [PATCH 2/3] add chainId to tx params --- prediction_market_agent_tooling/tools/web3_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prediction_market_agent_tooling/tools/web3_utils.py b/prediction_market_agent_tooling/tools/web3_utils.py index d3decaf2..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 From 5e88270865692aee9fbf8e683f64f42f99092a7d Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Wed, 4 Dec 2024 15:23:20 +0100 Subject: [PATCH 3/3] bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"