@varun-ai07/covenant-mcp 2.3.6 → 2.3.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 (84) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/lib/sqlite-store.d.ts.map +1 -1
  4. package/dist/lib/sqlite-store.js +2 -1
  5. package/dist/lib/sqlite-store.js.map +1 -1
  6. package/dist/lib/store.d.ts.map +1 -1
  7. package/dist/lib/store.js +2 -1
  8. package/dist/lib/store.js.map +1 -1
  9. package/dist/server.js +1 -1
  10. package/package.json +1 -1
  11. package/dist/sdk/chunk-3R2WXEXL.mjs +0 -828
  12. package/dist/sdk/chunk-6ORMNSPN.mjs +0 -842
  13. package/dist/sdk/chunk-FH2MCRWQ.mjs +0 -8732
  14. package/dist/sdk/chunk-Y3YIH5K3.mjs +0 -816
  15. package/dist/sdk/config.d.ts +0 -121
  16. package/dist/sdk/config.d.ts.map +0 -1
  17. package/dist/sdk/config.js +0 -196
  18. package/dist/sdk/config.js.map +0 -1
  19. package/dist/sdk/contracts/AgentCollective.json +0 -467
  20. package/dist/sdk/contracts/AgentRegistry.d.ts +0 -144
  21. package/dist/sdk/contracts/AgentRegistry.d.ts.map +0 -1
  22. package/dist/sdk/contracts/AgentRegistry.js +0 -92
  23. package/dist/sdk/contracts/AgentRegistry.js.map +0 -1
  24. package/dist/sdk/contracts/COVENANTRouter.json +0 -206
  25. package/dist/sdk/contracts/CovenantArbitration.json +0 -546
  26. package/dist/sdk/contracts/CovenantAttestation.json +0 -476
  27. package/dist/sdk/contracts/CovenantEscrow.d.ts +0 -70
  28. package/dist/sdk/contracts/CovenantEscrow.d.ts.map +0 -1
  29. package/dist/sdk/contracts/CovenantEscrow.js +0 -3
  30. package/dist/sdk/contracts/CovenantEscrow.js.map +0 -1
  31. package/dist/sdk/contracts/CovenantEscrow.json +0 -783
  32. package/dist/sdk/contracts/CovenantGovernance.json +0 -729
  33. package/dist/sdk/contracts/CovenantIdentity.d.ts +0 -70
  34. package/dist/sdk/contracts/CovenantIdentity.d.ts.map +0 -1
  35. package/dist/sdk/contracts/CovenantIdentity.js +0 -3
  36. package/dist/sdk/contracts/CovenantIdentity.js.map +0 -1
  37. package/dist/sdk/contracts/CovenantIdentity.json +0 -800
  38. package/dist/sdk/contracts/CovenantSettlement.json +0 -609
  39. package/dist/sdk/contracts/DisputeResolution.d.ts +0 -122
  40. package/dist/sdk/contracts/DisputeResolution.d.ts.map +0 -1
  41. package/dist/sdk/contracts/DisputeResolution.js +0 -86
  42. package/dist/sdk/contracts/DisputeResolution.js.map +0 -1
  43. package/dist/sdk/contracts/GrantProgram.json +0 -373
  44. package/dist/sdk/contracts/InsurancePool.d.ts +0 -209
  45. package/dist/sdk/contracts/InsurancePool.d.ts.map +0 -1
  46. package/dist/sdk/contracts/InsurancePool.js +0 -153
  47. package/dist/sdk/contracts/InsurancePool.js.map +0 -1
  48. package/dist/sdk/contracts/InsurancePool.json +0 -456
  49. package/dist/sdk/contracts/MultiTokenEscrow.json +0 -435
  50. package/dist/sdk/contracts/OpenTaskMarket.d.ts +0 -190
  51. package/dist/sdk/contracts/OpenTaskMarket.d.ts.map +0 -1
  52. package/dist/sdk/contracts/OpenTaskMarket.js +0 -117
  53. package/dist/sdk/contracts/OpenTaskMarket.js.map +0 -1
  54. package/dist/sdk/contracts/ParallelTaskBatch.json +0 -511
  55. package/dist/sdk/contracts/ReceiptVerifierV2.d.ts +0 -168
  56. package/dist/sdk/contracts/ReceiptVerifierV2.d.ts.map +0 -1
  57. package/dist/sdk/contracts/ReceiptVerifierV2.js +0 -109
  58. package/dist/sdk/contracts/ReceiptVerifierV2.js.map +0 -1
  59. package/dist/sdk/contracts/RevisionManager.json +0 -489
  60. package/dist/sdk/contracts/TaskEscrow.d.ts +0 -222
  61. package/dist/sdk/contracts/TaskEscrow.d.ts.map +0 -1
  62. package/dist/sdk/contracts/TaskEscrow.js +0 -144
  63. package/dist/sdk/contracts/TaskEscrow.js.map +0 -1
  64. package/dist/sdk/contracts/TrainingMarketplace.json +0 -357
  65. package/dist/sdk/index.d.mts +0 -385
  66. package/dist/sdk/index.d.ts +0 -35
  67. package/dist/sdk/index.d.ts.map +0 -1
  68. package/dist/sdk/index.js +0 -284
  69. package/dist/sdk/index.js.map +0 -1
  70. package/dist/sdk/index.mjs +0 -32
  71. package/dist/sdk/types.d.ts +0 -110
  72. package/dist/sdk/types.d.ts.map +0 -1
  73. package/dist/sdk/types.js +0 -17
  74. package/dist/sdk/types.js.map +0 -1
  75. package/dist/sdk/v2.d.mts +0 -100
  76. package/dist/sdk/v2.d.ts +0 -100
  77. package/dist/sdk/v2.d.ts.map +0 -1
  78. package/dist/sdk/v2.js +0 -2615
  79. package/dist/sdk/v2.js.map +0 -1
  80. package/dist/sdk/v2.mjs +0 -571
  81. package/dist/sdk/v5-extensions.d.ts +0 -133
  82. package/dist/sdk/v5-extensions.d.ts.map +0 -1
  83. package/dist/sdk/v5-extensions.js +0 -993
  84. package/dist/sdk/v5-extensions.js.map +0 -1
