@virtuals-protocol/acp-node 0.2.0-beta.1 → 0.2.0-beta.10
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 +24 -8
- package/dist/index.d.mts +284 -214
- package/dist/index.d.ts +284 -214
- package/dist/index.js +1698 -512
- package/dist/index.mjs +1678 -508
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
5
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -15,6 +17,7 @@ var __spreadValues = (a, b) => {
|
|
|
15
17
|
}
|
|
16
18
|
return a;
|
|
17
19
|
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
18
21
|
var __commonJS = (cb, mod) => function __require() {
|
|
19
22
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
20
23
|
};
|
|
@@ -44,7 +47,7 @@ var require_package = __commonJS({
|
|
|
44
47
|
"package.json"(exports, module) {
|
|
45
48
|
module.exports = {
|
|
46
49
|
name: "@virtuals-protocol/acp-node",
|
|
47
|
-
version: "0.2.0-beta.
|
|
50
|
+
version: "0.2.0-beta.10",
|
|
48
51
|
main: "./dist/index.js",
|
|
49
52
|
module: "./dist/index.mjs",
|
|
50
53
|
types: "./dist/index.d.ts",
|
|
@@ -76,32 +79,82 @@ var require_package = __commonJS({
|
|
|
76
79
|
|
|
77
80
|
// src/acpAbi.ts
|
|
78
81
|
var ACP_ABI = [
|
|
79
|
-
{
|
|
80
|
-
|
|
82
|
+
{
|
|
83
|
+
inputs: [],
|
|
84
|
+
stateMutability: "nonpayable",
|
|
85
|
+
type: "constructor"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
inputs: [],
|
|
89
|
+
name: "AccessControlBadConfirmation",
|
|
90
|
+
type: "error"
|
|
91
|
+
},
|
|
81
92
|
{
|
|
82
93
|
inputs: [
|
|
83
|
-
{
|
|
84
|
-
|
|
94
|
+
{
|
|
95
|
+
internalType: "address",
|
|
96
|
+
name: "account",
|
|
97
|
+
type: "address"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
internalType: "bytes32",
|
|
101
|
+
name: "neededRole",
|
|
102
|
+
type: "bytes32"
|
|
103
|
+
}
|
|
85
104
|
],
|
|
86
105
|
name: "AccessControlUnauthorizedAccount",
|
|
87
106
|
type: "error"
|
|
88
107
|
},
|
|
89
108
|
{
|
|
90
|
-
inputs: [
|
|
109
|
+
inputs: [
|
|
110
|
+
{
|
|
111
|
+
internalType: "address",
|
|
112
|
+
name: "target",
|
|
113
|
+
type: "address"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
91
116
|
name: "AddressEmptyCode",
|
|
92
117
|
type: "error"
|
|
93
118
|
},
|
|
94
119
|
{
|
|
95
|
-
inputs: [
|
|
120
|
+
inputs: [
|
|
121
|
+
{
|
|
122
|
+
internalType: "address",
|
|
123
|
+
name: "account",
|
|
124
|
+
type: "address"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
96
127
|
name: "AddressInsufficientBalance",
|
|
97
128
|
type: "error"
|
|
98
129
|
},
|
|
99
|
-
{ inputs: [], name: "FailedInnerCall", type: "error" },
|
|
100
|
-
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
101
|
-
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
102
|
-
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
|
|
103
130
|
{
|
|
104
|
-
inputs: [
|
|
131
|
+
inputs: [],
|
|
132
|
+
name: "FailedInnerCall",
|
|
133
|
+
type: "error"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
inputs: [],
|
|
137
|
+
name: "InvalidInitialization",
|
|
138
|
+
type: "error"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
inputs: [],
|
|
142
|
+
name: "NotInitializing",
|
|
143
|
+
type: "error"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
inputs: [],
|
|
147
|
+
name: "ReentrancyGuardReentrantCall",
|
|
148
|
+
type: "error"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
inputs: [
|
|
152
|
+
{
|
|
153
|
+
internalType: "address",
|
|
154
|
+
name: "token",
|
|
155
|
+
type: "address"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
105
158
|
name: "SafeERC20FailedOperation",
|
|
106
159
|
type: "error"
|
|
107
160
|
},
|
|
@@ -218,6 +271,25 @@ var ACP_ABI = [
|
|
|
218
271
|
name: "JobCreated",
|
|
219
272
|
type: "event"
|
|
220
273
|
},
|
|
274
|
+
{
|
|
275
|
+
anonymous: false,
|
|
276
|
+
inputs: [
|
|
277
|
+
{
|
|
278
|
+
indexed: true,
|
|
279
|
+
internalType: "uint256",
|
|
280
|
+
name: "jobId",
|
|
281
|
+
type: "uint256"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
indexed: true,
|
|
285
|
+
internalType: "address",
|
|
286
|
+
name: "paymentToken",
|
|
287
|
+
type: "address"
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
name: "JobPaymentTokenSet",
|
|
291
|
+
type: "event"
|
|
292
|
+
},
|
|
221
293
|
{
|
|
222
294
|
anonymous: false,
|
|
223
295
|
inputs: [
|
|
@@ -233,7 +305,12 @@ var ACP_ABI = [
|
|
|
233
305
|
name: "oldPhase",
|
|
234
306
|
type: "uint8"
|
|
235
307
|
},
|
|
236
|
-
{
|
|
308
|
+
{
|
|
309
|
+
indexed: false,
|
|
310
|
+
internalType: "uint8",
|
|
311
|
+
name: "phase",
|
|
312
|
+
type: "uint8"
|
|
313
|
+
}
|
|
237
314
|
],
|
|
238
315
|
name: "JobPhaseUpdated",
|
|
239
316
|
type: "event"
|
|
@@ -377,8 +454,61 @@ var ACP_ABI = [
|
|
|
377
454
|
name: "memoId",
|
|
378
455
|
type: "uint256"
|
|
379
456
|
},
|
|
380
|
-
{
|
|
381
|
-
|
|
457
|
+
{
|
|
458
|
+
indexed: true,
|
|
459
|
+
internalType: "address",
|
|
460
|
+
name: "sender",
|
|
461
|
+
type: "address"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
indexed: false,
|
|
465
|
+
internalType: "address",
|
|
466
|
+
name: "token",
|
|
467
|
+
type: "address"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
indexed: false,
|
|
471
|
+
internalType: "uint256",
|
|
472
|
+
name: "amount",
|
|
473
|
+
type: "uint256"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
indexed: false,
|
|
477
|
+
internalType: "uint256",
|
|
478
|
+
name: "feeAmount",
|
|
479
|
+
type: "uint256"
|
|
480
|
+
}
|
|
481
|
+
],
|
|
482
|
+
name: "PayableFundsEscrowed",
|
|
483
|
+
type: "event"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
anonymous: false,
|
|
487
|
+
inputs: [
|
|
488
|
+
{
|
|
489
|
+
indexed: true,
|
|
490
|
+
internalType: "uint256",
|
|
491
|
+
name: "jobId",
|
|
492
|
+
type: "uint256"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
indexed: true,
|
|
496
|
+
internalType: "uint256",
|
|
497
|
+
name: "memoId",
|
|
498
|
+
type: "uint256"
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
indexed: true,
|
|
502
|
+
internalType: "address",
|
|
503
|
+
name: "from",
|
|
504
|
+
type: "address"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
indexed: false,
|
|
508
|
+
internalType: "address",
|
|
509
|
+
name: "to",
|
|
510
|
+
type: "address"
|
|
511
|
+
},
|
|
382
512
|
{
|
|
383
513
|
indexed: false,
|
|
384
514
|
internalType: "address",
|
|
@@ -410,8 +540,18 @@ var ACP_ABI = [
|
|
|
410
540
|
name: "memoId",
|
|
411
541
|
type: "uint256"
|
|
412
542
|
},
|
|
413
|
-
{
|
|
414
|
-
|
|
543
|
+
{
|
|
544
|
+
indexed: true,
|
|
545
|
+
internalType: "address",
|
|
546
|
+
name: "from",
|
|
547
|
+
type: "address"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
indexed: false,
|
|
551
|
+
internalType: "address",
|
|
552
|
+
name: "to",
|
|
553
|
+
type: "address"
|
|
554
|
+
},
|
|
415
555
|
{
|
|
416
556
|
indexed: false,
|
|
417
557
|
internalType: "address",
|
|
@@ -481,7 +621,12 @@ var ACP_ABI = [
|
|
|
481
621
|
{
|
|
482
622
|
anonymous: false,
|
|
483
623
|
inputs: [
|
|
484
|
-
{
|
|
624
|
+
{
|
|
625
|
+
indexed: true,
|
|
626
|
+
internalType: "bytes32",
|
|
627
|
+
name: "role",
|
|
628
|
+
type: "bytes32"
|
|
629
|
+
},
|
|
485
630
|
{
|
|
486
631
|
indexed: true,
|
|
487
632
|
internalType: "bytes32",
|
|
@@ -501,7 +646,12 @@ var ACP_ABI = [
|
|
|
501
646
|
{
|
|
502
647
|
anonymous: false,
|
|
503
648
|
inputs: [
|
|
504
|
-
{
|
|
649
|
+
{
|
|
650
|
+
indexed: true,
|
|
651
|
+
internalType: "bytes32",
|
|
652
|
+
name: "role",
|
|
653
|
+
type: "bytes32"
|
|
654
|
+
},
|
|
505
655
|
{
|
|
506
656
|
indexed: true,
|
|
507
657
|
internalType: "address",
|
|
@@ -521,7 +671,12 @@ var ACP_ABI = [
|
|
|
521
671
|
{
|
|
522
672
|
anonymous: false,
|
|
523
673
|
inputs: [
|
|
524
|
-
{
|
|
674
|
+
{
|
|
675
|
+
indexed: true,
|
|
676
|
+
internalType: "bytes32",
|
|
677
|
+
name: "role",
|
|
678
|
+
type: "bytes32"
|
|
679
|
+
},
|
|
525
680
|
{
|
|
526
681
|
indexed: true,
|
|
527
682
|
internalType: "address",
|
|
@@ -541,87 +696,192 @@ var ACP_ABI = [
|
|
|
541
696
|
{
|
|
542
697
|
inputs: [],
|
|
543
698
|
name: "ADMIN_ROLE",
|
|
544
|
-
outputs: [
|
|
699
|
+
outputs: [
|
|
700
|
+
{
|
|
701
|
+
internalType: "bytes32",
|
|
702
|
+
name: "",
|
|
703
|
+
type: "bytes32"
|
|
704
|
+
}
|
|
705
|
+
],
|
|
545
706
|
stateMutability: "view",
|
|
546
707
|
type: "function"
|
|
547
708
|
},
|
|
548
709
|
{
|
|
549
710
|
inputs: [],
|
|
550
711
|
name: "DEFAULT_ADMIN_ROLE",
|
|
551
|
-
outputs: [
|
|
712
|
+
outputs: [
|
|
713
|
+
{
|
|
714
|
+
internalType: "bytes32",
|
|
715
|
+
name: "",
|
|
716
|
+
type: "bytes32"
|
|
717
|
+
}
|
|
718
|
+
],
|
|
552
719
|
stateMutability: "view",
|
|
553
720
|
type: "function"
|
|
554
721
|
},
|
|
555
722
|
{
|
|
556
723
|
inputs: [],
|
|
557
724
|
name: "PHASE_COMPLETED",
|
|
558
|
-
outputs: [
|
|
725
|
+
outputs: [
|
|
726
|
+
{
|
|
727
|
+
internalType: "uint8",
|
|
728
|
+
name: "",
|
|
729
|
+
type: "uint8"
|
|
730
|
+
}
|
|
731
|
+
],
|
|
559
732
|
stateMutability: "view",
|
|
560
733
|
type: "function"
|
|
561
734
|
},
|
|
562
735
|
{
|
|
563
736
|
inputs: [],
|
|
564
737
|
name: "PHASE_EVALUATION",
|
|
565
|
-
outputs: [
|
|
738
|
+
outputs: [
|
|
739
|
+
{
|
|
740
|
+
internalType: "uint8",
|
|
741
|
+
name: "",
|
|
742
|
+
type: "uint8"
|
|
743
|
+
}
|
|
744
|
+
],
|
|
566
745
|
stateMutability: "view",
|
|
567
746
|
type: "function"
|
|
568
747
|
},
|
|
569
748
|
{
|
|
570
749
|
inputs: [],
|
|
571
750
|
name: "PHASE_EXPIRED",
|
|
572
|
-
outputs: [
|
|
751
|
+
outputs: [
|
|
752
|
+
{
|
|
753
|
+
internalType: "uint8",
|
|
754
|
+
name: "",
|
|
755
|
+
type: "uint8"
|
|
756
|
+
}
|
|
757
|
+
],
|
|
573
758
|
stateMutability: "view",
|
|
574
759
|
type: "function"
|
|
575
760
|
},
|
|
576
761
|
{
|
|
577
762
|
inputs: [],
|
|
578
763
|
name: "PHASE_NEGOTIATION",
|
|
579
|
-
outputs: [
|
|
764
|
+
outputs: [
|
|
765
|
+
{
|
|
766
|
+
internalType: "uint8",
|
|
767
|
+
name: "",
|
|
768
|
+
type: "uint8"
|
|
769
|
+
}
|
|
770
|
+
],
|
|
580
771
|
stateMutability: "view",
|
|
581
772
|
type: "function"
|
|
582
773
|
},
|
|
583
774
|
{
|
|
584
775
|
inputs: [],
|
|
585
776
|
name: "PHASE_REJECTED",
|
|
586
|
-
outputs: [
|
|
777
|
+
outputs: [
|
|
778
|
+
{
|
|
779
|
+
internalType: "uint8",
|
|
780
|
+
name: "",
|
|
781
|
+
type: "uint8"
|
|
782
|
+
}
|
|
783
|
+
],
|
|
587
784
|
stateMutability: "view",
|
|
588
785
|
type: "function"
|
|
589
786
|
},
|
|
590
787
|
{
|
|
591
788
|
inputs: [],
|
|
592
789
|
name: "PHASE_REQUEST",
|
|
593
|
-
outputs: [
|
|
790
|
+
outputs: [
|
|
791
|
+
{
|
|
792
|
+
internalType: "uint8",
|
|
793
|
+
name: "",
|
|
794
|
+
type: "uint8"
|
|
795
|
+
}
|
|
796
|
+
],
|
|
594
797
|
stateMutability: "view",
|
|
595
798
|
type: "function"
|
|
596
799
|
},
|
|
597
800
|
{
|
|
598
801
|
inputs: [],
|
|
599
802
|
name: "PHASE_TRANSACTION",
|
|
600
|
-
outputs: [
|
|
803
|
+
outputs: [
|
|
804
|
+
{
|
|
805
|
+
internalType: "uint8",
|
|
806
|
+
name: "",
|
|
807
|
+
type: "uint8"
|
|
808
|
+
}
|
|
809
|
+
],
|
|
601
810
|
stateMutability: "view",
|
|
602
811
|
type: "function"
|
|
603
812
|
},
|
|
604
813
|
{
|
|
605
814
|
inputs: [],
|
|
606
815
|
name: "TOTAL_PHASES",
|
|
607
|
-
outputs: [
|
|
816
|
+
outputs: [
|
|
817
|
+
{
|
|
818
|
+
internalType: "uint8",
|
|
819
|
+
name: "",
|
|
820
|
+
type: "uint8"
|
|
821
|
+
}
|
|
822
|
+
],
|
|
608
823
|
stateMutability: "view",
|
|
609
824
|
type: "function"
|
|
610
825
|
},
|
|
611
826
|
{
|
|
612
827
|
inputs: [
|
|
613
|
-
{
|
|
828
|
+
{
|
|
829
|
+
internalType: "address",
|
|
830
|
+
name: "account",
|
|
831
|
+
type: "address"
|
|
832
|
+
},
|
|
614
833
|
{
|
|
615
834
|
components: [
|
|
616
|
-
{
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
{
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
835
|
+
{
|
|
836
|
+
internalType: "uint256",
|
|
837
|
+
name: "id",
|
|
838
|
+
type: "uint256"
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
internalType: "address",
|
|
842
|
+
name: "client",
|
|
843
|
+
type: "address"
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
internalType: "address",
|
|
847
|
+
name: "provider",
|
|
848
|
+
type: "address"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
internalType: "uint256",
|
|
852
|
+
name: "budget",
|
|
853
|
+
type: "uint256"
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
internalType: "uint256",
|
|
857
|
+
name: "amountClaimed",
|
|
858
|
+
type: "uint256"
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
internalType: "uint8",
|
|
862
|
+
name: "phase",
|
|
863
|
+
type: "uint8"
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
internalType: "uint256",
|
|
867
|
+
name: "memoCount",
|
|
868
|
+
type: "uint256"
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
internalType: "uint256",
|
|
872
|
+
name: "expiredAt",
|
|
873
|
+
type: "uint256"
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
internalType: "address",
|
|
877
|
+
name: "evaluator",
|
|
878
|
+
type: "address"
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
internalType: "contract IERC20",
|
|
882
|
+
name: "jobPaymentToken",
|
|
883
|
+
type: "address"
|
|
884
|
+
}
|
|
625
885
|
],
|
|
626
886
|
internalType: "struct ACPSimple.Job",
|
|
627
887
|
name: "job",
|
|
@@ -629,12 +889,24 @@ var ACP_ABI = [
|
|
|
629
889
|
}
|
|
630
890
|
],
|
|
631
891
|
name: "canSign",
|
|
632
|
-
outputs: [
|
|
892
|
+
outputs: [
|
|
893
|
+
{
|
|
894
|
+
internalType: "bool",
|
|
895
|
+
name: "",
|
|
896
|
+
type: "bool"
|
|
897
|
+
}
|
|
898
|
+
],
|
|
633
899
|
stateMutability: "pure",
|
|
634
900
|
type: "function"
|
|
635
901
|
},
|
|
636
902
|
{
|
|
637
|
-
inputs: [
|
|
903
|
+
inputs: [
|
|
904
|
+
{
|
|
905
|
+
internalType: "uint256",
|
|
906
|
+
name: "id",
|
|
907
|
+
type: "uint256"
|
|
908
|
+
}
|
|
909
|
+
],
|
|
638
910
|
name: "claimBudget",
|
|
639
911
|
outputs: [],
|
|
640
912
|
stateMutability: "nonpayable",
|
|
@@ -642,40 +914,104 @@ var ACP_ABI = [
|
|
|
642
914
|
},
|
|
643
915
|
{
|
|
644
916
|
inputs: [
|
|
645
|
-
{
|
|
646
|
-
|
|
647
|
-
|
|
917
|
+
{
|
|
918
|
+
internalType: "address",
|
|
919
|
+
name: "provider",
|
|
920
|
+
type: "address"
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
internalType: "address",
|
|
924
|
+
name: "evaluator",
|
|
925
|
+
type: "address"
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
internalType: "uint256",
|
|
929
|
+
name: "expiredAt",
|
|
930
|
+
type: "uint256"
|
|
931
|
+
}
|
|
648
932
|
],
|
|
649
933
|
name: "createJob",
|
|
650
|
-
outputs: [
|
|
934
|
+
outputs: [
|
|
935
|
+
{
|
|
936
|
+
internalType: "uint256",
|
|
937
|
+
name: "",
|
|
938
|
+
type: "uint256"
|
|
939
|
+
}
|
|
940
|
+
],
|
|
651
941
|
stateMutability: "nonpayable",
|
|
652
942
|
type: "function"
|
|
653
943
|
},
|
|
654
944
|
{
|
|
655
945
|
inputs: [
|
|
656
|
-
{
|
|
657
|
-
|
|
946
|
+
{
|
|
947
|
+
internalType: "uint256",
|
|
948
|
+
name: "jobId",
|
|
949
|
+
type: "uint256"
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
internalType: "string",
|
|
953
|
+
name: "content",
|
|
954
|
+
type: "string"
|
|
955
|
+
},
|
|
658
956
|
{
|
|
659
957
|
internalType: "enum InteractionLedger.MemoType",
|
|
660
958
|
name: "memoType",
|
|
661
959
|
type: "uint8"
|
|
662
960
|
},
|
|
663
|
-
{
|
|
664
|
-
|
|
961
|
+
{
|
|
962
|
+
internalType: "bool",
|
|
963
|
+
name: "isSecured",
|
|
964
|
+
type: "bool"
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
internalType: "uint8",
|
|
968
|
+
name: "nextPhase",
|
|
969
|
+
type: "uint8"
|
|
970
|
+
}
|
|
665
971
|
],
|
|
666
972
|
name: "createMemo",
|
|
667
|
-
outputs: [
|
|
973
|
+
outputs: [
|
|
974
|
+
{
|
|
975
|
+
internalType: "uint256",
|
|
976
|
+
name: "",
|
|
977
|
+
type: "uint256"
|
|
978
|
+
}
|
|
979
|
+
],
|
|
668
980
|
stateMutability: "nonpayable",
|
|
669
981
|
type: "function"
|
|
670
982
|
},
|
|
671
983
|
{
|
|
672
984
|
inputs: [
|
|
673
|
-
{
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
{
|
|
985
|
+
{
|
|
986
|
+
internalType: "uint256",
|
|
987
|
+
name: "jobId",
|
|
988
|
+
type: "uint256"
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
internalType: "string",
|
|
992
|
+
name: "content",
|
|
993
|
+
type: "string"
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
internalType: "address",
|
|
997
|
+
name: "token",
|
|
998
|
+
type: "address"
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
internalType: "uint256",
|
|
1002
|
+
name: "amount",
|
|
1003
|
+
type: "uint256"
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
internalType: "address",
|
|
1007
|
+
name: "recipient",
|
|
1008
|
+
type: "address"
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
internalType: "uint256",
|
|
1012
|
+
name: "feeAmount",
|
|
1013
|
+
type: "uint256"
|
|
1014
|
+
},
|
|
679
1015
|
{
|
|
680
1016
|
internalType: "enum ACPSimple.FeeType",
|
|
681
1017
|
name: "feeType",
|
|
@@ -686,88 +1022,198 @@ var ACP_ABI = [
|
|
|
686
1022
|
name: "memoType",
|
|
687
1023
|
type: "uint8"
|
|
688
1024
|
},
|
|
689
|
-
{
|
|
690
|
-
|
|
1025
|
+
{
|
|
1026
|
+
internalType: "uint8",
|
|
1027
|
+
name: "nextPhase",
|
|
1028
|
+
type: "uint8"
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
internalType: "uint256",
|
|
1032
|
+
name: "expiredAt",
|
|
1033
|
+
type: "uint256"
|
|
1034
|
+
}
|
|
691
1035
|
],
|
|
692
1036
|
name: "createPayableMemo",
|
|
693
|
-
outputs: [
|
|
1037
|
+
outputs: [
|
|
1038
|
+
{
|
|
1039
|
+
internalType: "uint256",
|
|
1040
|
+
name: "",
|
|
1041
|
+
type: "uint256"
|
|
1042
|
+
}
|
|
1043
|
+
],
|
|
694
1044
|
stateMutability: "nonpayable",
|
|
695
1045
|
type: "function"
|
|
696
1046
|
},
|
|
697
1047
|
{
|
|
698
1048
|
inputs: [],
|
|
699
1049
|
name: "evaluatorFeeBP",
|
|
700
|
-
outputs: [
|
|
1050
|
+
outputs: [
|
|
1051
|
+
{
|
|
1052
|
+
internalType: "uint256",
|
|
1053
|
+
name: "",
|
|
1054
|
+
type: "uint256"
|
|
1055
|
+
}
|
|
1056
|
+
],
|
|
701
1057
|
stateMutability: "view",
|
|
702
1058
|
type: "function"
|
|
703
1059
|
},
|
|
704
1060
|
{
|
|
705
1061
|
inputs: [
|
|
706
|
-
{
|
|
707
|
-
|
|
708
|
-
|
|
1062
|
+
{
|
|
1063
|
+
internalType: "uint256",
|
|
1064
|
+
name: "jobId",
|
|
1065
|
+
type: "uint256"
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
internalType: "uint256",
|
|
1069
|
+
name: "offset",
|
|
1070
|
+
type: "uint256"
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
internalType: "uint256",
|
|
1074
|
+
name: "limit",
|
|
1075
|
+
type: "uint256"
|
|
1076
|
+
}
|
|
709
1077
|
],
|
|
710
1078
|
name: "getAllMemos",
|
|
711
1079
|
outputs: [
|
|
712
1080
|
{
|
|
713
1081
|
components: [
|
|
714
|
-
{
|
|
1082
|
+
{
|
|
1083
|
+
internalType: "string",
|
|
1084
|
+
name: "content",
|
|
1085
|
+
type: "string"
|
|
1086
|
+
},
|
|
715
1087
|
{
|
|
716
1088
|
internalType: "enum InteractionLedger.MemoType",
|
|
717
1089
|
name: "memoType",
|
|
718
1090
|
type: "uint8"
|
|
719
1091
|
},
|
|
720
|
-
{
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
1092
|
+
{
|
|
1093
|
+
internalType: "bool",
|
|
1094
|
+
name: "isSecured",
|
|
1095
|
+
type: "bool"
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
internalType: "uint8",
|
|
1099
|
+
name: "nextPhase",
|
|
1100
|
+
type: "uint8"
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
internalType: "uint256",
|
|
1104
|
+
name: "jobId",
|
|
1105
|
+
type: "uint256"
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
internalType: "address",
|
|
1109
|
+
name: "sender",
|
|
1110
|
+
type: "address"
|
|
1111
|
+
}
|
|
724
1112
|
],
|
|
725
1113
|
internalType: "struct InteractionLedger.Memo[]",
|
|
726
1114
|
name: "",
|
|
727
1115
|
type: "tuple[]"
|
|
728
1116
|
},
|
|
729
|
-
{
|
|
1117
|
+
{
|
|
1118
|
+
internalType: "uint256",
|
|
1119
|
+
name: "total",
|
|
1120
|
+
type: "uint256"
|
|
1121
|
+
}
|
|
730
1122
|
],
|
|
731
1123
|
stateMutability: "view",
|
|
732
1124
|
type: "function"
|
|
733
1125
|
},
|
|
734
1126
|
{
|
|
735
1127
|
inputs: [
|
|
736
|
-
{
|
|
737
|
-
|
|
1128
|
+
{
|
|
1129
|
+
internalType: "uint256",
|
|
1130
|
+
name: "jobId",
|
|
1131
|
+
type: "uint256"
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
internalType: "uint8",
|
|
1135
|
+
name: "phase",
|
|
1136
|
+
type: "uint8"
|
|
1137
|
+
}
|
|
738
1138
|
],
|
|
739
1139
|
name: "getJobPhaseMemoIds",
|
|
740
|
-
outputs: [
|
|
1140
|
+
outputs: [
|
|
1141
|
+
{
|
|
1142
|
+
internalType: "uint256[]",
|
|
1143
|
+
name: "",
|
|
1144
|
+
type: "uint256[]"
|
|
1145
|
+
}
|
|
1146
|
+
],
|
|
741
1147
|
stateMutability: "view",
|
|
742
1148
|
type: "function"
|
|
743
1149
|
},
|
|
744
1150
|
{
|
|
745
1151
|
inputs: [
|
|
746
|
-
{
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
1152
|
+
{
|
|
1153
|
+
internalType: "uint256",
|
|
1154
|
+
name: "jobId",
|
|
1155
|
+
type: "uint256"
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
internalType: "uint8",
|
|
1159
|
+
name: "phase",
|
|
1160
|
+
type: "uint8"
|
|
1161
|
+
},
|
|
1162
|
+
{
|
|
1163
|
+
internalType: "uint256",
|
|
1164
|
+
name: "offset",
|
|
1165
|
+
type: "uint256"
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
internalType: "uint256",
|
|
1169
|
+
name: "limit",
|
|
1170
|
+
type: "uint256"
|
|
1171
|
+
}
|
|
750
1172
|
],
|
|
751
1173
|
name: "getMemosForPhase",
|
|
752
1174
|
outputs: [
|
|
753
1175
|
{
|
|
754
1176
|
components: [
|
|
755
|
-
{
|
|
1177
|
+
{
|
|
1178
|
+
internalType: "string",
|
|
1179
|
+
name: "content",
|
|
1180
|
+
type: "string"
|
|
1181
|
+
},
|
|
756
1182
|
{
|
|
757
1183
|
internalType: "enum InteractionLedger.MemoType",
|
|
758
1184
|
name: "memoType",
|
|
759
1185
|
type: "uint8"
|
|
760
1186
|
},
|
|
761
|
-
{
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
1187
|
+
{
|
|
1188
|
+
internalType: "bool",
|
|
1189
|
+
name: "isSecured",
|
|
1190
|
+
type: "bool"
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
internalType: "uint8",
|
|
1194
|
+
name: "nextPhase",
|
|
1195
|
+
type: "uint8"
|
|
1196
|
+
},
|
|
1197
|
+
{
|
|
1198
|
+
internalType: "uint256",
|
|
1199
|
+
name: "jobId",
|
|
1200
|
+
type: "uint256"
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
internalType: "address",
|
|
1204
|
+
name: "sender",
|
|
1205
|
+
type: "address"
|
|
1206
|
+
}
|
|
765
1207
|
],
|
|
766
1208
|
internalType: "struct InteractionLedger.Memo[]",
|
|
767
1209
|
name: "",
|
|
768
1210
|
type: "tuple[]"
|
|
769
1211
|
},
|
|
770
|
-
{
|
|
1212
|
+
{
|
|
1213
|
+
internalType: "uint256",
|
|
1214
|
+
name: "total",
|
|
1215
|
+
type: "uint256"
|
|
1216
|
+
}
|
|
771
1217
|
],
|
|
772
1218
|
stateMutability: "view",
|
|
773
1219
|
type: "function"
|
|
@@ -775,21 +1221,47 @@ var ACP_ABI = [
|
|
|
775
1221
|
{
|
|
776
1222
|
inputs: [],
|
|
777
1223
|
name: "getPhases",
|
|
778
|
-
outputs: [
|
|
1224
|
+
outputs: [
|
|
1225
|
+
{
|
|
1226
|
+
internalType: "string[7]",
|
|
1227
|
+
name: "",
|
|
1228
|
+
type: "string[7]"
|
|
1229
|
+
}
|
|
1230
|
+
],
|
|
779
1231
|
stateMutability: "pure",
|
|
780
1232
|
type: "function"
|
|
781
1233
|
},
|
|
782
1234
|
{
|
|
783
|
-
inputs: [
|
|
1235
|
+
inputs: [
|
|
1236
|
+
{
|
|
1237
|
+
internalType: "bytes32",
|
|
1238
|
+
name: "role",
|
|
1239
|
+
type: "bytes32"
|
|
1240
|
+
}
|
|
1241
|
+
],
|
|
784
1242
|
name: "getRoleAdmin",
|
|
785
|
-
outputs: [
|
|
1243
|
+
outputs: [
|
|
1244
|
+
{
|
|
1245
|
+
internalType: "bytes32",
|
|
1246
|
+
name: "",
|
|
1247
|
+
type: "bytes32"
|
|
1248
|
+
}
|
|
1249
|
+
],
|
|
786
1250
|
stateMutability: "view",
|
|
787
1251
|
type: "function"
|
|
788
1252
|
},
|
|
789
1253
|
{
|
|
790
1254
|
inputs: [
|
|
791
|
-
{
|
|
792
|
-
|
|
1255
|
+
{
|
|
1256
|
+
internalType: "bytes32",
|
|
1257
|
+
name: "role",
|
|
1258
|
+
type: "bytes32"
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
internalType: "address",
|
|
1262
|
+
name: "account",
|
|
1263
|
+
type: "address"
|
|
1264
|
+
}
|
|
793
1265
|
],
|
|
794
1266
|
name: "grantRole",
|
|
795
1267
|
outputs: [],
|
|
@@ -798,20 +1270,50 @@ var ACP_ABI = [
|
|
|
798
1270
|
},
|
|
799
1271
|
{
|
|
800
1272
|
inputs: [
|
|
801
|
-
{
|
|
802
|
-
|
|
1273
|
+
{
|
|
1274
|
+
internalType: "bytes32",
|
|
1275
|
+
name: "role",
|
|
1276
|
+
type: "bytes32"
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
internalType: "address",
|
|
1280
|
+
name: "account",
|
|
1281
|
+
type: "address"
|
|
1282
|
+
}
|
|
803
1283
|
],
|
|
804
1284
|
name: "hasRole",
|
|
805
|
-
outputs: [
|
|
1285
|
+
outputs: [
|
|
1286
|
+
{
|
|
1287
|
+
internalType: "bool",
|
|
1288
|
+
name: "",
|
|
1289
|
+
type: "bool"
|
|
1290
|
+
}
|
|
1291
|
+
],
|
|
806
1292
|
stateMutability: "view",
|
|
807
1293
|
type: "function"
|
|
808
1294
|
},
|
|
809
1295
|
{
|
|
810
1296
|
inputs: [
|
|
811
|
-
{
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
1297
|
+
{
|
|
1298
|
+
internalType: "address",
|
|
1299
|
+
name: "paymentTokenAddress",
|
|
1300
|
+
type: "address"
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
internalType: "uint256",
|
|
1304
|
+
name: "evaluatorFeeBP_",
|
|
1305
|
+
type: "uint256"
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
internalType: "uint256",
|
|
1309
|
+
name: "platformFeeBP_",
|
|
1310
|
+
type: "uint256"
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
internalType: "address",
|
|
1314
|
+
name: "platformTreasury_",
|
|
1315
|
+
type: "address"
|
|
1316
|
+
}
|
|
815
1317
|
],
|
|
816
1318
|
name: "initialize",
|
|
817
1319
|
outputs: [],
|
|
@@ -820,265 +1322,796 @@ var ACP_ABI = [
|
|
|
820
1322
|
},
|
|
821
1323
|
{
|
|
822
1324
|
inputs: [
|
|
823
|
-
{
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
1325
|
+
{
|
|
1326
|
+
internalType: "uint256",
|
|
1327
|
+
name: "jobId",
|
|
1328
|
+
type: "uint256"
|
|
1329
|
+
},
|
|
1330
|
+
{
|
|
1331
|
+
internalType: "address",
|
|
1332
|
+
name: "account",
|
|
1333
|
+
type: "address"
|
|
1334
|
+
}
|
|
1335
|
+
],
|
|
1336
|
+
name: "isJobEvaluator",
|
|
1337
|
+
outputs: [
|
|
1338
|
+
{
|
|
1339
|
+
internalType: "bool",
|
|
1340
|
+
name: "",
|
|
1341
|
+
type: "bool"
|
|
1342
|
+
}
|
|
1343
|
+
],
|
|
1344
|
+
stateMutability: "view",
|
|
1345
|
+
type: "function"
|
|
1346
|
+
},
|
|
1347
|
+
{
|
|
1348
|
+
inputs: [
|
|
1349
|
+
{
|
|
1350
|
+
internalType: "uint256",
|
|
1351
|
+
name: "memoId",
|
|
1352
|
+
type: "uint256"
|
|
1353
|
+
}
|
|
1354
|
+
],
|
|
1355
|
+
name: "isPayableMemo",
|
|
1356
|
+
outputs: [
|
|
1357
|
+
{
|
|
1358
|
+
internalType: "bool",
|
|
1359
|
+
name: "",
|
|
1360
|
+
type: "bool"
|
|
1361
|
+
}
|
|
1362
|
+
],
|
|
835
1363
|
stateMutability: "view",
|
|
836
1364
|
type: "function"
|
|
837
1365
|
},
|
|
838
1366
|
{
|
|
839
|
-
inputs: [
|
|
1367
|
+
inputs: [
|
|
1368
|
+
{
|
|
1369
|
+
internalType: "uint256",
|
|
1370
|
+
name: "jobId",
|
|
1371
|
+
type: "uint256"
|
|
1372
|
+
}
|
|
1373
|
+
],
|
|
840
1374
|
name: "jobAdditionalFees",
|
|
841
|
-
outputs: [
|
|
1375
|
+
outputs: [
|
|
1376
|
+
{
|
|
1377
|
+
internalType: "uint256",
|
|
1378
|
+
name: "",
|
|
1379
|
+
type: "uint256"
|
|
1380
|
+
}
|
|
1381
|
+
],
|
|
842
1382
|
stateMutability: "view",
|
|
843
1383
|
type: "function"
|
|
844
1384
|
},
|
|
845
1385
|
{
|
|
846
1386
|
inputs: [],
|
|
847
1387
|
name: "jobCounter",
|
|
848
|
-
outputs: [
|
|
1388
|
+
outputs: [
|
|
1389
|
+
{
|
|
1390
|
+
internalType: "uint256",
|
|
1391
|
+
name: "",
|
|
1392
|
+
type: "uint256"
|
|
1393
|
+
}
|
|
1394
|
+
],
|
|
1395
|
+
stateMutability: "view",
|
|
1396
|
+
type: "function"
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
inputs: [
|
|
1400
|
+
{
|
|
1401
|
+
internalType: "uint256",
|
|
1402
|
+
name: "jobId",
|
|
1403
|
+
type: "uint256"
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
internalType: "uint8",
|
|
1407
|
+
name: "phase",
|
|
1408
|
+
type: "uint8"
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
internalType: "uint256",
|
|
1412
|
+
name: "",
|
|
1413
|
+
type: "uint256"
|
|
1414
|
+
}
|
|
1415
|
+
],
|
|
1416
|
+
name: "jobMemoIds",
|
|
1417
|
+
outputs: [
|
|
1418
|
+
{
|
|
1419
|
+
internalType: "uint256",
|
|
1420
|
+
name: "memoIds",
|
|
1421
|
+
type: "uint256"
|
|
1422
|
+
}
|
|
1423
|
+
],
|
|
1424
|
+
stateMutability: "view",
|
|
1425
|
+
type: "function"
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
inputs: [
|
|
1429
|
+
{
|
|
1430
|
+
internalType: "uint256",
|
|
1431
|
+
name: "",
|
|
1432
|
+
type: "uint256"
|
|
1433
|
+
}
|
|
1434
|
+
],
|
|
1435
|
+
name: "jobs",
|
|
1436
|
+
outputs: [
|
|
1437
|
+
{
|
|
1438
|
+
internalType: "uint256",
|
|
1439
|
+
name: "id",
|
|
1440
|
+
type: "uint256"
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
internalType: "address",
|
|
1444
|
+
name: "client",
|
|
1445
|
+
type: "address"
|
|
1446
|
+
},
|
|
1447
|
+
{
|
|
1448
|
+
internalType: "address",
|
|
1449
|
+
name: "provider",
|
|
1450
|
+
type: "address"
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
internalType: "uint256",
|
|
1454
|
+
name: "budget",
|
|
1455
|
+
type: "uint256"
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
internalType: "uint256",
|
|
1459
|
+
name: "amountClaimed",
|
|
1460
|
+
type: "uint256"
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
internalType: "uint8",
|
|
1464
|
+
name: "phase",
|
|
1465
|
+
type: "uint8"
|
|
1466
|
+
},
|
|
1467
|
+
{
|
|
1468
|
+
internalType: "uint256",
|
|
1469
|
+
name: "memoCount",
|
|
1470
|
+
type: "uint256"
|
|
1471
|
+
},
|
|
1472
|
+
{
|
|
1473
|
+
internalType: "uint256",
|
|
1474
|
+
name: "expiredAt",
|
|
1475
|
+
type: "uint256"
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
internalType: "address",
|
|
1479
|
+
name: "evaluator",
|
|
1480
|
+
type: "address"
|
|
1481
|
+
},
|
|
1482
|
+
{
|
|
1483
|
+
internalType: "contract IERC20",
|
|
1484
|
+
name: "jobPaymentToken",
|
|
1485
|
+
type: "address"
|
|
1486
|
+
}
|
|
1487
|
+
],
|
|
1488
|
+
stateMutability: "view",
|
|
1489
|
+
type: "function"
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
inputs: [],
|
|
1493
|
+
name: "memoCounter",
|
|
1494
|
+
outputs: [
|
|
1495
|
+
{
|
|
1496
|
+
internalType: "uint256",
|
|
1497
|
+
name: "",
|
|
1498
|
+
type: "uint256"
|
|
1499
|
+
}
|
|
1500
|
+
],
|
|
1501
|
+
stateMutability: "view",
|
|
1502
|
+
type: "function"
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
inputs: [
|
|
1506
|
+
{
|
|
1507
|
+
internalType: "uint256",
|
|
1508
|
+
name: "memoId",
|
|
1509
|
+
type: "uint256"
|
|
1510
|
+
}
|
|
1511
|
+
],
|
|
1512
|
+
name: "memoExpiredAt",
|
|
1513
|
+
outputs: [
|
|
1514
|
+
{
|
|
1515
|
+
internalType: "uint256",
|
|
1516
|
+
name: "expiredAt",
|
|
1517
|
+
type: "uint256"
|
|
1518
|
+
}
|
|
1519
|
+
],
|
|
1520
|
+
stateMutability: "view",
|
|
1521
|
+
type: "function"
|
|
1522
|
+
},
|
|
1523
|
+
{
|
|
1524
|
+
inputs: [
|
|
1525
|
+
{
|
|
1526
|
+
internalType: "uint256",
|
|
1527
|
+
name: "",
|
|
1528
|
+
type: "uint256"
|
|
1529
|
+
}
|
|
1530
|
+
],
|
|
1531
|
+
name: "memos",
|
|
1532
|
+
outputs: [
|
|
1533
|
+
{
|
|
1534
|
+
internalType: "string",
|
|
1535
|
+
name: "content",
|
|
1536
|
+
type: "string"
|
|
1537
|
+
},
|
|
1538
|
+
{
|
|
1539
|
+
internalType: "enum InteractionLedger.MemoType",
|
|
1540
|
+
name: "memoType",
|
|
1541
|
+
type: "uint8"
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
internalType: "bool",
|
|
1545
|
+
name: "isSecured",
|
|
1546
|
+
type: "bool"
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
internalType: "uint8",
|
|
1550
|
+
name: "nextPhase",
|
|
1551
|
+
type: "uint8"
|
|
1552
|
+
},
|
|
1553
|
+
{
|
|
1554
|
+
internalType: "uint256",
|
|
1555
|
+
name: "jobId",
|
|
1556
|
+
type: "uint256"
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
internalType: "address",
|
|
1560
|
+
name: "sender",
|
|
1561
|
+
type: "address"
|
|
1562
|
+
}
|
|
1563
|
+
],
|
|
1564
|
+
stateMutability: "view",
|
|
1565
|
+
type: "function"
|
|
1566
|
+
},
|
|
1567
|
+
{
|
|
1568
|
+
inputs: [],
|
|
1569
|
+
name: "numEvaluatorsPerJob",
|
|
1570
|
+
outputs: [
|
|
1571
|
+
{
|
|
1572
|
+
internalType: "uint8",
|
|
1573
|
+
name: "",
|
|
1574
|
+
type: "uint8"
|
|
1575
|
+
}
|
|
1576
|
+
],
|
|
849
1577
|
stateMutability: "view",
|
|
850
1578
|
type: "function"
|
|
851
1579
|
},
|
|
852
1580
|
{
|
|
853
1581
|
inputs: [
|
|
854
|
-
{
|
|
855
|
-
|
|
856
|
-
|
|
1582
|
+
{
|
|
1583
|
+
internalType: "uint256",
|
|
1584
|
+
name: "memoId",
|
|
1585
|
+
type: "uint256"
|
|
1586
|
+
}
|
|
1587
|
+
],
|
|
1588
|
+
name: "payableDetails",
|
|
1589
|
+
outputs: [
|
|
1590
|
+
{
|
|
1591
|
+
internalType: "address",
|
|
1592
|
+
name: "token",
|
|
1593
|
+
type: "address"
|
|
1594
|
+
},
|
|
1595
|
+
{
|
|
1596
|
+
internalType: "uint256",
|
|
1597
|
+
name: "amount",
|
|
1598
|
+
type: "uint256"
|
|
1599
|
+
},
|
|
1600
|
+
{
|
|
1601
|
+
internalType: "address",
|
|
1602
|
+
name: "recipient",
|
|
1603
|
+
type: "address"
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
internalType: "uint256",
|
|
1607
|
+
name: "feeAmount",
|
|
1608
|
+
type: "uint256"
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
internalType: "enum ACPSimple.FeeType",
|
|
1612
|
+
name: "feeType",
|
|
1613
|
+
type: "uint8"
|
|
1614
|
+
},
|
|
1615
|
+
{
|
|
1616
|
+
internalType: "bool",
|
|
1617
|
+
name: "isExecuted",
|
|
1618
|
+
type: "bool"
|
|
1619
|
+
}
|
|
1620
|
+
],
|
|
1621
|
+
stateMutability: "view",
|
|
1622
|
+
type: "function"
|
|
1623
|
+
},
|
|
1624
|
+
{
|
|
1625
|
+
inputs: [],
|
|
1626
|
+
name: "paymentToken",
|
|
1627
|
+
outputs: [
|
|
1628
|
+
{
|
|
1629
|
+
internalType: "contract IERC20",
|
|
1630
|
+
name: "",
|
|
1631
|
+
type: "address"
|
|
1632
|
+
}
|
|
1633
|
+
],
|
|
1634
|
+
stateMutability: "view",
|
|
1635
|
+
type: "function"
|
|
1636
|
+
},
|
|
1637
|
+
{
|
|
1638
|
+
inputs: [],
|
|
1639
|
+
name: "platformFeeBP",
|
|
1640
|
+
outputs: [
|
|
1641
|
+
{
|
|
1642
|
+
internalType: "uint256",
|
|
1643
|
+
name: "",
|
|
1644
|
+
type: "uint256"
|
|
1645
|
+
}
|
|
1646
|
+
],
|
|
1647
|
+
stateMutability: "view",
|
|
1648
|
+
type: "function"
|
|
1649
|
+
},
|
|
1650
|
+
{
|
|
1651
|
+
inputs: [],
|
|
1652
|
+
name: "platformTreasury",
|
|
1653
|
+
outputs: [
|
|
1654
|
+
{
|
|
1655
|
+
internalType: "address",
|
|
1656
|
+
name: "",
|
|
1657
|
+
type: "address"
|
|
1658
|
+
}
|
|
1659
|
+
],
|
|
1660
|
+
stateMutability: "view",
|
|
1661
|
+
type: "function"
|
|
1662
|
+
},
|
|
1663
|
+
{
|
|
1664
|
+
inputs: [
|
|
1665
|
+
{
|
|
1666
|
+
internalType: "bytes32",
|
|
1667
|
+
name: "role",
|
|
1668
|
+
type: "bytes32"
|
|
1669
|
+
},
|
|
1670
|
+
{
|
|
1671
|
+
internalType: "address",
|
|
1672
|
+
name: "callerConfirmation",
|
|
1673
|
+
type: "address"
|
|
1674
|
+
}
|
|
1675
|
+
],
|
|
1676
|
+
name: "renounceRole",
|
|
1677
|
+
outputs: [],
|
|
1678
|
+
stateMutability: "nonpayable",
|
|
1679
|
+
type: "function"
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
inputs: [
|
|
1683
|
+
{
|
|
1684
|
+
internalType: "bytes32",
|
|
1685
|
+
name: "role",
|
|
1686
|
+
type: "bytes32"
|
|
1687
|
+
},
|
|
1688
|
+
{
|
|
1689
|
+
internalType: "address",
|
|
1690
|
+
name: "account",
|
|
1691
|
+
type: "address"
|
|
1692
|
+
}
|
|
1693
|
+
],
|
|
1694
|
+
name: "revokeRole",
|
|
1695
|
+
outputs: [],
|
|
1696
|
+
stateMutability: "nonpayable",
|
|
1697
|
+
type: "function"
|
|
1698
|
+
},
|
|
1699
|
+
{
|
|
1700
|
+
inputs: [
|
|
1701
|
+
{
|
|
1702
|
+
internalType: "uint256",
|
|
1703
|
+
name: "jobId",
|
|
1704
|
+
type: "uint256"
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
internalType: "uint256",
|
|
1708
|
+
name: "amount",
|
|
1709
|
+
type: "uint256"
|
|
1710
|
+
}
|
|
1711
|
+
],
|
|
1712
|
+
name: "setBudget",
|
|
1713
|
+
outputs: [],
|
|
1714
|
+
stateMutability: "nonpayable",
|
|
1715
|
+
type: "function"
|
|
1716
|
+
},
|
|
1717
|
+
{
|
|
1718
|
+
inputs: [
|
|
1719
|
+
{
|
|
1720
|
+
internalType: "uint256",
|
|
1721
|
+
name: "jobId",
|
|
1722
|
+
type: "uint256"
|
|
1723
|
+
},
|
|
1724
|
+
{
|
|
1725
|
+
internalType: "uint256",
|
|
1726
|
+
name: "amount",
|
|
1727
|
+
type: "uint256"
|
|
1728
|
+
},
|
|
1729
|
+
{
|
|
1730
|
+
internalType: "contract IERC20",
|
|
1731
|
+
name: "jobPaymentToken_",
|
|
1732
|
+
type: "address"
|
|
1733
|
+
}
|
|
1734
|
+
],
|
|
1735
|
+
name: "setBudgetWithPaymentToken",
|
|
1736
|
+
outputs: [],
|
|
1737
|
+
stateMutability: "nonpayable",
|
|
1738
|
+
type: "function"
|
|
1739
|
+
},
|
|
1740
|
+
{
|
|
1741
|
+
inputs: [
|
|
1742
|
+
{
|
|
1743
|
+
internalType: "uint256",
|
|
1744
|
+
name: "memoId",
|
|
1745
|
+
type: "uint256"
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
internalType: "bool",
|
|
1749
|
+
name: "isApproved",
|
|
1750
|
+
type: "bool"
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
internalType: "string",
|
|
1754
|
+
name: "reason",
|
|
1755
|
+
type: "string"
|
|
1756
|
+
}
|
|
1757
|
+
],
|
|
1758
|
+
name: "signMemo",
|
|
1759
|
+
outputs: [],
|
|
1760
|
+
stateMutability: "nonpayable",
|
|
1761
|
+
type: "function"
|
|
1762
|
+
},
|
|
1763
|
+
{
|
|
1764
|
+
inputs: [
|
|
1765
|
+
{
|
|
1766
|
+
internalType: "uint256",
|
|
1767
|
+
name: "memoId",
|
|
1768
|
+
type: "uint256"
|
|
1769
|
+
},
|
|
1770
|
+
{
|
|
1771
|
+
internalType: "address",
|
|
1772
|
+
name: "signer",
|
|
1773
|
+
type: "address"
|
|
1774
|
+
}
|
|
1775
|
+
],
|
|
1776
|
+
name: "signatories",
|
|
1777
|
+
outputs: [
|
|
1778
|
+
{
|
|
1779
|
+
internalType: "uint8",
|
|
1780
|
+
name: "res",
|
|
1781
|
+
type: "uint8"
|
|
1782
|
+
}
|
|
1783
|
+
],
|
|
1784
|
+
stateMutability: "view",
|
|
1785
|
+
type: "function"
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
inputs: [
|
|
1789
|
+
{
|
|
1790
|
+
internalType: "bytes4",
|
|
1791
|
+
name: "interfaceId",
|
|
1792
|
+
type: "bytes4"
|
|
1793
|
+
}
|
|
1794
|
+
],
|
|
1795
|
+
name: "supportsInterface",
|
|
1796
|
+
outputs: [
|
|
1797
|
+
{
|
|
1798
|
+
internalType: "bool",
|
|
1799
|
+
name: "",
|
|
1800
|
+
type: "bool"
|
|
1801
|
+
}
|
|
1802
|
+
],
|
|
1803
|
+
stateMutability: "view",
|
|
1804
|
+
type: "function"
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
inputs: [
|
|
1808
|
+
{
|
|
1809
|
+
internalType: "uint256",
|
|
1810
|
+
name: "evaluatorFeeBP_",
|
|
1811
|
+
type: "uint256"
|
|
1812
|
+
}
|
|
1813
|
+
],
|
|
1814
|
+
name: "updateEvaluatorFee",
|
|
1815
|
+
outputs: [],
|
|
1816
|
+
stateMutability: "nonpayable",
|
|
1817
|
+
type: "function"
|
|
1818
|
+
},
|
|
1819
|
+
{
|
|
1820
|
+
inputs: [
|
|
1821
|
+
{
|
|
1822
|
+
internalType: "uint256",
|
|
1823
|
+
name: "platformFeeBP_",
|
|
1824
|
+
type: "uint256"
|
|
1825
|
+
},
|
|
1826
|
+
{
|
|
1827
|
+
internalType: "address",
|
|
1828
|
+
name: "platformTreasury_",
|
|
1829
|
+
type: "address"
|
|
1830
|
+
}
|
|
1831
|
+
],
|
|
1832
|
+
name: "updatePlatformFee",
|
|
1833
|
+
outputs: [],
|
|
1834
|
+
stateMutability: "nonpayable",
|
|
1835
|
+
type: "function"
|
|
1836
|
+
},
|
|
1837
|
+
{
|
|
1838
|
+
inputs: [
|
|
1839
|
+
{
|
|
1840
|
+
internalType: "uint256",
|
|
1841
|
+
name: "memoId",
|
|
1842
|
+
type: "uint256"
|
|
1843
|
+
}
|
|
1844
|
+
],
|
|
1845
|
+
name: "withdrawEscrowedFunds",
|
|
1846
|
+
outputs: [],
|
|
1847
|
+
stateMutability: "nonpayable",
|
|
1848
|
+
type: "function"
|
|
1849
|
+
}
|
|
1850
|
+
];
|
|
1851
|
+
var acpAbi_default = ACP_ABI;
|
|
1852
|
+
|
|
1853
|
+
// src/acpClient.ts
|
|
1854
|
+
import { io } from "socket.io-client";
|
|
1855
|
+
|
|
1856
|
+
// src/acpContractClient.ts
|
|
1857
|
+
import { LocalAccountSigner } from "@aa-sdk/core";
|
|
1858
|
+
import { alchemy } from "@account-kit/infra";
|
|
1859
|
+
import {
|
|
1860
|
+
createModularAccountV2Client
|
|
1861
|
+
} from "@account-kit/smart-contracts";
|
|
1862
|
+
import { decodeEventLog, encodeFunctionData, erc20Abi, fromHex } from "viem";
|
|
1863
|
+
|
|
1864
|
+
// src/acpConfigs.ts
|
|
1865
|
+
import { baseSepolia, base } from "@account-kit/infra";
|
|
1866
|
+
|
|
1867
|
+
// src/acpFare.ts
|
|
1868
|
+
import { ethAddress, parseUnits } from "viem";
|
|
1869
|
+
|
|
1870
|
+
// src/acpError.ts
|
|
1871
|
+
var AcpError = class _AcpError extends Error {
|
|
1872
|
+
constructor(message, originalError) {
|
|
1873
|
+
super();
|
|
1874
|
+
this.message = message;
|
|
1875
|
+
this.name = "AcpError";
|
|
1876
|
+
if (originalError && typeof originalError === "object" && "stack" in originalError) {
|
|
1877
|
+
this.stack += `
|
|
1878
|
+
Caused by: ${originalError.stack}`;
|
|
1879
|
+
}
|
|
1880
|
+
Object.setPrototypeOf(this, _AcpError.prototype);
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
var acpError_default = AcpError;
|
|
1884
|
+
|
|
1885
|
+
// src/acpFare.ts
|
|
1886
|
+
var Fare = class {
|
|
1887
|
+
constructor(contractAddress, decimals) {
|
|
1888
|
+
this.contractAddress = contractAddress;
|
|
1889
|
+
this.decimals = decimals;
|
|
1890
|
+
}
|
|
1891
|
+
formatAmount(amount) {
|
|
1892
|
+
return parseUnits(amount.toString(), this.decimals);
|
|
1893
|
+
}
|
|
1894
|
+
};
|
|
1895
|
+
var FareAmount = class _FareAmount {
|
|
1896
|
+
constructor(fareAmount, fare) {
|
|
1897
|
+
this.amount = fare.formatAmount(
|
|
1898
|
+
this.truncateTo6Decimals(fareAmount.toString())
|
|
1899
|
+
);
|
|
1900
|
+
this.fare = fare;
|
|
1901
|
+
}
|
|
1902
|
+
truncateTo6Decimals(input) {
|
|
1903
|
+
const [intPart, decPart = ""] = input.split(".");
|
|
1904
|
+
if (decPart === "") {
|
|
1905
|
+
return parseFloat(intPart);
|
|
1906
|
+
}
|
|
1907
|
+
const truncated = decPart.slice(0, 6).padEnd(6, "0");
|
|
1908
|
+
return parseFloat(`${intPart}.${truncated}`);
|
|
1909
|
+
}
|
|
1910
|
+
add(other) {
|
|
1911
|
+
if (this.fare.contractAddress !== other.fare.contractAddress) {
|
|
1912
|
+
throw new acpError_default("Token addresses do not match");
|
|
1913
|
+
}
|
|
1914
|
+
return new _FareAmount(Number(this.amount + other.amount), this.fare);
|
|
1915
|
+
}
|
|
1916
|
+
};
|
|
1917
|
+
var FareBigInt = class _FareBigInt {
|
|
1918
|
+
constructor(amount, fare) {
|
|
1919
|
+
this.amount = amount;
|
|
1920
|
+
this.fare = fare;
|
|
1921
|
+
}
|
|
1922
|
+
add(other) {
|
|
1923
|
+
if (this.fare.contractAddress !== other.fare.contractAddress) {
|
|
1924
|
+
throw new acpError_default("Token addresses do not match");
|
|
1925
|
+
}
|
|
1926
|
+
return new _FareBigInt(this.amount + other.amount, this.fare);
|
|
1927
|
+
}
|
|
1928
|
+
};
|
|
1929
|
+
var wethFare = new Fare("0x4200000000000000000000000000000000000006", 18);
|
|
1930
|
+
var ethFare = new Fare(ethAddress, 18);
|
|
1931
|
+
|
|
1932
|
+
// src/acpConfigs.ts
|
|
1933
|
+
var AcpContractConfig = class {
|
|
1934
|
+
constructor(chain, contractAddress, baseFare, alchemyRpcUrl, acpUrl, rpcEndpoint) {
|
|
1935
|
+
this.chain = chain;
|
|
1936
|
+
this.contractAddress = contractAddress;
|
|
1937
|
+
this.baseFare = baseFare;
|
|
1938
|
+
this.alchemyRpcUrl = alchemyRpcUrl;
|
|
1939
|
+
this.acpUrl = acpUrl;
|
|
1940
|
+
this.rpcEndpoint = rpcEndpoint;
|
|
1941
|
+
}
|
|
1942
|
+
};
|
|
1943
|
+
var baseSepoliaAcpConfig = new AcpContractConfig(
|
|
1944
|
+
baseSepolia,
|
|
1945
|
+
"0x8Db6B1c839Fc8f6bd35777E194677B67b4D51928",
|
|
1946
|
+
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6),
|
|
1947
|
+
"https://alchemy-proxy.virtuals.io/api/proxy/rpc",
|
|
1948
|
+
"https://acpx.virtuals.gg"
|
|
1949
|
+
);
|
|
1950
|
+
var baseAcpConfig = new AcpContractConfig(
|
|
1951
|
+
base,
|
|
1952
|
+
"0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
|
|
1953
|
+
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6),
|
|
1954
|
+
"https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
|
|
1955
|
+
"https://acpx.virtuals.io"
|
|
1956
|
+
);
|
|
1957
|
+
|
|
1958
|
+
// src/wethAbi.ts
|
|
1959
|
+
var WETH_ABI = [
|
|
1960
|
+
{
|
|
1961
|
+
anonymous: false,
|
|
1962
|
+
inputs: [
|
|
1963
|
+
{ indexed: true, internalType: "address", name: "src", type: "address" },
|
|
1964
|
+
{ indexed: true, internalType: "address", name: "guy", type: "address" },
|
|
1965
|
+
{ indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
|
|
1966
|
+
],
|
|
1967
|
+
name: "Approval",
|
|
1968
|
+
type: "event"
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
anonymous: false,
|
|
1972
|
+
inputs: [
|
|
1973
|
+
{ indexed: true, internalType: "address", name: "dst", type: "address" },
|
|
1974
|
+
{ indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
|
|
857
1975
|
],
|
|
858
|
-
name: "
|
|
859
|
-
|
|
860
|
-
stateMutability: "view",
|
|
861
|
-
type: "function"
|
|
1976
|
+
name: "Deposit",
|
|
1977
|
+
type: "event"
|
|
862
1978
|
},
|
|
863
1979
|
{
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
{ internalType: "
|
|
868
|
-
{ internalType: "
|
|
869
|
-
{ internalType: "address", name: "provider", type: "address" },
|
|
870
|
-
{ internalType: "uint256", name: "budget", type: "uint256" },
|
|
871
|
-
{ internalType: "uint256", name: "amountClaimed", type: "uint256" },
|
|
872
|
-
{ internalType: "uint8", name: "phase", type: "uint8" },
|
|
873
|
-
{ internalType: "uint256", name: "memoCount", type: "uint256" },
|
|
874
|
-
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
875
|
-
{ internalType: "address", name: "evaluator", type: "address" }
|
|
1980
|
+
anonymous: false,
|
|
1981
|
+
inputs: [
|
|
1982
|
+
{ indexed: true, internalType: "address", name: "src", type: "address" },
|
|
1983
|
+
{ indexed: true, internalType: "address", name: "dst", type: "address" },
|
|
1984
|
+
{ indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
|
|
876
1985
|
],
|
|
877
|
-
|
|
878
|
-
type: "
|
|
1986
|
+
name: "Transfer",
|
|
1987
|
+
type: "event"
|
|
879
1988
|
},
|
|
880
1989
|
{
|
|
881
|
-
|
|
882
|
-
|
|
1990
|
+
anonymous: false,
|
|
1991
|
+
inputs: [
|
|
1992
|
+
{ indexed: true, internalType: "address", name: "src", type: "address" },
|
|
1993
|
+
{ indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
|
|
1994
|
+
],
|
|
1995
|
+
name: "Withdrawal",
|
|
1996
|
+
type: "event"
|
|
1997
|
+
},
|
|
1998
|
+
{ payable: true, stateMutability: "payable", type: "fallback" },
|
|
1999
|
+
{
|
|
2000
|
+
constant: true,
|
|
2001
|
+
inputs: [
|
|
2002
|
+
{ internalType: "address", name: "", type: "address" },
|
|
2003
|
+
{ internalType: "address", name: "", type: "address" }
|
|
2004
|
+
],
|
|
2005
|
+
name: "allowance",
|
|
883
2006
|
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
2007
|
+
payable: false,
|
|
884
2008
|
stateMutability: "view",
|
|
885
2009
|
type: "function"
|
|
886
2010
|
},
|
|
887
2011
|
{
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
2012
|
+
constant: false,
|
|
2013
|
+
inputs: [
|
|
2014
|
+
{ internalType: "address", name: "guy", type: "address" },
|
|
2015
|
+
{ internalType: "uint256", name: "wad", type: "uint256" }
|
|
2016
|
+
],
|
|
2017
|
+
name: "approve",
|
|
2018
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
2019
|
+
payable: false,
|
|
2020
|
+
stateMutability: "nonpayable",
|
|
892
2021
|
type: "function"
|
|
893
2022
|
},
|
|
894
2023
|
{
|
|
895
|
-
|
|
896
|
-
name: "
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
internalType: "enum InteractionLedger.MemoType",
|
|
901
|
-
name: "memoType",
|
|
902
|
-
type: "uint8"
|
|
903
|
-
},
|
|
904
|
-
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
905
|
-
{ internalType: "uint8", name: "nextPhase", type: "uint8" },
|
|
906
|
-
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
907
|
-
{ internalType: "address", name: "sender", type: "address" }
|
|
908
|
-
],
|
|
2024
|
+
constant: true,
|
|
2025
|
+
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
2026
|
+
name: "balanceOf",
|
|
2027
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
2028
|
+
payable: false,
|
|
909
2029
|
stateMutability: "view",
|
|
910
2030
|
type: "function"
|
|
911
2031
|
},
|
|
912
2032
|
{
|
|
2033
|
+
constant: true,
|
|
913
2034
|
inputs: [],
|
|
914
|
-
name: "
|
|
2035
|
+
name: "decimals",
|
|
915
2036
|
outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
|
|
2037
|
+
payable: false,
|
|
916
2038
|
stateMutability: "view",
|
|
917
2039
|
type: "function"
|
|
918
2040
|
},
|
|
919
2041
|
{
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
927
|
-
{
|
|
928
|
-
internalType: "enum ACPSimple.FeeType",
|
|
929
|
-
name: "feeType",
|
|
930
|
-
type: "uint8"
|
|
931
|
-
},
|
|
932
|
-
{ internalType: "bool", name: "isExecuted", type: "bool" }
|
|
933
|
-
],
|
|
934
|
-
stateMutability: "view",
|
|
2042
|
+
constant: false,
|
|
2043
|
+
inputs: [],
|
|
2044
|
+
name: "deposit",
|
|
2045
|
+
outputs: [],
|
|
2046
|
+
payable: true,
|
|
2047
|
+
stateMutability: "payable",
|
|
935
2048
|
type: "function"
|
|
936
2049
|
},
|
|
937
2050
|
{
|
|
2051
|
+
constant: true,
|
|
938
2052
|
inputs: [],
|
|
939
|
-
name: "
|
|
940
|
-
outputs: [{ internalType: "
|
|
2053
|
+
name: "name",
|
|
2054
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
2055
|
+
payable: false,
|
|
941
2056
|
stateMutability: "view",
|
|
942
2057
|
type: "function"
|
|
943
2058
|
},
|
|
944
2059
|
{
|
|
2060
|
+
constant: true,
|
|
945
2061
|
inputs: [],
|
|
946
|
-
name: "
|
|
947
|
-
outputs: [{ internalType: "
|
|
2062
|
+
name: "symbol",
|
|
2063
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
2064
|
+
payable: false,
|
|
948
2065
|
stateMutability: "view",
|
|
949
2066
|
type: "function"
|
|
950
2067
|
},
|
|
951
2068
|
{
|
|
2069
|
+
constant: true,
|
|
952
2070
|
inputs: [],
|
|
953
|
-
name: "
|
|
954
|
-
outputs: [{ internalType: "
|
|
2071
|
+
name: "totalSupply",
|
|
2072
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
2073
|
+
payable: false,
|
|
955
2074
|
stateMutability: "view",
|
|
956
2075
|
type: "function"
|
|
957
2076
|
},
|
|
958
2077
|
{
|
|
2078
|
+
constant: false,
|
|
959
2079
|
inputs: [
|
|
960
|
-
{ internalType: "
|
|
961
|
-
{ internalType: "
|
|
962
|
-
],
|
|
963
|
-
name: "renounceRole",
|
|
964
|
-
outputs: [],
|
|
965
|
-
stateMutability: "nonpayable",
|
|
966
|
-
type: "function"
|
|
967
|
-
},
|
|
968
|
-
{
|
|
969
|
-
inputs: [
|
|
970
|
-
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
971
|
-
{ internalType: "address", name: "account", type: "address" }
|
|
972
|
-
],
|
|
973
|
-
name: "revokeRole",
|
|
974
|
-
outputs: [],
|
|
975
|
-
stateMutability: "nonpayable",
|
|
976
|
-
type: "function"
|
|
977
|
-
},
|
|
978
|
-
{
|
|
979
|
-
inputs: [
|
|
980
|
-
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
981
|
-
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
982
|
-
],
|
|
983
|
-
name: "setBudget",
|
|
984
|
-
outputs: [],
|
|
985
|
-
stateMutability: "nonpayable",
|
|
986
|
-
type: "function"
|
|
987
|
-
},
|
|
988
|
-
{
|
|
989
|
-
inputs: [
|
|
990
|
-
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
991
|
-
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
992
|
-
{ internalType: "string", name: "reason", type: "string" }
|
|
2080
|
+
{ internalType: "address", name: "dst", type: "address" },
|
|
2081
|
+
{ internalType: "uint256", name: "wad", type: "uint256" }
|
|
993
2082
|
],
|
|
994
|
-
name: "
|
|
995
|
-
outputs: [],
|
|
2083
|
+
name: "transfer",
|
|
2084
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
2085
|
+
payable: false,
|
|
996
2086
|
stateMutability: "nonpayable",
|
|
997
2087
|
type: "function"
|
|
998
2088
|
},
|
|
999
2089
|
{
|
|
2090
|
+
constant: false,
|
|
1000
2091
|
inputs: [
|
|
1001
|
-
{ internalType: "
|
|
1002
|
-
{ internalType: "address", name: "
|
|
2092
|
+
{ internalType: "address", name: "src", type: "address" },
|
|
2093
|
+
{ internalType: "address", name: "dst", type: "address" },
|
|
2094
|
+
{ internalType: "uint256", name: "wad", type: "uint256" }
|
|
1003
2095
|
],
|
|
1004
|
-
name: "
|
|
1005
|
-
outputs: [{ internalType: "uint8", name: "res", type: "uint8" }],
|
|
1006
|
-
stateMutability: "view",
|
|
1007
|
-
type: "function"
|
|
1008
|
-
},
|
|
1009
|
-
{
|
|
1010
|
-
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
|
|
1011
|
-
name: "supportsInterface",
|
|
2096
|
+
name: "transferFrom",
|
|
1012
2097
|
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
1013
|
-
|
|
1014
|
-
type: "function"
|
|
1015
|
-
},
|
|
1016
|
-
{
|
|
1017
|
-
inputs: [
|
|
1018
|
-
{ internalType: "uint256", name: "evaluatorFeeBP_", type: "uint256" }
|
|
1019
|
-
],
|
|
1020
|
-
name: "updateEvaluatorFee",
|
|
1021
|
-
outputs: [],
|
|
2098
|
+
payable: false,
|
|
1022
2099
|
stateMutability: "nonpayable",
|
|
1023
2100
|
type: "function"
|
|
1024
2101
|
},
|
|
1025
2102
|
{
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
],
|
|
1030
|
-
name: "updatePlatformFee",
|
|
2103
|
+
constant: false,
|
|
2104
|
+
inputs: [{ internalType: "uint256", name: "wad", type: "uint256" }],
|
|
2105
|
+
name: "withdraw",
|
|
1031
2106
|
outputs: [],
|
|
2107
|
+
payable: false,
|
|
1032
2108
|
stateMutability: "nonpayable",
|
|
1033
2109
|
type: "function"
|
|
1034
2110
|
}
|
|
1035
2111
|
];
|
|
1036
|
-
var
|
|
1037
|
-
|
|
1038
|
-
// src/acpClient.ts
|
|
1039
|
-
import { parseEther } from "viem";
|
|
1040
|
-
import { io } from "socket.io-client";
|
|
1041
|
-
|
|
1042
|
-
// src/acpContractClient.ts
|
|
1043
|
-
import { LocalAccountSigner } from "@aa-sdk/core";
|
|
1044
|
-
import { alchemy } from "@account-kit/infra";
|
|
1045
|
-
import {
|
|
1046
|
-
createModularAccountV2Client
|
|
1047
|
-
} from "@account-kit/smart-contracts";
|
|
1048
|
-
|
|
1049
|
-
// src/configs.ts
|
|
1050
|
-
import { baseSepolia, base } from "@account-kit/infra";
|
|
1051
|
-
var baseSepoliaAcpConfig = {
|
|
1052
|
-
chain: baseSepolia,
|
|
1053
|
-
contractAddress: "0x8Db6B1c839Fc8f6bd35777E194677B67b4D51928",
|
|
1054
|
-
virtualsTokenAddress: "0xbfAB80ccc15DF6fb7185f9498d6039317331846a",
|
|
1055
|
-
alchemyRpcUrl: "https://alchemy-proxy.virtuals.io/api/proxy/rpc",
|
|
1056
|
-
acpUrl: "https://acpx.virtuals.gg",
|
|
1057
|
-
priorityFeeMultiplier: 2,
|
|
1058
|
-
maxFeePerGas: 2e7,
|
|
1059
|
-
maxPriorityFeePerGas: 21e6
|
|
1060
|
-
};
|
|
1061
|
-
var baseAcpConfig = {
|
|
1062
|
-
chain: base,
|
|
1063
|
-
contractAddress: "0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
|
|
1064
|
-
virtualsTokenAddress: "0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b",
|
|
1065
|
-
alchemyRpcUrl: "https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
|
|
1066
|
-
acpUrl: "https://acpx.virtuals.io",
|
|
1067
|
-
priorityFeeMultiplier: 2,
|
|
1068
|
-
maxFeePerGas: 2e7,
|
|
1069
|
-
maxPriorityFeePerGas: 21e6
|
|
1070
|
-
};
|
|
2112
|
+
var wethAbi_default = WETH_ABI;
|
|
1071
2113
|
|
|
1072
2114
|
// src/acpContractClient.ts
|
|
1073
|
-
import {
|
|
1074
|
-
createPublicClient,
|
|
1075
|
-
decodeEventLog,
|
|
1076
|
-
encodeFunctionData,
|
|
1077
|
-
erc20Abi,
|
|
1078
|
-
fromHex,
|
|
1079
|
-
http
|
|
1080
|
-
} from "viem";
|
|
1081
|
-
import { publicActionsL2 } from "viem/op-stack";
|
|
1082
2115
|
var MemoType = /* @__PURE__ */ ((MemoType2) => {
|
|
1083
2116
|
MemoType2[MemoType2["MESSAGE"] = 0] = "MESSAGE";
|
|
1084
2117
|
MemoType2[MemoType2["CONTEXT_URL"] = 1] = "CONTEXT_URL";
|
|
@@ -1088,8 +2121,7 @@ var MemoType = /* @__PURE__ */ ((MemoType2) => {
|
|
|
1088
2121
|
MemoType2[MemoType2["TXHASH"] = 5] = "TXHASH";
|
|
1089
2122
|
MemoType2[MemoType2["PAYABLE_REQUEST"] = 6] = "PAYABLE_REQUEST";
|
|
1090
2123
|
MemoType2[MemoType2["PAYABLE_TRANSFER"] = 7] = "PAYABLE_TRANSFER";
|
|
1091
|
-
MemoType2[MemoType2["
|
|
1092
|
-
MemoType2[MemoType2["PAYABLE_FEE_REQUEST"] = 9] = "PAYABLE_FEE_REQUEST";
|
|
2124
|
+
MemoType2[MemoType2["PAYABLE_TRANSFER_ESCROW"] = 8] = "PAYABLE_TRANSFER_ESCROW";
|
|
1093
2125
|
return MemoType2;
|
|
1094
2126
|
})(MemoType || {});
|
|
1095
2127
|
var AcpJobPhases = /* @__PURE__ */ ((AcpJobPhases2) => {
|
|
@@ -1103,30 +2135,26 @@ var AcpJobPhases = /* @__PURE__ */ ((AcpJobPhases2) => {
|
|
|
1103
2135
|
return AcpJobPhases2;
|
|
1104
2136
|
})(AcpJobPhases || {});
|
|
1105
2137
|
var AcpContractClient = class _AcpContractClient {
|
|
1106
|
-
|
|
2138
|
+
// private paymentTokenAddress: Address;
|
|
2139
|
+
constructor(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
|
|
1107
2140
|
this.walletPrivateKey = walletPrivateKey;
|
|
1108
2141
|
this.sessionEntityKeyId = sessionEntityKeyId;
|
|
1109
2142
|
this.agentWalletAddress = agentWalletAddress;
|
|
1110
2143
|
this.config = config;
|
|
1111
|
-
this.customRpcUrl = customRpcUrl;
|
|
1112
2144
|
this.MAX_RETRIES = 3;
|
|
2145
|
+
this.PRIORITY_FEE_MULTIPLIER = 2;
|
|
2146
|
+
this.MAX_FEE_PER_GAS = 2e7;
|
|
2147
|
+
this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
|
|
1113
2148
|
this.chain = config.chain;
|
|
1114
2149
|
this.contractAddress = config.contractAddress;
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
this
|
|
1118
|
-
chain: this.chain,
|
|
1119
|
-
transport: this.customRpcUrl ? http(this.customRpcUrl) : http()
|
|
1120
|
-
}).extend(publicActionsL2());
|
|
1121
|
-
}
|
|
1122
|
-
static build(_0, _1, _2, _3) {
|
|
1123
|
-
return __async(this, arguments, function* (walletPrivateKey, sessionEntityKeyId, agentWalletAddress, customRpcUrl, config = baseAcpConfig) {
|
|
2150
|
+
}
|
|
2151
|
+
static build(_0, _1, _2) {
|
|
2152
|
+
return __async(this, arguments, function* (walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
|
|
1124
2153
|
const acpContractClient = new _AcpContractClient(
|
|
1125
2154
|
walletPrivateKey,
|
|
1126
2155
|
sessionEntityKeyId,
|
|
1127
2156
|
agentWalletAddress,
|
|
1128
|
-
config
|
|
1129
|
-
customRpcUrl
|
|
2157
|
+
config
|
|
1130
2158
|
);
|
|
1131
2159
|
yield acpContractClient.init();
|
|
1132
2160
|
return acpContractClient;
|
|
@@ -1152,7 +2180,7 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1152
2180
|
}
|
|
1153
2181
|
get sessionKeyClient() {
|
|
1154
2182
|
if (!this._sessionKeyClient) {
|
|
1155
|
-
throw new
|
|
2183
|
+
throw new acpError_default("Session key client not initialized");
|
|
1156
2184
|
}
|
|
1157
2185
|
return this._sessionKeyClient;
|
|
1158
2186
|
}
|
|
@@ -1161,21 +2189,17 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1161
2189
|
}
|
|
1162
2190
|
calculateGasFees() {
|
|
1163
2191
|
return __async(this, null, function* () {
|
|
1164
|
-
const
|
|
1165
|
-
let finalMaxFeePerGas = maxFeePerGas;
|
|
1166
|
-
let priorityFeeMultiplier = Number(this.config.priorityFeeMultiplier) || 2;
|
|
1167
|
-
const overrideMaxFeePerGas = this.config.maxFeePerGas || maxFeePerGas;
|
|
1168
|
-
const overrideMaxPriorityFeePerGas = this.config.maxPriorityFeePerGas || maxPriorityFeePerGas;
|
|
1169
|
-
finalMaxFeePerGas = BigInt(overrideMaxFeePerGas) + BigInt(overrideMaxPriorityFeePerGas) * BigInt(Math.max(0, priorityFeeMultiplier - 1));
|
|
2192
|
+
const finalMaxFeePerGas = BigInt(this.MAX_FEE_PER_GAS) + BigInt(this.MAX_PRIORITY_FEE_PER_GAS) * BigInt(Math.max(0, this.PRIORITY_FEE_MULTIPLIER - 1));
|
|
1170
2193
|
return finalMaxFeePerGas;
|
|
1171
2194
|
});
|
|
1172
2195
|
}
|
|
1173
2196
|
handleSendUserOperation(_0) {
|
|
1174
|
-
return __async(this, arguments, function* (data, contractAddress = this.contractAddress) {
|
|
2197
|
+
return __async(this, arguments, function* (data, contractAddress = this.contractAddress, value) {
|
|
1175
2198
|
const payload = {
|
|
1176
2199
|
uo: {
|
|
1177
2200
|
target: contractAddress,
|
|
1178
|
-
data
|
|
2201
|
+
data,
|
|
2202
|
+
value
|
|
1179
2203
|
},
|
|
1180
2204
|
overrides: {}
|
|
1181
2205
|
};
|
|
@@ -1195,7 +2219,6 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1195
2219
|
});
|
|
1196
2220
|
return hash;
|
|
1197
2221
|
} catch (error) {
|
|
1198
|
-
console.debug("Failed to send user operation", error);
|
|
1199
2222
|
retries -= 1;
|
|
1200
2223
|
if (retries === 0) {
|
|
1201
2224
|
finalError = error;
|
|
@@ -1204,20 +2227,20 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1204
2227
|
yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
|
|
1205
2228
|
}
|
|
1206
2229
|
}
|
|
1207
|
-
throw new
|
|
2230
|
+
throw new acpError_default(`Failed to send user operation`, finalError);
|
|
1208
2231
|
});
|
|
1209
2232
|
}
|
|
1210
2233
|
getJobId(hash) {
|
|
1211
2234
|
return __async(this, null, function* () {
|
|
1212
2235
|
const result = yield this.sessionKeyClient.getUserOperationReceipt(hash);
|
|
1213
2236
|
if (!result) {
|
|
1214
|
-
throw new
|
|
2237
|
+
throw new acpError_default("Failed to get user operation receipt");
|
|
1215
2238
|
}
|
|
1216
2239
|
const contractLogs = result.logs.find(
|
|
1217
2240
|
(log) => log.address.toLowerCase() === this.contractAddress.toLowerCase()
|
|
1218
2241
|
);
|
|
1219
2242
|
if (!contractLogs) {
|
|
1220
|
-
throw new
|
|
2243
|
+
throw new acpError_default("Failed to get contract logs");
|
|
1221
2244
|
}
|
|
1222
2245
|
return fromHex(contractLogs.data, "number");
|
|
1223
2246
|
});
|
|
@@ -1238,100 +2261,47 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1238
2261
|
const jobId = yield this.getJobId(hash);
|
|
1239
2262
|
return { txHash: hash, jobId };
|
|
1240
2263
|
} catch (error) {
|
|
1241
|
-
|
|
1242
|
-
throw new Error("Failed to create job");
|
|
2264
|
+
throw new acpError_default("Failed to create job", error);
|
|
1243
2265
|
}
|
|
1244
2266
|
});
|
|
1245
2267
|
}
|
|
1246
|
-
approveAllowance(
|
|
1247
|
-
return __async(this,
|
|
2268
|
+
approveAllowance(_0) {
|
|
2269
|
+
return __async(this, arguments, function* (amountBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
|
|
1248
2270
|
try {
|
|
1249
2271
|
const data = encodeFunctionData({
|
|
1250
2272
|
abi: erc20Abi,
|
|
1251
2273
|
functionName: "approve",
|
|
1252
|
-
args: [this.contractAddress,
|
|
2274
|
+
args: [this.contractAddress, amountBaseUnit]
|
|
1253
2275
|
});
|
|
1254
|
-
return yield this.handleSendUserOperation(
|
|
1255
|
-
data,
|
|
1256
|
-
this.virtualsTokenAddress
|
|
1257
|
-
);
|
|
2276
|
+
return yield this.handleSendUserOperation(data, paymentTokenAddress);
|
|
1258
2277
|
} catch (error) {
|
|
1259
|
-
|
|
1260
|
-
throw new Error("Failed to approve allowance");
|
|
1261
|
-
}
|
|
1262
|
-
});
|
|
1263
|
-
}
|
|
1264
|
-
createPayableFeeMemo(jobId, content, amount, memoType, nextPhase) {
|
|
1265
|
-
return __async(this, null, function* () {
|
|
1266
|
-
let retries = 3;
|
|
1267
|
-
while (retries > 0) {
|
|
1268
|
-
try {
|
|
1269
|
-
const data = encodeFunctionData({
|
|
1270
|
-
abi: acpAbi_default,
|
|
1271
|
-
functionName: "createPayableFeeMemo",
|
|
1272
|
-
args: [jobId, content, amount, memoType, nextPhase]
|
|
1273
|
-
});
|
|
1274
|
-
const { hash } = yield this.sessionKeyClient.sendUserOperation({
|
|
1275
|
-
uo: {
|
|
1276
|
-
target: this.contractAddress,
|
|
1277
|
-
data
|
|
1278
|
-
}
|
|
1279
|
-
});
|
|
1280
|
-
yield this.sessionKeyClient.waitForUserOperationTransaction({
|
|
1281
|
-
hash
|
|
1282
|
-
});
|
|
1283
|
-
return hash;
|
|
1284
|
-
} catch (error) {
|
|
1285
|
-
console.error(
|
|
1286
|
-
`failed to create payable fee memo ${jobId} ${content} ${error}`
|
|
1287
|
-
);
|
|
1288
|
-
retries -= 1;
|
|
1289
|
-
yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
|
|
1290
|
-
}
|
|
2278
|
+
throw new acpError_default("Failed to approve allowance", error);
|
|
1291
2279
|
}
|
|
1292
|
-
throw new Error("Failed to create payable fee memo");
|
|
1293
2280
|
});
|
|
1294
2281
|
}
|
|
1295
2282
|
createPayableMemo(_0, _1, _2, _3, _4, _5, _6, _7, _8) {
|
|
1296
|
-
return __async(this, arguments, function* (jobId, content,
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
uo: {
|
|
1318
|
-
target: this.contractAddress,
|
|
1319
|
-
data
|
|
1320
|
-
}
|
|
1321
|
-
});
|
|
1322
|
-
yield this.sessionKeyClient.waitForUserOperationTransaction({
|
|
1323
|
-
hash
|
|
1324
|
-
});
|
|
1325
|
-
return hash;
|
|
1326
|
-
} catch (error) {
|
|
1327
|
-
console.error(
|
|
1328
|
-
`failed to create payable memo ${jobId} ${content} ${error}`
|
|
1329
|
-
);
|
|
1330
|
-
retries -= 1;
|
|
1331
|
-
yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
|
|
1332
|
-
}
|
|
2283
|
+
return __async(this, arguments, function* (jobId, content, amountBaseUnit, recipient, feeAmountBaseUnit, feeType, nextPhase, type, expiredAt, token = this.config.baseFare.contractAddress) {
|
|
2284
|
+
try {
|
|
2285
|
+
const data = encodeFunctionData({
|
|
2286
|
+
abi: acpAbi_default,
|
|
2287
|
+
functionName: "createPayableMemo",
|
|
2288
|
+
args: [
|
|
2289
|
+
jobId,
|
|
2290
|
+
content,
|
|
2291
|
+
token,
|
|
2292
|
+
amountBaseUnit,
|
|
2293
|
+
recipient,
|
|
2294
|
+
feeAmountBaseUnit,
|
|
2295
|
+
feeType,
|
|
2296
|
+
type,
|
|
2297
|
+
nextPhase,
|
|
2298
|
+
Math.floor(expiredAt.getTime() / 1e3)
|
|
2299
|
+
]
|
|
2300
|
+
});
|
|
2301
|
+
return yield this.handleSendUserOperation(data);
|
|
2302
|
+
} catch (error) {
|
|
2303
|
+
throw new acpError_default("Failed to create payable memo", error);
|
|
1333
2304
|
}
|
|
1334
|
-
throw new Error("Failed to create payable memo");
|
|
1335
2305
|
});
|
|
1336
2306
|
}
|
|
1337
2307
|
createMemo(jobId, content, type, isSecured, nextPhase) {
|
|
@@ -1344,8 +2314,7 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1344
2314
|
});
|
|
1345
2315
|
return yield this.handleSendUserOperation(data);
|
|
1346
2316
|
} catch (error) {
|
|
1347
|
-
|
|
1348
|
-
throw new Error("Failed to create memo");
|
|
2317
|
+
throw new acpError_default("Failed to create memo", error);
|
|
1349
2318
|
}
|
|
1350
2319
|
});
|
|
1351
2320
|
}
|
|
@@ -1353,13 +2322,13 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1353
2322
|
return __async(this, null, function* () {
|
|
1354
2323
|
const result = yield this.sessionKeyClient.getUserOperationReceipt(hash);
|
|
1355
2324
|
if (!result) {
|
|
1356
|
-
throw new
|
|
2325
|
+
throw new acpError_default("Failed to get user operation receipt");
|
|
1357
2326
|
}
|
|
1358
2327
|
const contractLogs = result.logs.find(
|
|
1359
2328
|
(log) => log.address.toLowerCase() === this.contractAddress.toLowerCase()
|
|
1360
2329
|
);
|
|
1361
2330
|
if (!contractLogs) {
|
|
1362
|
-
throw new
|
|
2331
|
+
throw new acpError_default("Failed to get contract logs");
|
|
1363
2332
|
}
|
|
1364
2333
|
const decoded = decodeEventLog({
|
|
1365
2334
|
abi: acpAbi_default,
|
|
@@ -1367,7 +2336,7 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1367
2336
|
topics: contractLogs.topics
|
|
1368
2337
|
});
|
|
1369
2338
|
if (!decoded.args) {
|
|
1370
|
-
throw new
|
|
2339
|
+
throw new acpError_default("Failed to decode event logs");
|
|
1371
2340
|
}
|
|
1372
2341
|
return parseInt(decoded.args.memoId);
|
|
1373
2342
|
});
|
|
@@ -1382,23 +2351,52 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1382
2351
|
});
|
|
1383
2352
|
return yield this.handleSendUserOperation(data);
|
|
1384
2353
|
} catch (error) {
|
|
1385
|
-
|
|
1386
|
-
throw new Error("Failed to sign memo");
|
|
2354
|
+
throw new acpError_default("Failed to sign memo", error);
|
|
1387
2355
|
}
|
|
1388
2356
|
});
|
|
1389
2357
|
}
|
|
1390
|
-
setBudget(jobId,
|
|
2358
|
+
setBudget(jobId, budgetBaseUnit) {
|
|
1391
2359
|
return __async(this, null, function* () {
|
|
1392
2360
|
try {
|
|
1393
2361
|
const data = encodeFunctionData({
|
|
1394
2362
|
abi: acpAbi_default,
|
|
1395
2363
|
functionName: "setBudget",
|
|
1396
|
-
args: [jobId,
|
|
2364
|
+
args: [jobId, budgetBaseUnit]
|
|
2365
|
+
});
|
|
2366
|
+
return yield this.handleSendUserOperation(data);
|
|
2367
|
+
} catch (error) {
|
|
2368
|
+
throw new acpError_default("Failed to set budget", error);
|
|
2369
|
+
}
|
|
2370
|
+
});
|
|
2371
|
+
}
|
|
2372
|
+
setBudgetWithPaymentToken(_0, _1) {
|
|
2373
|
+
return __async(this, arguments, function* (jobId, budgetBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
|
|
2374
|
+
try {
|
|
2375
|
+
const data = encodeFunctionData({
|
|
2376
|
+
abi: acpAbi_default,
|
|
2377
|
+
functionName: "setBudgetWithPaymentToken",
|
|
2378
|
+
args: [jobId, budgetBaseUnit, paymentTokenAddress]
|
|
1397
2379
|
});
|
|
1398
2380
|
return yield this.handleSendUserOperation(data);
|
|
1399
2381
|
} catch (error) {
|
|
1400
|
-
|
|
1401
|
-
|
|
2382
|
+
throw new acpError_default("Failed to set budget", error);
|
|
2383
|
+
}
|
|
2384
|
+
});
|
|
2385
|
+
}
|
|
2386
|
+
wrapEth(amountBaseUnit) {
|
|
2387
|
+
return __async(this, null, function* () {
|
|
2388
|
+
try {
|
|
2389
|
+
const data = encodeFunctionData({
|
|
2390
|
+
abi: wethAbi_default,
|
|
2391
|
+
functionName: "deposit"
|
|
2392
|
+
});
|
|
2393
|
+
return yield this.handleSendUserOperation(
|
|
2394
|
+
data,
|
|
2395
|
+
wethFare.contractAddress,
|
|
2396
|
+
amountBaseUnit
|
|
2397
|
+
);
|
|
2398
|
+
} catch (error) {
|
|
2399
|
+
throw new acpError_default("Failed to wrap eth", error);
|
|
1402
2400
|
}
|
|
1403
2401
|
});
|
|
1404
2402
|
}
|
|
@@ -1406,6 +2404,12 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1406
2404
|
var acpContractClient_default = AcpContractClient;
|
|
1407
2405
|
|
|
1408
2406
|
// src/interfaces.ts
|
|
2407
|
+
var AcpMemoStatus = /* @__PURE__ */ ((AcpMemoStatus2) => {
|
|
2408
|
+
AcpMemoStatus2["PENDING"] = "PENDING";
|
|
2409
|
+
AcpMemoStatus2["APPROVED"] = "APPROVED";
|
|
2410
|
+
AcpMemoStatus2["REJECTED"] = "REJECTED";
|
|
2411
|
+
return AcpMemoStatus2;
|
|
2412
|
+
})(AcpMemoStatus || {});
|
|
1409
2413
|
var AcpAgentSort = /* @__PURE__ */ ((AcpAgentSort2) => {
|
|
1410
2414
|
AcpAgentSort2["SUCCESSFUL_JOB_COUNT"] = "successfulJobCount";
|
|
1411
2415
|
AcpAgentSort2["SUCCESS_RATE"] = "successRate";
|
|
@@ -1428,6 +2432,8 @@ var AcpOnlineStatus = /* @__PURE__ */ ((AcpOnlineStatus2) => {
|
|
|
1428
2432
|
var PayloadType = /* @__PURE__ */ ((PayloadType2) => {
|
|
1429
2433
|
PayloadType2["FUND_RESPONSE"] = "fund_response";
|
|
1430
2434
|
PayloadType2["OPEN_POSITION"] = "open_position";
|
|
2435
|
+
PayloadType2["SWAP_TOKEN"] = "swap_token";
|
|
2436
|
+
PayloadType2["RESPONSE_SWAP_TOKEN"] = "response_swap_token";
|
|
1431
2437
|
PayloadType2["CLOSE_PARTIAL_POSITION"] = "close_partial_position";
|
|
1432
2438
|
PayloadType2["CLOSE_POSITION"] = "close_position";
|
|
1433
2439
|
PayloadType2["POSITION_FULFILLED"] = "position_fulfilled";
|
|
@@ -1435,6 +2441,11 @@ var PayloadType = /* @__PURE__ */ ((PayloadType2) => {
|
|
|
1435
2441
|
PayloadType2["UNFULFILLED_POSITION"] = "unfulfilled_position";
|
|
1436
2442
|
return PayloadType2;
|
|
1437
2443
|
})(PayloadType || {});
|
|
2444
|
+
var PositionDirection = /* @__PURE__ */ ((PositionDirection2) => {
|
|
2445
|
+
PositionDirection2["LONG"] = "long";
|
|
2446
|
+
PositionDirection2["SHORT"] = "short";
|
|
2447
|
+
return PositionDirection2;
|
|
2448
|
+
})(PositionDirection || {});
|
|
1438
2449
|
|
|
1439
2450
|
// src/utils.ts
|
|
1440
2451
|
function tryParseJson(content) {
|
|
@@ -1447,20 +2458,46 @@ function tryParseJson(content) {
|
|
|
1447
2458
|
|
|
1448
2459
|
// src/acpJob.ts
|
|
1449
2460
|
var AcpJob = class {
|
|
1450
|
-
constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, memos, phase, context) {
|
|
2461
|
+
constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, priceTokenAddress, memos, phase, context) {
|
|
1451
2462
|
this.acpClient = acpClient;
|
|
1452
2463
|
this.id = id;
|
|
1453
2464
|
this.clientAddress = clientAddress;
|
|
1454
2465
|
this.providerAddress = providerAddress;
|
|
1455
2466
|
this.evaluatorAddress = evaluatorAddress;
|
|
1456
2467
|
this.price = price;
|
|
2468
|
+
this.priceTokenAddress = priceTokenAddress;
|
|
1457
2469
|
this.memos = memos;
|
|
1458
2470
|
this.phase = phase;
|
|
1459
2471
|
this.context = context;
|
|
2472
|
+
this.baseFare = acpClient.acpContractClient.config.baseFare;
|
|
1460
2473
|
}
|
|
1461
2474
|
get serviceRequirement() {
|
|
1462
2475
|
var _a;
|
|
1463
|
-
|
|
2476
|
+
const content = (_a = this.memos.find(
|
|
2477
|
+
(m) => m.nextPhase === 1 /* NEGOTIATION */
|
|
2478
|
+
)) == null ? void 0 : _a.content;
|
|
2479
|
+
if (!content) {
|
|
2480
|
+
return void 0;
|
|
2481
|
+
}
|
|
2482
|
+
const contentObj = tryParseJson(content);
|
|
2483
|
+
if (!contentObj) {
|
|
2484
|
+
return content;
|
|
2485
|
+
}
|
|
2486
|
+
if (contentObj.serviceRequirement) {
|
|
2487
|
+
return contentObj.serviceRequirement;
|
|
2488
|
+
}
|
|
2489
|
+
return contentObj;
|
|
2490
|
+
}
|
|
2491
|
+
get serviceName() {
|
|
2492
|
+
var _a;
|
|
2493
|
+
const content = (_a = this.memos.find(
|
|
2494
|
+
(m) => m.nextPhase === 1 /* NEGOTIATION */
|
|
2495
|
+
)) == null ? void 0 : _a.content;
|
|
2496
|
+
if (!content) {
|
|
2497
|
+
return void 0;
|
|
2498
|
+
}
|
|
2499
|
+
const contentObj = tryParseJson(content);
|
|
2500
|
+
return contentObj == null ? void 0 : contentObj.serviceName;
|
|
1464
2501
|
}
|
|
1465
2502
|
get deliverable() {
|
|
1466
2503
|
var _a;
|
|
@@ -1484,16 +2521,21 @@ var AcpJob = class {
|
|
|
1484
2521
|
(m) => m.nextPhase === 2 /* TRANSACTION */
|
|
1485
2522
|
);
|
|
1486
2523
|
if (!memo) {
|
|
1487
|
-
throw new
|
|
2524
|
+
throw new acpError_default("No transaction memo found");
|
|
1488
2525
|
}
|
|
1489
|
-
return yield this.acpClient.payJob(
|
|
2526
|
+
return yield this.acpClient.payJob(
|
|
2527
|
+
this.id,
|
|
2528
|
+
this.baseFare.formatAmount(amount),
|
|
2529
|
+
memo.id,
|
|
2530
|
+
reason
|
|
2531
|
+
);
|
|
1490
2532
|
});
|
|
1491
2533
|
}
|
|
1492
2534
|
respond(accept, payload, reason) {
|
|
1493
2535
|
return __async(this, null, function* () {
|
|
1494
2536
|
var _a;
|
|
1495
2537
|
if (((_a = this.latestMemo) == null ? void 0 : _a.nextPhase) !== 1 /* NEGOTIATION */) {
|
|
1496
|
-
throw new
|
|
2538
|
+
throw new acpError_default("No negotiation memo found");
|
|
1497
2539
|
}
|
|
1498
2540
|
return yield this.acpClient.respondJob(
|
|
1499
2541
|
this.id,
|
|
@@ -1508,7 +2550,7 @@ var AcpJob = class {
|
|
|
1508
2550
|
return __async(this, null, function* () {
|
|
1509
2551
|
var _a;
|
|
1510
2552
|
if (((_a = this.latestMemo) == null ? void 0 : _a.nextPhase) !== 3 /* EVALUATION */) {
|
|
1511
|
-
throw new
|
|
2553
|
+
throw new acpError_default("No transaction memo found");
|
|
1512
2554
|
}
|
|
1513
2555
|
return yield this.acpClient.deliverJob(this.id, deliverable);
|
|
1514
2556
|
});
|
|
@@ -1517,7 +2559,7 @@ var AcpJob = class {
|
|
|
1517
2559
|
return __async(this, null, function* () {
|
|
1518
2560
|
var _a;
|
|
1519
2561
|
if (((_a = this.latestMemo) == null ? void 0 : _a.nextPhase) !== 4 /* COMPLETED */) {
|
|
1520
|
-
throw new
|
|
2562
|
+
throw new acpError_default("No evaluation memo found");
|
|
1521
2563
|
}
|
|
1522
2564
|
return yield this.acpClient.acpContractClient.signMemo(
|
|
1523
2565
|
this.latestMemo.id,
|
|
@@ -1526,16 +2568,17 @@ var AcpJob = class {
|
|
|
1526
2568
|
);
|
|
1527
2569
|
});
|
|
1528
2570
|
}
|
|
1529
|
-
openPosition(
|
|
1530
|
-
return __async(this,
|
|
2571
|
+
openPosition(_0, _1) {
|
|
2572
|
+
return __async(this, arguments, function* (payload, feeAmount, expiredAt = new Date(Date.now() + 1e3 * 60 * 3), walletAddress) {
|
|
1531
2573
|
if (payload.length === 0) {
|
|
1532
|
-
throw new
|
|
2574
|
+
throw new acpError_default("No positions to open");
|
|
1533
2575
|
}
|
|
2576
|
+
const sumAmount = payload.reduce((acc, curr) => acc + curr.amount, 0);
|
|
1534
2577
|
return yield this.acpClient.transferFunds(
|
|
1535
2578
|
this.id,
|
|
1536
|
-
|
|
2579
|
+
new FareAmount(sumAmount, this.baseFare),
|
|
1537
2580
|
walletAddress || this.providerAddress,
|
|
1538
|
-
feeAmount,
|
|
2581
|
+
new FareAmount(feeAmount, this.baseFare),
|
|
1539
2582
|
1 /* IMMEDIATE_FEE */,
|
|
1540
2583
|
{
|
|
1541
2584
|
type: "open_position" /* OPEN_POSITION */,
|
|
@@ -1546,34 +2589,84 @@ var AcpJob = class {
|
|
|
1546
2589
|
);
|
|
1547
2590
|
});
|
|
1548
2591
|
}
|
|
2592
|
+
swapToken(payload, decimals, feeAmount, walletAddress) {
|
|
2593
|
+
return __async(this, null, function* () {
|
|
2594
|
+
return yield this.acpClient.transferFunds(
|
|
2595
|
+
this.id,
|
|
2596
|
+
new FareAmount(
|
|
2597
|
+
payload.amount,
|
|
2598
|
+
new Fare(payload.fromContractAddress, decimals)
|
|
2599
|
+
),
|
|
2600
|
+
walletAddress || this.providerAddress,
|
|
2601
|
+
new FareAmount(feeAmount, this.baseFare),
|
|
2602
|
+
1 /* IMMEDIATE_FEE */,
|
|
2603
|
+
{
|
|
2604
|
+
type: "swap_token" /* SWAP_TOKEN */,
|
|
2605
|
+
data: payload
|
|
2606
|
+
},
|
|
2607
|
+
2 /* TRANSACTION */,
|
|
2608
|
+
new Date(Date.now() + 1e3 * 60 * 30)
|
|
2609
|
+
);
|
|
2610
|
+
});
|
|
2611
|
+
}
|
|
2612
|
+
responseSwapToken(memoId, accept, reason) {
|
|
2613
|
+
return __async(this, null, function* () {
|
|
2614
|
+
const memo = this.memos.find((m) => m.id === memoId);
|
|
2615
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2616
|
+
throw new acpError_default("No swap token memo found");
|
|
2617
|
+
}
|
|
2618
|
+
const payload = tryParseJson(
|
|
2619
|
+
memo.content
|
|
2620
|
+
);
|
|
2621
|
+
if ((payload == null ? void 0 : payload.type) !== "swap_token" /* SWAP_TOKEN */) {
|
|
2622
|
+
throw new acpError_default("Invalid swap token memo");
|
|
2623
|
+
}
|
|
2624
|
+
return yield memo.sign(accept, reason);
|
|
2625
|
+
});
|
|
2626
|
+
}
|
|
2627
|
+
transferFunds(_0, _1, _2) {
|
|
2628
|
+
return __async(this, arguments, function* (payload, fareAmount, walletAddress, expiredAt = new Date(Date.now() + 1e3 * 60 * 30)) {
|
|
2629
|
+
return yield this.acpClient.transferFunds(
|
|
2630
|
+
this.id,
|
|
2631
|
+
fareAmount,
|
|
2632
|
+
walletAddress || this.clientAddress,
|
|
2633
|
+
new FareAmount(0, this.baseFare),
|
|
2634
|
+
0 /* NO_FEE */,
|
|
2635
|
+
payload,
|
|
2636
|
+
2 /* TRANSACTION */,
|
|
2637
|
+
expiredAt
|
|
2638
|
+
);
|
|
2639
|
+
});
|
|
2640
|
+
}
|
|
1549
2641
|
responseOpenPosition(memoId, accept, reason) {
|
|
1550
2642
|
return __async(this, null, function* () {
|
|
1551
2643
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1552
|
-
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !==
|
|
1553
|
-
throw new
|
|
2644
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2645
|
+
throw new acpError_default("No open position memo found");
|
|
1554
2646
|
}
|
|
1555
2647
|
const payload = tryParseJson(
|
|
1556
2648
|
memo.content
|
|
1557
2649
|
);
|
|
1558
2650
|
if ((payload == null ? void 0 : payload.type) !== "open_position" /* OPEN_POSITION */) {
|
|
1559
|
-
throw new
|
|
2651
|
+
throw new acpError_default("Invalid open position memo");
|
|
1560
2652
|
}
|
|
1561
2653
|
return yield this.acpClient.responseFundsTransfer(memo.id, accept, reason);
|
|
1562
2654
|
});
|
|
1563
2655
|
}
|
|
1564
|
-
closePartialPosition(
|
|
1565
|
-
return __async(this,
|
|
2656
|
+
closePartialPosition(_0) {
|
|
2657
|
+
return __async(this, arguments, function* (payload, expireAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
1566
2658
|
return yield this.acpClient.requestFunds(
|
|
1567
2659
|
this.id,
|
|
1568
|
-
payload.amount,
|
|
2660
|
+
new FareAmount(payload.amount, this.baseFare),
|
|
1569
2661
|
this.clientAddress,
|
|
1570
|
-
0,
|
|
2662
|
+
new FareAmount(0, this.baseFare),
|
|
1571
2663
|
0 /* NO_FEE */,
|
|
1572
2664
|
{
|
|
1573
2665
|
type: "close_partial_position" /* CLOSE_PARTIAL_POSITION */,
|
|
1574
2666
|
data: payload
|
|
1575
2667
|
},
|
|
1576
|
-
2 /* TRANSACTION
|
|
2668
|
+
2 /* TRANSACTION */,
|
|
2669
|
+
expireAt
|
|
1577
2670
|
);
|
|
1578
2671
|
});
|
|
1579
2672
|
}
|
|
@@ -1581,18 +2674,18 @@ var AcpJob = class {
|
|
|
1581
2674
|
return __async(this, null, function* () {
|
|
1582
2675
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1583
2676
|
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 6 /* PAYABLE_REQUEST */) {
|
|
1584
|
-
throw new
|
|
2677
|
+
throw new acpError_default("No close position memo found");
|
|
1585
2678
|
}
|
|
1586
2679
|
const payload = tryParseJson(
|
|
1587
2680
|
memo.content
|
|
1588
2681
|
);
|
|
1589
2682
|
if ((payload == null ? void 0 : payload.type) !== "close_partial_position" /* CLOSE_PARTIAL_POSITION */) {
|
|
1590
|
-
throw new
|
|
2683
|
+
throw new acpError_default("Invalid close position memo");
|
|
1591
2684
|
}
|
|
1592
2685
|
return yield this.acpClient.responseFundsRequest(
|
|
1593
2686
|
memo.id,
|
|
1594
2687
|
accept,
|
|
1595
|
-
payload.data.amount,
|
|
2688
|
+
this.baseFare.formatAmount(payload.data.amount),
|
|
1596
2689
|
reason
|
|
1597
2690
|
);
|
|
1598
2691
|
});
|
|
@@ -1609,29 +2702,30 @@ var AcpJob = class {
|
|
|
1609
2702
|
);
|
|
1610
2703
|
});
|
|
1611
2704
|
}
|
|
1612
|
-
responseRequestClosePosition(
|
|
1613
|
-
return __async(this,
|
|
2705
|
+
responseRequestClosePosition(_0, _1, _2, _3) {
|
|
2706
|
+
return __async(this, arguments, function* (memoId, accept, payload, reason, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
1614
2707
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1615
2708
|
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 0 /* MESSAGE */) {
|
|
1616
|
-
throw new
|
|
2709
|
+
throw new acpError_default("No message memo found");
|
|
1617
2710
|
}
|
|
1618
2711
|
const messagePayload = tryParseJson(memo.content);
|
|
1619
2712
|
if ((messagePayload == null ? void 0 : messagePayload.type) !== "close_position" /* CLOSE_POSITION */) {
|
|
1620
|
-
throw new
|
|
2713
|
+
throw new acpError_default("Invalid close position memo");
|
|
1621
2714
|
}
|
|
1622
2715
|
yield memo.sign(accept, reason);
|
|
1623
2716
|
if (accept) {
|
|
1624
2717
|
return yield this.acpClient.transferFunds(
|
|
1625
2718
|
this.id,
|
|
1626
|
-
payload.amount,
|
|
2719
|
+
new FareAmount(payload.amount, this.baseFare),
|
|
1627
2720
|
this.clientAddress,
|
|
1628
|
-
0,
|
|
2721
|
+
new FareAmount(0, this.baseFare),
|
|
1629
2722
|
0 /* NO_FEE */,
|
|
1630
2723
|
{
|
|
1631
2724
|
type: "close_position" /* CLOSE_POSITION */,
|
|
1632
2725
|
data: payload
|
|
1633
2726
|
},
|
|
1634
|
-
2 /* TRANSACTION
|
|
2727
|
+
2 /* TRANSACTION */,
|
|
2728
|
+
expiredAt
|
|
1635
2729
|
);
|
|
1636
2730
|
}
|
|
1637
2731
|
});
|
|
@@ -1639,61 +2733,63 @@ var AcpJob = class {
|
|
|
1639
2733
|
confirmClosePosition(memoId, accept, reason) {
|
|
1640
2734
|
return __async(this, null, function* () {
|
|
1641
2735
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1642
|
-
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !==
|
|
1643
|
-
throw new
|
|
2736
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2737
|
+
throw new acpError_default("No payable transfer memo found");
|
|
1644
2738
|
}
|
|
1645
2739
|
const payload = tryParseJson(
|
|
1646
2740
|
memo.content
|
|
1647
2741
|
);
|
|
1648
2742
|
if ((payload == null ? void 0 : payload.type) !== "close_position" /* CLOSE_POSITION */) {
|
|
1649
|
-
throw new
|
|
2743
|
+
throw new acpError_default("Invalid close position memo");
|
|
1650
2744
|
}
|
|
1651
2745
|
yield memo.sign(accept, reason);
|
|
1652
2746
|
});
|
|
1653
2747
|
}
|
|
1654
|
-
positionFulfilled(
|
|
1655
|
-
return __async(this,
|
|
2748
|
+
positionFulfilled(_0) {
|
|
2749
|
+
return __async(this, arguments, function* (payload, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
1656
2750
|
return yield this.acpClient.transferFunds(
|
|
1657
2751
|
this.id,
|
|
1658
|
-
payload.amount,
|
|
2752
|
+
new FareAmount(payload.amount, this.baseFare),
|
|
1659
2753
|
this.clientAddress,
|
|
1660
|
-
0,
|
|
2754
|
+
new FareAmount(0, this.baseFare),
|
|
1661
2755
|
0 /* NO_FEE */,
|
|
1662
2756
|
{
|
|
1663
2757
|
type: "position_fulfilled" /* POSITION_FULFILLED */,
|
|
1664
2758
|
data: payload
|
|
1665
2759
|
},
|
|
1666
|
-
2 /* TRANSACTION
|
|
2760
|
+
2 /* TRANSACTION */,
|
|
2761
|
+
expiredAt
|
|
1667
2762
|
);
|
|
1668
2763
|
});
|
|
1669
2764
|
}
|
|
1670
|
-
unfulfilledPosition(
|
|
1671
|
-
return __async(this,
|
|
2765
|
+
unfulfilledPosition(_0) {
|
|
2766
|
+
return __async(this, arguments, function* (payload, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
1672
2767
|
return yield this.acpClient.transferFunds(
|
|
1673
2768
|
this.id,
|
|
1674
|
-
payload.amount,
|
|
2769
|
+
new FareAmount(payload.amount, this.baseFare),
|
|
1675
2770
|
this.clientAddress,
|
|
1676
|
-
0,
|
|
2771
|
+
new FareAmount(0, this.baseFare),
|
|
1677
2772
|
0 /* NO_FEE */,
|
|
1678
2773
|
{
|
|
1679
2774
|
type: "unfulfilled_position" /* UNFULFILLED_POSITION */,
|
|
1680
2775
|
data: payload
|
|
1681
2776
|
},
|
|
1682
|
-
2 /* TRANSACTION
|
|
2777
|
+
2 /* TRANSACTION */,
|
|
2778
|
+
expiredAt
|
|
1683
2779
|
);
|
|
1684
2780
|
});
|
|
1685
2781
|
}
|
|
1686
2782
|
responseUnfulfilledPosition(memoId, accept, reason) {
|
|
1687
2783
|
return __async(this, null, function* () {
|
|
1688
2784
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1689
|
-
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !==
|
|
1690
|
-
throw new
|
|
2785
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2786
|
+
throw new acpError_default("No unfulfilled position memo found");
|
|
1691
2787
|
}
|
|
1692
2788
|
const payload = tryParseJson(
|
|
1693
2789
|
memo.content
|
|
1694
2790
|
);
|
|
1695
2791
|
if ((payload == null ? void 0 : payload.type) !== "unfulfilled_position" /* UNFULFILLED_POSITION */) {
|
|
1696
|
-
throw new
|
|
2792
|
+
throw new acpError_default("Invalid unfulfilled position memo");
|
|
1697
2793
|
}
|
|
1698
2794
|
return yield this.acpClient.responseFundsTransfer(memo.id, accept, reason);
|
|
1699
2795
|
});
|
|
@@ -1701,14 +2797,14 @@ var AcpJob = class {
|
|
|
1701
2797
|
responsePositionFulfilled(memoId, accept, reason) {
|
|
1702
2798
|
return __async(this, null, function* () {
|
|
1703
2799
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1704
|
-
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !==
|
|
1705
|
-
throw new
|
|
2800
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2801
|
+
throw new acpError_default("No position fulfilled memo found");
|
|
1706
2802
|
}
|
|
1707
2803
|
const payload = tryParseJson(
|
|
1708
2804
|
memo.content
|
|
1709
2805
|
);
|
|
1710
2806
|
if ((payload == null ? void 0 : payload.type) !== "position_fulfilled" /* POSITION_FULFILLED */) {
|
|
1711
|
-
throw new
|
|
2807
|
+
throw new acpError_default("Invalid position fulfilled memo");
|
|
1712
2808
|
}
|
|
1713
2809
|
return yield this.acpClient.responseFundsTransfer(memo.id, accept, reason);
|
|
1714
2810
|
});
|
|
@@ -1727,17 +2823,17 @@ var AcpJob = class {
|
|
|
1727
2823
|
);
|
|
1728
2824
|
});
|
|
1729
2825
|
}
|
|
1730
|
-
responseCloseJob(
|
|
1731
|
-
return __async(this,
|
|
2826
|
+
responseCloseJob(_0, _1, _2, _3) {
|
|
2827
|
+
return __async(this, arguments, function* (memoId, accept, fulfilledPositions, reason, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
1732
2828
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1733
2829
|
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 0 /* MESSAGE */) {
|
|
1734
|
-
throw new
|
|
2830
|
+
throw new acpError_default("No message memo found");
|
|
1735
2831
|
}
|
|
1736
2832
|
const payload = tryParseJson(
|
|
1737
2833
|
memo.content
|
|
1738
2834
|
);
|
|
1739
2835
|
if ((payload == null ? void 0 : payload.type) !== "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */) {
|
|
1740
|
-
throw new
|
|
2836
|
+
throw new acpError_default("Invalid close job and withdraw memo");
|
|
1741
2837
|
}
|
|
1742
2838
|
yield memo.sign(accept, reason);
|
|
1743
2839
|
if (!accept) {
|
|
@@ -1759,15 +2855,16 @@ var AcpJob = class {
|
|
|
1759
2855
|
}
|
|
1760
2856
|
return yield this.acpClient.transferFunds(
|
|
1761
2857
|
this.id,
|
|
1762
|
-
|
|
2858
|
+
new FareAmount(totalAmount, this.baseFare),
|
|
1763
2859
|
this.clientAddress,
|
|
1764
|
-
0,
|
|
2860
|
+
new FareAmount(0, this.baseFare),
|
|
1765
2861
|
0 /* NO_FEE */,
|
|
1766
2862
|
{
|
|
1767
2863
|
type: "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */,
|
|
1768
2864
|
data: fulfilledPositions
|
|
1769
2865
|
},
|
|
1770
|
-
4 /* COMPLETED
|
|
2866
|
+
4 /* COMPLETED */,
|
|
2867
|
+
expiredAt
|
|
1771
2868
|
);
|
|
1772
2869
|
});
|
|
1773
2870
|
}
|
|
@@ -1775,13 +2872,13 @@ var AcpJob = class {
|
|
|
1775
2872
|
return __async(this, null, function* () {
|
|
1776
2873
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1777
2874
|
if (!memo) {
|
|
1778
|
-
throw new
|
|
2875
|
+
throw new acpError_default("Memo not found");
|
|
1779
2876
|
}
|
|
1780
2877
|
const payload = tryParseJson(
|
|
1781
2878
|
memo.content
|
|
1782
2879
|
);
|
|
1783
2880
|
if ((payload == null ? void 0 : payload.type) !== "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */) {
|
|
1784
|
-
throw new
|
|
2881
|
+
throw new acpError_default("Invalid close job and withdraw memo");
|
|
1785
2882
|
}
|
|
1786
2883
|
yield memo.sign(accept, reason);
|
|
1787
2884
|
});
|
|
@@ -1791,13 +2888,20 @@ var acpJob_default = AcpJob;
|
|
|
1791
2888
|
|
|
1792
2889
|
// src/acpMemo.ts
|
|
1793
2890
|
var AcpMemo = class {
|
|
1794
|
-
constructor(acpClient, id, type, content, nextPhase, expiry) {
|
|
2891
|
+
constructor(acpClient, id, type, content, nextPhase, status, signedReason, expiry, payableDetails) {
|
|
1795
2892
|
this.acpClient = acpClient;
|
|
1796
2893
|
this.id = id;
|
|
1797
2894
|
this.type = type;
|
|
1798
2895
|
this.content = content;
|
|
1799
2896
|
this.nextPhase = nextPhase;
|
|
2897
|
+
this.status = status;
|
|
2898
|
+
this.signedReason = signedReason;
|
|
1800
2899
|
this.expiry = expiry;
|
|
2900
|
+
this.payableDetails = payableDetails;
|
|
2901
|
+
if (this.payableDetails) {
|
|
2902
|
+
this.payableDetails.amount = BigInt(this.payableDetails.amount);
|
|
2903
|
+
this.payableDetails.feeAmount = BigInt(this.payableDetails.feeAmount);
|
|
2904
|
+
}
|
|
1801
2905
|
this.structuredContent = tryParseJson(this.content) || void 0;
|
|
1802
2906
|
}
|
|
1803
2907
|
get payloadType() {
|
|
@@ -1833,10 +2937,10 @@ var acpMemo_default = AcpMemo;
|
|
|
1833
2937
|
// src/acpJobOffering.ts
|
|
1834
2938
|
import Ajv from "ajv";
|
|
1835
2939
|
var AcpJobOffering = class {
|
|
1836
|
-
constructor(acpClient, providerAddress,
|
|
2940
|
+
constructor(acpClient, providerAddress, name, price, requirementSchema) {
|
|
1837
2941
|
this.acpClient = acpClient;
|
|
1838
2942
|
this.providerAddress = providerAddress;
|
|
1839
|
-
this.
|
|
2943
|
+
this.name = name;
|
|
1840
2944
|
this.price = price;
|
|
1841
2945
|
this.requirementSchema = requirementSchema;
|
|
1842
2946
|
this.ajv = new Ajv({ allErrors: true });
|
|
@@ -1847,13 +2951,28 @@ var AcpJobOffering = class {
|
|
|
1847
2951
|
const validator = this.ajv.compile(this.requirementSchema);
|
|
1848
2952
|
const valid = validator(serviceRequirement);
|
|
1849
2953
|
if (!valid) {
|
|
1850
|
-
throw new
|
|
2954
|
+
throw new acpError_default(this.ajv.errorsText(validator.errors));
|
|
1851
2955
|
}
|
|
1852
2956
|
}
|
|
2957
|
+
let finalServiceRequirement = {
|
|
2958
|
+
serviceName: this.name
|
|
2959
|
+
};
|
|
2960
|
+
if (typeof serviceRequirement === "string") {
|
|
2961
|
+
finalServiceRequirement = __spreadProps(__spreadValues({}, finalServiceRequirement), {
|
|
2962
|
+
message: serviceRequirement
|
|
2963
|
+
});
|
|
2964
|
+
} else {
|
|
2965
|
+
finalServiceRequirement = __spreadProps(__spreadValues({}, finalServiceRequirement), {
|
|
2966
|
+
serviceRequirement
|
|
2967
|
+
});
|
|
2968
|
+
}
|
|
1853
2969
|
return yield this.acpClient.initiateJob(
|
|
1854
2970
|
this.providerAddress,
|
|
1855
|
-
|
|
1856
|
-
|
|
2971
|
+
finalServiceRequirement,
|
|
2972
|
+
new FareAmount(
|
|
2973
|
+
this.price,
|
|
2974
|
+
this.acpClient.acpContractClient.config.baseFare
|
|
2975
|
+
),
|
|
1857
2976
|
evaluatorAddress,
|
|
1858
2977
|
expiredAt
|
|
1859
2978
|
);
|
|
@@ -1907,6 +3026,7 @@ var AcpClient = class {
|
|
|
1907
3026
|
data.providerAddress,
|
|
1908
3027
|
data.evaluatorAddress,
|
|
1909
3028
|
data.price,
|
|
3029
|
+
data.priceTokenAddress,
|
|
1910
3030
|
data.memos.map((memo) => {
|
|
1911
3031
|
return new acpMemo_default(
|
|
1912
3032
|
this,
|
|
@@ -1914,7 +3034,10 @@ var AcpClient = class {
|
|
|
1914
3034
|
memo.memoType,
|
|
1915
3035
|
memo.content,
|
|
1916
3036
|
memo.nextPhase,
|
|
1917
|
-
memo.
|
|
3037
|
+
memo.status,
|
|
3038
|
+
memo.signedReason,
|
|
3039
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3040
|
+
memo.payableDetails
|
|
1918
3041
|
);
|
|
1919
3042
|
}),
|
|
1920
3043
|
data.phase,
|
|
@@ -1936,6 +3059,7 @@ var AcpClient = class {
|
|
|
1936
3059
|
data.providerAddress,
|
|
1937
3060
|
data.evaluatorAddress,
|
|
1938
3061
|
data.price,
|
|
3062
|
+
data.priceTokenAddress,
|
|
1939
3063
|
data.memos.map((memo) => {
|
|
1940
3064
|
return new acpMemo_default(
|
|
1941
3065
|
this,
|
|
@@ -1943,7 +3067,10 @@ var AcpClient = class {
|
|
|
1943
3067
|
memo.memoType,
|
|
1944
3068
|
memo.content,
|
|
1945
3069
|
memo.nextPhase,
|
|
1946
|
-
memo.
|
|
3070
|
+
memo.status,
|
|
3071
|
+
memo.signedReason,
|
|
3072
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3073
|
+
memo.payableDetails
|
|
1947
3074
|
);
|
|
1948
3075
|
}),
|
|
1949
3076
|
data.phase,
|
|
@@ -2001,7 +3128,7 @@ var AcpClient = class {
|
|
|
2001
3128
|
this,
|
|
2002
3129
|
agent.walletAddress,
|
|
2003
3130
|
offering.name,
|
|
2004
|
-
offering.
|
|
3131
|
+
offering.priceUsd,
|
|
2005
3132
|
offering.requirementSchema
|
|
2006
3133
|
);
|
|
2007
3134
|
}),
|
|
@@ -2013,18 +3140,22 @@ var AcpClient = class {
|
|
|
2013
3140
|
});
|
|
2014
3141
|
}
|
|
2015
3142
|
initiateJob(_0, _1, _2, _3) {
|
|
2016
|
-
return __async(this, arguments, function* (providerAddress, serviceRequirement,
|
|
3143
|
+
return __async(this, arguments, function* (providerAddress, serviceRequirement, fareAmount, evaluatorAddress, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
3144
|
+
if (providerAddress === this.acpContractClient.walletAddress) {
|
|
3145
|
+
throw new acpError_default(
|
|
3146
|
+
"Provider address cannot be the same as the client address"
|
|
3147
|
+
);
|
|
3148
|
+
}
|
|
2017
3149
|
const { jobId } = yield this.acpContractClient.createJob(
|
|
2018
3150
|
providerAddress,
|
|
2019
3151
|
evaluatorAddress || this.acpContractClient.walletAddress,
|
|
2020
3152
|
expiredAt
|
|
2021
3153
|
);
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
}
|
|
3154
|
+
yield this.acpContractClient.setBudgetWithPaymentToken(
|
|
3155
|
+
jobId,
|
|
3156
|
+
fareAmount.amount,
|
|
3157
|
+
fareAmount.fare.contractAddress
|
|
3158
|
+
);
|
|
2028
3159
|
yield this.acpContractClient.createMemo(
|
|
2029
3160
|
jobId,
|
|
2030
3161
|
typeof serviceRequirement === "string" ? serviceRequirement : JSON.stringify(serviceRequirement),
|
|
@@ -2050,68 +3181,79 @@ var AcpClient = class {
|
|
|
2050
3181
|
);
|
|
2051
3182
|
});
|
|
2052
3183
|
}
|
|
2053
|
-
payJob(jobId,
|
|
3184
|
+
payJob(jobId, amountBaseUnit, memoId, reason) {
|
|
2054
3185
|
return __async(this, null, function* () {
|
|
2055
|
-
if (
|
|
2056
|
-
yield this.acpContractClient.approveAllowance(
|
|
2057
|
-
parseEther(amount.toString())
|
|
2058
|
-
);
|
|
3186
|
+
if (amountBaseUnit > BigInt(0)) {
|
|
3187
|
+
yield this.acpContractClient.approveAllowance(amountBaseUnit);
|
|
2059
3188
|
}
|
|
2060
3189
|
yield this.acpContractClient.signMemo(memoId, true, reason);
|
|
2061
3190
|
return yield this.acpContractClient.createMemo(
|
|
2062
3191
|
jobId,
|
|
2063
|
-
`Payment
|
|
3192
|
+
`Payment made. ${reason != null ? reason : ""}`,
|
|
2064
3193
|
0 /* MESSAGE */,
|
|
2065
3194
|
false,
|
|
2066
3195
|
3 /* EVALUATION */
|
|
2067
3196
|
);
|
|
2068
3197
|
});
|
|
2069
3198
|
}
|
|
2070
|
-
requestFunds(jobId,
|
|
3199
|
+
requestFunds(jobId, transferFareAmount, recipient, feeFareAmount, feeType, reason, nextPhase, expiredAt) {
|
|
2071
3200
|
return __async(this, null, function* () {
|
|
2072
3201
|
return yield this.acpContractClient.createPayableMemo(
|
|
2073
3202
|
jobId,
|
|
2074
3203
|
JSON.stringify(reason),
|
|
2075
|
-
|
|
3204
|
+
transferFareAmount.amount,
|
|
2076
3205
|
recipient,
|
|
2077
|
-
|
|
3206
|
+
feeFareAmount.amount,
|
|
2078
3207
|
feeType,
|
|
2079
3208
|
nextPhase,
|
|
2080
|
-
6 /* PAYABLE_REQUEST
|
|
3209
|
+
6 /* PAYABLE_REQUEST */,
|
|
3210
|
+
expiredAt
|
|
2081
3211
|
);
|
|
2082
3212
|
});
|
|
2083
3213
|
}
|
|
2084
|
-
responseFundsRequest(memoId, accept,
|
|
3214
|
+
responseFundsRequest(memoId, accept, amountBaseUnit, reason) {
|
|
2085
3215
|
return __async(this, null, function* () {
|
|
2086
3216
|
if (!accept) {
|
|
2087
3217
|
return yield this.acpContractClient.signMemo(memoId, accept, reason);
|
|
2088
3218
|
}
|
|
2089
|
-
if (
|
|
2090
|
-
yield this.acpContractClient.approveAllowance(
|
|
2091
|
-
parseEther(amount.toString())
|
|
2092
|
-
);
|
|
3219
|
+
if (amountBaseUnit > BigInt(0)) {
|
|
3220
|
+
yield this.acpContractClient.approveAllowance(amountBaseUnit);
|
|
2093
3221
|
}
|
|
2094
3222
|
return yield this.acpContractClient.signMemo(memoId, true, reason);
|
|
2095
3223
|
});
|
|
2096
3224
|
}
|
|
2097
|
-
transferFunds(jobId,
|
|
3225
|
+
transferFunds(jobId, transferFareAmount, recipient, feeFareAmount, feeType, reason, nextPhase, expiredAt) {
|
|
2098
3226
|
return __async(this, null, function* () {
|
|
2099
|
-
|
|
2100
|
-
|
|
3227
|
+
if (transferFareAmount.fare.contractAddress === ethFare.contractAddress) {
|
|
3228
|
+
yield this.acpContractClient.wrapEth(transferFareAmount.amount);
|
|
3229
|
+
transferFareAmount = new FareBigInt(transferFareAmount.amount, wethFare);
|
|
3230
|
+
}
|
|
3231
|
+
if (feeFareAmount.amount > 0 && feeFareAmount.fare.contractAddress !== this.acpContractClient.config.baseFare.contractAddress) {
|
|
3232
|
+
throw new acpError_default("Fee token address is not the same as the base fare");
|
|
3233
|
+
}
|
|
3234
|
+
const isFeeTokenDifferent = feeFareAmount.fare.contractAddress !== transferFareAmount.fare.contractAddress;
|
|
3235
|
+
if (isFeeTokenDifferent) {
|
|
2101
3236
|
yield this.acpContractClient.approveAllowance(
|
|
2102
|
-
|
|
3237
|
+
feeFareAmount.amount,
|
|
3238
|
+
feeFareAmount.fare.contractAddress
|
|
2103
3239
|
);
|
|
2104
3240
|
}
|
|
3241
|
+
const finalAmount = isFeeTokenDifferent ? transferFareAmount : transferFareAmount.add(feeFareAmount);
|
|
3242
|
+
yield this.acpContractClient.approveAllowance(
|
|
3243
|
+
finalAmount.amount,
|
|
3244
|
+
transferFareAmount.fare.contractAddress
|
|
3245
|
+
);
|
|
2105
3246
|
return yield this.acpContractClient.createPayableMemo(
|
|
2106
3247
|
jobId,
|
|
2107
3248
|
JSON.stringify(reason),
|
|
2108
|
-
|
|
3249
|
+
transferFareAmount.amount,
|
|
2109
3250
|
recipient,
|
|
2110
|
-
|
|
3251
|
+
feeFareAmount.amount,
|
|
2111
3252
|
feeType,
|
|
2112
3253
|
nextPhase,
|
|
2113
|
-
|
|
2114
|
-
expiredAt
|
|
3254
|
+
8 /* PAYABLE_TRANSFER_ESCROW */,
|
|
3255
|
+
expiredAt,
|
|
3256
|
+
transferFareAmount.fare.contractAddress
|
|
2115
3257
|
);
|
|
2116
3258
|
});
|
|
2117
3259
|
}
|
|
@@ -2153,7 +3295,7 @@ var AcpClient = class {
|
|
|
2153
3295
|
});
|
|
2154
3296
|
const data = yield response.json();
|
|
2155
3297
|
if (data.error) {
|
|
2156
|
-
throw new
|
|
3298
|
+
throw new acpError_default(data.error.message);
|
|
2157
3299
|
}
|
|
2158
3300
|
return data.data.map((job) => {
|
|
2159
3301
|
return new acpJob_default(
|
|
@@ -2163,6 +3305,7 @@ var AcpClient = class {
|
|
|
2163
3305
|
job.providerAddress,
|
|
2164
3306
|
job.evaluatorAddress,
|
|
2165
3307
|
job.price,
|
|
3308
|
+
job.priceTokenAddress,
|
|
2166
3309
|
job.memos.map((memo) => {
|
|
2167
3310
|
return new acpMemo_default(
|
|
2168
3311
|
this,
|
|
@@ -2170,7 +3313,10 @@ var AcpClient = class {
|
|
|
2170
3313
|
memo.memoType,
|
|
2171
3314
|
memo.content,
|
|
2172
3315
|
memo.nextPhase,
|
|
2173
|
-
memo.
|
|
3316
|
+
memo.status,
|
|
3317
|
+
memo.signedReason,
|
|
3318
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3319
|
+
memo.payableDetails
|
|
2174
3320
|
);
|
|
2175
3321
|
}),
|
|
2176
3322
|
job.phase,
|
|
@@ -2178,7 +3324,7 @@ var AcpClient = class {
|
|
|
2178
3324
|
);
|
|
2179
3325
|
});
|
|
2180
3326
|
} catch (error) {
|
|
2181
|
-
throw error;
|
|
3327
|
+
throw new acpError_default("Failed to get active jobs", error);
|
|
2182
3328
|
}
|
|
2183
3329
|
});
|
|
2184
3330
|
}
|
|
@@ -2193,7 +3339,7 @@ var AcpClient = class {
|
|
|
2193
3339
|
});
|
|
2194
3340
|
const data = yield response.json();
|
|
2195
3341
|
if (data.error) {
|
|
2196
|
-
throw new
|
|
3342
|
+
throw new acpError_default(data.error.message);
|
|
2197
3343
|
}
|
|
2198
3344
|
return data.data.map((job) => {
|
|
2199
3345
|
return new acpJob_default(
|
|
@@ -2203,6 +3349,7 @@ var AcpClient = class {
|
|
|
2203
3349
|
job.providerAddress,
|
|
2204
3350
|
job.evaluatorAddress,
|
|
2205
3351
|
job.price,
|
|
3352
|
+
job.priceTokenAddress,
|
|
2206
3353
|
job.memos.map((memo) => {
|
|
2207
3354
|
return new acpMemo_default(
|
|
2208
3355
|
this,
|
|
@@ -2210,7 +3357,10 @@ var AcpClient = class {
|
|
|
2210
3357
|
memo.memoType,
|
|
2211
3358
|
memo.content,
|
|
2212
3359
|
memo.nextPhase,
|
|
2213
|
-
memo.
|
|
3360
|
+
memo.status,
|
|
3361
|
+
memo.signedReason,
|
|
3362
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3363
|
+
memo.payableDetails
|
|
2214
3364
|
);
|
|
2215
3365
|
}),
|
|
2216
3366
|
job.phase,
|
|
@@ -2218,7 +3368,7 @@ var AcpClient = class {
|
|
|
2218
3368
|
);
|
|
2219
3369
|
});
|
|
2220
3370
|
} catch (error) {
|
|
2221
|
-
throw error;
|
|
3371
|
+
throw new acpError_default("Failed to get completed jobs", error);
|
|
2222
3372
|
}
|
|
2223
3373
|
});
|
|
2224
3374
|
}
|
|
@@ -2233,7 +3383,7 @@ var AcpClient = class {
|
|
|
2233
3383
|
});
|
|
2234
3384
|
const data = yield response.json();
|
|
2235
3385
|
if (data.error) {
|
|
2236
|
-
throw new
|
|
3386
|
+
throw new acpError_default(data.error.message);
|
|
2237
3387
|
}
|
|
2238
3388
|
return data.data.map((job) => {
|
|
2239
3389
|
return new acpJob_default(
|
|
@@ -2243,6 +3393,7 @@ var AcpClient = class {
|
|
|
2243
3393
|
job.providerAddress,
|
|
2244
3394
|
job.evaluatorAddress,
|
|
2245
3395
|
job.price,
|
|
3396
|
+
job.priceTokenAddress,
|
|
2246
3397
|
job.memos.map((memo) => {
|
|
2247
3398
|
return new acpMemo_default(
|
|
2248
3399
|
this,
|
|
@@ -2250,7 +3401,10 @@ var AcpClient = class {
|
|
|
2250
3401
|
memo.memoType,
|
|
2251
3402
|
memo.content,
|
|
2252
3403
|
memo.nextPhase,
|
|
2253
|
-
memo.
|
|
3404
|
+
memo.status,
|
|
3405
|
+
memo.signedReason,
|
|
3406
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3407
|
+
memo.payableDetails
|
|
2254
3408
|
);
|
|
2255
3409
|
}),
|
|
2256
3410
|
job.phase,
|
|
@@ -2258,7 +3412,7 @@ var AcpClient = class {
|
|
|
2258
3412
|
);
|
|
2259
3413
|
});
|
|
2260
3414
|
} catch (error) {
|
|
2261
|
-
throw error;
|
|
3415
|
+
throw new acpError_default("Failed to get cancelled jobs", error);
|
|
2262
3416
|
}
|
|
2263
3417
|
});
|
|
2264
3418
|
}
|
|
@@ -2273,7 +3427,7 @@ var AcpClient = class {
|
|
|
2273
3427
|
});
|
|
2274
3428
|
const data = yield response.json();
|
|
2275
3429
|
if (data.error) {
|
|
2276
|
-
throw new
|
|
3430
|
+
throw new acpError_default(data.error.message);
|
|
2277
3431
|
}
|
|
2278
3432
|
const job = data.data;
|
|
2279
3433
|
if (!job) {
|
|
@@ -2286,6 +3440,7 @@ var AcpClient = class {
|
|
|
2286
3440
|
job.providerAddress,
|
|
2287
3441
|
job.evaluatorAddress,
|
|
2288
3442
|
job.price,
|
|
3443
|
+
job.priceTokenAddress,
|
|
2289
3444
|
job.memos.map((memo) => {
|
|
2290
3445
|
return new acpMemo_default(
|
|
2291
3446
|
this,
|
|
@@ -2293,14 +3448,17 @@ var AcpClient = class {
|
|
|
2293
3448
|
memo.memoType,
|
|
2294
3449
|
memo.content,
|
|
2295
3450
|
memo.nextPhase,
|
|
2296
|
-
memo.
|
|
3451
|
+
memo.status,
|
|
3452
|
+
memo.signedReason,
|
|
3453
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3454
|
+
memo.payableDetails
|
|
2297
3455
|
);
|
|
2298
3456
|
}),
|
|
2299
3457
|
job.phase,
|
|
2300
3458
|
job.context
|
|
2301
3459
|
);
|
|
2302
3460
|
} catch (error) {
|
|
2303
|
-
throw error;
|
|
3461
|
+
throw new acpError_default("Failed to get job by id", error);
|
|
2304
3462
|
}
|
|
2305
3463
|
});
|
|
2306
3464
|
}
|
|
@@ -2315,7 +3473,7 @@ var AcpClient = class {
|
|
|
2315
3473
|
});
|
|
2316
3474
|
const data = yield response.json();
|
|
2317
3475
|
if (data.error) {
|
|
2318
|
-
throw new
|
|
3476
|
+
throw new acpError_default(data.error.message);
|
|
2319
3477
|
}
|
|
2320
3478
|
const memo = data.data;
|
|
2321
3479
|
if (!memo) {
|
|
@@ -2327,10 +3485,13 @@ var AcpClient = class {
|
|
|
2327
3485
|
memo.memoType,
|
|
2328
3486
|
memo.content,
|
|
2329
3487
|
memo.nextPhase,
|
|
2330
|
-
memo.
|
|
3488
|
+
memo.status,
|
|
3489
|
+
memo.signedReason,
|
|
3490
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3491
|
+
memo.payableDetails
|
|
2331
3492
|
);
|
|
2332
3493
|
} catch (error) {
|
|
2333
|
-
throw error;
|
|
3494
|
+
throw new acpError_default("Failed to get memo by id", error);
|
|
2334
3495
|
}
|
|
2335
3496
|
});
|
|
2336
3497
|
}
|
|
@@ -2355,14 +3516,23 @@ export {
|
|
|
2355
3516
|
acpAbi_default as ACP_ABI,
|
|
2356
3517
|
AcpAgentSort,
|
|
2357
3518
|
acpContractClient_default as AcpContractClient,
|
|
3519
|
+
AcpContractConfig,
|
|
3520
|
+
acpError_default as AcpError,
|
|
2358
3521
|
AcpGraduationStatus,
|
|
2359
3522
|
acpJob_default as AcpJob,
|
|
2360
3523
|
AcpJobPhases,
|
|
2361
3524
|
acpMemo_default as AcpMemo,
|
|
3525
|
+
AcpMemoStatus,
|
|
2362
3526
|
AcpOnlineStatus,
|
|
3527
|
+
Fare,
|
|
3528
|
+
FareAmount,
|
|
3529
|
+
FareBigInt,
|
|
2363
3530
|
MemoType,
|
|
2364
3531
|
PayloadType,
|
|
3532
|
+
PositionDirection,
|
|
2365
3533
|
baseAcpConfig,
|
|
2366
3534
|
baseSepoliaAcpConfig,
|
|
2367
|
-
index_default as default
|
|
3535
|
+
index_default as default,
|
|
3536
|
+
ethFare,
|
|
3537
|
+
wethFare
|
|
2368
3538
|
};
|