@varun-ai07/covenant-mcp 2.0.2 → 2.0.3

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 (88) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/config.d.ts +55 -55
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +1 -1
  6. package/dist/config.js.map +1 -1
  7. package/dist/sdk/chunk-3R2WXEXL.mjs +828 -0
  8. package/dist/sdk/chunk-6ORMNSPN.mjs +842 -0
  9. package/dist/sdk/chunk-FH2MCRWQ.mjs +8732 -0
  10. package/dist/sdk/chunk-Y3YIH5K3.mjs +816 -0
  11. package/dist/sdk/config.d.ts +121 -0
  12. package/dist/sdk/config.d.ts.map +1 -0
  13. package/dist/sdk/config.js +196 -0
  14. package/dist/sdk/config.js.map +1 -0
  15. package/dist/sdk/contracts/AgentCollective.json +467 -0
  16. package/dist/sdk/contracts/AgentRegistry.d.ts +144 -0
  17. package/dist/sdk/contracts/AgentRegistry.d.ts.map +1 -0
  18. package/dist/sdk/contracts/AgentRegistry.js +92 -0
  19. package/dist/sdk/contracts/AgentRegistry.js.map +1 -0
  20. package/dist/sdk/contracts/COVENANTRouter.json +206 -0
  21. package/dist/sdk/contracts/CovenantArbitration.json +546 -0
  22. package/dist/sdk/contracts/CovenantAttestation.json +476 -0
  23. package/dist/sdk/contracts/CovenantEscrow.d.ts +70 -0
  24. package/dist/sdk/contracts/CovenantEscrow.d.ts.map +1 -0
  25. package/dist/sdk/contracts/CovenantEscrow.js +3 -0
  26. package/dist/sdk/contracts/CovenantEscrow.js.map +1 -0
  27. package/dist/sdk/contracts/CovenantEscrow.json +783 -0
  28. package/dist/sdk/contracts/CovenantGovernance.json +729 -0
  29. package/dist/sdk/contracts/CovenantIdentity.d.ts +70 -0
  30. package/dist/sdk/contracts/CovenantIdentity.d.ts.map +1 -0
  31. package/dist/sdk/contracts/CovenantIdentity.js +3 -0
  32. package/dist/sdk/contracts/CovenantIdentity.js.map +1 -0
  33. package/dist/sdk/contracts/CovenantIdentity.json +800 -0
  34. package/dist/sdk/contracts/CovenantSettlement.json +609 -0
  35. package/dist/sdk/contracts/DisputeResolution.d.ts +122 -0
  36. package/dist/sdk/contracts/DisputeResolution.d.ts.map +1 -0
  37. package/dist/sdk/contracts/DisputeResolution.js +86 -0
  38. package/dist/sdk/contracts/DisputeResolution.js.map +1 -0
  39. package/dist/sdk/contracts/GrantProgram.json +373 -0
  40. package/dist/sdk/contracts/InsurancePool.d.ts +209 -0
  41. package/dist/sdk/contracts/InsurancePool.d.ts.map +1 -0
  42. package/dist/sdk/contracts/InsurancePool.js +153 -0
  43. package/dist/sdk/contracts/InsurancePool.js.map +1 -0
  44. package/dist/sdk/contracts/InsurancePool.json +456 -0
  45. package/dist/sdk/contracts/MultiTokenEscrow.json +435 -0
  46. package/dist/sdk/contracts/OpenTaskMarket.d.ts +190 -0
  47. package/dist/sdk/contracts/OpenTaskMarket.d.ts.map +1 -0
  48. package/dist/sdk/contracts/OpenTaskMarket.js +117 -0
  49. package/dist/sdk/contracts/OpenTaskMarket.js.map +1 -0
  50. package/dist/sdk/contracts/ParallelTaskBatch.json +511 -0
  51. package/dist/sdk/contracts/ReceiptVerifierV2.d.ts +168 -0
  52. package/dist/sdk/contracts/ReceiptVerifierV2.d.ts.map +1 -0
  53. package/dist/sdk/contracts/ReceiptVerifierV2.js +109 -0
  54. package/dist/sdk/contracts/ReceiptVerifierV2.js.map +1 -0
  55. package/dist/sdk/contracts/RevisionManager.json +489 -0
  56. package/dist/sdk/contracts/TaskEscrow.d.ts +222 -0
  57. package/dist/sdk/contracts/TaskEscrow.d.ts.map +1 -0
  58. package/dist/sdk/contracts/TaskEscrow.js +144 -0
  59. package/dist/sdk/contracts/TaskEscrow.js.map +1 -0
  60. package/dist/sdk/contracts/TrainingMarketplace.json +357 -0
  61. package/dist/sdk/index.d.mts +385 -0
  62. package/dist/sdk/index.d.ts +35 -0
  63. package/dist/sdk/index.d.ts.map +1 -0
  64. package/dist/sdk/index.js +284 -0
  65. package/dist/sdk/index.js.map +1 -0
  66. package/dist/sdk/index.mjs +32 -0
  67. package/dist/sdk/types.d.ts +110 -0
  68. package/dist/sdk/types.d.ts.map +1 -0
  69. package/dist/sdk/types.js +17 -0
  70. package/dist/sdk/types.js.map +1 -0
  71. package/dist/sdk/v2.d.mts +100 -0
  72. package/dist/sdk/v2.d.ts +100 -0
  73. package/dist/sdk/v2.d.ts.map +1 -0
  74. package/dist/sdk/v2.js +2615 -0
  75. package/dist/sdk/v2.js.map +1 -0
  76. package/dist/sdk/v2.mjs +571 -0
  77. package/dist/sdk/v5-extensions.d.ts +133 -0
  78. package/dist/sdk/v5-extensions.d.ts.map +1 -0
  79. package/dist/sdk/v5-extensions.js +993 -0
  80. package/dist/sdk/v5-extensions.js.map +1 -0
  81. package/dist/sdk.d.ts +30 -0
  82. package/dist/sdk.d.ts.map +1 -0
  83. package/dist/sdk.js +180 -0
  84. package/dist/sdk.js.map +1 -0
  85. package/dist/server.js +1 -1
  86. package/dist/shared-types.d.ts +101 -1
  87. package/dist/shared-types.d.ts.map +1 -1
  88. package/package.json +3 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2.js","sourceRoot":"","sources":["../src/v2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAA2B,MAAM,MAAM,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAWxE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,aAAc,SAAQ,WAAW;IACpC,WAAW,CA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C1B,IAAI,EAAE,CAAC,SAAS,CAAC;SAClB,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,MAA4C,CAAC;QAC1D,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,SAA0B;YAC1C,MAAM,EAAE,IAAI,CAAC,MAAiB;YAC9B,YAAY,EAAE,IAAI,CAAC,YAAuB;YAC1C,WAAW,EAAE,IAAI,CAAC,WAA0B;YAC5C,QAAQ,EAAE,IAAI,CAAC,QAAyB;YACxC,SAAS,EAAE,IAAI,CAAC,SAAmB;YACnC,OAAO,EAAE,IAAI,CAAC,OAAkB;SACjC,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,qBAAqB;IACrB,4EAA4E;IAE5E;;OAEG;IACH,cAAc;QACZ,OAAO,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC;CACF;AAED,+EAA+E;AAC/E,sCAAsC;AACtC,+EAA+E;AAE/E;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAClD,OAAO,KAAsB,CAAC;IAChC,CAAC;IACD,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AACnC,CAAC;AAWD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,571 @@
