@varun-ai07/covenant-mcp 2.3.6 → 2.3.7

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 (77) hide show
  1. package/dist/cli.js +0 -0
  2. package/dist/server.js +1 -1
  3. package/package.json +1 -1
  4. package/dist/sdk/chunk-3R2WXEXL.mjs +0 -828
  5. package/dist/sdk/chunk-6ORMNSPN.mjs +0 -842
  6. package/dist/sdk/chunk-FH2MCRWQ.mjs +0 -8732
  7. package/dist/sdk/chunk-Y3YIH5K3.mjs +0 -816
  8. package/dist/sdk/config.d.ts +0 -121
  9. package/dist/sdk/config.d.ts.map +0 -1
  10. package/dist/sdk/config.js +0 -196
  11. package/dist/sdk/config.js.map +0 -1
  12. package/dist/sdk/contracts/AgentCollective.json +0 -467
  13. package/dist/sdk/contracts/AgentRegistry.d.ts +0 -144
  14. package/dist/sdk/contracts/AgentRegistry.d.ts.map +0 -1
  15. package/dist/sdk/contracts/AgentRegistry.js +0 -92
  16. package/dist/sdk/contracts/AgentRegistry.js.map +0 -1
  17. package/dist/sdk/contracts/COVENANTRouter.json +0 -206
  18. package/dist/sdk/contracts/CovenantArbitration.json +0 -546
  19. package/dist/sdk/contracts/CovenantAttestation.json +0 -476
  20. package/dist/sdk/contracts/CovenantEscrow.d.ts +0 -70
  21. package/dist/sdk/contracts/CovenantEscrow.d.ts.map +0 -1
  22. package/dist/sdk/contracts/CovenantEscrow.js +0 -3
  23. package/dist/sdk/contracts/CovenantEscrow.js.map +0 -1
  24. package/dist/sdk/contracts/CovenantEscrow.json +0 -783
  25. package/dist/sdk/contracts/CovenantGovernance.json +0 -729
  26. package/dist/sdk/contracts/CovenantIdentity.d.ts +0 -70
  27. package/dist/sdk/contracts/CovenantIdentity.d.ts.map +0 -1
  28. package/dist/sdk/contracts/CovenantIdentity.js +0 -3
  29. package/dist/sdk/contracts/CovenantIdentity.js.map +0 -1
  30. package/dist/sdk/contracts/CovenantIdentity.json +0 -800
  31. package/dist/sdk/contracts/CovenantSettlement.json +0 -609
  32. package/dist/sdk/contracts/DisputeResolution.d.ts +0 -122
  33. package/dist/sdk/contracts/DisputeResolution.d.ts.map +0 -1
  34. package/dist/sdk/contracts/DisputeResolution.js +0 -86
  35. package/dist/sdk/contracts/DisputeResolution.js.map +0 -1
  36. package/dist/sdk/contracts/GrantProgram.json +0 -373
  37. package/dist/sdk/contracts/InsurancePool.d.ts +0 -209
  38. package/dist/sdk/contracts/InsurancePool.d.ts.map +0 -1
  39. package/dist/sdk/contracts/InsurancePool.js +0 -153
  40. package/dist/sdk/contracts/InsurancePool.js.map +0 -1
  41. package/dist/sdk/contracts/InsurancePool.json +0 -456
  42. package/dist/sdk/contracts/MultiTokenEscrow.json +0 -435
  43. package/dist/sdk/contracts/OpenTaskMarket.d.ts +0 -190
  44. package/dist/sdk/contracts/OpenTaskMarket.d.ts.map +0 -1
  45. package/dist/sdk/contracts/OpenTaskMarket.js +0 -117
  46. package/dist/sdk/contracts/OpenTaskMarket.js.map +0 -1
  47. package/dist/sdk/contracts/ParallelTaskBatch.json +0 -511
  48. package/dist/sdk/contracts/ReceiptVerifierV2.d.ts +0 -168
  49. package/dist/sdk/contracts/ReceiptVerifierV2.d.ts.map +0 -1
  50. package/dist/sdk/contracts/ReceiptVerifierV2.js +0 -109
  51. package/dist/sdk/contracts/ReceiptVerifierV2.js.map +0 -1
  52. package/dist/sdk/contracts/RevisionManager.json +0 -489
  53. package/dist/sdk/contracts/TaskEscrow.d.ts +0 -222
  54. package/dist/sdk/contracts/TaskEscrow.d.ts.map +0 -1
  55. package/dist/sdk/contracts/TaskEscrow.js +0 -144
  56. package/dist/sdk/contracts/TaskEscrow.js.map +0 -1
  57. package/dist/sdk/contracts/TrainingMarketplace.json +0 -357
  58. package/dist/sdk/index.d.mts +0 -385
  59. package/dist/sdk/index.d.ts +0 -35
  60. package/dist/sdk/index.d.ts.map +0 -1
  61. package/dist/sdk/index.js +0 -284
  62. package/dist/sdk/index.js.map +0 -1
  63. package/dist/sdk/index.mjs +0 -32
  64. package/dist/sdk/types.d.ts +0 -110
  65. package/dist/sdk/types.d.ts.map +0 -1
  66. package/dist/sdk/types.js +0 -17
  67. package/dist/sdk/types.js.map +0 -1
  68. package/dist/sdk/v2.d.mts +0 -100
  69. package/dist/sdk/v2.d.ts +0 -100
  70. package/dist/sdk/v2.d.ts.map +0 -1
  71. package/dist/sdk/v2.js +0 -2615
  72. package/dist/sdk/v2.js.map +0 -1
  73. package/dist/sdk/v2.mjs +0 -571
  74. package/dist/sdk/v5-extensions.d.ts +0 -133
  75. package/dist/sdk/v5-extensions.d.ts.map +0 -1
  76. package/dist/sdk/v5-extensions.js +0 -993
  77. package/dist/sdk/v5-extensions.js.map +0 -1
