@moonbeam-foundation/sdk 0.5.2 → 0.7.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.
Files changed (106) hide show
  1. package/README.md +137 -38
  2. package/dist/abi/index.d.ts +55 -0
  3. package/dist/abi/index.d.ts.map +1 -0
  4. package/dist/abi/index.js +227 -0
  5. package/dist/abi/index.js.map +1 -0
  6. package/dist/acp/events.d.ts +38 -38
  7. package/dist/acp/events.d.ts.map +1 -1
  8. package/dist/acp/events.js.map +1 -1
  9. package/dist/acp/moonbeam-acp.generated.d.ts +50 -0
  10. package/dist/acp/moonbeam-acp.generated.d.ts.map +1 -0
  11. package/dist/acp/moonbeam-acp.generated.js +56 -0
  12. package/dist/acp/moonbeam-acp.generated.js.map +1 -0
  13. package/dist/acp/pipeline.js.map +1 -1
  14. package/dist/acp/registry.d.ts.map +1 -1
  15. package/dist/acp/registry.js +5 -3
  16. package/dist/acp/registry.js.map +1 -1
  17. package/dist/actors/track-record.js.map +1 -1
  18. package/dist/adapters/acp.js.map +1 -1
  19. package/dist/adapters/stamp.d.ts +1 -1
  20. package/dist/adapters/stamp.d.ts.map +1 -1
  21. package/dist/arbitration/index.d.ts +120 -0
  22. package/dist/arbitration/index.d.ts.map +1 -0
  23. package/dist/arbitration/index.js +116 -0
  24. package/dist/arbitration/index.js.map +1 -0
  25. package/dist/assurance/assurance-shared.d.ts +1924 -0
  26. package/dist/assurance/assurance-shared.d.ts.map +1 -0
  27. package/dist/assurance/assurance-shared.js +2225 -0
  28. package/dist/assurance/assurance-shared.js.map +1 -0
  29. package/dist/assurance/index.d.ts +57 -0
  30. package/dist/assurance/index.d.ts.map +1 -0
  31. package/dist/assurance/index.js +49 -0
  32. package/dist/assurance/index.js.map +1 -0
  33. package/dist/attest/index.d.ts +19 -0
  34. package/dist/attest/index.d.ts.map +1 -0
  35. package/dist/attest/index.js +17 -0
  36. package/dist/attest/index.js.map +1 -0
  37. package/dist/client/index.d.ts +16 -6
  38. package/dist/client/index.d.ts.map +1 -1
  39. package/dist/client/index.js +21 -1
  40. package/dist/client/index.js.map +1 -1
  41. package/dist/connect/logs.js.map +1 -1
  42. package/dist/core/money.js.map +1 -1
  43. package/dist/core/settle.js.map +1 -1
  44. package/dist/core/types.d.ts +1 -1
  45. package/dist/erc8004/index.d.ts +9 -9
  46. package/dist/erc8004/index.d.ts.map +1 -1
  47. package/dist/erc8004/index.js.map +1 -1
  48. package/dist/erc8183/index.d.ts +12 -12
  49. package/dist/erc8183/index.d.ts.map +1 -1
  50. package/dist/erc8183/index.js.map +1 -1
  51. package/dist/index.d.ts +7 -0
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +8 -0
  54. package/dist/index.js.map +1 -1
  55. package/dist/judge/index.d.ts +35 -3
  56. package/dist/judge/index.d.ts.map +1 -1
  57. package/dist/judge/index.js +41 -2
  58. package/dist/judge/index.js.map +1 -1
  59. package/dist/launcher/index.d.ts +3 -3
  60. package/dist/launcher/index.d.ts.map +1 -1
  61. package/dist/onboard/index.d.ts +64 -24
  62. package/dist/onboard/index.d.ts.map +1 -1
  63. package/dist/onboard/index.js +90 -15
  64. package/dist/onboard/index.js.map +1 -1
  65. package/dist/pools/index.d.ts +49 -7
  66. package/dist/pools/index.d.ts.map +1 -1
  67. package/dist/pools/index.js +30 -6
  68. package/dist/pools/index.js.map +1 -1
  69. package/dist/proof/index.d.ts +117 -0
  70. package/dist/proof/index.d.ts.map +1 -0
  71. package/dist/proof/index.js +81 -0
  72. package/dist/proof/index.js.map +1 -0
  73. package/dist/resale/index.d.ts +120 -0
  74. package/dist/resale/index.d.ts.map +1 -0
  75. package/dist/resale/index.js +117 -0
  76. package/dist/resale/index.js.map +1 -0
  77. package/dist/resale/payment-scheme.d.mts +46 -0
  78. package/dist/resale/payment-scheme.mjs +351 -0
  79. package/dist/resale/payment-scheme.pin.json +6 -0
  80. package/dist/rpc/index.d.ts +24 -0
  81. package/dist/rpc/index.d.ts.map +1 -0
  82. package/dist/rpc/index.js +66 -0
  83. package/dist/rpc/index.js.map +1 -0
  84. package/dist/x402/index.d.ts +90 -0
  85. package/dist/x402/index.d.ts.map +1 -0
  86. package/dist/x402/index.js +75 -0
  87. package/dist/x402/index.js.map +1 -0
  88. package/examples/03-end-to-end-offline.mjs +2 -2
  89. package/examples/14-grade-record.mjs +6 -4
  90. package/examples/17-grade-live.mjs +1 -1
  91. package/examples/20-onboard-client.mjs +2 -2
  92. package/examples/24-resell-on-base.mjs +17 -0
  93. package/examples/{30-read-a-real-job.mjs → 30-read-a-job.mjs} +2 -2
  94. package/examples/32-read-live-from-base.mjs +8 -11
  95. package/examples/40-the-article.mjs +1 -1
  96. package/examples/50-x402-pay-a-wall.mjs +17 -0
  97. package/examples/51-read-a-proof.mjs +21 -0
  98. package/examples/52-arbitration-calls.mjs +13 -0
  99. package/examples/53-attested-by-default.mjs +19 -0
  100. package/examples/README.md +13 -6
  101. package/examples/data/proof-base-tx-52587000.json +116 -0
  102. package/package.json +51 -10
  103. package/skills/moonbeam-actor-backer/SKILL.md +1 -1
  104. package/skills/moonbeam-actor-challenger/SKILL.md +1 -1
  105. package/skills/moonbeam-actor-doubter/SKILL.md +1 -1
  106. package/skills/moonbeam-assurance/SKILL.md +1 -1