1
+ import {
2
+ CovenantSDK,
3
+ ReceiptType,
4
+ getV2ContractAddresses
5
+ } from "./chunk-FH2MCRWQ.mjs";
6
+
7
+ // src/v2.ts
8
+ import { keccak256, toBytes } from "viem";
9
+
10
+ // src/contracts/InsurancePool.ts
11
+ var InsurancePoolABI = [
12
+ // Read functions
13
+ {
14
+ name: "getPoolBalance",
15
+ type: "function",
16
+ stateMutability: "view",
17
+ inputs: [],
18
+ outputs: [{ name: "", type: "uint256" }]
19
+ },
20
+ {
21
+ name: "getMemberInfo",
22
+ type: "function",
23
+ stateMutability: "view",
24
+ inputs: [{ name: "member", type: "address" }],
25
+ outputs: [
26
+ { name: "active", type: "bool" },
27
+ { name: "contributed", type: "uint256" }
28
+ ]
29
+ },
30
+ {
31
+ name: "getClaim",
32
+ type: "function",
33
+ stateMutability: "view",
34
+ inputs: [{ name: "claimId", type: "uint256" }],
35
+ outputs: [
36
+ {
37
+ type: "tuple",
38
+ components: [
39
+ { name: "claimant", type: "address" },
40
+ { name: "taskId", type: "uint256" },
41
+ { name: "amount", type: "uint256" },
42
+ { name: "paid", type: "bool" },
43
+ { name: "timestamp", type: "uint256" }
44
+ ]
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ name: "isMember",
50
+ type: "function",
51
+ stateMutability: "view",
52
+ inputs: [{ name: "", type: "address" }],
53
+ outputs: [{ name: "", type: "bool" }]
54
+ },
55
+ {
56
+ name: "claimCounter",
57
+ type: "function",
58
+ stateMutability: "view",
59
+ inputs: [],
60
+ outputs: [{ name: "", type: "uint256" }]
61
+ },
62
+ {
63
+ name: "memberCount",
64
+ type: "function",
65
+ stateMutability: "view",
66
+ inputs: [],
67
+ outputs: [{ name: "", type: "uint256" }]
68
+ },
69
+ {
70
+ name: "COVERAGE_PERCENT",
71
+ type: "function",
72
+ stateMutability: "view",
73
+ inputs: [],
74
+ outputs: [{ name: "", type: "uint256" }]
75
+ },
76
+ {
77
+ name: "CLAIM_COOLDOWN",
78
+ type: "function",
79
+ stateMutability: "view",
80
+ inputs: [],
81
+ outputs: [{ name: "", type: "uint256" }]
82
+ },
83
+ {
84
+ name: "contributions",
85
+ type: "function",
86
+ stateMutability: "view",
87
+ inputs: [{ name: "", type: "address" }],
88
+ outputs: [{ name: "", type: "uint256" }]
89
+ },
90
+ {
91
+ name: "lastClaimTime",
92
+ type: "function",
93
+ stateMutability: "view",
94
+ inputs: [{ name: "", type: "address" }],
95
+ outputs: [{ name: "", type: "uint256" }]
96
+ },
97
+ // Write functions
98
+ {
99
+ name: "joinPool",
100
+ type: "function",
101
+ stateMutability: "payable",
102
+ inputs: [],
103
+ outputs: []
104
+ },
105
+ {
106
+ name: "fileClaim",
107
+ type: "function",
108
+ stateMutability: "nonpayable",
109
+ inputs: [
110
+ { name: "taskId", type: "uint256" },
111
+ { name: "amount", type: "uint256" }
112
+ ],
113
+ outputs: []
114
+ },
115
+ {
116
+ name: "payClaim",
117
+ type: "function",
118
+ stateMutability: "nonpayable",
119
+ inputs: [
120
+ { name: "claimId", type: "uint256" },
121
+ { name: "", type: "bytes" }
122
+ ],
123
+ outputs: []
124
+ },
125
+ {
126
+ name: "deposit",
127
+ type: "function",
128
+ stateMutability: "payable",
129
+ inputs: [],
130
+ outputs: []
131
+ },
132
+ // Events
133
+ {
134
+ name: "MemberJoined",
135
+ type: "event",
136
+ inputs: [
137
+ { name: "member", type: "address", indexed: true },
138
+ { name: "contribution", type: "uint256", indexed: false }
139
+ ]
140
+ },
141
+ {
142
+ name: "ClaimFiled",
143
+ type: "event",
144
+ inputs: [
145
+ { name: "claimId", type: "uint256", indexed: true },
146
+ { name: "claimant", type: "address", indexed: true },
147
+ { name: "amount", type: "uint256", indexed: false }
148
+ ]
149
+ },
150
+ {
151
+ name: "ClaimPaid",
152
+ type: "event",
153
+ inputs: [
154
+ { name: "claimId", type: "uint256", indexed: true },
155
+ { name: "claimant", type: "address", indexed: true },
156
+ { name: "amount", type: "uint256", indexed: false }
157
+ ]
158
+ }
159
+ ];
160
+
161
+ // src/contracts/DisputeResolution.ts
162
+ var DisputeResolutionABI = [
163
+ // Read functions
164
+ {
165
+ name: "getDispute",
166
+ type: "function",
167
+ stateMutability: "view",
168
+ inputs: [{ name: "disputeId", type: "uint256" }],
169
+ outputs: [
170
+ {
171
+ type: "tuple",
172
+ components: [
173
+ { name: "taskId", type: "uint256" },
174
+ { name: "filedBy", type: "address" },
175
+ { name: "bondAmount", type: "uint256" },
176
+ { name: "votingEndsAt", type: "uint256" },
177
+ { name: "resolved", type: "bool" },
178
+ { name: "workerWins", type: "bool" },
179
+ { name: "workerShare", type: "uint256" }
180
+ ]
181
+ }
182
+ ]
183
+ },
184
+ {
185
+ name: "disputeCounter",
186
+ type: "function",
187
+ stateMutability: "view",
188
+ inputs: [],
189
+ outputs: [{ name: "", type: "uint256" }]
190
+ },
191
+ {
192
+ name: "DISPUTE_BOND",
193
+ type: "function",
194
+ stateMutability: "view",
195
+ inputs: [],
196
+ outputs: [{ name: "", type: "uint256" }]
197
+ },
198
+ {
199
+ name: "VOTING_DURATION",
200
+ type: "function",
201
+ stateMutability: "view",
202
+ inputs: [],
203
+ outputs: [{ name: "", type: "uint256" }]
204
+ },
205
+ // Write functions
206
+ {
207
+ name: "fileDispute",
208
+ type: "function",
209
+ stateMutability: "payable",
210
+ inputs: [{ name: "taskId", type: "uint256" }],
211
+ outputs: []
212
+ },
213
+ {
214
+ name: "resolveDispute",
215
+ type: "function",
216
+ stateMutability: "nonpayable",
217
+ inputs: [
218
+ { name: "disputeId", type: "uint256" },
219
+ { name: "workerWins", type: "bool" },
220
+ { name: "workerShare", type: "uint256" }
221
+ ],
222
+ outputs: []
223
+ },
224
+ // Events
225
+ {
226
+ name: "DisputeFiled",
227
+ type: "event",
228
+ inputs: [
229
+ { name: "disputeId", type: "uint256", indexed: true },
230
+ { name: "taskId", type: "uint256", indexed: true },
231
+ { name: "filedBy", type: "address", indexed: true }
232
+ ]
233
+ },
234
+ {
235
+ name: "DisputeResolved",
236
+ type: "event",
237
+ inputs: [
238
+ { name: "disputeId", type: "uint256", indexed: true },
239
+ { name: "workerWins", type: "bool", indexed: false },
240
+ { name: "workerShare", type: "uint256", indexed: false }
241
+ ]
242
+ }
243
+ ];
244
+
245
+ // src/contracts/ReceiptVerifierV2.ts
246
+ var ReceiptVerifierV2ABI = [
247
+ // Read functions
248
+ {
249
+ name: "getReceipt",
250
+ type: "function",
251
+ stateMutability: "view",
252
+ inputs: [{ name: "receiptId", type: "bytes32" }],
253
+ outputs: [
254
+ {
255
+ type: "tuple",
256
+ components: [
257
+ { name: "receiptId", type: "bytes32" },
258
+ { name: "issuer", type: "address" },
259
+ { name: "counterparty", type: "address" },
260
+ { name: "receiptType", type: "uint8" },
261
+ { name: "dataHash", type: "bytes32" },
262
+ { name: "timestamp", type: "uint256" },
263
+ { name: "isValid", type: "bool" }
264
+ ]
265
+ }
266
+ ]
267
+ },
268
+ {
269
+ name: "verifyReceipt",
270
+ type: "function",
271
+ stateMutability: "view",
272
+ inputs: [{ name: "receiptId", type: "bytes32" }],
273
+ outputs: [{ name: "", type: "bool" }]
274
+ },
275
+ {
276
+ name: "batchVerifyReceipts",
277
+ type: "function",
278
+ stateMutability: "view",
279
+ inputs: [{ name: "receiptIds", type: "bytes32[]" }],
280
+ outputs: [{ name: "results", type: "bool[]" }]
281
+ },
282
+ {
283
+ name: "receiptCount",
284
+ type: "function",
285
+ stateMutability: "view",
286
+ inputs: [],
287
+ outputs: [{ name: "", type: "uint256" }]
288
+ },
289
+ {
290
+ name: "authorizedIssuers",
291
+ type: "function",
292
+ stateMutability: "view",
293
+ inputs: [{ name: "", type: "address" }],
294
+ outputs: [{ name: "", type: "bool" }]
295
+ },
296
+ // Write functions
297
+ {
298
+ name: "createReceipt",
299
+ type: "function",
300
+ stateMutability: "nonpayable",
301
+ inputs: [
302
+ { name: "issuer", type: "address" },
303
+ { name: "counterparty", type: "address" },
304
+ { name: "receiptType", type: "uint8" },
305
+ { name: "dataHash", type: "bytes32" }
306
+ ],
307
+ outputs: [{ name: "receiptId", type: "bytes32" }]
308
+ },
309
+ {
310
+ name: "invalidateReceipt",
311
+ type: "function",
312
+ stateMutability: "nonpayable",
313
+ inputs: [{ name: "receiptId", type: "bytes32" }],
314
+ outputs: []
315
+ },
316
+ {
317
+ name: "addAuthorizedIssuer",
318
+ type: "function",
319
+ stateMutability: "nonpayable",
320
+ inputs: [{ name: "issuer", type: "address" }],
321
+ outputs: []
322
+ },
323
+ {
324
+ name: "removeAuthorizedIssuer",
325
+ type: "function",
326
+ stateMutability: "nonpayable",
327
+ inputs: [{ name: "issuer", type: "address" }],
328
+ outputs: []
329
+ },
330
+ // Events
331
+ {
332
+ name: "ReceiptCreated",
333
+ type: "event",
334
+ inputs: [
335
+ { name: "receiptId", type: "bytes32", indexed: true },
336
+ { name: "issuer", type: "address", indexed: true },
337
+ { name: "counterparty", type: "address", indexed: true },
338
+ { name: "receiptType", type: "uint8", indexed: false },
339
+ { name: "timestamp", type: "uint256", indexed: false }
340
+ ]
341
+ },
342
+ {
343
+ name: "ReceiptInvalidated",
344
+ type: "event",
345
+ inputs: [
346
+ { name: "receiptId", type: "bytes32", indexed: true },
347
+ { name: "timestamp", type: "uint256", indexed: false }
348
+ ]
349
+ }
350
+ ];
351
+
352
+ // src/v2.ts
353
+ var CovenantSDKV2 = class extends CovenantSDK {
354
+ v2Addresses;
355
+ constructor(config) {
356
+ super(config);
357
+ this.v2Addresses = getV2ContractAddresses(
358
+ config.chainId,
359
+ config.v2ContractAddresses
360
+ );
361
+ }
362
+ // =========================================================================
363
+ // Insurance Pool Methods
364
+ // =========================================================================
365
+ /**
366
+ * Join the insurance pool by contributing ETH
367
+ */
368
+ async joinInsurancePool(contribution) {
369
+ this.requireWallet();
370
+ return await this.walletClient.writeContract({
371
+ address: this.v2Addresses.InsurancePool,
372
+ abi: InsurancePoolABI,
373
+ functionName: "joinPool",
374
+ value: contribution,
375
+ chain: this.chain,
376
+ account: this.account
377
+ });
378
+ }
379
+ /**
380
+ * File an insurance claim for a failed task
381
+ */
382
+ async fileClaim(taskId, amount) {
383
+ this.requireWallet();
384
+ return await this.walletClient.writeContract({
385
+ address: this.v2Addresses.InsurancePool,
386
+ abi: InsurancePoolABI,
387
+ functionName: "fileClaim",
388
+ args: [taskId, amount],
389
+ chain: this.chain,
390
+ account: this.account
391
+ });
392
+ }
393
+ /**
394
+ * Get insurance claim details
395
+ */
396
+ async getClaim(claimId) {
397
+ const result = await this.publicClient.readContract({
398
+ address: this.v2Addresses.InsurancePool,
399
+ abi: InsurancePoolABI,
400
+ functionName: "getClaim",
401
+ args: [claimId]
402
+ });
403
+ const data = result;
404
+ return {
405
+ claimant: data.claimant,
406
+ taskId: data.taskId,
407
+ amount: data.amount,
408
+ paid: data.paid,
409
+ timestamp: data.timestamp
410
+ };
411
+ }
412
+ /**
413
+ * Get the current balance of the insurance pool
414
+ */
415
+ async getPoolBalance() {
416
+ return await this.publicClient.readContract({
417
+ address: this.v2Addresses.InsurancePool,
418
+ abi: InsurancePoolABI,
419
+ functionName: "getPoolBalance"
420
+ });
421
+ }
422
+ /**
423
+ * Get insurance membership info for an agent
424
+ */
425
+ async getMemberInfo(member) {
426
+ const result = await this.publicClient.readContract({
427
+ address: this.v2Addresses.InsurancePool,
428
+ abi: InsurancePoolABI,
429
+ functionName: "getMemberInfo",
430
+ args: [member]
431
+ });
432
+ const tuple = result;
433
+ return {
434
+ active: tuple[0],
435
+ contributed: tuple[1]
436
+ };
437
+ }
438
+ // =========================================================================
439
+ // Dispute Resolution Methods
440
+ // =========================================================================
441
+ /**
442
+ * File a formal dispute on a task (requires bond in ETH)
443
+ */
444
+ async fileDispute(taskId, bond) {
445
+ this.requireWallet();
446
+ return await this.walletClient.writeContract({
447
+ address: this.v2Addresses.DisputeResolution,
448
+ abi: DisputeResolutionABI,
449
+ functionName: "fileDispute",
450
+ args: [taskId],
451
+ value: bond,
452
+ chain: this.chain,
453
+ account: this.account
454
+ });
455
+ }
456
+ /**
457
+ * Resolve a dispute (arbiter-only). Sets winner and worker share.
458
+ */
459
+ async resolveDispute(disputeId, workerWins, workerShare) {
460
+ this.requireWallet();
461
+ return await this.walletClient.writeContract({
462
+ address: this.v2Addresses.DisputeResolution,
463
+ abi: DisputeResolutionABI,
464
+ functionName: "resolveDispute",
465
+ args: [disputeId, workerWins, workerShare],
466
+ chain: this.chain,
467
+ account: this.account
468
+ });
469
+ }
470
+ /**
471
+ * Get dispute details
472
+ */
473
+ async getDispute(disputeId) {
474
+ const result = await this.publicClient.readContract({
475
+ address: this.v2Addresses.DisputeResolution,
476
+ abi: DisputeResolutionABI,
477
+ functionName: "getDispute",
478
+ args: [disputeId]
479
+ });
480
+ const data = result;
481
+ return {
482
+ taskId: data.taskId,
483
+ filedBy: data.filedBy,
484
+ bondAmount: data.bondAmount,
485
+ votingEndsAt: data.votingEndsAt,
486
+ resolved: data.resolved,
487
+ workerWins: data.workerWins,
488
+ workerShare: data.workerShare
489
+ };
490
+ }
491
+ // =========================================================================
492
+ // Receipt Verifier V2 Methods
493
+ // =========================================================================
494
+ /**
495
+ * Create an ERC-8004 attestation receipt with enum type
496
+ */
497
+ async createReceiptV2(issuer, counterparty, receiptType, dataHash) {
498
+ this.requireWallet();
499
+ return await this.walletClient.writeContract({
500
+ address: this.v2Addresses.ReceiptVerifier,
501
+ abi: ReceiptVerifierV2ABI,
502
+ functionName: "createReceipt",
503
+ args: [issuer, counterparty, receiptType, dataHash],
504
+ chain: this.chain,
505
+ account: this.account
506
+ });
507
+ }
508
+ /**
509
+ * Verify a single receipt by its bytes32 ID
510
+ */
511
+ async verifyReceipt(receiptId) {
512
+ return await this.publicClient.readContract({
513
+ address: this.v2Addresses.ReceiptVerifier,
514
+ abi: ReceiptVerifierV2ABI,
515
+ functionName: "verifyReceipt",
516
+ args: [receiptId]
517
+ });
518
+ }
519
+ /**
520
+ * Batch verify multiple receipts by their bytes32 IDs
521
+ */
522
+ async batchVerifyReceipts(receiptIds) {
523
+ return await this.publicClient.readContract({
524
+ address: this.v2Addresses.ReceiptVerifier,
525
+ abi: ReceiptVerifierV2ABI,
526
+ functionName: "batchVerifyReceipts",
527
+ args: [receiptIds]
528
+ });
529
+ }
530
+ /**
531
+ * Get full receipt details by bytes32 ID
532
+ */
533
+ async getReceiptV2(receiptId) {
534
+ const result = await this.publicClient.readContract({
535
+ address: this.v2Addresses.ReceiptVerifier,
536
+ abi: ReceiptVerifierV2ABI,
537
+ functionName: "getReceipt",
538
+ args: [receiptId]
539
+ });
540
+ const data = result;
541
+ return {
542
+ receiptId: data.receiptId,
543
+ issuer: data.issuer,
544
+ counterparty: data.counterparty,
545
+ receiptType: data.receiptType,
546
+ dataHash: data.dataHash,
547
+ timestamp: data.timestamp,
548
+ isValid: data.isValid
549
+ };
550
+ }
551
+ // =========================================================================
552
+ // V2 Utility Methods
553
+ // =========================================================================
554
+ /**
555
+ * Get v2 contract addresses being used
556
+ */
557
+ getV2Addresses() {
558
+ return { ...this.v2Addresses };
559
+ }
560
+ };
561
+ function toBytes32(input) {
562
+ if (input.startsWith("0x") && input.length === 66) {
563
+ return input;
564
+ }
565
+ return keccak256(toBytes(input));
566
+ }
567
+ export {
568
+ CovenantSDKV2,
569
+ ReceiptType,
570
+ toBytes32
571
+ };