agent0-sdk 0.31__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,497 @@
1
+ """
2
+ Smart contract ABIs and interfaces for ERC-8004.
3
+ """
4
+
5
+ from typing import Dict, List, Any
6
+
7
+ # ERC-721 ABI (minimal required functions)
8
+ ERC721_ABI = [
9
+ {
10
+ "inputs": [{"internalType": "uint256", "name": "tokenId", "type": "uint256"}],
11
+ "name": "ownerOf",
12
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
13
+ "stateMutability": "view",
14
+ "type": "function"
15
+ },
16
+ {
17
+ "inputs": [
18
+ {"internalType": "address", "name": "owner", "type": "address"},
19
+ {"internalType": "address", "name": "operator", "type": "address"}
20
+ ],
21
+ "name": "isApprovedForAll",
22
+ "outputs": [{"internalType": "bool", "name": "", "type": "bool"}],
23
+ "stateMutability": "view",
24
+ "type": "function"
25
+ },
26
+ {
27
+ "inputs": [{"internalType": "uint256", "name": "tokenId", "type": "uint256"}],
28
+ "name": "getApproved",
29
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
30
+ "stateMutability": "view",
31
+ "type": "function"
32
+ },
33
+ {
34
+ "inputs": [
35
+ {"internalType": "address", "name": "from", "type": "address"},
36
+ {"internalType": "address", "name": "to", "type": "address"},
37
+ {"internalType": "uint256", "name": "tokenId", "type": "uint256"}
38
+ ],
39
+ "name": "transferFrom",
40
+ "outputs": [],
41
+ "stateMutability": "nonpayable",
42
+ "type": "function"
43
+ },
44
+ {
45
+ "inputs": [
46
+ {"internalType": "address", "name": "to", "type": "address"},
47
+ {"internalType": "bool", "name": "approved", "type": "bool"}
48
+ ],
49
+ "name": "setApprovalForAll",
50
+ "outputs": [],
51
+ "stateMutability": "nonpayable",
52
+ "type": "function"
53
+ },
54
+ {
55
+ "inputs": [
56
+ {"internalType": "uint256", "name": "tokenId", "type": "uint256"},
57
+ {"internalType": "address", "name": "to", "type": "address"}
58
+ ],
59
+ "name": "approve",
60
+ "outputs": [],
61
+ "stateMutability": "nonpayable",
62
+ "type": "function"
63
+ }
64
+ ]
65
+
66
+ # ERC-721 URI Storage ABI
67
+ ERC721_URI_STORAGE_ABI = [
68
+ {
69
+ "inputs": [{"internalType": "uint256", "name": "tokenId", "type": "uint256"}],
70
+ "name": "tokenURI",
71
+ "outputs": [{"internalType": "string", "name": "", "type": "string"}],
72
+ "stateMutability": "view",
73
+ "type": "function"
74
+ },
75
+ {
76
+ "inputs": [
77
+ {"internalType": "uint256", "name": "tokenId", "type": "uint256"},
78
+ {"internalType": "string", "name": "_tokenURI", "type": "string"}
79
+ ],
80
+ "name": "setTokenURI",
81
+ "outputs": [],
82
+ "stateMutability": "nonpayable",
83
+ "type": "function"
84
+ }
85
+ ]
86
+
87
+ # Identity Registry ABI
88
+ IDENTITY_REGISTRY_ABI = [
89
+ # ERC-721 functions
90
+ *ERC721_ABI,
91
+ *ERC721_URI_STORAGE_ABI,
92
+
93
+ # Identity Registry specific functions
94
+ {
95
+ "inputs": [],
96
+ "name": "register",
97
+ "outputs": [{"internalType": "uint256", "name": "agentId", "type": "uint256"}],
98
+ "stateMutability": "nonpayable",
99
+ "type": "function"
100
+ },
101
+ {
102
+ "inputs": [{"internalType": "string", "name": "tokenUri", "type": "string"}],
103
+ "name": "register",
104
+ "outputs": [{"internalType": "uint256", "name": "agentId", "type": "uint256"}],
105
+ "stateMutability": "nonpayable",
106
+ "type": "function"
107
+ },
108
+ {
109
+ "inputs": [
110
+ {"internalType": "string", "name": "tokenUri", "type": "string"},
111
+ {
112
+ "components": [
113
+ {"internalType": "string", "name": "key", "type": "string"},
114
+ {"internalType": "bytes", "name": "value", "type": "bytes"}
115
+ ],
116
+ "internalType": "struct IdentityRegistry.MetadataEntry[]",
117
+ "name": "metadata",
118
+ "type": "tuple[]"
119
+ }
120
+ ],
121
+ "name": "register",
122
+ "outputs": [{"internalType": "uint256", "name": "agentId", "type": "uint256"}],
123
+ "stateMutability": "nonpayable",
124
+ "type": "function"
125
+ },
126
+ {
127
+ "inputs": [
128
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
129
+ {"internalType": "string", "name": "key", "type": "string"}
130
+ ],
131
+ "name": "getMetadata",
132
+ "outputs": [{"internalType": "bytes", "name": "", "type": "bytes"}],
133
+ "stateMutability": "view",
134
+ "type": "function"
135
+ },
136
+ {
137
+ "inputs": [
138
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
139
+ {"internalType": "string", "name": "key", "type": "string"},
140
+ {"internalType": "bytes", "name": "value", "type": "bytes"}
141
+ ],
142
+ "name": "setMetadata",
143
+ "outputs": [],
144
+ "stateMutability": "nonpayable",
145
+ "type": "function"
146
+ },
147
+ {
148
+ "inputs": [
149
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
150
+ {"internalType": "string", "name": "newUri", "type": "string"}
151
+ ],
152
+ "name": "setAgentUri",
153
+ "outputs": [],
154
+ "stateMutability": "nonpayable",
155
+ "type": "function"
156
+ },
157
+
158
+ # Events
159
+ {
160
+ "anonymous": False,
161
+ "inputs": [
162
+ {"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
163
+ {"indexed": False, "internalType": "string", "name": "tokenURI", "type": "string"},
164
+ {"indexed": True, "internalType": "address", "name": "owner", "type": "address"}
165
+ ],
166
+ "name": "Registered",
167
+ "type": "event"
168
+ },
169
+ {
170
+ "anonymous": False,
171
+ "inputs": [
172
+ {"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
173
+ {"indexed": True, "internalType": "string", "name": "indexedKey", "type": "string"},
174
+ {"indexed": False, "internalType": "string", "name": "key", "type": "string"},
175
+ {"indexed": False, "internalType": "bytes", "name": "value", "type": "bytes"}
176
+ ],
177
+ "name": "MetadataSet",
178
+ "type": "event"
179
+ }
180
+ ]
181
+
182
+ # Reputation Registry ABI
183
+ REPUTATION_REGISTRY_ABI = [
184
+ {
185
+ "inputs": [],
186
+ "name": "getIdentityRegistry",
187
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
188
+ "stateMutability": "view",
189
+ "type": "function"
190
+ },
191
+ {
192
+ "inputs": [
193
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
194
+ {"internalType": "uint8", "name": "score", "type": "uint8"},
195
+ {"internalType": "bytes32", "name": "tag1", "type": "bytes32"},
196
+ {"internalType": "bytes32", "name": "tag2", "type": "bytes32"},
197
+ {"internalType": "string", "name": "feedbackUri", "type": "string"},
198
+ {"internalType": "bytes32", "name": "feedbackHash", "type": "bytes32"},
199
+ {"internalType": "bytes", "name": "feedbackAuth", "type": "bytes"}
200
+ ],
201
+ "name": "giveFeedback",
202
+ "outputs": [],
203
+ "stateMutability": "nonpayable",
204
+ "type": "function"
205
+ },
206
+ {
207
+ "inputs": [
208
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
209
+ {"internalType": "uint64", "name": "feedbackIndex", "type": "uint64"}
210
+ ],
211
+ "name": "revokeFeedback",
212
+ "outputs": [],
213
+ "stateMutability": "nonpayable",
214
+ "type": "function"
215
+ },
216
+ {
217
+ "inputs": [
218
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
219
+ {"internalType": "address", "name": "clientAddress", "type": "address"},
220
+ {"internalType": "uint64", "name": "feedbackIndex", "type": "uint64"},
221
+ {"internalType": "string", "name": "responseUri", "type": "string"},
222
+ {"internalType": "bytes32", "name": "responseHash", "type": "bytes32"}
223
+ ],
224
+ "name": "appendResponse",
225
+ "outputs": [],
226
+ "stateMutability": "nonpayable",
227
+ "type": "function"
228
+ },
229
+ {
230
+ "inputs": [
231
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
232
+ {"internalType": "address", "name": "clientAddress", "type": "address"}
233
+ ],
234
+ "name": "getLastIndex",
235
+ "outputs": [{"internalType": "uint64", "name": "", "type": "uint64"}],
236
+ "stateMutability": "view",
237
+ "type": "function"
238
+ },
239
+ {
240
+ "inputs": [
241
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
242
+ {"internalType": "address", "name": "clientAddress", "type": "address"},
243
+ {"internalType": "uint64", "name": "index", "type": "uint64"}
244
+ ],
245
+ "name": "readFeedback",
246
+ "outputs": [
247
+ {"internalType": "uint8", "name": "score", "type": "uint8"},
248
+ {"internalType": "bytes32", "name": "tag1", "type": "bytes32"},
249
+ {"internalType": "bytes32", "name": "tag2", "type": "bytes32"},
250
+ {"internalType": "bool", "name": "isRevoked", "type": "bool"}
251
+ ],
252
+ "stateMutability": "view",
253
+ "type": "function"
254
+ },
255
+ {
256
+ "inputs": [
257
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
258
+ {"internalType": "address[]", "name": "clientAddresses", "type": "address[]"},
259
+ {"internalType": "bytes32", "name": "tag1", "type": "bytes32"},
260
+ {"internalType": "bytes32", "name": "tag2", "type": "bytes32"}
261
+ ],
262
+ "name": "getSummary",
263
+ "outputs": [
264
+ {"internalType": "uint64", "name": "count", "type": "uint64"},
265
+ {"internalType": "uint8", "name": "averageScore", "type": "uint8"}
266
+ ],
267
+ "stateMutability": "view",
268
+ "type": "function"
269
+ },
270
+ {
271
+ "inputs": [
272
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
273
+ {"internalType": "address[]", "name": "clientAddresses", "type": "address[]"},
274
+ {"internalType": "bytes32", "name": "tag1", "type": "bytes32"},
275
+ {"internalType": "bytes32", "name": "tag2", "type": "bytes32"},
276
+ {"internalType": "bool", "name": "includeRevoked", "type": "bool"}
277
+ ],
278
+ "name": "readAllFeedback",
279
+ "outputs": [
280
+ {"internalType": "address[]", "name": "clients", "type": "address[]"},
281
+ {"internalType": "uint8[]", "name": "scores", "type": "uint8[]"},
282
+ {"internalType": "bytes32[]", "name": "tag1s", "type": "bytes32[]"},
283
+ {"internalType": "bytes32[]", "name": "tag2s", "type": "bytes32[]"},
284
+ {"internalType": "bool[]", "name": "revokedStatuses", "type": "bool[]"}
285
+ ],
286
+ "stateMutability": "view",
287
+ "type": "function"
288
+ },
289
+ {
290
+ "inputs": [{"internalType": "uint256", "name": "agentId", "type": "uint256"}],
291
+ "name": "getClients",
292
+ "outputs": [{"internalType": "address[]", "name": "", "type": "address[]"}],
293
+ "stateMutability": "view",
294
+ "type": "function"
295
+ },
296
+ {
297
+ "inputs": [
298
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
299
+ {"internalType": "address", "name": "clientAddress", "type": "address"},
300
+ {"internalType": "uint64", "name": "feedbackIndex", "type": "uint64"},
301
+ {"internalType": "address[]", "name": "responders", "type": "address[]"}
302
+ ],
303
+ "name": "getResponseCount",
304
+ "outputs": [{"internalType": "uint64", "name": "count", "type": "uint64"}],
305
+ "stateMutability": "view",
306
+ "type": "function"
307
+ },
308
+
309
+ # Events
310
+ {
311
+ "anonymous": False,
312
+ "inputs": [
313
+ {"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
314
+ {"indexed": True, "internalType": "address", "name": "clientAddress", "type": "address"},
315
+ {"indexed": False, "internalType": "uint8", "name": "score", "type": "uint8"},
316
+ {"indexed": True, "internalType": "bytes32", "name": "tag1", "type": "bytes32"},
317
+ {"indexed": False, "internalType": "bytes32", "name": "tag2", "type": "bytes32"},
318
+ {"indexed": False, "internalType": "string", "name": "feedbackUri", "type": "string"},
319
+ {"indexed": False, "internalType": "bytes32", "name": "feedbackHash", "type": "bytes32"}
320
+ ],
321
+ "name": "NewFeedback",
322
+ "type": "event"
323
+ },
324
+ {
325
+ "anonymous": False,
326
+ "inputs": [
327
+ {"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
328
+ {"indexed": True, "internalType": "address", "name": "clientAddress", "type": "address"},
329
+ {"indexed": True, "internalType": "uint64", "name": "feedbackIndex", "type": "uint64"}
330
+ ],
331
+ "name": "FeedbackRevoked",
332
+ "type": "event"
333
+ },
334
+ {
335
+ "anonymous": False,
336
+ "inputs": [
337
+ {"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
338
+ {"indexed": True, "internalType": "address", "name": "clientAddress", "type": "address"},
339
+ {"indexed": False, "internalType": "uint64", "name": "feedbackIndex", "type": "uint64"},
340
+ {"indexed": True, "internalType": "address", "name": "responder", "type": "address"},
341
+ {"indexed": False, "internalType": "string", "name": "responseUri", "type": "string"},
342
+ {"indexed": False, "internalType": "bytes32", "name": "responseHash", "type": "bytes32"}
343
+ ],
344
+ "name": "ResponseAppended",
345
+ "type": "event"
346
+ }
347
+ ]
348
+
349
+ # Validation Registry ABI
350
+ VALIDATION_REGISTRY_ABI = [
351
+ {
352
+ "inputs": [],
353
+ "name": "getIdentityRegistry",
354
+ "outputs": [{"internalType": "address", "name": "", "type": "address"}],
355
+ "stateMutability": "view",
356
+ "type": "function"
357
+ },
358
+ {
359
+ "inputs": [
360
+ {"internalType": "address", "name": "validatorAddress", "type": "address"},
361
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
362
+ {"internalType": "string", "name": "requestUri", "type": "string"},
363
+ {"internalType": "bytes32", "name": "requestHash", "type": "bytes32"}
364
+ ],
365
+ "name": "validationRequest",
366
+ "outputs": [],
367
+ "stateMutability": "nonpayable",
368
+ "type": "function"
369
+ },
370
+ {
371
+ "inputs": [
372
+ {"internalType": "bytes32", "name": "requestHash", "type": "bytes32"},
373
+ {"internalType": "uint8", "name": "response", "type": "uint8"},
374
+ {"internalType": "string", "name": "responseUri", "type": "string"},
375
+ {"internalType": "bytes32", "name": "responseHash", "type": "bytes32"},
376
+ {"internalType": "bytes32", "name": "tag", "type": "bytes32"}
377
+ ],
378
+ "name": "validationResponse",
379
+ "outputs": [],
380
+ "stateMutability": "nonpayable",
381
+ "type": "function"
382
+ },
383
+ {
384
+ "inputs": [{"internalType": "bytes32", "name": "requestHash", "type": "bytes32"}],
385
+ "name": "getValidationStatus",
386
+ "outputs": [
387
+ {"internalType": "address", "name": "validatorAddress", "type": "address"},
388
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
389
+ {"internalType": "uint8", "name": "response", "type": "uint8"},
390
+ {"internalType": "bytes32", "name": "responseHash", "type": "bytes32"},
391
+ {"internalType": "bytes32", "name": "tag", "type": "bytes32"},
392
+ {"internalType": "uint256", "name": "lastUpdate", "type": "uint256"}
393
+ ],
394
+ "stateMutability": "view",
395
+ "type": "function"
396
+ },
397
+ {
398
+ "inputs": [
399
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
400
+ {"internalType": "address[]", "name": "validatorAddresses", "type": "address[]"},
401
+ {"internalType": "bytes32", "name": "tag", "type": "bytes32"}
402
+ ],
403
+ "name": "getSummary",
404
+ "outputs": [
405
+ {"internalType": "uint64", "name": "count", "type": "uint64"},
406
+ {"internalType": "uint8", "name": "avgResponse", "type": "uint8"}
407
+ ],
408
+ "stateMutability": "view",
409
+ "type": "function"
410
+ },
411
+ {
412
+ "inputs": [{"internalType": "uint256", "name": "agentId", "type": "uint256"}],
413
+ "name": "getAgentValidations",
414
+ "outputs": [{"internalType": "bytes32[]", "name": "", "type": "bytes32[]"}],
415
+ "stateMutability": "view",
416
+ "type": "function"
417
+ },
418
+ {
419
+ "inputs": [{"internalType": "address", "name": "validatorAddress", "type": "address"}],
420
+ "name": "getValidatorRequests",
421
+ "outputs": [{"internalType": "bytes32[]", "name": "", "type": "bytes32[]"}],
422
+ "stateMutability": "view",
423
+ "type": "function"
424
+ },
425
+ {
426
+ "inputs": [{"internalType": "bytes32", "name": "", "type": "bytes32"}],
427
+ "name": "validations",
428
+ "outputs": [
429
+ {"internalType": "address", "name": "validatorAddress", "type": "address"},
430
+ {"internalType": "uint256", "name": "agentId", "type": "uint256"},
431
+ {"internalType": "uint8", "name": "response", "type": "uint8"},
432
+ {"internalType": "bytes32", "name": "responseHash", "type": "bytes32"},
433
+ {"internalType": "bytes32", "name": "tag", "type": "bytes32"},
434
+ {"internalType": "uint256", "name": "lastUpdate", "type": "uint256"}
435
+ ],
436
+ "stateMutability": "view",
437
+ "type": "function"
438
+ },
439
+
440
+ # Events
441
+ {
442
+ "anonymous": False,
443
+ "inputs": [
444
+ {"indexed": True, "internalType": "address", "name": "validatorAddress", "type": "address"},
445
+ {"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
446
+ {"indexed": False, "internalType": "string", "name": "requestUri", "type": "string"},
447
+ {"indexed": True, "internalType": "bytes32", "name": "requestHash", "type": "bytes32"}
448
+ ],
449
+ "name": "ValidationRequest",
450
+ "type": "event"
451
+ },
452
+ {
453
+ "anonymous": False,
454
+ "inputs": [
455
+ {"indexed": True, "internalType": "address", "name": "validatorAddress", "type": "address"},
456
+ {"indexed": True, "internalType": "uint256", "name": "agentId", "type": "uint256"},
457
+ {"indexed": True, "internalType": "bytes32", "name": "requestHash", "type": "bytes32"},
458
+ {"indexed": False, "internalType": "uint8", "name": "response", "type": "uint8"},
459
+ {"indexed": False, "internalType": "string", "name": "responseUri", "type": "string"},
460
+ {"indexed": False, "internalType": "bytes32", "name": "responseHash", "type": "bytes32"},
461
+ {"indexed": False, "internalType": "bytes32", "name": "tag", "type": "bytes32"}
462
+ ],
463
+ "name": "ValidationResponse",
464
+ "type": "event"
465
+ }
466
+ ]
467
+
468
+ # Contract registry for different chains
469
+ DEFAULT_REGISTRIES: Dict[int, Dict[str, str]] = {
470
+ 11155111: { # Ethereum Sepolia
471
+ "IDENTITY": "0x8004a6090Cd10A7288092483047B097295Fb8847",
472
+ "REPUTATION": "0x8004B8FD1A363aa02fDC07635C0c5F94f6Af5B7E",
473
+ "VALIDATION": "0x8004CB39f29c09145F24Ad9dDe2A108C1A2cdfC5",
474
+ },
475
+ 84532: { # Base Sepolia
476
+ "IDENTITY": "0x8004AA63c570c570eBF15376c0dB199918BFe9Fb",
477
+ "REPUTATION": "0x8004bd8daB57f14Ed299135749a5CB5c42d341BF",
478
+ "VALIDATION": "0x8004C269D0A5647E51E121FeB226200ECE932d55",
479
+ },
480
+ 80002: { # Polygon Amoy
481
+ "IDENTITY": "0x8004ad19E14B9e0654f73353e8a0B600D46C2898",
482
+ "REPUTATION": "0x8004B12F4C2B42d00c46479e859C92e39044C930",
483
+ "VALIDATION": "0x8004C11C213ff7BaD36489bcBDF947ba5eee289B",
484
+ },
485
+ 59141: { # Linea Sepolia
486
+ "IDENTITY": "0x8004aa7C931bCE1233973a0C6A667f73F66282e7",
487
+ "REPUTATION": "0x8004bd8483b99310df121c46ED8858616b2Bba02",
488
+ "VALIDATION": "0x8004c44d1EFdd699B2A26e781eF7F77c56A9a4EB",
489
+ },
490
+ }
491
+
492
+ # Default subgraph URLs for different chains
493
+ DEFAULT_SUBGRAPH_URLS: Dict[int, str] = {
494
+ 11155111: "https://gateway.thegraph.com/api/00a452ad3cd1900273ea62c1bf283f93/subgraphs/id/6wQRC7geo9XYAhckfmfo8kbMRLeWU8KQd3XsJqFKmZLT", # Ethereum Sepolia
495
+ 84532: "https://gateway.thegraph.com/api/00a452ad3cd1900273ea62c1bf283f93/subgraphs/id/GjQEDgEKqoh5Yc8MUgxoQoRATEJdEiH7HbocfR1aFiHa", # Base Sepolia
496
+ 80002: "https://gateway.thegraph.com/api/00a452ad3cd1900273ea62c1bf283f93/subgraphs/id/2A1JB18r1mF2VNP4QBH4mmxd74kbHoM6xLXC8ABAKf7j", # Polygon Amoy
497
+ }