prediction-market-agent-tooling 0.63.0.dev508__py3-none-any.whl → 0.63.0.dev511__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,14 +40,23 @@ def store_trades(
40
40
 
41
41
  # tx_hashes must be list of bytes32 (see Solidity contract).
42
42
  # For regular tx hashes that's fine, but for other types of IDs we take the first 32 bytes (orderDigest).
43
- tx_hashes = [
44
- HexBytes(HexStr(trade.id))[:32] for trade in traded_market.trades if trade.id
45
- ]
43
+ tx_hashes = []
44
+ for trade in traded_market.trades:
45
+ if not trade.id:
46
+ continue
47
+
48
+ tx_hash = HexBytes(HexStr(trade.id))
49
+ if len(tx_hash) > 32:
50
+ logger.info(
51
+ f"len(tx_hash) is {len(tx_hash)} should be <= 32, else contract will not accept it."
52
+ )
53
+ else:
54
+ tx_hashes.append(HexBytes(HexStr(trade.id)))
46
55
 
47
56
  prediction = ContractPrediction(
48
57
  publisher=keys.bet_from_address,
49
58
  ipfs_hash=ipfs_hash_decoded,
50
- tx_hashes=tx_hashes, # type: ignore[arg-type]
59
+ tx_hashes=tx_hashes,
51
60
  estimated_probability_bps=int(traded_market.answer.p_yes * BPS_CONSTANT),
52
61
  )
53
62
  tx_receipt = OmenAgentResultMappingContract().add_prediction(
@@ -4,7 +4,6 @@ from prediction_market_agent_tooling.gtypes import (
4
4
  ChecksumAddress,
5
5
  CollateralToken,
6
6
  Probability,
7
- Wei,
8
7
  )
9
8
  from prediction_market_agent_tooling.loggers import logger
10
9
  from prediction_market_agent_tooling.markets.seer.data_models import (
@@ -17,7 +16,6 @@ from prediction_market_agent_tooling.markets.seer.seer_subgraph_handler import (
17
16
  from prediction_market_agent_tooling.markets.seer.subgraph_data_models import SeerPool
18
17
  from prediction_market_agent_tooling.tools.cow.cow_order import get_quote
19
18
  from prediction_market_agent_tooling.tools.hexbytes_custom import HexBytes
20
- from prediction_market_agent_tooling.tools.utils import check_not_none
21
19
 
22
20
 
23
21
  class PriceManager:
@@ -143,6 +143,12 @@ def get_buy_token_amount_else_raise(
143
143
  return Wei(order_quote.quote.buyAmount.root)
144
144
 
145
145
 
146
+ @tenacity.retry(
147
+ stop=stop_after_attempt(3),
148
+ wait=wait_fixed(1),
149
+ retry=tenacity.retry_if_not_exception_type((TimeoutError, OrderStatusError)),
150
+ after=lambda x: logger.debug(f"swap_tokens_waiting failed, {x.attempt_number=}."),
151
+ )
146
152
  def swap_tokens_waiting(
147
153
  amount_wei: Wei,
148
154
  sell_token: ChecksumAddress,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.63.0.dev508
3
+ Version: 0.63.0.dev511
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.13
@@ -36,7 +36,7 @@ prediction_market_agent_tooling/jobs/omen/omen_jobs.py,sha256=Pf6QxPXGyie-2l_wZU
36
36
  prediction_market_agent_tooling/loggers.py,sha256=MvCkQSJL2_0yErNatqr81sJlc4aOgPzDp9VNrIhKUcc,4140
37
37
  prediction_market_agent_tooling/markets/agent_market.py,sha256=1NomilM0GCXcRq_1N_cr2AbSK5ONTowFeRbrhc7V5zE,14929
38
38
  prediction_market_agent_tooling/markets/base_subgraph_handler.py,sha256=7RaYO_4qAmQ6ZGM8oPK2-CkiJfKmV9MxM-rJlduaecU,1971
39
- prediction_market_agent_tooling/markets/blockchain_utils.py,sha256=0sMBfSK8Tx1VQVtRDbSDSH95AwMHPEXKPNfVXG7uH6A,2390
39
+ prediction_market_agent_tooling/markets/blockchain_utils.py,sha256=13OUImn2afOjTv943X9DoC50jKxCONBp1zZao1fkBLI,2645
40
40
  prediction_market_agent_tooling/markets/categorize.py,sha256=jsoHWvZk9pU6n17oWSCcCxNNYVwlb_NXsZxKRI7vmsk,1301
41
41
  prediction_market_agent_tooling/markets/data_models.py,sha256=_R9Hr5zwGLpZLPXq0Jo2wZRNRQyOnSi3WVQJZ81syuk,4541
42
42
  prediction_market_agent_tooling/markets/manifold/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -62,7 +62,7 @@ prediction_market_agent_tooling/markets/polymarket/data_models_web.py,sha256=LVE
62
62
  prediction_market_agent_tooling/markets/polymarket/polymarket.py,sha256=6rc9qulPl90MxXKB55XiiWKLhjfAyG_eUzAlqpq1UIE,3339
63
63
  prediction_market_agent_tooling/markets/polymarket/utils.py,sha256=8kTeVjXPcXC6DkDvWYsZQLY7x8DS6CEp_yznSEazsNU,2037
64
64
  prediction_market_agent_tooling/markets/seer/data_models.py,sha256=FwTOq9X2iJ7r3ijtE0evl8pMSbFPm4lUwuc9m7YsMVA,6373
65
- prediction_market_agent_tooling/markets/seer/price_manager.py,sha256=i31iHTZCxAbKoyU9x7k52DyfmMf-W1xc0Yu3Lxi3rEE,4771
65
+ prediction_market_agent_tooling/markets/seer/price_manager.py,sha256=GaDaFIz1jMgUUg4TpR-FdIF-_-C6pX4sjp3xTLi8KyI,4691
66
66
  prediction_market_agent_tooling/markets/seer/seer.py,sha256=LcNc9vH8OMkzr7FgzKHqMqxd86FNRRG57BRbvvZuvu8,15150
67
67
  prediction_market_agent_tooling/markets/seer/seer_contracts.py,sha256=0pXFzCNO9RFgCWAyyVRQliJuMvMr4uVS5B7cmSz_ffA,2685
68
68
  prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py,sha256=KKRI493VNNAY9tR1AjzNraeH76MvDsBV6GsiLZas0_Y,9859
@@ -88,7 +88,7 @@ prediction_market_agent_tooling/tools/caches/inmemory_cache.py,sha256=ZW5iI5rmjq
88
88
  prediction_market_agent_tooling/tools/caches/serializers.py,sha256=vFDx4fsPxclXp2q0sv27j4al_M_Tj9aR2JJP-xNHQXA,2151
89
89
  prediction_market_agent_tooling/tools/contract.py,sha256=1ZFp_VoqTjM8cqOfAhco2Ht0DTqakjhZpuZUrAXr28Q,21332
90
90
  prediction_market_agent_tooling/tools/costs.py,sha256=EaAJ7v9laD4VEV3d8B44M4u3_oEO_H16jRVCdoZ93Uw,954
91
- prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=SU0xp0MqriqJYpyTfk-y6ogUn3fCi_vIDIA-npfGOyQ,6709
91
+ prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=8t9_QQpoL6j_R9ommqZSklaQKK2vaO2gv9_FY-SFktY,6953
92
92
  prediction_market_agent_tooling/tools/custom_exceptions.py,sha256=Fh8z1fbwONvP4-j7AmV_PuEcoqb6-QXa9PJ9m7guMcM,93
93
93
  prediction_market_agent_tooling/tools/datetime_utc.py,sha256=8_WackjtjC8zHXrhQFTGQ6e6Fz_6llWoKR4CSFvIv9I,2766
94
94
  prediction_market_agent_tooling/tools/db/db_manager.py,sha256=GtzHH1NLl8HwqC8Z7s6eTlIQXuV0blxfaV2PeQrBnfQ,3013
@@ -121,8 +121,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=Qq8ofVCCMX-eo8mDlHv4g
121
121
  prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
122
122
  prediction_market_agent_tooling/tools/utils.py,sha256=1xsyBBJfiEdSoMlceB2F8o2sCb6Z8-qNz11pEJFrdyE,6566
123
123
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=eYCc1iWAVtqDKUPTwnMUHuYolPdwh_OTiM3-AdRgDp4,12198
124
- prediction_market_agent_tooling-0.63.0.dev508.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
125
- prediction_market_agent_tooling-0.63.0.dev508.dist-info/METADATA,sha256=Yq6XIH9CVQ0Iu-n8CpHXiJI_xPrOdXCqapzUyU89l2o,8696
126
- prediction_market_agent_tooling-0.63.0.dev508.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
127
- prediction_market_agent_tooling-0.63.0.dev508.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
128
- prediction_market_agent_tooling-0.63.0.dev508.dist-info/RECORD,,
124
+ prediction_market_agent_tooling-0.63.0.dev511.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
125
+ prediction_market_agent_tooling-0.63.0.dev511.dist-info/METADATA,sha256=EGjg-cJr7WjjJbJ5VvYbb_Y_yqtjv67qcS_6DbHTp1I,8696
126
+ prediction_market_agent_tooling-0.63.0.dev511.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
127
+ prediction_market_agent_tooling-0.63.0.dev511.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
128
+ prediction_market_agent_tooling-0.63.0.dev511.dist-info/RECORD,,