@blindmarket/sdk 0.1.7 → 0.1.8

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 (133) hide show
  1. package/dist/chain/BlindEscrowClient.d.ts +2 -0
  2. package/dist/chain/BlindEscrowClient.js +14 -6
  3. package/dist/chain/BlindReputationClient.d.ts +3 -0
  4. package/dist/chain/BlindReputationClient.js +3 -1
  5. package/dist/chain/ChainClient.d.ts +5 -2
  6. package/dist/chain/ChainClient.js +5 -0
  7. package/dist/chain/IBlindMarketChain.d.ts +74 -0
  8. package/dist/chain/IBlindMarketChain.js +1 -0
  9. package/dist/chain/TaskRegistryClient.d.ts +2 -1
  10. package/dist/chain/TaskRegistryClient.js +15 -7
  11. package/dist/chain/createChainAdapter.d.ts +25 -0
  12. package/dist/chain/createChainAdapter.js +24 -0
  13. package/dist/chain/domain-types.d.ts +77 -0
  14. package/dist/chain/domain-types.js +1 -0
  15. package/dist/chain/evm/EVMChainAdapter.d.ts +56 -0
  16. package/dist/chain/evm/EVMChainAdapter.js +161 -0
  17. package/dist/chain/evm/index.d.ts +1 -0
  18. package/dist/chain/evm/index.js +1 -0
  19. package/dist/chain/index.d.ts +4 -0
  20. package/dist/chain/index.js +5 -0
  21. package/dist/executor/WorkerRuntime.d.ts +113 -0
  22. package/dist/executor/WorkerRuntime.js +248 -0
  23. package/dist/executor/index.d.ts +1 -0
  24. package/dist/executor/index.js +1 -0
  25. package/dist/index.d.ts +7 -0
  26. package/dist/index.js +8 -3
  27. package/dist/network/presets.d.ts +33 -5
  28. package/dist/network/presets.js +35 -8
  29. package/dist/network/resolve.d.ts +12 -3
  30. package/dist/network/resolve.js +15 -7
  31. package/dist/network/types.d.ts +3 -16
  32. package/dist/types.d.ts +1 -1
  33. package/package.json +1 -1
  34. package/src/chain/BlindEscrowClient.ts +15 -6
  35. package/src/chain/BlindReputationClient.ts +6 -1
  36. package/src/chain/ChainClient.ts +9 -3
  37. package/src/chain/IBlindMarketChain.ts +109 -0
  38. package/src/chain/TaskRegistryClient.ts +17 -8
  39. package/src/chain/createChainAdapter.ts +40 -0
  40. package/src/chain/domain-types.ts +92 -0
  41. package/src/chain/evm/EVMChainAdapter.ts +212 -0
  42. package/src/chain/evm/index.ts +1 -0
  43. package/src/chain/index.ts +6 -0
  44. package/src/executor/WorkerRuntime.ts +338 -0
  45. package/src/executor/index.ts +8 -0
  46. package/src/index.ts +23 -4
  47. package/src/network/presets.ts +47 -8
  48. package/src/network/resolve.ts +20 -8
  49. package/src/network/types.ts +18 -16
  50. package/src/signer/index.ts +1 -1
  51. package/src/types.ts +2 -1
  52. package/dist/BlindEscrowClient-CyPuKMge.d.cts +0 -54
  53. package/dist/BlindEscrowClient-R7iGpE-n.d.ts +0 -54
  54. package/dist/KeyStore-Be_SSpCt.d.cts +0 -21
  55. package/dist/KeyStore-k1JgYPJY.d.ts +0 -21
  56. package/dist/Signer-BnqH_qew.d.cts +0 -38
  57. package/dist/Signer-LColE0Uo.d.ts +0 -38
  58. package/dist/Storage-4QOrh7rm.d.ts +0 -17
  59. package/dist/Storage-Cf4IJRMk.d.cts +0 -17
  60. package/dist/TaskRegistryClient-Ch6lYqM_.d.ts +0 -24
  61. package/dist/TaskRegistryClient-CrQjddDc.d.cts +0 -24
  62. package/dist/aes-J-7HrHze.d.cts +0 -17
  63. package/dist/aes-J-7HrHze.d.ts +0 -17
  64. package/dist/agent/index.cjs +0 -425
  65. package/dist/agent/index.cjs.map +0 -1
  66. package/dist/agent/index.d.cts +0 -63
  67. package/dist/agent/index.js.map +0 -1
  68. package/dist/api/index.cjs +0 -4
  69. package/dist/api/index.cjs.map +0 -1
  70. package/dist/api/index.d.cts +0 -2
  71. package/dist/api/index.js.map +0 -1
  72. package/dist/chain/index.cjs +0 -2484
  73. package/dist/chain/index.cjs.map +0 -1
  74. package/dist/chain/index.d.cts +0 -2305
  75. package/dist/chain/index.js.map +0 -1
  76. package/dist/compute/index.cjs +0 -4
  77. package/dist/compute/index.cjs.map +0 -1
  78. package/dist/compute/index.d.cts +0 -2
  79. package/dist/compute/index.js.map +0 -1
  80. package/dist/crypto/index.cjs +0 -424
  81. package/dist/crypto/index.cjs.map +0 -1
  82. package/dist/crypto/index.d.cts +0 -74
  83. package/dist/crypto/index.js.map +0 -1
  84. package/dist/errors/BlindBountyError.d.ts +0 -14
  85. package/dist/errors/BlindBountyError.js +0 -30
  86. package/dist/errors/index.cjs +0 -136
  87. package/dist/errors/index.cjs.map +0 -1
  88. package/dist/errors/index.d.cts +0 -60
  89. package/dist/errors/index.js.map +0 -1
  90. package/dist/events/index.cjs +0 -41
  91. package/dist/events/index.cjs.map +0 -1
  92. package/dist/events/index.d.cts +0 -61
  93. package/dist/events/index.js.map +0 -1
  94. package/dist/index.cjs +0 -4
  95. package/dist/index.cjs.map +0 -1
  96. package/dist/index.d.cts +0 -2
  97. package/dist/index.js.map +0 -1
  98. package/dist/keystore/index.cjs +0 -335
  99. package/dist/keystore/index.cjs.map +0 -1
  100. package/dist/keystore/index.d.cts +0 -23
  101. package/dist/keystore/index.js.map +0 -1
  102. package/dist/mcp.d.ts +0 -23
  103. package/dist/mcp.js +0 -101
  104. package/dist/network/index.cjs +0 -74
  105. package/dist/network/index.cjs.map +0 -1
  106. package/dist/network/index.d.cts +0 -36
  107. package/dist/network/index.js.map +0 -1
  108. package/dist/signer/index.cjs +0 -121
  109. package/dist/signer/index.cjs.map +0 -1
  110. package/dist/signer/index.d.cts +0 -40
  111. package/dist/signer/index.js.map +0 -1
  112. package/dist/storage/ZgStorage.d.ts +0 -24
  113. package/dist/storage/ZgStorage.js +0 -102
  114. package/dist/storage/index.cjs +0 -221
  115. package/dist/storage/index.cjs.map +0 -1
  116. package/dist/storage/index.d.cts +0 -44
  117. package/dist/storage/index.js.map +0 -1
  118. package/dist/testing/index.cjs +0 -4
  119. package/dist/testing/index.cjs.map +0 -1
  120. package/dist/testing/index.d.cts +0 -2
  121. package/dist/testing/index.js.map +0 -1
  122. package/dist/types-BOG5Ub1z.d.cts +0 -31
  123. package/dist/types-BOG5Ub1z.d.ts +0 -31
  124. package/dist/types-V7_ZmUb-.d.cts +0 -19
  125. package/dist/types-hAsITUQ7.d.ts +0 -19
  126. package/dist/verifier/index.cjs +0 -4
  127. package/dist/verifier/index.cjs.map +0 -1
  128. package/dist/verifier/index.d.cts +0 -2
  129. package/dist/verifier/index.js.map +0 -1
  130. package/dist/worker/index.cjs +0 -382
  131. package/dist/worker/index.cjs.map +0 -1
  132. package/dist/worker/index.d.cts +0 -58
  133. package/dist/worker/index.js.map +0 -1
