prediction-market-agent-tooling 0.57.7__py3-none-any.whl → 0.57.9__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.
@@ -0,0 +1,328 @@
1
+ [
2
+ {
3
+ "type": "constructor",
4
+ "inputs": [
5
+ {
6
+ "name": "_treasury",
7
+ "type": "address",
8
+ "internalType": "address payable"
9
+ },
10
+ {
11
+ "name": "_pctToTreasuryInBasisPoints",
12
+ "type": "uint256",
13
+ "internalType": "uint256"
14
+ }
15
+ ],
16
+ "stateMutability": "nonpayable"
17
+ },
18
+ {
19
+ "type": "function",
20
+ "name": "adjustMinimumValueForSendingMessage",
21
+ "inputs": [
22
+ {
23
+ "name": "newValue",
24
+ "type": "uint256",
25
+ "internalType": "uint256"
26
+ }
27
+ ],
28
+ "outputs": [],
29
+ "stateMutability": "nonpayable"
30
+ },
31
+ {
32
+ "type": "function",
33
+ "name": "countMessages",
34
+ "inputs": [
35
+ {
36
+ "name": "agentAddress",
37
+ "type": "address",
38
+ "internalType": "address"
39
+ }
40
+ ],
41
+ "outputs": [
42
+ {
43
+ "name": "",
44
+ "type": "uint256",
45
+ "internalType": "uint256"
46
+ }
47
+ ],
48
+ "stateMutability": "view"
49
+ },
50
+ {
51
+ "type": "function",
52
+ "name": "getAtIndex",
53
+ "inputs": [
54
+ {
55
+ "name": "agentAddress",
56
+ "type": "address",
57
+ "internalType": "address"
58
+ },
59
+ {
60
+ "name": "idx",
61
+ "type": "uint256",
62
+ "internalType": "uint256"
63
+ }
64
+ ],
65
+ "outputs": [
66
+ {
67
+ "name": "",
68
+ "type": "tuple",
69
+ "internalType": "struct DoubleEndedStructQueue.MessageContainer",
70
+ "components": [
71
+ {
72
+ "name": "sender",
73
+ "type": "address",
74
+ "internalType": "address"
75
+ },
76
+ {
77
+ "name": "recipient",
78
+ "type": "address",
79
+ "internalType": "address"
80
+ },
81
+ {
82
+ "name": "message",
83
+ "type": "bytes",
84
+ "internalType": "bytes"
85
+ },
86
+ {
87
+ "name": "value",
88
+ "type": "uint256",
89
+ "internalType": "uint256"
90
+ }
91
+ ]
92
+ }
93
+ ],
94
+ "stateMutability": "view"
95
+ },
96
+ {
97
+ "type": "function",
98
+ "name": "minimumValueForSendingMessageInWei",
99
+ "inputs": [],
100
+ "outputs": [
101
+ {
102
+ "name": "",
103
+ "type": "uint256",
104
+ "internalType": "uint256"
105
+ }
106
+ ],
107
+ "stateMutability": "view"
108
+ },
109
+ {
110
+ "type": "function",
111
+ "name": "owner",
112
+ "inputs": [],
113
+ "outputs": [
114
+ {
115
+ "name": "",
116
+ "type": "address",
117
+ "internalType": "address"
118
+ }
119
+ ],
120
+ "stateMutability": "view"
121
+ },
122
+ {
123
+ "type": "function",
124
+ "name": "pctToTreasuryInBasisPoints",
125
+ "inputs": [],
126
+ "outputs": [
127
+ {
128
+ "name": "",
129
+ "type": "uint256",
130
+ "internalType": "uint256"
131
+ }
132
+ ],
133
+ "stateMutability": "view"
134
+ },
135
+ {
136
+ "type": "function",
137
+ "name": "popNextMessage",
138
+ "inputs": [
139
+ {
140
+ "name": "agentAddress",
141
+ "type": "address",
142
+ "internalType": "address"
143
+ }
144
+ ],
145
+ "outputs": [
146
+ {
147
+ "name": "",
148
+ "type": "tuple",
149
+ "internalType": "struct DoubleEndedStructQueue.MessageContainer",
150
+ "components": [
151
+ {
152
+ "name": "sender",
153
+ "type": "address",
154
+ "internalType": "address"
155
+ },
156
+ {
157
+ "name": "recipient",
158
+ "type": "address",
159
+ "internalType": "address"
160
+ },
161
+ {
162
+ "name": "message",
163
+ "type": "bytes",
164
+ "internalType": "bytes"
165
+ },
166
+ {
167
+ "name": "value",
168
+ "type": "uint256",
169
+ "internalType": "uint256"
170
+ }
171
+ ]
172
+ }
173
+ ],
174
+ "stateMutability": "nonpayable"
175
+ },
176
+ {
177
+ "type": "function",
178
+ "name": "queues",
179
+ "inputs": [
180
+ {
181
+ "name": "",
182
+ "type": "address",
183
+ "internalType": "address"
184
+ }
185
+ ],
186
+ "outputs": [
187
+ {
188
+ "name": "_begin",
189
+ "type": "uint128",
190
+ "internalType": "uint128"
191
+ },
192
+ {
193
+ "name": "_end",
194
+ "type": "uint128",
195
+ "internalType": "uint128"
196
+ }
197
+ ],
198
+ "stateMutability": "view"
199
+ },
200
+ {
201
+ "type": "function",
202
+ "name": "renounceOwnership",
203
+ "inputs": [],
204
+ "outputs": [],
205
+ "stateMutability": "nonpayable"
206
+ },
207
+ {
208
+ "type": "function",
209
+ "name": "sendMessage",
210
+ "inputs": [
211
+ {
212
+ "name": "agentAddress",
213
+ "type": "address",
214
+ "internalType": "address"
215
+ },
216
+ {
217
+ "name": "message",
218
+ "type": "bytes",
219
+ "internalType": "bytes"
220
+ }
221
+ ],
222
+ "outputs": [],
223
+ "stateMutability": "payable"
224
+ },
225
+ {
226
+ "type": "function",
227
+ "name": "transferOwnership",
228
+ "inputs": [
229
+ {
230
+ "name": "newOwner",
231
+ "type": "address",
232
+ "internalType": "address"
233
+ }
234
+ ],
235
+ "outputs": [],
236
+ "stateMutability": "nonpayable"
237
+ },
238
+ {
239
+ "type": "function",
240
+ "name": "treasury",
241
+ "inputs": [],
242
+ "outputs": [
243
+ {
244
+ "name": "",
245
+ "type": "address",
246
+ "internalType": "address payable"
247
+ }
248
+ ],
249
+ "stateMutability": "view"
250
+ },
251
+ {
252
+ "type": "event",
253
+ "name": "LogMessage",
254
+ "inputs": [
255
+ {
256
+ "name": "sender",
257
+ "type": "address",
258
+ "indexed": true,
259
+ "internalType": "address"
260
+ },
261
+ {
262
+ "name": "agentAddress",
263
+ "type": "address",
264
+ "indexed": true,
265
+ "internalType": "address"
266
+ },
267
+ {
268
+ "name": "message",
269
+ "type": "bytes",
270
+ "indexed": false,
271
+ "internalType": "bytes"
272
+ },
273
+ {
274
+ "name": "value",
275
+ "type": "uint256",
276
+ "indexed": false,
277
+ "internalType": "uint256"
278
+ }
279
+ ],
280
+ "anonymous": false
281
+ },
282
+ {
283
+ "type": "event",
284
+ "name": "OwnershipTransferred",
285
+ "inputs": [
286
+ {
287
+ "name": "previousOwner",
288
+ "type": "address",
289
+ "indexed": true,
290
+ "internalType": "address"
291
+ },
292
+ {
293
+ "name": "newOwner",
294
+ "type": "address",
295
+ "indexed": true,
296
+ "internalType": "address"
297
+ }
298
+ ],
299
+ "anonymous": false
300
+ },
301
+ {
302
+ "type": "error",
303
+ "name": "MessageNotSentByAgent",
304
+ "inputs": []
305
+ },
306
+ {
307
+ "type": "error",
308
+ "name": "OwnableInvalidOwner",
309
+ "inputs": [
310
+ {
311
+ "name": "owner",
312
+ "type": "address",
313
+ "internalType": "address"
314
+ }
315
+ ]
316
+ },
317
+ {
318
+ "type": "error",
319
+ "name": "OwnableUnauthorizedAccount",
320
+ "inputs": [
321
+ {
322
+ "name": "account",
323
+ "type": "address",
324
+ "internalType": "address"
325
+ }
326
+ ]
327
+ }
328
+ ]
@@ -3,13 +3,17 @@ from pydantic import BaseModel, ConfigDict, Field
3
3
  from prediction_market_agent_tooling.gtypes import HexBytes
