prediction-market-agent-tooling 0.62.0.dev471__py3-none-any.whl → 0.62.0.dev473__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.
@@ -31,6 +31,10 @@ from prediction_market_agent_tooling.tools.contract import ContractERC20OnGnosis
31
31
  from prediction_market_agent_tooling.tools.utils import utcnow
32
32
 
33
33
 
34
+ class OrderStatusError(Exception):
35
+ pass
36
+
37
+
34
38
  def get_order_book_api(env: Envs, chain: Chain) -> OrderBookApi:
35
39
  chain_id = SupportedChainId(chain.value[0])
36
40
  return OrderBookApi(OrderBookAPIConfigFactory.get_config(env, chain_id))
@@ -99,6 +103,12 @@ def get_buy_token_amount(
99
103
  return Wei(order_quote.quote.buyAmount.root)
100
104
 
101
105
 
106
+ @tenacity.retry(
107
+ stop=tenacity.stop_after_attempt(3),
108
+ wait=tenacity.wait_fixed(1),
109
+ retry=tenacity.retry_if_not_exception_type((TimeoutError, OrderStatusError)),
110
+ after=lambda x: logger.debug(f"swap_tokens_waiting failed, {x.attempt_number=}."),
111
+ )
102
112
  def swap_tokens_waiting(
103
113
  amount_wei: Wei,
104
114
  sell_token: ChecksumAddress,
@@ -159,7 +169,7 @@ async def swap_tokens_waiting_async(
159
169
  OrderStatus.cancelled,
160
170
  OrderStatus.expired,
161
171
  ):
162
- raise ValueError(f"Order {order.uid} failed. {order.url}")
172
+ raise OrderStatusError(f"Order {order.uid} failed. {order.url}")
163
173
 
164
174
  if utcnow() - start_time > timeout:
165
175
  raise TimeoutError(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.62.0.dev471
3
+ Version: 0.62.0.dev473
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.13
@@ -87,7 +87,7 @@ prediction_market_agent_tooling/tools/caches/serializers.py,sha256=vFDx4fsPxclXp
87
87
  prediction_market_agent_tooling/tools/contract.py,sha256=PJaC_Mc06vowyHD6f4MNQuEfo-h0H-Lh741YzRuemUk,21018
88
88
  prediction_market_agent_tooling/tools/costs.py,sha256=EaAJ7v9laD4VEV3d8B44M4u3_oEO_H16jRVCdoZ93Uw,954
89
89
  prediction_market_agent_tooling/tools/cow/cow_manager.py,sha256=ZX6K0ZKMpcgiDsIrv4wtZAPg-LTozIbvOyQFyVgDpMA,3812
90
- prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=RdbIUlE7ssQAXKDYEWK1twrt57pWCdYCqdlzrAGFI_k,5523
90
+ prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=4BV9t_RZU07SxwAzjTVkXKoQtm9l-roFHJR_cE8O04A,5837
91
91
  prediction_market_agent_tooling/tools/custom_exceptions.py,sha256=Fh8z1fbwONvP4-j7AmV_PuEcoqb6-QXa9PJ9m7guMcM,93
92
92
  prediction_market_agent_tooling/tools/datetime_utc.py,sha256=8_WackjtjC8zHXrhQFTGQ6e6Fz_6llWoKR4CSFvIv9I,2766
93
93
  prediction_market_agent_tooling/tools/db/db_manager.py,sha256=GtzHH1NLl8HwqC8Z7s6eTlIQXuV0blxfaV2PeQrBnfQ,3013
@@ -120,8 +120,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=FmQUfrkLvN8cI_6vw9QNh
120
120
  prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
121
121
  prediction_market_agent_tooling/tools/utils.py,sha256=1xsyBBJfiEdSoMlceB2F8o2sCb6Z8-qNz11pEJFrdyE,6566
122
122
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=eYCc1iWAVtqDKUPTwnMUHuYolPdwh_OTiM3-AdRgDp4,12198
123
- prediction_market_agent_tooling-0.62.0.dev471.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
124
- prediction_market_agent_tooling-0.62.0.dev471.dist-info/METADATA,sha256=FXFhBtPJQo1TxlIC6xUlEPE0W0mLj2lscAchC1IiQk0,8696
125
- prediction_market_agent_tooling-0.62.0.dev471.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
126
- prediction_market_agent_tooling-0.62.0.dev471.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
127
- prediction_market_agent_tooling-0.62.0.dev471.dist-info/RECORD,,
123
+ prediction_market_agent_tooling-0.62.0.dev473.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
124
+ prediction_market_agent_tooling-0.62.0.dev473.dist-info/METADATA,sha256=_oYyrci_zcvf94oHMxCFrccV63TTXor_4ETAsny-1U0,8696
125
+ prediction_market_agent_tooling-0.62.0.dev473.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
126
+ prediction_market_agent_tooling-0.62.0.dev473.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
127
+ prediction_market_agent_tooling-0.62.0.dev473.dist-info/RECORD,,