@@ -1,993 +0,0 @@
1
- import { getContractAddresses, CHAIN_CONFIGS } from "./config.js";
2
- // V5 ABIs (all functions)
3
- import CovenantSettlementABI from "./contracts/CovenantSettlement.json" with { type: "json" };
4
- import CovenantArbitrationABI from "./contracts/CovenantArbitration.json" with { type: "json" };
5
- import CovenantAttestationABI from "./contracts/CovenantAttestation.json" with { type: "json" };
6
- import CovenantGovernanceABI from "./contracts/CovenantGovernance.json" with { type: "json" };
7
- import InsurancePoolABI from "./contracts/InsurancePool.json" with { type: "json" };
8
- import TrainingMarketplaceABI from "./contracts/TrainingMarketplace.json" with { type: "json" };
9
- import GrantProgramABI from "./contracts/GrantProgram.json" with { type: "json" };
10
- import RevisionManagerABI from "./contracts/RevisionManager.json" with { type: "json" };
11
- import ParallelTaskBatchABI from "./contracts/ParallelTaskBatch.json" with { type: "json" };
12
- import AgentCollectiveABI from "./contracts/AgentCollective.json" with { type: "json" };
13
- import MultiTokenEscrowABI from "./contracts/MultiTokenEscrow.json" with { type: "json" };
14
- import COVENANTRouterABI from "./contracts/COVENANTRouter.json" with { type: "json" };
15
- export class CovenantSDKV5 {
16
- publicClient;
17
- walletClient;
18
- chain;
19
- account;
20
- addresses;
21
- constructor(config) {
22
- this.publicClient = config.publicClient;
23
- this.walletClient = config.walletClient;
24
- this.account = config.walletClient?.account;
25
- this.addresses = getContractAddresses(config.chainId, config.contractAddresses);
26
- this.chain = CHAIN_CONFIGS[config.chainId]?.chain ?? {
27
- id: config.chainId,
28
- name: `Chain ${config.chainId}`,
29
- nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
30
- rpcUrls: { default: { http: [] } },
31
- };
32
- }
33
- requireWallet() {
34
- if (!this.walletClient) {
35
- throw new Error("Wallet client required for write operations. Pass walletClient in config.");
36
- }
37
- }
38
- getAddresses() {
39
- return { ...this.addresses };
40
- }
41
- async waitForTransaction(hash) {
42
- return await this.publicClient.waitForTransactionReceipt({ hash });
43
- }
44
- // ═══════════════════════════════════════════════════════════════
45
- // CovenantSettlement (17 functions)
46
- // ═══════════════════════════════════════════════════════════════
47
- async createStream(payee, ratePerSecond, duration) {
48
- this.requireWallet();
49
- const totalCost = ratePerSecond * BigInt(duration);
50
- return this.walletClient.writeContract({
51
- address: this.addresses.CovenantSettlement,
52
- abi: CovenantSettlementABI.abi,
53
- functionName: "createStream",
54
- args: [payee, ratePerSecond, duration],
55
- value: totalCost,
56
- chain: this.chain,
57
- account: this.account,
58
- });
59
- }
60
- async withdrawStream(streamId) {
61
- this.requireWallet();
62
- return this.walletClient.writeContract({
63
- address: this.addresses.CovenantSettlement,
64
- abi: CovenantSettlementABI.abi,
65
- functionName: "withdrawStream",
66
- args: [streamId],
67
- chain: this.chain,
68
- account: this.account,
69
- });
70
- }
71
- async cancelStream(streamId) {
72
- this.requireWallet();
73
- return this.walletClient.writeContract({
74
- address: this.addresses.CovenantSettlement,
75
- abi: CovenantSettlementABI.abi,
76
- functionName: "cancelStream",
77
- args: [streamId],
78
- chain: this.chain,
79
- account: this.account,
80
- });
81
- }
82
- async getStream(streamId) {
83
- return this.publicClient.readContract({
84
- address: this.addresses.CovenantSettlement,
85
- abi: CovenantSettlementABI.abi,
86
- functionName: "getStream",
87
- args: [streamId],
88
- });
89
- }
90
- async streamCount() {
91
- return this.publicClient.readContract({
92
- address: this.addresses.CovenantSettlement,
93
- abi: CovenantSettlementABI.abi,
94
- functionName: "streamCount",
95
- args: [],
96
- });
97
- }
98
- async claimableAmount(streamId) {
99
- return this.publicClient.readContract({
100
- address: this.addresses.CovenantSettlement,
101
- abi: CovenantSettlementABI.abi,
102
- functionName: "claimableAmount",
103
- args: [streamId],
104
- });
105
- }
106
- async settleReceipt(payer, payee, amount, nonce, payerSignature) {
107
- this.requireWallet();
108
- return this.walletClient.writeContract({
109
- address: this.addresses.CovenantSettlement,
110
- abi: CovenantSettlementABI.abi,
111
- functionName: "settleReceipt",
112
- args: [payer, payee, amount, nonce, payerSignature],
113
- chain: this.chain,
114
- account: this.account,
115
- });
116
- }
117
- async batchSettleReceipts(payers, payees, amounts, nonces, payerSignatures) {
118
- this.requireWallet();
119
- return this.walletClient.writeContract({
120
- address: this.addresses.CovenantSettlement,
121
- abi: CovenantSettlementABI.abi,
122
- functionName: "batchSettleReceipts",
123
- args: [payers, payees, amounts, nonces, payerSignatures],
124
- chain: this.chain,
125
- account: this.account,
126
- });
127
- }
128
- async receiptCount() {
129
- return this.publicClient.readContract({
130
- address: this.addresses.CovenantSettlement,
131
- abi: CovenantSettlementABI.abi,
132
- functionName: "receiptCount",
133
- args: [],
134
- });
135
- }
136
- async batchCount() {
137
- return this.publicClient.readContract({
138
- address: this.addresses.CovenantSettlement,
139
- abi: CovenantSettlementABI.abi,
140
- functionName: "batchCount",
141
- args: [],
142
- });
143
- }
144
- // ═══════════════════════════════════════════════════════════════
145
- // CovenantArbitration (17 functions)
146
- // ═══════════════════════════════════════════════════════════════
147
- async createDispute(taskId, evidenceHash) {
148
- this.requireWallet();
149
- return this.walletClient.writeContract({
150
- address: this.addresses.CovenantArbitration,
151
- abi: CovenantArbitrationABI.abi,
152
- functionName: "createDispute",
153
- args: [taskId, evidenceHash],
154
- chain: this.chain,
155
- account: this.account,
156
- });
157
- }
158
- async stakeForDispute(disputeId, amount) {
159
- this.requireWallet();
160
- return this.walletClient.writeContract({
161
- address: this.addresses.CovenantArbitration,
162
- abi: CovenantArbitrationABI.abi,
163
- functionName: "stakeForDispute",
164
- args: [disputeId],
165
- value: amount,
166
- chain: this.chain,
167
- account: this.account,
168
- });
169
- }
170
- async settleDispute(disputeId) {
171
- this.requireWallet();
172
- return this.walletClient.writeContract({
173
- address: this.addresses.CovenantArbitration,
174
- abi: CovenantArbitrationABI.abi,
175
- functionName: "settleDispute",
176
- args: [disputeId],
177
- chain: this.chain,
178
- account: this.account,
179
- });
180
- }
181
- async submitRuling(disputeId, ruling, splitBps, arbiterSignature) {
182
- this.requireWallet();
183
- return this.walletClient.writeContract({
184
- address: this.addresses.CovenantArbitration,
185
- abi: CovenantArbitrationABI.abi,
186
- functionName: "submitRuling",
187
- args: [disputeId, ruling, splitBps, arbiterSignature],
188
- chain: this.chain,
189
- account: this.account,
190
- });
191
- }
192
- async getDispute(disputeId) {
193
- return this.publicClient.readContract({
194
- address: this.addresses.CovenantArbitration,
195
- abi: CovenantArbitrationABI.abi,
196
- functionName: "getDispute",
197
- args: [disputeId],
198
- });
199
- }
200
- async disputeCount() {
201
- return this.publicClient.readContract({
202
- address: this.addresses.CovenantArbitration,
203
- abi: CovenantArbitrationABI.abi,
204
- functionName: "disputeCount",
205
- args: [],
206
- });
207
- }
208
- async arbiter() {
209
- return this.publicClient.readContract({
210
- address: this.addresses.CovenantArbitration,
211
- abi: CovenantArbitrationABI.abi,
212
- functionName: "arbiter",
213
- args: [],
214
- });
215
- }
216
- // ═══════════════════════════════════════════════════════════════
217
- // CovenantAttestation (15 functions)
218
- // ═══════════════════════════════════════════════════════════════
219
- async attest(subject, schemaHash, dataHash, expiresAt) {
220
- this.requireWallet();
221
- return this.walletClient.writeContract({
222
- address: this.addresses.CovenantAttestation,
223
- abi: CovenantAttestationABI.abi,
224
- functionName: "attest",
225
- args: [subject, schemaHash, dataHash, expiresAt],
226
- chain: this.chain,
227
- account: this.account,
228
- });
229
- }
230
- async attestBatch(subjects, schemaHash, dataHashes, expiresAt) {
231
- this.requireWallet();
232
- return this.walletClient.writeContract({
233
- address: this.addresses.CovenantAttestation,
234
- abi: CovenantAttestationABI.abi,
235
- functionName: "attestBatch",
236
- args: [subjects, schemaHash, dataHashes, expiresAt],
237
- chain: this.chain,
238
- account: this.account,
239
- });
240
- }
241
- async verifyAttestation(attestationId) {
242
- const result = await this.publicClient.readContract({
243
- address: this.addresses.CovenantAttestation,
244
- abi: CovenantAttestationABI.abi,
245
- functionName: "verify",
246
- args: [attestationId],
247
- });
248
- return result;
249
- }
250
- async attestationCount() {
251
- return this.publicClient.readContract({
252
- address: this.addresses.CovenantAttestation,
253
- abi: CovenantAttestationABI.abi,
254
- functionName: "attestationCount",
255
- args: [],
256
- });
257
- }
258
- async getAgentAttestations(agent) {
259
- return this.publicClient.readContract({
260
- address: this.addresses.CovenantAttestation,
261
- abi: CovenantAttestationABI.abi,
262
- functionName: "getAgentAttestations",
263
- args: [agent],
264
- });
265
- }
266
- async registerIssuer(issuer, name) {
267
- this.requireWallet();
268
- return this.walletClient.writeContract({
269
- address: this.addresses.CovenantAttestation,
270
- abi: CovenantAttestationABI.abi,
271
- functionName: "registerIssuer",
272
- args: [issuer, name],
273
- chain: this.chain,
274
- account: this.account,
275
- });
276
- }
277
- async registerSchema(schemaHash, name) {
278
- this.requireWallet();
279
- return this.walletClient.writeContract({
280
- address: this.addresses.CovenantAttestation,
281
- abi: CovenantAttestationABI.abi,
282
- functionName: "registerSchema",
283
- args: [schemaHash, name],
284
- chain: this.chain,
285
- account: this.account,
286
- });
287
- }
288
- async revokeAttestation(attestationId) {
289
- this.requireWallet();
290
- return this.walletClient.writeContract({
291
- address: this.addresses.CovenantAttestation,
292
- abi: CovenantAttestationABI.abi,
293
- functionName: "revoke",
294
- args: [attestationId],
295
- chain: this.chain,
296
- account: this.account,
297
- });
298
- }
299
- async isIssuer(address) {
300
- return this.publicClient.readContract({
301
- address: this.addresses.CovenantAttestation,
302
- abi: CovenantAttestationABI.abi,
303
- functionName: "isIssuer",
304
- args: [address],
305
- });
306
- }
307
- async schemaExists(schemaHash) {
308
- return this.publicClient.readContract({
309
- address: this.addresses.CovenantAttestation,
310
- abi: CovenantAttestationABI.abi,
311
- functionName: "schemas",
312
- args: [schemaHash],
313
- });
314
- }
315
- // ═══════════════════════════════════════════════════════════════
316
- // CovenantGovernance (26 functions)
317
- // ═══════════════════════════════════════════════════════════════
318
- async propose(target, callData, descriptionHash, votingPeriod) {
319
- this.requireWallet();
320
- return this.walletClient.writeContract({
321
- address: this.addresses.CovenantGovernance,
322
- abi: CovenantGovernanceABI.abi,
323
- functionName: "propose",
324
- args: [target, callData, descriptionHash, votingPeriod],
325
- chain: this.chain,
326
- account: this.account,
327
- });
328
- }
329
- async submitVotes(proposalId, forVotes, againstVotes, guardianSignature) {
330
- this.requireWallet();
331
- return this.walletClient.writeContract({
332
- address: this.addresses.CovenantGovernance,
333
- abi: CovenantGovernanceABI.abi,
334
- functionName: "submitVotes",
335
- args: [proposalId, forVotes, againstVotes, guardianSignature],
336
- chain: this.chain,
337
- account: this.account,
338
- });
339
- }
340
- async executeProposal(proposalId) {
341
- this.requireWallet();
342
- return this.walletClient.writeContract({
343
- address: this.addresses.CovenantGovernance,
344
- abi: CovenantGovernanceABI.abi,
345
- functionName: "executeProposal",
346
- args: [proposalId],
347
- chain: this.chain,
348
- account: this.account,
349
- });
350
- }
351
- async vetoProposal(proposalId) {
352
- this.requireWallet();
353
- return this.walletClient.writeContract({
354
- address: this.addresses.CovenantGovernance,
355
- abi: CovenantGovernanceABI.abi,
356
- functionName: "vetoProposal",
357
- args: [proposalId],
358
- chain: this.chain,
359
- account: this.account,
360
- });
361
- }
362
- async emergencyPause(target, paused) {
363
- this.requireWallet();
364
- return this.walletClient.writeContract({
365
- address: this.addresses.CovenantGovernance,
366
- abi: CovenantGovernanceABI.abi,
367
- functionName: "emergencyPause",
368
- args: [target, paused],
369
- chain: this.chain,
370
- account: this.account,
371
- });
372
- }
373
- async getProposal(proposalId) {
374
- return this.publicClient.readContract({
375
- address: this.addresses.CovenantGovernance,
376
- abi: CovenantGovernanceABI.abi,
377
- functionName: "getProposal",
378
- args: [proposalId],
379
- });
380
- }
381
- async proposalCount() {
382
- return this.publicClient.readContract({
383
- address: this.addresses.CovenantGovernance,
384
- abi: CovenantGovernanceABI.abi,
385
- functionName: "proposalCount",
386
- args: [],
387
- });
388
- }
389
- async quorum() {
390
- return this.publicClient.readContract({
391
- address: this.addresses.CovenantGovernance,
392
- abi: CovenantGovernanceABI.abi,
393
- functionName: "quorum",
394
- args: [],
395
- });
396
- }
397
- async guardian() {
398
- return this.publicClient.readContract({
399
- address: this.addresses.CovenantGovernance,
400
- abi: CovenantGovernanceABI.abi,
401
- functionName: "guardian",
402
- args: [],
403
- });
404
- }
405
- async vetoer() {
406
- return this.publicClient.readContract({
407
- address: this.addresses.CovenantGovernance,
408
- abi: CovenantGovernanceABI.abi,
409
- functionName: "vetoer",
410
- args: [],
411
- });
412
- }
413
- async isPaused(target) {
414
- return this.publicClient.readContract({
415
- address: this.addresses.CovenantGovernance,
416
- abi: CovenantGovernanceABI.abi,
417
- functionName: "isPaused",
418
- args: [target],
419
- });
420
- }
421
- async setGuardian(newGuardian) {
422
- this.requireWallet();
423
- return this.walletClient.writeContract({
424
- address: this.addresses.CovenantGovernance,
425
- abi: CovenantGovernanceABI.abi,
426
- functionName: "setGuardian",
427
- args: [newGuardian],
428
- chain: this.chain,
429
- account: this.account,
430
- });
431
- }
432
- async setVetoer(newVetoer) {
433
- this.requireWallet();
434
- return this.walletClient.writeContract({
435
- address: this.addresses.CovenantGovernance,
436
- abi: CovenantGovernanceABI.abi,
437
- functionName: "setVetoer",
438
- args: [newVetoer],
439
- chain: this.chain,
440
- account: this.account,
441
- });
442
- }
443
- async setQuorum(newQuorum) {
444
- this.requireWallet();
445
- return this.walletClient.writeContract({
446
- address: this.addresses.CovenantGovernance,
447
- abi: CovenantGovernanceABI.abi,
448
- functionName: "setQuorum",
449
- args: [newQuorum],
450
- chain: this.chain,
451
- account: this.account,
452
- });
453
- }
454
- // ═══════════════════════════════════════════════════════════════
455
- // InsurancePool (19 functions)
456
- // ═══════════════════════════════════════════════════════════════
457
- async joinPool(amount) {
458
- this.requireWallet();
459
- return this.walletClient.writeContract({
460
- address: this.addresses.InsurancePool,
461
- abi: InsurancePoolABI.abi,
462
- functionName: "joinPool",
463
- args: [],
464
- value: amount,
465
- chain: this.chain,
466
- account: this.account,
467
- });
468
- }
469
- async fileClaim(taskId, amount) {
470
- this.requireWallet();
471
- return this.walletClient.writeContract({
472
- address: this.addresses.InsurancePool,
473
- abi: InsurancePoolABI.abi,
474
- functionName: "fileClaim",
475
- args: [taskId, amount],
476
- chain: this.chain,
477
- account: this.account,
478
- });
479
- }
480
- async voteOnClaim(claimId, inFavor) {
481
- this.requireWallet();
482
- return this.walletClient.writeContract({
483
- address: this.addresses.InsurancePool,
484
- abi: InsurancePoolABI.abi,
485
- functionName: "voteOnClaim",
486
- args: [claimId, inFavor],
487
- chain: this.chain,
488
- account: this.account,
489
- });
490
- }
491
- async approveClaim(claimId) {
492
- this.requireWallet();
493
- return this.walletClient.writeContract({
494
- address: this.addresses.InsurancePool,
495
- abi: InsurancePoolABI.abi,
496
- functionName: "approveClaim",
497
- args: [claimId],
498
- chain: this.chain,
499
- account: this.account,
500
- });
501
- }
502
- async payClaim(claimId) {
503
- this.requireWallet();
504
- return this.walletClient.writeContract({
505
- address: this.addresses.InsurancePool,
506
- abi: InsurancePoolABI.abi,
507
- functionName: "payClaim",
508
- args: [claimId],
509
- chain: this.chain,
510
- account: this.account,
511
- });
512
- }
513
- async withdrawPool() {
514
- this.requireWallet();
515
- return this.walletClient.writeContract({
516
- address: this.addresses.InsurancePool,
517
- abi: InsurancePoolABI.abi,
518
- functionName: "withdraw",
519
- args: [],
520
- chain: this.chain,
521
- account: this.account,
522
- });
523
- }
524
- async getPoolBalance() {
525
- return this.publicClient.readContract({
526
- address: this.addresses.InsurancePool,
527
- abi: InsurancePoolABI.abi,
528
- functionName: "getPoolBalance",
529
- args: [],
530
- });
531
- }
532
- async getMemberInfo(address) {
533
- return this.publicClient.readContract({
534
- address: this.addresses.InsurancePool,
535
- abi: InsurancePoolABI.abi,
536
- functionName: "members",
537
- args: [address],
538
- });
539
- }
540
- async getClaim(claimId) {
541
- return this.publicClient.readContract({
542
- address: this.addresses.InsurancePool,
543
- abi: InsurancePoolABI.abi,
544
- functionName: "claims",
545
- args: [claimId],
546
- });
547
- }
548
- async claimCount() {
549
- return this.publicClient.readContract({
550
- address: this.addresses.InsurancePool,
551
- abi: InsurancePoolABI.abi,
552
- functionName: "claimCount",
553
- args: [],
554
- });
555
- }
556
- async memberCount() {
557
- return this.publicClient.readContract({
558
- address: this.addresses.InsurancePool,
559
- abi: InsurancePoolABI.abi,
560
- functionName: "memberCount",
561
- args: [],
562
- });
563
- }
564
- // ═══════════════════════════════════════════════════════════════
565
- // TrainingMarketplace (13 functions)
566
- // ═══════════════════════════════════════════════════════════════
567
- async createTraining(title, price) {
568
- this.requireWallet();
569
- return this.walletClient.writeContract({
570
- address: this.addresses.TrainingMarketplace,
571
- abi: TrainingMarketplaceABI.abi,
572
- functionName: "createTraining",
573
- args: [title, price],
574
- chain: this.chain,
575
- account: this.account,
576
- });
577
- }
578
- async enroll(trainingId, price) {
579
- this.requireWallet();
580
- return this.walletClient.writeContract({
581
- address: this.addresses.TrainingMarketplace,
582
- abi: TrainingMarketplaceABI.abi,
583
- functionName: "enroll",
584
- args: [trainingId],
585
- value: price,
586
- chain: this.chain,
587
- account: this.account,
588
- });
589
- }
590
- async getTraining(trainingId) {
591
- return this.publicClient.readContract({
592
- address: this.addresses.TrainingMarketplace,
593
- abi: TrainingMarketplaceABI.abi,
594
- functionName: "trainings",
595
- args: [trainingId],
596
- });
597
- }
598
- async trainingCount() {
599
- return this.publicClient.readContract({
600
- address: this.addresses.TrainingMarketplace,
601
- abi: TrainingMarketplaceABI.abi,
602
- functionName: "trainingCount",
603
- args: [],
604
- });
605
- }
606
- async platformFeeBps() {
607
- return this.publicClient.readContract({
608
- address: this.addresses.TrainingMarketplace,
609
- abi: TrainingMarketplaceABI.abi,
610
- functionName: "platformFeeBps",
611
- args: [],
612
- });
613
- }
614
- async feeRecipient() {
615
- return this.publicClient.readContract({
616
- address: this.addresses.TrainingMarketplace,
617
- abi: TrainingMarketplaceABI.abi,
618
- functionName: "feeRecipient",
619
- args: [],
620
- });
621
- }
622
- // ═══════════════════════════════════════════════════════════════
623
- // GrantProgram (14 functions)
624
- // ═══════════════════════════════════════════════════════════════
625
- async depositToGrants(amount) {
626
- this.requireWallet();
627
- return this.walletClient.writeContract({
628
- address: this.addresses.GrantProgram,
629
- abi: GrantProgramABI.abi,
630
- functionName: "deposit",
631
- args: [],
632
- value: amount,
633
- chain: this.chain,
634
- account: this.account,
635
- });
636
- }
637
- async applyGrant(amount) {
638
- this.requireWallet();
639
- return this.walletClient.writeContract({
640
- address: this.addresses.GrantProgram,
641
- abi: GrantProgramABI.abi,
642
- functionName: "applyGrant",
643
- args: [amount],
644
- chain: this.chain,
645
- account: this.account,
646
- });
647
- }
648
- async voteGrant(grantId, inFavor) {
649
- this.requireWallet();
650
- return this.walletClient.writeContract({
651
- address: this.addresses.GrantProgram,
652
- abi: GrantProgramABI.abi,
653
- functionName: "voteGrant",
654
- args: [grantId, inFavor],
655
- chain: this.chain,
656
- account: this.account,
657
- });
658
- }
659
- async disburseGrant(grantId) {
660
- this.requireWallet();
661
- return this.walletClient.writeContract({
662
- address: this.addresses.GrantProgram,
663
- abi: GrantProgramABI.abi,
664
- functionName: "disburseGrant",
665
- args: [grantId],
666
- chain: this.chain,
667
- account: this.account,
668
- });
669
- }
670
- async getGrant(grantId) {
671
- return this.publicClient.readContract({
672
- address: this.addresses.GrantProgram,
673
- abi: GrantProgramABI.abi,
674
- functionName: "grants",
675
- args: [grantId],
676
- });
677
- }
678
- async grantCount() {
679
- return this.publicClient.readContract({
680
- address: this.addresses.GrantProgram,
681
- abi: GrantProgramABI.abi,
682
- functionName: "grantCount",
683
- args: [],
684
- });
685
- }
686
- async treasury() {
687
- return this.publicClient.readContract({
688
- address: this.addresses.GrantProgram,
689
- abi: GrantProgramABI.abi,
690
- functionName: "treasury",
691
- args: [],
692
- });
693
- }
694
- async votingPeriod() {
695
- return this.publicClient.readContract({
696
- address: this.addresses.GrantProgram,
697
- abi: GrantProgramABI.abi,
698
- functionName: "votingPeriod",
699
- args: [],
700
- });
701
- }
702
- // ═══════════════════════════════════════════════════════════════
703
- // RevisionManager (17 functions)
704
- // ═══════════════════════════════════════════════════════════════
705
- async requestRevision(taskId, feedbackHash) {
706
- this.requireWallet();
707
- return this.walletClient.writeContract({
708
- address: this.addresses.RevisionManager,
709
- abi: RevisionManagerABI.abi,
710
- functionName: "requestRevision",
711
- args: [taskId, feedbackHash],
712
- chain: this.chain,
713
- account: this.account,
714
- });
715
- }
716
- async submitRevision(taskId, newHash) {
717
- this.requireWallet();
718
- return this.walletClient.writeContract({
719
- address: this.addresses.RevisionManager,
720
- abi: RevisionManagerABI.abi,
721
- functionName: "submitRevision",
722
- args: [taskId, newHash],
723
- chain: this.chain,
724
- account: this.account,
725
- });
726
- }
727
- async getRevisionCount(taskId) {
728
- return this.publicClient.readContract({
729
- address: this.addresses.RevisionManager,
730
- abi: RevisionManagerABI.abi,
731
- functionName: "getRevisionCount",
732
- args: [taskId],
733
- });
734
- }
735
- async getLatestRevision(taskId) {
736
- return this.publicClient.readContract({
737
- address: this.addresses.RevisionManager,
738
- abi: RevisionManagerABI.abi,
739
- functionName: "getLatestRevision",
740
- args: [taskId],
741
- });
742
- }
743
- async getRevision(taskId, revisionNumber) {
744
- return this.publicClient.readContract({
745
- address: this.addresses.RevisionManager,
746
- abi: RevisionManagerABI.abi,
747
- functionName: "revisions",
748
- args: [taskId, revisionNumber],
749
- });
750
- }
751
- async revisionAllowed(taskId) {
752
- return this.publicClient.readContract({
753
- address: this.addresses.RevisionManager,
754
- abi: RevisionManagerABI.abi,
755
- functionName: "revisionAllowed",
756
- args: [taskId],
757
- });
758
- }
759
- async taskClient(taskId) {
760
- return this.publicClient.readContract({
761
- address: this.addresses.RevisionManager,
762
- abi: RevisionManagerABI.abi,
763
- functionName: "taskClient",
764
- args: [taskId],
765
- });
766
- }
767
- async setTaskClient(taskId, client) {
768
- this.requireWallet();
769
- return this.walletClient.writeContract({
770
- address: this.addresses.RevisionManager,
771
- abi: RevisionManagerABI.abi,
772
- functionName: "setTaskClient",
773
- args: [taskId, client],
774
- chain: this.chain,
775
- account: this.account,
776
- });
777
- }
778
- async setMaxRevisions(taskId, max) {
779
- this.requireWallet();
780
- return this.walletClient.writeContract({
781
- address: this.addresses.RevisionManager,
782
- abi: RevisionManagerABI.abi,
783
- functionName: "setMaxRevisions",
784
- args: [taskId, max],
785
- chain: this.chain,
786
- account: this.account,
787
- });
788
- }
789
- async setRevisionAllowed(taskId, allowed) {
790
- this.requireWallet();
791
- return this.walletClient.writeContract({
792
- address: this.addresses.RevisionManager,
793
- abi: RevisionManagerABI.abi,
794
- functionName: "setRevisionAllowed",
795
- args: [taskId, allowed],
796
- chain: this.chain,
797
- account: this.account,
798
- });
799
- }
800
- async defaultMaxRevisions() {
801
- return this.publicClient.readContract({
802
- address: this.addresses.RevisionManager,
803
- abi: RevisionManagerABI.abi,
804
- functionName: "defaultMaxRevisions",
805
- args: [],
806
- });
807
- }
808
- // ═══════════════════════════════════════════════════════════════
809
- // ParallelTaskBatch (15 functions)
810
- // ═══════════════════════════════════════════════════════════════
811
- async createBatch(workers, payments, deadlines, descriptionHashes, aggregationSpec) {
812
- this.requireWallet();
813
- const totalBudget = payments.reduce((a, b) => a + b, 0n);
814
- return this.walletClient.writeContract({
815
- address: this.addresses.ParallelTaskBatch,
816
- abi: ParallelTaskBatchABI.abi,
817
- functionName: "createBatch",
818
- args: [workers, payments, deadlines, descriptionHashes, aggregationSpec],
819
- value: totalBudget,
820
- chain: this.chain,
821
- account: this.account,
822
- });
823
- }
824
- async aggregateResults(batchId) {
825
- this.requireWallet();
826
- return this.walletClient.writeContract({
827
- address: this.addresses.ParallelTaskBatch,
828
- abi: ParallelTaskBatchABI.abi,
829
- functionName: "aggregateResults",
830
- args: [batchId],
831
- chain: this.chain,
832
- account: this.account,
833
- });
834
- }
835
- async getBatch(batchId) {
836
- return this.publicClient.readContract({
837
- address: this.addresses.ParallelTaskBatch,
838
- abi: ParallelTaskBatchABI.abi,
839
- functionName: "getBatch",
840
- args: [batchId],
841
- });
842
- }
843
- async batchCounter() {
844
- return this.publicClient.readContract({
845
- address: this.addresses.ParallelTaskBatch,
846
- abi: ParallelTaskBatchABI.abi,
847
- functionName: "batchCounter",
848
- args: [],
849
- });
850
- }
851
- // ═══════════════════════════════════════════════════════════════
852
- // AgentCollective (15 functions)
853
- // ═══════════════════════════════════════════════════════════════
854
- async createCollective(minContribution, maxMembers) {
855
- this.requireWallet();
856
- return this.walletClient.writeContract({
857
- address: this.addresses.AgentCollective,
858
- abi: AgentCollectiveABI.abi,
859
- functionName: "createCollective",
860
- args: [minContribution, maxMembers],
861
- chain: this.chain,
862
- account: this.account,
863
- });
864
- }
865
- async joinCollective(collectiveId, amount) {
866
- this.requireWallet();
867
- return this.walletClient.writeContract({
868
- address: this.addresses.AgentCollective,
869
- abi: AgentCollectiveABI.abi,
870
- functionName: "joinCollective",
871
- args: [collectiveId],
872
- value: amount,
873
- chain: this.chain,
874
- account: this.account,
875
- });
876
- }
877
- async launchCollectiveTask(collectiveId, worker, payment, deadline, descriptionHash) {
878
- this.requireWallet();
879
- return this.walletClient.writeContract({
880
- address: this.addresses.AgentCollective,
881
- abi: AgentCollectiveABI.abi,
882
- functionName: "launchCollectiveTask",
883
- args: [collectiveId, worker, payment, deadline, descriptionHash],
884
- chain: this.chain,
885
- account: this.account,
886
- });
887
- }
888
- async getCollective(collectiveId) {
889
- return this.publicClient.readContract({
890
- address: this.addresses.AgentCollective,
891
- abi: AgentCollectiveABI.abi,
892
- functionName: "getCollective",
893
- args: [collectiveId],
894
- });
895
- }
896
- async collectiveCounter() {
897
- return this.publicClient.readContract({
898
- address: this.addresses.AgentCollective,
899
- abi: AgentCollectiveABI.abi,
900
- functionName: "collectiveCounter",
901
- args: [],
902
- });
903
- }
904
- // ═══════════════════════════════════════════════════════════════
905
- // MultiTokenEscrow (16 functions)
906
- // ═══════════════════════════════════════════════════════════════
907
- async createTaskERC20(worker, token, amount, deadline) {
908
- this.requireWallet();
909
- return this.walletClient.writeContract({
910
- address: this.addresses.MultiTokenEscrow,
911
- abi: MultiTokenEscrowABI.abi,
912
- functionName: "createTaskERC20",
913
- args: [worker, token, amount, deadline],
914
- chain: this.chain,
915
- account: this.account,
916
- });
917
- }
918
- async verifyTask(taskId, success) {
919
- this.requireWallet();
920
- return this.walletClient.writeContract({
921
- address: this.addresses.MultiTokenEscrow,
922
- abi: MultiTokenEscrowABI.abi,
923
- functionName: "verifyTask",
924
- args: [taskId, success],
925
- chain: this.chain,
926
- account: this.account,
927
- });
928
- }
929
- async multiTokenTaskCount() {
930
- return this.publicClient.readContract({
931
- address: this.addresses.MultiTokenEscrow,
932
- abi: MultiTokenEscrowABI.abi,
933
- functionName: "taskCount",
934
- args: [],
935
- });
936
- }
937
- async isAcceptedToken(token) {
938
- return this.publicClient.readContract({
939
- address: this.addresses.MultiTokenEscrow,
940
- abi: MultiTokenEscrowABI.abi,
941
- functionName: "acceptedTokens",
942
- args: [token],
943
- });
944
- }
945
- async tokenFee(token) {
946
- return this.publicClient.readContract({
947
- address: this.addresses.MultiTokenEscrow,
948
- abi: MultiTokenEscrowABI.abi,
949
- functionName: "tokenFees",
950
- args: [token],
951
- });
952
- }
953
- async setAcceptedToken(token, accepted) {
954
- this.requireWallet();
955
- return this.walletClient.writeContract({
956
- address: this.addresses.MultiTokenEscrow,
957
- abi: MultiTokenEscrowABI.abi,
958
- functionName: "setAcceptedToken",
959
- args: [token, accepted],
960
- chain: this.chain,
961
- account: this.account,
962
- });
963
- }
964
- // ═══════════════════════════════════════════════════════════════
965
- // COVENANTRouter (7 functions)
966
- // ═══════════════════════════════════════════════════════════════
967
- async multicall(calls) {
968
- this.requireWallet();
969
- const totalValue = calls.reduce((a, b) => a + b.value, 0n);
970
- return this.walletClient.writeContract({
971
- address: this.addresses.COVENANTRouter,
972
- abi: COVENANTRouterABI.abi,
973
- functionName: "multicall",
974
- args: [calls],
975
- value: totalValue,
976
- chain: this.chain,
977
- account: this.account,
978
- });
979
- }
980
- async registerAndCreateTask(agentRegistry, taskEscrow, name, capabilities, worker, payment, deadline, descriptionHash) {
981
- this.requireWallet();
982
- return this.walletClient.writeContract({
983
- address: this.addresses.COVENANTRouter,
984
- abi: COVENANTRouterABI.abi,
985
- functionName: "registerAndCreateTask",
986
- args: [agentRegistry, taskEscrow, name, capabilities, worker, payment, deadline, descriptionHash],
987
- value: payment,
988
- chain: this.chain,
989
- account: this.account,
990
- });
991
- }
992
- }
993
- //# sourceMappingURL=v5-extensions.js.map