arl-protocol-sdk 0.2.0 → 0.3.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/README.md +39 -1
- package/package.json +1 -1
- package/protocol/src/deployments.js +2 -2
- package/protocol/src/evidence.d.ts +0 -5
- package/protocol/src/evidence.js +20 -4
- package/protocol/src/index.d.ts +2 -0
- package/protocol/src/index.js +1 -0
- package/protocol/src/policies.js +54 -0
- package/protocol/src/reputationRead.d.ts +57 -0
- package/protocol/src/reputationRead.js +100 -0
- package/sdk/src/agentScore.d.ts +840 -0
- package/sdk/src/agentScore.js +335 -0
- package/sdk/src/audit.d.ts +30 -0
- package/sdk/src/audit.js +101 -0
- package/sdk/src/index.d.ts +6 -1
- package/sdk/src/index.js +6 -1
- package/sdk/src/passport.d.ts +25 -0
- package/sdk/src/passport.js +88 -0
- package/sdk/src/payOnProof.d.ts +75 -0
- package/sdk/src/payOnProof.js +137 -0
- package/sdk/src/validators.d.ts +27 -0
- package/sdk/src/validators.js +82 -0
- package/sdk/src/verified.d.ts +49 -1
- package/sdk/src/verified.js +44 -4
|
@@ -0,0 +1,840 @@
|
|
|
1
|
+
import { type Address, type PublicClient } from "viem";
|
|
2
|
+
import { type Outcome, type Score } from "../../protocol/src/index.ts";
|
|
3
|
+
export declare const REPUTATION_REGISTRY: Address;
|
|
4
|
+
/** The verified evaluators on Base Mainnet, with their escrow and creation block. */
|
|
5
|
+
export declare const VERIFIED_EVALUATORS: readonly [{
|
|
6
|
+
readonly token: "ARL";
|
|
7
|
+
readonly evaluator: "0x0D160C869bd2a7AaEDd29e11fc60fdAEf21c3E28";
|
|
8
|
+
readonly escrow: "0x9aE99bF9a59aF47E81346B7c0b93Cd2B610455fC";
|
|
9
|
+
readonly fromBlock: 59577368n;
|
|
10
|
+
}, {
|
|
11
|
+
readonly token: "USDC";
|
|
12
|
+
readonly evaluator: "0x7A00D45598Da7C13feEA8962fc1110FC4Db4D850";
|
|
13
|
+
readonly escrow: "0xE3eA0EAEc3Cf9DA2d0856A0f784A4B1671AeFD04";
|
|
14
|
+
readonly fromBlock: 59579724n;
|
|
15
|
+
}];
|
|
16
|
+
/** Every event of the escrow and the verified evaluator. */
|
|
17
|
+
export declare const protocolEvents: readonly [{
|
|
18
|
+
readonly name: "JobCreated";
|
|
19
|
+
readonly type: "event";
|
|
20
|
+
readonly inputs: readonly [{
|
|
21
|
+
readonly type: "uint256";
|
|
22
|
+
readonly name: "jobId";
|
|
23
|
+
readonly indexed: true;
|
|
24
|
+
}, {
|
|
25
|
+
readonly type: "address";
|
|
26
|
+
readonly name: "client";
|
|
27
|
+
readonly indexed: true;
|
|
28
|
+
}, {
|
|
29
|
+
readonly type: "address";
|
|
30
|
+
readonly name: "provider";
|
|
31
|
+
readonly indexed: true;
|
|
32
|
+
}, {
|
|
33
|
+
readonly type: "address";
|
|
34
|
+
readonly name: "evaluator";
|
|
35
|
+
}, {
|
|
36
|
+
readonly type: "uint256";
|
|
37
|
+
readonly name: "expiredAt";
|
|
38
|
+
}, {
|
|
39
|
+
readonly type: "address";
|
|
40
|
+
readonly name: "hook";
|
|
41
|
+
}];
|
|
42
|
+
}, {
|
|
43
|
+
readonly name: "ProviderSet";
|
|
44
|
+
readonly type: "event";
|
|
45
|
+
readonly inputs: readonly [{
|
|
46
|
+
readonly type: "uint256";
|
|
47
|
+
readonly name: "jobId";
|
|
48
|
+
readonly indexed: true;
|
|
49
|
+
}, {
|
|
50
|
+
readonly type: "address";
|
|
51
|
+
readonly name: "provider";
|
|
52
|
+
readonly indexed: true;
|
|
53
|
+
}];
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "BudgetSet";
|
|
56
|
+
readonly type: "event";
|
|
57
|
+
readonly inputs: readonly [{
|
|
58
|
+
readonly type: "uint256";
|
|
59
|
+
readonly name: "jobId";
|
|
60
|
+
readonly indexed: true;
|
|
61
|
+
}, {
|
|
62
|
+
readonly type: "uint256";
|
|
63
|
+
readonly name: "amount";
|
|
64
|
+
}];
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "JobFunded";
|
|
67
|
+
readonly type: "event";
|
|
68
|
+
readonly inputs: readonly [{
|
|
69
|
+
readonly type: "uint256";
|
|
70
|
+
readonly name: "jobId";
|
|
71
|
+
readonly indexed: true;
|
|
72
|
+
}, {
|
|
73
|
+
readonly type: "address";
|
|
74
|
+
readonly name: "client";
|
|
75
|
+
readonly indexed: true;
|
|
76
|
+
}, {
|
|
77
|
+
readonly type: "uint256";
|
|
78
|
+
readonly name: "amount";
|
|
79
|
+
}];
|
|
80
|
+
}, {
|
|
81
|
+
readonly name: "JobSubmitted";
|
|
82
|
+
readonly type: "event";
|
|
83
|
+
readonly inputs: readonly [{
|
|
84
|
+
readonly type: "uint256";
|
|
85
|
+
readonly name: "jobId";
|
|
86
|
+
readonly indexed: true;
|
|
87
|
+
}, {
|
|
88
|
+
readonly type: "address";
|
|
89
|
+
readonly name: "provider";
|
|
90
|
+
readonly indexed: true;
|
|
91
|
+
}, {
|
|
92
|
+
readonly type: "bytes32";
|
|
93
|
+
readonly name: "deliverable";
|
|
94
|
+
}];
|
|
95
|
+
}, {
|
|
96
|
+
readonly name: "JobCompleted";
|
|
97
|
+
readonly type: "event";
|
|
98
|
+
readonly inputs: readonly [{
|
|
99
|
+
readonly type: "uint256";
|
|
100
|
+
readonly name: "jobId";
|
|
101
|
+
readonly indexed: true;
|
|
102
|
+
}, {
|
|
103
|
+
readonly type: "address";
|
|
104
|
+
readonly name: "evaluator";
|
|
105
|
+
readonly indexed: true;
|
|
106
|
+
}, {
|
|
107
|
+
readonly type: "bytes32";
|
|
108
|
+
readonly name: "reason";
|
|
109
|
+
}];
|
|
110
|
+
}, {
|
|
111
|
+
readonly name: "JobRejected";
|
|
112
|
+
readonly type: "event";
|
|
113
|
+
readonly inputs: readonly [{
|
|
114
|
+
readonly type: "uint256";
|
|
115
|
+
readonly name: "jobId";
|
|
116
|
+
readonly indexed: true;
|
|
117
|
+
}, {
|
|
118
|
+
readonly type: "address";
|
|
119
|
+
readonly name: "rejector";
|
|
120
|
+
readonly indexed: true;
|
|
121
|
+
}, {
|
|
122
|
+
readonly type: "bytes32";
|
|
123
|
+
readonly name: "reason";
|
|
124
|
+
}];
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "JobExpired";
|
|
127
|
+
readonly type: "event";
|
|
128
|
+
readonly inputs: readonly [{
|
|
129
|
+
readonly type: "uint256";
|
|
130
|
+
readonly name: "jobId";
|
|
131
|
+
readonly indexed: true;
|
|
132
|
+
}];
|
|
133
|
+
}, {
|
|
134
|
+
readonly name: "PaymentReleased";
|
|
135
|
+
readonly type: "event";
|
|
136
|
+
readonly inputs: readonly [{
|
|
137
|
+
readonly type: "uint256";
|
|
138
|
+
readonly name: "jobId";
|
|
139
|
+
readonly indexed: true;
|
|
140
|
+
}, {
|
|
141
|
+
readonly type: "address";
|
|
142
|
+
readonly name: "provider";
|
|
143
|
+
readonly indexed: true;
|
|
144
|
+
}, {
|
|
145
|
+
readonly type: "uint256";
|
|
146
|
+
readonly name: "amount";
|
|
147
|
+
}];
|
|
148
|
+
}, {
|
|
149
|
+
readonly name: "Refunded";
|
|
150
|
+
readonly type: "event";
|
|
151
|
+
readonly inputs: readonly [{
|
|
152
|
+
readonly type: "uint256";
|
|
153
|
+
readonly name: "jobId";
|
|
154
|
+
readonly indexed: true;
|
|
155
|
+
}, {
|
|
156
|
+
readonly type: "address";
|
|
157
|
+
readonly name: "client";
|
|
158
|
+
readonly indexed: true;
|
|
159
|
+
}, {
|
|
160
|
+
readonly type: "uint256";
|
|
161
|
+
readonly name: "amount";
|
|
162
|
+
}];
|
|
163
|
+
}, {
|
|
164
|
+
readonly name: "Configured";
|
|
165
|
+
readonly type: "event";
|
|
166
|
+
readonly inputs: readonly [{
|
|
167
|
+
readonly type: "uint256";
|
|
168
|
+
readonly name: "jobId";
|
|
169
|
+
readonly indexed: true;
|
|
170
|
+
}, {
|
|
171
|
+
readonly type: "uint8";
|
|
172
|
+
readonly name: "tier";
|
|
173
|
+
}, {
|
|
174
|
+
readonly type: "uint8";
|
|
175
|
+
readonly name: "threshold";
|
|
176
|
+
}, {
|
|
177
|
+
readonly type: "uint64";
|
|
178
|
+
readonly name: "voteWindow";
|
|
179
|
+
}, {
|
|
180
|
+
readonly type: "uint64";
|
|
181
|
+
readonly name: "challengeWindow";
|
|
182
|
+
}, {
|
|
183
|
+
readonly type: "uint96";
|
|
184
|
+
readonly name: "bond";
|
|
185
|
+
}, {
|
|
186
|
+
readonly type: "uint256";
|
|
187
|
+
readonly name: "providerAgentId";
|
|
188
|
+
}, {
|
|
189
|
+
readonly type: "bytes32";
|
|
190
|
+
readonly name: "specHash";
|
|
191
|
+
}, {
|
|
192
|
+
readonly type: "address[]";
|
|
193
|
+
readonly name: "committee";
|
|
194
|
+
}];
|
|
195
|
+
}, {
|
|
196
|
+
readonly name: "CommitteeApproved";
|
|
197
|
+
readonly type: "event";
|
|
198
|
+
readonly inputs: readonly [{
|
|
199
|
+
readonly type: "uint256";
|
|
200
|
+
readonly name: "jobId";
|
|
201
|
+
readonly indexed: true;
|
|
202
|
+
}, {
|
|
203
|
+
readonly type: "address";
|
|
204
|
+
readonly name: "provider";
|
|
205
|
+
readonly indexed: true;
|
|
206
|
+
}];
|
|
207
|
+
}, {
|
|
208
|
+
readonly name: "Accepted";
|
|
209
|
+
readonly type: "event";
|
|
210
|
+
readonly inputs: readonly [{
|
|
211
|
+
readonly type: "uint256";
|
|
212
|
+
readonly name: "jobId";
|
|
213
|
+
readonly indexed: true;
|
|
214
|
+
}, {
|
|
215
|
+
readonly type: "address";
|
|
216
|
+
readonly name: "validator";
|
|
217
|
+
readonly indexed: true;
|
|
218
|
+
}, {
|
|
219
|
+
readonly type: "uint256";
|
|
220
|
+
readonly name: "bond";
|
|
221
|
+
}];
|
|
222
|
+
}, {
|
|
223
|
+
readonly name: "VotingStarted";
|
|
224
|
+
readonly type: "event";
|
|
225
|
+
readonly inputs: readonly [{
|
|
226
|
+
readonly type: "uint256";
|
|
227
|
+
readonly name: "jobId";
|
|
228
|
+
readonly indexed: true;
|
|
229
|
+
}, {
|
|
230
|
+
readonly type: "uint64";
|
|
231
|
+
readonly name: "voteEnds";
|
|
232
|
+
}];
|
|
233
|
+
}, {
|
|
234
|
+
readonly name: "Voted";
|
|
235
|
+
readonly type: "event";
|
|
236
|
+
readonly inputs: readonly [{
|
|
237
|
+
readonly type: "uint256";
|
|
238
|
+
readonly name: "jobId";
|
|
239
|
+
readonly indexed: true;
|
|
240
|
+
}, {
|
|
241
|
+
readonly type: "address";
|
|
242
|
+
readonly name: "validator";
|
|
243
|
+
readonly indexed: true;
|
|
244
|
+
}, {
|
|
245
|
+
readonly type: "bool";
|
|
246
|
+
readonly name: "approve";
|
|
247
|
+
}, {
|
|
248
|
+
readonly type: "bytes32";
|
|
249
|
+
readonly name: "deliverable";
|
|
250
|
+
}, {
|
|
251
|
+
readonly type: "bytes32";
|
|
252
|
+
readonly name: "evidence";
|
|
253
|
+
}];
|
|
254
|
+
}, {
|
|
255
|
+
readonly name: "Decided";
|
|
256
|
+
readonly type: "event";
|
|
257
|
+
readonly inputs: readonly [{
|
|
258
|
+
readonly type: "uint256";
|
|
259
|
+
readonly name: "jobId";
|
|
260
|
+
readonly indexed: true;
|
|
261
|
+
}, {
|
|
262
|
+
readonly type: "bool";
|
|
263
|
+
readonly name: "approved";
|
|
264
|
+
}, {
|
|
265
|
+
readonly type: "uint64";
|
|
266
|
+
readonly name: "challengeEnds";
|
|
267
|
+
}];
|
|
268
|
+
}, {
|
|
269
|
+
readonly name: "Disputed";
|
|
270
|
+
readonly type: "event";
|
|
271
|
+
readonly inputs: readonly [{
|
|
272
|
+
readonly type: "uint256";
|
|
273
|
+
readonly name: "jobId";
|
|
274
|
+
readonly indexed: true;
|
|
275
|
+
}, {
|
|
276
|
+
readonly type: "address";
|
|
277
|
+
readonly name: "challenger";
|
|
278
|
+
readonly indexed: true;
|
|
279
|
+
}, {
|
|
280
|
+
readonly type: "bytes32";
|
|
281
|
+
readonly name: "evidence";
|
|
282
|
+
}];
|
|
283
|
+
}, {
|
|
284
|
+
readonly name: "Resolved";
|
|
285
|
+
readonly type: "event";
|
|
286
|
+
readonly inputs: readonly [{
|
|
287
|
+
readonly type: "uint256";
|
|
288
|
+
readonly name: "jobId";
|
|
289
|
+
readonly indexed: true;
|
|
290
|
+
}, {
|
|
291
|
+
readonly type: "bool";
|
|
292
|
+
readonly name: "approved";
|
|
293
|
+
}, {
|
|
294
|
+
readonly type: "bool";
|
|
295
|
+
readonly name: "overturned";
|
|
296
|
+
}, {
|
|
297
|
+
readonly type: "bytes32";
|
|
298
|
+
readonly name: "reason";
|
|
299
|
+
}];
|
|
300
|
+
}, {
|
|
301
|
+
readonly name: "Slashed";
|
|
302
|
+
readonly type: "event";
|
|
303
|
+
readonly inputs: readonly [{
|
|
304
|
+
readonly type: "uint256";
|
|
305
|
+
readonly name: "jobId";
|
|
306
|
+
readonly indexed: true;
|
|
307
|
+
}, {
|
|
308
|
+
readonly type: "address";
|
|
309
|
+
readonly name: "account";
|
|
310
|
+
readonly indexed: true;
|
|
311
|
+
}, {
|
|
312
|
+
readonly type: "uint256";
|
|
313
|
+
readonly name: "amount";
|
|
314
|
+
}];
|
|
315
|
+
}, {
|
|
316
|
+
readonly name: "Failed";
|
|
317
|
+
readonly type: "event";
|
|
318
|
+
readonly inputs: readonly [{
|
|
319
|
+
readonly type: "uint256";
|
|
320
|
+
readonly name: "jobId";
|
|
321
|
+
readonly indexed: true;
|
|
322
|
+
}];
|
|
323
|
+
}, {
|
|
324
|
+
readonly name: "Finalized";
|
|
325
|
+
readonly type: "event";
|
|
326
|
+
readonly inputs: readonly [{
|
|
327
|
+
readonly type: "uint256";
|
|
328
|
+
readonly name: "jobId";
|
|
329
|
+
readonly indexed: true;
|
|
330
|
+
}, {
|
|
331
|
+
readonly type: "bool";
|
|
332
|
+
readonly name: "approved";
|
|
333
|
+
}, {
|
|
334
|
+
readonly type: "bytes32";
|
|
335
|
+
readonly name: "voteHash";
|
|
336
|
+
}];
|
|
337
|
+
}, {
|
|
338
|
+
readonly name: "Released";
|
|
339
|
+
readonly type: "event";
|
|
340
|
+
readonly inputs: readonly [{
|
|
341
|
+
readonly type: "uint256";
|
|
342
|
+
readonly name: "jobId";
|
|
343
|
+
readonly indexed: true;
|
|
344
|
+
}];
|
|
345
|
+
}, {
|
|
346
|
+
readonly name: "FeedbackFailed";
|
|
347
|
+
readonly type: "event";
|
|
348
|
+
readonly inputs: readonly [{
|
|
349
|
+
readonly type: "uint256";
|
|
350
|
+
readonly name: "jobId";
|
|
351
|
+
readonly indexed: true;
|
|
352
|
+
}, {
|
|
353
|
+
readonly type: "uint256";
|
|
354
|
+
readonly name: "agentId";
|
|
355
|
+
}];
|
|
356
|
+
}, {
|
|
357
|
+
readonly name: "RefundDeferred";
|
|
358
|
+
readonly type: "event";
|
|
359
|
+
readonly inputs: readonly [{
|
|
360
|
+
readonly type: "uint256";
|
|
361
|
+
readonly name: "jobId";
|
|
362
|
+
readonly indexed: true;
|
|
363
|
+
}];
|
|
364
|
+
}, {
|
|
365
|
+
readonly name: "DisputeExpired";
|
|
366
|
+
readonly type: "event";
|
|
367
|
+
readonly inputs: readonly [{
|
|
368
|
+
readonly type: "uint256";
|
|
369
|
+
readonly name: "jobId";
|
|
370
|
+
readonly indexed: true;
|
|
371
|
+
}];
|
|
372
|
+
}, {
|
|
373
|
+
readonly name: "Staked";
|
|
374
|
+
readonly type: "event";
|
|
375
|
+
readonly inputs: readonly [{
|
|
376
|
+
readonly type: "address";
|
|
377
|
+
readonly name: "validator";
|
|
378
|
+
readonly indexed: true;
|
|
379
|
+
}, {
|
|
380
|
+
readonly type: "uint256";
|
|
381
|
+
readonly name: "amount";
|
|
382
|
+
}];
|
|
383
|
+
}, {
|
|
384
|
+
readonly name: "Unstaked";
|
|
385
|
+
readonly type: "event";
|
|
386
|
+
readonly inputs: readonly [{
|
|
387
|
+
readonly type: "address";
|
|
388
|
+
readonly name: "validator";
|
|
389
|
+
readonly indexed: true;
|
|
390
|
+
}, {
|
|
391
|
+
readonly type: "uint256";
|
|
392
|
+
readonly name: "amount";
|
|
393
|
+
}];
|
|
394
|
+
}];
|
|
395
|
+
/**
|
|
396
|
+
* getLogs over [from, to] in spans the endpoint accepts. The ranges are fixed 50,000-block steps
|
|
397
|
+
* from `from` (so a finished range is always asked for the same way and can be cached) and are
|
|
398
|
+
* read two at a time; the answer keeps block order. Once the endpoint rate-limits a request the
|
|
399
|
+
* rest are read one after another.
|
|
400
|
+
*/
|
|
401
|
+
export declare function logsInRange<T>(from: bigint, to: bigint, read: (fromBlock: bigint, toBlock: bigint) => Promise<T[]>, wholeRange?: boolean): Promise<T[]>;
|
|
402
|
+
export interface AgentScore {
|
|
403
|
+
agentId: bigint;
|
|
404
|
+
/** The block everything was read at. */
|
|
405
|
+
block: bigint;
|
|
406
|
+
score: Score;
|
|
407
|
+
outcomes: Outcome[];
|
|
408
|
+
skipped: {
|
|
409
|
+
what: string;
|
|
410
|
+
reason: string;
|
|
411
|
+
}[];
|
|
412
|
+
}
|
|
413
|
+
export interface HistoryOptions {
|
|
414
|
+
/**
|
|
415
|
+
* Ask for the whole history in one `getLogs` request instead of 50,000-block ranges. Only for a
|
|
416
|
+
* client whose transport stores finished scans and splits the request itself (the Agent API's
|
|
417
|
+
* `cachedLogsProvider`); a plain RPC endpoint refuses a range this wide.
|
|
418
|
+
*/
|
|
419
|
+
wholeRange?: boolean;
|
|
420
|
+
}
|
|
421
|
+
/** The first block any verified evaluator has code at: where every scan starts. */
|
|
422
|
+
export declare const HISTORY_START: bigint;
|
|
423
|
+
/**
|
|
424
|
+
* The events of every escrow and evaluator in [from, to], in one request per range. The filter is
|
|
425
|
+
* the same for every caller, so a provider that stores finished ranges serves the score, the
|
|
426
|
+
* trust graph and the audit trail from one store.
|
|
427
|
+
*/
|
|
428
|
+
export declare function readProtocolLogs(client: PublicClient, from: bigint, to: bigint, opts?: HistoryOptions): Promise<import("viem").Log<bigint, number, false, undefined, undefined, readonly [{
|
|
429
|
+
readonly name: "JobCreated";
|
|
430
|
+
readonly type: "event";
|
|
431
|
+
readonly inputs: readonly [{
|
|
432
|
+
readonly type: "uint256";
|
|
433
|
+
readonly name: "jobId";
|
|
434
|
+
readonly indexed: true;
|
|
435
|
+
}, {
|
|
436
|
+
readonly type: "address";
|
|
437
|
+
readonly name: "client";
|
|
438
|
+
readonly indexed: true;
|
|
439
|
+
}, {
|
|
440
|
+
readonly type: "address";
|
|
441
|
+
readonly name: "provider";
|
|
442
|
+
readonly indexed: true;
|
|
443
|
+
}, {
|
|
444
|
+
readonly type: "address";
|
|
445
|
+
readonly name: "evaluator";
|
|
446
|
+
}, {
|
|
447
|
+
readonly type: "uint256";
|
|
448
|
+
readonly name: "expiredAt";
|
|
449
|
+
}, {
|
|
450
|
+
readonly type: "address";
|
|
451
|
+
readonly name: "hook";
|
|
452
|
+
}];
|
|
453
|
+
}, {
|
|
454
|
+
readonly name: "ProviderSet";
|
|
455
|
+
readonly type: "event";
|
|
456
|
+
readonly inputs: readonly [{
|
|
457
|
+
readonly type: "uint256";
|
|
458
|
+
readonly name: "jobId";
|
|
459
|
+
readonly indexed: true;
|
|
460
|
+
}, {
|
|
461
|
+
readonly type: "address";
|
|
462
|
+
readonly name: "provider";
|
|
463
|
+
readonly indexed: true;
|
|
464
|
+
}];
|
|
465
|
+
}, {
|
|
466
|
+
readonly name: "BudgetSet";
|
|
467
|
+
readonly type: "event";
|
|
468
|
+
readonly inputs: readonly [{
|
|
469
|
+
readonly type: "uint256";
|
|
470
|
+
readonly name: "jobId";
|
|
471
|
+
readonly indexed: true;
|
|
472
|
+
}, {
|
|
473
|
+
readonly type: "uint256";
|
|
474
|
+
readonly name: "amount";
|
|
475
|
+
}];
|
|
476
|
+
}, {
|
|
477
|
+
readonly name: "JobFunded";
|
|
478
|
+
readonly type: "event";
|
|
479
|
+
readonly inputs: readonly [{
|
|
480
|
+
readonly type: "uint256";
|
|
481
|
+
readonly name: "jobId";
|
|
482
|
+
readonly indexed: true;
|
|
483
|
+
}, {
|
|
484
|
+
readonly type: "address";
|
|
485
|
+
readonly name: "client";
|
|
486
|
+
readonly indexed: true;
|
|
487
|
+
}, {
|
|
488
|
+
readonly type: "uint256";
|
|
489
|
+
readonly name: "amount";
|
|
490
|
+
}];
|
|
491
|
+
}, {
|
|
492
|
+
readonly name: "JobSubmitted";
|
|
493
|
+
readonly type: "event";
|
|
494
|
+
readonly inputs: readonly [{
|
|
495
|
+
readonly type: "uint256";
|
|
496
|
+
readonly name: "jobId";
|
|
497
|
+
readonly indexed: true;
|
|
498
|
+
}, {
|
|
499
|
+
readonly type: "address";
|
|
500
|
+
readonly name: "provider";
|
|
501
|
+
readonly indexed: true;
|
|
502
|
+
}, {
|
|
503
|
+
readonly type: "bytes32";
|
|
504
|
+
readonly name: "deliverable";
|
|
505
|
+
}];
|
|
506
|
+
}, {
|
|
507
|
+
readonly name: "JobCompleted";
|
|
508
|
+
readonly type: "event";
|
|
509
|
+
readonly inputs: readonly [{
|
|
510
|
+
readonly type: "uint256";
|
|
511
|
+
readonly name: "jobId";
|
|
512
|
+
readonly indexed: true;
|
|
513
|
+
}, {
|
|
514
|
+
readonly type: "address";
|
|
515
|
+
readonly name: "evaluator";
|
|
516
|
+
readonly indexed: true;
|
|
517
|
+
}, {
|
|
518
|
+
readonly type: "bytes32";
|
|
519
|
+
readonly name: "reason";
|
|
520
|
+
}];
|
|
521
|
+
}, {
|
|
522
|
+
readonly name: "JobRejected";
|
|
523
|
+
readonly type: "event";
|
|
524
|
+
readonly inputs: readonly [{
|
|
525
|
+
readonly type: "uint256";
|
|
526
|
+
readonly name: "jobId";
|
|
527
|
+
readonly indexed: true;
|
|
528
|
+
}, {
|
|
529
|
+
readonly type: "address";
|
|
530
|
+
readonly name: "rejector";
|
|
531
|
+
readonly indexed: true;
|
|
532
|
+
}, {
|
|
533
|
+
readonly type: "bytes32";
|
|
534
|
+
readonly name: "reason";
|
|
535
|
+
}];
|
|
536
|
+
}, {
|
|
537
|
+
readonly name: "JobExpired";
|
|
538
|
+
readonly type: "event";
|
|
539
|
+
readonly inputs: readonly [{
|
|
540
|
+
readonly type: "uint256";
|
|
541
|
+
readonly name: "jobId";
|
|
542
|
+
readonly indexed: true;
|
|
543
|
+
}];
|
|
544
|
+
}, {
|
|
545
|
+
readonly name: "PaymentReleased";
|
|
546
|
+
readonly type: "event";
|
|
547
|
+
readonly inputs: readonly [{
|
|
548
|
+
readonly type: "uint256";
|
|
549
|
+
readonly name: "jobId";
|
|
550
|
+
readonly indexed: true;
|
|
551
|
+
}, {
|
|
552
|
+
readonly type: "address";
|
|
553
|
+
readonly name: "provider";
|
|
554
|
+
readonly indexed: true;
|
|
555
|
+
}, {
|
|
556
|
+
readonly type: "uint256";
|
|
557
|
+
readonly name: "amount";
|
|
558
|
+
}];
|
|
559
|
+
}, {
|
|
560
|
+
readonly name: "Refunded";
|
|
561
|
+
readonly type: "event";
|
|
562
|
+
readonly inputs: readonly [{
|
|
563
|
+
readonly type: "uint256";
|
|
564
|
+
readonly name: "jobId";
|
|
565
|
+
readonly indexed: true;
|
|
566
|
+
}, {
|
|
567
|
+
readonly type: "address";
|
|
568
|
+
readonly name: "client";
|
|
569
|
+
readonly indexed: true;
|
|
570
|
+
}, {
|
|
571
|
+
readonly type: "uint256";
|
|
572
|
+
readonly name: "amount";
|
|
573
|
+
}];
|
|
574
|
+
}, {
|
|
575
|
+
readonly name: "Configured";
|
|
576
|
+
readonly type: "event";
|
|
577
|
+
readonly inputs: readonly [{
|
|
578
|
+
readonly type: "uint256";
|
|
579
|
+
readonly name: "jobId";
|
|
580
|
+
readonly indexed: true;
|
|
581
|
+
}, {
|
|
582
|
+
readonly type: "uint8";
|
|
583
|
+
readonly name: "tier";
|
|
584
|
+
}, {
|
|
585
|
+
readonly type: "uint8";
|
|
586
|
+
readonly name: "threshold";
|
|
587
|
+
}, {
|
|
588
|
+
readonly type: "uint64";
|
|
589
|
+
readonly name: "voteWindow";
|
|
590
|
+
}, {
|
|
591
|
+
readonly type: "uint64";
|
|
592
|
+
readonly name: "challengeWindow";
|
|
593
|
+
}, {
|
|
594
|
+
readonly type: "uint96";
|
|
595
|
+
readonly name: "bond";
|
|
596
|
+
}, {
|
|
597
|
+
readonly type: "uint256";
|
|
598
|
+
readonly name: "providerAgentId";
|
|
599
|
+
}, {
|
|
600
|
+
readonly type: "bytes32";
|
|
601
|
+
readonly name: "specHash";
|
|
602
|
+
}, {
|
|
603
|
+
readonly type: "address[]";
|
|
604
|
+
readonly name: "committee";
|
|
605
|
+
}];
|
|
606
|
+
}, {
|
|
607
|
+
readonly name: "CommitteeApproved";
|
|
608
|
+
readonly type: "event";
|
|
609
|
+
readonly inputs: readonly [{
|
|
610
|
+
readonly type: "uint256";
|
|
611
|
+
readonly name: "jobId";
|
|
612
|
+
readonly indexed: true;
|
|
613
|
+
}, {
|
|
614
|
+
readonly type: "address";
|
|
615
|
+
readonly name: "provider";
|
|
616
|
+
readonly indexed: true;
|
|
617
|
+
}];
|
|
618
|
+
}, {
|
|
619
|
+
readonly name: "Accepted";
|
|
620
|
+
readonly type: "event";
|
|
621
|
+
readonly inputs: readonly [{
|
|
622
|
+
readonly type: "uint256";
|
|
623
|
+
readonly name: "jobId";
|
|
624
|
+
readonly indexed: true;
|
|
625
|
+
}, {
|
|
626
|
+
readonly type: "address";
|
|
627
|
+
readonly name: "validator";
|
|
628
|
+
readonly indexed: true;
|
|
629
|
+
}, {
|
|
630
|
+
readonly type: "uint256";
|
|
631
|
+
readonly name: "bond";
|
|
632
|
+
}];
|
|
633
|
+
}, {
|
|
634
|
+
readonly name: "VotingStarted";
|
|
635
|
+
readonly type: "event";
|
|
636
|
+
readonly inputs: readonly [{
|
|
637
|
+
readonly type: "uint256";
|
|
638
|
+
readonly name: "jobId";
|
|
639
|
+
readonly indexed: true;
|
|
640
|
+
}, {
|
|
641
|
+
readonly type: "uint64";
|
|
642
|
+
readonly name: "voteEnds";
|
|
643
|
+
}];
|
|
644
|
+
}, {
|
|
645
|
+
readonly name: "Voted";
|
|
646
|
+
readonly type: "event";
|
|
647
|
+
readonly inputs: readonly [{
|
|
648
|
+
readonly type: "uint256";
|
|
649
|
+
readonly name: "jobId";
|
|
650
|
+
readonly indexed: true;
|
|
651
|
+
}, {
|
|
652
|
+
readonly type: "address";
|
|
653
|
+
readonly name: "validator";
|
|
654
|
+
readonly indexed: true;
|
|
655
|
+
}, {
|
|
656
|
+
readonly type: "bool";
|
|
657
|
+
readonly name: "approve";
|
|
658
|
+
}, {
|
|
659
|
+
readonly type: "bytes32";
|
|
660
|
+
readonly name: "deliverable";
|
|
661
|
+
}, {
|
|
662
|
+
readonly type: "bytes32";
|
|
663
|
+
readonly name: "evidence";
|
|
664
|
+
}];
|
|
665
|
+
}, {
|
|
666
|
+
readonly name: "Decided";
|
|
667
|
+
readonly type: "event";
|
|
668
|
+
readonly inputs: readonly [{
|
|
669
|
+
readonly type: "uint256";
|
|
670
|
+
readonly name: "jobId";
|
|
671
|
+
readonly indexed: true;
|
|
672
|
+
}, {
|
|
673
|
+
readonly type: "bool";
|
|
674
|
+
readonly name: "approved";
|
|
675
|
+
}, {
|
|
676
|
+
readonly type: "uint64";
|
|
677
|
+
readonly name: "challengeEnds";
|
|
678
|
+
}];
|
|
679
|
+
}, {
|
|
680
|
+
readonly name: "Disputed";
|
|
681
|
+
readonly type: "event";
|
|
682
|
+
readonly inputs: readonly [{
|
|
683
|
+
readonly type: "uint256";
|
|
684
|
+
readonly name: "jobId";
|
|
685
|
+
readonly indexed: true;
|
|
686
|
+
}, {
|
|
687
|
+
readonly type: "address";
|
|
688
|
+
readonly name: "challenger";
|
|
689
|
+
readonly indexed: true;
|
|
690
|
+
}, {
|
|
691
|
+
readonly type: "bytes32";
|
|
692
|
+
readonly name: "evidence";
|
|
693
|
+
}];
|
|
694
|
+
}, {
|
|
695
|
+
readonly name: "Resolved";
|
|
696
|
+
readonly type: "event";
|
|
697
|
+
readonly inputs: readonly [{
|
|
698
|
+
readonly type: "uint256";
|
|
699
|
+
readonly name: "jobId";
|
|
700
|
+
readonly indexed: true;
|
|
701
|
+
}, {
|
|
702
|
+
readonly type: "bool";
|
|
703
|
+
readonly name: "approved";
|
|
704
|
+
}, {
|
|
705
|
+
readonly type: "bool";
|
|
706
|
+
readonly name: "overturned";
|
|
707
|
+
}, {
|
|
708
|
+
readonly type: "bytes32";
|
|
709
|
+
readonly name: "reason";
|
|
710
|
+
}];
|
|
711
|
+
}, {
|
|
712
|
+
readonly name: "Slashed";
|
|
713
|
+
readonly type: "event";
|
|
714
|
+
readonly inputs: readonly [{
|
|
715
|
+
readonly type: "uint256";
|
|
716
|
+
readonly name: "jobId";
|
|
717
|
+
readonly indexed: true;
|
|
718
|
+
}, {
|
|
719
|
+
readonly type: "address";
|
|
720
|
+
readonly name: "account";
|
|
721
|
+
readonly indexed: true;
|
|
722
|
+
}, {
|
|
723
|
+
readonly type: "uint256";
|
|
724
|
+
readonly name: "amount";
|
|
725
|
+
}];
|
|
726
|
+
}, {
|
|
727
|
+
readonly name: "Failed";
|
|
728
|
+
readonly type: "event";
|
|
729
|
+
readonly inputs: readonly [{
|
|
730
|
+
readonly type: "uint256";
|
|
731
|
+
readonly name: "jobId";
|
|
732
|
+
readonly indexed: true;
|
|
733
|
+
}];
|
|
734
|
+
}, {
|
|
735
|
+
readonly name: "Finalized";
|
|
736
|
+
readonly type: "event";
|
|
737
|
+
readonly inputs: readonly [{
|
|
738
|
+
readonly type: "uint256";
|
|
739
|
+
readonly name: "jobId";
|
|
740
|
+
readonly indexed: true;
|
|
741
|
+
}, {
|
|
742
|
+
readonly type: "bool";
|
|
743
|
+
readonly name: "approved";
|
|
744
|
+
}, {
|
|
745
|
+
readonly type: "bytes32";
|
|
746
|
+
readonly name: "voteHash";
|
|
747
|
+
}];
|
|
748
|
+
}, {
|
|
749
|
+
readonly name: "Released";
|
|
750
|
+
readonly type: "event";
|
|
751
|
+
readonly inputs: readonly [{
|
|
752
|
+
readonly type: "uint256";
|
|
753
|
+
readonly name: "jobId";
|
|
754
|
+
readonly indexed: true;
|
|
755
|
+
}];
|
|
756
|
+
}, {
|
|
757
|
+
readonly name: "FeedbackFailed";
|
|
758
|
+
readonly type: "event";
|
|
759
|
+
readonly inputs: readonly [{
|
|
760
|
+
readonly type: "uint256";
|
|
761
|
+
readonly name: "jobId";
|
|
762
|
+
readonly indexed: true;
|
|
763
|
+
}, {
|
|
764
|
+
readonly type: "uint256";
|
|
765
|
+
readonly name: "agentId";
|
|
766
|
+
}];
|
|
767
|
+
}, {
|
|
768
|
+
readonly name: "RefundDeferred";
|
|
769
|
+
readonly type: "event";
|
|
770
|
+
readonly inputs: readonly [{
|
|
771
|
+
readonly type: "uint256";
|
|
772
|
+
readonly name: "jobId";
|
|
773
|
+
readonly indexed: true;
|
|
774
|
+
}];
|
|
775
|
+
}, {
|
|
776
|
+
readonly name: "DisputeExpired";
|
|
777
|
+
readonly type: "event";
|
|
778
|
+
readonly inputs: readonly [{
|
|
779
|
+
readonly type: "uint256";
|
|
780
|
+
readonly name: "jobId";
|
|
781
|
+
readonly indexed: true;
|
|
782
|
+
}];
|
|
783
|
+
}, {
|
|
784
|
+
readonly name: "Staked";
|
|
785
|
+
readonly type: "event";
|
|
786
|
+
readonly inputs: readonly [{
|
|
787
|
+
readonly type: "address";
|
|
788
|
+
readonly name: "validator";
|
|
789
|
+
readonly indexed: true;
|
|
790
|
+
}, {
|
|
791
|
+
readonly type: "uint256";
|
|
792
|
+
readonly name: "amount";
|
|
793
|
+
}];
|
|
794
|
+
}, {
|
|
795
|
+
readonly name: "Unstaked";
|
|
796
|
+
readonly type: "event";
|
|
797
|
+
readonly inputs: readonly [{
|
|
798
|
+
readonly type: "address";
|
|
799
|
+
readonly name: "validator";
|
|
800
|
+
readonly indexed: true;
|
|
801
|
+
}, {
|
|
802
|
+
readonly type: "uint256";
|
|
803
|
+
readonly name: "amount";
|
|
804
|
+
}];
|
|
805
|
+
}], undefined>[]>;
|
|
806
|
+
export declare function getAgentScore(client: PublicClient, agentId: bigint, opts?: {
|
|
807
|
+
now?: number;
|
|
808
|
+
} & HistoryOptions): Promise<AgentScore>;
|
|
809
|
+
/** Who hired whom, and how it ended: one edge per client and agent. */
|
|
810
|
+
export interface TrustEdge {
|
|
811
|
+
client: Address;
|
|
812
|
+
agentId: bigint;
|
|
813
|
+
completed: number;
|
|
814
|
+
rejected: number;
|
|
815
|
+
expired: number;
|
|
816
|
+
disputed: number;
|
|
817
|
+
/** Budget of the completed jobs, in base units, per payment token. */
|
|
818
|
+
paid: Partial<Record<Outcome["token"], string>>;
|
|
819
|
+
/** Unix seconds of the first and the latest outcome between the two. */
|
|
820
|
+
first: number;
|
|
821
|
+
latest: number;
|
|
822
|
+
}
|
|
823
|
+
export interface TrustGraph {
|
|
824
|
+
/** The block everything was read at. */
|
|
825
|
+
block: bigint;
|
|
826
|
+
agents: {
|
|
827
|
+
agentId: bigint;
|
|
828
|
+
score: Score;
|
|
829
|
+
}[];
|
|
830
|
+
edges: TrustEdge[];
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* The trust graph of verified work: every agent with a verified outcome, its score, and an edge
|
|
834
|
+
* for each client it worked for. Built from the same records as the score, so an edge exists only
|
|
835
|
+
* where a committee settled a job (or the agent let one expire).
|
|
836
|
+
*/
|
|
837
|
+
export declare function getTrustGraph(client: PublicClient, opts?: {
|
|
838
|
+
now?: number;
|
|
839
|
+
} & HistoryOptions): Promise<TrustGraph>;
|
|
840
|
+
export declare function blockTime(client: PublicClient, block: bigint): Promise<number>;
|