@perkos/contracts-erc8004 1.0.0 → 1.0.1

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.
package/dist/index.mjs CHANGED
@@ -1,48 +1,63 @@
1
1
  // src/index.ts
2
+ var ValidationStatus = /* @__PURE__ */ ((ValidationStatus2) => {
3
+ ValidationStatus2[ValidationStatus2["None"] = 0] = "None";
4
+ ValidationStatus2[ValidationStatus2["Pending"] = 1] = "Pending";
5
+ ValidationStatus2[ValidationStatus2["Approved"] = 2] = "Approved";
6
+ ValidationStatus2[ValidationStatus2["Rejected"] = 3] = "Rejected";
7
+ ValidationStatus2[ValidationStatus2["Cancelled"] = 4] = "Cancelled";
8
+ return ValidationStatus2;
9
+ })(ValidationStatus || {});
2
10
  var IDENTITY_REGISTRY_ABI = [
3
11
  // Read functions
4
12
  {
5
13
  inputs: [{ name: "agentId", type: "uint256" }],
6
14
  name: "tokenURI",
7
- outputs: [{ name: "", type: "string" }],
15
+ outputs: [{ name: "uri", type: "string" }],
8
16
  stateMutability: "view",
9
17
  type: "function"
10
18
  },
11
19
  {
12
20
  inputs: [{ name: "agentId", type: "uint256" }],
13
21
  name: "ownerOf",
14
- outputs: [{ name: "", type: "address" }],
22
+ outputs: [{ name: "owner", type: "address" }],
15
23
  stateMutability: "view",
16
24
  type: "function"
17
25
  },
18
26
  {
19
27
  inputs: [{ name: "owner", type: "address" }],
20
28
  name: "getAgentsByOwner",
21
- outputs: [{ name: "", type: "uint256[]" }],
29
+ outputs: [{ name: "agentIds", type: "uint256[]" }],
22
30
  stateMutability: "view",
23
31
  type: "function"
24
32
  },
25
33
  {
26
34
  inputs: [],
27
35
  name: "totalAgents",
28
- outputs: [{ name: "", type: "uint256" }],
36
+ outputs: [{ name: "count", type: "uint256" }],
29
37
  stateMutability: "view",
30
38
  type: "function"
31
39
  },
32
40
  {
33
41
  inputs: [],
34
42
  name: "nextAgentId",
35
- outputs: [{ name: "", type: "uint256" }],
43
+ outputs: [{ name: "id", type: "uint256" }],
36
44
  stateMutability: "view",
37
45
  type: "function"
38
46
  },
39
47
  {
40
48
  inputs: [
41
49
  { name: "agentId", type: "uint256" },
42
- { name: "key", type: "string" }
50
+ { name: "metadataKey", type: "string" }
43
51
  ],
44
52
  name: "getMetadata",
45
- outputs: [{ name: "value", type: "bytes" }],
53
+ outputs: [{ name: "metadataValue", type: "string" }],
54
+ stateMutability: "view",
55
+ type: "function"
56
+ },
57
+ {
58
+ inputs: [{ name: "agentId", type: "uint256" }],
59
+ name: "getAgentWallet",
60
+ outputs: [{ name: "wallet", type: "address" }],
46
61
  stateMutability: "view",
47
62
  type: "function"
48
63
  },
@@ -56,13 +71,13 @@ var IDENTITY_REGISTRY_ABI = [
56
71
  // Write functions
57
72
  {
58
73
  inputs: [
59
- { name: "tokenURI_", type: "string" },
74
+ { name: "agentURI", type: "string" },
60
75
  {
61
76
  name: "metadata",
62
77
  type: "tuple[]",
63
78
  components: [
64
79
  { name: "key", type: "string" },
65
- { name: "value", type: "bytes" }
80
+ { name: "value", type: "string" }
66
81
  ]
67
82
  }
68
83
  ],
@@ -72,7 +87,7 @@ var IDENTITY_REGISTRY_ABI = [
72
87
  type: "function"
73
88
  },
74
89
  {
75
- inputs: [{ name: "tokenURI_", type: "string" }],
90
+ inputs: [{ name: "agentURI", type: "string" }],
76
91
  name: "register",
77
92
  outputs: [{ name: "agentId", type: "uint256" }],
78
93
  stateMutability: "nonpayable",
@@ -88,8 +103,18 @@ var IDENTITY_REGISTRY_ABI = [
88
103
  {
89
104
  inputs: [
90
105
  { name: "agentId", type: "uint256" },
91
- { name: "key", type: "string" },
92
- { name: "value", type: "bytes" }
106
+ { name: "newURI", type: "string" }
107
+ ],
108
+ name: "setAgentURI",
109
+ outputs: [],
110
+ stateMutability: "nonpayable",
111
+ type: "function"
112
+ },
113
+ {
114
+ inputs: [
115
+ { name: "agentId", type: "uint256" },
116
+ { name: "metadataKey", type: "string" },
117
+ { name: "metadataValue", type: "string" }
93
118
  ],
94
119
  name: "setMetadata",
95
120
  outputs: [],
@@ -99,9 +124,11 @@ var IDENTITY_REGISTRY_ABI = [
99
124
  {
100
125
  inputs: [
101
126
  { name: "agentId", type: "uint256" },
102
- { name: "tokenURI_", type: "string" }
127
+ { name: "newWallet", type: "address" },
128
+ { name: "deadline", type: "uint256" },
129
+ { name: "signature", type: "bytes" }
103
130
  ],
104
- name: "setTokenURI",
131
+ name: "setAgentWallet",
105
132
  outputs: [],
106
133
  stateMutability: "nonpayable",
107
134
  type: "function"
@@ -111,43 +138,57 @@ var IDENTITY_REGISTRY_ABI = [
111
138
  anonymous: false,
112
139
  inputs: [
113
140
  { indexed: true, name: "agentId", type: "uint256" },
114
- { indexed: false, name: "tokenURI", type: "string" },
141
+ { indexed: false, name: "agentURI", type: "string" },
115
142
  { indexed: true, name: "owner", type: "address" }
116
143
  ],
117
144
  name: "Registered",
118
145
  type: "event"
119
146
  },
147
+ {
148
+ anonymous: false,
149
+ inputs: [
150
+ { indexed: true, name: "agentId", type: "uint256" },
151
+ { indexed: false, name: "newURI", type: "string" },
152
+ { indexed: true, name: "updatedBy", type: "address" }
153
+ ],
154
+ name: "URIUpdated",
155
+ type: "event"
156
+ },
120
157
  {
121
158
  anonymous: false,
122
159
  inputs: [
123
160
  { indexed: true, name: "agentId", type: "uint256" },
124
161
  { indexed: true, name: "indexedKey", type: "string" },
125
- { indexed: false, name: "key", type: "string" },
126
- { indexed: false, name: "value", type: "bytes" }
162
+ { indexed: false, name: "metadataKey", type: "string" },
163
+ { indexed: false, name: "metadataValue", type: "string" }
127
164
  ],
128
165
  name: "MetadataSet",
129
166
  type: "event"
167
+ },
168
+ {
169
+ anonymous: false,
170
+ inputs: [
171
+ { indexed: true, name: "agentId", type: "uint256" },
172
+ { indexed: true, name: "oldWallet", type: "address" },
173
+ { indexed: true, name: "newWallet", type: "address" }
174
+ ],
175
+ name: "AgentWalletUpdated",
176
+ type: "event"
130
177
  }
131
178
  ];
132
179
  var REPUTATION_REGISTRY_ABI = [
133
180
  // Read functions
134
181
  {
135
- inputs: [{ name: "agentId", type: "uint256" }],
182
+ inputs: [
183
+ { name: "agentId", type: "uint256" },
184
+ { name: "clientAddresses", type: "address[]" },
185
+ { name: "tag1", type: "string" },
186
+ { name: "tag2", type: "string" }
187
+ ],
136
188
  name: "getSummary",
137
189
  outputs: [
138
- {
139
- name: "summary",
140
- type: "tuple",
141
- components: [
142
- { name: "totalFeedback", type: "uint256" },
143
- { name: "activeFeedback", type: "uint256" },
144
- { name: "averageRating", type: "int256" },
145
- { name: "positiveCount", type: "uint256" },
146
- { name: "negativeCount", type: "uint256" },
147
- { name: "neutralCount", type: "uint256" },
148
- { name: "lastUpdated", type: "uint256" }
149
- ]
150
- }
190
+ { name: "count", type: "uint64" },
191
+ { name: "averageScore", type: "uint8" }
151
192
  ],
152
193
  stateMutability: "view",
153
194
  type: "function"
@@ -155,67 +196,91 @@ var REPUTATION_REGISTRY_ABI = [
155
196
  {
156
197
  inputs: [
157
198
  { name: "agentId", type: "uint256" },
158
- { name: "index", type: "uint256" }
199
+ { name: "clientAddress", type: "address" },
200
+ { name: "index", type: "uint64" }
159
201
  ],
160
202
  name: "readFeedback",
161
203
  outputs: [
162
- {
163
- name: "feedback",
164
- type: "tuple",
165
- components: [
166
- { name: "client", type: "address" },
167
- { name: "rating", type: "int8" },
168
- { name: "comment", type: "string" },
169
- { name: "timestamp", type: "uint256" },
170
- { name: "revoked", type: "bool" },
171
- { name: "response", type: "string" }
172
- ]
173
- }
204
+ { name: "score", type: "uint8" },
205
+ { name: "tag1", type: "string" },
206
+ { name: "tag2", type: "string" },
207
+ { name: "isRevoked", type: "bool" }
174
208
  ],
175
209
  stateMutability: "view",
176
210
  type: "function"
177
211
  },
178
212
  {
179
- inputs: [{ name: "agentId", type: "uint256" }],
213
+ inputs: [
214
+ { name: "agentId", type: "uint256" },
215
+ { name: "clientAddresses", type: "address[]" },
216
+ { name: "tag1", type: "string" },
217
+ { name: "tag2", type: "string" },
218
+ { name: "includeRevoked", type: "bool" }
219
+ ],
180
220
  name: "readAllFeedback",
181
221
  outputs: [
182
- {
183
- name: "",
184
- type: "tuple[]",
185
- components: [
186
- { name: "client", type: "address" },
187
- { name: "rating", type: "int8" },
188
- { name: "comment", type: "string" },
189
- { name: "timestamp", type: "uint256" },
190
- { name: "revoked", type: "bool" },
191
- { name: "response", type: "string" }
192
- ]
193
- }
222
+ { name: "clients", type: "address[]" },
223
+ { name: "scores", type: "uint8[]" },
224
+ { name: "tag1s", type: "string[]" },
225
+ { name: "tag2s", type: "string[]" },
226
+ { name: "revoked", type: "bool[]" }
194
227
  ],
195
228
  stateMutability: "view",
196
229
  type: "function"
197
230
  },
198
231
  {
199
- inputs: [{ name: "agentId", type: "uint256" }],
232
+ inputs: [
233
+ { name: "agentId", type: "uint256" },
234
+ { name: "clientAddress", type: "address" }
235
+ ],
200
236
  name: "getLastIndex",
201
- outputs: [{ name: "lastIndex", type: "uint256" }],
237
+ outputs: [{ name: "lastIndex", type: "uint64" }],
202
238
  stateMutability: "view",
203
239
  type: "function"
204
240
  },
205
241
  {
206
242
  inputs: [{ name: "agentId", type: "uint256" }],
207
243
  name: "getClients",
208
- outputs: [{ name: "", type: "address[]" }],
244
+ outputs: [{ name: "clients", type: "address[]" }],
245
+ stateMutability: "view",
246
+ type: "function"
247
+ },
248
+ {
249
+ inputs: [
250
+ { name: "agentId", type: "uint256" },
251
+ { name: "clientAddress", type: "address" },
252
+ { name: "index", type: "uint64" }
253
+ ],
254
+ name: "getFeedbackDetails",
255
+ outputs: [
256
+ {
257
+ name: "feedback",
258
+ type: "tuple",
259
+ components: [
260
+ { name: "client", type: "address" },
261
+ { name: "score", type: "uint8" },
262
+ { name: "tag1", type: "string" },
263
+ { name: "tag2", type: "string" },
264
+ { name: "endpoint", type: "string" },
265
+ { name: "feedbackURI", type: "string" },
266
+ { name: "feedbackHash", type: "bytes32" },
267
+ { name: "timestamp", type: "uint256" },
268
+ { name: "isRevoked", type: "bool" },
269
+ { name: "responseURI", type: "string" },
270
+ { name: "responseHash", type: "bytes32" }
271
+ ]
272
+ }
273
+ ],
209
274
  stateMutability: "view",
210
275
  type: "function"
211
276
  },
212
277
  {
213
278
  inputs: [
214
279
  { name: "agentId", type: "uint256" },
215
- { name: "client", type: "address" }
280
+ { name: "clientAddress", type: "address" }
216
281
  ],
217
- name: "hasClientFeedback",
218
- outputs: [{ name: "hasFeedback", type: "bool" }],
282
+ name: "getClientFeedbackCount",
283
+ outputs: [{ name: "", type: "uint256" }],
219
284
  stateMutability: "view",
220
285
  type: "function"
221
286
  },
@@ -237,40 +302,32 @@ var REPUTATION_REGISTRY_ABI = [
237
302
  {
238
303
  inputs: [
239
304
  { name: "agentId", type: "uint256" },
240
- { name: "rating", type: "int8" },
241
- { name: "comment", type: "string" },
242
- {
243
- name: "auth",
244
- type: "tuple",
245
- components: [
246
- { name: "agentId", type: "uint256" },
247
- { name: "client", type: "address" },
248
- { name: "nonce", type: "uint256" },
249
- { name: "deadline", type: "uint256" }
250
- ]
251
- },
252
- { name: "signature", type: "bytes" }
305
+ { name: "score", type: "uint8" },
306
+ { name: "tag1", type: "string" },
307
+ { name: "tag2", type: "string" },
308
+ { name: "endpoint", type: "string" },
309
+ { name: "feedbackURI", type: "string" },
310
+ { name: "feedbackHash", type: "bytes32" }
253
311
  ],
254
312
  name: "giveFeedback",
255
- outputs: [{ name: "index", type: "uint256" }],
313
+ outputs: [],
256
314
  stateMutability: "nonpayable",
257
315
  type: "function"
258
316
  },
259
317
  {
260
318
  inputs: [
261
319
  { name: "agentId", type: "uint256" },
262
- { name: "rating", type: "int8" },
263
- { name: "comment", type: "string" }
320
+ { name: "score", type: "uint8" }
264
321
  ],
265
322
  name: "giveFeedback",
266
- outputs: [{ name: "index", type: "uint256" }],
323
+ outputs: [],
267
324
  stateMutability: "nonpayable",
268
325
  type: "function"
269
326
  },
270
327
  {
271
328
  inputs: [
272
329
  { name: "agentId", type: "uint256" },
273
- { name: "index", type: "uint256" }
330
+ { name: "feedbackIndex", type: "uint64" }
274
331
  ],
275
332
  name: "revokeFeedback",
276
333
  outputs: [],
@@ -280,8 +337,10 @@ var REPUTATION_REGISTRY_ABI = [
280
337
  {
281
338
  inputs: [
282
339
  { name: "agentId", type: "uint256" },
283
- { name: "index", type: "uint256" },
284
- { name: "response", type: "string" }
340
+ { name: "clientAddress", type: "address" },
341
+ { name: "feedbackIndex", type: "uint64" },
342
+ { name: "responseURI", type: "string" },
343
+ { name: "responseHash", type: "bytes32" }
285
344
  ],
286
345
  name: "appendResponse",
287
346
  outputs: [],
@@ -293,20 +352,23 @@ var REPUTATION_REGISTRY_ABI = [
293
352
  anonymous: false,
294
353
  inputs: [
295
354
  { indexed: true, name: "agentId", type: "uint256" },
296
- { indexed: true, name: "client", type: "address" },
297
- { indexed: true, name: "index", type: "uint256" },
298
- { indexed: false, name: "rating", type: "int8" },
299
- { indexed: false, name: "comment", type: "string" }
300
- ],
301
- name: "FeedbackGiven",
355
+ { indexed: true, name: "clientAddress", type: "address" },
356
+ { indexed: false, name: "score", type: "uint8" },
357
+ { indexed: true, name: "tag1", type: "string" },
358
+ { indexed: false, name: "tag2", type: "string" },
359
+ { indexed: false, name: "endpoint", type: "string" },
360
+ { indexed: false, name: "feedbackURI", type: "string" },
361
+ { indexed: false, name: "feedbackHash", type: "bytes32" }
362
+ ],
363
+ name: "NewFeedback",
302
364
  type: "event"
303
365
  },
304
366
  {
305
367
  anonymous: false,
306
368
  inputs: [
307
369
  { indexed: true, name: "agentId", type: "uint256" },
308
- { indexed: true, name: "client", type: "address" },
309
- { indexed: true, name: "index", type: "uint256" }
370
+ { indexed: true, name: "clientAddress", type: "address" },
371
+ { indexed: true, name: "feedbackIndex", type: "uint64" }
310
372
  ],
311
373
  name: "FeedbackRevoked",
312
374
  type: "event"
@@ -315,8 +377,10 @@ var REPUTATION_REGISTRY_ABI = [
315
377
  anonymous: false,
316
378
  inputs: [
317
379
  { indexed: true, name: "agentId", type: "uint256" },
318
- { indexed: true, name: "feedbackIndex", type: "uint256" },
319
- { indexed: false, name: "response", type: "string" }
380
+ { indexed: true, name: "clientAddress", type: "address" },
381
+ { indexed: false, name: "feedbackIndex", type: "uint64" },
382
+ { indexed: true, name: "responder", type: "address" },
383
+ { indexed: false, name: "responseURI", type: "string" }
320
384
  ],
321
385
  name: "ResponseAppended",
322
386
  type: "event"
@@ -325,157 +389,108 @@ var REPUTATION_REGISTRY_ABI = [
325
389
  var VALIDATION_REGISTRY_ABI = [
326
390
  // Read functions
327
391
  {
328
- inputs: [{ name: "validator", type: "address" }],
329
- name: "getValidator",
392
+ inputs: [{ name: "requestHash", type: "bytes32" }],
393
+ name: "getValidationStatus",
394
+ outputs: [
395
+ { name: "status", type: "uint8" },
396
+ { name: "agentId", type: "uint256" },
397
+ { name: "validatorAddress", type: "address" },
398
+ { name: "response", type: "uint8" },
399
+ { name: "tag", type: "string" }
400
+ ],
401
+ stateMutability: "view",
402
+ type: "function"
403
+ },
404
+ {
405
+ inputs: [{ name: "requestHash", type: "bytes32" }],
406
+ name: "getValidation",
330
407
  outputs: [
331
408
  {
332
- name: "info",
409
+ name: "request",
333
410
  type: "tuple",
334
411
  components: [
335
- { name: "name", type: "string" },
336
- { name: "metadataURI", type: "string" },
337
- { name: "stake", type: "uint256" },
338
- { name: "registeredAt", type: "uint256" },
339
- { name: "active", type: "bool" },
340
- { name: "attestationCount", type: "uint256" }
412
+ { name: "agentId", type: "uint256" },
413
+ { name: "requester", type: "address" },
414
+ { name: "validatorAddress", type: "address" },
415
+ { name: "requestURI", type: "string" },
416
+ { name: "requestDataHash", type: "bytes32" },
417
+ { name: "requestedAt", type: "uint256" },
418
+ { name: "status", type: "uint8" },
419
+ { name: "response", type: "uint8" },
420
+ { name: "responseURI", type: "string" },
421
+ { name: "responseDataHash", type: "bytes32" },
422
+ { name: "tag", type: "string" },
423
+ { name: "respondedAt", type: "uint256" }
341
424
  ]
342
425
  }
343
426
  ],
344
427
  stateMutability: "view",
345
428
  type: "function"
346
429
  },
347
- {
348
- inputs: [{ name: "validator", type: "address" }],
349
- name: "isActiveValidator",
350
- outputs: [{ name: "isActive", type: "bool" }],
351
- stateMutability: "view",
352
- type: "function"
353
- },
354
430
  {
355
431
  inputs: [
356
432
  { name: "agentId", type: "uint256" },
357
- { name: "attestationId", type: "uint256" }
433
+ { name: "validatorAddresses", type: "address[]" },
434
+ { name: "tag", type: "string" }
358
435
  ],
359
- name: "getAttestation",
436
+ name: "getSummary",
360
437
  outputs: [
361
- {
362
- name: "attestation",
363
- type: "tuple",
364
- components: [
365
- { name: "validator", type: "address" },
366
- { name: "attestationType", type: "string" },
367
- { name: "dataHash", type: "bytes32" },
368
- { name: "dataURI", type: "string" },
369
- { name: "createdAt", type: "uint256" },
370
- { name: "expiresAt", type: "uint256" },
371
- { name: "revoked", type: "bool" },
372
- { name: "confidenceScore", type: "uint8" }
373
- ]
374
- }
438
+ { name: "count", type: "uint64" },
439
+ { name: "averageResponse", type: "uint8" }
375
440
  ],
376
441
  stateMutability: "view",
377
442
  type: "function"
378
443
  },
379
444
  {
380
445
  inputs: [{ name: "agentId", type: "uint256" }],
381
- name: "getAllAttestations",
382
- outputs: [
383
- {
384
- name: "",
385
- type: "tuple[]",
386
- components: [
387
- { name: "validator", type: "address" },
388
- { name: "attestationType", type: "string" },
389
- { name: "dataHash", type: "bytes32" },
390
- { name: "dataURI", type: "string" },
391
- { name: "createdAt", type: "uint256" },
392
- { name: "expiresAt", type: "uint256" },
393
- { name: "revoked", type: "bool" },
394
- { name: "confidenceScore", type: "uint8" }
395
- ]
396
- }
397
- ],
446
+ name: "getAgentValidations",
447
+ outputs: [{ name: "requestHashes", type: "bytes32[]" }],
398
448
  stateMutability: "view",
399
449
  type: "function"
400
450
  },
401
451
  {
402
- inputs: [{ name: "agentId", type: "uint256" }],
403
- name: "getActiveAttestations",
404
- outputs: [
405
- {
406
- name: "",
407
- type: "tuple[]",
408
- components: [
409
- { name: "validator", type: "address" },
410
- { name: "attestationType", type: "string" },
411
- { name: "dataHash", type: "bytes32" },
412
- { name: "dataURI", type: "string" },
413
- { name: "createdAt", type: "uint256" },
414
- { name: "expiresAt", type: "uint256" },
415
- { name: "revoked", type: "bool" },
416
- { name: "confidenceScore", type: "uint8" }
417
- ]
418
- }
419
- ],
452
+ inputs: [{ name: "validatorAddress", type: "address" }],
453
+ name: "getValidatorRequests",
454
+ outputs: [{ name: "requestHashes", type: "bytes32[]" }],
455
+ stateMutability: "view",
456
+ type: "function"
457
+ },
458
+ {
459
+ inputs: [{ name: "validatorAddress", type: "address" }],
460
+ name: "getPendingRequests",
461
+ outputs: [{ name: "", type: "bytes32[]" }],
420
462
  stateMutability: "view",
421
463
  type: "function"
422
464
  },
423
465
  {
424
466
  inputs: [
425
467
  { name: "agentId", type: "uint256" },
426
- { name: "attestationType", type: "string" }
427
- ],
428
- name: "getAttestationsByType",
429
- outputs: [
430
- {
431
- name: "",
432
- type: "tuple[]",
433
- components: [
434
- { name: "validator", type: "address" },
435
- { name: "attestationType", type: "string" },
436
- { name: "dataHash", type: "bytes32" },
437
- { name: "dataURI", type: "string" },
438
- { name: "createdAt", type: "uint256" },
439
- { name: "expiresAt", type: "uint256" },
440
- { name: "revoked", type: "bool" },
441
- { name: "confidenceScore", type: "uint8" }
442
- ]
443
- }
468
+ { name: "tag", type: "string" }
444
469
  ],
470
+ name: "hasApprovedValidation",
471
+ outputs: [{ name: "hasApproval", type: "bool" }],
445
472
  stateMutability: "view",
446
473
  type: "function"
447
474
  },
448
475
  {
449
476
  inputs: [{ name: "agentId", type: "uint256" }],
450
- name: "getValidationSummary",
477
+ name: "getValidationStatistics",
451
478
  outputs: [
452
479
  {
453
480
  name: "summary",
454
481
  type: "tuple",
455
482
  components: [
456
- { name: "totalAttestations", type: "uint256" },
457
- { name: "activeAttestations", type: "uint256" },
458
- { name: "expiredAttestations", type: "uint256" },
459
- { name: "revokedAttestations", type: "uint256" },
460
- { name: "validatorCount", type: "uint256" },
461
- { name: "averageConfidence", type: "uint8" },
462
- { name: "lastUpdated", type: "uint256" }
483
+ { name: "totalRequests", type: "uint64" },
484
+ { name: "approvedCount", type: "uint64" },
485
+ { name: "rejectedCount", type: "uint64" },
486
+ { name: "pendingCount", type: "uint64" },
487
+ { name: "averageResponse", type: "uint8" }
463
488
  ]
464
489
  }
465
490
  ],
466
491
  stateMutability: "view",
467
492
  type: "function"
468
493
  },
469
- {
470
- inputs: [
471
- { name: "agentId", type: "uint256" },
472
- { name: "attestationType", type: "string" }
473
- ],
474
- name: "hasValidAttestation",
475
- outputs: [{ name: "hasValid", type: "bool" }],
476
- stateMutability: "view",
477
- type: "function"
478
- },
479
494
  {
480
495
  inputs: [],
481
496
  name: "identityRegistry",
@@ -483,13 +498,6 @@ var VALIDATION_REGISTRY_ABI = [
483
498
  stateMutability: "view",
484
499
  type: "function"
485
500
  },
486
- {
487
- inputs: [],
488
- name: "minimumStake",
489
- outputs: [{ name: "minStake", type: "uint256" }],
490
- stateMutability: "view",
491
- type: "function"
492
- },
493
501
  {
494
502
  inputs: [],
495
503
  name: "version",
@@ -500,55 +508,32 @@ var VALIDATION_REGISTRY_ABI = [
500
508
  // Write functions
501
509
  {
502
510
  inputs: [
503
- { name: "name", type: "string" },
504
- { name: "metadataURI", type: "string" }
511
+ { name: "validatorAddress", type: "address" },
512
+ { name: "agentId", type: "uint256" },
513
+ { name: "requestURI", type: "string" },
514
+ { name: "requestDataHash", type: "bytes32" }
505
515
  ],
506
- name: "registerValidator",
507
- outputs: [],
508
- stateMutability: "payable",
509
- type: "function"
510
- },
511
- {
512
- inputs: [],
513
- name: "updateStake",
514
- outputs: [],
515
- stateMutability: "payable",
516
- type: "function"
517
- },
518
- {
519
- inputs: [{ name: "amount", type: "uint256" }],
520
- name: "withdrawStake",
521
- outputs: [],
522
- stateMutability: "nonpayable",
523
- type: "function"
524
- },
525
- {
526
- inputs: [],
527
- name: "deactivateValidator",
528
- outputs: [],
516
+ name: "validationRequest",
517
+ outputs: [{ name: "requestHash", type: "bytes32" }],
529
518
  stateMutability: "nonpayable",
530
519
  type: "function"
531
520
  },
532
521
  {
533
522
  inputs: [
534
- { name: "agentId", type: "uint256" },
535
- { name: "attestationType", type: "string" },
536
- { name: "dataHash", type: "bytes32" },
537
- { name: "dataURI", type: "string" },
538
- { name: "validityPeriod", type: "uint256" },
539
- { name: "confidenceScore", type: "uint8" }
540
- ],
541
- name: "attest",
542
- outputs: [{ name: "attestationId", type: "uint256" }],
523
+ { name: "requestHash", type: "bytes32" },
524
+ { name: "response", type: "uint8" },
525
+ { name: "responseURI", type: "string" },
526
+ { name: "responseDataHash", type: "bytes32" },
527
+ { name: "tag", type: "string" }
528
+ ],
529
+ name: "validationResponse",
530
+ outputs: [],
543
531
  stateMutability: "nonpayable",
544
532
  type: "function"
545
533
  },
546
534
  {
547
- inputs: [
548
- { name: "agentId", type: "uint256" },
549
- { name: "attestationId", type: "uint256" }
550
- ],
551
- name: "revokeAttestation",
535
+ inputs: [{ name: "requestHash", type: "bytes32" }],
536
+ name: "cancelValidation",
552
537
  outputs: [],
553
538
  stateMutability: "nonpayable",
554
539
  type: "function"
@@ -557,57 +542,35 @@ var VALIDATION_REGISTRY_ABI = [
557
542
  {
558
543
  anonymous: false,
559
544
  inputs: [
560
- { indexed: true, name: "validator", type: "address" },
561
- { indexed: false, name: "name", type: "string" },
562
- { indexed: false, name: "stake", type: "uint256" }
563
- ],
564
- name: "ValidatorRegistered",
565
- type: "event"
566
- },
567
- {
568
- anonymous: false,
569
- inputs: [
570
- { indexed: true, name: "validator", type: "address" },
571
- { indexed: false, name: "oldStake", type: "uint256" },
572
- { indexed: false, name: "newStake", type: "uint256" }
573
- ],
574
- name: "StakeUpdated",
575
- type: "event"
576
- },
577
- {
578
- anonymous: false,
579
- inputs: [{ indexed: true, name: "validator", type: "address" }],
580
- name: "ValidatorRemoved",
581
- type: "event"
582
- },
583
- {
584
- anonymous: false,
585
- inputs: [
545
+ { indexed: true, name: "requestHash", type: "bytes32" },
586
546
  { indexed: true, name: "agentId", type: "uint256" },
587
- { indexed: true, name: "validator", type: "address" },
588
- { indexed: true, name: "attestationId", type: "uint256" },
589
- { indexed: false, name: "attestationType", type: "string" }
547
+ { indexed: true, name: "validatorAddress", type: "address" },
548
+ { indexed: false, name: "requestURI", type: "string" },
549
+ { indexed: false, name: "requestDataHash", type: "bytes32" }
590
550
  ],
591
- name: "AttestationCreated",
551
+ name: "ValidationRequested",
592
552
  type: "event"
593
553
  },
594
554
  {
595
555
  anonymous: false,
596
556
  inputs: [
557
+ { indexed: true, name: "requestHash", type: "bytes32" },
597
558
  { indexed: true, name: "agentId", type: "uint256" },
598
- { indexed: true, name: "validator", type: "address" },
599
- { indexed: true, name: "attestationId", type: "uint256" }
559
+ { indexed: true, name: "validatorAddress", type: "address" },
560
+ { indexed: false, name: "response", type: "uint8" },
561
+ { indexed: false, name: "tag", type: "string" }
600
562
  ],
601
- name: "AttestationRevoked",
563
+ name: "ValidationResponseSubmitted",
602
564
  type: "event"
603
565
  },
604
566
  {
605
567
  anonymous: false,
606
568
  inputs: [
569
+ { indexed: true, name: "requestHash", type: "bytes32" },
607
570
  { indexed: true, name: "agentId", type: "uint256" },
608
- { indexed: true, name: "attestationId", type: "uint256" }
571
+ { indexed: true, name: "cancelledBy", type: "address" }
609
572
  ],
610
- name: "AttestationExpired",
573
+ name: "ValidationCancelled",
611
574
  type: "event"
612
575
  }
613
576
  ];
@@ -616,55 +579,77 @@ var ERC8004_ABIS = {
616
579
  ReputationRegistry: REPUTATION_REGISTRY_ABI,
617
580
  ValidationRegistry: VALIDATION_REGISTRY_ABI
618
581
  };
619
- var RATING = {
620
- NEGATIVE: -1,
621
- NEUTRAL: 0,
622
- POSITIVE: 1
623
- };
624
- var ATTESTATION_TYPES = {
625
- KYC: "kyc",
626
- AML: "aml",
582
+ var VALIDATION_TAGS = {
583
+ SECURITY: "security",
584
+ COMPLIANCE: "compliance",
585
+ PERFORMANCE: "performance",
627
586
  IDENTITY: "identity",
628
587
  CAPABILITY: "capability",
629
- PERFORMANCE: "performance",
630
- SECURITY: "security",
631
- COMPLIANCE: "compliance"
588
+ KYC: "kyc",
589
+ AML: "aml"
632
590
  };
633
- function encodeMetadataValue(value) {
634
- const encoder = new TextEncoder();
635
- const bytes = encoder.encode(value);
636
- return `0x${Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("")}`;
591
+ var FEEDBACK_TAGS = {
592
+ QUALITY: "quality",
593
+ SPEED: "speed",
594
+ RELIABILITY: "reliability",
595
+ ACCURACY: "accuracy",
596
+ SUPPORT: "support"
597
+ };
598
+ function isValidationApproved(status) {
599
+ return status === 2 /* Approved */;
600
+ }
601
+ function getValidationStatusString(status) {
602
+ switch (status) {
603
+ case 0 /* None */:
604
+ return "none";
605
+ case 1 /* Pending */:
606
+ return "pending";
607
+ case 2 /* Approved */:
608
+ return "approved";
609
+ case 3 /* Rejected */:
610
+ return "rejected";
611
+ case 4 /* Cancelled */:
612
+ return "cancelled";
613
+ default:
614
+ return "none";
615
+ }
637
616
  }
638
- function decodeMetadataValue(hex) {
639
- const bytes = hex.slice(2).match(/.{2}/g);
640
- if (!bytes) return "";
641
- const decoder = new TextDecoder();
642
- return decoder.decode(new Uint8Array(bytes.map((b) => parseInt(b, 16))));
617
+ function getScorePercentage(score) {
618
+ return Math.min(100, Math.max(0, score));
643
619
  }
644
- function calculateAverageRating(summary) {
645
- if (summary.activeFeedback === 0n) return 0;
646
- return Number(summary.averageRating) / Number(summary.activeFeedback);
620
+ function isScoreApproved(score) {
621
+ return score > 50;
647
622
  }
648
- function isAttestationValid(attestation) {
649
- const now = BigInt(Math.floor(Date.now() / 1e3));
650
- return !attestation.revoked && attestation.expiresAt > now;
623
+ function getAttestationStatus() {
624
+ throw new Error(
625
+ "getAttestationStatus is deprecated. Use getValidationStatusString instead."
626
+ );
627
+ }
628
+ function isAttestationValid() {
629
+ throw new Error(
630
+ "isAttestationValid is deprecated. Use isValidationApproved instead."
631
+ );
632
+ }
633
+ function encodeMetadataValue(value) {
634
+ return value;
651
635
  }
652
- function getAttestationStatus(attestation) {
653
- if (attestation.revoked) return "revoked";
654
- const now = BigInt(Math.floor(Date.now() / 1e3));
655
- if (attestation.expiresAt <= now) return "expired";
656
- return "active";
636
+ function decodeMetadataValue(value) {
637
+ return value;
657
638
  }
658
639
  export {
659
- ATTESTATION_TYPES,
660
640
  ERC8004_ABIS,
641
+ FEEDBACK_TAGS,
661
642
  IDENTITY_REGISTRY_ABI,
662
- RATING,
663
643
  REPUTATION_REGISTRY_ABI,
664
644
  VALIDATION_REGISTRY_ABI,
665
- calculateAverageRating,
645
+ VALIDATION_TAGS,
646
+ ValidationStatus,
666
647
  decodeMetadataValue,
667
648
  encodeMetadataValue,
668
649
  getAttestationStatus,
669
- isAttestationValid
650
+ getScorePercentage,
651
+ getValidationStatusString,
652
+ isAttestationValid,
653
+ isScoreApproved,
654
+ isValidationApproved
670
655
  };