@@ -1,828 +0,0 @@
1
- // src/config.ts
2
- var DEFAULT_ADDRESSES = {
3
- // Base Sepolia Testnet
4
- 84532: {
5
- // Core Protocol
6
- AgentRegistry: "0xB215589dA259A98eEE8BF39739F6255131ac33A1",
7
- TaskEscrow: "0xFD081B5cB8bAE37DC878078bE3165932b0bC0BB3",
8
- ReceiptVerifier: "0xa47D15099be6aC516B53a6859D468E9004eEf76b",
9
- // Market & Batching
10
- OpenTaskMarket: "0x5ccF09469222E5046b0830c6d71ed6B912bE70e6",
11
- ParallelTaskBatch: "0xaf23D40668f0e33426824Bf2027A0E9cD26c11Bc",
12
- // Collective & Insurance
13
- AgentCollective: "0x0CDE9560D2E95338922c40A52A2c81cdd20613d1",
14
- AgentInsurance: "0x1798d370e3C566001A84F38EbDc0F6F1Db6bdd55",
15
- // Dispute Resolution
16
- DisputeArbitration: "0x37A62C6eDd18461CCe00B6772Da8640C75DE740e",
17
- // ZK Verifiers
18
- Groth16VerifierCapability: "0xd7108ed5C8577B30f6FC024319ebE8B380DaAb85",
19
- CapabilityVerifier: "0x628CB2cA13f6FeAc48e0f24f45C3AF2Dbb1c02Fb",
20
- Groth16VerifierReputation: "0xbe6AfBa53E06099410d78d56A75b689dfCa6532F",
21
- ReputationVerifier: "0x1ac2532e39591cdb5E00Fb9d7C0f47E082d0F149",
22
- // Router & Integration
23
- COVENANTRouter: "0x565C48FEFc39c9D98a37cCE30583913C7d0d5e09",
24
- LitProtocolIntegration: "0x9322B12111699Dd05DD3d0c5D8D08b764051A89f"
25
- },
26
- // Hardhat Local (placeholder addresses)
27
- 31337: {
28
- AgentRegistry: "0x0000000000000000000000000000000000000000",
29
- TaskEscrow: "0x0000000000000000000000000000000000000000",
30
- ReceiptVerifier: "0x0000000000000000000000000000000000000000",
31
- OpenTaskMarket: "0x0000000000000000000000000000000000000000",
32
- ParallelTaskBatch: "0x0000000000000000000000000000000000000000",
33
- AgentCollective: "0x0000000000000000000000000000000000000000",
34
- AgentInsurance: "0x0000000000000000000000000000000000000000",
35
- DisputeArbitration: "0x0000000000000000000000000000000000000000",
36
- Groth16VerifierCapability: "0x0000000000000000000000000000000000000000",
37
- CapabilityVerifier: "0x0000000000000000000000000000000000000000",
38
- Groth16VerifierReputation: "0x0000000000000000000000000000000000000000",
39
- ReputationVerifier: "0x0000000000000000000000000000000000000000",
40
- COVENANTRouter: "0x0000000000000000000000000000000000000000",
41
- LitProtocolIntegration: "0x0000000000000000000000000000000000000000"
42
- },
43
- // Base Mainnet (placeholder - not deployed yet)
44
- 8453: {
45
- AgentRegistry: "0x0000000000000000000000000000000000000000",
46
- TaskEscrow: "0x0000000000000000000000000000000000000000",
47
- ReceiptVerifier: "0x0000000000000000000000000000000000000000",
48
- OpenTaskMarket: "0x0000000000000000000000000000000000000000",
49
- ParallelTaskBatch: "0x0000000000000000000000000000000000000000",
50
- AgentCollective: "0x0000000000000000000000000000000000000000",
51
- AgentInsurance: "0x0000000000000000000000000000000000000000",
52
- DisputeArbitration: "0x0000000000000000000000000000000000000000",
53
- Groth16VerifierCapability: "0x0000000000000000000000000000000000000000",
54
- CapabilityVerifier: "0x0000000000000000000000000000000000000000",
55
- Groth16VerifierReputation: "0x0000000000000000000000000000000000000000",
56
- ReputationVerifier: "0x0000000000000000000000000000000000000000",
57
- COVENANTRouter: "0x0000000000000000000000000000000000000000",
58
- LitProtocolIntegration: "0x0000000000000000000000000000000000000000"
59
- }
60
- };
61
- var V2_ADDRESSES = {
62
- // Base Sepolia Testnet
63
- 84532: {
64
- AgentRegistry: "0x773d1954997b6A91e917e0c2326ABCcAf36e21E1",
65
- TaskEscrow: "0xf4d0765A935E36F888d899D9A7C9156CeCdEa6F5",
66
- ReceiptVerifier: "0x05cC13692755015FCb11e95d609187b214197edF",
67
- InsurancePool: "0x920f3925122B3Ce9380A220AA748e67bD787BE1d",
68
- DisputeResolution: "0xFA6dd0929a4ACCCC2E083DaDaD89226dd71Ef28F"
69
- },
70
- // Hardhat Local (placeholder addresses)
71
- 31337: {
72
- AgentRegistry: "0x0000000000000000000000000000000000000000",
73
- TaskEscrow: "0x0000000000000000000000000000000000000000",
74
- ReceiptVerifier: "0x0000000000000000000000000000000000000000",
75
- InsurancePool: "0x0000000000000000000000000000000000000000",
76
- DisputeResolution: "0x0000000000000000000000000000000000000000"
77
- },
78
- // Base Mainnet (placeholder - not deployed yet)
79
- 8453: {
80
- AgentRegistry: "0x0000000000000000000000000000000000000000",
81
- TaskEscrow: "0x0000000000000000000000000000000000000000",
82
- ReceiptVerifier: "0x0000000000000000000000000000000000000000",
83
- InsurancePool: "0x0000000000000000000000000000000000000000",
84
- DisputeResolution: "0x0000000000000000000000000000000000000000"
85
- }
86
- };
87
- var CHAIN_CONFIGS = {
88
- 84532: {
89
- chain: {
90
- id: 84532,
91
- name: "Base Sepolia",
92
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
93
- rpcUrls: { default: { http: ["https://sepolia.base.org"] } }
94
- }
95
- },
96
- 8453: {
97
- chain: {
98
- id: 8453,
99
- name: "Base",
100
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
101
- rpcUrls: { default: { http: ["https://mainnet.base.org"] } }
102
- }
103
- },
104
- 31337: {
105
- chain: {
106
- id: 31337,
107
- name: "Hardhat Local",
108
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
109
- rpcUrls: { default: { http: ["http://localhost:8545"] } }
110
- }
111
- }
112
- };
113
- var CHAINS = {
114
- baseSepolia: {
115
- id: 84532,
116
- name: "Base Sepolia",
117
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
118
- rpcUrls: {
119
- default: { http: ["https://sepolia.base.org"] }
120
- },
121
- blockExplorers: {
122
- default: { name: "Basescan", url: "https://sepolia.basescan.org" }
123
- },
124
- testnet: true
125
- },
126
- base: {
127
- id: 8453,
128
- name: "Base",
129
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
130
- rpcUrls: {
131
- default: { http: ["https://mainnet.base.org"] }
132
- },
133
- blockExplorers: {
134
- default: { name: "Basescan", url: "https://basescan.org" }
135
- }
136
- }
137
- };
138
- function getContractAddresses(chainId, overrides) {
139
- const defaults = DEFAULT_ADDRESSES[chainId];
140
- if (!defaults) {
141
- throw new Error(`Unsupported chain ID: ${chainId}. Supported: ${Object.keys(DEFAULT_ADDRESSES).join(", ")}`);
142
- }
143
- return { ...defaults, ...overrides };
144
- }
145
- function isDeployed(chainId) {
146
- const addresses = DEFAULT_ADDRESSES[chainId];
147
- if (!addresses) return false;
148
- return addresses.AgentRegistry !== "0x0000000000000000000000000000000000000000";
149
- }
150
- function getV2ContractAddresses(chainId, overrides) {
151
- const defaults = V2_ADDRESSES[chainId];
152
- if (!defaults) {
153
- throw new Error(`Unsupported chain ID for V2: ${chainId}. Supported: ${Object.keys(V2_ADDRESSES).join(", ")}`);
154
- }
155
- return { ...defaults, ...overrides };
156
- }
157
-
158
- // src/contracts/AgentRegistry.ts
159
- var AgentRegistryABI = [
160
- // Read functions
161
- {
162
- name: "getAgent",
163
- type: "function",
164
- stateMutability: "view",
165
- inputs: [{ name: "agent", type: "address" }],
166
- outputs: [
167
- { name: "did", type: "bytes32" },
168
- { name: "name", type: "string" },
169
- { name: "capabilities", type: "string[]" },
170
- { name: "reputation", type: "uint256" },
171
- { name: "stakedAmount", type: "uint256" },
172
- { name: "tasksCompleted", type: "uint256" },
173
- { name: "tasksFailed", type: "uint256" },
174
- { name: "totalValueTransferred", type: "uint256" },
175
- { name: "isActive", type: "bool" },
176
- { name: "registeredAt", type: "uint256" },
177
- { name: "walletAddress", type: "address" }
178
- ]
179
- },
180
- {
181
- name: "getAgentCount",
182
- type: "function",
183
- stateMutability: "view",
184
- inputs: [],
185
- outputs: [{ name: "", type: "uint256" }]
186
- },
187
- {
188
- name: "getAgentsByCapability",
189
- type: "function",
190
- stateMutability: "view",
191
- inputs: [
192
- { name: "capability", type: "string" },
193
- { name: "offset", type: "uint256" },
194
- { name: "limit", type: "uint256" }
195
- ],
196
- outputs: [{ name: "", type: "address[]" }]
197
- },
198
- {
199
- name: "getAllAgents",
200
- type: "function",
201
- stateMutability: "view",
202
- inputs: [
203
- { name: "offset", type: "uint256" },
204
- { name: "limit", type: "uint256" }
205
- ],
206
- outputs: [{ name: "", type: "address[]" }]
207
- },
208
- // Write functions
209
- {
210
- name: "register",
211
- type: "function",
212
- stateMutability: "payable",
213
- inputs: [
214
- { name: "name", type: "string" },
215
- { name: "capabilities", type: "string[]" }
216
- ],
217
- outputs: []
218
- },
219
- {
220
- name: "deactivate",
221
- type: "function",
222
- stateMutability: "nonpayable",
223
- inputs: [],
224
- outputs: []
225
- },
226
- // Events
227
- {
228
- name: "AgentRegistered",
229
- type: "event",
230
- inputs: [
231
- { name: "agent", type: "address", indexed: true },
232
- { name: "did", type: "bytes32", indexed: true },
233
- { name: "name", type: "string", indexed: false },
234
- { name: "stake", type: "uint256", indexed: false }
235
- ]
236
- },
237
- {
238
- name: "ReputationUpdated",
239
- type: "event",
240
- inputs: [
241
- { name: "agent", type: "address", indexed: true },
242
- { name: "delta", type: "int256", indexed: false },
243
- { name: "newReputation", type: "uint256", indexed: false }
244
- ]
245
- }
246
- ];
247
-
248
- // src/contracts/TaskEscrow.ts
249
- var TaskEscrowABI = [
250
- // Read functions
251
- {
252
- name: "getTask",
253
- type: "function",
254
- stateMutability: "view",
255
- inputs: [{ name: "taskId", type: "uint256" }],
256
- outputs: [
257
- { name: "taskId", type: "uint256" },
258
- { name: "client", type: "address" },
259
- { name: "worker", type: "address" },
260
- { name: "payment", type: "uint256" },
261
- { name: "deadline", type: "uint256" },
262
- { name: "descriptionHash", type: "string" },
263
- { name: "deliverableHash", type: "string" },
264
- { name: "status", type: "uint8" },
265
- { name: "createdAt", type: "uint256" },
266
- { name: "completedAt", type: "uint256" },
267
- { name: "protocolFee", type: "uint256" },
268
- { name: "totalValue", type: "uint256" }
269
- ]
270
- },
271
- {
272
- name: "getTaskCount",
273
- type: "function",
274
- stateMutability: "view",
275
- inputs: [],
276
- outputs: [{ name: "", type: "uint256" }]
277
- },
278
- {
279
- name: "getClientTasks",
280
- type: "function",
281
- stateMutability: "view",
282
- inputs: [{ name: "client", type: "address" }],
283
- outputs: [{ name: "", type: "uint256[]" }]
284
- },
285
- {
286
- name: "getWorkerTasks",
287
- type: "function",
288
- stateMutability: "view",
289
- inputs: [{ name: "worker", type: "address" }],
290
- outputs: [{ name: "", type: "uint256[]" }]
291
- },
292
- // Write functions
293
- {
294
- name: "createTask",
295
- type: "function",
296
- stateMutability: "payable",
297
- inputs: [
298
- { name: "worker", type: "address" },
299
- { name: "deadline", type: "uint256" },
300
- { name: "descriptionHash", type: "string" }
301
- ],
302
- outputs: [{ name: "", type: "uint256" }]
303
- },
304
- {
305
- name: "fundTask",
306
- type: "function",
307
- stateMutability: "payable",
308
- inputs: [{ name: "taskId", type: "uint256" }],
309
- outputs: []
310
- },
311
- {
312
- name: "startTask",
313
- type: "function",
314
- stateMutability: "nonpayable",
315
- inputs: [{ name: "taskId", type: "uint256" }],
316
- outputs: []
317
- },
318
- {
319
- name: "submitWork",
320
- type: "function",
321
- stateMutability: "nonpayable",
322
- inputs: [
323
- { name: "taskId", type: "uint256" },
324
- { name: "deliverableHash", type: "string" }
325
- ],
326
- outputs: []
327
- },
328
- {
329
- name: "verifyTask",
330
- type: "function",
331
- stateMutability: "nonpayable",
332
- inputs: [
333
- { name: "taskId", type: "uint256" },
334
- { name: "success", type: "bool" }
335
- ],
336
- outputs: []
337
- },
338
- {
339
- name: "disputeTask",
340
- type: "function",
341
- stateMutability: "payable",
342
- inputs: [{ name: "taskId", type: "uint256" }],
343
- outputs: []
344
- },
345
- {
346
- name: "cancelTask",
347
- type: "function",
348
- stateMutability: "nonpayable",
349
- inputs: [{ name: "taskId", type: "uint256" }],
350
- outputs: []
351
- },
352
- // Events
353
- {
354
- name: "TaskCreated",
355
- type: "event",
356
- inputs: [
357
- { name: "taskId", type: "uint256", indexed: true },
358
- { name: "client", type: "address", indexed: true },
359
- { name: "worker", type: "address", indexed: true },
360
- { name: "payment", type: "uint256", indexed: false },
361
- { name: "deadline", type: "uint256", indexed: false }
362
- ]
363
- },
364
- {
365
- name: "WorkSubmitted",
366
- type: "event",
367
- inputs: [
368
- { name: "taskId", type: "uint256", indexed: true },
369
- { name: "deliverableHash", type: "string", indexed: false }
370
- ]
371
- },
372
- {
373
- name: "TaskCompleted",
374
- type: "event",
375
- inputs: [
376
- { name: "taskId", type: "uint256", indexed: true },
377
- { name: "workerPayment", type: "uint256", indexed: false }
378
- ]
379
- },
380
- {
381
- name: "TaskDisputed",
382
- type: "event",
383
- inputs: [
384
- { name: "taskId", type: "uint256", indexed: true },
385
- { name: "disputedBy", type: "address", indexed: false }
386
- ]
387
- }
388
- ];
389
-
390
- // src/contracts/OpenTaskMarket.ts
391
- var OpenTaskMarketABI = [
392
- // Read functions
393
- {
394
- name: "getOpenTask",
395
- type: "function",
396
- stateMutability: "view",
397
- inputs: [{ name: "taskId", type: "uint256" }],
398
- outputs: [
399
- { name: "client", type: "address" },
400
- { name: "maxPayment", type: "uint256" },
401
- { name: "deadline", type: "uint256" },
402
- { name: "descriptionHash", type: "string" },
403
- { name: "bidders", type: "address[]" },
404
- { name: "selectedWorker", type: "address" },
405
- { name: "status", type: "uint8" }
406
- ]
407
- },
408
- {
409
- name: "getBid",
410
- type: "function",
411
- stateMutability: "view",
412
- inputs: [
413
- { name: "taskId", type: "uint256" },
414
- { name: "bidder", type: "address" }
415
- ],
416
- outputs: [
417
- { name: "price", type: "uint256" },
418
- { name: "timeEstimate", type: "uint256" },
419
- { name: "proposalHash", type: "string" },
420
- { name: "bidAt", type: "uint256" }
421
- ]
422
- },
423
- {
424
- name: "getOpenTaskCount",
425
- type: "function",
426
- stateMutability: "view",
427
- inputs: [],
428
- outputs: [{ name: "", type: "uint256" }]
429
- },
430
- // Write functions
431
- {
432
- name: "postOpenTask",
433
- type: "function",
434
- stateMutability: "payable",
435
- inputs: [
436
- { name: "maxPayment", type: "uint256" },
437
- { name: "deadline", type: "uint256" },
438
- { name: "descriptionHash", type: "string" }
439
- ],
440
- outputs: [{ name: "", type: "uint256" }]
441
- },
442
- {
443
- name: "submitBid",
444
- type: "function",
445
- stateMutability: "nonpayable",
446
- inputs: [
447
- { name: "taskId", type: "uint256" },
448
- { name: "price", type: "uint256" },
449
- { name: "timeEstimate", type: "uint256" },
450
- { name: "proposalHash", type: "string" }
451
- ],
452
- outputs: []
453
- },
454
- {
455
- name: "selectWorker",
456
- type: "function",
457
- stateMutability: "nonpayable",
458
- inputs: [
459
- { name: "taskId", type: "uint256" },
460
- { name: "worker", type: "address" }
461
- ],
462
- outputs: []
463
- },
464
- {
465
- name: "withdrawBid",
466
- type: "function",
467
- stateMutability: "nonpayable",
468
- inputs: [{ name: "taskId", type: "uint256" }],
469
- outputs: []
470
- },
471
- // Events
472
- {
473
- name: "TaskPosted",
474
- type: "event",
475
- inputs: [
476
- { name: "taskId", type: "uint256", indexed: true },
477
- { name: "client", type: "address", indexed: true },
478
- { name: "maxPayment", type: "uint256", indexed: false },
479
- { name: "deadline", type: "uint256", indexed: false },
480
- { name: "descriptionHash", type: "string", indexed: false }
481
- ]
482
- },
483
- {
484
- name: "BidSubmitted",
485
- type: "event",
486
- inputs: [
487
- { name: "taskId", type: "uint256", indexed: true },
488
- { name: "bidder", type: "address", indexed: true },
489
- { name: "price", type: "uint256", indexed: false },
490
- { name: "timeEstimate", type: "uint256", indexed: false },
491
- { name: "proposalHash", type: "string", indexed: false }
492
- ]
493
- },
494
- {
495
- name: "WorkerSelected",
496
- type: "event",
497
- inputs: [
498
- { name: "taskId", type: "uint256", indexed: true },
499
- { name: "worker", type: "address", indexed: true },
500
- { name: "selectedPrice", type: "uint256", indexed: false }
501
- ]
502
- }
503
- ];
504
-
505
- // src/types.ts
506
- var ReceiptType = /* @__PURE__ */ ((ReceiptType2) => {
507
- ReceiptType2[ReceiptType2["TaskCompleted"] = 0] = "TaskCompleted";
508
- ReceiptType2[ReceiptType2["AgentVerified"] = 1] = "AgentVerified";
509
- ReceiptType2[ReceiptType2["DisputeResolved"] = 2] = "DisputeResolved";
510
- ReceiptType2[ReceiptType2["InsuranceClaim"] = 3] = "InsuranceClaim";
511
- ReceiptType2[ReceiptType2["MilestoneReached"] = 4] = "MilestoneReached";
512
- ReceiptType2[ReceiptType2["ReputationUpdated"] = 5] = "ReputationUpdated";
513
- return ReceiptType2;
514
- })(ReceiptType || {});
515
-
516
- // src/index.ts
517
- var CovenantSDK = class {
518
- publicClient;
519
- walletClient;
520
- addresses;
521
- chain;
522
- account;
523
- constructor(config) {
524
- this.publicClient = config.publicClient;
525
- this.walletClient = config.walletClient;
526
- this.account = config.walletClient?.account;
527
- this.addresses = getContractAddresses(config.chainId, config.contractAddresses);
528
- this.chain = CHAIN_CONFIGS[config.chainId]?.chain ?? {
529
- id: config.chainId,
530
- name: `Chain ${config.chainId}`,
531
- nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
532
- rpcUrls: { default: { http: [] } }
533
- };
534
- }
535
- // =========================================================================
536
- // Agent Methods
537
- // =========================================================================
538
- /**
539
- * Get agent data by address
540
- */
541
- async getAgent(address) {
542
- const result = await this.publicClient.readContract({
543
- address: this.addresses.AgentRegistry,
544
- abi: AgentRegistryABI,
545
- functionName: "getAgent",
546
- args: [address]
547
- });
548
- return this.parseAgentData(result);
549
- }
550
- /**
551
- * Get total number of registered agents
552
- */
553
- async getAgentCount() {
554
- return await this.publicClient.readContract({
555
- address: this.addresses.AgentRegistry,
556
- abi: AgentRegistryABI,
557
- functionName: "getAgentCount",
558
- args: []
559
- });
560
- }
561
- /**
562
- * Find agents by capability
563
- */
564
- async findAgents(capability, minReputation, limit = 20) {
565
- const addresses = await this.publicClient.readContract({
566
- address: this.addresses.AgentRegistry,
567
- abi: AgentRegistryABI,
568
- functionName: "getAgentsByCapability",
569
- args: [capability, BigInt(0), BigInt(limit)]
570
- });
571
- if (minReputation !== void 0) {
572
- const filtered = [];
573
- for (const addr of addresses) {
574
- const agent = await this.getAgent(addr);
575
- if (agent.reputation >= BigInt(minReputation)) {
576
- filtered.push(addr);
577
- }
578
- }
579
- return filtered;
580
- }
581
- return addresses;
582
- }
583
- /**
584
- * Get all agents with pagination
585
- */
586
- async getAllAgents(offset = 0, limit = 50) {
587
- return await this.publicClient.readContract({
588
- address: this.addresses.AgentRegistry,
589
- abi: AgentRegistryABI,
590
- functionName: "getAllAgents",
591
- args: [BigInt(offset), BigInt(limit)]
592
- });
593
- }
594
- /**
595
- * Register a new agent (requires wallet)
596
- */
597
- async registerAgent(name, capabilities, stake) {
598
- this.requireWallet();
599
- return await this.walletClient.writeContract({
600
- address: this.addresses.AgentRegistry,
601
- abi: AgentRegistryABI,
602
- functionName: "register",
603
- args: [name, capabilities],
604
- value: stake,
605
- chain: this.chain,
606
- account: this.account
607
- });
608
- }
609
- // =========================================================================
610
- // Task Methods
611
- // =========================================================================
612
- /**
613
- * Get task data by ID
614
- */
615
- async getTask(taskId) {
616
- const result = await this.publicClient.readContract({
617
- address: this.addresses.TaskEscrow,
618
- abi: TaskEscrowABI,
619
- functionName: "getTask",
620
- args: [taskId]
621
- });
622
- return this.parseTaskData(result);
623
- }
624
- /**
625
- * Get total number of tasks
626
- */
627
- async getTaskCount() {
628
- return await this.publicClient.readContract({
629
- address: this.addresses.TaskEscrow,
630
- abi: TaskEscrowABI,
631
- functionName: "getTaskCount",
632
- args: []
633
- });
634
- }
635
- /**
636
- * Get all task IDs for a client
637
- */
638
- async getClientTasks(client) {
639
- return await this.publicClient.readContract({
640
- address: this.addresses.TaskEscrow,
641
- abi: TaskEscrowABI,
642
- functionName: "getClientTasks",
643
- args: [client]
644
- });
645
- }
646
- /**
647
- * Get all task IDs for a worker
648
- */
649
- async getWorkerTasks(worker) {
650
- return await this.publicClient.readContract({
651
- address: this.addresses.TaskEscrow,
652
- abi: TaskEscrowABI,
653
- functionName: "getWorkerTasks",
654
- args: [worker]
655
- });
656
- }
657
- /**
658
- * Create a new task (requires wallet)
659
- */
660
- async createTask(worker, payment, deadline, descriptionHash) {
661
- this.requireWallet();
662
- return await this.walletClient.writeContract({
663
- address: this.addresses.TaskEscrow,
664
- abi: TaskEscrowABI,
665
- functionName: "createTask",
666
- args: [worker, deadline, descriptionHash],
667
- value: payment,
668
- chain: this.chain,
669
- account: this.account
670
- });
671
- }
672
- /**
673
- * Submit work for a task (requires wallet)
674
- */
675
- async submitWork(taskId, deliverableHash) {
676
- this.requireWallet();
677
- return await this.walletClient.writeContract({
678
- address: this.addresses.TaskEscrow,
679
- abi: TaskEscrowABI,
680
- functionName: "submitWork",
681
- args: [taskId, deliverableHash],
682
- chain: this.chain,
683
- account: this.account
684
- });
685
- }
686
- /**
687
- * Verify task completion (requires wallet)
688
- */
689
- async verifyTask(taskId, success) {
690
- this.requireWallet();
691
- return await this.walletClient.writeContract({
692
- address: this.addresses.TaskEscrow,
693
- abi: TaskEscrowABI,
694
- functionName: "verifyTask",
695
- args: [taskId, success],
696
- chain: this.chain,
697
- account: this.account
698
- });
699
- }
700
- /**
701
- * Dispute a task (requires wallet)
702
- */
703
- async disputeTask(taskId, disputeBond) {
704
- this.requireWallet();
705
- return await this.walletClient.writeContract({
706
- address: this.addresses.TaskEscrow,
707
- abi: TaskEscrowABI,
708
- functionName: "disputeTask",
709
- args: [taskId],
710
- value: disputeBond,
711
- chain: this.chain,
712
- account: this.account
713
- });
714
- }
715
- // =========================================================================
716
- // Open Task Market Methods
717
- // =========================================================================
718
- /**
719
- * Post an open task for bidding
720
- */
721
- async postOpenTask(maxPayment, deadline, descriptionHash) {
722
- this.requireWallet();
723
- return await this.walletClient.writeContract({
724
- address: this.addresses.OpenTaskMarket,
725
- abi: OpenTaskMarketABI,
726
- functionName: "postOpenTask",
727
- args: [maxPayment, deadline, descriptionHash],
728
- value: maxPayment,
729
- chain: this.chain,
730
- account: this.account
731
- });
732
- }
733
- /**
734
- * Submit a bid on an open task
735
- */
736
- async submitBid(taskId, price, timeEstimate, proposalHash) {
737
- this.requireWallet();
738
- return await this.walletClient.writeContract({
739
- address: this.addresses.OpenTaskMarket,
740
- abi: OpenTaskMarketABI,
741
- functionName: "submitBid",
742
- args: [taskId, price, timeEstimate, proposalHash],
743
- chain: this.chain,
744
- account: this.account
745
- });
746
- }
747
- /**
748
- * Select a worker for an open task
749
- */
750
- async selectWorker(taskId, worker) {
751
- this.requireWallet();
752
- return await this.walletClient.writeContract({
753
- address: this.addresses.OpenTaskMarket,
754
- abi: OpenTaskMarketABI,
755
- functionName: "selectWorker",
756
- args: [taskId, worker],
757
- chain: this.chain,
758
- account: this.account
759
- });
760
- }
761
- // =========================================================================
762
- // Utility Methods
763
- // =========================================================================
764
- /**
765
- * Wait for a transaction to be confirmed
766
- */
767
- async waitForTransaction(hash) {
768
- return await this.publicClient.waitForTransactionReceipt({ hash });
769
- }
770
- /**
771
- * Get contract addresses being used
772
- */
773
- getAddresses() {
774
- return { ...this.addresses };
775
- }
776
- // =========================================================================
777
- // Private Helpers
778
- // =========================================================================
779
- requireWallet() {
780
- if (!this.walletClient) {
781
- throw new Error("Wallet client required for write operations. Pass walletClient in config.");
782
- }
783
- }
784
- parseAgentData(result) {
785
- return {
786
- did: result[0],
787
- name: result[1],
788
- capabilities: result[2],
789
- reputation: result[3],
790
- stakedAmount: result[4],
791
- tasksCompleted: result[5],
792
- tasksFailed: result[6],
793
- totalValueTransferred: result[7],
794
- isActive: result[8],
795
- registeredAt: result[9],
796
- walletAddress: result[10]
797
- };
798
- }
799
- parseTaskData(result) {
800
- const statusMap = ["Open", "Funded", "InProgress", "Submitted", "Completed", "Disputed", "Failed", "Cancelled"];
801
- return {
802
- taskId: result[0],
803
- client: result[1],
804
- worker: result[2],
805
- payment: result[3],
806
- deadline: result[4],
807
- descriptionHash: result[5],
808
- deliverableHash: result[6],
809
- status: statusMap[result[7]] || "Open",
810
- createdAt: result[8],
811
- completedAt: result[9],
812
- protocolFee: result[10],
813
- totalValue: result[11]
814
- };
815
- }
816
- };
817
-
818
- export {
819
- DEFAULT_ADDRESSES,
820
- V2_ADDRESSES,
821
- CHAIN_CONFIGS,
822
- CHAINS,
823
- getContractAddresses,
824
- isDeployed,
825
- getV2ContractAddresses,
826
- ReceiptType,
827
- CovenantSDK
828
- };