4
4
 
5
5
 
6
+ class SeerParentMarket(BaseModel):
7
+ id: HexBytes
8
+
9
+
6
10
  class SeerMarket(BaseModel):
7
11
  model_config = ConfigDict(populate_by_name=True)
8
12
 
9
13
  id: HexBytes
10
14
  title: str = Field(alias="marketName")
11
15
  outcomes: list[str]
12
- parent_market: HexBytes = Field(alias="parentMarket")
16
+ parent_market: SeerParentMarket | None = Field(alias="parentMarket")
13
17
  wrapped_tokens: list[HexBytes] = Field(alias="wrappedTokens")
14
18
 
15
19
 
@@ -47,7 +47,7 @@ class SeerSubgraphHandler(BaseSubgraphHandler):
47
47
  markets_field.creator,
48
48
  markets_field.marketName,
49
49
  markets_field.outcomes,
50
- markets_field.parentMarket,
50
+ markets_field.parentMarket.id,
51
51
  markets_field.finalizeTs,
52
52
  markets_field.wrappedTokens,
53
53
  ]
@@ -18,6 +18,8 @@ from prediction_market_agent_tooling.gtypes import (
18
18
  TxReceipt,
19
19
  Wei,
20
20
  )
21
+ from prediction_market_agent_tooling.tools.data_models import MessageContainer
22
+ from prediction_market_agent_tooling.tools.hexbytes_custom import HexBytes
21
23
  from prediction_market_agent_tooling.tools.utils import DatetimeUTC, should_not_happen
