prediction-market-agent-tooling 0.65.0__py3-none-any.whl → 0.65.1__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.
@@ -11,6 +11,7 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
11
11
  from safe_eth.eth import EthereumClient
12
12
  from safe_eth.safe.safe import SafeV141
13
13
  from web3 import Account, Web3
14
+ from web3._utils.http import construct_user_agent
14
15
 
15
16
  from prediction_market_agent_tooling.chains import ETHEREUM_ID, GNOSIS_CHAIN_ID
16
17
  from prediction_market_agent_tooling.deploy.gcp.utils import gcp_get_secret_value
@@ -280,7 +281,9 @@ class RPCConfig(BaseSettings):
280
281
  )
281
282
 
282
283
  ETHEREUM_RPC_URL: URI = Field(default=URI("https://rpc.eth.gateway.fm"))
284
+ ETHEREUM_RPC_BEARER: SecretStr | None = None
283
285
  GNOSIS_RPC_URL: URI = Field(default=URI("https://rpc.gnosis.gateway.fm"))
286
+ GNOSIS_RPC_BEARER: SecretStr | None = None
284
287
  CHAIN_ID: ChainID = Field(default=GNOSIS_CHAIN_ID)
285
288
 
286
289
  @property
@@ -300,15 +303,33 @@ class RPCConfig(BaseSettings):
300
303
  return check_not_none(self.CHAIN_ID, "CHAIN_ID missing in the environment.")
301
304
 
302
305
  def chain_id_to_rpc_url(self, chain_id: ChainID) -> URI:
303
- if chain_id == ETHEREUM_ID:
304
- return self.ethereum_rpc_url
305
- elif chain_id == GNOSIS_CHAIN_ID:
306
- return self.gnosis_rpc_url
307
- else:
308
- raise ValueError(f"Unsupported chain ID: {chain_id}")
306
+ return {
307
+ ETHEREUM_ID: self.ethereum_rpc_url,
308
+ GNOSIS_CHAIN_ID: self.gnosis_rpc_url,
309
+ }[chain_id]
310
+
311
+ def chain_id_to_rpc_bearer(self, chain_id: ChainID) -> SecretStr | None:
312
+ return {
313
+ ETHEREUM_ID: self.ETHEREUM_RPC_BEARER,
314
+ GNOSIS_CHAIN_ID: self.GNOSIS_RPC_BEARER,
315
+ }[chain_id]
309
316
 
310
317
  def get_web3(self) -> Web3:
311
- return Web3(Web3.HTTPProvider(self.gnosis_rpc_url))
318
+ headers = {
319
+ "Content-Type": "application/json",
320
+ "User-Agent": construct_user_agent(str(type(self))),
321
+ }
322
+ if bearer := self.chain_id_to_rpc_bearer(self.chain_id):
323
+ headers["Authorization"] = f"Bearer {bearer.get_secret_value()}"
324
+
325
+ return Web3(
326
+ Web3.HTTPProvider(
327
+ self.chain_id_to_rpc_url(self.chain_id),
328
+ request_kwargs={
329
+ "headers": headers,
330
+ },
331
+ )
332
+ )
312
333
 
313
334
 
314
335
  class CloudCredentials(BaseSettings):
@@ -134,6 +134,7 @@ def patch_logger(force_patch: bool = False) -> None:
134
134
  handler,
135
135
  level=config.LOG_LEVEL.value,
136
136
  colorize=False,
137
+ catch=False,
137
138
  )
138
139
 
139
140
  # Use logging module for warnings.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.65.0
3
+ Version: 0.65.1
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.13
@@ -23,7 +23,7 @@ prediction_market_agent_tooling/benchmark/agents.py,sha256=zC5tUM6pPTWtqSddOOSYV
23
23
  prediction_market_agent_tooling/benchmark/benchmark.py,sha256=KwMZzwise3sgmhdjw7xCgHMmjKHdHqQC-zc9untOLWg,17832
24
24
  prediction_market_agent_tooling/benchmark/utils.py,sha256=xQd7p9H08-OtN3iC4QT2i9bkUTmrXa6rxGXeg9yMhgU,2986
