402mob-merchant-sdk 0.4.2 → 0.6.0
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/CHANGELOG.md +24 -1
- package/README.md +53 -2
- package/dist/index.d.ts +264 -1
- package/dist/index.js +239 -0
- package/dist/protected-inspection-schemas.d.ts +2 -0
- package/dist/protected-inspection-schemas.js +3117 -0
- package/dist/protected-inspection-types.d.ts +623 -0
- package/dist/protected-inspection-types.js +1 -0
- package/dist/protected-inspection.d.ts +42 -0
- package/dist/protected-inspection.js +197 -0
- package/dist/protected-work-schemas.d.ts +2 -0
- package/dist/protected-work-schemas.js +2558 -0
- package/dist/protected-work-types.d.ts +524 -0
- package/dist/protected-work-types.js +1 -0
- package/dist/protected-work.d.ts +40 -0
- package/dist/protected-work.js +187 -0
- package/examples/protected-inspection-service.ts +31 -0
- package/examples/protected-work.ts +21 -0
- package/examples/respond-to-work-request.ts +21 -0
- package/package.json +1 -1
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
export type ProtectedInspectionPrepareRequest = {
|
|
2
|
+
"task": {
|
|
3
|
+
"version": "funded-inspection-v1";
|
|
4
|
+
"requestId": string;
|
|
5
|
+
"proposalId": string;
|
|
6
|
+
"proposalTermsHash": string;
|
|
7
|
+
"plan": {
|
|
8
|
+
"version": "buyer-probe-v1";
|
|
9
|
+
"targetUrl": string;
|
|
10
|
+
"method": "GET";
|
|
11
|
+
"paymentRecipient": string;
|
|
12
|
+
"maxTestAmountAtomic": string;
|
|
13
|
+
"maxPaidAttempts": 1;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
"terms": {
|
|
17
|
+
"buyer": string;
|
|
18
|
+
"seller": string;
|
|
19
|
+
"amount": string;
|
|
20
|
+
"deliveryDeadline": number;
|
|
21
|
+
"evaluationPeriod": number;
|
|
22
|
+
"correctionPeriod": number;
|
|
23
|
+
"resolutionDeadline": number;
|
|
24
|
+
"reviewPeriod": number;
|
|
25
|
+
"appealPeriod": number;
|
|
26
|
+
"appealVerifier": string;
|
|
27
|
+
"fallbackVerifier": string;
|
|
28
|
+
"appealOriginHash": string;
|
|
29
|
+
"fallbackOriginHash": string;
|
|
30
|
+
"nonce": string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type ProtectedInspectionFundingRequest = {
|
|
34
|
+
"terms": {
|
|
35
|
+
"buyer": string;
|
|
36
|
+
"seller": string;
|
|
37
|
+
"amount": string;
|
|
38
|
+
"workHash": string;
|
|
39
|
+
"deliveryDeadline": number;
|
|
40
|
+
"evaluationPeriod": number;
|
|
41
|
+
"correctionPeriod": number;
|
|
42
|
+
"resolutionDeadline": number;
|
|
43
|
+
"reviewPeriod": number;
|
|
44
|
+
"appealPeriod": number;
|
|
45
|
+
"appealVerifier": string;
|
|
46
|
+
"fallbackVerifier": string;
|
|
47
|
+
"appealOriginHash": string;
|
|
48
|
+
"fallbackOriginHash": string;
|
|
49
|
+
"verifierHash": "0x9ab07031c15c8a11071e8e65aaeabfb4d11160466bb76c5733477d6436757312";
|
|
50
|
+
"nonce": string;
|
|
51
|
+
};
|
|
52
|
+
"sellerSignature": string;
|
|
53
|
+
"consentUntil": number;
|
|
54
|
+
"appealConsent": string;
|
|
55
|
+
"fallbackConsent": string;
|
|
56
|
+
"task": {
|
|
57
|
+
"version": "funded-inspection-v1";
|
|
58
|
+
"requestId": string;
|
|
59
|
+
"proposalId": string;
|
|
60
|
+
"proposalTermsHash": string;
|
|
61
|
+
"plan": {
|
|
62
|
+
"version": "buyer-probe-v1";
|
|
63
|
+
"targetUrl": string;
|
|
64
|
+
"method": "GET";
|
|
65
|
+
"paymentRecipient": string;
|
|
66
|
+
"maxTestAmountAtomic": string;
|
|
67
|
+
"maxPaidAttempts": 1;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export type ProtectedInspectionChallengeRequest = {
|
|
72
|
+
"action": "read";
|
|
73
|
+
"wallet": string;
|
|
74
|
+
};
|
|
75
|
+
export type ProtectedInspectionSubmissionRequest = {
|
|
76
|
+
"task": {
|
|
77
|
+
"version": "funded-inspection-v1";
|
|
78
|
+
"requestId": string;
|
|
79
|
+
"proposalId": string;
|
|
80
|
+
"proposalTermsHash": string;
|
|
81
|
+
"plan": {
|
|
82
|
+
"version": "buyer-probe-v1";
|
|
83
|
+
"targetUrl": string;
|
|
84
|
+
"method": "GET";
|
|
85
|
+
"paymentRecipient": string;
|
|
86
|
+
"maxTestAmountAtomic": string;
|
|
87
|
+
"maxPaidAttempts": 1;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
"result": unknown;
|
|
91
|
+
"attempt": number;
|
|
92
|
+
"signature": string;
|
|
93
|
+
};
|
|
94
|
+
export type ProtectedInspectionResultRequest = {
|
|
95
|
+
"proof": {
|
|
96
|
+
"wallet": string;
|
|
97
|
+
"expiresAt": number;
|
|
98
|
+
"signature": string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export type ProtectedInspectionPrepareResponse = {
|
|
102
|
+
"jobId": string;
|
|
103
|
+
"terms": {
|
|
104
|
+
"buyer": string;
|
|
105
|
+
"seller": string;
|
|
106
|
+
"amount": string;
|
|
107
|
+
"workHash": string;
|
|
108
|
+
"deliveryDeadline": number;
|
|
109
|
+
"evaluationPeriod": number;
|
|
110
|
+
"correctionPeriod": number;
|
|
111
|
+
"resolutionDeadline": number;
|
|
112
|
+
"reviewPeriod": number;
|
|
113
|
+
"appealPeriod": number;
|
|
114
|
+
"appealVerifier": string;
|
|
115
|
+
"fallbackVerifier": string;
|
|
116
|
+
"appealOriginHash": string;
|
|
117
|
+
"fallbackOriginHash": string;
|
|
118
|
+
"verifierHash": "0x9ab07031c15c8a11071e8e65aaeabfb4d11160466bb76c5733477d6436757312";
|
|
119
|
+
"nonce": string;
|
|
120
|
+
};
|
|
121
|
+
"workHash": string;
|
|
122
|
+
"sellerSigning": {
|
|
123
|
+
"domain": {
|
|
124
|
+
"name": "402Mob Protected Work";
|
|
125
|
+
"version": "3";
|
|
126
|
+
"chainId": 8453;
|
|
127
|
+
"verifyingContract": string;
|
|
128
|
+
};
|
|
129
|
+
"types": {
|
|
130
|
+
"Terms": [{
|
|
131
|
+
"name": "buyer";
|
|
132
|
+
"type": "address";
|
|
133
|
+
}, {
|
|
134
|
+
"name": "seller";
|
|
135
|
+
"type": "address";
|
|
136
|
+
}, {
|
|
137
|
+
"name": "amount";
|
|
138
|
+
"type": "uint256";
|
|
139
|
+
}, {
|
|
140
|
+
"name": "workHash";
|
|
141
|
+
"type": "bytes32";
|
|
142
|
+
}, {
|
|
143
|
+
"name": "deliveryDeadline";
|
|
144
|
+
"type": "uint256";
|
|
145
|
+
}, {
|
|
146
|
+
"name": "evaluationPeriod";
|
|
147
|
+
"type": "uint256";
|
|
148
|
+
}, {
|
|
149
|
+
"name": "correctionPeriod";
|
|
150
|
+
"type": "uint256";
|
|
151
|
+
}, {
|
|
152
|
+
"name": "resolutionDeadline";
|
|
153
|
+
"type": "uint256";
|
|
154
|
+
}, {
|
|
155
|
+
"name": "reviewPeriod";
|
|
156
|
+
"type": "uint256";
|
|
157
|
+
}, {
|
|
158
|
+
"name": "appealPeriod";
|
|
159
|
+
"type": "uint256";
|
|
160
|
+
}, {
|
|
161
|
+
"name": "appealVerifier";
|
|
162
|
+
"type": "address";
|
|
163
|
+
}, {
|
|
164
|
+
"name": "fallbackVerifier";
|
|
165
|
+
"type": "address";
|
|
166
|
+
}, {
|
|
167
|
+
"name": "appealOriginHash";
|
|
168
|
+
"type": "bytes32";
|
|
169
|
+
}, {
|
|
170
|
+
"name": "fallbackOriginHash";
|
|
171
|
+
"type": "bytes32";
|
|
172
|
+
}, {
|
|
173
|
+
"name": "verifierHash";
|
|
174
|
+
"type": "bytes32";
|
|
175
|
+
}, {
|
|
176
|
+
"name": "nonce";
|
|
177
|
+
"type": "bytes32";
|
|
178
|
+
}];
|
|
179
|
+
};
|
|
180
|
+
"primaryType": "Terms";
|
|
181
|
+
"message": {
|
|
182
|
+
"buyer": string;
|
|
183
|
+
"seller": string;
|
|
184
|
+
"amount": string;
|
|
185
|
+
"workHash": string;
|
|
186
|
+
"deliveryDeadline": number;
|
|
187
|
+
"evaluationPeriod": number;
|
|
188
|
+
"correctionPeriod": number;
|
|
189
|
+
"resolutionDeadline": number;
|
|
190
|
+
"reviewPeriod": number;
|
|
191
|
+
"appealPeriod": number;
|
|
192
|
+
"appealVerifier": string;
|
|
193
|
+
"fallbackVerifier": string;
|
|
194
|
+
"appealOriginHash": string;
|
|
195
|
+
"fallbackOriginHash": string;
|
|
196
|
+
"verifierHash": "0x9ab07031c15c8a11071e8e65aaeabfb4d11160466bb76c5733477d6436757312";
|
|
197
|
+
"nonce": string;
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
export type ProtectedInspectionFundingResponse = {
|
|
202
|
+
"jobId": string;
|
|
203
|
+
"transactions": Array<{
|
|
204
|
+
"chainId": 8453;
|
|
205
|
+
"to": string;
|
|
206
|
+
"data": string;
|
|
207
|
+
"value": "0";
|
|
208
|
+
"from"?: string;
|
|
209
|
+
}>;
|
|
210
|
+
"instruction": string;
|
|
211
|
+
};
|
|
212
|
+
export type ProtectedInspectionStatus = {
|
|
213
|
+
"jobId": string;
|
|
214
|
+
"terms": {
|
|
215
|
+
"buyer": string;
|
|
216
|
+
"seller": string;
|
|
217
|
+
"amount": string;
|
|
218
|
+
"workHash": string;
|
|
219
|
+
"deliveryDeadline": number;
|
|
220
|
+
"evaluationPeriod": number;
|
|
221
|
+
"correctionPeriod": number;
|
|
222
|
+
"resolutionDeadline": number;
|
|
223
|
+
"reviewPeriod": number;
|
|
224
|
+
"appealPeriod": number;
|
|
225
|
+
"appealVerifier": string;
|
|
226
|
+
"fallbackVerifier": string;
|
|
227
|
+
"appealOriginHash": string;
|
|
228
|
+
"fallbackOriginHash": string;
|
|
229
|
+
"verifierHash": "0x9ab07031c15c8a11071e8e65aaeabfb4d11160466bb76c5733477d6436757312";
|
|
230
|
+
"nonce": string;
|
|
231
|
+
};
|
|
232
|
+
"state": "unknown" | "funded" | "submitted" | "rejected" | "review" | "challenged" | "approved" | "completed" | "refunded";
|
|
233
|
+
"attempt": number;
|
|
234
|
+
"resultHash": string | null;
|
|
235
|
+
"evaluationUntil": number;
|
|
236
|
+
"correctionUntil": number;
|
|
237
|
+
"fallbackUntil": number;
|
|
238
|
+
"buyerReceived": boolean;
|
|
239
|
+
"outcome": "none" | "buyer_accepted" | "review_elapsed" | "appeal_approved" | "verifier_rejected" | "no_submission" | "evaluation_timeout" | "uncorrected_rejection" | "verifiers_unavailable";
|
|
240
|
+
"activeAppealRound": number | null;
|
|
241
|
+
"reviewUntil": number;
|
|
242
|
+
"appealUntil": number;
|
|
243
|
+
"appealUsed": boolean;
|
|
244
|
+
"reason": number;
|
|
245
|
+
"evidenceHash": string;
|
|
246
|
+
"chainTimestamp": number;
|
|
247
|
+
"refundEligible": boolean;
|
|
248
|
+
"payoutEligible": boolean;
|
|
249
|
+
"refundTransaction": {
|
|
250
|
+
"chainId": 8453;
|
|
251
|
+
"to": string;
|
|
252
|
+
"data": string;
|
|
253
|
+
"value": "0";
|
|
254
|
+
"from"?: string;
|
|
255
|
+
};
|
|
256
|
+
"finalizeTransaction": {
|
|
257
|
+
"chainId": 8453;
|
|
258
|
+
"to": string;
|
|
259
|
+
"data": string;
|
|
260
|
+
"value": "0";
|
|
261
|
+
"from"?: string;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
export type ProtectedInspectionChallenge = {
|
|
265
|
+
"message": string;
|
|
266
|
+
"expiresAt": number;
|
|
267
|
+
"wallet": string;
|
|
268
|
+
"action": "read";
|
|
269
|
+
};
|
|
270
|
+
export type ProtectedInspectionSubmissionResponse = {
|
|
271
|
+
"jobId": string;
|
|
272
|
+
"resultHash": string;
|
|
273
|
+
"attempt": number;
|
|
274
|
+
"replay": boolean;
|
|
275
|
+
"submissionTransaction": {
|
|
276
|
+
"chainId": 8453;
|
|
277
|
+
"to": string;
|
|
278
|
+
"data": string;
|
|
279
|
+
"value": "0";
|
|
280
|
+
"from"?: string;
|
|
281
|
+
} | null;
|
|
282
|
+
"relay": {
|
|
283
|
+
"queued": boolean;
|
|
284
|
+
"id": string | null;
|
|
285
|
+
};
|
|
286
|
+
"retainedUntil": string;
|
|
287
|
+
};
|
|
288
|
+
export type ProtectedInspectionResult = {
|
|
289
|
+
"jobId": string;
|
|
290
|
+
"state": "unknown" | "funded" | "submitted" | "rejected" | "review" | "challenged" | "approved" | "completed" | "refunded";
|
|
291
|
+
"attempt": number;
|
|
292
|
+
"resultHash": string;
|
|
293
|
+
"task": {
|
|
294
|
+
"version": "funded-inspection-v1";
|
|
295
|
+
"requestId": string;
|
|
296
|
+
"proposalId": string;
|
|
297
|
+
"proposalTermsHash": string;
|
|
298
|
+
"plan": {
|
|
299
|
+
"version": "buyer-probe-v1";
|
|
300
|
+
"targetUrl": string;
|
|
301
|
+
"method": "GET";
|
|
302
|
+
"paymentRecipient": string;
|
|
303
|
+
"maxTestAmountAtomic": string;
|
|
304
|
+
"maxPaidAttempts": 1;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
"result": unknown;
|
|
308
|
+
};
|
|
309
|
+
export type ProtectedInspectionCapability = {
|
|
310
|
+
"protocol": string;
|
|
311
|
+
"configured": boolean;
|
|
312
|
+
"status": string;
|
|
313
|
+
"descriptor": string;
|
|
314
|
+
"guide": string;
|
|
315
|
+
"verifierHash": string;
|
|
316
|
+
"task": string;
|
|
317
|
+
"network": string;
|
|
318
|
+
"asset": string;
|
|
319
|
+
"settlement": string;
|
|
320
|
+
"serviceFeeMaximumAtomic": string;
|
|
321
|
+
"testBudgetMaximumAtomic": string;
|
|
322
|
+
"maxPaidAttempts": number;
|
|
323
|
+
"verification": string;
|
|
324
|
+
"startGate": string;
|
|
325
|
+
"runtime": string;
|
|
326
|
+
"clients": string;
|
|
327
|
+
"relayEnabled": boolean;
|
|
328
|
+
"productionValidated": boolean;
|
|
329
|
+
};
|
|
330
|
+
export type ProtectedInspectionCandidateRequest = {
|
|
331
|
+
"attempt": number;
|
|
332
|
+
"resultHash": string;
|
|
333
|
+
};
|
|
334
|
+
export type ProtectedInspectionActionRequest = {
|
|
335
|
+
"action": "receipt";
|
|
336
|
+
"signature"?: string;
|
|
337
|
+
} | {
|
|
338
|
+
"action": "accept";
|
|
339
|
+
"signature"?: string;
|
|
340
|
+
} | {
|
|
341
|
+
"action": "challenge";
|
|
342
|
+
"reason": "wrong_output" | "rules_mismatch" | "result_unavailable" | "evaluator_timeout";
|
|
343
|
+
"evidenceHash": string;
|
|
344
|
+
"signature"?: string;
|
|
345
|
+
} | {
|
|
346
|
+
"action": "finalize";
|
|
347
|
+
} | {
|
|
348
|
+
"action": "refund";
|
|
349
|
+
};
|
|
350
|
+
export type ProtectedInspectionAppealRequest = {
|
|
351
|
+
"round": number;
|
|
352
|
+
"valid": boolean;
|
|
353
|
+
"signature": string;
|
|
354
|
+
};
|
|
355
|
+
export type ProtectedInspectionEvaluationRequest = {};
|
|
356
|
+
export type ProtectedInspectionCandidateSigning = {
|
|
357
|
+
"signing": {
|
|
358
|
+
"domain": {
|
|
359
|
+
"name": "402Mob Protected Work";
|
|
360
|
+
"version": "3";
|
|
361
|
+
"chainId": 8453;
|
|
362
|
+
"verifyingContract": string;
|
|
363
|
+
};
|
|
364
|
+
"types": {
|
|
365
|
+
"Candidate": [{
|
|
366
|
+
"name": "jobId";
|
|
367
|
+
"type": "bytes32";
|
|
368
|
+
}, {
|
|
369
|
+
"name": "attempt";
|
|
370
|
+
"type": "uint256";
|
|
371
|
+
}, {
|
|
372
|
+
"name": "resultHash";
|
|
373
|
+
"type": "bytes32";
|
|
374
|
+
}];
|
|
375
|
+
};
|
|
376
|
+
"primaryType": "Candidate";
|
|
377
|
+
"message": {
|
|
378
|
+
"jobId": string;
|
|
379
|
+
"attempt": number;
|
|
380
|
+
"resultHash": string;
|
|
381
|
+
};
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
export type ProtectedInspectionEvaluationResponse = {
|
|
385
|
+
"jobId": string;
|
|
386
|
+
"resultHash": string;
|
|
387
|
+
"attempt": number;
|
|
388
|
+
"valid": boolean;
|
|
389
|
+
"evaluationTransaction": {
|
|
390
|
+
"chainId": 8453;
|
|
391
|
+
"to": string;
|
|
392
|
+
"data": string;
|
|
393
|
+
"value": "0";
|
|
394
|
+
"from"?: string;
|
|
395
|
+
};
|
|
396
|
+
"relay": {
|
|
397
|
+
"queued": boolean;
|
|
398
|
+
"id": string | null;
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
export type ProtectedInspectionActionResponse = {
|
|
402
|
+
"signing": {
|
|
403
|
+
"domain": {
|
|
404
|
+
"name": "402Mob Protected Work";
|
|
405
|
+
"version": "3";
|
|
406
|
+
"chainId": 8453;
|
|
407
|
+
"verifyingContract": string;
|
|
408
|
+
};
|
|
409
|
+
"types": {
|
|
410
|
+
"Accept": [{
|
|
411
|
+
"name": "jobId";
|
|
412
|
+
"type": "bytes32";
|
|
413
|
+
}, {
|
|
414
|
+
"name": "attempt";
|
|
415
|
+
"type": "uint256";
|
|
416
|
+
}, {
|
|
417
|
+
"name": "resultHash";
|
|
418
|
+
"type": "bytes32";
|
|
419
|
+
}];
|
|
420
|
+
};
|
|
421
|
+
"primaryType": "Accept";
|
|
422
|
+
"message": {
|
|
423
|
+
"jobId": string;
|
|
424
|
+
"attempt": number;
|
|
425
|
+
"resultHash": string;
|
|
426
|
+
};
|
|
427
|
+
} | {
|
|
428
|
+
"domain": {
|
|
429
|
+
"name": "402Mob Protected Work";
|
|
430
|
+
"version": "3";
|
|
431
|
+
"chainId": 8453;
|
|
432
|
+
"verifyingContract": string;
|
|
433
|
+
};
|
|
434
|
+
"types": {
|
|
435
|
+
"Challenge": [{
|
|
436
|
+
"name": "jobId";
|
|
437
|
+
"type": "bytes32";
|
|
438
|
+
}, {
|
|
439
|
+
"name": "attempt";
|
|
440
|
+
"type": "uint256";
|
|
441
|
+
}, {
|
|
442
|
+
"name": "resultHash";
|
|
443
|
+
"type": "bytes32";
|
|
444
|
+
}, {
|
|
445
|
+
"name": "reason";
|
|
446
|
+
"type": "uint8";
|
|
447
|
+
}, {
|
|
448
|
+
"name": "evidenceHash";
|
|
449
|
+
"type": "bytes32";
|
|
450
|
+
}];
|
|
451
|
+
};
|
|
452
|
+
"primaryType": "Challenge";
|
|
453
|
+
"message": {
|
|
454
|
+
"jobId": string;
|
|
455
|
+
"attempt": number;
|
|
456
|
+
"resultHash": string;
|
|
457
|
+
"reason": number;
|
|
458
|
+
"evidenceHash": string;
|
|
459
|
+
};
|
|
460
|
+
} | {
|
|
461
|
+
"domain": {
|
|
462
|
+
"name": "402Mob Protected Work";
|
|
463
|
+
"version": "3";
|
|
464
|
+
"chainId": 8453;
|
|
465
|
+
"verifyingContract": string;
|
|
466
|
+
};
|
|
467
|
+
"types": {
|
|
468
|
+
"Receipt": [{
|
|
469
|
+
"name": "jobId";
|
|
470
|
+
"type": "bytes32";
|
|
471
|
+
}, {
|
|
472
|
+
"name": "attempt";
|
|
473
|
+
"type": "uint256";
|
|
474
|
+
}, {
|
|
475
|
+
"name": "resultHash";
|
|
476
|
+
"type": "bytes32";
|
|
477
|
+
}];
|
|
478
|
+
};
|
|
479
|
+
"primaryType": "Receipt";
|
|
480
|
+
"message": {
|
|
481
|
+
"jobId": string;
|
|
482
|
+
"attempt": number;
|
|
483
|
+
"resultHash": string;
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
"transaction": null;
|
|
487
|
+
"relay": {
|
|
488
|
+
"queued": boolean;
|
|
489
|
+
"id": string | null;
|
|
490
|
+
};
|
|
491
|
+
} | {
|
|
492
|
+
"signing": null;
|
|
493
|
+
"transaction": {
|
|
494
|
+
"chainId": 8453;
|
|
495
|
+
"to": string;
|
|
496
|
+
"data": string;
|
|
497
|
+
"value": "0";
|
|
498
|
+
"from"?: string;
|
|
499
|
+
};
|
|
500
|
+
"relay": {
|
|
501
|
+
"queued": boolean;
|
|
502
|
+
"id": string | null;
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
export type ProtectedInspectionAppealResponse = {
|
|
506
|
+
"transaction": {
|
|
507
|
+
"chainId": 8453;
|
|
508
|
+
"to": string;
|
|
509
|
+
"data": string;
|
|
510
|
+
"value": "0";
|
|
511
|
+
"from"?: string;
|
|
512
|
+
};
|
|
513
|
+
"relay": {
|
|
514
|
+
"queued": boolean;
|
|
515
|
+
"id": string | null;
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
export type ProtectedInspectionReplicasRequest = {
|
|
519
|
+
"attempt": number;
|
|
520
|
+
"resultHash": string;
|
|
521
|
+
"replicaA": string;
|
|
522
|
+
"replicaB": string;
|
|
523
|
+
};
|
|
524
|
+
export type ProtectedInspectionReplicasResponse = {
|
|
525
|
+
"jobId": string;
|
|
526
|
+
"attempt": number;
|
|
527
|
+
"resultHash": string;
|
|
528
|
+
"replicated": true;
|
|
529
|
+
};
|
|
530
|
+
export type ProtectedInspectionObservationRequest = {
|
|
531
|
+
"task": {
|
|
532
|
+
"version": "funded-inspection-v1";
|
|
533
|
+
"requestId": string;
|
|
534
|
+
"proposalId": string;
|
|
535
|
+
"proposalTermsHash": string;
|
|
536
|
+
"plan": {
|
|
537
|
+
"version": "buyer-probe-v1";
|
|
538
|
+
"targetUrl": string;
|
|
539
|
+
"method": "GET";
|
|
540
|
+
"paymentRecipient": string;
|
|
541
|
+
"maxTestAmountAtomic": string;
|
|
542
|
+
"maxPaidAttempts": 1;
|
|
543
|
+
};
|
|
544
|
+
};
|
|
545
|
+
"evidence": {
|
|
546
|
+
"version": "inspection-result-v1";
|
|
547
|
+
"observation": {
|
|
548
|
+
"observedAt": number;
|
|
549
|
+
"probeNonce": string;
|
|
550
|
+
"transport": "http" | "error";
|
|
551
|
+
"statusCode": number | null;
|
|
552
|
+
"responseHash": string | null;
|
|
553
|
+
"authorizationIssued": boolean;
|
|
554
|
+
"paymentAmountAtomic": string;
|
|
555
|
+
"paymentTransaction": string | null;
|
|
556
|
+
};
|
|
557
|
+
"buyerSignature": string;
|
|
558
|
+
"classification": "payment_confirmed_response_received" | "payment_confirmed_endpoint_failure" | "payment_outcome_unresolved" | "unpaid_response" | "transport_failure";
|
|
559
|
+
};
|
|
560
|
+
};
|
|
561
|
+
export type ProtectedInspectionObservationResponse = {
|
|
562
|
+
"jobId": string;
|
|
563
|
+
"retained": true;
|
|
564
|
+
"replay": boolean;
|
|
565
|
+
};
|
|
566
|
+
export type ProtectedInspectionStartRequest = {
|
|
567
|
+
"proof": {
|
|
568
|
+
"wallet": string;
|
|
569
|
+
"expiresAt": number;
|
|
570
|
+
"signature": string;
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
export type ProtectedInspectionStartResponse = {
|
|
574
|
+
"jobId": string;
|
|
575
|
+
"startAllowed": true;
|
|
576
|
+
"task": {
|
|
577
|
+
"version": "funded-inspection-v1";
|
|
578
|
+
"requestId": string;
|
|
579
|
+
"proposalId": string;
|
|
580
|
+
"proposalTermsHash": string;
|
|
581
|
+
"plan": {
|
|
582
|
+
"version": "buyer-probe-v1";
|
|
583
|
+
"targetUrl": string;
|
|
584
|
+
"method": "GET";
|
|
585
|
+
"paymentRecipient": string;
|
|
586
|
+
"maxTestAmountAtomic": string;
|
|
587
|
+
"maxPaidAttempts": 1;
|
|
588
|
+
};
|
|
589
|
+
};
|
|
590
|
+
"evidence": {
|
|
591
|
+
"version": "inspection-result-v1";
|
|
592
|
+
"observation": {
|
|
593
|
+
"observedAt": number;
|
|
594
|
+
"probeNonce": string;
|
|
595
|
+
"transport": "http" | "error";
|
|
596
|
+
"statusCode": number | null;
|
|
597
|
+
"responseHash": string | null;
|
|
598
|
+
"authorizationIssued": boolean;
|
|
599
|
+
"paymentAmountAtomic": string;
|
|
600
|
+
"paymentTransaction": string | null;
|
|
601
|
+
};
|
|
602
|
+
"buyerSignature": string;
|
|
603
|
+
"classification": "payment_confirmed_response_received" | "payment_confirmed_endpoint_failure" | "payment_outcome_unresolved" | "unpaid_response" | "transport_failure";
|
|
604
|
+
};
|
|
605
|
+
"terms": {
|
|
606
|
+
"buyer": string;
|
|
607
|
+
"seller": string;
|
|
608
|
+
"amount": string;
|
|
609
|
+
"workHash": string;
|
|
610
|
+
"deliveryDeadline": number;
|
|
611
|
+
"evaluationPeriod": number;
|
|
612
|
+
"correctionPeriod": number;
|
|
613
|
+
"resolutionDeadline": number;
|
|
614
|
+
"reviewPeriod": number;
|
|
615
|
+
"appealPeriod": number;
|
|
616
|
+
"appealVerifier": string;
|
|
617
|
+
"fallbackVerifier": string;
|
|
618
|
+
"appealOriginHash": string;
|
|
619
|
+
"fallbackOriginHash": string;
|
|
620
|
+
"verifierHash": "0x9ab07031c15c8a11071e8e65aaeabfb4d11160466bb76c5733477d6436757312";
|
|
621
|
+
"nonce": string;
|
|
622
|
+
};
|
|
623
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type * as T from './protected-inspection-types.js';
|
|
2
|
+
export * from './protected-inspection-types.js';
|
|
3
|
+
export declare class ProtectedInspectionApiError extends Error {
|
|
4
|
+
readonly status: number;
|
|
5
|
+
readonly code: string;
|
|
6
|
+
constructor(status: number, code: string, message: string);
|
|
7
|
+
}
|
|
8
|
+
export interface ProtectedInspectionClientOptions {
|
|
9
|
+
/** Exact HTTPS origin. HTTP is allowed only for loopback integration tests. */
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
/** Pin the reviewed contract and verifier before requesting signing data or transactions. */
|
|
12
|
+
contract?: string;
|
|
13
|
+
verifierHash?: string;
|
|
14
|
+
fetch?: typeof globalThis.fetch;
|
|
15
|
+
}
|
|
16
|
+
/** HTTP transport only. No keys, merchant bearer tokens, wallet signing or transaction broadcasting. */
|
|
17
|
+
export declare class ProtectedInspectionClient {
|
|
18
|
+
private readonly origin;
|
|
19
|
+
private readonly contract;
|
|
20
|
+
private readonly verifierHash;
|
|
21
|
+
private readonly fetcher;
|
|
22
|
+
constructor(options?: ProtectedInspectionClientOptions);
|
|
23
|
+
getCapabilities(): Promise<T.ProtectedInspectionCapability>;
|
|
24
|
+
prepare(input: T.ProtectedInspectionPrepareRequest): Promise<T.ProtectedInspectionPrepareResponse>;
|
|
25
|
+
prepareFunding(input: T.ProtectedInspectionFundingRequest): Promise<T.ProtectedInspectionFundingResponse>;
|
|
26
|
+
getJob(id: string): Promise<T.ProtectedInspectionStatus>;
|
|
27
|
+
createReadChallenge(id: string, input: T.ProtectedInspectionChallengeRequest): Promise<T.ProtectedInspectionChallenge>;
|
|
28
|
+
createCandidateSigning(id: string, input: T.ProtectedInspectionCandidateRequest): Promise<T.ProtectedInspectionCandidateSigning>;
|
|
29
|
+
submitCandidate(id: string, input: T.ProtectedInspectionSubmissionRequest): Promise<T.ProtectedInspectionSubmissionResponse>;
|
|
30
|
+
attachReplicas(id: string, input: T.ProtectedInspectionReplicasRequest): Promise<T.ProtectedInspectionReplicasResponse>;
|
|
31
|
+
evaluate(id: string): Promise<T.ProtectedInspectionEvaluationResponse>;
|
|
32
|
+
readResult(id: string, input: T.ProtectedInspectionResultRequest): Promise<T.ProtectedInspectionResult>;
|
|
33
|
+
/** With no signature, requests a draft. Submit the returned transaction yourself; inspections have no hosted relay. */
|
|
34
|
+
requestAction(id: string, input: T.ProtectedInspectionActionRequest): Promise<T.ProtectedInspectionActionResponse>;
|
|
35
|
+
submitAppeal(id: string, input: T.ProtectedInspectionAppealRequest): Promise<T.ProtectedInspectionAppealResponse>;
|
|
36
|
+
submitObservation(id: string, input: T.ProtectedInspectionObservationRequest): Promise<T.ProtectedInspectionObservationResponse>;
|
|
37
|
+
start(id: string, input: T.ProtectedInspectionStartRequest): Promise<T.ProtectedInspectionStartResponse>;
|
|
38
|
+
private job;
|
|
39
|
+
private invalid;
|
|
40
|
+
private transaction;
|
|
41
|
+
private call;
|
|
42
|
+
}
|