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