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