@virtuals-protocol/acp-node 0.1.0-beta.8 → 0.2.0-beta-usdc.1
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.
- package/README.md +75 -20
- package/dist/index.d.mts +304 -154
- package/dist/index.d.ts +304 -154
- package/dist/index.js +2034 -345
- package/dist/index.mjs +2043 -349
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
5
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
7
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -14,6 +17,10 @@ var __spreadValues = (a, b) => {
|
|
|
14
17
|
}
|
|
15
18
|
return a;
|
|
16
19
|
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
22
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
23
|
+
};
|
|
17
24
|
var __async = (__this, __arguments, generator) => {
|
|
18
25
|
return new Promise((resolve, reject) => {
|
|
19
26
|
var fulfilled = (value) => {
|
|
@@ -35,34 +42,119 @@ var __async = (__this, __arguments, generator) => {
|
|
|
35
42
|
});
|
|
36
43
|
};
|
|
37
44
|
|
|
45
|
+
// package.json
|
|
46
|
+
var require_package = __commonJS({
|
|
47
|
+
"package.json"(exports, module) {
|
|
48
|
+
module.exports = {
|
|
49
|
+
name: "@virtuals-protocol/acp-node",
|
|
50
|
+
version: "0.1.0-beta-usdc.1",
|
|
51
|
+
main: "./dist/index.js",
|
|
52
|
+
module: "./dist/index.mjs",
|
|
53
|
+
types: "./dist/index.d.ts",
|
|
54
|
+
scripts: {
|
|
55
|
+
test: 'echo "Error: no test specified" && exit 1',
|
|
56
|
+
tsup: "tsup src/index.ts --dts --format cjs,esm --out-dir dist"
|
|
57
|
+
},
|
|
58
|
+
author: "",
|
|
59
|
+
license: "ISC",
|
|
60
|
+
description: "",
|
|
61
|
+
devDependencies: {
|
|
62
|
+
typescript: "^5.8.3"
|
|
63
|
+
},
|
|
64
|
+
dependencies: {
|
|
65
|
+
"@aa-sdk/core": "^4.30.0",
|
|
66
|
+
"@account-kit/infra": "^4.30.0",
|
|
67
|
+
"@account-kit/smart-contracts": "^4.30.0",
|
|
68
|
+
ajv: "^8.17.1",
|
|
69
|
+
"socket.io-client": "^4.8.1",
|
|
70
|
+
tsup: "^8.5.0",
|
|
71
|
+
viem: "^2.28.2"
|
|
72
|
+
},
|
|
73
|
+
files: [
|
|
74
|
+
"dist"
|
|
75
|
+
]
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
38
80
|
// src/acpAbi.ts
|
|
39
81
|
var ACP_ABI = [
|
|
40
|
-
{
|
|
41
|
-
|
|
82
|
+
{
|
|
83
|
+
inputs: [],
|
|
84
|
+
stateMutability: "nonpayable",
|
|
85
|
+
type: "constructor"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
inputs: [],
|
|
89
|
+
name: "AccessControlBadConfirmation",
|
|
90
|
+
type: "error"
|
|
91
|
+
},
|
|
42
92
|
{
|
|
43
93
|
inputs: [
|
|
44
|
-
{
|
|
45
|
-
|
|
94
|
+
{
|
|
95
|
+
internalType: "address",
|
|
96
|
+
name: "account",
|
|
97
|
+
type: "address"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
internalType: "bytes32",
|
|
101
|
+
name: "neededRole",
|
|
102
|
+
type: "bytes32"
|
|
103
|
+
}
|
|
46
104
|
],
|
|
47
105
|
name: "AccessControlUnauthorizedAccount",
|
|
48
106
|
type: "error"
|
|
49
107
|
},
|
|
50
108
|
{
|
|
51
|
-
inputs: [
|
|
109
|
+
inputs: [
|
|
110
|
+
{
|
|
111
|
+
internalType: "address",
|
|
112
|
+
name: "target",
|
|
113
|
+
type: "address"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
52
116
|
name: "AddressEmptyCode",
|
|
53
117
|
type: "error"
|
|
54
118
|
},
|
|
55
119
|
{
|
|
56
|
-
inputs: [
|
|
120
|
+
inputs: [
|
|
121
|
+
{
|
|
122
|
+
internalType: "address",
|
|
123
|
+
name: "account",
|
|
124
|
+
type: "address"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
57
127
|
name: "AddressInsufficientBalance",
|
|
58
128
|
type: "error"
|
|
59
129
|
},
|
|
60
|
-
{ inputs: [], name: "FailedInnerCall", type: "error" },
|
|
61
|
-
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
62
|
-
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
63
|
-
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
|
|
64
130
|
{
|
|
65
|
-
inputs: [
|
|
131
|
+
inputs: [],
|
|
132
|
+
name: "FailedInnerCall",
|
|
133
|
+
type: "error"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
inputs: [],
|
|
137
|
+
name: "InvalidInitialization",
|
|
138
|
+
type: "error"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
inputs: [],
|
|
142
|
+
name: "NotInitializing",
|
|
143
|
+
type: "error"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
inputs: [],
|
|
147
|
+
name: "ReentrancyGuardReentrantCall",
|
|
148
|
+
type: "error"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
inputs: [
|
|
152
|
+
{
|
|
153
|
+
internalType: "address",
|
|
154
|
+
name: "token",
|
|
155
|
+
type: "address"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
66
158
|
name: "SafeERC20FailedOperation",
|
|
67
159
|
type: "error"
|
|
68
160
|
},
|
|
@@ -179,6 +271,25 @@ var ACP_ABI = [
|
|
|
179
271
|
name: "JobCreated",
|
|
180
272
|
type: "event"
|
|
181
273
|
},
|
|
274
|
+
{
|
|
275
|
+
anonymous: false,
|
|
276
|
+
inputs: [
|
|
277
|
+
{
|
|
278
|
+
indexed: true,
|
|
279
|
+
internalType: "uint256",
|
|
280
|
+
name: "jobId",
|
|
281
|
+
type: "uint256"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
indexed: true,
|
|
285
|
+
internalType: "address",
|
|
286
|
+
name: "paymentToken",
|
|
287
|
+
type: "address"
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
name: "JobPaymentTokenSet",
|
|
291
|
+
type: "event"
|
|
292
|
+
},
|
|
182
293
|
{
|
|
183
294
|
anonymous: false,
|
|
184
295
|
inputs: [
|
|
@@ -194,7 +305,12 @@ var ACP_ABI = [
|
|
|
194
305
|
name: "oldPhase",
|
|
195
306
|
type: "uint8"
|
|
196
307
|
},
|
|
197
|
-
{
|
|
308
|
+
{
|
|
309
|
+
indexed: false,
|
|
310
|
+
internalType: "uint8",
|
|
311
|
+
name: "phase",
|
|
312
|
+
type: "uint8"
|
|
313
|
+
}
|
|
198
314
|
],
|
|
199
315
|
name: "JobPhaseUpdated",
|
|
200
316
|
type: "event"
|
|
@@ -244,6 +360,12 @@ var ACP_ABI = [
|
|
|
244
360
|
internalType: "uint256",
|
|
245
361
|
name: "memoId",
|
|
246
362
|
type: "uint256"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
indexed: false,
|
|
366
|
+
internalType: "string",
|
|
367
|
+
name: "content",
|
|
368
|
+
type: "string"
|
|
247
369
|
}
|
|
248
370
|
],
|
|
249
371
|
name: "NewMemo",
|
|
@@ -253,15 +375,21 @@ var ACP_ABI = [
|
|
|
253
375
|
anonymous: false,
|
|
254
376
|
inputs: [
|
|
255
377
|
{
|
|
256
|
-
indexed:
|
|
378
|
+
indexed: true,
|
|
257
379
|
internalType: "uint256",
|
|
258
380
|
name: "jobId",
|
|
259
381
|
type: "uint256"
|
|
260
382
|
},
|
|
383
|
+
{
|
|
384
|
+
indexed: true,
|
|
385
|
+
internalType: "uint256",
|
|
386
|
+
name: "memoId",
|
|
387
|
+
type: "uint256"
|
|
388
|
+
},
|
|
261
389
|
{
|
|
262
390
|
indexed: true,
|
|
263
391
|
internalType: "address",
|
|
264
|
-
name: "
|
|
392
|
+
name: "payer",
|
|
265
393
|
type: "address"
|
|
266
394
|
},
|
|
267
395
|
{
|
|
@@ -271,375 +399,1279 @@ var ACP_ABI = [
|
|
|
271
399
|
type: "uint256"
|
|
272
400
|
}
|
|
273
401
|
],
|
|
274
|
-
name: "
|
|
402
|
+
name: "PayableFeeCollected",
|
|
275
403
|
type: "event"
|
|
276
404
|
},
|
|
277
405
|
{
|
|
278
406
|
anonymous: false,
|
|
279
407
|
inputs: [
|
|
280
|
-
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
281
408
|
{
|
|
282
409
|
indexed: true,
|
|
283
|
-
internalType: "
|
|
284
|
-
name: "
|
|
285
|
-
type: "
|
|
410
|
+
internalType: "uint256",
|
|
411
|
+
name: "jobId",
|
|
412
|
+
type: "uint256"
|
|
286
413
|
},
|
|
287
414
|
{
|
|
288
415
|
indexed: true,
|
|
289
|
-
internalType: "
|
|
290
|
-
name: "
|
|
291
|
-
type: "
|
|
416
|
+
internalType: "uint256",
|
|
417
|
+
name: "memoId",
|
|
418
|
+
type: "uint256"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
indexed: true,
|
|
422
|
+
internalType: "address",
|
|
423
|
+
name: "payer",
|
|
424
|
+
type: "address"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
indexed: false,
|
|
428
|
+
internalType: "address",
|
|
429
|
+
name: "recipient",
|
|
430
|
+
type: "address"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
indexed: false,
|
|
434
|
+
internalType: "uint256",
|
|
435
|
+
name: "netAmount",
|
|
436
|
+
type: "uint256"
|
|
292
437
|
}
|
|
293
438
|
],
|
|
294
|
-
name: "
|
|
439
|
+
name: "PayableFeeRequestExecuted",
|
|
295
440
|
type: "event"
|
|
296
441
|
},
|
|
297
442
|
{
|
|
298
443
|
anonymous: false,
|
|
299
444
|
inputs: [
|
|
300
|
-
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
301
445
|
{
|
|
302
446
|
indexed: true,
|
|
303
|
-
internalType: "
|
|
304
|
-
name: "
|
|
305
|
-
type: "
|
|
447
|
+
internalType: "uint256",
|
|
448
|
+
name: "jobId",
|
|
449
|
+
type: "uint256"
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
indexed: true,
|
|
453
|
+
internalType: "uint256",
|
|
454
|
+
name: "memoId",
|
|
455
|
+
type: "uint256"
|
|
306
456
|
},
|
|
307
457
|
{
|
|
308
458
|
indexed: true,
|
|
309
459
|
internalType: "address",
|
|
310
460
|
name: "sender",
|
|
311
461
|
type: "address"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
indexed: false,
|
|
465
|
+
internalType: "address",
|
|
466
|
+
name: "token",
|
|
467
|
+
type: "address"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
indexed: false,
|
|
471
|
+
internalType: "uint256",
|
|
472
|
+
name: "amount",
|
|
473
|
+
type: "uint256"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
indexed: false,
|
|
477
|
+
internalType: "uint256",
|
|
478
|
+
name: "feeAmount",
|
|
479
|
+
type: "uint256"
|
|
312
480
|
}
|
|
313
481
|
],
|
|
314
|
-
name: "
|
|
482
|
+
name: "PayableFundsEscrowed",
|
|
315
483
|
type: "event"
|
|
316
484
|
},
|
|
317
485
|
{
|
|
318
486
|
anonymous: false,
|
|
319
487
|
inputs: [
|
|
320
|
-
{
|
|
488
|
+
{
|
|
489
|
+
indexed: true,
|
|
490
|
+
internalType: "uint256",
|
|
491
|
+
name: "jobId",
|
|
492
|
+
type: "uint256"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
indexed: true,
|
|
496
|
+
internalType: "uint256",
|
|
497
|
+
name: "memoId",
|
|
498
|
+
type: "uint256"
|
|
499
|
+
},
|
|
321
500
|
{
|
|
322
501
|
indexed: true,
|
|
323
502
|
internalType: "address",
|
|
324
|
-
name: "
|
|
503
|
+
name: "from",
|
|
325
504
|
type: "address"
|
|
326
505
|
},
|
|
327
506
|
{
|
|
328
|
-
indexed:
|
|
507
|
+
indexed: false,
|
|
329
508
|
internalType: "address",
|
|
330
|
-
name: "
|
|
509
|
+
name: "to",
|
|
510
|
+
type: "address"
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
indexed: false,
|
|
514
|
+
internalType: "address",
|
|
515
|
+
name: "token",
|
|
331
516
|
type: "address"
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
indexed: false,
|
|
520
|
+
internalType: "uint256",
|
|
521
|
+
name: "amount",
|
|
522
|
+
type: "uint256"
|
|
332
523
|
}
|
|
333
524
|
],
|
|
334
|
-
name: "
|
|
525
|
+
name: "PayableRequestExecuted",
|
|
335
526
|
type: "event"
|
|
336
527
|
},
|
|
337
528
|
{
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
529
|
+
anonymous: false,
|
|
530
|
+
inputs: [
|
|
531
|
+
{
|
|
532
|
+
indexed: true,
|
|
533
|
+
internalType: "uint256",
|
|
534
|
+
name: "jobId",
|
|
535
|
+
type: "uint256"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
indexed: true,
|
|
539
|
+
internalType: "uint256",
|
|
540
|
+
name: "memoId",
|
|
541
|
+
type: "uint256"
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
indexed: true,
|
|
545
|
+
internalType: "address",
|
|
546
|
+
name: "from",
|
|
547
|
+
type: "address"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
indexed: false,
|
|
551
|
+
internalType: "address",
|
|
552
|
+
name: "to",
|
|
553
|
+
type: "address"
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
indexed: false,
|
|
557
|
+
internalType: "address",
|
|
558
|
+
name: "token",
|
|
559
|
+
type: "address"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
indexed: false,
|
|
563
|
+
internalType: "uint256",
|
|
564
|
+
name: "amount",
|
|
565
|
+
type: "uint256"
|
|
566
|
+
}
|
|
567
|
+
],
|
|
568
|
+
name: "PayableTransferExecuted",
|
|
569
|
+
type: "event"
|
|
350
570
|
},
|
|
351
571
|
{
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
572
|
+
anonymous: false,
|
|
573
|
+
inputs: [
|
|
574
|
+
{
|
|
575
|
+
indexed: true,
|
|
576
|
+
internalType: "uint256",
|
|
577
|
+
name: "jobId",
|
|
578
|
+
type: "uint256"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
indexed: true,
|
|
582
|
+
internalType: "address",
|
|
583
|
+
name: "client",
|
|
584
|
+
type: "address"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
indexed: false,
|
|
588
|
+
internalType: "uint256",
|
|
589
|
+
name: "amount",
|
|
590
|
+
type: "uint256"
|
|
591
|
+
}
|
|
592
|
+
],
|
|
593
|
+
name: "RefundedAdditionalFees",
|
|
594
|
+
type: "event"
|
|
357
595
|
},
|
|
358
596
|
{
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
597
|
+
anonymous: false,
|
|
598
|
+
inputs: [
|
|
599
|
+
{
|
|
600
|
+
indexed: false,
|
|
601
|
+
internalType: "uint256",
|
|
602
|
+
name: "jobId",
|
|
603
|
+
type: "uint256"
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
indexed: true,
|
|
607
|
+
internalType: "address",
|
|
608
|
+
name: "client",
|
|
609
|
+
type: "address"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
indexed: false,
|
|
613
|
+
internalType: "uint256",
|
|
614
|
+
name: "amount",
|
|
615
|
+
type: "uint256"
|
|
616
|
+
}
|
|
617
|
+
],
|
|
618
|
+
name: "RefundedBudget",
|
|
619
|
+
type: "event"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
anonymous: false,
|
|
623
|
+
inputs: [
|
|
624
|
+
{
|
|
625
|
+
indexed: true,
|
|
626
|
+
internalType: "bytes32",
|
|
627
|
+
name: "role",
|
|
628
|
+
type: "bytes32"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
indexed: true,
|
|
632
|
+
internalType: "bytes32",
|
|
633
|
+
name: "previousAdminRole",
|
|
634
|
+
type: "bytes32"
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
indexed: true,
|
|
638
|
+
internalType: "bytes32",
|
|
639
|
+
name: "newAdminRole",
|
|
640
|
+
type: "bytes32"
|
|
641
|
+
}
|
|
642
|
+
],
|
|
643
|
+
name: "RoleAdminChanged",
|
|
644
|
+
type: "event"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
anonymous: false,
|
|
648
|
+
inputs: [
|
|
649
|
+
{
|
|
650
|
+
indexed: true,
|
|
651
|
+
internalType: "bytes32",
|
|
652
|
+
name: "role",
|
|
653
|
+
type: "bytes32"
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
indexed: true,
|
|
657
|
+
internalType: "address",
|
|
658
|
+
name: "account",
|
|
659
|
+
type: "address"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
indexed: true,
|
|
663
|
+
internalType: "address",
|
|
664
|
+
name: "sender",
|
|
665
|
+
type: "address"
|
|
666
|
+
}
|
|
667
|
+
],
|
|
668
|
+
name: "RoleGranted",
|
|
669
|
+
type: "event"
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
anonymous: false,
|
|
673
|
+
inputs: [
|
|
674
|
+
{
|
|
675
|
+
indexed: true,
|
|
676
|
+
internalType: "bytes32",
|
|
677
|
+
name: "role",
|
|
678
|
+
type: "bytes32"
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
indexed: true,
|
|
682
|
+
internalType: "address",
|
|
683
|
+
name: "account",
|
|
684
|
+
type: "address"
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
indexed: true,
|
|
688
|
+
internalType: "address",
|
|
689
|
+
name: "sender",
|
|
690
|
+
type: "address"
|
|
691
|
+
}
|
|
692
|
+
],
|
|
693
|
+
name: "RoleRevoked",
|
|
694
|
+
type: "event"
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
inputs: [],
|
|
698
|
+
name: "ADMIN_ROLE",
|
|
699
|
+
outputs: [
|
|
700
|
+
{
|
|
701
|
+
internalType: "bytes32",
|
|
702
|
+
name: "",
|
|
703
|
+
type: "bytes32"
|
|
704
|
+
}
|
|
705
|
+
],
|
|
706
|
+
stateMutability: "view",
|
|
707
|
+
type: "function"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
inputs: [],
|
|
711
|
+
name: "DEFAULT_ADMIN_ROLE",
|
|
712
|
+
outputs: [
|
|
713
|
+
{
|
|
714
|
+
internalType: "bytes32",
|
|
715
|
+
name: "",
|
|
716
|
+
type: "bytes32"
|
|
717
|
+
}
|
|
718
|
+
],
|
|
719
|
+
stateMutability: "view",
|
|
720
|
+
type: "function"
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
inputs: [],
|
|
724
|
+
name: "PHASE_COMPLETED",
|
|
725
|
+
outputs: [
|
|
726
|
+
{
|
|
727
|
+
internalType: "uint8",
|
|
728
|
+
name: "",
|
|
729
|
+
type: "uint8"
|
|
730
|
+
}
|
|
731
|
+
],
|
|
732
|
+
stateMutability: "view",
|
|
733
|
+
type: "function"
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
inputs: [],
|
|
737
|
+
name: "PHASE_EVALUATION",
|
|
738
|
+
outputs: [
|
|
739
|
+
{
|
|
740
|
+
internalType: "uint8",
|
|
741
|
+
name: "",
|
|
742
|
+
type: "uint8"
|
|
743
|
+
}
|
|
744
|
+
],
|
|
745
|
+
stateMutability: "view",
|
|
746
|
+
type: "function"
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
inputs: [],
|
|
750
|
+
name: "PHASE_EXPIRED",
|
|
751
|
+
outputs: [
|
|
752
|
+
{
|
|
753
|
+
internalType: "uint8",
|
|
754
|
+
name: "",
|
|
755
|
+
type: "uint8"
|
|
756
|
+
}
|
|
757
|
+
],
|
|
362
758
|
stateMutability: "view",
|
|
363
759
|
type: "function"
|
|
364
760
|
},
|
|
365
761
|
{
|
|
366
762
|
inputs: [],
|
|
367
763
|
name: "PHASE_NEGOTIATION",
|
|
368
|
-
outputs: [
|
|
764
|
+
outputs: [
|
|
765
|
+
{
|
|
766
|
+
internalType: "uint8",
|
|
767
|
+
name: "",
|
|
768
|
+
type: "uint8"
|
|
769
|
+
}
|
|
770
|
+
],
|
|
369
771
|
stateMutability: "view",
|
|
370
772
|
type: "function"
|
|
371
773
|
},
|
|
372
774
|
{
|
|
373
775
|
inputs: [],
|
|
374
776
|
name: "PHASE_REJECTED",
|
|
375
|
-
outputs: [
|
|
777
|
+
outputs: [
|
|
778
|
+
{
|
|
779
|
+
internalType: "uint8",
|
|
780
|
+
name: "",
|
|
781
|
+
type: "uint8"
|
|
782
|
+
}
|
|
783
|
+
],
|
|
376
784
|
stateMutability: "view",
|
|
377
785
|
type: "function"
|
|
378
786
|
},
|
|
379
787
|
{
|
|
380
788
|
inputs: [],
|
|
381
789
|
name: "PHASE_REQUEST",
|
|
382
|
-
outputs: [
|
|
790
|
+
outputs: [
|
|
791
|
+
{
|
|
792
|
+
internalType: "uint8",
|
|
793
|
+
name: "",
|
|
794
|
+
type: "uint8"
|
|
795
|
+
}
|
|
796
|
+
],
|
|
383
797
|
stateMutability: "view",
|
|
384
798
|
type: "function"
|
|
385
799
|
},
|
|
386
800
|
{
|
|
387
801
|
inputs: [],
|
|
388
802
|
name: "PHASE_TRANSACTION",
|
|
389
|
-
outputs: [
|
|
803
|
+
outputs: [
|
|
804
|
+
{
|
|
805
|
+
internalType: "uint8",
|
|
806
|
+
name: "",
|
|
807
|
+
type: "uint8"
|
|
808
|
+
}
|
|
809
|
+
],
|
|
810
|
+
stateMutability: "view",
|
|
811
|
+
type: "function"
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
inputs: [],
|
|
815
|
+
name: "TOTAL_PHASES",
|
|
816
|
+
outputs: [
|
|
817
|
+
{
|
|
818
|
+
internalType: "uint8",
|
|
819
|
+
name: "",
|
|
820
|
+
type: "uint8"
|
|
821
|
+
}
|
|
822
|
+
],
|
|
823
|
+
stateMutability: "view",
|
|
824
|
+
type: "function"
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
inputs: [
|
|
828
|
+
{
|
|
829
|
+
internalType: "address",
|
|
830
|
+
name: "account",
|
|
831
|
+
type: "address"
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
components: [
|
|
835
|
+
{
|
|
836
|
+
internalType: "uint256",
|
|
837
|
+
name: "id",
|
|
838
|
+
type: "uint256"
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
internalType: "address",
|
|
842
|
+
name: "client",
|
|
843
|
+
type: "address"
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
internalType: "address",
|
|
847
|
+
name: "provider",
|
|
848
|
+
type: "address"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
internalType: "uint256",
|
|
852
|
+
name: "budget",
|
|
853
|
+
type: "uint256"
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
internalType: "uint256",
|
|
857
|
+
name: "amountClaimed",
|
|
858
|
+
type: "uint256"
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
internalType: "uint8",
|
|
862
|
+
name: "phase",
|
|
863
|
+
type: "uint8"
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
internalType: "uint256",
|
|
867
|
+
name: "memoCount",
|
|
868
|
+
type: "uint256"
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
internalType: "uint256",
|
|
872
|
+
name: "expiredAt",
|
|
873
|
+
type: "uint256"
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
internalType: "address",
|
|
877
|
+
name: "evaluator",
|
|
878
|
+
type: "address"
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
internalType: "contract IERC20",
|
|
882
|
+
name: "jobPaymentToken",
|
|
883
|
+
type: "address"
|
|
884
|
+
}
|
|
885
|
+
],
|
|
886
|
+
internalType: "struct ACPSimple.Job",
|
|
887
|
+
name: "job",
|
|
888
|
+
type: "tuple"
|
|
889
|
+
}
|
|
890
|
+
],
|
|
891
|
+
name: "canSign",
|
|
892
|
+
outputs: [
|
|
893
|
+
{
|
|
894
|
+
internalType: "bool",
|
|
895
|
+
name: "",
|
|
896
|
+
type: "bool"
|
|
897
|
+
}
|
|
898
|
+
],
|
|
899
|
+
stateMutability: "pure",
|
|
900
|
+
type: "function"
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
inputs: [
|
|
904
|
+
{
|
|
905
|
+
internalType: "uint256",
|
|
906
|
+
name: "id",
|
|
907
|
+
type: "uint256"
|
|
908
|
+
}
|
|
909
|
+
],
|
|
910
|
+
name: "claimBudget",
|
|
911
|
+
outputs: [],
|
|
912
|
+
stateMutability: "nonpayable",
|
|
913
|
+
type: "function"
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
inputs: [
|
|
917
|
+
{
|
|
918
|
+
internalType: "address",
|
|
919
|
+
name: "provider",
|
|
920
|
+
type: "address"
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
internalType: "address",
|
|
924
|
+
name: "evaluator",
|
|
925
|
+
type: "address"
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
internalType: "uint256",
|
|
929
|
+
name: "expiredAt",
|
|
930
|
+
type: "uint256"
|
|
931
|
+
}
|
|
932
|
+
],
|
|
933
|
+
name: "createJob",
|
|
934
|
+
outputs: [
|
|
935
|
+
{
|
|
936
|
+
internalType: "uint256",
|
|
937
|
+
name: "",
|
|
938
|
+
type: "uint256"
|
|
939
|
+
}
|
|
940
|
+
],
|
|
941
|
+
stateMutability: "nonpayable",
|
|
942
|
+
type: "function"
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
inputs: [
|
|
946
|
+
{
|
|
947
|
+
internalType: "uint256",
|
|
948
|
+
name: "jobId",
|
|
949
|
+
type: "uint256"
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
internalType: "string",
|
|
953
|
+
name: "content",
|
|
954
|
+
type: "string"
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
internalType: "enum InteractionLedger.MemoType",
|
|
958
|
+
name: "memoType",
|
|
959
|
+
type: "uint8"
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
internalType: "bool",
|
|
963
|
+
name: "isSecured",
|
|
964
|
+
type: "bool"
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
internalType: "uint8",
|
|
968
|
+
name: "nextPhase",
|
|
969
|
+
type: "uint8"
|
|
970
|
+
}
|
|
971
|
+
],
|
|
972
|
+
name: "createMemo",
|
|
973
|
+
outputs: [
|
|
974
|
+
{
|
|
975
|
+
internalType: "uint256",
|
|
976
|
+
name: "",
|
|
977
|
+
type: "uint256"
|
|
978
|
+
}
|
|
979
|
+
],
|
|
980
|
+
stateMutability: "nonpayable",
|
|
981
|
+
type: "function"
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
inputs: [
|
|
985
|
+
{
|
|
986
|
+
internalType: "uint256",
|
|
987
|
+
name: "jobId",
|
|
988
|
+
type: "uint256"
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
internalType: "string",
|
|
992
|
+
name: "content",
|
|
993
|
+
type: "string"
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
internalType: "address",
|
|
997
|
+
name: "token",
|
|
998
|
+
type: "address"
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
internalType: "uint256",
|
|
1002
|
+
name: "amount",
|
|
1003
|
+
type: "uint256"
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
internalType: "address",
|
|
1007
|
+
name: "recipient",
|
|
1008
|
+
type: "address"
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
internalType: "uint256",
|
|
1012
|
+
name: "feeAmount",
|
|
1013
|
+
type: "uint256"
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
internalType: "enum ACPSimple.FeeType",
|
|
1017
|
+
name: "feeType",
|
|
1018
|
+
type: "uint8"
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
internalType: "enum InteractionLedger.MemoType",
|
|
1022
|
+
name: "memoType",
|
|
1023
|
+
type: "uint8"
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
internalType: "uint8",
|
|
1027
|
+
name: "nextPhase",
|
|
1028
|
+
type: "uint8"
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
internalType: "uint256",
|
|
1032
|
+
name: "expiredAt",
|
|
1033
|
+
type: "uint256"
|
|
1034
|
+
}
|
|
1035
|
+
],
|
|
1036
|
+
name: "createPayableMemo",
|
|
1037
|
+
outputs: [
|
|
1038
|
+
{
|
|
1039
|
+
internalType: "uint256",
|
|
1040
|
+
name: "",
|
|
1041
|
+
type: "uint256"
|
|
1042
|
+
}
|
|
1043
|
+
],
|
|
1044
|
+
stateMutability: "nonpayable",
|
|
1045
|
+
type: "function"
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
inputs: [],
|
|
1049
|
+
name: "evaluatorFeeBP",
|
|
1050
|
+
outputs: [
|
|
1051
|
+
{
|
|
1052
|
+
internalType: "uint256",
|
|
1053
|
+
name: "",
|
|
1054
|
+
type: "uint256"
|
|
1055
|
+
}
|
|
1056
|
+
],
|
|
1057
|
+
stateMutability: "view",
|
|
1058
|
+
type: "function"
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
inputs: [
|
|
1062
|
+
{
|
|
1063
|
+
internalType: "uint256",
|
|
1064
|
+
name: "jobId",
|
|
1065
|
+
type: "uint256"
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
internalType: "uint256",
|
|
1069
|
+
name: "offset",
|
|
1070
|
+
type: "uint256"
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
internalType: "uint256",
|
|
1074
|
+
name: "limit",
|
|
1075
|
+
type: "uint256"
|
|
1076
|
+
}
|
|
1077
|
+
],
|
|
1078
|
+
name: "getAllMemos",
|
|
1079
|
+
outputs: [
|
|
1080
|
+
{
|
|
1081
|
+
components: [
|
|
1082
|
+
{
|
|
1083
|
+
internalType: "string",
|
|
1084
|
+
name: "content",
|
|
1085
|
+
type: "string"
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
internalType: "enum InteractionLedger.MemoType",
|
|
1089
|
+
name: "memoType",
|
|
1090
|
+
type: "uint8"
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
internalType: "bool",
|
|
1094
|
+
name: "isSecured",
|
|
1095
|
+
type: "bool"
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
internalType: "uint8",
|
|
1099
|
+
name: "nextPhase",
|
|
1100
|
+
type: "uint8"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
internalType: "uint256",
|
|
1104
|
+
name: "jobId",
|
|
1105
|
+
type: "uint256"
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
internalType: "address",
|
|
1109
|
+
name: "sender",
|
|
1110
|
+
type: "address"
|
|
1111
|
+
}
|
|
1112
|
+
],
|
|
1113
|
+
internalType: "struct InteractionLedger.Memo[]",
|
|
1114
|
+
name: "",
|
|
1115
|
+
type: "tuple[]"
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
internalType: "uint256",
|
|
1119
|
+
name: "total",
|
|
1120
|
+
type: "uint256"
|
|
1121
|
+
}
|
|
1122
|
+
],
|
|
1123
|
+
stateMutability: "view",
|
|
1124
|
+
type: "function"
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
inputs: [
|
|
1128
|
+
{
|
|
1129
|
+
internalType: "uint256",
|
|
1130
|
+
name: "jobId",
|
|
1131
|
+
type: "uint256"
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
internalType: "uint8",
|
|
1135
|
+
name: "phase",
|
|
1136
|
+
type: "uint8"
|
|
1137
|
+
}
|
|
1138
|
+
],
|
|
1139
|
+
name: "getJobPhaseMemoIds",
|
|
1140
|
+
outputs: [
|
|
1141
|
+
{
|
|
1142
|
+
internalType: "uint256[]",
|
|
1143
|
+
name: "",
|
|
1144
|
+
type: "uint256[]"
|
|
1145
|
+
}
|
|
1146
|
+
],
|
|
1147
|
+
stateMutability: "view",
|
|
1148
|
+
type: "function"
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
inputs: [
|
|
1152
|
+
{
|
|
1153
|
+
internalType: "uint256",
|
|
1154
|
+
name: "jobId",
|
|
1155
|
+
type: "uint256"
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
internalType: "uint8",
|
|
1159
|
+
name: "phase",
|
|
1160
|
+
type: "uint8"
|
|
1161
|
+
},
|
|
1162
|
+
{
|
|
1163
|
+
internalType: "uint256",
|
|
1164
|
+
name: "offset",
|
|
1165
|
+
type: "uint256"
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
internalType: "uint256",
|
|
1169
|
+
name: "limit",
|
|
1170
|
+
type: "uint256"
|
|
1171
|
+
}
|
|
1172
|
+
],
|
|
1173
|
+
name: "getMemosForPhase",
|
|
1174
|
+
outputs: [
|
|
1175
|
+
{
|
|
1176
|
+
components: [
|
|
1177
|
+
{
|
|
1178
|
+
internalType: "string",
|
|
1179
|
+
name: "content",
|
|
1180
|
+
type: "string"
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
internalType: "enum InteractionLedger.MemoType",
|
|
1184
|
+
name: "memoType",
|
|
1185
|
+
type: "uint8"
|
|
1186
|
+
},
|
|
1187
|
+
{
|
|
1188
|
+
internalType: "bool",
|
|
1189
|
+
name: "isSecured",
|
|
1190
|
+
type: "bool"
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
internalType: "uint8",
|
|
1194
|
+
name: "nextPhase",
|
|
1195
|
+
type: "uint8"
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
internalType: "uint256",
|
|
1199
|
+
name: "jobId",
|
|
1200
|
+
type: "uint256"
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
internalType: "address",
|
|
1204
|
+
name: "sender",
|
|
1205
|
+
type: "address"
|
|
1206
|
+
}
|
|
1207
|
+
],
|
|
1208
|
+
internalType: "struct InteractionLedger.Memo[]",
|
|
1209
|
+
name: "",
|
|
1210
|
+
type: "tuple[]"
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
internalType: "uint256",
|
|
1214
|
+
name: "total",
|
|
1215
|
+
type: "uint256"
|
|
1216
|
+
}
|
|
1217
|
+
],
|
|
390
1218
|
stateMutability: "view",
|
|
391
1219
|
type: "function"
|
|
392
1220
|
},
|
|
393
1221
|
{
|
|
394
1222
|
inputs: [],
|
|
395
|
-
name: "
|
|
396
|
-
outputs: [
|
|
397
|
-
|
|
1223
|
+
name: "getPhases",
|
|
1224
|
+
outputs: [
|
|
1225
|
+
{
|
|
1226
|
+
internalType: "string[7]",
|
|
1227
|
+
name: "",
|
|
1228
|
+
type: "string[7]"
|
|
1229
|
+
}
|
|
1230
|
+
],
|
|
1231
|
+
stateMutability: "pure",
|
|
398
1232
|
type: "function"
|
|
399
1233
|
},
|
|
400
1234
|
{
|
|
401
1235
|
inputs: [
|
|
402
|
-
{
|
|
403
|
-
|
|
1236
|
+
{
|
|
1237
|
+
internalType: "bytes32",
|
|
1238
|
+
name: "role",
|
|
1239
|
+
type: "bytes32"
|
|
1240
|
+
}
|
|
1241
|
+
],
|
|
1242
|
+
name: "getRoleAdmin",
|
|
1243
|
+
outputs: [
|
|
1244
|
+
{
|
|
1245
|
+
internalType: "bytes32",
|
|
1246
|
+
name: "",
|
|
1247
|
+
type: "bytes32"
|
|
1248
|
+
}
|
|
404
1249
|
],
|
|
405
|
-
name: "canSign",
|
|
406
|
-
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
407
1250
|
stateMutability: "view",
|
|
408
1251
|
type: "function"
|
|
409
1252
|
},
|
|
410
1253
|
{
|
|
411
|
-
inputs: [
|
|
412
|
-
|
|
1254
|
+
inputs: [
|
|
1255
|
+
{
|
|
1256
|
+
internalType: "bytes32",
|
|
1257
|
+
name: "role",
|
|
1258
|
+
type: "bytes32"
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
internalType: "address",
|
|
1262
|
+
name: "account",
|
|
1263
|
+
type: "address"
|
|
1264
|
+
}
|
|
1265
|
+
],
|
|
1266
|
+
name: "grantRole",
|
|
413
1267
|
outputs: [],
|
|
414
1268
|
stateMutability: "nonpayable",
|
|
415
1269
|
type: "function"
|
|
416
1270
|
},
|
|
417
1271
|
{
|
|
418
1272
|
inputs: [
|
|
419
|
-
{
|
|
420
|
-
|
|
421
|
-
|
|
1273
|
+
{
|
|
1274
|
+
internalType: "bytes32",
|
|
1275
|
+
name: "role",
|
|
1276
|
+
type: "bytes32"
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
internalType: "address",
|
|
1280
|
+
name: "account",
|
|
1281
|
+
type: "address"
|
|
1282
|
+
}
|
|
422
1283
|
],
|
|
423
|
-
name: "
|
|
424
|
-
outputs: [
|
|
425
|
-
|
|
1284
|
+
name: "hasRole",
|
|
1285
|
+
outputs: [
|
|
1286
|
+
{
|
|
1287
|
+
internalType: "bool",
|
|
1288
|
+
name: "",
|
|
1289
|
+
type: "bool"
|
|
1290
|
+
}
|
|
1291
|
+
],
|
|
1292
|
+
stateMutability: "view",
|
|
426
1293
|
type: "function"
|
|
427
1294
|
},
|
|
428
1295
|
{
|
|
429
1296
|
inputs: [
|
|
430
|
-
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
431
|
-
{ internalType: "string", name: "content", type: "string" },
|
|
432
1297
|
{
|
|
433
|
-
internalType: "
|
|
434
|
-
name: "
|
|
435
|
-
type: "
|
|
1298
|
+
internalType: "address",
|
|
1299
|
+
name: "paymentTokenAddress",
|
|
1300
|
+
type: "address"
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
internalType: "uint256",
|
|
1304
|
+
name: "evaluatorFeeBP_",
|
|
1305
|
+
type: "uint256"
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
internalType: "uint256",
|
|
1309
|
+
name: "platformFeeBP_",
|
|
1310
|
+
type: "uint256"
|
|
436
1311
|
},
|
|
437
|
-
{
|
|
438
|
-
|
|
1312
|
+
{
|
|
1313
|
+
internalType: "address",
|
|
1314
|
+
name: "platformTreasury_",
|
|
1315
|
+
type: "address"
|
|
1316
|
+
}
|
|
439
1317
|
],
|
|
440
|
-
name: "
|
|
441
|
-
outputs: [
|
|
1318
|
+
name: "initialize",
|
|
1319
|
+
outputs: [],
|
|
442
1320
|
stateMutability: "nonpayable",
|
|
443
1321
|
type: "function"
|
|
444
1322
|
},
|
|
445
1323
|
{
|
|
446
|
-
inputs: [
|
|
447
|
-
|
|
448
|
-
|
|
1324
|
+
inputs: [
|
|
1325
|
+
{
|
|
1326
|
+
internalType: "uint256",
|
|
1327
|
+
name: "jobId",
|
|
1328
|
+
type: "uint256"
|
|
1329
|
+
},
|
|
1330
|
+
{
|
|
1331
|
+
internalType: "address",
|
|
1332
|
+
name: "account",
|
|
1333
|
+
type: "address"
|
|
1334
|
+
}
|
|
1335
|
+
],
|
|
1336
|
+
name: "isJobEvaluator",
|
|
1337
|
+
outputs: [
|
|
1338
|
+
{
|
|
1339
|
+
internalType: "bool",
|
|
1340
|
+
name: "",
|
|
1341
|
+
type: "bool"
|
|
1342
|
+
}
|
|
1343
|
+
],
|
|
449
1344
|
stateMutability: "view",
|
|
450
1345
|
type: "function"
|
|
451
1346
|
},
|
|
452
1347
|
{
|
|
453
1348
|
inputs: [
|
|
454
|
-
{
|
|
455
|
-
|
|
456
|
-
|
|
1349
|
+
{
|
|
1350
|
+
internalType: "uint256",
|
|
1351
|
+
name: "memoId",
|
|
1352
|
+
type: "uint256"
|
|
1353
|
+
}
|
|
457
1354
|
],
|
|
458
|
-
name: "
|
|
1355
|
+
name: "isPayableMemo",
|
|
459
1356
|
outputs: [
|
|
460
1357
|
{
|
|
461
|
-
|
|
462
|
-
{ internalType: "string", name: "content", type: "string" },
|
|
463
|
-
{
|
|
464
|
-
internalType: "enum InteractionLedger.MemoType",
|
|
465
|
-
name: "memoType",
|
|
466
|
-
type: "uint8"
|
|
467
|
-
},
|
|
468
|
-
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
469
|
-
{ internalType: "uint8", name: "nextPhase", type: "uint8" },
|
|
470
|
-
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
471
|
-
{ internalType: "address", name: "sender", type: "address" }
|
|
472
|
-
],
|
|
473
|
-
internalType: "struct InteractionLedger.Memo[]",
|
|
1358
|
+
internalType: "bool",
|
|
474
1359
|
name: "",
|
|
475
|
-
type: "
|
|
476
|
-
}
|
|
477
|
-
{ internalType: "uint256", name: "total", type: "uint256" }
|
|
1360
|
+
type: "bool"
|
|
1361
|
+
}
|
|
478
1362
|
],
|
|
479
1363
|
stateMutability: "view",
|
|
480
1364
|
type: "function"
|
|
481
1365
|
},
|
|
482
1366
|
{
|
|
483
1367
|
inputs: [
|
|
484
|
-
{
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
1368
|
+
{
|
|
1369
|
+
internalType: "uint256",
|
|
1370
|
+
name: "jobId",
|
|
1371
|
+
type: "uint256"
|
|
1372
|
+
}
|
|
488
1373
|
],
|
|
489
|
-
name: "
|
|
1374
|
+
name: "jobAdditionalFees",
|
|
490
1375
|
outputs: [
|
|
491
1376
|
{
|
|
492
|
-
|
|
493
|
-
{ internalType: "string", name: "content", type: "string" },
|
|
494
|
-
{
|
|
495
|
-
internalType: "enum InteractionLedger.MemoType",
|
|
496
|
-
name: "memoType",
|
|
497
|
-
type: "uint8"
|
|
498
|
-
},
|
|
499
|
-
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
500
|
-
{ internalType: "uint8", name: "nextPhase", type: "uint8" },
|
|
501
|
-
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
502
|
-
{ internalType: "address", name: "sender", type: "address" }
|
|
503
|
-
],
|
|
504
|
-
internalType: "struct InteractionLedger.Memo[]",
|
|
1377
|
+
internalType: "uint256",
|
|
505
1378
|
name: "",
|
|
506
|
-
type: "
|
|
507
|
-
}
|
|
508
|
-
{ internalType: "uint256", name: "total", type: "uint256" }
|
|
1379
|
+
type: "uint256"
|
|
1380
|
+
}
|
|
509
1381
|
],
|
|
510
1382
|
stateMutability: "view",
|
|
511
1383
|
type: "function"
|
|
512
1384
|
},
|
|
513
1385
|
{
|
|
514
1386
|
inputs: [],
|
|
515
|
-
name: "
|
|
516
|
-
outputs: [
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
1387
|
+
name: "jobCounter",
|
|
1388
|
+
outputs: [
|
|
1389
|
+
{
|
|
1390
|
+
internalType: "uint256",
|
|
1391
|
+
name: "",
|
|
1392
|
+
type: "uint256"
|
|
1393
|
+
}
|
|
1394
|
+
],
|
|
524
1395
|
stateMutability: "view",
|
|
525
1396
|
type: "function"
|
|
526
1397
|
},
|
|
527
1398
|
{
|
|
528
1399
|
inputs: [
|
|
529
|
-
{
|
|
530
|
-
|
|
1400
|
+
{
|
|
1401
|
+
internalType: "uint256",
|
|
1402
|
+
name: "jobId",
|
|
1403
|
+
type: "uint256"
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
internalType: "uint8",
|
|
1407
|
+
name: "phase",
|
|
1408
|
+
type: "uint8"
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
internalType: "uint256",
|
|
1412
|
+
name: "",
|
|
1413
|
+
type: "uint256"
|
|
1414
|
+
}
|
|
531
1415
|
],
|
|
532
|
-
name: "
|
|
533
|
-
outputs: [
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
540
|
-
{ internalType: "address", name: "account", type: "address" }
|
|
1416
|
+
name: "jobMemoIds",
|
|
1417
|
+
outputs: [
|
|
1418
|
+
{
|
|
1419
|
+
internalType: "uint256",
|
|
1420
|
+
name: "memoIds",
|
|
1421
|
+
type: "uint256"
|
|
1422
|
+
}
|
|
541
1423
|
],
|
|
542
|
-
name: "hasRole",
|
|
543
|
-
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
544
1424
|
stateMutability: "view",
|
|
545
1425
|
type: "function"
|
|
546
1426
|
},
|
|
547
1427
|
{
|
|
548
1428
|
inputs: [
|
|
549
|
-
{
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
1429
|
+
{
|
|
1430
|
+
internalType: "uint256",
|
|
1431
|
+
name: "",
|
|
1432
|
+
type: "uint256"
|
|
1433
|
+
}
|
|
553
1434
|
],
|
|
554
|
-
name: "
|
|
555
|
-
outputs: [
|
|
556
|
-
|
|
1435
|
+
name: "jobs",
|
|
1436
|
+
outputs: [
|
|
1437
|
+
{
|
|
1438
|
+
internalType: "uint256",
|
|
1439
|
+
name: "id",
|
|
1440
|
+
type: "uint256"
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
internalType: "address",
|
|
1444
|
+
name: "client",
|
|
1445
|
+
type: "address"
|
|
1446
|
+
},
|
|
1447
|
+
{
|
|
1448
|
+
internalType: "address",
|
|
1449
|
+
name: "provider",
|
|
1450
|
+
type: "address"
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
internalType: "uint256",
|
|
1454
|
+
name: "budget",
|
|
1455
|
+
type: "uint256"
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
internalType: "uint256",
|
|
1459
|
+
name: "amountClaimed",
|
|
1460
|
+
type: "uint256"
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
internalType: "uint8",
|
|
1464
|
+
name: "phase",
|
|
1465
|
+
type: "uint8"
|
|
1466
|
+
},
|
|
1467
|
+
{
|
|
1468
|
+
internalType: "uint256",
|
|
1469
|
+
name: "memoCount",
|
|
1470
|
+
type: "uint256"
|
|
1471
|
+
},
|
|
1472
|
+
{
|
|
1473
|
+
internalType: "uint256",
|
|
1474
|
+
name: "expiredAt",
|
|
1475
|
+
type: "uint256"
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
internalType: "address",
|
|
1479
|
+
name: "evaluator",
|
|
1480
|
+
type: "address"
|
|
1481
|
+
},
|
|
1482
|
+
{
|
|
1483
|
+
internalType: "contract IERC20",
|
|
1484
|
+
name: "jobPaymentToken",
|
|
1485
|
+
type: "address"
|
|
1486
|
+
}
|
|
1487
|
+
],
|
|
1488
|
+
stateMutability: "view",
|
|
557
1489
|
type: "function"
|
|
558
1490
|
},
|
|
559
1491
|
{
|
|
560
|
-
inputs: [
|
|
561
|
-
|
|
562
|
-
|
|
1492
|
+
inputs: [],
|
|
1493
|
+
name: "memoCounter",
|
|
1494
|
+
outputs: [
|
|
1495
|
+
{
|
|
1496
|
+
internalType: "uint256",
|
|
1497
|
+
name: "",
|
|
1498
|
+
type: "uint256"
|
|
1499
|
+
}
|
|
563
1500
|
],
|
|
564
|
-
name: "isJobEvaluator",
|
|
565
|
-
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
566
|
-
stateMutability: "view",
|
|
567
|
-
type: "function"
|
|
568
|
-
},
|
|
569
|
-
{
|
|
570
|
-
inputs: [],
|
|
571
|
-
name: "jobCounter",
|
|
572
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
573
1501
|
stateMutability: "view",
|
|
574
1502
|
type: "function"
|
|
575
1503
|
},
|
|
576
1504
|
{
|
|
577
1505
|
inputs: [
|
|
578
|
-
{
|
|
579
|
-
|
|
580
|
-
|
|
1506
|
+
{
|
|
1507
|
+
internalType: "uint256",
|
|
1508
|
+
name: "memoId",
|
|
1509
|
+
type: "uint256"
|
|
1510
|
+
}
|
|
1511
|
+
],
|
|
1512
|
+
name: "memoExpiredAt",
|
|
1513
|
+
outputs: [
|
|
1514
|
+
{
|
|
1515
|
+
internalType: "uint256",
|
|
1516
|
+
name: "expiredAt",
|
|
1517
|
+
type: "uint256"
|
|
1518
|
+
}
|
|
581
1519
|
],
|
|
582
|
-
name: "jobMemoIds",
|
|
583
|
-
outputs: [{ internalType: "uint256", name: "memoIds", type: "uint256" }],
|
|
584
1520
|
stateMutability: "view",
|
|
585
1521
|
type: "function"
|
|
586
1522
|
},
|
|
587
1523
|
{
|
|
588
|
-
inputs: [
|
|
589
|
-
|
|
1524
|
+
inputs: [
|
|
1525
|
+
{
|
|
1526
|
+
internalType: "uint256",
|
|
1527
|
+
name: "",
|
|
1528
|
+
type: "uint256"
|
|
1529
|
+
}
|
|
1530
|
+
],
|
|
1531
|
+
name: "memos",
|
|
590
1532
|
outputs: [
|
|
591
|
-
{
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
{
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
1533
|
+
{
|
|
1534
|
+
internalType: "string",
|
|
1535
|
+
name: "content",
|
|
1536
|
+
type: "string"
|
|
1537
|
+
},
|
|
1538
|
+
{
|
|
1539
|
+
internalType: "enum InteractionLedger.MemoType",
|
|
1540
|
+
name: "memoType",
|
|
1541
|
+
type: "uint8"
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
internalType: "bool",
|
|
1545
|
+
name: "isSecured",
|
|
1546
|
+
type: "bool"
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
internalType: "uint8",
|
|
1550
|
+
name: "nextPhase",
|
|
1551
|
+
type: "uint8"
|
|
1552
|
+
},
|
|
1553
|
+
{
|
|
1554
|
+
internalType: "uint256",
|
|
1555
|
+
name: "jobId",
|
|
1556
|
+
type: "uint256"
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
internalType: "address",
|
|
1560
|
+
name: "sender",
|
|
1561
|
+
type: "address"
|
|
1562
|
+
}
|
|
600
1563
|
],
|
|
601
1564
|
stateMutability: "view",
|
|
602
1565
|
type: "function"
|
|
603
1566
|
},
|
|
604
1567
|
{
|
|
605
1568
|
inputs: [],
|
|
606
|
-
name: "
|
|
607
|
-
outputs: [
|
|
1569
|
+
name: "numEvaluatorsPerJob",
|
|
1570
|
+
outputs: [
|
|
1571
|
+
{
|
|
1572
|
+
internalType: "uint8",
|
|
1573
|
+
name: "",
|
|
1574
|
+
type: "uint8"
|
|
1575
|
+
}
|
|
1576
|
+
],
|
|
608
1577
|
stateMutability: "view",
|
|
609
1578
|
type: "function"
|
|
610
1579
|
},
|
|
611
1580
|
{
|
|
612
|
-
inputs: [
|
|
613
|
-
|
|
614
|
-
|
|
1581
|
+
inputs: [
|
|
1582
|
+
{
|
|
1583
|
+
internalType: "uint256",
|
|
1584
|
+
name: "memoId",
|
|
1585
|
+
type: "uint256"
|
|
1586
|
+
}
|
|
1587
|
+
],
|
|
1588
|
+
name: "payableDetails",
|
|
1589
|
+
outputs: [
|
|
1590
|
+
{
|
|
1591
|
+
internalType: "address",
|
|
1592
|
+
name: "token",
|
|
1593
|
+
type: "address"
|
|
1594
|
+
},
|
|
1595
|
+
{
|
|
1596
|
+
internalType: "uint256",
|
|
1597
|
+
name: "amount",
|
|
1598
|
+
type: "uint256"
|
|
1599
|
+
},
|
|
1600
|
+
{
|
|
1601
|
+
internalType: "address",
|
|
1602
|
+
name: "recipient",
|
|
1603
|
+
type: "address"
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
internalType: "uint256",
|
|
1607
|
+
name: "feeAmount",
|
|
1608
|
+
type: "uint256"
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
internalType: "enum ACPSimple.FeeType",
|
|
1612
|
+
name: "feeType",
|
|
1613
|
+
type: "uint8"
|
|
1614
|
+
},
|
|
1615
|
+
{
|
|
1616
|
+
internalType: "bool",
|
|
1617
|
+
name: "isExecuted",
|
|
1618
|
+
type: "bool"
|
|
1619
|
+
}
|
|
1620
|
+
],
|
|
615
1621
|
stateMutability: "view",
|
|
616
1622
|
type: "function"
|
|
617
1623
|
},
|
|
618
1624
|
{
|
|
619
1625
|
inputs: [],
|
|
620
1626
|
name: "paymentToken",
|
|
621
|
-
outputs: [
|
|
1627
|
+
outputs: [
|
|
1628
|
+
{
|
|
1629
|
+
internalType: "contract IERC20",
|
|
1630
|
+
name: "",
|
|
1631
|
+
type: "address"
|
|
1632
|
+
}
|
|
1633
|
+
],
|
|
622
1634
|
stateMutability: "view",
|
|
623
1635
|
type: "function"
|
|
624
1636
|
},
|
|
625
1637
|
{
|
|
626
1638
|
inputs: [],
|
|
627
1639
|
name: "platformFeeBP",
|
|
628
|
-
outputs: [
|
|
1640
|
+
outputs: [
|
|
1641
|
+
{
|
|
1642
|
+
internalType: "uint256",
|
|
1643
|
+
name: "",
|
|
1644
|
+
type: "uint256"
|
|
1645
|
+
}
|
|
1646
|
+
],
|
|
629
1647
|
stateMutability: "view",
|
|
630
1648
|
type: "function"
|
|
631
1649
|
},
|
|
632
1650
|
{
|
|
633
1651
|
inputs: [],
|
|
634
1652
|
name: "platformTreasury",
|
|
635
|
-
outputs: [
|
|
1653
|
+
outputs: [
|
|
1654
|
+
{
|
|
1655
|
+
internalType: "address",
|
|
1656
|
+
name: "",
|
|
1657
|
+
type: "address"
|
|
1658
|
+
}
|
|
1659
|
+
],
|
|
636
1660
|
stateMutability: "view",
|
|
637
1661
|
type: "function"
|
|
638
1662
|
},
|
|
639
1663
|
{
|
|
640
1664
|
inputs: [
|
|
641
|
-
{
|
|
642
|
-
|
|
1665
|
+
{
|
|
1666
|
+
internalType: "bytes32",
|
|
1667
|
+
name: "role",
|
|
1668
|
+
type: "bytes32"
|
|
1669
|
+
},
|
|
1670
|
+
{
|
|
1671
|
+
internalType: "address",
|
|
1672
|
+
name: "callerConfirmation",
|
|
1673
|
+
type: "address"
|
|
1674
|
+
}
|
|
643
1675
|
],
|
|
644
1676
|
name: "renounceRole",
|
|
645
1677
|
outputs: [],
|
|
@@ -648,8 +1680,16 @@ var ACP_ABI = [
|
|
|
648
1680
|
},
|
|
649
1681
|
{
|
|
650
1682
|
inputs: [
|
|
651
|
-
{
|
|
652
|
-
|
|
1683
|
+
{
|
|
1684
|
+
internalType: "bytes32",
|
|
1685
|
+
name: "role",
|
|
1686
|
+
type: "bytes32"
|
|
1687
|
+
},
|
|
1688
|
+
{
|
|
1689
|
+
internalType: "address",
|
|
1690
|
+
name: "account",
|
|
1691
|
+
type: "address"
|
|
1692
|
+
}
|
|
653
1693
|
],
|
|
654
1694
|
name: "revokeRole",
|
|
655
1695
|
outputs: [],
|
|
@@ -658,8 +1698,16 @@ var ACP_ABI = [
|
|
|
658
1698
|
},
|
|
659
1699
|
{
|
|
660
1700
|
inputs: [
|
|
661
|
-
{
|
|
662
|
-
|
|
1701
|
+
{
|
|
1702
|
+
internalType: "uint256",
|
|
1703
|
+
name: "jobId",
|
|
1704
|
+
type: "uint256"
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
internalType: "uint256",
|
|
1708
|
+
name: "amount",
|
|
1709
|
+
type: "uint256"
|
|
1710
|
+
}
|
|
663
1711
|
],
|
|
664
1712
|
name: "setBudget",
|
|
665
1713
|
outputs: [],
|
|
@@ -668,9 +1716,44 @@ var ACP_ABI = [
|
|
|
668
1716
|
},
|
|
669
1717
|
{
|
|
670
1718
|
inputs: [
|
|
671
|
-
{
|
|
672
|
-
|
|
673
|
-
|
|
1719
|
+
{
|
|
1720
|
+
internalType: "uint256",
|
|
1721
|
+
name: "jobId",
|
|
1722
|
+
type: "uint256"
|
|
1723
|
+
},
|
|
1724
|
+
{
|
|
1725
|
+
internalType: "uint256",
|
|
1726
|
+
name: "amount",
|
|
1727
|
+
type: "uint256"
|
|
1728
|
+
},
|
|
1729
|
+
{
|
|
1730
|
+
internalType: "contract IERC20",
|
|
1731
|
+
name: "jobPaymentToken_",
|
|
1732
|
+
type: "address"
|
|
1733
|
+
}
|
|
1734
|
+
],
|
|
1735
|
+
name: "setBudgetWithPaymentToken",
|
|
1736
|
+
outputs: [],
|
|
1737
|
+
stateMutability: "nonpayable",
|
|
1738
|
+
type: "function"
|
|
1739
|
+
},
|
|
1740
|
+
{
|
|
1741
|
+
inputs: [
|
|
1742
|
+
{
|
|
1743
|
+
internalType: "uint256",
|
|
1744
|
+
name: "memoId",
|
|
1745
|
+
type: "uint256"
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
internalType: "bool",
|
|
1749
|
+
name: "isApproved",
|
|
1750
|
+
type: "bool"
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
internalType: "string",
|
|
1754
|
+
name: "reason",
|
|
1755
|
+
type: "string"
|
|
1756
|
+
}
|
|
674
1757
|
],
|
|
675
1758
|
name: "signMemo",
|
|
676
1759
|
outputs: [],
|
|
@@ -679,24 +1762,54 @@ var ACP_ABI = [
|
|
|
679
1762
|
},
|
|
680
1763
|
{
|
|
681
1764
|
inputs: [
|
|
682
|
-
{
|
|
683
|
-
|
|
1765
|
+
{
|
|
1766
|
+
internalType: "uint256",
|
|
1767
|
+
name: "memoId",
|
|
1768
|
+
type: "uint256"
|
|
1769
|
+
},
|
|
1770
|
+
{
|
|
1771
|
+
internalType: "address",
|
|
1772
|
+
name: "signer",
|
|
1773
|
+
type: "address"
|
|
1774
|
+
}
|
|
684
1775
|
],
|
|
685
1776
|
name: "signatories",
|
|
686
|
-
outputs: [
|
|
1777
|
+
outputs: [
|
|
1778
|
+
{
|
|
1779
|
+
internalType: "uint8",
|
|
1780
|
+
name: "res",
|
|
1781
|
+
type: "uint8"
|
|
1782
|
+
}
|
|
1783
|
+
],
|
|
687
1784
|
stateMutability: "view",
|
|
688
1785
|
type: "function"
|
|
689
1786
|
},
|
|
690
1787
|
{
|
|
691
|
-
inputs: [
|
|
1788
|
+
inputs: [
|
|
1789
|
+
{
|
|
1790
|
+
internalType: "bytes4",
|
|
1791
|
+
name: "interfaceId",
|
|
1792
|
+
type: "bytes4"
|
|
1793
|
+
}
|
|
1794
|
+
],
|
|
692
1795
|
name: "supportsInterface",
|
|
693
|
-
outputs: [
|
|
1796
|
+
outputs: [
|
|
1797
|
+
{
|
|
1798
|
+
internalType: "bool",
|
|
1799
|
+
name: "",
|
|
1800
|
+
type: "bool"
|
|
1801
|
+
}
|
|
1802
|
+
],
|
|
694
1803
|
stateMutability: "view",
|
|
695
1804
|
type: "function"
|
|
696
1805
|
},
|
|
697
1806
|
{
|
|
698
1807
|
inputs: [
|
|
699
|
-
{
|
|
1808
|
+
{
|
|
1809
|
+
internalType: "uint256",
|
|
1810
|
+
name: "evaluatorFeeBP_",
|
|
1811
|
+
type: "uint256"
|
|
1812
|
+
}
|
|
700
1813
|
],
|
|
701
1814
|
name: "updateEvaluatorFee",
|
|
702
1815
|
outputs: [],
|
|
@@ -705,19 +1818,39 @@ var ACP_ABI = [
|
|
|
705
1818
|
},
|
|
706
1819
|
{
|
|
707
1820
|
inputs: [
|
|
708
|
-
{
|
|
709
|
-
|
|
1821
|
+
{
|
|
1822
|
+
internalType: "uint256",
|
|
1823
|
+
name: "platformFeeBP_",
|
|
1824
|
+
type: "uint256"
|
|
1825
|
+
},
|
|
1826
|
+
{
|
|
1827
|
+
internalType: "address",
|
|
1828
|
+
name: "platformTreasury_",
|
|
1829
|
+
type: "address"
|
|
1830
|
+
}
|
|
710
1831
|
],
|
|
711
1832
|
name: "updatePlatformFee",
|
|
712
1833
|
outputs: [],
|
|
713
1834
|
stateMutability: "nonpayable",
|
|
714
1835
|
type: "function"
|
|
1836
|
+
},
|
|
1837
|
+
{
|
|
1838
|
+
inputs: [
|
|
1839
|
+
{
|
|
1840
|
+
internalType: "uint256",
|
|
1841
|
+
name: "memoId",
|
|
1842
|
+
type: "uint256"
|
|
1843
|
+
}
|
|
1844
|
+
],
|
|
1845
|
+
name: "withdrawEscrowedFunds",
|
|
1846
|
+
outputs: [],
|
|
1847
|
+
stateMutability: "nonpayable",
|
|
1848
|
+
type: "function"
|
|
715
1849
|
}
|
|
716
1850
|
];
|
|
717
1851
|
var acpAbi_default = ACP_ABI;
|
|
718
1852
|
|
|
719
1853
|
// src/acpClient.ts
|
|
720
|
-
import { parseEther } from "viem";
|
|
721
1854
|
import { io } from "socket.io-client";
|
|
722
1855
|
|
|
723
1856
|
// src/acpContractClient.ts
|
|
@@ -731,21 +1864,38 @@ import {
|
|
|
731
1864
|
import { baseSepolia, base } from "@account-kit/infra";
|
|
732
1865
|
var baseSepoliaAcpConfig = {
|
|
733
1866
|
chain: baseSepolia,
|
|
734
|
-
contractAddress: "
|
|
735
|
-
|
|
1867
|
+
contractAddress: "0x8Db6B1c839Fc8f6bd35777E194677B67b4D51928",
|
|
1868
|
+
paymentTokenAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
1869
|
+
paymentTokenDecimals: 6,
|
|
736
1870
|
alchemyRpcUrl: "https://alchemy-proxy.virtuals.io/api/proxy/rpc",
|
|
737
|
-
acpUrl: "https://acpx
|
|
1871
|
+
acpUrl: "https://acpx.virtuals.gg",
|
|
1872
|
+
priorityFeeMultiplier: 2,
|
|
1873
|
+
maxFeePerGas: 2e7,
|
|
1874
|
+
maxPriorityFeePerGas: 21e6
|
|
738
1875
|
};
|
|
739
1876
|
var baseAcpConfig = {
|
|
740
1877
|
chain: base,
|
|
741
1878
|
contractAddress: "0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
|
|
742
|
-
|
|
1879
|
+
paymentTokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
1880
|
+
paymentTokenDecimals: 6,
|
|
743
1881
|
alchemyRpcUrl: "https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
|
|
744
|
-
acpUrl: "https://acpx.virtuals.io"
|
|
1882
|
+
acpUrl: "https://acpx.virtuals.io",
|
|
1883
|
+
priorityFeeMultiplier: 2,
|
|
1884
|
+
maxFeePerGas: 2e7,
|
|
1885
|
+
maxPriorityFeePerGas: 21e6
|
|
745
1886
|
};
|
|
746
1887
|
|
|
747
1888
|
// src/acpContractClient.ts
|
|
748
|
-
import {
|
|
1889
|
+
import {
|
|
1890
|
+
createPublicClient,
|
|
1891
|
+
decodeEventLog,
|
|
1892
|
+
encodeFunctionData,
|
|
1893
|
+
erc20Abi,
|
|
1894
|
+
fromHex,
|
|
1895
|
+
http,
|
|
1896
|
+
parseUnits
|
|
1897
|
+
} from "viem";
|
|
1898
|
+
import { publicActionsL2 } from "viem/op-stack";
|
|
749
1899
|
var MemoType = /* @__PURE__ */ ((MemoType2) => {
|
|
750
1900
|
MemoType2[MemoType2["MESSAGE"] = 0] = "MESSAGE";
|
|
751
1901
|
MemoType2[MemoType2["CONTEXT_URL"] = 1] = "CONTEXT_URL";
|
|
@@ -753,6 +1903,9 @@ var MemoType = /* @__PURE__ */ ((MemoType2) => {
|
|
|
753
1903
|
MemoType2[MemoType2["VOICE_URL"] = 3] = "VOICE_URL";
|
|
754
1904
|
MemoType2[MemoType2["OBJECT_URL"] = 4] = "OBJECT_URL";
|
|
755
1905
|
MemoType2[MemoType2["TXHASH"] = 5] = "TXHASH";
|
|
1906
|
+
MemoType2[MemoType2["PAYABLE_REQUEST"] = 6] = "PAYABLE_REQUEST";
|
|
1907
|
+
MemoType2[MemoType2["PAYABLE_TRANSFER"] = 7] = "PAYABLE_TRANSFER";
|
|
1908
|
+
MemoType2[MemoType2["PAYABLE_TRANSFER_ESCROW"] = 8] = "PAYABLE_TRANSFER_ESCROW";
|
|
756
1909
|
return MemoType2;
|
|
757
1910
|
})(MemoType || {});
|
|
758
1911
|
var AcpJobPhases = /* @__PURE__ */ ((AcpJobPhases2) => {
|
|
@@ -762,25 +1915,34 @@ var AcpJobPhases = /* @__PURE__ */ ((AcpJobPhases2) => {
|
|
|
762
1915
|
AcpJobPhases2[AcpJobPhases2["EVALUATION"] = 3] = "EVALUATION";
|
|
763
1916
|
AcpJobPhases2[AcpJobPhases2["COMPLETED"] = 4] = "COMPLETED";
|
|
764
1917
|
AcpJobPhases2[AcpJobPhases2["REJECTED"] = 5] = "REJECTED";
|
|
1918
|
+
AcpJobPhases2[AcpJobPhases2["EXPIRED"] = 6] = "EXPIRED";
|
|
765
1919
|
return AcpJobPhases2;
|
|
766
1920
|
})(AcpJobPhases || {});
|
|
767
1921
|
var AcpContractClient = class _AcpContractClient {
|
|
768
|
-
constructor(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
|
|
1922
|
+
constructor(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig, customRpcUrl) {
|
|
769
1923
|
this.walletPrivateKey = walletPrivateKey;
|
|
770
1924
|
this.sessionEntityKeyId = sessionEntityKeyId;
|
|
771
1925
|
this.agentWalletAddress = agentWalletAddress;
|
|
772
1926
|
this.config = config;
|
|
1927
|
+
this.customRpcUrl = customRpcUrl;
|
|
1928
|
+
this.MAX_RETRIES = 3;
|
|
773
1929
|
this.chain = config.chain;
|
|
774
1930
|
this.contractAddress = config.contractAddress;
|
|
775
|
-
this.
|
|
1931
|
+
this.paymentTokenAddress = config.paymentTokenAddress;
|
|
1932
|
+
this.customRpcUrl = customRpcUrl;
|
|
1933
|
+
this.customRpcClient = createPublicClient({
|
|
1934
|
+
chain: this.chain,
|
|
1935
|
+
transport: this.customRpcUrl ? http(this.customRpcUrl) : http()
|
|
1936
|
+
}).extend(publicActionsL2());
|
|
776
1937
|
}
|
|
777
|
-
static build(_0, _1, _2) {
|
|
778
|
-
return __async(this, arguments, function* (walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
|
|
1938
|
+
static build(_0, _1, _2, _3) {
|
|
1939
|
+
return __async(this, arguments, function* (walletPrivateKey, sessionEntityKeyId, agentWalletAddress, customRpcUrl, config = baseAcpConfig) {
|
|
779
1940
|
const acpContractClient = new _AcpContractClient(
|
|
780
1941
|
walletPrivateKey,
|
|
781
1942
|
sessionEntityKeyId,
|
|
782
1943
|
agentWalletAddress,
|
|
783
|
-
config
|
|
1944
|
+
config,
|
|
1945
|
+
customRpcUrl
|
|
784
1946
|
);
|
|
785
1947
|
yield acpContractClient.init();
|
|
786
1948
|
return acpContractClient;
|
|
@@ -813,6 +1975,54 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
813
1975
|
get walletAddress() {
|
|
814
1976
|
return this.sessionKeyClient.account.address;
|
|
815
1977
|
}
|
|
1978
|
+
calculateGasFees() {
|
|
1979
|
+
return __async(this, null, function* () {
|
|
1980
|
+
const { maxFeePerGas, maxPriorityFeePerGas } = yield this.customRpcClient.estimateFeesPerGas();
|
|
1981
|
+
let finalMaxFeePerGas = maxFeePerGas;
|
|
1982
|
+
let priorityFeeMultiplier = Number(this.config.priorityFeeMultiplier) || 2;
|
|
1983
|
+
const overrideMaxFeePerGas = this.config.maxFeePerGas || maxFeePerGas;
|
|
1984
|
+
const overrideMaxPriorityFeePerGas = this.config.maxPriorityFeePerGas || maxPriorityFeePerGas;
|
|
1985
|
+
finalMaxFeePerGas = BigInt(overrideMaxFeePerGas) + BigInt(overrideMaxPriorityFeePerGas) * BigInt(Math.max(0, priorityFeeMultiplier - 1));
|
|
1986
|
+
return finalMaxFeePerGas;
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
handleSendUserOperation(_0) {
|
|
1990
|
+
return __async(this, arguments, function* (data, contractAddress = this.contractAddress) {
|
|
1991
|
+
const payload = {
|
|
1992
|
+
uo: {
|
|
1993
|
+
target: contractAddress,
|
|
1994
|
+
data
|
|
1995
|
+
},
|
|
1996
|
+
overrides: {}
|
|
1997
|
+
};
|
|
1998
|
+
let retries = this.MAX_RETRIES;
|
|
1999
|
+
let finalError;
|
|
2000
|
+
while (retries > 0) {
|
|
2001
|
+
try {
|
|
2002
|
+
if (this.MAX_RETRIES > retries) {
|
|
2003
|
+
const gasFees = yield this.calculateGasFees();
|
|
2004
|
+
payload["overrides"] = {
|
|
2005
|
+
maxFeePerGas: `0x${gasFees.toString(16)}`
|
|
2006
|
+
};
|
|
2007
|
+
}
|
|
2008
|
+
const { hash } = yield this.sessionKeyClient.sendUserOperation(payload);
|
|
2009
|
+
yield this.sessionKeyClient.waitForUserOperationTransaction({
|
|
2010
|
+
hash
|
|
2011
|
+
});
|
|
2012
|
+
return hash;
|
|
2013
|
+
} catch (error) {
|
|
2014
|
+
console.debug("Failed to send user operation", error);
|
|
2015
|
+
retries -= 1;
|
|
2016
|
+
if (retries === 0) {
|
|
2017
|
+
finalError = error;
|
|
2018
|
+
break;
|
|
2019
|
+
}
|
|
2020
|
+
yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
throw new Error(`Failed to send user operation ${finalError}`);
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
816
2026
|
getJobId(hash) {
|
|
817
2027
|
return __async(this, null, function* () {
|
|
818
2028
|
const result = yield this.sessionKeyClient.getUserOperationReceipt(hash);
|
|
@@ -828,6 +2038,9 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
828
2038
|
return fromHex(contractLogs.data, "number");
|
|
829
2039
|
});
|
|
830
2040
|
}
|
|
2041
|
+
formatAmount(amount) {
|
|
2042
|
+
return parseUnits(amount.toString(), this.config.paymentTokenDecimals);
|
|
2043
|
+
}
|
|
831
2044
|
createJob(providerAddress, evaluatorAddress, expireAt) {
|
|
832
2045
|
return __async(this, null, function* () {
|
|
833
2046
|
try {
|
|
@@ -840,51 +2053,50 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
840
2053
|
Math.floor(expireAt.getTime() / 1e3)
|
|
841
2054
|
]
|
|
842
2055
|
});
|
|
843
|
-
const
|
|
844
|
-
uo: {
|
|
845
|
-
target: this.contractAddress,
|
|
846
|
-
data
|
|
847
|
-
}
|
|
848
|
-
});
|
|
849
|
-
yield this.sessionKeyClient.waitForUserOperationTransaction({
|
|
850
|
-
hash
|
|
851
|
-
});
|
|
2056
|
+
const hash = yield this.handleSendUserOperation(data);
|
|
852
2057
|
const jobId = yield this.getJobId(hash);
|
|
853
2058
|
return { txHash: hash, jobId };
|
|
854
2059
|
} catch (error) {
|
|
855
|
-
console.error(error);
|
|
2060
|
+
console.error(`Failed to create job ${error}`);
|
|
856
2061
|
throw new Error("Failed to create job");
|
|
857
2062
|
}
|
|
858
2063
|
});
|
|
859
2064
|
}
|
|
860
|
-
approveAllowance(
|
|
861
|
-
return __async(this,
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
}
|
|
873
|
-
yield this.sessionKeyClient.waitForUserOperationTransaction({
|
|
874
|
-
hash
|
|
875
|
-
});
|
|
876
|
-
return hash;
|
|
2065
|
+
approveAllowance(_0) {
|
|
2066
|
+
return __async(this, arguments, function* (amount, paymentTokenAddress = this.paymentTokenAddress) {
|
|
2067
|
+
try {
|
|
2068
|
+
const data = encodeFunctionData({
|
|
2069
|
+
abi: erc20Abi,
|
|
2070
|
+
functionName: "approve",
|
|
2071
|
+
args: [this.contractAddress, this.formatAmount(amount)]
|
|
2072
|
+
});
|
|
2073
|
+
return yield this.handleSendUserOperation(data, paymentTokenAddress);
|
|
2074
|
+
} catch (error) {
|
|
2075
|
+
console.error(`Failed to approve allowance ${error}`);
|
|
2076
|
+
throw new Error("Failed to approve allowance");
|
|
2077
|
+
}
|
|
877
2078
|
});
|
|
878
2079
|
}
|
|
879
|
-
|
|
880
|
-
return __async(this,
|
|
2080
|
+
createPayableMemo(_0, _1, _2, _3, _4, _5, _6, _7, _8) {
|
|
2081
|
+
return __async(this, arguments, function* (jobId, content, amount, recipient, feeAmount, feeType, nextPhase, type, expiredAt, token = this.paymentTokenAddress) {
|
|
881
2082
|
let retries = 3;
|
|
882
2083
|
while (retries > 0) {
|
|
883
2084
|
try {
|
|
884
2085
|
const data = encodeFunctionData({
|
|
885
2086
|
abi: acpAbi_default,
|
|
886
|
-
functionName: "
|
|
887
|
-
args: [
|
|
2087
|
+
functionName: "createPayableMemo",
|
|
2088
|
+
args: [
|
|
2089
|
+
jobId,
|
|
2090
|
+
content,
|
|
2091
|
+
token,
|
|
2092
|
+
this.formatAmount(amount),
|
|
2093
|
+
recipient,
|
|
2094
|
+
this.formatAmount(feeAmount),
|
|
2095
|
+
feeType,
|
|
2096
|
+
type,
|
|
2097
|
+
nextPhase,
|
|
2098
|
+
Math.floor(expiredAt.getTime() / 1e3)
|
|
2099
|
+
]
|
|
888
2100
|
});
|
|
889
2101
|
const { hash } = yield this.sessionKeyClient.sendUserOperation({
|
|
890
2102
|
uo: {
|
|
@@ -897,41 +2109,67 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
897
2109
|
});
|
|
898
2110
|
return hash;
|
|
899
2111
|
} catch (error) {
|
|
900
|
-
console.error(
|
|
2112
|
+
console.error(
|
|
2113
|
+
`failed to create payable memo ${jobId} ${content} ${error}`
|
|
2114
|
+
);
|
|
901
2115
|
retries -= 1;
|
|
902
2116
|
yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
|
|
903
2117
|
}
|
|
904
2118
|
}
|
|
905
|
-
throw new Error("Failed to create memo");
|
|
2119
|
+
throw new Error("Failed to create payable memo");
|
|
2120
|
+
});
|
|
2121
|
+
}
|
|
2122
|
+
createMemo(jobId, content, type, isSecured, nextPhase) {
|
|
2123
|
+
return __async(this, null, function* () {
|
|
2124
|
+
try {
|
|
2125
|
+
const data = encodeFunctionData({
|
|
2126
|
+
abi: acpAbi_default,
|
|
2127
|
+
functionName: "createMemo",
|
|
2128
|
+
args: [jobId, content, type, isSecured, nextPhase]
|
|
2129
|
+
});
|
|
2130
|
+
return yield this.handleSendUserOperation(data);
|
|
2131
|
+
} catch (error) {
|
|
2132
|
+
console.error(`Failed to create memo ${jobId} ${content} ${error}`);
|
|
2133
|
+
throw new Error("Failed to create memo");
|
|
2134
|
+
}
|
|
2135
|
+
});
|
|
2136
|
+
}
|
|
2137
|
+
getMemoId(hash) {
|
|
2138
|
+
return __async(this, null, function* () {
|
|
2139
|
+
const result = yield this.sessionKeyClient.getUserOperationReceipt(hash);
|
|
2140
|
+
if (!result) {
|
|
2141
|
+
throw new Error("Failed to get user operation receipt");
|
|
2142
|
+
}
|
|
2143
|
+
const contractLogs = result.logs.find(
|
|
2144
|
+
(log) => log.address.toLowerCase() === this.contractAddress.toLowerCase()
|
|
2145
|
+
);
|
|
2146
|
+
if (!contractLogs) {
|
|
2147
|
+
throw new Error("Failed to get contract logs");
|
|
2148
|
+
}
|
|
2149
|
+
const decoded = decodeEventLog({
|
|
2150
|
+
abi: acpAbi_default,
|
|
2151
|
+
data: contractLogs.data,
|
|
2152
|
+
topics: contractLogs.topics
|
|
2153
|
+
});
|
|
2154
|
+
if (!decoded.args) {
|
|
2155
|
+
throw new Error("Failed to decode event logs");
|
|
2156
|
+
}
|
|
2157
|
+
return parseInt(decoded.args.memoId);
|
|
906
2158
|
});
|
|
907
2159
|
}
|
|
908
2160
|
signMemo(memoId, isApproved, reason) {
|
|
909
2161
|
return __async(this, null, function* () {
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
target: this.contractAddress,
|
|
921
|
-
data
|
|
922
|
-
}
|
|
923
|
-
});
|
|
924
|
-
yield this.sessionKeyClient.waitForUserOperationTransaction({
|
|
925
|
-
hash
|
|
926
|
-
});
|
|
927
|
-
return hash;
|
|
928
|
-
} catch (error) {
|
|
929
|
-
console.error(`failed to sign memo ${error}`);
|
|
930
|
-
retries -= 1;
|
|
931
|
-
yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
|
|
932
|
-
}
|
|
2162
|
+
try {
|
|
2163
|
+
const data = encodeFunctionData({
|
|
2164
|
+
abi: acpAbi_default,
|
|
2165
|
+
functionName: "signMemo",
|
|
2166
|
+
args: [memoId, isApproved, reason]
|
|
2167
|
+
});
|
|
2168
|
+
return yield this.handleSendUserOperation(data);
|
|
2169
|
+
} catch (error) {
|
|
2170
|
+
console.error(`Failed to sign memo ${error}`);
|
|
2171
|
+
throw new Error("Failed to sign memo");
|
|
933
2172
|
}
|
|
934
|
-
throw new Error("Failed to sign memo");
|
|
935
2173
|
});
|
|
936
2174
|
}
|
|
937
2175
|
setBudget(jobId, budget) {
|
|
@@ -940,20 +2178,26 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
940
2178
|
const data = encodeFunctionData({
|
|
941
2179
|
abi: acpAbi_default,
|
|
942
2180
|
functionName: "setBudget",
|
|
943
|
-
args: [jobId, budget]
|
|
944
|
-
});
|
|
945
|
-
const { hash } = yield this.sessionKeyClient.sendUserOperation({
|
|
946
|
-
uo: {
|
|
947
|
-
target: this.contractAddress,
|
|
948
|
-
data
|
|
949
|
-
}
|
|
2181
|
+
args: [jobId, this.formatAmount(budget)]
|
|
950
2182
|
});
|
|
951
|
-
yield this.
|
|
952
|
-
|
|
2183
|
+
return yield this.handleSendUserOperation(data);
|
|
2184
|
+
} catch (error) {
|
|
2185
|
+
console.error(`Failed to set budget ${error}`);
|
|
2186
|
+
throw new Error("Failed to set budget");
|
|
2187
|
+
}
|
|
2188
|
+
});
|
|
2189
|
+
}
|
|
2190
|
+
setBudgetWithPaymentToken(_0, _1) {
|
|
2191
|
+
return __async(this, arguments, function* (jobId, budget, paymentTokenAddress = this.paymentTokenAddress) {
|
|
2192
|
+
try {
|
|
2193
|
+
const data = encodeFunctionData({
|
|
2194
|
+
abi: acpAbi_default,
|
|
2195
|
+
functionName: "setBudgetWithPaymentToken",
|
|
2196
|
+
args: [jobId, this.formatAmount(budget), paymentTokenAddress]
|
|
953
2197
|
});
|
|
954
|
-
return
|
|
2198
|
+
return yield this.handleSendUserOperation(data);
|
|
955
2199
|
} catch (error) {
|
|
956
|
-
console.error(error);
|
|
2200
|
+
console.error(`Failed to set budget ${error}`);
|
|
957
2201
|
throw new Error("Failed to set budget");
|
|
958
2202
|
}
|
|
959
2203
|
});
|
|
@@ -961,22 +2205,93 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
961
2205
|
};
|
|
962
2206
|
var acpContractClient_default = AcpContractClient;
|
|
963
2207
|
|
|
2208
|
+
// src/interfaces.ts
|
|
2209
|
+
var AcpMemoStatus = /* @__PURE__ */ ((AcpMemoStatus2) => {
|
|
2210
|
+
AcpMemoStatus2["PENDING"] = "PENDING";
|
|
2211
|
+
AcpMemoStatus2["APPROVED"] = "APPROVED";
|
|
2212
|
+
AcpMemoStatus2["REJECTED"] = "REJECTED";
|
|
2213
|
+
return AcpMemoStatus2;
|
|
2214
|
+
})(AcpMemoStatus || {});
|
|
2215
|
+
var AcpAgentSort = /* @__PURE__ */ ((AcpAgentSort2) => {
|
|
2216
|
+
AcpAgentSort2["SUCCESSFUL_JOB_COUNT"] = "successfulJobCount";
|
|
2217
|
+
AcpAgentSort2["SUCCESS_RATE"] = "successRate";
|
|
2218
|
+
AcpAgentSort2["UNIQUE_BUYER_COUNT"] = "uniqueBuyerCount";
|
|
2219
|
+
AcpAgentSort2["MINS_FROM_LAST_ONLINE"] = "minsFromLastOnlineTime";
|
|
2220
|
+
return AcpAgentSort2;
|
|
2221
|
+
})(AcpAgentSort || {});
|
|
2222
|
+
var AcpGraduationStatus = /* @__PURE__ */ ((AcpGraduationStatus2) => {
|
|
2223
|
+
AcpGraduationStatus2["ALL"] = "all";
|
|
2224
|
+
AcpGraduationStatus2["GRADUATED"] = "graduated";
|
|
2225
|
+
AcpGraduationStatus2["NOT_GRADUATED"] = "not_graduated";
|
|
2226
|
+
return AcpGraduationStatus2;
|
|
2227
|
+
})(AcpGraduationStatus || {});
|
|
2228
|
+
var AcpOnlineStatus = /* @__PURE__ */ ((AcpOnlineStatus2) => {
|
|
2229
|
+
AcpOnlineStatus2["ALL"] = "all";
|
|
2230
|
+
AcpOnlineStatus2["ONLINE"] = "online";
|
|
2231
|
+
AcpOnlineStatus2["OFFLINE"] = "offline";
|
|
2232
|
+
return AcpOnlineStatus2;
|
|
2233
|
+
})(AcpOnlineStatus || {});
|
|
2234
|
+
var PayloadType = /* @__PURE__ */ ((PayloadType2) => {
|
|
2235
|
+
PayloadType2["FUND_RESPONSE"] = "fund_response";
|
|
2236
|
+
PayloadType2["OPEN_POSITION"] = "open_position";
|
|
2237
|
+
PayloadType2["CLOSE_PARTIAL_POSITION"] = "close_partial_position";
|
|
2238
|
+
PayloadType2["CLOSE_POSITION"] = "close_position";
|
|
2239
|
+
PayloadType2["POSITION_FULFILLED"] = "position_fulfilled";
|
|
2240
|
+
PayloadType2["CLOSE_JOB_AND_WITHDRAW"] = "close_job_and_withdraw";
|
|
2241
|
+
PayloadType2["UNFULFILLED_POSITION"] = "unfulfilled_position";
|
|
2242
|
+
return PayloadType2;
|
|
2243
|
+
})(PayloadType || {});
|
|
2244
|
+
|
|
2245
|
+
// src/utils.ts
|
|
2246
|
+
function tryParseJson(content) {
|
|
2247
|
+
try {
|
|
2248
|
+
return JSON.parse(content);
|
|
2249
|
+
} catch (error) {
|
|
2250
|
+
return null;
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
|
|
964
2254
|
// src/acpJob.ts
|
|
965
2255
|
var AcpJob = class {
|
|
966
|
-
constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, memos, phase, context) {
|
|
2256
|
+
constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, priceTokenAddress, memos, phase, context) {
|
|
967
2257
|
this.acpClient = acpClient;
|
|
968
2258
|
this.id = id;
|
|
969
2259
|
this.clientAddress = clientAddress;
|
|
970
2260
|
this.providerAddress = providerAddress;
|
|
971
2261
|
this.evaluatorAddress = evaluatorAddress;
|
|
972
2262
|
this.price = price;
|
|
2263
|
+
this.priceTokenAddress = priceTokenAddress;
|
|
973
2264
|
this.memos = memos;
|
|
974
2265
|
this.phase = phase;
|
|
975
2266
|
this.context = context;
|
|
976
2267
|
}
|
|
977
2268
|
get serviceRequirement() {
|
|
978
2269
|
var _a;
|
|
979
|
-
|
|
2270
|
+
const content = (_a = this.memos.find(
|
|
2271
|
+
(m) => m.nextPhase === 1 /* NEGOTIATION */
|
|
2272
|
+
)) == null ? void 0 : _a.content;
|
|
2273
|
+
if (!content) {
|
|
2274
|
+
return void 0;
|
|
2275
|
+
}
|
|
2276
|
+
const contentObj = tryParseJson(content);
|
|
2277
|
+
if (!contentObj) {
|
|
2278
|
+
return content;
|
|
2279
|
+
}
|
|
2280
|
+
if (contentObj.serviceRequirement) {
|
|
2281
|
+
return contentObj.serviceRequirement;
|
|
2282
|
+
}
|
|
2283
|
+
return contentObj;
|
|
2284
|
+
}
|
|
2285
|
+
get serviceName() {
|
|
2286
|
+
var _a;
|
|
2287
|
+
const content = (_a = this.memos.find(
|
|
2288
|
+
(m) => m.nextPhase === 1 /* NEGOTIATION */
|
|
2289
|
+
)) == null ? void 0 : _a.content;
|
|
2290
|
+
if (!content) {
|
|
2291
|
+
return void 0;
|
|
2292
|
+
}
|
|
2293
|
+
const contentObj = tryParseJson(content);
|
|
2294
|
+
return contentObj == null ? void 0 : contentObj.serviceName;
|
|
980
2295
|
}
|
|
981
2296
|
get deliverable() {
|
|
982
2297
|
var _a;
|
|
@@ -991,6 +2306,9 @@ var AcpJob = class {
|
|
|
991
2306
|
get evaluatorAgent() {
|
|
992
2307
|
return this.acpClient.getAgent(this.evaluatorAddress);
|
|
993
2308
|
}
|
|
2309
|
+
get latestMemo() {
|
|
2310
|
+
return this.memos[this.memos.length - 1];
|
|
2311
|
+
}
|
|
994
2312
|
pay(amount, reason) {
|
|
995
2313
|
return __async(this, null, function* () {
|
|
996
2314
|
const memo = this.memos.find(
|
|
@@ -1002,23 +2320,25 @@ var AcpJob = class {
|
|
|
1002
2320
|
return yield this.acpClient.payJob(this.id, amount, memo.id, reason);
|
|
1003
2321
|
});
|
|
1004
2322
|
}
|
|
1005
|
-
respond(accept, reason) {
|
|
2323
|
+
respond(accept, payload, reason) {
|
|
1006
2324
|
return __async(this, null, function* () {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
);
|
|
1010
|
-
if (!memo) {
|
|
2325
|
+
var _a;
|
|
2326
|
+
if (((_a = this.latestMemo) == null ? void 0 : _a.nextPhase) !== 1 /* NEGOTIATION */) {
|
|
1011
2327
|
throw new Error("No negotiation memo found");
|
|
1012
2328
|
}
|
|
1013
|
-
return yield this.acpClient.respondJob(
|
|
2329
|
+
return yield this.acpClient.respondJob(
|
|
2330
|
+
this.id,
|
|
2331
|
+
this.latestMemo.id,
|
|
2332
|
+
accept,
|
|
2333
|
+
payload ? JSON.stringify(payload) : void 0,
|
|
2334
|
+
reason
|
|
2335
|
+
);
|
|
1014
2336
|
});
|
|
1015
2337
|
}
|
|
1016
2338
|
deliver(deliverable) {
|
|
1017
2339
|
return __async(this, null, function* () {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
);
|
|
1021
|
-
if (!memo) {
|
|
2340
|
+
var _a;
|
|
2341
|
+
if (((_a = this.latestMemo) == null ? void 0 : _a.nextPhase) !== 3 /* EVALUATION */) {
|
|
1022
2342
|
throw new Error("No transaction memo found");
|
|
1023
2343
|
}
|
|
1024
2344
|
return yield this.acpClient.deliverJob(this.id, deliverable);
|
|
@@ -1026,28 +2346,304 @@ var AcpJob = class {
|
|
|
1026
2346
|
}
|
|
1027
2347
|
evaluate(accept, reason) {
|
|
1028
2348
|
return __async(this, null, function* () {
|
|
1029
|
-
|
|
1030
|
-
if (
|
|
2349
|
+
var _a;
|
|
2350
|
+
if (((_a = this.latestMemo) == null ? void 0 : _a.nextPhase) !== 4 /* COMPLETED */) {
|
|
1031
2351
|
throw new Error("No evaluation memo found");
|
|
1032
2352
|
}
|
|
1033
2353
|
return yield this.acpClient.acpContractClient.signMemo(
|
|
2354
|
+
this.latestMemo.id,
|
|
2355
|
+
accept,
|
|
2356
|
+
reason
|
|
2357
|
+
);
|
|
2358
|
+
});
|
|
2359
|
+
}
|
|
2360
|
+
openPosition(_0, _1) {
|
|
2361
|
+
return __async(this, arguments, function* (payload, feeAmount, expiredAt = new Date(Date.now() + 1e3 * 60 * 3), walletAddress) {
|
|
2362
|
+
if (payload.length === 0) {
|
|
2363
|
+
throw new Error("No positions to open");
|
|
2364
|
+
}
|
|
2365
|
+
return yield this.acpClient.transferFunds(
|
|
2366
|
+
this.id,
|
|
2367
|
+
payload.reduce((acc, curr) => acc + curr.amount, 0),
|
|
2368
|
+
walletAddress || this.providerAddress,
|
|
2369
|
+
feeAmount,
|
|
2370
|
+
1 /* IMMEDIATE_FEE */,
|
|
2371
|
+
{
|
|
2372
|
+
type: "open_position" /* OPEN_POSITION */,
|
|
2373
|
+
data: payload
|
|
2374
|
+
},
|
|
2375
|
+
2 /* TRANSACTION */,
|
|
2376
|
+
expiredAt
|
|
2377
|
+
);
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
responseOpenPosition(memoId, accept, reason) {
|
|
2381
|
+
return __async(this, null, function* () {
|
|
2382
|
+
const memo = this.memos.find((m) => m.id === memoId);
|
|
2383
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2384
|
+
throw new Error("No open position memo found");
|
|
2385
|
+
}
|
|
2386
|
+
const payload = tryParseJson(
|
|
2387
|
+
memo.content
|
|
2388
|
+
);
|
|
2389
|
+
if ((payload == null ? void 0 : payload.type) !== "open_position" /* OPEN_POSITION */) {
|
|
2390
|
+
throw new Error("Invalid open position memo");
|
|
2391
|
+
}
|
|
2392
|
+
return yield this.acpClient.responseFundsTransfer(memo.id, accept, reason);
|
|
2393
|
+
});
|
|
2394
|
+
}
|
|
2395
|
+
closePartialPosition(_0) {
|
|
2396
|
+
return __async(this, arguments, function* (payload, expireAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
2397
|
+
return yield this.acpClient.requestFunds(
|
|
2398
|
+
this.id,
|
|
2399
|
+
payload.amount,
|
|
2400
|
+
this.clientAddress,
|
|
2401
|
+
0,
|
|
2402
|
+
0 /* NO_FEE */,
|
|
2403
|
+
{
|
|
2404
|
+
type: "close_partial_position" /* CLOSE_PARTIAL_POSITION */,
|
|
2405
|
+
data: payload
|
|
2406
|
+
},
|
|
2407
|
+
2 /* TRANSACTION */,
|
|
2408
|
+
expireAt
|
|
2409
|
+
);
|
|
2410
|
+
});
|
|
2411
|
+
}
|
|
2412
|
+
responseClosePartialPosition(memoId, accept, reason) {
|
|
2413
|
+
return __async(this, null, function* () {
|
|
2414
|
+
const memo = this.memos.find((m) => m.id === memoId);
|
|
2415
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 6 /* PAYABLE_REQUEST */) {
|
|
2416
|
+
throw new Error("No close position memo found");
|
|
2417
|
+
}
|
|
2418
|
+
const payload = tryParseJson(
|
|
2419
|
+
memo.content
|
|
2420
|
+
);
|
|
2421
|
+
if ((payload == null ? void 0 : payload.type) !== "close_partial_position" /* CLOSE_PARTIAL_POSITION */) {
|
|
2422
|
+
throw new Error("Invalid close position memo");
|
|
2423
|
+
}
|
|
2424
|
+
return yield this.acpClient.responseFundsRequest(
|
|
1034
2425
|
memo.id,
|
|
1035
2426
|
accept,
|
|
2427
|
+
payload.data.amount,
|
|
1036
2428
|
reason
|
|
1037
2429
|
);
|
|
1038
2430
|
});
|
|
1039
2431
|
}
|
|
2432
|
+
requestClosePosition(payload) {
|
|
2433
|
+
return __async(this, null, function* () {
|
|
2434
|
+
return yield this.acpClient.sendMessage(
|
|
2435
|
+
this.id,
|
|
2436
|
+
{
|
|
2437
|
+
type: "close_position" /* CLOSE_POSITION */,
|
|
2438
|
+
data: payload
|
|
2439
|
+
},
|
|
2440
|
+
2 /* TRANSACTION */
|
|
2441
|
+
);
|
|
2442
|
+
});
|
|
2443
|
+
}
|
|
2444
|
+
responseRequestClosePosition(_0, _1, _2, _3) {
|
|
2445
|
+
return __async(this, arguments, function* (memoId, accept, payload, reason, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
2446
|
+
const memo = this.memos.find((m) => m.id === memoId);
|
|
2447
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 0 /* MESSAGE */) {
|
|
2448
|
+
throw new Error("No message memo found");
|
|
2449
|
+
}
|
|
2450
|
+
const messagePayload = tryParseJson(memo.content);
|
|
2451
|
+
if ((messagePayload == null ? void 0 : messagePayload.type) !== "close_position" /* CLOSE_POSITION */) {
|
|
2452
|
+
throw new Error("Invalid close position memo");
|
|
2453
|
+
}
|
|
2454
|
+
yield memo.sign(accept, reason);
|
|
2455
|
+
if (accept) {
|
|
2456
|
+
return yield this.acpClient.transferFunds(
|
|
2457
|
+
this.id,
|
|
2458
|
+
payload.amount,
|
|
2459
|
+
this.clientAddress,
|
|
2460
|
+
0,
|
|
2461
|
+
0 /* NO_FEE */,
|
|
2462
|
+
{
|
|
2463
|
+
type: "close_position" /* CLOSE_POSITION */,
|
|
2464
|
+
data: payload
|
|
2465
|
+
},
|
|
2466
|
+
2 /* TRANSACTION */,
|
|
2467
|
+
expiredAt
|
|
2468
|
+
);
|
|
2469
|
+
}
|
|
2470
|
+
});
|
|
2471
|
+
}
|
|
2472
|
+
confirmClosePosition(memoId, accept, reason) {
|
|
2473
|
+
return __async(this, null, function* () {
|
|
2474
|
+
const memo = this.memos.find((m) => m.id === memoId);
|
|
2475
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2476
|
+
throw new Error("No payable transfer memo found");
|
|
2477
|
+
}
|
|
2478
|
+
const payload = tryParseJson(
|
|
2479
|
+
memo.content
|
|
2480
|
+
);
|
|
2481
|
+
if ((payload == null ? void 0 : payload.type) !== "close_position" /* CLOSE_POSITION */) {
|
|
2482
|
+
throw new Error("Invalid close position memo");
|
|
2483
|
+
}
|
|
2484
|
+
yield memo.sign(accept, reason);
|
|
2485
|
+
});
|
|
2486
|
+
}
|
|
2487
|
+
positionFulfilled(_0) {
|
|
2488
|
+
return __async(this, arguments, function* (payload, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
2489
|
+
return yield this.acpClient.transferFunds(
|
|
2490
|
+
this.id,
|
|
2491
|
+
payload.amount,
|
|
2492
|
+
this.clientAddress,
|
|
2493
|
+
0,
|
|
2494
|
+
0 /* NO_FEE */,
|
|
2495
|
+
{
|
|
2496
|
+
type: "position_fulfilled" /* POSITION_FULFILLED */,
|
|
2497
|
+
data: payload
|
|
2498
|
+
},
|
|
2499
|
+
2 /* TRANSACTION */,
|
|
2500
|
+
expiredAt
|
|
2501
|
+
);
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
unfulfilledPosition(_0) {
|
|
2505
|
+
return __async(this, arguments, function* (payload, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
2506
|
+
return yield this.acpClient.transferFunds(
|
|
2507
|
+
this.id,
|
|
2508
|
+
payload.amount,
|
|
2509
|
+
this.clientAddress,
|
|
2510
|
+
0,
|
|
2511
|
+
0 /* NO_FEE */,
|
|
2512
|
+
{
|
|
2513
|
+
type: "unfulfilled_position" /* UNFULFILLED_POSITION */,
|
|
2514
|
+
data: payload
|
|
2515
|
+
},
|
|
2516
|
+
2 /* TRANSACTION */,
|
|
2517
|
+
expiredAt
|
|
2518
|
+
);
|
|
2519
|
+
});
|
|
2520
|
+
}
|
|
2521
|
+
responseUnfulfilledPosition(memoId, accept, reason) {
|
|
2522
|
+
return __async(this, null, function* () {
|
|
2523
|
+
const memo = this.memos.find((m) => m.id === memoId);
|
|
2524
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2525
|
+
throw new Error("No unfulfilled position memo found");
|
|
2526
|
+
}
|
|
2527
|
+
const payload = tryParseJson(
|
|
2528
|
+
memo.content
|
|
2529
|
+
);
|
|
2530
|
+
if ((payload == null ? void 0 : payload.type) !== "unfulfilled_position" /* UNFULFILLED_POSITION */) {
|
|
2531
|
+
throw new Error("Invalid unfulfilled position memo");
|
|
2532
|
+
}
|
|
2533
|
+
return yield this.acpClient.responseFundsTransfer(memo.id, accept, reason);
|
|
2534
|
+
});
|
|
2535
|
+
}
|
|
2536
|
+
responsePositionFulfilled(memoId, accept, reason) {
|
|
2537
|
+
return __async(this, null, function* () {
|
|
2538
|
+
const memo = this.memos.find((m) => m.id === memoId);
|
|
2539
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2540
|
+
throw new Error("No position fulfilled memo found");
|
|
2541
|
+
}
|
|
2542
|
+
const payload = tryParseJson(
|
|
2543
|
+
memo.content
|
|
2544
|
+
);
|
|
2545
|
+
if ((payload == null ? void 0 : payload.type) !== "position_fulfilled" /* POSITION_FULFILLED */) {
|
|
2546
|
+
throw new Error("Invalid position fulfilled memo");
|
|
2547
|
+
}
|
|
2548
|
+
return yield this.acpClient.responseFundsTransfer(memo.id, accept, reason);
|
|
2549
|
+
});
|
|
2550
|
+
}
|
|
2551
|
+
closeJob(message = "Close job and withdraw all") {
|
|
2552
|
+
return __async(this, null, function* () {
|
|
2553
|
+
return yield this.acpClient.sendMessage(
|
|
2554
|
+
this.id,
|
|
2555
|
+
{
|
|
2556
|
+
type: "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */,
|
|
2557
|
+
data: {
|
|
2558
|
+
message
|
|
2559
|
+
}
|
|
2560
|
+
},
|
|
2561
|
+
2 /* TRANSACTION */
|
|
2562
|
+
);
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
responseCloseJob(_0, _1, _2, _3) {
|
|
2566
|
+
return __async(this, arguments, function* (memoId, accept, fulfilledPositions, reason, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
2567
|
+
const memo = this.memos.find((m) => m.id === memoId);
|
|
2568
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 0 /* MESSAGE */) {
|
|
2569
|
+
throw new Error("No message memo found");
|
|
2570
|
+
}
|
|
2571
|
+
const payload = tryParseJson(
|
|
2572
|
+
memo.content
|
|
2573
|
+
);
|
|
2574
|
+
if ((payload == null ? void 0 : payload.type) !== "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */) {
|
|
2575
|
+
throw new Error("Invalid close job and withdraw memo");
|
|
2576
|
+
}
|
|
2577
|
+
yield memo.sign(accept, reason);
|
|
2578
|
+
if (!accept) {
|
|
2579
|
+
return;
|
|
2580
|
+
}
|
|
2581
|
+
const totalAmount = fulfilledPositions.reduce(
|
|
2582
|
+
(acc, curr) => acc + curr.amount,
|
|
2583
|
+
0
|
|
2584
|
+
);
|
|
2585
|
+
if (totalAmount === 0) {
|
|
2586
|
+
return yield this.acpClient.sendMessage(
|
|
2587
|
+
this.id,
|
|
2588
|
+
{
|
|
2589
|
+
type: "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */,
|
|
2590
|
+
data: fulfilledPositions
|
|
2591
|
+
},
|
|
2592
|
+
4 /* COMPLETED */
|
|
2593
|
+
);
|
|
2594
|
+
}
|
|
2595
|
+
return yield this.acpClient.transferFunds(
|
|
2596
|
+
this.id,
|
|
2597
|
+
fulfilledPositions.reduce((acc, curr) => acc + curr.amount, 0),
|
|
2598
|
+
this.clientAddress,
|
|
2599
|
+
0,
|
|
2600
|
+
0 /* NO_FEE */,
|
|
2601
|
+
{
|
|
2602
|
+
type: "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */,
|
|
2603
|
+
data: fulfilledPositions
|
|
2604
|
+
},
|
|
2605
|
+
4 /* COMPLETED */,
|
|
2606
|
+
expiredAt
|
|
2607
|
+
);
|
|
2608
|
+
});
|
|
2609
|
+
}
|
|
2610
|
+
confirmJobClosure(memoId, accept, reason) {
|
|
2611
|
+
return __async(this, null, function* () {
|
|
2612
|
+
const memo = this.memos.find((m) => m.id === memoId);
|
|
2613
|
+
if (!memo) {
|
|
2614
|
+
throw new Error("Memo not found");
|
|
2615
|
+
}
|
|
2616
|
+
const payload = tryParseJson(
|
|
2617
|
+
memo.content
|
|
2618
|
+
);
|
|
2619
|
+
if ((payload == null ? void 0 : payload.type) !== "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */) {
|
|
2620
|
+
throw new Error("Invalid close job and withdraw memo");
|
|
2621
|
+
}
|
|
2622
|
+
yield memo.sign(accept, reason);
|
|
2623
|
+
});
|
|
2624
|
+
}
|
|
1040
2625
|
};
|
|
1041
2626
|
var acpJob_default = AcpJob;
|
|
1042
2627
|
|
|
1043
2628
|
// src/acpMemo.ts
|
|
1044
2629
|
var AcpMemo = class {
|
|
1045
|
-
constructor(acpClient, id, type, content, nextPhase) {
|
|
2630
|
+
constructor(acpClient, id, type, content, nextPhase, status, signedReason, expiry) {
|
|
1046
2631
|
this.acpClient = acpClient;
|
|
1047
2632
|
this.id = id;
|
|
1048
2633
|
this.type = type;
|
|
1049
2634
|
this.content = content;
|
|
1050
2635
|
this.nextPhase = nextPhase;
|
|
2636
|
+
this.status = status;
|
|
2637
|
+
this.signedReason = signedReason;
|
|
2638
|
+
this.expiry = expiry;
|
|
2639
|
+
this.structuredContent = tryParseJson(this.content) || void 0;
|
|
2640
|
+
}
|
|
2641
|
+
get payloadType() {
|
|
2642
|
+
var _a;
|
|
2643
|
+
return (_a = this.structuredContent) == null ? void 0 : _a.type;
|
|
2644
|
+
}
|
|
2645
|
+
getStructuredContent() {
|
|
2646
|
+
return this.structuredContent;
|
|
1051
2647
|
}
|
|
1052
2648
|
create(jobId, isSecured = true) {
|
|
1053
2649
|
return __async(this, null, function* () {
|
|
@@ -1075,10 +2671,10 @@ var acpMemo_default = AcpMemo;
|
|
|
1075
2671
|
// src/acpJobOffering.ts
|
|
1076
2672
|
import Ajv from "ajv";
|
|
1077
2673
|
var AcpJobOffering = class {
|
|
1078
|
-
constructor(acpClient, providerAddress,
|
|
2674
|
+
constructor(acpClient, providerAddress, name, price, requirementSchema) {
|
|
1079
2675
|
this.acpClient = acpClient;
|
|
1080
2676
|
this.providerAddress = providerAddress;
|
|
1081
|
-
this.
|
|
2677
|
+
this.name = name;
|
|
1082
2678
|
this.price = price;
|
|
1083
2679
|
this.requirementSchema = requirementSchema;
|
|
1084
2680
|
this.ajv = new Ajv({ allErrors: true });
|
|
@@ -1092,9 +2688,21 @@ var AcpJobOffering = class {
|
|
|
1092
2688
|
throw new Error(this.ajv.errorsText(validator.errors));
|
|
1093
2689
|
}
|
|
1094
2690
|
}
|
|
2691
|
+
let finalServiceRequirement = {
|
|
2692
|
+
serviceName: this.name
|
|
2693
|
+
};
|
|
2694
|
+
if (typeof serviceRequirement === "string") {
|
|
2695
|
+
finalServiceRequirement = __spreadProps(__spreadValues({}, finalServiceRequirement), {
|
|
2696
|
+
message: serviceRequirement
|
|
2697
|
+
});
|
|
2698
|
+
} else {
|
|
2699
|
+
finalServiceRequirement = __spreadProps(__spreadValues({}, finalServiceRequirement), {
|
|
2700
|
+
serviceRequirement
|
|
2701
|
+
});
|
|
2702
|
+
}
|
|
1095
2703
|
return yield this.acpClient.initiateJob(
|
|
1096
2704
|
this.providerAddress,
|
|
1097
|
-
|
|
2705
|
+
finalServiceRequirement,
|
|
1098
2706
|
this.price,
|
|
1099
2707
|
evaluatorAddress,
|
|
1100
2708
|
expiredAt
|
|
@@ -1105,6 +2713,7 @@ var AcpJobOffering = class {
|
|
|
1105
2713
|
var acpJobOffering_default = AcpJobOffering;
|
|
1106
2714
|
|
|
1107
2715
|
// src/acpClient.ts
|
|
2716
|
+
var { version } = require_package();
|
|
1108
2717
|
var AcpClient = class {
|
|
1109
2718
|
constructor(options) {
|
|
1110
2719
|
this.acpContractClient = options.acpContractClient;
|
|
@@ -1121,11 +2730,16 @@ var AcpClient = class {
|
|
|
1121
2730
|
init() {
|
|
1122
2731
|
return __async(this, null, function* () {
|
|
1123
2732
|
const socket = io(this.acpUrl, {
|
|
1124
|
-
auth: __spreadValues(
|
|
2733
|
+
auth: __spreadValues({
|
|
1125
2734
|
walletAddress: this.acpContractClient.walletAddress
|
|
1126
|
-
}
|
|
2735
|
+
}, this.onEvaluate !== this.defaultOnEvaluate && {
|
|
1127
2736
|
evaluatorAddress: this.acpContractClient.walletAddress
|
|
1128
|
-
})
|
|
2737
|
+
}),
|
|
2738
|
+
extraHeaders: {
|
|
2739
|
+
"x-sdk-version": version,
|
|
2740
|
+
"x-sdk-language": "node"
|
|
2741
|
+
},
|
|
2742
|
+
transports: ["websocket"]
|
|
1129
2743
|
});
|
|
1130
2744
|
socket.on("roomJoined" /* ROOM_JOINED */, (_, callback) => {
|
|
1131
2745
|
console.log("Joined ACP Room");
|
|
@@ -1143,13 +2757,17 @@ var AcpClient = class {
|
|
|
1143
2757
|
data.providerAddress,
|
|
1144
2758
|
data.evaluatorAddress,
|
|
1145
2759
|
data.price,
|
|
2760
|
+
data.priceTokenAddress,
|
|
1146
2761
|
data.memos.map((memo) => {
|
|
1147
2762
|
return new acpMemo_default(
|
|
1148
2763
|
this,
|
|
1149
2764
|
memo.id,
|
|
1150
2765
|
memo.memoType,
|
|
1151
2766
|
memo.content,
|
|
1152
|
-
memo.nextPhase
|
|
2767
|
+
memo.nextPhase,
|
|
2768
|
+
memo.status,
|
|
2769
|
+
memo.signedReason,
|
|
2770
|
+
memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
|
|
1153
2771
|
);
|
|
1154
2772
|
}),
|
|
1155
2773
|
data.phase,
|
|
@@ -1171,19 +2789,26 @@ var AcpClient = class {
|
|
|
1171
2789
|
data.providerAddress,
|
|
1172
2790
|
data.evaluatorAddress,
|
|
1173
2791
|
data.price,
|
|
2792
|
+
data.priceTokenAddress,
|
|
1174
2793
|
data.memos.map((memo) => {
|
|
1175
2794
|
return new acpMemo_default(
|
|
1176
2795
|
this,
|
|
1177
2796
|
memo.id,
|
|
1178
2797
|
memo.memoType,
|
|
1179
2798
|
memo.content,
|
|
1180
|
-
memo.nextPhase
|
|
2799
|
+
memo.nextPhase,
|
|
2800
|
+
memo.status,
|
|
2801
|
+
memo.signedReason,
|
|
2802
|
+
memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
|
|
1181
2803
|
);
|
|
1182
2804
|
}),
|
|
1183
2805
|
data.phase,
|
|
1184
2806
|
data.context
|
|
1185
2807
|
);
|
|
1186
|
-
this.onNewTask(
|
|
2808
|
+
this.onNewTask(
|
|
2809
|
+
job,
|
|
2810
|
+
job.memos.find((m) => m.id == data.memoToSign)
|
|
2811
|
+
);
|
|
1187
2812
|
}
|
|
1188
2813
|
})
|
|
1189
2814
|
);
|
|
@@ -1199,28 +2824,26 @@ var AcpClient = class {
|
|
|
1199
2824
|
}
|
|
1200
2825
|
browseAgents(keyword, options) {
|
|
1201
2826
|
return __async(this, null, function* () {
|
|
1202
|
-
let { cluster, sort_by,
|
|
1203
|
-
rerank = rerank != null ? rerank : false;
|
|
2827
|
+
let { cluster, sort_by, top_k, graduationStatus, onlineStatus } = options;
|
|
1204
2828
|
top_k = top_k != null ? top_k : 5;
|
|
1205
|
-
|
|
1206
|
-
let url = `${this.acpUrl}/api/agents?search=${keyword}`;
|
|
2829
|
+
let url = `${this.acpUrl}/api/agents/v2/search?search=${keyword}`;
|
|
1207
2830
|
if (sort_by && sort_by.length > 0) {
|
|
1208
|
-
url += `&
|
|
2831
|
+
url += `&sortBy=${sort_by.map((s) => s).join(",")}`;
|
|
1209
2832
|
}
|
|
1210
2833
|
if (top_k) {
|
|
1211
2834
|
url += `&top_k=${top_k}`;
|
|
1212
2835
|
}
|
|
1213
|
-
if (rerank) {
|
|
1214
|
-
url += `&rerank=true`;
|
|
1215
|
-
}
|
|
1216
2836
|
if (this.acpContractClient.walletAddress) {
|
|
1217
|
-
url += `&
|
|
2837
|
+
url += `&walletAddressesToExclude=${this.acpContractClient.walletAddress}`;
|
|
1218
2838
|
}
|
|
1219
2839
|
if (cluster) {
|
|
1220
|
-
url += `&
|
|
2840
|
+
url += `&cluster=${cluster}`;
|
|
1221
2841
|
}
|
|
1222
|
-
if (
|
|
1223
|
-
url += `&
|
|
2842
|
+
if (graduationStatus) {
|
|
2843
|
+
url += `&graduationStatus=${graduationStatus}`;
|
|
2844
|
+
}
|
|
2845
|
+
if (onlineStatus) {
|
|
2846
|
+
url += `&onlineStatus=${onlineStatus}`;
|
|
1224
2847
|
}
|
|
1225
2848
|
const response = yield fetch(url);
|
|
1226
2849
|
const data = yield response.json();
|
|
@@ -1234,7 +2857,7 @@ var AcpClient = class {
|
|
|
1234
2857
|
this,
|
|
1235
2858
|
agent.walletAddress,
|
|
1236
2859
|
offering.name,
|
|
1237
|
-
offering.
|
|
2860
|
+
offering.priceUsd,
|
|
1238
2861
|
offering.requirementSchema
|
|
1239
2862
|
);
|
|
1240
2863
|
}),
|
|
@@ -1252,10 +2875,7 @@ var AcpClient = class {
|
|
|
1252
2875
|
evaluatorAddress || this.acpContractClient.walletAddress,
|
|
1253
2876
|
expiredAt
|
|
1254
2877
|
);
|
|
1255
|
-
yield this.acpContractClient.
|
|
1256
|
-
jobId,
|
|
1257
|
-
parseEther(amount.toString())
|
|
1258
|
-
);
|
|
2878
|
+
yield this.acpContractClient.setBudgetWithPaymentToken(jobId, amount);
|
|
1259
2879
|
yield this.acpContractClient.createMemo(
|
|
1260
2880
|
jobId,
|
|
1261
2881
|
typeof serviceRequirement === "string" ? serviceRequirement : JSON.stringify(serviceRequirement),
|
|
@@ -1266,7 +2886,7 @@ var AcpClient = class {
|
|
|
1266
2886
|
return jobId;
|
|
1267
2887
|
});
|
|
1268
2888
|
}
|
|
1269
|
-
respondJob(jobId, memoId, accept, reason) {
|
|
2889
|
+
respondJob(jobId, memoId, accept, content, reason) {
|
|
1270
2890
|
return __async(this, null, function* () {
|
|
1271
2891
|
yield this.acpContractClient.signMemo(memoId, accept, reason);
|
|
1272
2892
|
if (!accept) {
|
|
@@ -1274,7 +2894,7 @@ var AcpClient = class {
|
|
|
1274
2894
|
}
|
|
1275
2895
|
return yield this.acpContractClient.createMemo(
|
|
1276
2896
|
jobId,
|
|
1277
|
-
`Job ${jobId} accepted. ${reason != null ? reason : ""}`,
|
|
2897
|
+
content != null ? content : `Job ${jobId} accepted. ${reason != null ? reason : ""}`,
|
|
1278
2898
|
0 /* MESSAGE */,
|
|
1279
2899
|
false,
|
|
1280
2900
|
2 /* TRANSACTION */
|
|
@@ -1283,9 +2903,9 @@ var AcpClient = class {
|
|
|
1283
2903
|
}
|
|
1284
2904
|
payJob(jobId, amount, memoId, reason) {
|
|
1285
2905
|
return __async(this, null, function* () {
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
2906
|
+
if (amount > 0) {
|
|
2907
|
+
yield this.acpContractClient.approveAllowance(amount);
|
|
2908
|
+
}
|
|
1289
2909
|
yield this.acpContractClient.signMemo(memoId, true, reason);
|
|
1290
2910
|
return yield this.acpContractClient.createMemo(
|
|
1291
2911
|
jobId,
|
|
@@ -1296,11 +2916,72 @@ var AcpClient = class {
|
|
|
1296
2916
|
);
|
|
1297
2917
|
});
|
|
1298
2918
|
}
|
|
2919
|
+
requestFunds(jobId, amount, recipient, feeAmount, feeType, reason, nextPhase, expiredAt) {
|
|
2920
|
+
return __async(this, null, function* () {
|
|
2921
|
+
return yield this.acpContractClient.createPayableMemo(
|
|
2922
|
+
jobId,
|
|
2923
|
+
JSON.stringify(reason),
|
|
2924
|
+
amount,
|
|
2925
|
+
recipient,
|
|
2926
|
+
feeAmount,
|
|
2927
|
+
feeType,
|
|
2928
|
+
nextPhase,
|
|
2929
|
+
6 /* PAYABLE_REQUEST */,
|
|
2930
|
+
expiredAt
|
|
2931
|
+
);
|
|
2932
|
+
});
|
|
2933
|
+
}
|
|
2934
|
+
responseFundsRequest(memoId, accept, amount, reason) {
|
|
2935
|
+
return __async(this, null, function* () {
|
|
2936
|
+
if (!accept) {
|
|
2937
|
+
return yield this.acpContractClient.signMemo(memoId, accept, reason);
|
|
2938
|
+
}
|
|
2939
|
+
if (amount > 0) {
|
|
2940
|
+
yield this.acpContractClient.approveAllowance(amount);
|
|
2941
|
+
}
|
|
2942
|
+
return yield this.acpContractClient.signMemo(memoId, true, reason);
|
|
2943
|
+
});
|
|
2944
|
+
}
|
|
2945
|
+
transferFunds(jobId, amount, recipient, feeAmount, feeType, reason, nextPhase, expiredAt) {
|
|
2946
|
+
return __async(this, null, function* () {
|
|
2947
|
+
const totalAmount = amount + feeAmount;
|
|
2948
|
+
if (totalAmount > 0) {
|
|
2949
|
+
yield this.acpContractClient.approveAllowance(totalAmount);
|
|
2950
|
+
}
|
|
2951
|
+
return yield this.acpContractClient.createPayableMemo(
|
|
2952
|
+
jobId,
|
|
2953
|
+
JSON.stringify(reason),
|
|
2954
|
+
amount,
|
|
2955
|
+
recipient,
|
|
2956
|
+
feeAmount,
|
|
2957
|
+
feeType,
|
|
2958
|
+
nextPhase,
|
|
2959
|
+
8 /* PAYABLE_TRANSFER_ESCROW */,
|
|
2960
|
+
expiredAt
|
|
2961
|
+
);
|
|
2962
|
+
});
|
|
2963
|
+
}
|
|
2964
|
+
sendMessage(jobId, message, nextPhase) {
|
|
2965
|
+
return __async(this, null, function* () {
|
|
2966
|
+
return yield this.acpContractClient.createMemo(
|
|
2967
|
+
jobId,
|
|
2968
|
+
JSON.stringify(message),
|
|
2969
|
+
0 /* MESSAGE */,
|
|
2970
|
+
false,
|
|
2971
|
+
nextPhase
|
|
2972
|
+
);
|
|
2973
|
+
});
|
|
2974
|
+
}
|
|
2975
|
+
responseFundsTransfer(memoId, accept, reason) {
|
|
2976
|
+
return __async(this, null, function* () {
|
|
2977
|
+
return yield this.acpContractClient.signMemo(memoId, accept, reason);
|
|
2978
|
+
});
|
|
2979
|
+
}
|
|
1299
2980
|
deliverJob(jobId, deliverable) {
|
|
1300
2981
|
return __async(this, null, function* () {
|
|
1301
2982
|
return yield this.acpContractClient.createMemo(
|
|
1302
2983
|
jobId,
|
|
1303
|
-
deliverable,
|
|
2984
|
+
JSON.stringify(deliverable),
|
|
1304
2985
|
4 /* OBJECT_URL */,
|
|
1305
2986
|
true,
|
|
1306
2987
|
4 /* COMPLETED */
|
|
@@ -1328,13 +3009,17 @@ var AcpClient = class {
|
|
|
1328
3009
|
job.providerAddress,
|
|
1329
3010
|
job.evaluatorAddress,
|
|
1330
3011
|
job.price,
|
|
3012
|
+
job.priceTokenAddress,
|
|
1331
3013
|
job.memos.map((memo) => {
|
|
1332
3014
|
return new acpMemo_default(
|
|
1333
3015
|
this,
|
|
1334
3016
|
memo.id,
|
|
1335
3017
|
memo.memoType,
|
|
1336
3018
|
memo.content,
|
|
1337
|
-
memo.nextPhase
|
|
3019
|
+
memo.nextPhase,
|
|
3020
|
+
memo.status,
|
|
3021
|
+
memo.signedReason,
|
|
3022
|
+
memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
|
|
1338
3023
|
);
|
|
1339
3024
|
}),
|
|
1340
3025
|
job.phase,
|
|
@@ -1367,13 +3052,17 @@ var AcpClient = class {
|
|
|
1367
3052
|
job.providerAddress,
|
|
1368
3053
|
job.evaluatorAddress,
|
|
1369
3054
|
job.price,
|
|
3055
|
+
job.priceTokenAddress,
|
|
1370
3056
|
job.memos.map((memo) => {
|
|
1371
3057
|
return new acpMemo_default(
|
|
1372
3058
|
this,
|
|
1373
3059
|
memo.id,
|
|
1374
3060
|
memo.memoType,
|
|
1375
3061
|
memo.content,
|
|
1376
|
-
memo.nextPhase
|
|
3062
|
+
memo.nextPhase,
|
|
3063
|
+
memo.status,
|
|
3064
|
+
memo.signedReason,
|
|
3065
|
+
memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
|
|
1377
3066
|
);
|
|
1378
3067
|
}),
|
|
1379
3068
|
job.phase,
|
|
@@ -1406,13 +3095,17 @@ var AcpClient = class {
|
|
|
1406
3095
|
job.providerAddress,
|
|
1407
3096
|
job.evaluatorAddress,
|
|
1408
3097
|
job.price,
|
|
3098
|
+
job.priceTokenAddress,
|
|
1409
3099
|
job.memos.map((memo) => {
|
|
1410
3100
|
return new acpMemo_default(
|
|
1411
3101
|
this,
|
|
1412
3102
|
memo.id,
|
|
1413
3103
|
memo.memoType,
|
|
1414
3104
|
memo.content,
|
|
1415
|
-
memo.nextPhase
|
|
3105
|
+
memo.nextPhase,
|
|
3106
|
+
memo.status,
|
|
3107
|
+
memo.signedReason,
|
|
3108
|
+
memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
|
|
1416
3109
|
);
|
|
1417
3110
|
}),
|
|
1418
3111
|
job.phase,
|
|
@@ -1448,13 +3141,17 @@ var AcpClient = class {
|
|
|
1448
3141
|
job.providerAddress,
|
|
1449
3142
|
job.evaluatorAddress,
|
|
1450
3143
|
job.price,
|
|
3144
|
+
job.priceTokenAddress,
|
|
1451
3145
|
job.memos.map((memo) => {
|
|
1452
3146
|
return new acpMemo_default(
|
|
1453
3147
|
this,
|
|
1454
3148
|
memo.id,
|
|
1455
3149
|
memo.memoType,
|
|
1456
3150
|
memo.content,
|
|
1457
|
-
memo.nextPhase
|
|
3151
|
+
memo.nextPhase,
|
|
3152
|
+
memo.status,
|
|
3153
|
+
memo.signedReason,
|
|
3154
|
+
memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
|
|
1458
3155
|
);
|
|
1459
3156
|
}),
|
|
1460
3157
|
job.phase,
|
|
@@ -1487,7 +3184,10 @@ var AcpClient = class {
|
|
|
1487
3184
|
memo.id,
|
|
1488
3185
|
memo.memoType,
|
|
1489
3186
|
memo.content,
|
|
1490
|
-
memo.nextPhase
|
|
3187
|
+
memo.nextPhase,
|
|
3188
|
+
memo.status,
|
|
3189
|
+
memo.signedReason,
|
|
3190
|
+
memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
|
|
1491
3191
|
);
|
|
1492
3192
|
} catch (error) {
|
|
1493
3193
|
throw error;
|
|
@@ -1509,26 +3209,20 @@ var AcpClient = class {
|
|
|
1509
3209
|
};
|
|
1510
3210
|
var acpClient_default = AcpClient;
|
|
1511
3211
|
|
|
1512
|
-
// src/interfaces.ts
|
|
1513
|
-
var AcpAgentSort = /* @__PURE__ */ ((AcpAgentSort2) => {
|
|
1514
|
-
AcpAgentSort2["SUCCESSFUL_JOB_COUNT"] = "successfulJobCount";
|
|
1515
|
-
AcpAgentSort2["SUCCESS_RATE"] = "successRate";
|
|
1516
|
-
AcpAgentSort2["UNIQUE_BUYER_COUNT"] = "uniqueBuyerCount";
|
|
1517
|
-
AcpAgentSort2["MINS_FROM_LAST_ONLINE"] = "minsFromLastOnlineTime";
|
|
1518
|
-
AcpAgentSort2["IS_ONLINE"] = "isOnline";
|
|
1519
|
-
return AcpAgentSort2;
|
|
1520
|
-
})(AcpAgentSort || {});
|
|
1521
|
-
|
|
1522
3212
|
// src/index.ts
|
|
1523
3213
|
var index_default = acpClient_default;
|
|
1524
3214
|
export {
|
|
1525
3215
|
acpAbi_default as ACP_ABI,
|
|
1526
3216
|
AcpAgentSort,
|
|
1527
3217
|
acpContractClient_default as AcpContractClient,
|
|
3218
|
+
AcpGraduationStatus,
|
|
1528
3219
|
acpJob_default as AcpJob,
|
|
1529
3220
|
AcpJobPhases,
|
|
1530
3221
|
acpMemo_default as AcpMemo,
|
|
3222
|
+
AcpMemoStatus,
|
|
3223
|
+
AcpOnlineStatus,
|
|
1531
3224
|
MemoType,
|
|
3225
|
+
PayloadType,
|
|
1532
3226
|
baseAcpConfig,
|
|
1533
3227
|
baseSepoliaAcpConfig,
|
|
1534
3228
|
index_default as default
|