@@ -0,0 +1,1924 @@
1
+ /**
2
+ * @taifoon/assurance: the assurance product's core. _ASSURANCE_CORE_v1_
3
+ *
4
+ * ONE file with NO imports, pure and browser-safe, so a project that cannot install this package (the site, the SDKs)
5
+ * carries a byte-identical copy and pins its hash (scripts/sync.mjs). What is in it:
6
+ *
7
+ * machine the coordination state machine, generated from schemas/transitions.json: every state, every transition
8
+ * with its trigger and actor per lane, every timeout, ending and exclusion, the source vocabularies, the money
9
+ * effects, the external-cover policy machine, and the revenue hooks of schemas/phase-map.json.
10
+ * next next(state, event, ctx): one step of a job, from a named transition, a source event or the clock.
11
+ * endings endingOf(job): how a job ended, the verdict it writes into the seller's record, and what external cover
12
+ * does with it; whoCanEnd(state): who may end each held state, and when.
13
+ * the job the venue-neutral assured job: price, deposit, cover, evaluator, deadlines, terms.
14
+ * flows quote, buy, settle, claim, composed from an Economy the caller passes in (jev-wilson's economy); this file
15
+ * computes no premium, leg or compensation itself: it picks, checks and refuses.
16
+ *
17
+ * Nothing here reads a network, signs or holds a key. Amounts are bigint smallest units.
18
+ */
19
+ export declare const MACHINE: {
20
+ readonly version: "coordination.transitions.v1";
21
+ readonly initial: "Open";
22
+ readonly lanes: readonly ["handshake", "hook", "erc8183", "erc8183-extra", "memo-acp"];
23
+ readonly continues: {
24
+ readonly handshake: "hook";
25
+ };
26
+ readonly observedLanes: readonly ["olas-mech", "grid"];
27
+ readonly states: readonly [{
28
+ readonly id: "Open";
29
+ readonly terminal: false;
30
+ readonly holdsFunds: false;
31
+ readonly timeout: null;
32
+ }, {
33
+ readonly id: "Delivered";
34
+ readonly terminal: false;
35
+ readonly holdsFunds: false;
36
+ readonly timeout: null;
37
+ }, {
38
+ readonly id: "Created";
39
+ readonly terminal: false;
40
+ readonly holdsFunds: false;
41
+ readonly timeout: {
42
+ readonly after: "expiredAt";
43
+ readonly to: "Cancelled";
44
+ };
45
+ }, {
46
+ readonly id: "Funded";
47
+ readonly terminal: false;
48
+ readonly holdsFunds: true;
49
+ readonly timeout: {
50
+ readonly after: "expiredAt | hook deadline";
51
+ readonly to: "Expired";
52
+ };
53
+ }, {
54
+ readonly id: "Submitted";
55
+ readonly terminal: false;
56
+ readonly holdsFunds: true;
57
+ readonly timeout: {
58
+ readonly after: "expiredAt | hook deadline";
59
+ readonly to: "Expired";
60
+ };
61
+ }, {
62
+ readonly id: "Graded";
63
+ readonly terminal: false;
64
+ readonly holdsFunds: true;
65
+ readonly timeout: {
66
+ readonly after: "hook deadline";
67
+ readonly to: "Expired";
68
+ };
69
+ }, {
70
+ readonly id: "Held";
71
+ readonly terminal: false;
72
+ readonly holdsFunds: true;
73
+ readonly timeout: {
74
+ readonly after: "hook deadline";
75
+ readonly to: "Expired";
76
+ };
77
+ }, {
78
+ readonly id: "Opened";
79
+ readonly terminal: false;
80
+ readonly holdsFunds: true;
81
+ readonly timeout: {
82
+ readonly after: "hook deadline";
83
+ readonly to: "Expired";
84
+ };
85
+ }, {
86
+ readonly id: "RejectPending";
87
+ readonly terminal: false;
88
+ readonly holdsFunds: true;
89
+ readonly timeout: {
90
+ readonly after: "disputeDeadline (RejectProposed field)";
91
+ readonly to: "Rejected";
92
+ };
93
+ }, {
94
+ readonly id: "Disputed";
95
+ readonly terminal: false;
96
+ readonly holdsFunds: true;
97
+ readonly timeout: {
98
+ readonly after: "arbitrationDeadline (DisputeOpened field)";
99
+ readonly to: "Rejected";
100
+ };
101
+ }, {
102
+ readonly id: "Settled";
103
+ readonly terminal: true;
104
+ readonly holdsFunds: false;
105
+ readonly timeout: null;
106
+ }, {
107
+ readonly id: "Rejected";
108
+ readonly terminal: true;
109
+ readonly holdsFunds: false;
110
+ readonly timeout: null;
111
+ }, {
112
+ readonly id: "Expired";
113
+ readonly terminal: true;
114
+ readonly holdsFunds: false;
115
+ readonly timeout: null;
116
+ }, {
117
+ readonly id: "Cheat";
118
+ readonly terminal: true;
119
+ readonly holdsFunds: false;
120
+ readonly timeout: null;
121
+ }, {
122
+ readonly id: "Cancelled";
123
+ readonly terminal: true;
124
+ readonly holdsFunds: false;
125
+ readonly timeout: null;
126
+ }];
127
+ readonly transitions: readonly [{
128
+ readonly id: "dispatch_no_work";
129
+ readonly from: "Open";
130
+ readonly to: "Open";
131
+ readonly timeout: null;
132
+ readonly hook: null;
133
+ readonly by: {
134
+ readonly handshake: {
135
+ readonly type: "offchain";
136
+ readonly name: "dispatch answered without work";
137
+ readonly actor: "layer";
138
+ };
139
+ };
140
+ }, {
141
+ readonly id: "dispatch_delivered";
142
+ readonly from: "Open";
143
+ readonly to: "Delivered";
144
+ readonly timeout: null;
145
+ readonly hook: null;
146
+ readonly by: {
147
+ readonly handshake: {
148
+ readonly type: "offchain";
149
+ readonly name: "reply held with its keccak digest";
150
+ readonly actor: "seller (answers its own endpoint; the layer holds the reply)";
151
+ };
152
+ };
153
+ }, {
154
+ readonly id: "pregrade";
155
+ readonly from: "Delivered";
156
+ readonly to: "Delivered";
157
+ readonly timeout: null;
158
+ readonly hook: null;
159
+ readonly by: {
160
+ readonly handshake: {
161
+ readonly type: "offchain";
162
+ readonly name: "RUBRIC_v1 compose on the handshake subject; decision.v2 anchored on JevDecisionLog (36927)";
163
+ readonly actor: "layer (trial / layer key) or the caller’s TypeSafe credential";
164
+ };
165
+ };
166
+ }, {
167
+ readonly id: "fund_offer";
168
+ readonly from: "Open";
169
+ readonly to: "Funded";
170
+ readonly timeout: null;
171
+ readonly hook: null;
172
+ readonly by: {
173
+ readonly hook: {
174
+ readonly type: "call";
175
+ readonly name: "JobFunded (+ JobCovered)";
176
+ readonly actor: "buyer (after the seller approves D and the buyer approves P + π)";
177
+ };
178
+ };
179
+ }, {
180
+ readonly id: "fund_delivered";
181
+ readonly from: "Delivered";
182
+ readonly to: "Funded";
183
+ readonly timeout: null;
184
+ readonly hook: null;
185
+ readonly by: {
186
+ readonly hook: {
187
+ readonly type: "call";
188
+ readonly name: "JobFunded (+ JobCovered)";
189
+ readonly actor: "buyer";
190
+ };
191
+ };
192
+ }, {
193
+ readonly id: "create";
194
+ readonly from: "Open";
195
+ readonly to: "Created";
196
+ readonly timeout: null;
197
+ readonly hook: null;
198
+ readonly by: {
199
+ readonly erc8183: {
200
+ readonly type: "event";
201
+ readonly name: "JobCreated";
202
+ readonly actor: "client";
203
+ };
204
+ readonly "erc8183-extra": {
205
+ readonly type: "event";
206
+ readonly name: "JobCreated";
207
+ readonly actor: "client";
208
+ };
209
+ readonly "memo-acp": {
210
+ readonly type: "event";
211
+ readonly name: "JobCreated (phase 0 REQUEST)";
212
+ readonly actor: "client";
213
+ };
214
+ };
215
+ }, {
216
+ readonly id: "terms";
217
+ readonly from: "Created";
218
+ readonly to: "Created";
219
+ readonly timeout: null;
220
+ readonly hook: null;
221
+ readonly by: {
222
+ readonly erc8183: {
223
+ readonly type: "event";
224
+ readonly name: "BudgetSet";
225
+ readonly actor: "client | provider";
226
+ };
227
+ readonly "erc8183-extra": {
228
+ readonly type: "event";
229
+ readonly name: "BudgetSet(uint256,address,uint256) · ProviderSet(uint256,address,uint256)";
230
+ readonly actor: "client";
231
+ };
232
+ readonly "memo-acp": {
233
+ readonly type: "event";
234
+ readonly name: "JobPhaseUpdated 0→1 (NEGOTIATION)";
235
+ readonly actor: "provider";
236
+ };
237
+ };
238
+ }, {
239
+ readonly id: "fund";
240
+ readonly from: "Created";
241
+ readonly to: "Funded";
242
+ readonly timeout: null;
243
+ readonly hook: null;
244
+ readonly by: {
245
+ readonly erc8183: {
246
+ readonly type: "event";
247
+ readonly name: "JobFunded";
248
+ readonly actor: "client";
249
+ };
250
+ readonly "erc8183-extra": {
251
+ readonly type: "event";
252
+ readonly name: "JobFunded";
253
+ readonly actor: "client";
254
+ };
255
+ readonly "memo-acp": {
256
+ readonly type: "event";
257
+ readonly name: "JobPhaseUpdated 1→2 (TRANSACTION)";
258
+ readonly actor: "client";
259
+ };
260
+ };
261
+ }, {
262
+ readonly id: "reject_unfunded";
263
+ readonly from: "Created";
264
+ readonly to: "Rejected";
265
+ readonly timeout: null;
266
+ readonly hook: null;
267
+ readonly by: {
268
+ readonly erc8183: {
269
+ readonly type: "event";
270
+ readonly name: "JobRejected";
271
+ readonly actor: "client";
272
+ };
273
+ readonly "erc8183-extra": {
274
+ readonly type: "event";
275
+ readonly name: "JobRejected";
276
+ readonly actor: "client";
277
+ };
278
+ readonly "memo-acp": {
279
+ readonly type: "event";
280
+ readonly name: "JobPhaseUpdated 0|1→5 (REJECTED)";
281
+ readonly actor: "provider | client";
282
+ };
283
+ };
284
+ }, {
285
+ readonly id: "lapse";
286
+ readonly from: "Created";
287
+ readonly to: "Cancelled";
288
+ readonly timeout: {
289
+ readonly after: "expiredAt";
290
+ readonly default: true;
291
+ };
292
+ readonly hook: null;
293
+ readonly by: {
294
+ readonly erc8183: {
295
+ readonly type: "timeout";
296
+ readonly name: "expiredAt passed with no JobFunded";
297
+ readonly actor: "nobody (the observatory derives lapsed_unfunded)";
298
+ };
299
+ readonly "erc8183-extra": {
300
+ readonly type: "timeout";
301
+ readonly name: "expiredAt passed with no JobFunded";
302
+ readonly actor: "nobody";
303
+ };
304
+ readonly "memo-acp": {
305
+ readonly type: "timeout";
306
+ readonly name: "expiredAt passed before TRANSACTION";
307
+ readonly actor: "nobody";
308
+ };
309
+ };
310
+ }, {
311
+ readonly id: "expire_unfunded";
312
+ readonly from: "Created";
313
+ readonly to: "Expired";
314
+ readonly timeout: {
315
+ readonly after: "expiredAt";
316
+ readonly default: false;
317
+ };
318
+ readonly hook: null;
319
+ readonly by: {
320
+ readonly erc8183: {
321
+ readonly type: "event";
322
+ readonly name: "JobExpired (no Refunded: nothing was escrowed)";
323
+ readonly actor: "anyone";
324
+ };
325
+ readonly "erc8183-extra": {
326
+ readonly type: "event";
327
+ readonly name: "JobExpired";
328
+ readonly actor: "anyone";
329
+ };
330
+ readonly "memo-acp": {
331
+ readonly type: "event";
332
+ readonly name: "JobPhaseUpdated 0|1→6 (EXPIRED)";
333
+ readonly actor: "anyone";
334
+ };
335
+ };
336
+ }, {
337
+ readonly id: "submit_unfunded";
338
+ readonly from: "Created";
339
+ readonly to: "Submitted";
340
+ readonly timeout: null;
341
+ readonly hook: null;
342
+ readonly by: {
343
+ readonly erc8183: {
344
+ readonly type: "event";
345
+ readonly name: "JobSubmitted (+ JobCompleted + PaymentReleased in the same tx when the evaluator is 0x0)";
346
+ readonly actor: "provider";
347
+ };
348
+ };
349
+ }, {
350
+ readonly id: "submit";
351
+ readonly from: "Funded";
352
+ readonly to: "Submitted";
353
+ readonly timeout: null;
354
+ readonly hook: null;
355
+ readonly by: {
356
+ readonly erc8183: {
357
+ readonly type: "event";
358
+ readonly name: "JobSubmitted";
359
+ readonly actor: "provider";
360
+ };
361
+ readonly "erc8183-extra": {
362
+ readonly type: "event";
363
+ readonly name: "JobSubmitted";
364
+ readonly actor: "provider";
365
+ };
366
+ readonly "memo-acp": {
367
+ readonly type: "event";
368
+ readonly name: "JobPhaseUpdated 2→3 (EVALUATION)";
369
+ readonly actor: "provider";
370
+ };
371
+ readonly hook: {
372
+ readonly type: "call";
373
+ readonly name: "Submitted";
374
+ readonly actor: "seller";
375
+ };
376
+ };
377
+ }, {
378
+ readonly id: "reject_undelivered";
379
+ readonly from: "Funded";
380
+ readonly to: "Rejected";
381
+ readonly timeout: null;
382
+ readonly hook: null;
383
+ readonly by: {
384
+ readonly erc8183: {
385
+ readonly type: "event";
386
+ readonly name: "JobRejected";
387
+ readonly actor: "evaluator";
388
+ };
389
+ readonly "erc8183-extra": {
390
+ readonly type: "event";
391
+ readonly name: "JobRejected";
392
+ readonly actor: "evaluator";
393
+ };
394
+ readonly "memo-acp": {
395
+ readonly type: "event";
396
+ readonly name: "JobPhaseUpdated 2→5 (REJECTED)";
397
+ readonly actor: "provider | evaluator";
398
+ };
399
+ };
400
+ }, {
401
+ readonly id: "expire_undelivered";
402
+ readonly from: "Funded";
403
+ readonly to: "Expired";
404
+ readonly timeout: {
405
+ readonly after: "expiredAt | hook deadline";
406
+ readonly default: true;
407
+ };
408
+ readonly hook: null;
409
+ readonly by: {
410
+ readonly erc8183: {
411
+ readonly type: "event";
412
+ readonly name: "JobExpired + Refunded";
413
+ readonly actor: "anyone";
414
+ };
415
+ readonly "erc8183-extra": {
416
+ readonly type: "event";
417
+ readonly name: "JobExpired + Refunded";
418
+ readonly actor: "anyone";
419
+ };
420
+ readonly "memo-acp": {
421
+ readonly type: "event";
422
+ readonly name: "JobPhaseUpdated 2→6 (EXPIRED)";
423
+ readonly actor: "anyone";
424
+ };
425
+ readonly hook: {
426
+ readonly type: "call";
427
+ readonly name: "Expired(jobId, triggeredBy) (+ NoShowCompensated on a V5 hook)";
428
+ readonly actor: "anyone";
429
+ };
430
+ };
431
+ }, {
432
+ readonly id: "complete";
433
+ readonly from: "Submitted";
434
+ readonly to: "Settled";
435
+ readonly timeout: null;
436
+ readonly hook: null;
437
+ readonly by: {
438
+ readonly erc8183: {
439
+ readonly type: "event";
440
+ readonly name: "JobCompleted + PaymentReleased (+ EvaluatorFeePaid)";
441
+ readonly actor: "evaluator (the client itself on 10,927 of 11,052 indexed jobs)";
442
+ };
443
+ readonly "erc8183-extra": {
444
+ readonly type: "event";
445
+ readonly name: "PaymentReleased + JobCompleted + Settled";
446
+ readonly actor: "platform evaluator";
447
+ };
448
+ readonly "memo-acp": {
449
+ readonly type: "event";
450
+ readonly name: "JobPhaseUpdated 3→4 (COMPLETED) + USDC to the provider";
451
+ readonly actor: "evaluator (usually the client)";
452
+ };
453
+ readonly hook: {
454
+ readonly type: "call";
455
+ readonly name: "Completed(jobId, premiumToPool) (+ PremiumSplit on a V5 hook)";
456
+ readonly actor: "buyer | hook evaluator; a V4 job that names an evaluator: that evaluator only";
457
+ };
458
+ };
459
+ }, {
460
+ readonly id: "reject_delivered";
461
+ readonly from: "Submitted";
462
+ readonly to: "Rejected";
463
+ readonly timeout: null;
464
+ readonly hook: null;
465
+ readonly by: {
466
+ readonly erc8183: {
467
+ readonly type: "event";
468
+ readonly name: "JobRejected";
469
+ readonly actor: "evaluator";
470
+ };
471
+ readonly "erc8183-extra": {
472
+ readonly type: "event";
473
+ readonly name: "JobRejected";
474
+ readonly actor: "evaluator";
475
+ };
476
+ readonly "memo-acp": {
477
+ readonly type: "event";
478
+ readonly name: "JobPhaseUpdated 3→5 (REJECTED)";
479
+ readonly actor: "evaluator";
480
+ };
481
+ readonly hook: {
482
+ readonly type: "call";
483
+ readonly name: "Rejected(jobId, verdictDigest)";
484
+ readonly actor: "buyer | hook evaluator";
485
+ };
486
+ };
487
+ }, {
488
+ readonly id: "expire_delivered";
489
+ readonly from: "Submitted";
490
+ readonly to: "Expired";
491
+ readonly timeout: {
492
+ readonly after: "expiredAt | hook deadline";
493
+ readonly default: true;
494
+ };
495
+ readonly hook: null;
496
+ readonly by: {
497
+ readonly erc8183: {
498
+ readonly type: "event";
499
+ readonly name: "JobExpired + Refunded";
500
+ readonly actor: "anyone";
501
+ };
502
+ readonly "erc8183-extra": {
503
+ readonly type: "event";
504
+ readonly name: "JobExpired + Refunded";
505
+ readonly actor: "anyone";
506
+ };
507
+ readonly "memo-acp": {
508
+ readonly type: "event";
509
+ readonly name: "JobPhaseUpdated 3→6 (EXPIRED)";
510
+ readonly actor: "anyone";
511
+ };
512
+ readonly hook: {
513
+ readonly type: "call";
514
+ readonly name: "Expired(jobId, triggeredBy)";
515
+ readonly actor: "anyone";
516
+ };
517
+ };
518
+ }, {
519
+ readonly id: "cheat";
520
+ readonly from: "Submitted";
521
+ readonly to: "Cheat";
522
+ readonly timeout: null;
523
+ readonly hook: null;
524
+ readonly by: {
525
+ readonly hook: {
526
+ readonly type: "call";
527
+ readonly name: "Cheated(jobId, loss, fromDeposit, fromPool)";
528
+ readonly actor: "arbitrator";
529
+ };
530
+ };
531
+ }, {
532
+ readonly id: "cheat_after_reject";
533
+ readonly from: "Rejected";
534
+ readonly to: "Cheat";
535
+ readonly timeout: null;
536
+ readonly hook: {
537
+ readonly only: readonly ["V1"];
538
+ };
539
+ readonly by: {
540
+ readonly hook: {
541
+ readonly type: "call";
542
+ readonly name: "Cheated(jobId, loss, fromDeposit, fromPool)";
543
+ readonly actor: "arbitrator";
544
+ };
545
+ };
546
+ }, {
547
+ readonly id: "grade_auto";
548
+ readonly from: "Submitted";
549
+ readonly to: "Graded";
550
+ readonly timeout: null;
551
+ readonly hook: null;
552
+ readonly by: {
553
+ readonly hook: {
554
+ readonly type: "offchain";
555
+ readonly name: "RUBRIC_v1 compose → complete | reject (auto), decision.v2 anchored";
556
+ readonly actor: "layer";
557
+ };
558
+ };
559
+ }, {
560
+ readonly id: "hold";
561
+ readonly from: "Submitted";
562
+ readonly to: "Held";
563
+ readonly timeout: null;
564
+ readonly hook: null;
565
+ readonly by: {
566
+ readonly hook: {
567
+ readonly type: "offchain";
568
+ readonly name: "RUBRIC_v1 compose → needs_review";
569
+ readonly actor: "layer";
570
+ };
571
+ };
572
+ }, {
573
+ readonly id: "graded_complete";
574
+ readonly from: "Graded";
575
+ readonly to: "Settled";
576
+ readonly timeout: null;
577
+ readonly hook: null;
578
+ readonly by: {
579
+ readonly hook: {
580
+ readonly type: "call";
581
+ readonly name: "Completed(jobId, premiumToPool)";
582
+ readonly actor: "buyer";
583
+ };
584
+ };
585
+ }, {
586
+ readonly id: "graded_reject";
587
+ readonly from: "Graded";
588
+ readonly to: "Rejected";
589
+ readonly timeout: null;
590
+ readonly hook: null;
591
+ readonly by: {
592
+ readonly hook: {
593
+ readonly type: "call";
594
+ readonly name: "Rejected(jobId, verdictDigest)";
595
+ readonly actor: "buyer | hook evaluator";
596
+ };
597
+ };
598
+ }, {
599
+ readonly id: "graded_expire";
600
+ readonly from: "Graded";
601
+ readonly to: "Expired";
602
+ readonly timeout: {
603
+ readonly after: "hook deadline";
604
+ readonly default: true;
605
+ };
606
+ readonly hook: null;
607
+ readonly by: {
608
+ readonly hook: {
609
+ readonly type: "call";
610
+ readonly name: "Expired(jobId, triggeredBy)";
611
+ readonly actor: "anyone";
612
+ };
613
+ };
614
+ }, {
615
+ readonly id: "graded_cheat";
616
+ readonly from: "Graded";
617
+ readonly to: "Cheat";
618
+ readonly timeout: null;
619
+ readonly hook: null;
620
+ readonly by: {
621
+ readonly hook: {
622
+ readonly type: "call";
623
+ readonly name: "Cheated";
624
+ readonly actor: "arbitrator";
625
+ };
626
+ };
627
+ }, {
628
+ readonly id: "held_complete";
629
+ readonly from: "Held";
630
+ readonly to: "Settled";
631
+ readonly timeout: null;
632
+ readonly hook: null;
633
+ readonly by: {
634
+ readonly hook: {
635
+ readonly type: "call";
636
+ readonly name: "VerdictPosted + Completed";
637
+ readonly actor: "registered evaluator (devnet JudgeAdapter today)";
638
+ };
639
+ };
640
+ }, {
641
+ readonly id: "held_reject";
642
+ readonly from: "Held";
643
+ readonly to: "Rejected";
644
+ readonly timeout: null;
645
+ readonly hook: null;
646
+ readonly by: {
647
+ readonly hook: {
648
+ readonly type: "call";
649
+ readonly name: "VerdictPosted + Rejected";
650
+ readonly actor: "registered evaluator";
651
+ };
652
+ };
653
+ }, {
654
+ readonly id: "held_expire";
655
+ readonly from: "Held";
656
+ readonly to: "Expired";
657
+ readonly timeout: {
658
+ readonly after: "hook deadline";
659
+ readonly default: true;
660
+ };
661
+ readonly hook: null;
662
+ readonly by: {
663
+ readonly hook: {
664
+ readonly type: "call";
665
+ readonly name: "Expired(jobId, triggeredBy)";
666
+ readonly actor: "anyone";
667
+ };
668
+ };
669
+ }, {
670
+ readonly id: "held_cheat";
671
+ readonly from: "Held";
672
+ readonly to: "Cheat";
673
+ readonly timeout: null;
674
+ readonly hook: null;
675
+ readonly by: {
676
+ readonly hook: {
677
+ readonly type: "call";
678
+ readonly name: "Cheated";
679
+ readonly actor: "arbitrator";
680
+ };
681
+ };
682
+ }, {
683
+ readonly id: "open_v4";
684
+ readonly from: "Open";
685
+ readonly to: "Opened";
686
+ readonly timeout: null;
687
+ readonly hook: {
688
+ readonly since: "V4";
689
+ };
690
+ readonly by: {
691
+ readonly hook: {
692
+ readonly type: "call";
693
+ readonly name: "JobOpened (+ JobSpecCommitted, X402PaymentReceived)";
694
+ readonly actor: "buyer";
695
+ };
696
+ };
697
+ }, {
698
+ readonly id: "accept_v4";
699
+ readonly from: "Opened";
700
+ readonly to: "Funded";
701
+ readonly timeout: null;
702
+ readonly hook: {
703
+ readonly since: "V4";
704
+ };
705
+ readonly by: {
706
+ readonly hook: {
707
+ readonly type: "call";
708
+ readonly name: "JobAccepted + JobFunded (+ JobCovered)";
709
+ readonly actor: "seller (locks its deposit)";
710
+ };
711
+ };
712
+ }, {
713
+ readonly id: "cancel_open_v4";
714
+ readonly from: "Opened";
715
+ readonly to: "Expired";
716
+ readonly timeout: null;
717
+ readonly hook: {
718
+ readonly since: "V4";
719
+ };
720
+ readonly by: {
721
+ readonly hook: {
722
+ readonly type: "call";
723
+ readonly name: "OpenCancelled + Settled(ending 7)";
724
+ readonly actor: "buyer";
725
+ };
726
+ };
727
+ }, {
728
+ readonly id: "expire_open_v4";
729
+ readonly from: "Opened";
730
+ readonly to: "Expired";
731
+ readonly timeout: {
732
+ readonly after: "hook deadline";
733
+ readonly default: true;
734
+ };
735
+ readonly hook: {
736
+ readonly since: "V4";
737
+ };
738
+ readonly by: {
739
+ readonly hook: {
740
+ readonly type: "call";
741
+ readonly name: "Settled(ending 2) + Expired(jobId, triggeredBy)";
742
+ readonly actor: "anyone";
743
+ };
744
+ };
745
+ }, {
746
+ readonly id: "propose_reject_v4";
747
+ readonly from: "Submitted";
748
+ readonly to: "RejectPending";
749
+ readonly timeout: null;
750
+ readonly hook: {
751
+ readonly since: "V4";
752
+ };
753
+ readonly by: {
754
+ readonly hook: {
755
+ readonly type: "call";
756
+ readonly name: "RejectProposed(jobId, verdictDigest, disputeDeadline)";
757
+ readonly actor: "named evaluator | hook evaluator";
758
+ };
759
+ };
760
+ }, {
761
+ readonly id: "graded_propose_reject_v4";
762
+ readonly from: "Graded";
763
+ readonly to: "RejectPending";
764
+ readonly timeout: null;
765
+ readonly hook: {
766
+ readonly since: "V4";
767
+ };
768
+ readonly by: {
769
+ readonly hook: {
770
+ readonly type: "call";
771
+ readonly name: "VerdictPosted + RejectProposed";
772
+ readonly actor: "named evaluator (the fee-forwarding JudgeAdapter)";
773
+ };
774
+ };
775
+ }, {
776
+ readonly id: "held_propose_reject_v4";
777
+ readonly from: "Held";
778
+ readonly to: "RejectPending";
779
+ readonly timeout: null;
780
+ readonly hook: {
781
+ readonly since: "V4";
782
+ };
783
+ readonly by: {
784
+ readonly hook: {
785
+ readonly type: "call";
786
+ readonly name: "VerdictPosted + RejectProposed";
787
+ readonly actor: "named evaluator";
788
+ };
789
+ };
790
+ }, {
791
+ readonly id: "finalize_reject_v4";
792
+ readonly from: "RejectPending";
793
+ readonly to: "Rejected";
794
+ readonly timeout: {
795
+ readonly after: "disputeDeadline";
796
+ readonly default: true;
797
+ };
798
+ readonly hook: {
799
+ readonly since: "V4";
800
+ };
801
+ readonly by: {
802
+ readonly hook: {
803
+ readonly type: "call";
804
+ readonly name: "Rejected + Settled(ending 3) (+ EvaluatorFeePaid)";
805
+ readonly actor: "anyone";
806
+ };
807
+ };
808
+ }, {
809
+ readonly id: "dispute_v4";
810
+ readonly from: "RejectPending";
811
+ readonly to: "Disputed";
812
+ readonly timeout: null;
813
+ readonly hook: {
814
+ readonly since: "V4";
815
+ };
816
+ readonly by: {
817
+ readonly hook: {
818
+ readonly type: "call";
819
+ readonly name: "DisputeOpened(jobId, arbitrationDeadline)";
820
+ readonly actor: "seller";
821
+ };
822
+ };
823
+ }, {
824
+ readonly id: "resolve_seller_v4";
825
+ readonly from: "Disputed";
826
+ readonly to: "Settled";
827
+ readonly timeout: null;
828
+ readonly hook: {
829
+ readonly since: "V4";
830
+ };
831
+ readonly by: {
832
+ readonly hook: {
833
+ readonly type: "call";
834
+ readonly name: "DisputeResolved + Completed + Settled(ending 6)";
835
+ readonly actor: "arbitrator";
836
+ };
837
+ };
838
+ }, {
839
+ readonly id: "resolve_buyer_v4";
840
+ readonly from: "Disputed";
841
+ readonly to: "Rejected";
842
+ readonly timeout: null;
843
+ readonly hook: {
844
+ readonly since: "V4";
845
+ };
846
+ readonly by: {
847
+ readonly hook: {
848
+ readonly type: "call";
849
+ readonly name: "DisputeResolved + Rejected + Settled(ending 3)";
850
+ readonly actor: "arbitrator";
851
+ };
852
+ };
853
+ }, {
854
+ readonly id: "stale_dispute_v4";
855
+ readonly from: "Disputed";
856
+ readonly to: "Rejected";
857
+ readonly timeout: {
858
+ readonly after: "arbitrationDeadline";
859
+ readonly default: true;
860
+ };
861
+ readonly hook: {
862
+ readonly since: "V4";
863
+ };
864
+ readonly by: {
865
+ readonly hook: {
866
+ readonly type: "call";
867
+ readonly name: "Rejected + Settled(ending 3)";
868
+ readonly actor: "anyone";
869
+ };
870
+ };
871
+ }, {
872
+ readonly id: "auto_complete_v4";
873
+ readonly from: "Submitted";
874
+ readonly to: "Settled";
875
+ readonly timeout: {
876
+ readonly after: "submittedAt + reviewWindow (V4 job terms)";
877
+ readonly default: true;
878
+ };
879
+ readonly hook: {
880
+ readonly since: "V4";
881
+ };
882
+ readonly by: {
883
+ readonly hook: {
884
+ readonly type: "call";
885
+ readonly name: "AutoCompleted + Completed + Settled(ending 5) (+ EvaluatorFeeRefunded)";
886
+ readonly actor: "anyone";
887
+ };
888
+ };
889
+ }, {
890
+ readonly id: "graded_auto_complete_v4";
891
+ readonly from: "Graded";
892
+ readonly to: "Settled";
893
+ readonly timeout: {
894
+ readonly after: "submittedAt + reviewWindow (V4 job terms)";
895
+ readonly default: true;
896
+ };
897
+ readonly hook: {
898
+ readonly since: "V4";
899
+ };
900
+ readonly by: {
901
+ readonly hook: {
902
+ readonly type: "call";
903
+ readonly name: "AutoCompleted + Completed + Settled(ending 5) (+ EvaluatorFeeRefunded)";
904
+ readonly actor: "anyone";
905
+ };
906
+ };
907
+ }, {
908
+ readonly id: "held_auto_complete_v4";
909
+ readonly from: "Held";
910
+ readonly to: "Settled";
911
+ readonly timeout: {
912
+ readonly after: "submittedAt + reviewWindow (V4 job terms)";
913
+ readonly default: true;
914
+ };
915
+ readonly hook: {
916
+ readonly since: "V4";
917
+ };
918
+ readonly by: {
919
+ readonly hook: {
920
+ readonly type: "call";
921
+ readonly name: "AutoCompleted + Completed + Settled(ending 5) (+ EvaluatorFeeRefunded)";
922
+ readonly actor: "anyone";
923
+ };
924
+ };
925
+ }];
926
+ readonly endings: readonly [{
927
+ readonly id: "completed";
928
+ readonly state: "Settled";
929
+ readonly verdict: "correct";
930
+ readonly countsInN: true;
931
+ readonly jevCase: false;
932
+ }, {
933
+ readonly id: "cheated";
934
+ readonly state: "Cheat";
935
+ readonly verdict: "incorrect";
936
+ readonly countsInN: true;
937
+ readonly jevCase: false;
938
+ }, {
939
+ readonly id: "rejected_delivered";
940
+ readonly state: "Rejected";
941
+ readonly verdict: "incorrect";
942
+ readonly countsInN: true;
943
+ readonly jevCase: true;
944
+ }, {
945
+ readonly id: "expired_undelivered";
946
+ readonly state: "Expired";
947
+ readonly verdict: "incorrect";
948
+ readonly countsInN: true;
949
+ readonly jevCase: false;
950
+ }, {
951
+ readonly id: "expired_delivered";
952
+ readonly state: "Expired";
953
+ readonly verdict: "undecided";
954
+ readonly countsInN: false;
955
+ readonly jevCase: true;
956
+ }, {
957
+ readonly id: "rejected_undelivered";
958
+ readonly state: "Rejected";
959
+ readonly verdict: "excluded:rejected_before_delivery";
960
+ readonly countsInN: false;
961
+ readonly jevCase: false;
962
+ }, {
963
+ readonly id: "lapsed_unfunded";
964
+ readonly state: "Cancelled";
965
+ readonly verdict: "excluded:lapsed_unfunded";
966
+ readonly countsInN: false;
967
+ readonly jevCase: false;
968
+ }, {
969
+ readonly id: "open";
970
+ readonly state: null;
971
+ readonly verdict: "excluded:open";
972
+ readonly countsInN: false;
973
+ readonly jevCase: false;
974
+ }];
975
+ readonly exclusions: readonly [{
976
+ readonly rule: "budget not > 0 (any ending)";
977
+ readonly verdict: "excluded:unpaid";
978
+ }, {
979
+ readonly rule: "memo-acp or erc8183-extra, expired_undelivered and never funded";
980
+ readonly verdict: "excluded:expired_unfunded";
981
+ }, {
982
+ readonly rule: "memo-acp or erc8183-extra, rejected_undelivered and never funded";
983
+ readonly verdict: "excluded:rejected_unfunded";
984
+ }, {
985
+ readonly rule: "V4 hook job the seller never accepted (JobOpened, no JobFunded), expired or cancelled";
986
+ readonly verdict: "excluded:expired_unfunded";
987
+ }];
988
+ readonly maps: {
989
+ readonly hookState: {
990
+ readonly "0": "Open";
991
+ readonly "1": "Funded";
992
+ readonly "2": "Submitted";
993
+ readonly "3": "Settled";
994
+ readonly "4": "Expired";
995
+ readonly "5": "Rejected";
996
+ readonly "6": "Cheat";
997
+ readonly "7": "Opened";
998
+ readonly "8": "RejectPending";
999
+ readonly "9": "Disputed";
1000
+ };
1001
+ readonly memoAcpPhase: {
1002
+ readonly "0": "Created";
1003
+ readonly "1": "Created";
1004
+ readonly "2": "Funded";
1005
+ readonly "3": "Submitted";
1006
+ readonly "4": "Settled";
1007
+ readonly "5": "Rejected";
1008
+ readonly "6": "Expired";
1009
+ };
1010
+ readonly handshakeState: {
1011
+ readonly OPEN: "Open";
1012
+ readonly NOTIFIED: "Open";
1013
+ readonly PRICED: "Open";
1014
+ readonly OFFERED: "Open";
1015
+ readonly DELIVERED: "Delivered";
1016
+ readonly ACCEPTED: "Funded";
1017
+ readonly PROVED: "Submitted";
1018
+ readonly SETTLED: "Settled";
1019
+ readonly EXPIRED: "Expired";
1020
+ readonly REJECTED: "Rejected";
1021
+ readonly CHEAT: "Cheat";
1022
+ };
1023
+ readonly event: {
1024
+ readonly JobCreated: "Created";
1025
+ readonly BudgetSet: "Created";
1026
+ readonly ProviderSet: "Created";
1027
+ readonly JobFunded: "Funded";
1028
+ readonly JobCovered: "Funded";
1029
+ readonly JobSubmitted: "Submitted";
1030
+ readonly Submitted: "Submitted";
1031
+ readonly JobCompleted: "Settled";
1032
+ readonly PaymentReleased: "Settled";
1033
+ readonly Settled: "Settled";
1034
+ readonly Completed: "Settled";
1035
+ readonly JobRejected: "Rejected";
1036
+ readonly Rejected: "Rejected";
1037
+ readonly JobExpired: "Expired";
1038
+ readonly Expired: "Expired";
1039
+ readonly Cheated: "Cheat";
1040
+ readonly Refunded: null;
1041
+ readonly EvaluatorFeePaid: null;
1042
+ readonly JobOpened: "Opened";
1043
+ readonly RejectProposed: "RejectPending";
1044
+ readonly DisputeOpened: "Disputed";
1045
+ readonly OpenCancelled: "Expired";
1046
+ };
1047
+ readonly ending: {
1048
+ readonly open: null;
1049
+ readonly lapsed_unfunded: "Cancelled";
1050
+ readonly completed: "Settled";
1051
+ readonly rejected_delivered: "Rejected";
1052
+ readonly rejected_undelivered: "Rejected";
1053
+ readonly expired_delivered: "Expired";
1054
+ readonly expired_undelivered: "Expired";
1055
+ readonly cheated: "Cheat";
1056
+ };
1057
+ };
1058
+ readonly money: readonly [{
1059
+ readonly event: "Encumbered";
1060
+ readonly contract: "pool";
1061
+ readonly money: "reserve";
1062
+ readonly with: readonly ["fund_offer", "fund_delivered", "accept_v4"];
1063
+ }, {
1064
+ readonly event: "JobCoveredCross";
1065
+ readonly contract: "hook";
1066
+ readonly money: "reserve";
1067
+ readonly with: readonly ["fund_offer", "fund_delivered"];
1068
+ }, {
1069
+ readonly event: "PremiumReceived";
1070
+ readonly contract: "pool";
1071
+ readonly money: "in";
1072
+ readonly with: readonly ["complete", "graded_complete", "held_complete", "auto_complete_v4", "graded_auto_complete_v4", "held_auto_complete_v4", "resolve_seller_v4"];
1073
+ }, {
1074
+ readonly event: "RewardPremiumReceived";
1075
+ readonly contract: "pool";
1076
+ readonly money: "in";
1077
+ readonly with: readonly ["complete", "graded_complete", "held_complete", "auto_complete_v4", "graded_auto_complete_v4", "held_auto_complete_v4", "resolve_seller_v4"];
1078
+ }, {
1079
+ readonly event: "Released";
1080
+ readonly contract: "pool";
1081
+ readonly money: "release";
1082
+ readonly with: readonly ["complete", "graded_complete", "held_complete", "reject_delivered", "graded_reject", "held_reject", "expire_undelivered", "expire_delivered", "graded_expire", "held_expire", "cheat", "graded_cheat", "held_cheat", "propose_reject_v4", "graded_propose_reject_v4", "held_propose_reject_v4", "auto_complete_v4", "graded_auto_complete_v4", "held_auto_complete_v4"];
1083
+ }, {
1084
+ readonly event: "CoverReleaseFailed";
1085
+ readonly contract: "hook";
1086
+ readonly money: "release_failed";
1087
+ readonly with: readonly ["complete", "graded_complete", "held_complete", "reject_delivered", "graded_reject", "held_reject", "expire_undelivered", "expire_delivered", "graded_expire", "held_expire", "cheat", "graded_cheat", "held_cheat", "propose_reject_v4", "graded_propose_reject_v4", "held_propose_reject_v4", "auto_complete_v4", "graded_auto_complete_v4", "held_auto_complete_v4"];
1088
+ }, {
1089
+ readonly event: "CoverPaid";
1090
+ readonly contract: "pool";
1091
+ readonly money: "out";
1092
+ readonly with: readonly ["cheat", "graded_cheat", "held_cheat", "cheat_after_reject"];
1093
+ }, {
1094
+ readonly event: "CrossCoverPaid";
1095
+ readonly contract: "hook";
1096
+ readonly money: "out";
1097
+ readonly with: readonly ["cheat", "graded_cheat", "held_cheat"];
1098
+ }, {
1099
+ readonly event: "Refunded";
1100
+ readonly contract: "erc8183";
1101
+ readonly money: "out";
1102
+ readonly with: readonly ["reject_undelivered", "reject_delivered", "expire_undelivered", "expire_delivered"];
1103
+ }, {
1104
+ readonly event: "EvaluatorFeePaid";
1105
+ readonly contract: "erc8183 · hook (V4)";
1106
+ readonly money: "out";
1107
+ readonly with: readonly ["complete", "graded_complete", "held_complete", "finalize_reject_v4", "resolve_buyer_v4", "stale_dispute_v4"];
1108
+ }, {
1109
+ readonly event: "JobAccepted";
1110
+ readonly contract: "hook";
1111
+ readonly money: "in";
1112
+ readonly with: readonly ["accept_v4"];
1113
+ }, {
1114
+ readonly event: "EvaluatorFeeRefunded";
1115
+ readonly contract: "hook";
1116
+ readonly money: "out";
1117
+ readonly with: readonly ["complete", "graded_complete", "held_complete", "auto_complete_v4", "graded_auto_complete_v4", "held_auto_complete_v4", "resolve_seller_v4", "cancel_open_v4", "expire_open_v4", "expire_undelivered", "cheat", "graded_cheat", "held_cheat", "finalize_reject_v4", "resolve_buyer_v4", "stale_dispute_v4"];
1118
+ }, {
1119
+ readonly event: "PremiumSplit";
1120
+ readonly contract: "hook";
1121
+ readonly money: "in";
1122
+ readonly with: readonly ["complete", "graded_complete", "held_complete", "auto_complete_v4", "graded_auto_complete_v4", "held_auto_complete_v4", "resolve_seller_v4"];
1123
+ }, {
1124
+ readonly event: "NoShowCompensated";
1125
+ readonly contract: "hook";
1126
+ readonly money: "out";
1127
+ readonly with: readonly ["expire_undelivered"];
1128
+ }, {
1129
+ readonly event: "RejectionCompensated";
1130
+ readonly contract: "hook";
1131
+ readonly money: "out";
1132
+ readonly with: readonly ["finalize_reject_v4", "resolve_buyer_v4", "stale_dispute_v4"];
1133
+ }, {
1134
+ readonly event: "FeeForwarded";
1135
+ readonly contract: "judge-adapter";
1136
+ readonly money: "out";
1137
+ readonly with: readonly ["complete", "graded_complete", "held_complete", "propose_reject_v4", "graded_propose_reject_v4", "held_propose_reject_v4"];
1138
+ }, {
1139
+ readonly event: "PayableMemoExecuted";
1140
+ readonly contract: "memo-acp";
1141
+ readonly money: "in";
1142
+ readonly with: readonly ["fund"];
1143
+ }, {
1144
+ readonly event: "X402PaymentReceived";
1145
+ readonly contract: "memo-acp · hook (V4)";
1146
+ readonly money: "in";
1147
+ readonly with: readonly ["fund", "open_v4"];
1148
+ }, {
1149
+ readonly event: "ClaimApproved";
1150
+ readonly contract: "erc8183-extra";
1151
+ readonly money: "out";
1152
+ readonly with: readonly ["fund_offer", "fund_delivered", "fund", "submit"];
1153
+ }, {
1154
+ readonly event: "ClaimSettled";
1155
+ readonly contract: "erc8183-extra";
1156
+ readonly money: "out";
1157
+ readonly with: readonly ["fund_offer", "fund_delivered", "fund", "submit"];
1158
+ }, {
1159
+ readonly event: "Disbursed";
1160
+ readonly contract: "erc8183-extra";
1161
+ readonly money: "out";
1162
+ readonly with: readonly ["complete", "graded_complete", "held_complete", "submit"];
1163
+ }, {
1164
+ readonly event: "PlatformFeePaid";
1165
+ readonly contract: "erc8183-extra";
1166
+ readonly money: "out";
1167
+ readonly with: readonly ["complete", "graded_complete", "held_complete", "submit"];
1168
+ }];
1169
+ readonly cover: {
1170
+ readonly lane: "external-cover";
1171
+ readonly states: readonly [{
1172
+ readonly id: "Quoted";
1173
+ readonly terminal: false;
1174
+ readonly holdsFunds: false;
1175
+ }, {
1176
+ readonly id: "Active";
1177
+ readonly terminal: false;
1178
+ readonly holdsFunds: true;
1179
+ }, {
1180
+ readonly id: "Settled";
1181
+ readonly terminal: true;
1182
+ readonly holdsFunds: false;
1183
+ }, {
1184
+ readonly id: "Expired";
1185
+ readonly terminal: true;
1186
+ readonly holdsFunds: false;
1187
+ }];
1188
+ readonly transitions: readonly [{
1189
+ readonly id: "quote";
1190
+ readonly from: null;
1191
+ readonly to: "Quoted";
1192
+ readonly actor: "layer (observer + pricer + attestor)";
1193
+ readonly call: "GET /v1/cover/quote";
1194
+ }, {
1195
+ readonly id: "buy";
1196
+ readonly from: "Quoted";
1197
+ readonly to: "Active";
1198
+ readonly actor: "buyer";
1199
+ readonly call: "buyCover(quote, signatures)";
1200
+ }, {
1201
+ readonly id: "settle";
1202
+ readonly from: "Active";
1203
+ readonly to: "Settled";
1204
+ readonly actor: "anyone (the statement is the authority)";
1205
+ readonly call: "settle(policyId, statement, signatures, proof)";
1206
+ }, {
1207
+ readonly id: "expire";
1208
+ readonly from: "Active";
1209
+ readonly to: "Expired";
1210
+ readonly actor: "anyone";
1211
+ readonly call: "expire(policyId)";
1212
+ }];
1213
+ readonly endings: readonly [{
1214
+ readonly code: 1;
1215
+ readonly id: "COMPLETED";
1216
+ readonly pays: false;
1217
+ readonly from: readonly ["completed"];
1218
+ readonly premium: "pool";
1219
+ }, {
1220
+ readonly code: 2;
1221
+ readonly id: "REFUNDED";
1222
+ readonly pays: false;
1223
+ readonly from: readonly ["rejected_undelivered", "rejected_delivered", "expired_undelivered", "expired_delivered"];
1224
+ readonly premium: "pool";
1225
+ }, {
1226
+ readonly code: 3;
1227
+ readonly id: "UNDELIVERED";
1228
+ readonly pays: true;
1229
+ readonly from: readonly ["expired_undelivered", "rejected_undelivered", "completed (no deliverable: an operator force-settle, an x402 call that returned nothing)"];
1230
+ readonly premium: "pool";
1231
+ }, {
1232
+ readonly code: 4;
1233
+ readonly id: "DELIVERED_FINDING";
1234
+ readonly pays: true;
1235
+ readonly from: readonly ["cheated", "completed", "rejected_delivered", "expired_delivered"];
1236
+ readonly premium: "pool";
1237
+ }, {
1238
+ readonly code: 5;
1239
+ readonly id: "DELIVERED_NO_FINDING";
1240
+ readonly pays: false;
1241
+ readonly from: readonly ["rejected_delivered", "expired_delivered", "completed"];
1242
+ readonly premium: "pool";
1243
+ }, {
1244
+ readonly code: 6;
1245
+ readonly id: "VOID";
1246
+ readonly pays: false;
1247
+ readonly from: readonly ["lapsed_unfunded"];
1248
+ readonly premium: "buyer";
1249
+ }];
1250
+ };
1251
+ readonly revenueHooks: readonly [{
1252
+ readonly hook: "grades_pay_to_key";
1253
+ readonly phase: 1;
1254
+ readonly lane: "a grade past the three free ones (the Jev grade of a hire, a listing or a card)";
1255
+ readonly gate: null;
1256
+ }, {
1257
+ readonly hook: "x402_wall";
1258
+ readonly phase: 2;
1259
+ readonly lane: "a paid call to a walled skill, settled by the facilitator to the vault";
1260
+ readonly gate: null;
1261
+ }, {
1262
+ readonly hook: "routing_fee";
1263
+ readonly phase: 2;
1264
+ readonly lane: "a gateway call past the free daily allowance (every hire the loop sends through /gw is one)";
1265
+ readonly gate: null;
1266
+ }, {
1267
+ readonly hook: "evaluator_fee";
1268
+ readonly phase: 3;
1269
+ readonly lane: "an auto-matched hire settled through the layer: paid when our decision stands";
1270
+ readonly gate: null;
1271
+ }, {
1272
+ readonly hook: "resale_fee";
1273
+ readonly phase: 3;
1274
+ readonly lane: "a catalogue buy: the seller's price plus the fee, taken at settlement on the settle line";
1275
+ readonly gate: null;
1276
+ }, {
1277
+ readonly hook: "bridge_fee";
1278
+ readonly phase: 3;
1279
+ readonly lane: "a transfer the layer plans between chains for a hire or a caller";
1280
+ readonly gate: null;
1281
+ }, {
1282
+ readonly hook: "pool_premium_share";
1283
+ readonly phase: 4;
1284
+ readonly lane: "the premium of a covered hire: the layer's share of the written split";
1285
+ readonly gate: "split";
1286
+ }, {
1287
+ readonly hook: "grid_premium_share";
1288
+ readonly phase: 4;
1289
+ readonly lane: "the layer's leg of a GRID line's premium, paid in GRID on top of a GRID job (GRID jobs, GRID cover, made whole in GRID; opens when GRID can be deposited into pools)";
1290
+ readonly gate: "split";
1291
+ }, {
1292
+ readonly hook: "partner_bond";
1293
+ readonly phase: 5;
1294
+ readonly lane: "an enterprise partner's bond and its members' hires";
1295
+ readonly gate: null;
1296
+ }];
1297
+ };
1298
+ export type State = "Open" | "Delivered" | "Created" | "Funded" | "Submitted" | "Graded" | "Held" | "Opened" | "RejectPending" | "Disputed" | "Settled" | "Rejected" | "Expired" | "Cheat" | "Cancelled";
1299
+ export type Lane = "handshake" | "hook" | "erc8183" | "erc8183-extra" | "memo-acp";
1300
+ export type TransitionId = "dispatch_no_work" | "dispatch_delivered" | "pregrade" | "fund_offer" | "fund_delivered" | "create" | "terms" | "fund" | "reject_unfunded" | "lapse" | "expire_unfunded" | "submit_unfunded" | "submit" | "reject_undelivered" | "expire_undelivered" | "complete" | "reject_delivered" | "expire_delivered" | "cheat" | "cheat_after_reject" | "grade_auto" | "hold" | "graded_complete" | "graded_reject" | "graded_expire" | "graded_cheat" | "held_complete" | "held_reject" | "held_expire" | "held_cheat" | "open_v4" | "accept_v4" | "cancel_open_v4" | "expire_open_v4" | "propose_reject_v4" | "graded_propose_reject_v4" | "held_propose_reject_v4" | "finalize_reject_v4" | "dispute_v4" | "resolve_seller_v4" | "resolve_buyer_v4" | "stale_dispute_v4" | "auto_complete_v4" | "graded_auto_complete_v4" | "held_auto_complete_v4";
1301
+ export type EndingId = "completed" | "cheated" | "rejected_delivered" | "expired_undelivered" | "expired_delivered" | "rejected_undelivered" | "lapsed_unfunded" | "open";
1302
+ export type CoverEnding = "COMPLETED" | "REFUNDED" | "UNDELIVERED" | "DELIVERED_FINDING" | "DELIVERED_NO_FINDING" | "VOID";
1303
+ export type RevenueHook = "grades_pay_to_key" | "x402_wall" | "routing_fee" | "evaluator_fee" | "resale_fee" | "bridge_fee" | "pool_premium_share" | "grid_premium_share" | "partner_bond";
1304
+ export type Trigger = {
1305
+ type: 'event' | 'call' | 'offchain' | 'timeout';
1306
+ name: string | null;
1307
+ actor: string;
1308
+ };
1309
+ export type Transition = {
1310
+ id: TransitionId;
1311
+ from: State;
1312
+ to: State;
1313
+ timeout: {
1314
+ after: string;
1315
+ default: boolean;
1316
+ } | null;
1317
+ hook: {
1318
+ only?: readonly string[];
1319
+ since?: string;
1320
+ } | null;
1321
+ by: Partial<Record<Lane, Trigger>>;
1322
+ };
1323
+ /** the hook contract generation a hook-lane job runs on (Moonbeam's live hook is V3; Taifoon's lines are V4, V5 next) */
1324
+ export type HookVersion = 'V1' | 'V2' | 'V3' | 'V4' | 'V5';
1325
+ export type Ctx = {
1326
+ lane: Lane;
1327
+ hook?: HookVersion;
1328
+ };
1329
+ export declare const STATES: readonly State[];
1330
+ export declare const TRANSITIONS: readonly Transition[];
1331
+ export declare const LANES: readonly Lane[];
1332
+ export declare const ENDINGS: readonly [{
1333
+ readonly id: "completed";
1334
+ readonly state: "Settled";
1335
+ readonly verdict: "correct";
1336
+ readonly countsInN: true;
1337
+ readonly jevCase: false;
1338
+ }, {
1339
+ readonly id: "cheated";
1340
+ readonly state: "Cheat";
1341
+ readonly verdict: "incorrect";
1342
+ readonly countsInN: true;
1343
+ readonly jevCase: false;
1344
+ }, {
1345
+ readonly id: "rejected_delivered";
1346
+ readonly state: "Rejected";
1347
+ readonly verdict: "incorrect";
1348
+ readonly countsInN: true;
1349
+ readonly jevCase: true;
1350
+ }, {
1351
+ readonly id: "expired_undelivered";
1352
+ readonly state: "Expired";
1353
+ readonly verdict: "incorrect";
1354
+ readonly countsInN: true;
1355
+ readonly jevCase: false;
1356
+ }, {
1357
+ readonly id: "expired_delivered";
1358
+ readonly state: "Expired";
1359
+ readonly verdict: "undecided";
1360
+ readonly countsInN: false;
1361
+ readonly jevCase: true;
1362
+ }, {
1363
+ readonly id: "rejected_undelivered";
1364
+ readonly state: "Rejected";
1365
+ readonly verdict: "excluded:rejected_before_delivery";
1366
+ readonly countsInN: false;
1367
+ readonly jevCase: false;
1368
+ }, {
1369
+ readonly id: "lapsed_unfunded";
1370
+ readonly state: "Cancelled";
1371
+ readonly verdict: "excluded:lapsed_unfunded";
1372
+ readonly countsInN: false;
1373
+ readonly jevCase: false;
1374
+ }, {
1375
+ readonly id: "open";
1376
+ readonly state: null;
1377
+ readonly verdict: "excluded:open";
1378
+ readonly countsInN: false;
1379
+ readonly jevCase: false;
1380
+ }];
1381
+ export declare const isState: (s: unknown) => s is State;
1382
+ export declare const isTerminal: (s: State) => boolean;
1383
+ export declare const holdsFunds: (s: State) => boolean;
1384
+ /** a lane and the lane it continues as (a handshake continues as a hook job once funded) */
1385
+ export declare function lanesOf(lane: Lane): Lane[];
1386
+ /** whether a transition runs where this job runs: V4 transitions need a V4+ hook, the V1 defect only a V1 hook */
1387
+ export declare function runsOn(t: Transition, ctx: Ctx): boolean;
1388
+ /** the trigger of a transition on this lane (or the lane it continues as), or null when the lane does not walk it */
1389
+ export declare function triggerOf(t: Transition, lane: Lane): Trigger | null;
1390
+ /** every transition out of a state that this lane walks here */
1391
+ export declare const exits: (from: State, ctx: Ctx) => Transition[];
1392
+ /** the states a lane can reach from the initial state, breadth first */
1393
+ export declare function reachable(ctx: Ctx): State[];
1394
+ /** the job's deadlines in unix seconds; a missing one never fires */
1395
+ export type Clock = {
1396
+ expiredAt?: number;
1397
+ deadline?: number;
1398
+ reviewEnds?: number;
1399
+ disputeDeadline?: number;
1400
+ arbitrationDeadline?: number;
1401
+ };
1402
+ /** the clock fields a timeout's `after` names (transitions.json wording: "expiredAt | hook deadline", "submittedAt + reviewWindow …") */
1403
+ export declare function clockKeys(after: string): (keyof Clock)[];
1404
+ /** when a timed transition becomes possible on this clock: the earliest deadline it names that is set, or null */
1405
+ export declare function dueAt(t: Transition, clock: Clock): number | null;
1406
+ /**
1407
+ * What happened to a job:
1408
+ * transition a named transition (what a plan or a contract call says it does)
1409
+ * event an event a venue emitted, in transitions.json's vocabulary (JobFunded, RejectProposed …); an effect that
1410
+ * decides no state (Refunded, EvaluatorFeePaid) leaves the state as it is
1411
+ * state a source that reports the state itself (memo-ACP's phase, the hook's State enum, a handshake state)
1412
+ * tick time passed: the default timeout transition whose deadline came first fires
1413
+ */
1414
+ export type AssuranceEvent = {
1415
+ kind: 'transition';
1416
+ id: TransitionId;
1417
+ } | {
1418
+ kind: 'event';
1419
+ name: string;
1420
+ via?: TransitionId;
1421
+ } | {
1422
+ kind: 'state';
1423
+ to: State;
1424
+ via?: TransitionId;
1425
+ } | {
1426
+ kind: 'tick';
1427
+ now: number;
1428
+ clock: Clock;
1429
+ };
1430
+ export type Next = {
1431
+ ok: true;
1432
+ state: State;
1433
+ transition: TransitionId | null;
1434
+ trigger: Trigger | null;
1435
+ effect?: string;
1436
+ } | {
1437
+ ok: false;
1438
+ state: State;
1439
+ error: string;
1440
+ };
1441
+ export declare function next(state: State, ev: AssuranceEvent, ctx: Ctx): Next;
1442
+ /** source vocabularies → machine states (transitions.json maps) */
1443
+ export declare const stateOf: {
1444
+ /** the hook's State enum: None Funded Submitted Completed Expired Rejected Cheated, then V4 Open RejectPending Disputed */
1445
+ hook: (n: number) => State | null;
1446
+ /** memo-ACP JobManager phase 0..6 */
1447
+ memoPhase: (n: number) => State | null;
1448
+ /** a handshake state; OFFERED with a held delivery is Delivered */
1449
+ handshake: (s: string, delivered?: boolean) => State | null;
1450
+ };
1451
+ export type PathStep = {
1452
+ from: State;
1453
+ to: State;
1454
+ transition: TransitionId;
1455
+ };
1456
+ /** fold events from a start state; stops at the first refusal and says where */
1457
+ export declare function run(events: AssuranceEvent[], ctx: Ctx, start?: State): {
1458
+ ok: true;
1459
+ state: State;
1460
+ path: PathStep[];
1461
+ } | {
1462
+ ok: false;
1463
+ state: State;
1464
+ path: PathStep[];
1465
+ at: number;
1466
+ error: string;
1467
+ };
1468
+ export type Exit = {
1469
+ transition: TransitionId;
1470
+ to: State;
1471
+ actor: string;
1472
+ trigger: Trigger['type'];
1473
+ after: string | null;
1474
+ isDefault: boolean;
1475
+ };
1476
+ /** every way out of a state on this lane: who acts, and the deadline a timed exit waits for */
1477
+ export declare function whoCanEnd(state: State, ctx: Ctx): Exit[];
1478
+ /** no lockout: a held state has an exit nobody can block (a timeout, or a call anyone may send) */
1479
+ export declare function unblockable(state: State, ctx: Ctx): Exit | null;
1480
+ export type Token = {
1481
+ symbol: string;
1482
+ decimals: number;
1483
+ };
1484
+ /** where the layer attaches assurance to a venue's job */
1485
+ export type Attachment = 'hook' | 'external-cover' | 'none';
1486
+ export type Compensation = {
1487
+ noShow: bigint;
1488
+ rejection: bigint;
1489
+ };
1490
+ /** the terms a buyer and seller agree before any money moves; every number comes from the Economy (jev-wilson) */
1491
+ export type Terms = {
1492
+ token: Token;
1493
+ price: bigint;
1494
+ premium: bigint;
1495
+ backersLeg: bigint;
1496
+ layerLeg: bigint;
1497
+ jobFee: bigint;
1498
+ deposit: bigint;
1499
+ cover: bigint;
1500
+ compensation: Compensation;
1501
+ attachment: Attachment;
1502
+ lockSeconds: number;
1503
+ };
1504
+ export type AssuredJob = {
1505
+ venue: string;
1506
+ ctx: Ctx;
1507
+ chainId: number;
1508
+ jobId: string;
1509
+ buyer: string;
1510
+ seller: string;
1511
+ evaluator: string | null;
1512
+ terms: Terms | null;
1513
+ clock: Clock;
1514
+ state: State;
1515
+ path: PathStep[];
1516
+ /** the venue paid something (budget > 0): an unpaid job is excluded from every record */
1517
+ paid?: boolean;
1518
+ /** an arbitrator's finding against the delivery (a grade is not a finding) */
1519
+ finding?: string | null;
1520
+ };
1521
+ /** the job reached the seller's delivery (a JobSubmitted, or a later state that needs one) */
1522
+ export declare const deliveredOf: (job: Pick<AssuredJob, 'path' | 'state'>) => boolean;
1523
+ /** money was held at some point (the job was funded) */
1524
+ export declare const fundedOf: (job: Pick<AssuredJob, 'path' | 'state'>) => boolean;
1525
+ export type Ending = {
1526
+ id: EndingId;
1527
+ state: State | null;
1528
+ verdict: string;
1529
+ countsInN: boolean;
1530
+ jevCase: boolean;
1531
+ excluded: string | null;
1532
+ };
1533
+ /** how a job ended and the verdict it writes into the seller's record (transitions.json endings + exclusions) */
1534
+ export declare function endingOf(job: Pick<AssuredJob, 'path' | 'state' | 'ctx' | 'paid'>): Ending;
1535
+ /** what external cover does with an ending (transitions.json external_cover.endings): the policy's ending code */
1536
+ export declare function coverEndingOf(ending: EndingId, o: {
1537
+ price: bigint;
1538
+ refunded: bigint;
1539
+ refundable: bigint;
1540
+ finding?: string | null;
1541
+ deliveredSomething?: boolean;
1542
+ sameParty?: boolean;
1543
+ }): {
1544
+ id: CoverEnding;
1545
+ code: number;
1546
+ pays: boolean;
1547
+ premium: string;
1548
+ };
1549
+ /** the seller's settled record (correct and incorrect endings that count in n) */
1550
+ export type SellerRecord = {
1551
+ correct: number;
1552
+ incorrect: number;
1553
+ };
1554
+ export type EconomyInput = {
1555
+ chainId: number;
1556
+ token: Token;
1557
+ price: bigint;
1558
+ record: SellerRecord | null;
1559
+ lockSeconds: number;
1560
+ cover?: bigint;
1561
+ attachment: Attachment;
1562
+ };
1563
+ /** where the money of one ending goes; the sum equals what the job held */
1564
+ export type Legs = {
1565
+ buyer: bigint;
1566
+ seller: bigint;
1567
+ backers: bigint;
1568
+ layer: bigint;
1569
+ evaluator: bigint;
1570
+ };
1571
+ /** the money endings a quote prices (a pool's loss on a cheat is bounded by the cover, the deposit pays first) */
1572
+ export type MoneyEnding = 'completed' | 'auto_completed' | 'rejected' | 'no_show' | 'expired_delivered' | 'unaccepted' | 'cheated';
1573
+ export type EconomyQuote = {
1574
+ insurable: boolean;
1575
+ why: string[];
1576
+ premium: bigint;
1577
+ backersLeg: bigint;
1578
+ layerLeg: bigint;
1579
+ jobFee: bigint;
1580
+ deposit: bigint;
1581
+ cover: bigint;
1582
+ compensation: Compensation;
1583
+ /** per money ending, who receives what (the hook's own arithmetic, from the same module) */
1584
+ legs: Partial<Record<MoneyEnding, Legs>>;
1585
+ };
1586
+ /** jev-wilson's economy (quoteEconomy), or a stand-in in tests: the only place any of these numbers is computed */
1587
+ export type Economy = (i: EconomyInput) => EconomyQuote;
1588
+ export type Refused = {
1589
+ ok: false;
1590
+ why: string[];
1591
+ };
1592
+ /** quote: the economy's terms, checked against the rules the contracts enforce; refusal over a term the chain would revert */
1593
+ export declare function quote(i: EconomyInput, economy: Economy): {
1594
+ ok: true;
1595
+ terms: Terms;
1596
+ quote: EconomyQuote;
1597
+ } | Refused;
1598
+ /** buy: an assured job at its first held state, with the terms committed (no money moves here: the plan does) */
1599
+ export declare function buy(job: Omit<AssuredJob, 'state' | 'path' | 'terms'>, terms: Terms, opts?: {
1600
+ open?: boolean;
1601
+ }): {
1602
+ ok: true;
1603
+ job: AssuredJob;
1604
+ transition: TransitionId;
1605
+ } | Refused;
1606
+ /** the money ending of a terminal job: which legs of the quote apply */
1607
+ export declare function moneyEndingOf(job: Pick<AssuredJob, 'path' | 'state' | 'ctx'>): MoneyEnding | null;
1608
+ /** settle: who receives what at this job's ending, from the committed quote; refused while the job is still open */
1609
+ export declare function settle(job: AssuredJob, q: EconomyQuote): {
1610
+ ok: true;
1611
+ ending: Ending;
1612
+ money: MoneyEnding;
1613
+ legs: Legs;
1614
+ } | Refused;
1615
+ /** claim: what each party may take out once the job settled (non-zero legs only) */
1616
+ export declare function claim(job: AssuredJob, q: EconomyQuote): {
1617
+ ok: true;
1618
+ claims: {
1619
+ who: keyof Legs;
1620
+ amount: bigint;
1621
+ }[];
1622
+ } | Refused;
1623
+ /** the revenue hooks (phase-map) a venue's assurance earns through, with their phase and gate */
1624
+ export declare const revenueOf: (hooks: readonly RevenueHook[]) => ({
1625
+ readonly hook: "grades_pay_to_key";
1626
+ readonly phase: 1;
1627
+ readonly lane: "a grade past the three free ones (the Jev grade of a hire, a listing or a card)";
1628
+ readonly gate: null;
1629
+ } | {
1630
+ readonly hook: "x402_wall";
1631
+ readonly phase: 2;
1632
+ readonly lane: "a paid call to a walled skill, settled by the facilitator to the vault";
1633
+ readonly gate: null;
1634
+ } | {
1635
+ readonly hook: "routing_fee";
1636
+ readonly phase: 2;
1637
+ readonly lane: "a gateway call past the free daily allowance (every hire the loop sends through /gw is one)";
1638
+ readonly gate: null;
1639
+ } | {
1640
+ readonly hook: "evaluator_fee";
1641
+ readonly phase: 3;
1642
+ readonly lane: "an auto-matched hire settled through the layer: paid when our decision stands";
1643
+ readonly gate: null;
1644
+ } | {
1645
+ readonly hook: "resale_fee";
1646
+ readonly phase: 3;
1647
+ readonly lane: "a catalogue buy: the seller's price plus the fee, taken at settlement on the settle line";
1648
+ readonly gate: null;
1649
+ } | {
1650
+ readonly hook: "bridge_fee";
1651
+ readonly phase: 3;
1652
+ readonly lane: "a transfer the layer plans between chains for a hire or a caller";
1653
+ readonly gate: null;
1654
+ } | {
1655
+ readonly hook: "pool_premium_share";
1656
+ readonly phase: 4;
1657
+ readonly lane: "the premium of a covered hire: the layer's share of the written split";
1658
+ readonly gate: "split";
1659
+ } | {
1660
+ readonly hook: "grid_premium_share";
1661
+ readonly phase: 4;
1662
+ readonly lane: "the layer's leg of a GRID line's premium, paid in GRID on top of a GRID job (GRID jobs, GRID cover, made whole in GRID; opens when GRID can be deposited into pools)";
1663
+ readonly gate: "split";
1664
+ } | {
1665
+ readonly hook: "partner_bond";
1666
+ readonly phase: 5;
1667
+ readonly lane: "an enterprise partner's bond and its members' hires";
1668
+ readonly gate: null;
1669
+ })[];
1670
+ /**
1671
+ * attest: the attested mark, the on-chain attestation and the stamp of one step (a grade, an assurance settle, a resale
1672
+ * step), as UNSIGNED calls aimed at a default network chosen by profile. _ATTEST_BY_DEFAULT_v1_
1673
+ *
1674
+ * ONE file with NO imports, pure and browser-safe, like assurance.ts: @taifoon/jev, @taifoon/assurance (and through its
1675
+ * sync, taifoon-sdk and moonbeam-sdk) carry a byte-identical copy and pin its hash. The addresses come from the address
1676
+ * registry (packages/addresses) through scripts/gen-attest.mjs; nothing below the generated block names an address.
1677
+ *
1678
+ * mark what is attested, offline: the step's kind, the subject ids (decision log + stamp registry) and the
1679
+ * digest = keccak256 of the canonical JSON body (or the digest the caller already has, e.g. Jev's).
1680
+ * attestation JevDecisionLog.record(subject, kind, digest, confidenceBps, model, uri) on every target network, after
1681
+ * JevAnswerLog.record(...) when the step carries Jev's answers.
1682
+ * stamp GradeStampRegistry.stamp(subject, digest, verdict, mode, model, uri) when the step has a verdict.
1683
+ *
1684
+ * Recording is ON by default (the owner's rule of 2026-10-14): profile taifoon → the Taifoon devnet 36927 and the Taifoon
1685
+ * mainnet 3692781 (GRID); profile moonbeam → Base 8453. Any network can be named instead; `networks: 'none'` opts out
1686
+ * (the mark is still returned). A contract the registry does not have on a target network is listed in `missing`, with
1687
+ * no call: nothing is faked. Nothing here signs or sends; the caller signs the calls.
1688
+ */
1689
+ /** The attestation contracts on every chain the address registry has one on (superseded deploys left out). */
1690
+ export declare const ATTEST_TARGETS: Readonly<Record<number, {
1691
+ name: string;
1692
+ decisionLog: string | null;
1693
+ answerLog: string | null;
1694
+ stampRegistry: string | null;
1695
+ }>>;
1696
+ /** The default networks per profile. Taifoon: its devnet and its mainnet (GRID). Moonbeam: Base only. */
1697
+ export declare const ATTEST_PROFILES: {
1698
+ readonly taifoon: readonly [36927, 3692781];
1699
+ readonly moonbeam: readonly [8453];
1700
+ };
1701
+ export type AttestProfile = keyof typeof ATTEST_PROFILES;
1702
+ export type AttestHex = `0x${string}`;
1703
+ export type AttestCall = {
1704
+ chainId: number;
1705
+ to: string;
1706
+ data: AttestHex;
1707
+ value: '0';
1708
+ fn: 'JevDecisionLog.record' | 'JevAnswerLog.record' | 'GradeStampRegistry.stamp';
1709
+ };
1710
+ export type AttestMissing = {
1711
+ chainId: number;
1712
+ network: string;
1713
+ contract: 'JevDecisionLog' | 'JevAnswerLog' | 'GradeStampRegistry';
1714
+ why: string;
1715
+ };
1716
+ /** the REF verdict vocabulary of GradeStampRegistry: 1 delivered as specified · 2 with defects · 3 not delivered · 4 cannot determine */
1717
+ export type StampVerdict = 1 | 2 | 3 | 4;
1718
+ export type AttestInput = {
1719
+ /** the step: 'grade', 'assurance.settle', 'resale.<hop>' … (the decision log's kind is keccak256 of it) */
1720
+ kind: string;
1721
+ /** the job the step is about, on its own chain and contract */
1722
+ subject: {
1723
+ chainId: number;
1724
+ contract: string;
1725
+ jobId: string | number | bigint;
1726
+ };
1727
+ /** the canonical body of the step; its keccak256 is the digest unless `digest` is given */
1728
+ body?: unknown | undefined;
1729
+ digest?: AttestHex | undefined;
1730
+ /** 0..10000; default 10000 (a deterministic step) */
1731
+ confidenceBps?: number | undefined;
1732
+ /** ≤ 64 bytes, e.g. 'jev-1.13.0' or 'det:assurance-settle-v1' */
1733
+ model: string;
1734
+ /** ≤ 512 bytes; default urn:taifoon:<kind>:<digest> */
1735
+ uri?: string | undefined;
1736
+ /** a stamp is built when there is a verdict; mode 1 deterministic (default) · 2 calibrated */
1737
+ verdict?: StampVerdict | null | undefined;
1738
+ mode?: 1 | 2 | undefined;
1739
+ /** Jev's answer record digests: adds JevAnswerLog.record */
1740
+ answers?: {
1741
+ useCase: string;
1742
+ inputDigest: AttestHex;
1743
+ answersDigest: AttestHex;
1744
+ uri?: string | undefined;
1745
+ } | undefined;
1746
+ };
1747
+ export type AttestOptions = {
1748
+ /** picks the default networks; default 'taifoon' */
1749
+ profile?: AttestProfile | undefined;
1750
+ /** overrides the profile: chain ids, or 'none' to opt out of recording (the mark is still returned) */
1751
+ networks?: readonly number[] | 'none' | undefined;
1752
+ /** extra or replacement contracts per chain (e.g. a fork's deploy, or a network the registry does not list) */
1753
+ targets?: Readonly<Record<number, Partial<{
1754
+ name: string;
1755
+ decisionLog: string | null;
1756
+ answerLog: string | null;
1757
+ stampRegistry: string | null;
1758
+ }>>> | undefined;
1759
+ };
1760
+ export type Attested = {
1761
+ mark: {
1762
+ kind: string;
1763
+ kindId: AttestHex;
1764
+ subject: AttestHex;
1765
+ stampSubject: AttestHex;
1766
+ digest: AttestHex;
1767
+ confidenceBps: number;
1768
+ verdict: StampVerdict | null;
1769
+ model: string;
1770
+ uri: string;
1771
+ };
1772
+ /** false only when the caller opted out */
1773
+ recorded: boolean;
1774
+ networks: number[];
1775
+ calls: AttestCall[];
1776
+ missing: AttestMissing[];
1777
+ /** ready: every target contract exists · partial: some are missing · missing: none exist · none: opted out */
1778
+ status: 'ready' | 'partial' | 'missing' | 'none';
1779
+ };
1780
+ export declare function attestKeccak(input: Uint8Array | string): AttestHex;
1781
+ export declare const DECISION_LOG_RECORD_SIG = "record(bytes32,bytes32,bytes32,uint16,string,string)";
1782
+ export declare const ANSWER_LOG_RECORD_SIG = "record(bytes32,bytes32,bytes32,bytes32,bytes32,string,string)";
1783
+ export declare const STAMP_SIG = "stamp(bytes32,bytes32,uint8,uint8,string,string)";
1784
+ /** canonical JSON: sorted keys, bigint as a decimal string, no whitespace (the digest's preimage) */
1785
+ export declare function attestCanonical(v: unknown): string;
1786
+ /** JevDecisionLog.subjectOf(chainId, at, ref) = keccak256(abi.encode("taifoon.decision.subject.v1", chainId, at, ref)) */
1787
+ export declare const decisionSubjectOf: (chainId: number, at: string, ref: string | number | bigint) => AttestHex;
1788
+ /** GradeStampRegistry.subjectOf(chainId, jobContract, jobId) = keccak256(abi.encode("taifoon.stamp.subject.v1", …)) */
1789
+ export declare const stampSubjectOf: (chainId: number, jobContract: string, jobId: string | number | bigint) => AttestHex;
1790
+ /** the stamp verdict of a settled ending, from the seller-record verdict the machine writes (endingOf): correct → 1;
1791
+ * a Jev case (rejected or expired after delivery) → 4, it takes a grade to say more; incorrect → 3; excluded → no stamp */
1792
+ export declare function stampVerdictOfEnding(e: {
1793
+ verdict: string;
1794
+ jevCase: boolean;
1795
+ excluded: string | null;
1796
+ }): StampVerdict | null;
1797
+ /** the mark, the attestation calls and the stamp call of one step, on the profile's networks (or the ones named) */
1798
+ export declare function attest(input: AttestInput, opts?: AttestOptions): Attested;
1799
+ export type SettleAttestOptions = AttestOptions & {
1800
+ /** the contract the job lives on (the hook, the venue's escrow): with chainId and jobId it names the subject */
1801
+ contract: string;
1802
+ /** ≤ 64 bytes; default det:assurance-settle-v1 */
1803
+ model?: string | undefined;
1804
+ uri?: string | undefined;
1805
+ };
1806
+ /** the canonical body a settle attests: the job, its ending and the legs (bigint amounts as decimal strings) */
1807
+ export declare const settleBodyOf: (job: AssuredJob, contract: string, s: {
1808
+ ending: Ending;
1809
+ money: MoneyEnding;
1810
+ legs: Legs;
1811
+ }) => {
1812
+ v: string;
1813
+ chainId: number;
1814
+ contract: string;
1815
+ jobId: string;
1816
+ venue: string;
1817
+ ending: EndingId;
1818
+ verdict: string;
1819
+ money: MoneyEnding;
1820
+ legs: Legs;
1821
+ };
1822
+ /** settle() and the attestation of its result; refused exactly when settle() refuses */
1823
+ export declare function settleAttested(job: AssuredJob, q: EconomyQuote, opts: SettleAttestOptions): {
1824
+ ok: true;
1825
+ ending: Ending;
1826
+ money: MoneyEnding;
1827
+ legs: Legs;
1828
+ attest: Attested;
1829
+ } | Refused;
1830
+ /** a contract by its address-registry entry */
1831
+ export type Ref = {
1832
+ system: string;
1833
+ chain: number;
1834
+ name: string;
1835
+ };
1836
+ /** what Taifoon can put on a venue's job */
1837
+ export type Attach = 'hook-cover' | 'external-cover' | 'evaluator-seat' | 'grade' | 'proof';
1838
+ export type VenueId = 'taifoon-hook' | 'moonbeam' | 'virtuals-acp' | 'memo-acp' | 'bitagent' | 'erc8183' | 'x402' | 'olas-mech';
1839
+ /** a trail as the venue (or the observatory's index of it) reports it: an event name, or a state carrier */
1840
+ export type NativeStep = {
1841
+ name: string;
1842
+ phase?: number;
1843
+ hookState?: number;
1844
+ handshake?: string;
1845
+ delivered?: boolean;
1846
+ };
1847
+ export type VenueAdapter = {
1848
+ id: VenueId;
1849
+ name: string;
1850
+ status: 'live' | 'devnet' | 'observed' | 'prepared' | 'read-only';
1851
+ /** the machine lane and hook version a job here walks; null for a venue that is observed, not walked (Olas Mech) */
1852
+ ctx: Ctx | null;
1853
+ observedLane?: string;
1854
+ /** `line`: an asset line of the venue on that chain (ASSET_LINES), when the chain's row is one line, not the venue's default asset */
1855
+ chains: {
1856
+ chainId: number;
1857
+ escrow: Ref | null;
1858
+ status: 'live' | 'devnet' | 'prepared' | 'read-only';
1859
+ line?: AssetLineId;
1860
+ }[];
1861
+ /** the venue's payment system in plain words */
1862
+ payment: string;
1863
+ asset: string;
1864
+ /** where the buyer's money sits in each held state (every held state the lane reaches) */
1865
+ moneyAt: Partial<Record<State, string>>;
1866
+ refund: {
1867
+ rule: 'hook' | 'claim' | 'claim-if-deployed' | 'none';
1868
+ how: string;
1869
+ };
1870
+ attach: {
1871
+ kind: Attach;
1872
+ how: string;
1873
+ }[];
1874
+ /** the phase-map revenue hooks this venue's assurance earns through */
1875
+ revenue: {
1876
+ hook: RevenueHook;
1877
+ how: string;
1878
+ }[];
1879
+ /** the read the layer already runs for this venue: no second index */
1880
+ observe: {
1881
+ index: string;
1882
+ adapter: string;
1883
+ reads: string[];
1884
+ };
1885
+ /** external cover's own id for the venue, when it sells policies there */
1886
+ coverVenue: 'erc8183' | 'bitagent' | 'memo-acp' | 'olas-mech' | 'x402' | null;
1887
+ /** may the public build money calls through us here (Moonbeam: no, pilot only) */
1888
+ publicWrites: boolean;
1889
+ /** what an integration needs that does not exist yet, or waits on a decision */
1890
+ needs: string[];
1891
+ };
1892
+ /** _GRID_LINE_v1_: one asset per job (V4: no oracle on the money path). An asset line is one hook instance whose job asset is
1893
+ * that asset, with pools in that asset; a pool covers only jobs in its own asset. Every line walks the hook lane. */
1894
+ export type AssetLineId = 'grid';
1895
+ export type AssetLine = {
1896
+ id: AssetLineId;
1897
+ /** what a person reads */ name: string;
1898
+ chainId: number;
1899
+ asset: {
1900
+ symbol: string;
1901
+ decimals: number;
1902
+ pegUsd: number | null;
1903
+ };
1904
+ /** 'prepared': the terms and the quote exist; buying waits on `opens` */ status: 'live' | 'prepared';
1905
+ /** the one plain sentence shown instead of a buy action while the line is prepared */ opens: string | null;
1906
+ /** the promise, in plain words */ promise: string;
1907
+ /** what the line never does */ never: string;
1908
+ /** jev-wilson's calibration of the line (judge/wilson calibration/<id>.json) and the hook bounds its quotes pass */
1909
+ economy: {
1910
+ calibration: string;
1911
+ maxPremiumBps: number;
1912
+ minBackersAprBps: number;
1913
+ };
1914
+ /** the phase-map revenue hook the layer's leg lands in */ revenue: RevenueHook;
1915
+ /** what the line needs that does not exist yet */ needs: string[];
1916
+ };
1917
+ /** the venue's trail as machine events: event names pass through; phases, hook states and handshake states become states */
1918
+ export declare function eventsOf(trail: NativeStep[]): AssuranceEvent[];
1919
+ /** the revenue hooks of phase-map, by name (a typo fails the adapter test) */
1920
+ export declare const knownHook: (h: string) => boolean;
1921
+ export declare const moonbeamVenue: VenueAdapter;
1922
+ /** the venues of this profile (moonbeam) */
1923
+ export declare const VENUES: Partial<Record<VenueId, VenueAdapter>>;
1924
+ //# sourceMappingURL=assurance-shared.d.ts.map