22
24
  from prediction_market_agent_tooling.tools.web3_utils import (
23
25
  call_function_on_contract,
@@ -533,6 +535,88 @@ class DebuggingContract(ContractOnGnosisChain):
533
535
  )
534
536
 
535
537
 
538
+ class AgentCommunicationContract(ContractOnGnosisChain):
539
+ # Contract ABI taken from built https://github.com/gnosis/labs-contracts.
540
+ abi: ABI = abi_field_validator(
541
+ os.path.join(
542
+ os.path.dirname(os.path.realpath(__file__)),
543
+ "../abis/agentcommunication.abi.json",
544
+ )
545
+ )
546
+
547
+ address: ChecksumAddress = Web3.to_checksum_address(
548
+ "0xd422e0059ed819e8d792af936da206878188e34f"
549
+ )
550
+
551
+ def count_unseen_messages(
552
+ self,
553
+ agent_address: ChecksumAddress,
554
+ web3: Web3 | None = None,
555
+ ) -> int:
556
+ unseen_message_count: int = self.call(
557
+ "countMessages", function_params=[agent_address], web3=web3
558
+ )
559
+ return unseen_message_count
560
+
561
+ def get_at_index(
562
+ self,
563
+ agent_address: ChecksumAddress,
564
+ idx: int,
565
+ web3: Web3 | None = None,
566
+ ) -> MessageContainer:
567
+ message_container_raw: t.Tuple[t.Any] = self.call(
568
+ "getAtIndex", function_params=[agent_address, idx], web3=web3
569
+ )
570
+ return MessageContainer.from_tuple(message_container_raw)
571
+
572
+ def pop_message(
573
+ self,
574
+ api_keys: APIKeys,
575
+ agent_address: ChecksumAddress,
576
+ web3: Web3 | None = None,
577
+ ) -> MessageContainer:
578
+ """
579
+ Retrieves and removes the first message from the agent's message queue.
580
+
581
+ This method first retrieves the message at the front of the queue without removing it,
582
+ allowing us to return the message content directly. The actual removal of the message
583
+ from the queue is performed by sending a transaction to the contract, which executes
584
+ the `popNextMessage` function. The transaction receipt is not used to obtain the message
585
+ content, as it only contains event data, not the returned struct.
586
+ """
587
+
588
+ # Peek first element before popping.
589
+ message_container = self.get_at_index(
590
+ agent_address=agent_address, idx=0, web3=web3
591
+ )
592
+
593
+ # Next, pop that element and discard the transaction receipt.
594
+ self.send(
595
+ api_keys=api_keys,
596
+ function_name="popNextMessage",
597
+ function_params=[agent_address],
598
+ web3=web3,
599
+ )
600
+
601
+ return message_container
602
+
603
+ def send_message(
604
+ self,
605
+ api_keys: APIKeys,
606
+ agent_address: ChecksumAddress,
607
+ message: HexBytes,
608
+ amount_wei: Wei,
609
+ web3: Web3 | None = None,
610
+ ) -> TxReceipt:
611
+ return self.send_with_value(
612
+ api_keys=api_keys,
613
+ function_name="sendMessage",
614
+ amount_wei=amount_wei,
615
+ function_params=[agent_address, message],
616
+ web3=web3,
617
+ )
618
+
619
+
536
620
  def contract_implements_function(
537
621
  contract_address: ChecksumAddress,
538
622
  function_name: str,
@@ -0,0 +1,23 @@
1
+ import typing as t
2
+
3
+ from pydantic import BaseModel, ConfigDict, Field
4
+
5
+ from prediction_market_agent_tooling.gtypes import ChecksumAddress, HexBytes, Wei
6
+
7
+
8
+ # Taken from https://github.com/gnosis/labs-contracts/blob/main/src/NFT/DoubleEndedStructQueue.sol
9
+ class MessageContainer(BaseModel):
10
+ model_config = ConfigDict(populate_by_name=True)
11
+ sender: ChecksumAddress
12
+ recipient: ChecksumAddress = Field(alias="agentAddress")
13
+ message: HexBytes
14
+ value: Wei
15
+
16
+ @staticmethod
17
+ def from_tuple(values: tuple[t.Any, ...]) -> "MessageContainer":
18
+ return MessageContainer(
19
+ sender=values[0],
20
+ recipient=values[1],
21
+ message=HexBytes(values[2]),
22
+ value=values[3],
23
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.57.7
3
+ Version: 0.57.9
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.12
@@ -1,3 +1,4 @@
1
+ prediction_market_agent_tooling/abis/agentcommunication.abi.json,sha256=rTYxzN-veBbBJ-M2JL--7dRQSS6yWRhiQ1lGvWe_Wrg,9781
1
2
  prediction_market_agent_tooling/abis/debuggingcontract.abi.json,sha256=KdkCWmif_WO421RFKhc03kGJiccFqsxsZNrgCd8EH_4,571
2
3
  prediction_market_agent_tooling/abis/depositablewrapper_erc20.abi.json,sha256=m0Wk3uQyLM8apWRRvX4d3u1d77bWVuXfV38D-aV48t0,4612
3
4
  prediction_market_agent_tooling/abis/erc20.abi.json,sha256=b8t6tPUhjBo5dHFq8ipsK-ih_g29dOTbWI0GBZiEWL8,3685
@@ -56,8 +57,8 @@ prediction_market_agent_tooling/markets/polymarket/data_models.py,sha256=Fd5PI5y
56
57
  prediction_market_agent_tooling/markets/polymarket/data_models_web.py,sha256=VZhVccTApygSKMmy6Au2G02JCJOKJnR_oVeKlaesuSg,12548
57
58
  prediction_market_agent_tooling/markets/polymarket/polymarket.py,sha256=NRoZK71PtH8kkangMqme7twcAXhRJSSabbmOir-UnAI,3418
58
59
  prediction_market_agent_tooling/markets/polymarket/utils.py,sha256=DImFxeMg8lTfsEDZ8FavndW38TfUsCkawcVGnucsuGo,2029
59
- prediction_market_agent_tooling/markets/seer/data_models.py,sha256=2f6DOXhGerYbTSk5vUvw_y87TcUxOtSfca8-Et7imtU,643
60
- prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py,sha256=Jola8AxmNDljBCzl6Gvjb9qH75Y7D5dAwbdZl_jndN8,5478
60
+ prediction_market_agent_tooling/markets/seer/data_models.py,sha256=afbwmwGJXUw-F7SE3OgL4ClpXp5yHs5v1Ae7xlFgJdQ,712
61
+ prediction_market_agent_tooling/markets/seer/seer_subgraph_handler.py,sha256=gVzmLhN9YQdmeYVNAwdZ4_t_bND09ioIJOmXnb8UOvo,5481
61
62
  prediction_market_agent_tooling/monitor/financial_metrics/financial_metrics.py,sha256=fjIgjDIx5MhH5mwf7S0cspLOOSU3elYLhGYoIiM26mU,2746
62
63
  prediction_market_agent_tooling/monitor/markets/manifold.py,sha256=TS4ERwTfQnot8dhekNyVNhJYf5ysYsjF-9v5_kM3aVI,3334
63
64
  prediction_market_agent_tooling/monitor/markets/metaculus.py,sha256=LOnyWWBFdg10-cTWdb76nOsNjDloO8OfMT85GBzRCFI,1455
@@ -76,9 +77,10 @@ prediction_market_agent_tooling/tools/betting_strategies/utils.py,sha256=kpIb-ci
76
77
  prediction_market_agent_tooling/tools/caches/db_cache.py,sha256=aafau_n_AUbLIwkyIRiTPgKB0dmM0767mSqyPDLF2A4,10576
77
78
  prediction_market_agent_tooling/tools/caches/inmemory_cache.py,sha256=ZW5iI5rmjqeAebu5T7ftRnlkxiL02IC-MxCfDB80x7w,1506
78
79
  prediction_market_agent_tooling/tools/caches/serializers.py,sha256=upSXN5__rmRlzJ6tv1h7FodKzJu9eCkFrN_zeuwroJM,2151
79
- prediction_market_agent_tooling/tools/contract.py,sha256=tJHwbDXRRRS7g-vIzqfYTOPQBcU5lqb9o_FF9OECZQ8,22941
80
+ prediction_market_agent_tooling/tools/contract.py,sha256=8aHDOCSya8G-0IugM7efcdBKTFkwyUQwuiHWwTKfNhQ,25796
80
81
  prediction_market_agent_tooling/tools/costs.py,sha256=EaAJ7v9laD4VEV3d8B44M4u3_oEO_H16jRVCdoZ93Uw,954
81
82
  prediction_market_agent_tooling/tools/custom_exceptions.py,sha256=Fh8z1fbwONvP4-j7AmV_PuEcoqb6-QXa9PJ9m7guMcM,93
83
+ prediction_market_agent_tooling/tools/data_models.py,sha256=jDQ7FU0QQhXlcgJh5VZZGwDTYP2OPAqKPHZFewCPAUY,732
82
84
  prediction_market_agent_tooling/tools/datetime_utc.py,sha256=2JSWF7AXQnv04_D_cu9Vmdkq0TWmGJ1QcK9AeqrA-U8,2765
83
85
  prediction_market_agent_tooling/tools/db/db_manager.py,sha256=GtzHH1NLl8HwqC8Z7s6eTlIQXuV0blxfaV2PeQrBnfQ,3013
84
86
  prediction_market_agent_tooling/tools/google_utils.py,sha256=t3_UEEvKX3L0biSIQ560GdRbllQ6eprhK_upE243A-0,3185
@@ -104,8 +106,8 @@ prediction_market_agent_tooling/tools/tavily/tavily_search.py,sha256=Kw2mXNkMTYT
104
106
  prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
105
107
  prediction_market_agent_tooling/tools/utils.py,sha256=WvuUCHgMCiMq8_wMm5PHNwvLhcdDk2zGKaAM8OUC-qY,6438
106
108
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=wqUDCed3iNrn1Wao1iwGN6tzIrhpzrTRj319wlveJEo,12275
107
- prediction_market_agent_tooling-0.57.7.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
108
- prediction_market_agent_tooling-0.57.7.dist-info/METADATA,sha256=dDVW3NpNlZdOWksAXIUHFFynWSvxbA_kZXffQ-Af1Ys,8188
109
- prediction_market_agent_tooling-0.57.7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
110
- prediction_market_agent_tooling-0.57.7.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
111
- prediction_market_agent_tooling-0.57.7.dist-info/RECORD,,
109
+ prediction_market_agent_tooling-0.57.9.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
110
+ prediction_market_agent_tooling-0.57.9.dist-info/METADATA,sha256=jUI2ndFGWKzpN_w_39bWU_KUdnGyrXZs3a9k0jfju1M,8188
111
+ prediction_market_agent_tooling-0.57.9.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
112
+ prediction_market_agent_tooling-0.57.9.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
113
+ prediction_market_agent_tooling-0.57.9.dist-info/RECORD,,