@@ -1,2484 +0,0 @@
1
- 'use strict';
2
-
3
- var ethers = require('ethers');
4
-
5
- // src/chain/abi/BlindEscrow.json
6
- var BlindEscrow_default = [
7
- {
8
- inputs: [
9
- {
10
- internalType: "address",
11
- name: "_treasury",
12
- type: "address"
13
- },
14
- {
15
- internalType: "address",
16
- name: "_verifier",
17
- type: "address"
18
- }
19
- ],
20
- stateMutability: "nonpayable",
21
- type: "constructor"
22
- },
23
- {
24
- inputs: [],
25
- name: "DeadlineNotReached",
26
- type: "error"
27
- },
28
- {
29
- inputs: [],
30
- name: "DeadlineReached",
31
- type: "error"
32
- },
33
- {
34
- inputs: [],
35
- name: "EmptyHash",
36
- type: "error"
37
- },
38
- {
39
- inputs: [],
40
- name: "EnforcedPause",
41
- type: "error"
42
- },
43
- {
44
- inputs: [],
45
- name: "ExpectedPause",
46
- type: "error"
47
- },
48
- {
49
- inputs: [],
50
- name: "FeeExceedsMax",
51
- type: "error"
52
- },
53
- {
54
- inputs: [],
55
- name: "InvalidDeadline",
56
- type: "error"
57
- },
58
- {
59
- inputs: [
60
- {
61
- internalType: "enum BlindEscrow.TaskStatus",
62
- name: "current",
63
- type: "uint8"
64
- },
65
- {
66
- internalType: "enum BlindEscrow.TaskStatus",
67
- name: "required",
68
- type: "uint8"
69
- }
70
- ],
71
- name: "InvalidStatus",
72
- type: "error"
73
- },
74
- {
75
- inputs: [],
76
- name: "MaxSubmissionAttemptsReached",
77
- type: "error"
78
- },
79
- {
80
- inputs: [],
81
- name: "NotAdmin",
82
- type: "error"
83
- },
84
- {
85
- inputs: [],
86
- name: "NotAgent",
87
- type: "error"
88
- },
89
- {
90
- inputs: [],
91
- name: "NotPendingAdmin",
92
- type: "error"
93
- },
94
- {
95
- inputs: [],
96
- name: "NotVerifier",
97
- type: "error"
98
- },
99
- {
100
- inputs: [],
101
- name: "NotWorker",
102
- type: "error"
103
- },
104
- {
105
- inputs: [],
106
- name: "ReentrancyGuardReentrantCall",
107
- type: "error"
108
- },
109
- {
110
- inputs: [
111
- {
112
- internalType: "address",
113
- name: "token",
114
- type: "address"
115
- }
116
- ],
117
- name: "SafeERC20FailedOperation",
118
- type: "error"
119
- },
120
- {
121
- inputs: [],
122
- name: "SelfAssignment",
123
- type: "error"
124
- },
125
- {
126
- inputs: [],
127
- name: "TokenNotAllowed",
128
- type: "error"
129
- },
130
- {
131
- inputs: [],
132
- name: "ZeroAddress",
133
- type: "error"
134
- },
135
- {
136
- inputs: [],
137
- name: "ZeroAmount",
138
- type: "error"
139
- },
140
- {
141
- anonymous: false,
142
- inputs: [
143
- {
144
- indexed: true,
145
- internalType: "address",
146
- name: "oldAdmin",
147
- type: "address"
148
- },
149
- {
150
- indexed: true,
151
- internalType: "address",
152
- name: "newAdmin",
153
- type: "address"
154
- }
155
- ],
156
- name: "AdminTransferCompleted",
157
- type: "event"
158
- },
159
- {
160
- anonymous: false,
161
- inputs: [
162
- {
163
- indexed: true,
164
- internalType: "address",
165
- name: "currentAdmin",
166
- type: "address"
167
- },
168
- {
169
- indexed: true,
170
- internalType: "address",
171
- name: "pendingAdmin",
172
- type: "address"
173
- }
174
- ],
175
- name: "AdminTransferProposed",
176
- type: "event"
177
- },
178
- {
179
- anonymous: false,
180
- inputs: [
181
- {
182
- indexed: true,
183
- internalType: "uint256",
184
- name: "taskId",
185
- type: "uint256"
186
- },
187
- {
188
- indexed: false,
189
- internalType: "uint256",
190
- name: "refundAmount",
191
- type: "uint256"
192
- }
193
- ],
194
- name: "DeadlineExpired",
195
- type: "event"
196
- },
197
- {
198
- anonymous: false,
199
- inputs: [
200
- {
201
- indexed: true,
202
- internalType: "uint256",
203
- name: "taskId",
204
- type: "uint256"
205
- },
206
- {
207
- indexed: false,
208
- internalType: "bool",
209
- name: "workerFavored",
210
- type: "bool"
211
- }
212
- ],
213
- name: "DisputeResolved",
214
- type: "event"
215
- },
216
- {
217
- anonymous: false,
218
- inputs: [
219
- {
220
- indexed: true,
221
- internalType: "uint256",
222
- name: "taskId",
223
- type: "uint256"
224
- },
225
- {
226
- indexed: true,
227
- internalType: "address",
228
- name: "worker",
229
- type: "address"
230
- },
231
- {
232
- indexed: false,
233
- internalType: "bytes32",
234
- name: "evidenceHash",
235
- type: "bytes32"
236
- },
237
- {
238
- indexed: false,
239
- internalType: "uint8",
240
- name: "attempt",
241
- type: "uint8"
242
- }
243
- ],
244
- name: "EvidenceSubmitted",
245
- type: "event"
246
- },
247
- {
248
- anonymous: false,
249
- inputs: [
250
- {
251
- indexed: false,
252
- internalType: "uint256",
253
- name: "oldFeeBps",
254
- type: "uint256"
255
- },
256
- {
257
- indexed: false,
258
- internalType: "uint256",
259
- name: "newFeeBps",
260
- type: "uint256"
261
- }
262
- ],
263
- name: "FeeBpsUpdated",
264
- type: "event"
265
- },
266
- {
267
- anonymous: false,
268
- inputs: [
269
- {
270
- indexed: false,
271
- internalType: "address",
272
- name: "account",
273
- type: "address"
274
- }
275
- ],
276
- name: "Paused",
277
- type: "event"
278
- },
279
- {
280
- anonymous: false,
281
- inputs: [
282
- {
283
- indexed: true,
284
- internalType: "address",
285
- name: "oldContract",
286
- type: "address"
287
- },
288
- {
289
- indexed: true,
290
- internalType: "address",
291
- name: "newContract",
292
- type: "address"
293
- }
294
- ],
295
- name: "ReputationContractUpdated",
296
- type: "event"
297
- },
298
- {
299
- anonymous: false,
300
- inputs: [
301
- {
302
- indexed: true,
303
- internalType: "uint256",
304
- name: "taskId",
305
- type: "uint256"
306
- },
307
- {
308
- indexed: false,
309
- internalType: "uint256",
310
- name: "refundAmount",
311
- type: "uint256"
312
- }
313
- ],
314
- name: "TaskCancelled",
315
- type: "event"
316
- },
317
- {
318
- anonymous: false,
319
- inputs: [
320
- {
321
- indexed: true,
322
- internalType: "uint256",
323
- name: "taskId",
324
- type: "uint256"
325
- },
326
- {
327
- indexed: false,
328
- internalType: "uint256",
329
- name: "workerPayout",
330
- type: "uint256"
331
- },
332
- {
333
- indexed: false,
334
- internalType: "uint256",
335
- name: "platformFee",
336
- type: "uint256"
337
- }
338
- ],
339
- name: "TaskCompleted",
340
- type: "event"
341
- },
342
- {
343
- anonymous: false,
344
- inputs: [
345
- {
346
- indexed: true,
347
- internalType: "uint256",
348
- name: "taskId",
349
- type: "uint256"
350
- },
351
- {
352
- indexed: true,
353
- internalType: "address",
354
- name: "agent",
355
- type: "address"
356
- },
357
- {
358
- indexed: false,
359
- internalType: "address",
360
- name: "token",
361
- type: "address"
362
- },
363
- {
364
- indexed: false,
365
- internalType: "uint256",
366
- name: "amount",
367
- type: "uint256"
368
- },
369
- {
370
- indexed: false,
371
- internalType: "bytes32",
372
- name: "taskHash",
373
- type: "bytes32"
374
- },
375
- {
376
- indexed: false,
377
- internalType: "string",
378
- name: "category",
379
- type: "string"
380
- },
381
- {
382
- indexed: false,
383
- internalType: "string",
384
- name: "locationZone",
385
- type: "string"
386
- },
387
- {
388
- indexed: false,
389
- internalType: "uint256",
390
- name: "deadline",
391
- type: "uint256"
392
- }
393
- ],
394
- name: "TaskCreated",
395
- type: "event"
396
- },
397
- {
398
- anonymous: false,
399
- inputs: [
400
- {
401
- indexed: true,
402
- internalType: "uint256",
403
- name: "taskId",
404
- type: "uint256"
405
- },
406
- {
407
- indexed: true,
408
- internalType: "address",
409
- name: "initiator",
410
- type: "address"
411
- }
412
- ],
413
- name: "TaskDisputed",
414
- type: "event"
415
- },
416
- {
417
- anonymous: false,
418
- inputs: [
419
- {
420
- indexed: true,
421
- internalType: "address",
422
- name: "oldRegistry",
423
- type: "address"
424
- },
425
- {
426
- indexed: true,
427
- internalType: "address",
428
- name: "newRegistry",
429
- type: "address"
430
- }
431
- ],
432
- name: "TaskRegistryUpdated",
433
- type: "event"
434
- },
435
- {
436
- anonymous: false,
437
- inputs: [
438
- {
439
- indexed: true,
440
- internalType: "address",
441
- name: "token",
442
- type: "address"
443
- }
444
- ],
445
- name: "TokenAllowed",
446
- type: "event"
447
- },
448
- {
449
- anonymous: false,
450
- inputs: [
451
- {
452
- indexed: true,
453
- internalType: "address",
454
- name: "token",
455
- type: "address"
456
- }
457
- ],
458
- name: "TokenDisallowed",
459
- type: "event"
460
- },
461
- {
462
- anonymous: false,
463
- inputs: [
464
- {
465
- indexed: true,
466
- internalType: "address",
467
- name: "oldTreasury",
468
- type: "address"
469
- },
470
- {
471
- indexed: true,
472
- internalType: "address",
473
- name: "newTreasury",
474
- type: "address"
475
- }
476
- ],
477
- name: "TreasuryUpdated",
478
- type: "event"
479
- },
480
- {
481
- anonymous: false,
482
- inputs: [
483
- {
484
- indexed: false,
485
- internalType: "address",
486
- name: "account",
487
- type: "address"
488
- }
489
- ],
490
- name: "Unpaused",
491
- type: "event"
492
- },
493
- {
494
- anonymous: false,
495
- inputs: [
496
- {
497
- indexed: true,
498
- internalType: "uint256",
499
- name: "taskId",
500
- type: "uint256"
501
- },
502
- {
503
- indexed: false,
504
- internalType: "bool",
505
- name: "passed",
506
- type: "bool"
507
- }
508
- ],
509
- name: "VerificationCompleted",
510
- type: "event"
511
- },
512
- {
513
- anonymous: false,
514
- inputs: [
515
- {
516
- indexed: true,
517
- internalType: "address",
518
- name: "oldVerifier",
519
- type: "address"
520
- },
521
- {
522
- indexed: true,
523
- internalType: "address",
524
- name: "newVerifier",
525
- type: "address"
526
- }
527
- ],
528
- name: "VerifierUpdated",
529
- type: "event"
530
- },
531
- {
532
- anonymous: false,
533
- inputs: [
534
- {
535
- indexed: true,
536
- internalType: "uint256",
537
- name: "taskId",
538
- type: "uint256"
539
- },
540
- {
541
- indexed: true,
542
- internalType: "address",
543
- name: "worker",
544
- type: "address"
545
- }
546
- ],
547
- name: "WorkerAssigned",
548
- type: "event"
549
- },
550
- {
551
- inputs: [],
552
- name: "MAX_DEADLINE",
553
- outputs: [
554
- {
555
- internalType: "uint256",
556
- name: "",
557
- type: "uint256"
558
- }
559
- ],
560
- stateMutability: "view",
561
- type: "function"
562
- },
563
- {
564
- inputs: [],
565
- name: "MAX_FEE_BPS",
566
- outputs: [
567
- {
568
- internalType: "uint256",
569
- name: "",
570
- type: "uint256"
571
- }
572
- ],
573
- stateMutability: "view",
574
- type: "function"
575
- },
576
- {
577
- inputs: [],
578
- name: "MAX_SUBMISSION_ATTEMPTS",
579
- outputs: [
580
- {
581
- internalType: "uint8",
582
- name: "",
583
- type: "uint8"
584
- }
585
- ],
586
- stateMutability: "view",
587
- type: "function"
588
- },
589
- {
590
- inputs: [],
591
- name: "MIN_DEADLINE",
592
- outputs: [
593
- {
594
- internalType: "uint256",
595
- name: "",
596
- type: "uint256"
597
- }
598
- ],
599
- stateMutability: "view",
600
- type: "function"
601
- },
602
- {
603
- inputs: [],
604
- name: "acceptAdmin",
605
- outputs: [],
606
- stateMutability: "nonpayable",
607
- type: "function"
608
- },
609
- {
610
- inputs: [],
611
- name: "admin",
612
- outputs: [
613
- {
614
- internalType: "address",
615
- name: "",
616
- type: "address"
617
- }
618
- ],
619
- stateMutability: "view",
620
- type: "function"
621
- },
622
- {
623
- inputs: [
624
- {
625
- internalType: "address",
626
- name: "token",
627
- type: "address"
628
- }
629
- ],
630
- name: "allowToken",
631
- outputs: [],
632
- stateMutability: "nonpayable",
633
- type: "function"
634
- },
635
- {
636
- inputs: [
637
- {
638
- internalType: "address",
639
- name: "",
640
- type: "address"
641
- }
642
- ],
643
- name: "allowedTokens",
644
- outputs: [
645
- {
646
- internalType: "bool",
647
- name: "",
648
- type: "bool"
649
- }
650
- ],
651
- stateMutability: "view",
652
- type: "function"
653
- },
654
- {
655
- inputs: [
656
- {
657
- internalType: "uint256",
658
- name: "taskId",
659
- type: "uint256"
660
- },
661
- {
662
- internalType: "address",
663
- name: "worker",
664
- type: "address"
665
- }
666
- ],
667
- name: "assignWorker",
668
- outputs: [],
669
- stateMutability: "nonpayable",
670
- type: "function"
671
- },
672
- {
673
- inputs: [
674
- {
675
- internalType: "uint256",
676
- name: "taskId",
677
- type: "uint256"
678
- }
679
- ],
680
- name: "cancelTask",
681
- outputs: [],
682
- stateMutability: "nonpayable",
683
- type: "function"
684
- },
685
- {
686
- inputs: [
687
- {
688
- internalType: "uint256",
689
- name: "taskId",
690
- type: "uint256"
691
- }
692
- ],
693
- name: "claimTimeout",
694
- outputs: [],
695
- stateMutability: "nonpayable",
696
- type: "function"
697
- },
698
- {
699
- inputs: [
700
- {
701
- internalType: "uint256",
702
- name: "taskId",
703
- type: "uint256"
704
- },
705
- {
706
- internalType: "bool",
707
- name: "passed",
708
- type: "bool"
709
- }
710
- ],
711
- name: "completeVerification",
712
- outputs: [],
713
- stateMutability: "nonpayable",
714
- type: "function"
715
- },
716
- {
717
- inputs: [
718
- {
719
- internalType: "bytes32",
720
- name: "taskHash",
721
- type: "bytes32"
722
- },
723
- {
724
- internalType: "address",
725
- name: "token",
726
- type: "address"
727
- },
728
- {
729
- internalType: "uint256",
730
- name: "amount",
731
- type: "uint256"
732
- },
733
- {
734
- internalType: "string",
735
- name: "category",
736
- type: "string"
737
- },
738
- {
739
- internalType: "string",
740
- name: "locationZone",
741
- type: "string"
742
- },
743
- {
744
- internalType: "uint256",
745
- name: "duration",
746
- type: "uint256"
747
- }
748
- ],
749
- name: "createTask",
750
- outputs: [
751
- {
752
- internalType: "uint256",
753
- name: "taskId",
754
- type: "uint256"
755
- }
756
- ],
757
- stateMutability: "nonpayable",
758
- type: "function"
759
- },
760
- {
761
- inputs: [
762
- {
763
- internalType: "address",
764
- name: "token",
765
- type: "address"
766
- }
767
- ],
768
- name: "disallowToken",
769
- outputs: [],
770
- stateMutability: "nonpayable",
771
- type: "function"
772
- },
773
- {
774
- inputs: [],
775
- name: "feeBps",
776
- outputs: [
777
- {
778
- internalType: "uint256",
779
- name: "",
780
- type: "uint256"
781
- }
782
- ],
783
- stateMutability: "view",
784
- type: "function"
785
- },
786
- {
787
- inputs: [
788
- {
789
- internalType: "uint256",
790
- name: "taskId",
791
- type: "uint256"
792
- }
793
- ],
794
- name: "getTask",
795
- outputs: [
796
- {
797
- components: [
798
- {
799
- internalType: "address",
800
- name: "agent",
801
- type: "address"
802
- },
803
- {
804
- internalType: "address",
805
- name: "worker",
806
- type: "address"
807
- },
808
- {
809
- internalType: "address",
810
- name: "token",
811
- type: "address"
812
- },
813
- {
814
- internalType: "uint256",
815
- name: "amount",
816
- type: "uint256"
817
- },
818
- {
819
- internalType: "bytes32",
820
- name: "taskHash",
821
- type: "bytes32"
822
- },
823
- {
824
- internalType: "bytes32",
825
- name: "evidenceHash",
826
- type: "bytes32"
827
- },
828
- {
829
- internalType: "enum BlindEscrow.TaskStatus",
830
- name: "status",
831
- type: "uint8"
832
- },
833
- {
834
- internalType: "string",
835
- name: "category",
836
- type: "string"
837
- },
838
- {
839
- internalType: "string",
840
- name: "locationZone",
841
- type: "string"
842
- },
843
- {
844
- internalType: "uint256",
845
- name: "createdAt",
846
- type: "uint256"
847
- },
848
- {
849
- internalType: "uint256",
850
- name: "deadline",
851
- type: "uint256"
852
- },
853
- {
854
- internalType: "uint8",
855
- name: "submissionAttempts",
856
- type: "uint8"
857
- }
858
- ],
859
- internalType: "struct BlindEscrow.Task",
860
- name: "",
861
- type: "tuple"
862
- }
863
- ],
864
- stateMutability: "view",
865
- type: "function"
866
- },
867
- {
868
- inputs: [
869
- {
870
- internalType: "uint256",
871
- name: "taskId",
872
- type: "uint256"
873
- }
874
- ],
875
- name: "isTaskExpired",
876
- outputs: [
877
- {
878
- internalType: "bool",
879
- name: "",
880
- type: "bool"
881
- }
882
- ],
883
- stateMutability: "view",
884
- type: "function"
885
- },
886
- {
887
- inputs: [],
888
- name: "nextTaskId",
889
- outputs: [
890
- {
891
- internalType: "uint256",
892
- name: "",
893
- type: "uint256"
894
- }
895
- ],
896
- stateMutability: "view",
897
- type: "function"
898
- },
899
- {
900
- inputs: [],
901
- name: "pause",
902
- outputs: [],
903
- stateMutability: "nonpayable",
904
- type: "function"
905
- },
906
- {
907
- inputs: [],
908
- name: "paused",
909
- outputs: [
910
- {
911
- internalType: "bool",
912
- name: "",
913
- type: "bool"
914
- }
915
- ],
916
- stateMutability: "view",
917
- type: "function"
918
- },
919
- {
920
- inputs: [],
921
- name: "pendingAdmin",
922
- outputs: [
923
- {
924
- internalType: "address",
925
- name: "",
926
- type: "address"
927
- }
928
- ],
929
- stateMutability: "view",
930
- type: "function"
931
- },
932
- {
933
- inputs: [
934
- {
935
- internalType: "address",
936
- name: "_newAdmin",
937
- type: "address"
938
- }
939
- ],
940
- name: "proposeAdmin",
941
- outputs: [],
942
- stateMutability: "nonpayable",
943
- type: "function"
944
- },
945
- {
946
- inputs: [
947
- {
948
- internalType: "uint256",
949
- name: "taskId",
950
- type: "uint256"
951
- }
952
- ],
953
- name: "raiseDispute",
954
- outputs: [],
955
- stateMutability: "nonpayable",
956
- type: "function"
957
- },
958
- {
959
- inputs: [],
960
- name: "reputationContract",
961
- outputs: [
962
- {
963
- internalType: "contract IBlindReputation",
964
- name: "",
965
- type: "address"
966
- }
967
- ],
968
- stateMutability: "view",
969
- type: "function"
970
- },
971
- {
972
- inputs: [
973
- {
974
- internalType: "uint256",
975
- name: "taskId",
976
- type: "uint256"
977
- },
978
- {
979
- internalType: "bool",
980
- name: "workerFavored",
981
- type: "bool"
982
- }
983
- ],
984
- name: "resolveDispute",
985
- outputs: [],
986
- stateMutability: "nonpayable",
987
- type: "function"
988
- },
989
- {
990
- inputs: [
991
- {
992
- internalType: "uint256",
993
- name: "_feeBps",
994
- type: "uint256"
995
- }
996
- ],
997
- name: "setFeeBps",
998
- outputs: [],
999
- stateMutability: "nonpayable",
1000
- type: "function"
1001
- },
1002
- {
1003
- inputs: [
1004
- {
1005
- internalType: "address",
1006
- name: "_reputation",
1007
- type: "address"
1008
- }
1009
- ],
1010
- name: "setReputationContract",
1011
- outputs: [],
1012
- stateMutability: "nonpayable",
1013
- type: "function"
1014
- },
1015
- {
1016
- inputs: [
1017
- {
1018
- internalType: "address",
1019
- name: "_registry",
1020
- type: "address"
1021
- }
1022
- ],
1023
- name: "setTaskRegistry",
1024
- outputs: [],
1025
- stateMutability: "nonpayable",
1026
- type: "function"
1027
- },
1028
- {
1029
- inputs: [
1030
- {
1031
- internalType: "address",
1032
- name: "_treasury",
1033
- type: "address"
1034
- }
1035
- ],
1036
- name: "setTreasury",
1037
- outputs: [],
1038
- stateMutability: "nonpayable",
1039
- type: "function"
1040
- },
1041
- {
1042
- inputs: [
1043
- {
1044
- internalType: "address",
1045
- name: "_verifier",
1046
- type: "address"
1047
- }
1048
- ],
1049
- name: "setVerifier",
1050
- outputs: [],
1051
- stateMutability: "nonpayable",
1052
- type: "function"
1053
- },
1054
- {
1055
- inputs: [
1056
- {
1057
- internalType: "uint256",
1058
- name: "taskId",
1059
- type: "uint256"
1060
- },
1061
- {
1062
- internalType: "bytes32",
1063
- name: "evidenceHash",
1064
- type: "bytes32"
1065
- }
1066
- ],
1067
- name: "submitEvidence",
1068
- outputs: [],
1069
- stateMutability: "nonpayable",
1070
- type: "function"
1071
- },
1072
- {
1073
- inputs: [],
1074
- name: "taskRegistry",
1075
- outputs: [
1076
- {
1077
- internalType: "contract ITaskRegistry",
1078
- name: "",
1079
- type: "address"
1080
- }
1081
- ],
1082
- stateMutability: "view",
1083
- type: "function"
1084
- },
1085
- {
1086
- inputs: [],
1087
- name: "treasury",
1088
- outputs: [
1089
- {
1090
- internalType: "address",
1091
- name: "",
1092
- type: "address"
1093
- }
1094
- ],
1095
- stateMutability: "view",
1096
- type: "function"
1097
- },
1098
- {
1099
- inputs: [],
1100
- name: "unpause",
1101
- outputs: [],
1102
- stateMutability: "nonpayable",
1103
- type: "function"
1104
- },
1105
- {
1106
- inputs: [],
1107
- name: "verifier",
1108
- outputs: [
1109
- {
1110
- internalType: "address",
1111
- name: "",
1112
- type: "address"
1113
- }
1114
- ],
1115
- stateMutability: "view",
1116
- type: "function"
1117
- }
1118
- ];
1119
-
1120
- // src/chain/abi/BlindReputation.json
1121
- var BlindReputation_default = [
1122
- {
1123
- inputs: [],
1124
- stateMutability: "nonpayable",
1125
- type: "constructor"
1126
- },
1127
- {
1128
- inputs: [],
1129
- name: "AlreadyRated",
1130
- type: "error"
1131
- },
1132
- {
1133
- inputs: [],
1134
- name: "EnforcedPause",
1135
- type: "error"
1136
- },
1137
- {
1138
- inputs: [],
1139
- name: "ExpectedPause",
1140
- type: "error"
1141
- },
1142
- {
1143
- inputs: [],
1144
- name: "InvalidScore",
1145
- type: "error"
1146
- },
1147
- {
1148
- inputs: [],
1149
- name: "NotAdmin",
1150
- type: "error"
1151
- },
1152
- {
1153
- inputs: [],
1154
- name: "NotAuthorizedRater",
1155
- type: "error"
1156
- },
1157
- {
1158
- inputs: [],
1159
- name: "NotPendingAdmin",
1160
- type: "error"
1161
- },
1162
- {
1163
- inputs: [],
1164
- name: "ZeroAddress",
1165
- type: "error"
1166
- },
1167
- {
1168
- anonymous: false,
1169
- inputs: [
1170
- {
1171
- indexed: true,
1172
- internalType: "address",
1173
- name: "oldAdmin",
1174
- type: "address"
1175
- },
1176
- {
1177
- indexed: true,
1178
- internalType: "address",
1179
- name: "newAdmin",
1180
- type: "address"
1181
- }
1182
- ],
1183
- name: "AdminTransferCompleted",
1184
- type: "event"
1185
- },
1186
- {
1187
- anonymous: false,
1188
- inputs: [
1189
- {
1190
- indexed: true,
1191
- internalType: "address",
1192
- name: "currentAdmin",
1193
- type: "address"
1194
- },
1195
- {
1196
- indexed: true,
1197
- internalType: "address",
1198
- name: "pendingAdmin",
1199
- type: "address"
1200
- }
1201
- ],
1202
- name: "AdminTransferProposed",
1203
- type: "event"
1204
- },
1205
- {
1206
- anonymous: false,
1207
- inputs: [
1208
- {
1209
- indexed: true,
1210
- internalType: "address",
1211
- name: "worker",
1212
- type: "address"
1213
- },
1214
- {
1215
- indexed: true,
1216
- internalType: "uint256",
1217
- name: "taskId",
1218
- type: "uint256"
1219
- }
1220
- ],
1221
- name: "DisputeRecorded",
1222
- type: "event"
1223
- },
1224
- {
1225
- anonymous: false,
1226
- inputs: [
1227
- {
1228
- indexed: false,
1229
- internalType: "address",
1230
- name: "account",
1231
- type: "address"
1232
- }
1233
- ],
1234
- name: "Paused",
1235
- type: "event"
1236
- },
1237
- {
1238
- anonymous: false,
1239
- inputs: [
1240
- {
1241
- indexed: true,
1242
- internalType: "address",
1243
- name: "worker",
1244
- type: "address"
1245
- },
1246
- {
1247
- indexed: true,
1248
- internalType: "address",
1249
- name: "rater",
1250
- type: "address"
1251
- },
1252
- {
1253
- indexed: false,
1254
- internalType: "uint8",
1255
- name: "score",
1256
- type: "uint8"
1257
- },
1258
- {
1259
- indexed: true,
1260
- internalType: "uint256",
1261
- name: "taskId",
1262
- type: "uint256"
1263
- }
1264
- ],
1265
- name: "Rated",
1266
- type: "event"
1267
- },
1268
- {
1269
- anonymous: false,
1270
- inputs: [
1271
- {
1272
- indexed: true,
1273
- internalType: "address",
1274
- name: "rater",
1275
- type: "address"
1276
- }
1277
- ],
1278
- name: "RaterAuthorized",
1279
- type: "event"
1280
- },
1281
- {
1282
- anonymous: false,
1283
- inputs: [
1284
- {
1285
- indexed: true,
1286
- internalType: "address",
1287
- name: "rater",
1288
- type: "address"
1289
- }
1290
- ],
1291
- name: "RaterRevoked",
1292
- type: "event"
1293
- },
1294
- {
1295
- anonymous: false,
1296
- inputs: [
1297
- {
1298
- indexed: false,
1299
- internalType: "address",
1300
- name: "account",
1301
- type: "address"
1302
- }
1303
- ],
1304
- name: "Unpaused",
1305
- type: "event"
1306
- },
1307
- {
1308
- inputs: [],
1309
- name: "acceptAdmin",
1310
- outputs: [],
1311
- stateMutability: "nonpayable",
1312
- type: "function"
1313
- },
1314
- {
1315
- inputs: [],
1316
- name: "admin",
1317
- outputs: [
1318
- {
1319
- internalType: "address",
1320
- name: "",
1321
- type: "address"
1322
- }
1323
- ],
1324
- stateMutability: "view",
1325
- type: "function"
1326
- },
1327
- {
1328
- inputs: [
1329
- {
1330
- internalType: "address",
1331
- name: "rater",
1332
- type: "address"
1333
- }
1334
- ],
1335
- name: "authorizeRater",
1336
- outputs: [],
1337
- stateMutability: "nonpayable",
1338
- type: "function"
1339
- },
1340
- {
1341
- inputs: [
1342
- {
1343
- internalType: "address",
1344
- name: "",
1345
- type: "address"
1346
- }
1347
- ],
1348
- name: "authorizedRaters",
1349
- outputs: [
1350
- {
1351
- internalType: "bool",
1352
- name: "",
1353
- type: "bool"
1354
- }
1355
- ],
1356
- stateMutability: "view",
1357
- type: "function"
1358
- },
1359
- {
1360
- inputs: [
1361
- {
1362
- internalType: "address",
1363
- name: "worker",
1364
- type: "address"
1365
- }
1366
- ],
1367
- name: "getReputation",
1368
- outputs: [
1369
- {
1370
- internalType: "uint256",
1371
- name: "tasksCompleted",
1372
- type: "uint256"
1373
- },
1374
- {
1375
- internalType: "uint256",
1376
- name: "avgScore",
1377
- type: "uint256"
1378
- },
1379
- {
1380
- internalType: "uint256",
1381
- name: "disputes",
1382
- type: "uint256"
1383
- }
1384
- ],
1385
- stateMutability: "view",
1386
- type: "function"
1387
- },
1388
- {
1389
- inputs: [
1390
- {
1391
- internalType: "address",
1392
- name: "worker",
1393
- type: "address"
1394
- },
1395
- {
1396
- internalType: "uint256",
1397
- name: "taskId",
1398
- type: "uint256"
1399
- }
1400
- ],
1401
- name: "hasBeenRated",
1402
- outputs: [
1403
- {
1404
- internalType: "bool",
1405
- name: "",
1406
- type: "bool"
1407
- }
1408
- ],
1409
- stateMutability: "view",
1410
- type: "function"
1411
- },
1412
- {
1413
- inputs: [],
1414
- name: "pause",
1415
- outputs: [],
1416
- stateMutability: "nonpayable",
1417
- type: "function"
1418
- },
1419
- {
1420
- inputs: [],
1421
- name: "paused",
1422
- outputs: [
1423
- {
1424
- internalType: "bool",
1425
- name: "",
1426
- type: "bool"
1427
- }
1428
- ],
1429
- stateMutability: "view",
1430
- type: "function"
1431
- },
1432
- {
1433
- inputs: [],
1434
- name: "pendingAdmin",
1435
- outputs: [
1436
- {
1437
- internalType: "address",
1438
- name: "",
1439
- type: "address"
1440
- }
1441
- ],
1442
- stateMutability: "view",
1443
- type: "function"
1444
- },
1445
- {
1446
- inputs: [
1447
- {
1448
- internalType: "address",
1449
- name: "_newAdmin",
1450
- type: "address"
1451
- }
1452
- ],
1453
- name: "proposeAdmin",
1454
- outputs: [],
1455
- stateMutability: "nonpayable",
1456
- type: "function"
1457
- },
1458
- {
1459
- inputs: [
1460
- {
1461
- internalType: "address",
1462
- name: "worker",
1463
- type: "address"
1464
- },
1465
- {
1466
- internalType: "uint8",
1467
- name: "score",
1468
- type: "uint8"
1469
- },
1470
- {
1471
- internalType: "uint256",
1472
- name: "taskId",
1473
- type: "uint256"
1474
- }
1475
- ],
1476
- name: "rate",
1477
- outputs: [],
1478
- stateMutability: "nonpayable",
1479
- type: "function"
1480
- },
1481
- {
1482
- inputs: [
1483
- {
1484
- internalType: "bytes32",
1485
- name: "",
1486
- type: "bytes32"
1487
- }
1488
- ],
1489
- name: "ratedTasks",
1490
- outputs: [
1491
- {
1492
- internalType: "bool",
1493
- name: "",
1494
- type: "bool"
1495
- }
1496
- ],
1497
- stateMutability: "view",
1498
- type: "function"
1499
- },
1500
- {
1501
- inputs: [
1502
- {
1503
- internalType: "address",
1504
- name: "worker",
1505
- type: "address"
1506
- },
1507
- {
1508
- internalType: "uint256",
1509
- name: "taskId",
1510
- type: "uint256"
1511
- }
1512
- ],
1513
- name: "recordDispute",
1514
- outputs: [],
1515
- stateMutability: "nonpayable",
1516
- type: "function"
1517
- },
1518
- {
1519
- inputs: [
1520
- {
1521
- internalType: "address",
1522
- name: "",
1523
- type: "address"
1524
- }
1525
- ],
1526
- name: "reputations",
1527
- outputs: [
1528
- {
1529
- internalType: "uint256",
1530
- name: "tasksCompleted",
1531
- type: "uint256"
1532
- },
1533
- {
1534
- internalType: "uint256",
1535
- name: "totalScore",
1536
- type: "uint256"
1537
- },
1538
- {
1539
- internalType: "uint256",
1540
- name: "disputes",
1541
- type: "uint256"
1542
- }
1543
- ],
1544
- stateMutability: "view",
1545
- type: "function"
1546
- },
1547
- {
1548
- inputs: [
1549
- {
1550
- internalType: "address",
1551
- name: "rater",
1552
- type: "address"
1553
- }
1554
- ],
1555
- name: "revokeRater",
1556
- outputs: [],
1557
- stateMutability: "nonpayable",
1558
- type: "function"
1559
- },
1560
- {
1561
- inputs: [],
1562
- name: "unpause",
1563
- outputs: [],
1564
- stateMutability: "nonpayable",
1565
- type: "function"
1566
- }
1567
- ];
1568
-
1569
- // src/chain/abi/TaskRegistry.json
1570
- var TaskRegistry_default = [
1571
- {
1572
- inputs: [],
1573
- stateMutability: "nonpayable",
1574
- type: "constructor"
1575
- },
1576
- {
1577
- inputs: [],
1578
- name: "EnforcedPause",
1579
- type: "error"
1580
- },
1581
- {
1582
- inputs: [],
1583
- name: "ExpectedPause",
1584
- type: "error"
1585
- },
1586
- {
1587
- inputs: [],
1588
- name: "NotAdmin",
1589
- type: "error"
1590
- },
1591
- {
1592
- inputs: [],
1593
- name: "NotAuthorized",
1594
- type: "error"
1595
- },
1596
- {
1597
- inputs: [],
1598
- name: "NotPendingAdmin",
1599
- type: "error"
1600
- },
1601
- {
1602
- inputs: [],
1603
- name: "TaskAlreadyClosed",
1604
- type: "error"
1605
- },
1606
- {
1607
- inputs: [],
1608
- name: "TaskAlreadyExists",
1609
- type: "error"
1610
- },
1611
- {
1612
- inputs: [],
1613
- name: "TaskNotFound",
1614
- type: "error"
1615
- },
1616
- {
1617
- inputs: [],
1618
- name: "ZeroAddress",
1619
- type: "error"
1620
- },
1621
- {
1622
- anonymous: false,
1623
- inputs: [
1624
- {
1625
- indexed: true,
1626
- internalType: "address",
1627
- name: "oldAdmin",
1628
- type: "address"
1629
- },
1630
- {
1631
- indexed: true,
1632
- internalType: "address",
1633
- name: "newAdmin",
1634
- type: "address"
1635
- }
1636
- ],
1637
- name: "AdminTransferCompleted",
1638
- type: "event"
1639
- },
1640
- {
1641
- anonymous: false,
1642
- inputs: [
1643
- {
1644
- indexed: true,
1645
- internalType: "address",
1646
- name: "currentAdmin",
1647
- type: "address"
1648
- },
1649
- {
1650
- indexed: true,
1651
- internalType: "address",
1652
- name: "pendingAdmin",
1653
- type: "address"
1654
- }
1655
- ],
1656
- name: "AdminTransferProposed",
1657
- type: "event"
1658
- },
1659
- {
1660
- anonymous: false,
1661
- inputs: [
1662
- {
1663
- indexed: false,
1664
- internalType: "address",
1665
- name: "account",
1666
- type: "address"
1667
- }
1668
- ],
1669
- name: "Paused",
1670
- type: "event"
1671
- },
1672
- {
1673
- anonymous: false,
1674
- inputs: [
1675
- {
1676
- indexed: true,
1677
- internalType: "address",
1678
- name: "publisher",
1679
- type: "address"
1680
- }
1681
- ],
1682
- name: "PublisherAuthorized",
1683
- type: "event"
1684
- },
1685
- {
1686
- anonymous: false,
1687
- inputs: [
1688
- {
1689
- indexed: true,
1690
- internalType: "address",
1691
- name: "publisher",
1692
- type: "address"
1693
- }
1694
- ],
1695
- name: "PublisherRevoked",
1696
- type: "event"
1697
- },
1698
- {
1699
- anonymous: false,
1700
- inputs: [
1701
- {
1702
- indexed: true,
1703
- internalType: "uint256",
1704
- name: "taskId",
1705
- type: "uint256"
1706
- }
1707
- ],
1708
- name: "TaskClosed",
1709
- type: "event"
1710
- },
1711
- {
1712
- anonymous: false,
1713
- inputs: [
1714
- {
1715
- indexed: true,
1716
- internalType: "uint256",
1717
- name: "taskId",
1718
- type: "uint256"
1719
- },
1720
- {
1721
- indexed: true,
1722
- internalType: "address",
1723
- name: "agent",
1724
- type: "address"
1725
- },
1726
- {
1727
- indexed: false,
1728
- internalType: "string",
1729
- name: "category",
1730
- type: "string"
1731
- },
1732
- {
1733
- indexed: false,
1734
- internalType: "string",
1735
- name: "locationZone",
1736
- type: "string"
1737
- },
1738
- {
1739
- indexed: false,
1740
- internalType: "uint256",
1741
- name: "reward",
1742
- type: "uint256"
1743
- }
1744
- ],
1745
- name: "TaskPublished",
1746
- type: "event"
1747
- },
1748
- {
1749
- anonymous: false,
1750
- inputs: [
1751
- {
1752
- indexed: false,
1753
- internalType: "address",
1754
- name: "account",
1755
- type: "address"
1756
- }
1757
- ],
1758
- name: "Unpaused",
1759
- type: "event"
1760
- },
1761
- {
1762
- inputs: [],
1763
- name: "acceptAdmin",
1764
- outputs: [],
1765
- stateMutability: "nonpayable",
1766
- type: "function"
1767
- },
1768
- {
1769
- inputs: [],
1770
- name: "admin",
1771
- outputs: [
1772
- {
1773
- internalType: "address",
1774
- name: "",
1775
- type: "address"
1776
- }
1777
- ],
1778
- stateMutability: "view",
1779
- type: "function"
1780
- },
1781
- {
1782
- inputs: [
1783
- {
1784
- internalType: "address",
1785
- name: "publisher",
1786
- type: "address"
1787
- }
1788
- ],
1789
- name: "authorizePublisher",
1790
- outputs: [],
1791
- stateMutability: "nonpayable",
1792
- type: "function"
1793
- },
1794
- {
1795
- inputs: [
1796
- {
1797
- internalType: "address",
1798
- name: "",
1799
- type: "address"
1800
- }
1801
- ],
1802
- name: "authorizedPublishers",
1803
- outputs: [
1804
- {
1805
- internalType: "bool",
1806
- name: "",
1807
- type: "bool"
1808
- }
1809
- ],
1810
- stateMutability: "view",
1811
- type: "function"
1812
- },
1813
- {
1814
- inputs: [
1815
- {
1816
- internalType: "uint256",
1817
- name: "taskId",
1818
- type: "uint256"
1819
- }
1820
- ],
1821
- name: "closeTask",
1822
- outputs: [],
1823
- stateMutability: "nonpayable",
1824
- type: "function"
1825
- },
1826
- {
1827
- inputs: [
1828
- {
1829
- internalType: "uint256",
1830
- name: "offset",
1831
- type: "uint256"
1832
- },
1833
- {
1834
- internalType: "uint256",
1835
- name: "limit",
1836
- type: "uint256"
1837
- }
1838
- ],
1839
- name: "getOpenTasks",
1840
- outputs: [
1841
- {
1842
- components: [
1843
- {
1844
- internalType: "uint256",
1845
- name: "taskId",
1846
- type: "uint256"
1847
- },
1848
- {
1849
- internalType: "address",
1850
- name: "agent",
1851
- type: "address"
1852
- },
1853
- {
1854
- internalType: "string",
1855
- name: "category",
1856
- type: "string"
1857
- },
1858
- {
1859
- internalType: "string",
1860
- name: "locationZone",
1861
- type: "string"
1862
- },
1863
- {
1864
- internalType: "uint256",
1865
- name: "reward",
1866
- type: "uint256"
1867
- },
1868
- {
1869
- internalType: "uint256",
1870
- name: "createdAt",
1871
- type: "uint256"
1872
- },
1873
- {
1874
- internalType: "bool",
1875
- name: "isOpen",
1876
- type: "bool"
1877
- }
1878
- ],
1879
- internalType: "struct TaskRegistry.TaskMeta[]",
1880
- name: "",
1881
- type: "tuple[]"
1882
- }
1883
- ],
1884
- stateMutability: "view",
1885
- type: "function"
1886
- },
1887
- {
1888
- inputs: [
1889
- {
1890
- internalType: "uint256",
1891
- name: "taskId",
1892
- type: "uint256"
1893
- }
1894
- ],
1895
- name: "getTaskMeta",
1896
- outputs: [
1897
- {
1898
- components: [
1899
- {
1900
- internalType: "uint256",
1901
- name: "taskId",
1902
- type: "uint256"
1903
- },
1904
- {
1905
- internalType: "address",
1906
- name: "agent",
1907
- type: "address"
1908
- },
1909
- {
1910
- internalType: "string",
1911
- name: "category",
1912
- type: "string"
1913
- },
1914
- {
1915
- internalType: "string",
1916
- name: "locationZone",
1917
- type: "string"
1918
- },
1919
- {
1920
- internalType: "uint256",
1921
- name: "reward",
1922
- type: "uint256"
1923
- },
1924
- {
1925
- internalType: "uint256",
1926
- name: "createdAt",
1927
- type: "uint256"
1928
- },
1929
- {
1930
- internalType: "bool",
1931
- name: "isOpen",
1932
- type: "bool"
1933
- }
1934
- ],
1935
- internalType: "struct TaskRegistry.TaskMeta",
1936
- name: "",
1937
- type: "tuple"
1938
- }
1939
- ],
1940
- stateMutability: "view",
1941
- type: "function"
1942
- },
1943
- {
1944
- inputs: [],
1945
- name: "openTaskCount",
1946
- outputs: [
1947
- {
1948
- internalType: "uint256",
1949
- name: "",
1950
- type: "uint256"
1951
- }
1952
- ],
1953
- stateMutability: "view",
1954
- type: "function"
1955
- },
1956
- {
1957
- inputs: [],
1958
- name: "pause",
1959
- outputs: [],
1960
- stateMutability: "nonpayable",
1961
- type: "function"
1962
- },
1963
- {
1964
- inputs: [],
1965
- name: "paused",
1966
- outputs: [
1967
- {
1968
- internalType: "bool",
1969
- name: "",
1970
- type: "bool"
1971
- }
1972
- ],
1973
- stateMutability: "view",
1974
- type: "function"
1975
- },
1976
- {
1977
- inputs: [],
1978
- name: "pendingAdmin",
1979
- outputs: [
1980
- {
1981
- internalType: "address",
1982
- name: "",
1983
- type: "address"
1984
- }
1985
- ],
1986
- stateMutability: "view",
1987
- type: "function"
1988
- },
1989
- {
1990
- inputs: [
1991
- {
1992
- internalType: "address",
1993
- name: "_newAdmin",
1994
- type: "address"
1995
- }
1996
- ],
1997
- name: "proposeAdmin",
1998
- outputs: [],
1999
- stateMutability: "nonpayable",
2000
- type: "function"
2001
- },
2002
- {
2003
- inputs: [
2004
- {
2005
- internalType: "uint256",
2006
- name: "taskId",
2007
- type: "uint256"
2008
- },
2009
- {
2010
- internalType: "address",
2011
- name: "agent",
2012
- type: "address"
2013
- },
2014
- {
2015
- internalType: "string",
2016
- name: "category",
2017
- type: "string"
2018
- },
2019
- {
2020
- internalType: "string",
2021
- name: "locationZone",
2022
- type: "string"
2023
- },
2024
- {
2025
- internalType: "uint256",
2026
- name: "reward",
2027
- type: "uint256"
2028
- }
2029
- ],
2030
- name: "publishTask",
2031
- outputs: [],
2032
- stateMutability: "nonpayable",
2033
- type: "function"
2034
- },
2035
- {
2036
- inputs: [
2037
- {
2038
- internalType: "address",
2039
- name: "publisher",
2040
- type: "address"
2041
- }
2042
- ],
2043
- name: "revokePublisher",
2044
- outputs: [],
2045
- stateMutability: "nonpayable",
2046
- type: "function"
2047
- },
2048
- {
2049
- inputs: [
2050
- {
2051
- internalType: "uint256",
2052
- name: "",
2053
- type: "uint256"
2054
- }
2055
- ],
2056
- name: "taskExists",
2057
- outputs: [
2058
- {
2059
- internalType: "bool",
2060
- name: "",
2061
- type: "bool"
2062
- }
2063
- ],
2064
- stateMutability: "view",
2065
- type: "function"
2066
- },
2067
- {
2068
- inputs: [
2069
- {
2070
- internalType: "uint256",
2071
- name: "",
2072
- type: "uint256"
2073
- }
2074
- ],
2075
- name: "taskIdToIndex",
2076
- outputs: [
2077
- {
2078
- internalType: "uint256",
2079
- name: "",
2080
- type: "uint256"
2081
- }
2082
- ],
2083
- stateMutability: "view",
2084
- type: "function"
2085
- },
2086
- {
2087
- inputs: [
2088
- {
2089
- internalType: "uint256",
2090
- name: "",
2091
- type: "uint256"
2092
- }
2093
- ],
2094
- name: "taskList",
2095
- outputs: [
2096
- {
2097
- internalType: "uint256",
2098
- name: "taskId",
2099
- type: "uint256"
2100
- },
2101
- {
2102
- internalType: "address",
2103
- name: "agent",
2104
- type: "address"
2105
- },
2106
- {
2107
- internalType: "string",
2108
- name: "category",
2109
- type: "string"
2110
- },
2111
- {
2112
- internalType: "string",
2113
- name: "locationZone",
2114
- type: "string"
2115
- },
2116
- {
2117
- internalType: "uint256",
2118
- name: "reward",
2119
- type: "uint256"
2120
- },
2121
- {
2122
- internalType: "uint256",
2123
- name: "createdAt",
2124
- type: "uint256"
2125
- },
2126
- {
2127
- internalType: "bool",
2128
- name: "isOpen",
2129
- type: "bool"
2130
- }
2131
- ],
2132
- stateMutability: "view",
2133
- type: "function"
2134
- },
2135
- {
2136
- inputs: [],
2137
- name: "totalTasks",
2138
- outputs: [
2139
- {
2140
- internalType: "uint256",
2141
- name: "",
2142
- type: "uint256"
2143
- }
2144
- ],
2145
- stateMutability: "view",
2146
- type: "function"
2147
- },
2148
- {
2149
- inputs: [],
2150
- name: "unpause",
2151
- outputs: [],
2152
- stateMutability: "nonpayable",
2153
- type: "function"
2154
- }
2155
- ];
2156
-
2157
- // src/errors/BlindBountyError.ts
2158
- var BlindBountyError = class extends Error {
2159
- code;
2160
- retriable;
2161
- context;
2162
- cause;
2163
- constructor(code, message, opts = {}) {
2164
- super(message);
2165
- this.code = code;
2166
- this.retriable = opts.retriable ?? false;
2167
- if (opts.context !== void 0) this.context = opts.context;
2168
- if (opts.cause !== void 0) this.cause = opts.cause;
2169
- Object.defineProperty(this, "name", {
2170
- value: this.constructor.name,
2171
- enumerable: false,
2172
- configurable: true,
2173
- writable: true
2174
- });
2175
- }
2176
- toJSON() {
2177
- return {
2178
- name: this.name,
2179
- code: this.code,
2180
- message: this.message,
2181
- retriable: this.retriable,
2182
- ...this.context ? { context: this.context } : {}
2183
- };
2184
- }
2185
- };
2186
-
2187
- // src/errors/subclasses.ts
2188
- var ChainError = class extends BlindBountyError {
2189
- constructor(code, msg, opts) {
2190
- super(code, msg, opts);
2191
- }
2192
- };
2193
-
2194
- // src/chain/errors.ts
2195
- function wrapChainError(err, hint) {
2196
- const e = err ?? {};
2197
- const msg = e.shortMessage ?? e.reason ?? e.message ?? "unknown chain error";
2198
- const withHint = hint ? `${hint}: ${msg}` : msg;
2199
- switch (e.code) {
2200
- case "INSUFFICIENT_FUNDS":
2201
- return new ChainError("CHAIN/INSUFFICIENT_BALANCE", withHint, { cause: err, retriable: false });
2202
- case "NONCE_EXPIRED":
2203
- case "REPLACEMENT_UNDERPRICED":
2204
- return new ChainError("CHAIN/NONCE_CONFLICT", withHint, { cause: err, retriable: true });
2205
- case "NETWORK_ERROR":
2206
- case "SERVER_ERROR":
2207
- case "TIMEOUT":
2208
- return new ChainError("CHAIN/TX_TIMED_OUT", withHint, { cause: err, retriable: true });
2209
- case "UNSUPPORTED_OPERATION":
2210
- case "UNKNOWN_ERROR":
2211
- case "CALL_EXCEPTION":
2212
- return new ChainError("CHAIN/TX_REVERTED", withHint, {
2213
- cause: err,
2214
- ...e.data !== void 0 ? { context: { data: e.data } } : {}
2215
- });
2216
- default:
2217
- return new ChainError("CHAIN/TX_REVERTED", withHint, { cause: err });
2218
- }
2219
- }
2220
- var STATUS_BY_INDEX = ["funded", "assigned", "submitted", "verified", "completed", "cancelled"];
2221
- var BlindEscrowClient = class {
2222
- contract;
2223
- address;
2224
- constructor(address, runner) {
2225
- this.address = address;
2226
- this.contract = new ethers.ethers.Contract(address, BlindEscrow_default, runner);
2227
- }
2228
- /** Create a task and return its id + receipt. Reads the TaskCreated event for the id. */
2229
- async createTask(args) {
2230
- try {
2231
- const tx = await this.contract.createTask(
2232
- args.taskHash,
2233
- args.token,
2234
- args.amount,
2235
- args.category,
2236
- args.locationZone,
2237
- args.deadline
2238
- );
2239
- const rec = await tx.wait(1);
2240
- const taskId = this.extractTaskIdFromReceipt(rec);
2241
- return { taskId, receipt: toReceipt(rec) };
2242
- } catch (err) {
2243
- throw wrapChainError(err, "createTask");
2244
- }
2245
- }
2246
- async assignWorker(taskId, worker) {
2247
- return this.sendTx("assignWorker", [taskId, worker]);
2248
- }
2249
- async submitEvidence(taskId, evidenceHash) {
2250
- return this.sendTx("submitEvidence", [taskId, evidenceHash]);
2251
- }
2252
- async completeVerification(taskId, passed) {
2253
- return this.sendTx("completeVerification", [taskId, passed]);
2254
- }
2255
- async cancelTask(taskId) {
2256
- return this.sendTx("cancelTask", [taskId]);
2257
- }
2258
- async raiseDispute(taskId) {
2259
- return this.sendTx("raiseDispute", [taskId]);
2260
- }
2261
- async resolveDispute(taskId, workerFavored) {
2262
- return this.sendTx("resolveDispute", [taskId, workerFavored]);
2263
- }
2264
- async claimTimeout(taskId) {
2265
- return this.sendTx("claimTimeout", [taskId]);
2266
- }
2267
- async getTask(taskId) {
2268
- try {
2269
- const raw = await this.contract.getTask(taskId);
2270
- return decodeTask(taskId, raw);
2271
- } catch (err) {
2272
- throw wrapChainError(err, "getTask");
2273
- }
2274
- }
2275
- async isTaskExpired(taskId) {
2276
- try {
2277
- return Boolean(await this.contract.isTaskExpired(taskId));
2278
- } catch (err) {
2279
- throw wrapChainError(err, "isTaskExpired");
2280
- }
2281
- }
2282
- async nextTaskId() {
2283
- try {
2284
- return BigInt(await this.contract.nextTaskId());
2285
- } catch (err) {
2286
- throw wrapChainError(err, "nextTaskId");
2287
- }
2288
- }
2289
- async feeBps() {
2290
- try {
2291
- return BigInt(await this.contract.feeBps());
2292
- } catch (err) {
2293
- throw wrapChainError(err, "feeBps");
2294
- }
2295
- }
2296
- async sendTx(method, args) {
2297
- try {
2298
- const fn = this.contract[method];
2299
- if (typeof fn !== "function") {
2300
- throw new Error(`unknown contract method: ${method}`);
2301
- }
2302
- const tx = await fn(...args);
2303
- const rec = await tx.wait(1);
2304
- return toReceipt(rec);
2305
- } catch (err) {
2306
- throw wrapChainError(err, method);
2307
- }
2308
- }
2309
- extractTaskIdFromReceipt(receipt) {
2310
- if (!receipt) throw new Error("no receipt");
2311
- const iface = this.contract.interface;
2312
- for (const log of receipt.logs) {
2313
- try {
2314
- const parsed = iface.parseLog({ topics: log.topics, data: log.data });
2315
- if (parsed?.name === "TaskCreated") {
2316
- return BigInt(parsed.args.getValue("taskId"));
2317
- }
2318
- } catch {
2319
- }
2320
- }
2321
- throw new Error("TaskCreated event not found in receipt logs");
2322
- }
2323
- };
2324
- function toReceipt(rec) {
2325
- if (!rec) throw new Error("no receipt");
2326
- return {
2327
- hash: rec.hash,
2328
- blockNumber: rec.blockNumber,
2329
- gasUsed: rec.gasUsed
2330
- };
2331
- }
2332
- function decodeTask(taskId, raw) {
2333
- const arr = raw;
2334
- const statusIndex = Number(arr[6]);
2335
- return {
2336
- taskId,
2337
- agent: arr[0],
2338
- worker: arr[1],
2339
- token: arr[2],
2340
- amount: BigInt(arr[3]),
2341
- taskHash: arr[4],
2342
- evidenceHash: arr[5],
2343
- status: STATUS_BY_INDEX[statusIndex] ?? "funded",
2344
- createdAt: new Date(Number(arr[7]) * 1e3),
2345
- deadline: new Date(Number(arr[8]) * 1e3)
2346
- };
2347
- }
2348
- var TaskRegistryClient = class {
2349
- contract;
2350
- address;
2351
- constructor(address, runner) {
2352
- this.address = address;
2353
- this.contract = new ethers.ethers.Contract(address, TaskRegistry_default, runner);
2354
- }
2355
- async getTaskMeta(taskId) {
2356
- try {
2357
- const raw = await this.contract.getTaskMeta(taskId);
2358
- return {
2359
- taskId,
2360
- token: raw[0],
2361
- category: raw[1],
2362
- locationZone: raw[2],
2363
- reward: BigInt(raw[3]),
2364
- createdAt: new Date(Number(raw[4]) * 1e3)
2365
- };
2366
- } catch (err) {
2367
- throw wrapChainError(err, "getTaskMeta");
2368
- }
2369
- }
2370
- async getOpenTasks(offset, limit) {
2371
- try {
2372
- const ids = await this.contract.getOpenTasks(offset, limit);
2373
- return ids.map((x) => BigInt(x));
2374
- } catch (err) {
2375
- throw wrapChainError(err, "getOpenTasks");
2376
- }
2377
- }
2378
- async totalTasks() {
2379
- try {
2380
- return BigInt(await this.contract.totalTasks());
2381
- } catch (err) {
2382
- throw wrapChainError(err, "totalTasks");
2383
- }
2384
- }
2385
- async openTaskCount() {
2386
- try {
2387
- return BigInt(await this.contract.openTaskCount());
2388
- } catch (err) {
2389
- throw wrapChainError(err, "openTaskCount");
2390
- }
2391
- }
2392
- async taskExists(taskId) {
2393
- try {
2394
- return Boolean(await this.contract.taskExists(taskId));
2395
- } catch (err) {
2396
- throw wrapChainError(err, "taskExists");
2397
- }
2398
- }
2399
- async closeTask(taskId) {
2400
- try {
2401
- const tx = await this.contract.closeTask(taskId);
2402
- const rec = await tx.wait(1);
2403
- return { hash: rec.hash, blockNumber: rec.blockNumber, gasUsed: rec.gasUsed };
2404
- } catch (err) {
2405
- throw wrapChainError(err, "closeTask");
2406
- }
2407
- }
2408
- };
2409
- var BlindReputationClient = class {
2410
- contract;
2411
- address;
2412
- constructor(address, runner) {
2413
- this.address = address;
2414
- this.contract = new ethers.ethers.Contract(address, BlindReputation_default, runner);
2415
- }
2416
- async getReputation(worker) {
2417
- try {
2418
- const raw = await this.contract.getReputation(worker);
2419
- const tasksCompleted = BigInt(raw[0]);
2420
- const totalScore = BigInt(raw[1]);
2421
- const disputes = BigInt(raw[2]);
2422
- const avgScore = tasksCompleted === 0n ? 0 : Number(totalScore) / Number(tasksCompleted);
2423
- return { tasksCompleted, totalScore, disputes, avgScore };
2424
- } catch (err) {
2425
- throw wrapChainError(err, "getReputation");
2426
- }
2427
- }
2428
- async rate(worker, score, taskId) {
2429
- if (!Number.isInteger(score) || score < 1 || score > 5) {
2430
- throw wrapChainError(new Error(`score must be integer 1..5, got ${score}`), "rate");
2431
- }
2432
- try {
2433
- const tx = await this.contract.rate(worker, score, taskId);
2434
- const rec = await tx.wait(1);
2435
- return { hash: rec.hash, blockNumber: rec.blockNumber, gasUsed: rec.gasUsed };
2436
- } catch (err) {
2437
- throw wrapChainError(err, "rate");
2438
- }
2439
- }
2440
- async hasBeenRated(worker, taskId) {
2441
- try {
2442
- return Boolean(await this.contract.hasBeenRated(worker, taskId));
2443
- } catch (err) {
2444
- throw wrapChainError(err, "hasBeenRated");
2445
- }
2446
- }
2447
- };
2448
- var ChainClient = class {
2449
- escrow;
2450
- registry;
2451
- reputation;
2452
- provider;
2453
- network;
2454
- constructor(opts) {
2455
- this.network = opts.network;
2456
- const provider = opts.provider ?? (opts.signer && unwrapEthersSigner(opts.signer)?.provider) ?? defaultProvider(opts.network);
2457
- this.provider = provider;
2458
- const runner = unwrapEthersSigner(opts.signer) ?? provider;
2459
- this.escrow = new BlindEscrowClient(opts.network.contracts.escrow, runner);
2460
- this.registry = new TaskRegistryClient(opts.network.contracts.registry, runner);
2461
- this.reputation = new BlindReputationClient(opts.network.contracts.reputation, runner);
2462
- }
2463
- };
2464
- function unwrapEthersSigner(signer) {
2465
- if (!signer) return void 0;
2466
- const maybe = signer;
2467
- return maybe.inner;
2468
- }
2469
- function defaultProvider(network) {
2470
- const url = network.rpc[0];
2471
- if (!url) throw new Error(`network ${network.name} has no RPC endpoint configured`);
2472
- return new ethers.ethers.JsonRpcProvider(url, { chainId: Number(network.chainId), name: network.name });
2473
- }
2474
-
2475
- exports.BlindEscrowAbi = BlindEscrow_default;
2476
- exports.BlindEscrowClient = BlindEscrowClient;
2477
- exports.BlindReputationAbi = BlindReputation_default;
2478
- exports.BlindReputationClient = BlindReputationClient;
2479
- exports.ChainClient = ChainClient;
2480
- exports.TaskRegistryAbi = TaskRegistry_default;
2481
- exports.TaskRegistryClient = TaskRegistryClient;
2482
- exports.wrapChainError = wrapChainError;
2483
- //# sourceMappingURL=index.cjs.map
2484
- //# sourceMappingURL=index.cjs.map