25
25
  prediction_market_agent_tooling/chains.py,sha256=1qQstoqXMwqwM7k-KH7MjMz8Ei-D83KZByvDbCZpAxs,116
26
- prediction_market_agent_tooling/config.py,sha256=rdpRHZyoTvRIDn7Qu6eViOjPBkR9Z0MOdEMFsQOuAIE,10822
26
+ prediction_market_agent_tooling/config.py,sha256=UyhK6u261tBLVsRwvXJm9C0wy6UrUpfAKH6xk4CSfk8,11535
27
27
  prediction_market_agent_tooling/deploy/agent.py,sha256=kxfJNfuvGJ2LFReI-PCyjGuubZKIrPEYiyphaS6eKcM,25476
28
28
  prediction_market_agent_tooling/deploy/agent_example.py,sha256=yS1fWkHynr9MYGNOM2WsCnRWLPaffY4bOc6bIudrdd4,1377
29
29
  prediction_market_agent_tooling/deploy/betting_strategy.py,sha256=YYayGjTKW02d3BUavJ8M3NmFk41oldEM3FHbwppZGRM,17184
@@ -36,7 +36,7 @@ prediction_market_agent_tooling/gtypes.py,sha256=bUIZfZIGvIi3aiZNu5rVE9kRevw8sfM
36
36
  prediction_market_agent_tooling/jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  prediction_market_agent_tooling/jobs/jobs_models.py,sha256=DoZ9dlvVhpNrnINiR1uy6YUOsuzI_L-avBt362y5xXM,2467
38
38
  prediction_market_agent_tooling/jobs/omen/omen_jobs.py,sha256=qbTZ9HVvu_iP4dDxuvOZxAp6JsRKejvEW2YDYCnRmd4,5039
39
- prediction_market_agent_tooling/loggers.py,sha256=hF_n-E5iMSqh3dY5G6LkQRHyReMYGPNTLu82dDFh1PU,5187
39
+ prediction_market_agent_tooling/loggers.py,sha256=kFZ1BrI8hvWgZO1vzptFnYiOEDx9Ozs86DA9yF3bSgY,5212
40
40
  prediction_market_agent_tooling/logprobs_parser.py,sha256=Du1Yc-fAVSixQX_Zx6KWpgSzI_ZYhv5tS1b8IcOPPr8,4979
41
41
  prediction_market_agent_tooling/markets/agent_market.py,sha256=smKuMaP1zyTtw31Robbj3ospF03xptWX0EDKPJbHH9I,19070
42
42
  prediction_market_agent_tooling/markets/base_subgraph_handler.py,sha256=7RaYO_4qAmQ6ZGM8oPK2-CkiJfKmV9MxM-rJlduaecU,1971
@@ -116,8 +116,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=yuW8iPPtcpP4eLH2nORMD
116
116
  prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
117
117
  prediction_market_agent_tooling/tools/utils.py,sha256=Jzpck3_QwShhejhgbAhmNxPSOPQJssBQep0eVemVjZ4,7064
118
118
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=zRq-eeBGWt8uUGN9G_WfjmJ0eVvO8aWE9S0Pz_Y6AOA,12342
119
- prediction_market_agent_tooling-0.65.0.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
120
- prediction_market_agent_tooling-0.65.0.dist-info/METADATA,sha256=y1MAlJYLGomNEXjCKul5qGed38uRLULoYAtzh-xFZ2E,8734
121
- prediction_market_agent_tooling-0.65.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
122
- prediction_market_agent_tooling-0.65.0.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
123
- prediction_market_agent_tooling-0.65.0.dist-info/RECORD,,
119
+ prediction_market_agent_tooling-0.65.1.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
120
+ prediction_market_agent_tooling-0.65.1.dist-info/METADATA,sha256=kpSC3I15pU7pCOkvGEv_nl5WiXDyDzk9JegAlbWdkRg,8734
121
+ prediction_market_agent_tooling-0.65.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
122
+ prediction_market_agent_tooling-0.65.1.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
123
+ prediction_market_agent_tooling-0.65.1.dist-info/RECORD,,