@virtuals-protocol/acp-node 0.2.0-beta.1 → 0.2.0-beta.11
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 +42 -21
- package/dist/index.d.mts +285 -214
- package/dist/index.d.ts +285 -214
- package/dist/index.js +1705 -509
- package/dist/index.mjs +1689 -509
- 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.11",
|
|
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" }
|
|
1975
|
+
],
|
|
1976
|
+
name: "Deposit",
|
|
1977
|
+
type: "event"
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
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" }
|
|
857
1985
|
],
|
|
858
|
-
name: "
|
|
859
|
-
|
|
860
|
-
stateMutability: "view",
|
|
861
|
-
type: "function"
|
|
1986
|
+
name: "Transfer",
|
|
1987
|
+
type: "event"
|
|
862
1988
|
},
|
|
863
1989
|
{
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
{ internalType: "uint256", name: "
|
|
868
|
-
{ internalType: "address", name: "client", type: "address" },
|
|
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" }
|
|
1990
|
+
anonymous: false,
|
|
1991
|
+
inputs: [
|
|
1992
|
+
{ indexed: true, internalType: "address", name: "src", type: "address" },
|
|
1993
|
+
{ indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
|
|
876
1994
|
],
|
|
877
|
-
|
|
878
|
-
type: "
|
|
1995
|
+
name: "Withdrawal",
|
|
1996
|
+
type: "event"
|
|
879
1997
|
},
|
|
1998
|
+
{ payable: true, stateMutability: "payable", type: "fallback" },
|
|
880
1999
|
{
|
|
881
|
-
|
|
882
|
-
|
|
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,25 @@ var AcpJobPhases = /* @__PURE__ */ ((AcpJobPhases2) => {
|
|
|
1103
2135
|
return AcpJobPhases2;
|
|
1104
2136
|
})(AcpJobPhases || {});
|
|
1105
2137
|
var AcpContractClient = class _AcpContractClient {
|
|
1106
|
-
constructor(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig
|
|
2138
|
+
constructor(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
|
|
1107
2139
|
this.walletPrivateKey = walletPrivateKey;
|
|
1108
2140
|
this.sessionEntityKeyId = sessionEntityKeyId;
|
|
1109
2141
|
this.agentWalletAddress = agentWalletAddress;
|
|
1110
2142
|
this.config = config;
|
|
1111
|
-
this.customRpcUrl = customRpcUrl;
|
|
1112
2143
|
this.MAX_RETRIES = 3;
|
|
2144
|
+
this.PRIORITY_FEE_MULTIPLIER = 2;
|
|
2145
|
+
this.MAX_FEE_PER_GAS = 2e7;
|
|
2146
|
+
this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
|
|
1113
2147
|
this.chain = config.chain;
|
|
1114
2148
|
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) {
|
|
2149
|
+
}
|
|
2150
|
+
static build(_0, _1, _2) {
|
|
2151
|
+
return __async(this, arguments, function* (walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
|
|
1124
2152
|
const acpContractClient = new _AcpContractClient(
|
|
1125
2153
|
walletPrivateKey,
|
|
1126
2154
|
sessionEntityKeyId,
|
|
1127
2155
|
agentWalletAddress,
|
|
1128
|
-
config
|
|
1129
|
-
customRpcUrl
|
|
2156
|
+
config
|
|
1130
2157
|
);
|
|
1131
2158
|
yield acpContractClient.init();
|
|
1132
2159
|
return acpContractClient;
|
|
@@ -1150,9 +2177,18 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1150
2177
|
});
|
|
1151
2178
|
});
|
|
1152
2179
|
}
|
|
2180
|
+
getRandomNonce(bits = 152) {
|
|
2181
|
+
const bytes = bits / 8;
|
|
2182
|
+
const array = new Uint8Array(bytes);
|
|
2183
|
+
crypto.getRandomValues(array);
|
|
2184
|
+
let hex = Array.from(array, (b) => b.toString(16).padStart(2, "0")).join(
|
|
2185
|
+
""
|
|
2186
|
+
);
|
|
2187
|
+
return BigInt("0x" + hex);
|
|
2188
|
+
}
|
|
1153
2189
|
get sessionKeyClient() {
|
|
1154
2190
|
if (!this._sessionKeyClient) {
|
|
1155
|
-
throw new
|
|
2191
|
+
throw new acpError_default("Session key client not initialized");
|
|
1156
2192
|
}
|
|
1157
2193
|
return this._sessionKeyClient;
|
|
1158
2194
|
}
|
|
@@ -1161,23 +2197,21 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1161
2197
|
}
|
|
1162
2198
|
calculateGasFees() {
|
|
1163
2199
|
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));
|
|
2200
|
+
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
2201
|
return finalMaxFeePerGas;
|
|
1171
2202
|
});
|
|
1172
2203
|
}
|
|
1173
2204
|
handleSendUserOperation(_0) {
|
|
1174
|
-
return __async(this, arguments, function* (data, contractAddress = this.contractAddress) {
|
|
2205
|
+
return __async(this, arguments, function* (data, contractAddress = this.contractAddress, value) {
|
|
1175
2206
|
const payload = {
|
|
1176
2207
|
uo: {
|
|
1177
2208
|
target: contractAddress,
|
|
1178
|
-
data
|
|
2209
|
+
data,
|
|
2210
|
+
value
|
|
1179
2211
|
},
|
|
1180
|
-
overrides: {
|
|
2212
|
+
overrides: {
|
|
2213
|
+
nonceKey: this.getRandomNonce()
|
|
2214
|
+
}
|
|
1181
2215
|
};
|
|
1182
2216
|
let retries = this.MAX_RETRIES;
|
|
1183
2217
|
let finalError;
|
|
@@ -1195,7 +2229,6 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1195
2229
|
});
|
|
1196
2230
|
return hash;
|
|
1197
2231
|
} catch (error) {
|
|
1198
|
-
console.debug("Failed to send user operation", error);
|
|
1199
2232
|
retries -= 1;
|
|
1200
2233
|
if (retries === 0) {
|
|
1201
2234
|
finalError = error;
|
|
@@ -1204,20 +2237,20 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1204
2237
|
yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
|
|
1205
2238
|
}
|
|
1206
2239
|
}
|
|
1207
|
-
throw new
|
|
2240
|
+
throw new acpError_default(`Failed to send user operation`, finalError);
|
|
1208
2241
|
});
|
|
1209
2242
|
}
|
|
1210
2243
|
getJobId(hash) {
|
|
1211
2244
|
return __async(this, null, function* () {
|
|
1212
2245
|
const result = yield this.sessionKeyClient.getUserOperationReceipt(hash);
|
|
1213
2246
|
if (!result) {
|
|
1214
|
-
throw new
|
|
2247
|
+
throw new acpError_default("Failed to get user operation receipt");
|
|
1215
2248
|
}
|
|
1216
2249
|
const contractLogs = result.logs.find(
|
|
1217
2250
|
(log) => log.address.toLowerCase() === this.contractAddress.toLowerCase()
|
|
1218
2251
|
);
|
|
1219
2252
|
if (!contractLogs) {
|
|
1220
|
-
throw new
|
|
2253
|
+
throw new acpError_default("Failed to get contract logs");
|
|
1221
2254
|
}
|
|
1222
2255
|
return fromHex(contractLogs.data, "number");
|
|
1223
2256
|
});
|
|
@@ -1238,100 +2271,47 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1238
2271
|
const jobId = yield this.getJobId(hash);
|
|
1239
2272
|
return { txHash: hash, jobId };
|
|
1240
2273
|
} catch (error) {
|
|
1241
|
-
|
|
1242
|
-
throw new Error("Failed to create job");
|
|
2274
|
+
throw new acpError_default("Failed to create job", error);
|
|
1243
2275
|
}
|
|
1244
2276
|
});
|
|
1245
2277
|
}
|
|
1246
|
-
approveAllowance(
|
|
1247
|
-
return __async(this,
|
|
2278
|
+
approveAllowance(_0) {
|
|
2279
|
+
return __async(this, arguments, function* (amountBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
|
|
1248
2280
|
try {
|
|
1249
2281
|
const data = encodeFunctionData({
|
|
1250
2282
|
abi: erc20Abi,
|
|
1251
2283
|
functionName: "approve",
|
|
1252
|
-
args: [this.contractAddress,
|
|
2284
|
+
args: [this.contractAddress, amountBaseUnit]
|
|
1253
2285
|
});
|
|
1254
|
-
return yield this.handleSendUserOperation(
|
|
1255
|
-
data,
|
|
1256
|
-
this.virtualsTokenAddress
|
|
1257
|
-
);
|
|
2286
|
+
return yield this.handleSendUserOperation(data, paymentTokenAddress);
|
|
1258
2287
|
} 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
|
-
}
|
|
2288
|
+
throw new acpError_default("Failed to approve allowance", error);
|
|
1291
2289
|
}
|
|
1292
|
-
throw new Error("Failed to create payable fee memo");
|
|
1293
2290
|
});
|
|
1294
2291
|
}
|
|
1295
2292
|
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
|
-
}
|
|
2293
|
+
return __async(this, arguments, function* (jobId, content, amountBaseUnit, recipient, feeAmountBaseUnit, feeType, nextPhase, type, expiredAt, token = this.config.baseFare.contractAddress) {
|
|
2294
|
+
try {
|
|
2295
|
+
const data = encodeFunctionData({
|
|
2296
|
+
abi: acpAbi_default,
|
|
2297
|
+
functionName: "createPayableMemo",
|
|
2298
|
+
args: [
|
|
2299
|
+
jobId,
|
|
2300
|
+
content,
|
|
2301
|
+
token,
|
|
2302
|
+
amountBaseUnit,
|
|
2303
|
+
recipient,
|
|
2304
|
+
feeAmountBaseUnit,
|
|
2305
|
+
feeType,
|
|
2306
|
+
type,
|
|
2307
|
+
nextPhase,
|
|
2308
|
+
Math.floor(expiredAt.getTime() / 1e3)
|
|
2309
|
+
]
|
|
2310
|
+
});
|
|
2311
|
+
return yield this.handleSendUserOperation(data);
|
|
2312
|
+
} catch (error) {
|
|
2313
|
+
throw new acpError_default("Failed to create payable memo", error);
|
|
1333
2314
|
}
|
|
1334
|
-
throw new Error("Failed to create payable memo");
|
|
1335
2315
|
});
|
|
1336
2316
|
}
|
|
1337
2317
|
createMemo(jobId, content, type, isSecured, nextPhase) {
|
|
@@ -1344,8 +2324,7 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1344
2324
|
});
|
|
1345
2325
|
return yield this.handleSendUserOperation(data);
|
|
1346
2326
|
} catch (error) {
|
|
1347
|
-
|
|
1348
|
-
throw new Error("Failed to create memo");
|
|
2327
|
+
throw new acpError_default("Failed to create memo", error);
|
|
1349
2328
|
}
|
|
1350
2329
|
});
|
|
1351
2330
|
}
|
|
@@ -1353,13 +2332,13 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1353
2332
|
return __async(this, null, function* () {
|
|
1354
2333
|
const result = yield this.sessionKeyClient.getUserOperationReceipt(hash);
|
|
1355
2334
|
if (!result) {
|
|
1356
|
-
throw new
|
|
2335
|
+
throw new acpError_default("Failed to get user operation receipt");
|
|
1357
2336
|
}
|
|
1358
2337
|
const contractLogs = result.logs.find(
|
|
1359
2338
|
(log) => log.address.toLowerCase() === this.contractAddress.toLowerCase()
|
|
1360
2339
|
);
|
|
1361
2340
|
if (!contractLogs) {
|
|
1362
|
-
throw new
|
|
2341
|
+
throw new acpError_default("Failed to get contract logs");
|
|
1363
2342
|
}
|
|
1364
2343
|
const decoded = decodeEventLog({
|
|
1365
2344
|
abi: acpAbi_default,
|
|
@@ -1367,7 +2346,7 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1367
2346
|
topics: contractLogs.topics
|
|
1368
2347
|
});
|
|
1369
2348
|
if (!decoded.args) {
|
|
1370
|
-
throw new
|
|
2349
|
+
throw new acpError_default("Failed to decode event logs");
|
|
1371
2350
|
}
|
|
1372
2351
|
return parseInt(decoded.args.memoId);
|
|
1373
2352
|
});
|
|
@@ -1382,23 +2361,52 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1382
2361
|
});
|
|
1383
2362
|
return yield this.handleSendUserOperation(data);
|
|
1384
2363
|
} catch (error) {
|
|
1385
|
-
|
|
1386
|
-
throw new Error("Failed to sign memo");
|
|
2364
|
+
throw new acpError_default("Failed to sign memo", error);
|
|
1387
2365
|
}
|
|
1388
2366
|
});
|
|
1389
2367
|
}
|
|
1390
|
-
setBudget(jobId,
|
|
2368
|
+
setBudget(jobId, budgetBaseUnit) {
|
|
1391
2369
|
return __async(this, null, function* () {
|
|
1392
2370
|
try {
|
|
1393
2371
|
const data = encodeFunctionData({
|
|
1394
2372
|
abi: acpAbi_default,
|
|
1395
2373
|
functionName: "setBudget",
|
|
1396
|
-
args: [jobId,
|
|
2374
|
+
args: [jobId, budgetBaseUnit]
|
|
2375
|
+
});
|
|
2376
|
+
return yield this.handleSendUserOperation(data);
|
|
2377
|
+
} catch (error) {
|
|
2378
|
+
throw new acpError_default("Failed to set budget", error);
|
|
2379
|
+
}
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
setBudgetWithPaymentToken(_0, _1) {
|
|
2383
|
+
return __async(this, arguments, function* (jobId, budgetBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
|
|
2384
|
+
try {
|
|
2385
|
+
const data = encodeFunctionData({
|
|
2386
|
+
abi: acpAbi_default,
|
|
2387
|
+
functionName: "setBudgetWithPaymentToken",
|
|
2388
|
+
args: [jobId, budgetBaseUnit, paymentTokenAddress]
|
|
1397
2389
|
});
|
|
1398
2390
|
return yield this.handleSendUserOperation(data);
|
|
1399
2391
|
} catch (error) {
|
|
1400
|
-
|
|
1401
|
-
|
|
2392
|
+
throw new acpError_default("Failed to set budget", error);
|
|
2393
|
+
}
|
|
2394
|
+
});
|
|
2395
|
+
}
|
|
2396
|
+
wrapEth(amountBaseUnit) {
|
|
2397
|
+
return __async(this, null, function* () {
|
|
2398
|
+
try {
|
|
2399
|
+
const data = encodeFunctionData({
|
|
2400
|
+
abi: wethAbi_default,
|
|
2401
|
+
functionName: "deposit"
|
|
2402
|
+
});
|
|
2403
|
+
return yield this.handleSendUserOperation(
|
|
2404
|
+
data,
|
|
2405
|
+
wethFare.contractAddress,
|
|
2406
|
+
amountBaseUnit
|
|
2407
|
+
);
|
|
2408
|
+
} catch (error) {
|
|
2409
|
+
throw new acpError_default("Failed to wrap eth", error);
|
|
1402
2410
|
}
|
|
1403
2411
|
});
|
|
1404
2412
|
}
|
|
@@ -1406,6 +2414,12 @@ var AcpContractClient = class _AcpContractClient {
|
|
|
1406
2414
|
var acpContractClient_default = AcpContractClient;
|
|
1407
2415
|
|
|
1408
2416
|
// src/interfaces.ts
|
|
2417
|
+
var AcpMemoStatus = /* @__PURE__ */ ((AcpMemoStatus2) => {
|
|
2418
|
+
AcpMemoStatus2["PENDING"] = "PENDING";
|
|
2419
|
+
AcpMemoStatus2["APPROVED"] = "APPROVED";
|
|
2420
|
+
AcpMemoStatus2["REJECTED"] = "REJECTED";
|
|
2421
|
+
return AcpMemoStatus2;
|
|
2422
|
+
})(AcpMemoStatus || {});
|
|
1409
2423
|
var AcpAgentSort = /* @__PURE__ */ ((AcpAgentSort2) => {
|
|
1410
2424
|
AcpAgentSort2["SUCCESSFUL_JOB_COUNT"] = "successfulJobCount";
|
|
1411
2425
|
AcpAgentSort2["SUCCESS_RATE"] = "successRate";
|
|
@@ -1428,6 +2442,8 @@ var AcpOnlineStatus = /* @__PURE__ */ ((AcpOnlineStatus2) => {
|
|
|
1428
2442
|
var PayloadType = /* @__PURE__ */ ((PayloadType2) => {
|
|
1429
2443
|
PayloadType2["FUND_RESPONSE"] = "fund_response";
|
|
1430
2444
|
PayloadType2["OPEN_POSITION"] = "open_position";
|
|
2445
|
+
PayloadType2["SWAP_TOKEN"] = "swap_token";
|
|
2446
|
+
PayloadType2["RESPONSE_SWAP_TOKEN"] = "response_swap_token";
|
|
1431
2447
|
PayloadType2["CLOSE_PARTIAL_POSITION"] = "close_partial_position";
|
|
1432
2448
|
PayloadType2["CLOSE_POSITION"] = "close_position";
|
|
1433
2449
|
PayloadType2["POSITION_FULFILLED"] = "position_fulfilled";
|
|
@@ -1435,6 +2451,11 @@ var PayloadType = /* @__PURE__ */ ((PayloadType2) => {
|
|
|
1435
2451
|
PayloadType2["UNFULFILLED_POSITION"] = "unfulfilled_position";
|
|
1436
2452
|
return PayloadType2;
|
|
1437
2453
|
})(PayloadType || {});
|
|
2454
|
+
var PositionDirection = /* @__PURE__ */ ((PositionDirection2) => {
|
|
2455
|
+
PositionDirection2["LONG"] = "long";
|
|
2456
|
+
PositionDirection2["SHORT"] = "short";
|
|
2457
|
+
return PositionDirection2;
|
|
2458
|
+
})(PositionDirection || {});
|
|
1438
2459
|
|
|
1439
2460
|
// src/utils.ts
|
|
1440
2461
|
function tryParseJson(content) {
|
|
@@ -1447,20 +2468,46 @@ function tryParseJson(content) {
|
|
|
1447
2468
|
|
|
1448
2469
|
// src/acpJob.ts
|
|
1449
2470
|
var AcpJob = class {
|
|
1450
|
-
constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, memos, phase, context) {
|
|
2471
|
+
constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, priceTokenAddress, memos, phase, context) {
|
|
1451
2472
|
this.acpClient = acpClient;
|
|
1452
2473
|
this.id = id;
|
|
1453
2474
|
this.clientAddress = clientAddress;
|
|
1454
2475
|
this.providerAddress = providerAddress;
|
|
1455
2476
|
this.evaluatorAddress = evaluatorAddress;
|
|
1456
2477
|
this.price = price;
|
|
2478
|
+
this.priceTokenAddress = priceTokenAddress;
|
|
1457
2479
|
this.memos = memos;
|
|
1458
2480
|
this.phase = phase;
|
|
1459
2481
|
this.context = context;
|
|
2482
|
+
this.baseFare = acpClient.acpContractClient.config.baseFare;
|
|
1460
2483
|
}
|
|
1461
2484
|
get serviceRequirement() {
|
|
1462
2485
|
var _a;
|
|
1463
|
-
|
|
2486
|
+
const content = (_a = this.memos.find(
|
|
2487
|
+
(m) => m.nextPhase === 1 /* NEGOTIATION */
|
|
2488
|
+
)) == null ? void 0 : _a.content;
|
|
2489
|
+
if (!content) {
|
|
2490
|
+
return void 0;
|
|
2491
|
+
}
|
|
2492
|
+
const contentObj = tryParseJson(content);
|
|
2493
|
+
if (!contentObj) {
|
|
2494
|
+
return content;
|
|
2495
|
+
}
|
|
2496
|
+
if (contentObj.serviceRequirement) {
|
|
2497
|
+
return contentObj.serviceRequirement;
|
|
2498
|
+
}
|
|
2499
|
+
return contentObj;
|
|
2500
|
+
}
|
|
2501
|
+
get serviceName() {
|
|
2502
|
+
var _a;
|
|
2503
|
+
const content = (_a = this.memos.find(
|
|
2504
|
+
(m) => m.nextPhase === 1 /* NEGOTIATION */
|
|
2505
|
+
)) == null ? void 0 : _a.content;
|
|
2506
|
+
if (!content) {
|
|
2507
|
+
return void 0;
|
|
2508
|
+
}
|
|
2509
|
+
const contentObj = tryParseJson(content);
|
|
2510
|
+
return contentObj == null ? void 0 : contentObj.serviceName;
|
|
1464
2511
|
}
|
|
1465
2512
|
get deliverable() {
|
|
1466
2513
|
var _a;
|
|
@@ -1484,16 +2531,21 @@ var AcpJob = class {
|
|
|
1484
2531
|
(m) => m.nextPhase === 2 /* TRANSACTION */
|
|
1485
2532
|
);
|
|
1486
2533
|
if (!memo) {
|
|
1487
|
-
throw new
|
|
2534
|
+
throw new acpError_default("No transaction memo found");
|
|
1488
2535
|
}
|
|
1489
|
-
return yield this.acpClient.payJob(
|
|
2536
|
+
return yield this.acpClient.payJob(
|
|
2537
|
+
this.id,
|
|
2538
|
+
this.baseFare.formatAmount(amount),
|
|
2539
|
+
memo.id,
|
|
2540
|
+
reason
|
|
2541
|
+
);
|
|
1490
2542
|
});
|
|
1491
2543
|
}
|
|
1492
2544
|
respond(accept, payload, reason) {
|
|
1493
2545
|
return __async(this, null, function* () {
|
|
1494
2546
|
var _a;
|
|
1495
2547
|
if (((_a = this.latestMemo) == null ? void 0 : _a.nextPhase) !== 1 /* NEGOTIATION */) {
|
|
1496
|
-
throw new
|
|
2548
|
+
throw new acpError_default("No negotiation memo found");
|
|
1497
2549
|
}
|
|
1498
2550
|
return yield this.acpClient.respondJob(
|
|
1499
2551
|
this.id,
|
|
@@ -1508,7 +2560,7 @@ var AcpJob = class {
|
|
|
1508
2560
|
return __async(this, null, function* () {
|
|
1509
2561
|
var _a;
|
|
1510
2562
|
if (((_a = this.latestMemo) == null ? void 0 : _a.nextPhase) !== 3 /* EVALUATION */) {
|
|
1511
|
-
throw new
|
|
2563
|
+
throw new acpError_default("No transaction memo found");
|
|
1512
2564
|
}
|
|
1513
2565
|
return yield this.acpClient.deliverJob(this.id, deliverable);
|
|
1514
2566
|
});
|
|
@@ -1517,7 +2569,7 @@ var AcpJob = class {
|
|
|
1517
2569
|
return __async(this, null, function* () {
|
|
1518
2570
|
var _a;
|
|
1519
2571
|
if (((_a = this.latestMemo) == null ? void 0 : _a.nextPhase) !== 4 /* COMPLETED */) {
|
|
1520
|
-
throw new
|
|
2572
|
+
throw new acpError_default("No evaluation memo found");
|
|
1521
2573
|
}
|
|
1522
2574
|
return yield this.acpClient.acpContractClient.signMemo(
|
|
1523
2575
|
this.latestMemo.id,
|
|
@@ -1526,16 +2578,17 @@ var AcpJob = class {
|
|
|
1526
2578
|
);
|
|
1527
2579
|
});
|
|
1528
2580
|
}
|
|
1529
|
-
openPosition(
|
|
1530
|
-
return __async(this,
|
|
2581
|
+
openPosition(_0, _1) {
|
|
2582
|
+
return __async(this, arguments, function* (payload, feeAmount, expiredAt = new Date(Date.now() + 1e3 * 60 * 3), walletAddress) {
|
|
1531
2583
|
if (payload.length === 0) {
|
|
1532
|
-
throw new
|
|
2584
|
+
throw new acpError_default("No positions to open");
|
|
1533
2585
|
}
|
|
2586
|
+
const sumAmount = payload.reduce((acc, curr) => acc + curr.amount, 0);
|
|
1534
2587
|
return yield this.acpClient.transferFunds(
|
|
1535
2588
|
this.id,
|
|
1536
|
-
|
|
2589
|
+
new FareAmount(sumAmount, this.baseFare),
|
|
1537
2590
|
walletAddress || this.providerAddress,
|
|
1538
|
-
feeAmount,
|
|
2591
|
+
new FareAmount(feeAmount, this.baseFare),
|
|
1539
2592
|
1 /* IMMEDIATE_FEE */,
|
|
1540
2593
|
{
|
|
1541
2594
|
type: "open_position" /* OPEN_POSITION */,
|
|
@@ -1546,34 +2599,84 @@ var AcpJob = class {
|
|
|
1546
2599
|
);
|
|
1547
2600
|
});
|
|
1548
2601
|
}
|
|
2602
|
+
swapToken(payload, decimals, feeAmount, walletAddress) {
|
|
2603
|
+
return __async(this, null, function* () {
|
|
2604
|
+
return yield this.acpClient.transferFunds(
|
|
2605
|
+
this.id,
|
|
2606
|
+
new FareAmount(
|
|
2607
|
+
payload.amount,
|
|
2608
|
+
new Fare(payload.fromContractAddress, decimals)
|
|
2609
|
+
),
|
|
2610
|
+
walletAddress || this.providerAddress,
|
|
2611
|
+
new FareAmount(feeAmount, this.baseFare),
|
|
2612
|
+
1 /* IMMEDIATE_FEE */,
|
|
2613
|
+
{
|
|
2614
|
+
type: "swap_token" /* SWAP_TOKEN */,
|
|
2615
|
+
data: payload
|
|
2616
|
+
},
|
|
2617
|
+
2 /* TRANSACTION */,
|
|
2618
|
+
new Date(Date.now() + 1e3 * 60 * 30)
|
|
2619
|
+
);
|
|
2620
|
+
});
|
|
2621
|
+
}
|
|
2622
|
+
responseSwapToken(memoId, accept, reason) {
|
|
2623
|
+
return __async(this, null, function* () {
|
|
2624
|
+
const memo = this.memos.find((m) => m.id === memoId);
|
|
2625
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2626
|
+
throw new acpError_default("No swap token memo found");
|
|
2627
|
+
}
|
|
2628
|
+
const payload = tryParseJson(
|
|
2629
|
+
memo.content
|
|
2630
|
+
);
|
|
2631
|
+
if ((payload == null ? void 0 : payload.type) !== "swap_token" /* SWAP_TOKEN */) {
|
|
2632
|
+
throw new acpError_default("Invalid swap token memo");
|
|
2633
|
+
}
|
|
2634
|
+
return yield memo.sign(accept, reason);
|
|
2635
|
+
});
|
|
2636
|
+
}
|
|
2637
|
+
transferFunds(_0, _1, _2) {
|
|
2638
|
+
return __async(this, arguments, function* (payload, fareAmount, walletAddress, expiredAt = new Date(Date.now() + 1e3 * 60 * 30)) {
|
|
2639
|
+
return yield this.acpClient.transferFunds(
|
|
2640
|
+
this.id,
|
|
2641
|
+
fareAmount,
|
|
2642
|
+
walletAddress || this.clientAddress,
|
|
2643
|
+
new FareAmount(0, this.baseFare),
|
|
2644
|
+
0 /* NO_FEE */,
|
|
2645
|
+
payload,
|
|
2646
|
+
2 /* TRANSACTION */,
|
|
2647
|
+
expiredAt
|
|
2648
|
+
);
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
1549
2651
|
responseOpenPosition(memoId, accept, reason) {
|
|
1550
2652
|
return __async(this, null, function* () {
|
|
1551
2653
|
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
|
|
2654
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2655
|
+
throw new acpError_default("No open position memo found");
|
|
1554
2656
|
}
|
|
1555
2657
|
const payload = tryParseJson(
|
|
1556
2658
|
memo.content
|
|
1557
2659
|
);
|
|
1558
2660
|
if ((payload == null ? void 0 : payload.type) !== "open_position" /* OPEN_POSITION */) {
|
|
1559
|
-
throw new
|
|
2661
|
+
throw new acpError_default("Invalid open position memo");
|
|
1560
2662
|
}
|
|
1561
2663
|
return yield this.acpClient.responseFundsTransfer(memo.id, accept, reason);
|
|
1562
2664
|
});
|
|
1563
2665
|
}
|
|
1564
|
-
closePartialPosition(
|
|
1565
|
-
return __async(this,
|
|
2666
|
+
closePartialPosition(_0) {
|
|
2667
|
+
return __async(this, arguments, function* (payload, expireAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
1566
2668
|
return yield this.acpClient.requestFunds(
|
|
1567
2669
|
this.id,
|
|
1568
|
-
payload.amount,
|
|
2670
|
+
new FareAmount(payload.amount, this.baseFare),
|
|
1569
2671
|
this.clientAddress,
|
|
1570
|
-
0,
|
|
2672
|
+
new FareAmount(0, this.baseFare),
|
|
1571
2673
|
0 /* NO_FEE */,
|
|
1572
2674
|
{
|
|
1573
2675
|
type: "close_partial_position" /* CLOSE_PARTIAL_POSITION */,
|
|
1574
2676
|
data: payload
|
|
1575
2677
|
},
|
|
1576
|
-
2 /* TRANSACTION
|
|
2678
|
+
2 /* TRANSACTION */,
|
|
2679
|
+
expireAt
|
|
1577
2680
|
);
|
|
1578
2681
|
});
|
|
1579
2682
|
}
|
|
@@ -1581,18 +2684,18 @@ var AcpJob = class {
|
|
|
1581
2684
|
return __async(this, null, function* () {
|
|
1582
2685
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1583
2686
|
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 6 /* PAYABLE_REQUEST */) {
|
|
1584
|
-
throw new
|
|
2687
|
+
throw new acpError_default("No close position memo found");
|
|
1585
2688
|
}
|
|
1586
2689
|
const payload = tryParseJson(
|
|
1587
2690
|
memo.content
|
|
1588
2691
|
);
|
|
1589
2692
|
if ((payload == null ? void 0 : payload.type) !== "close_partial_position" /* CLOSE_PARTIAL_POSITION */) {
|
|
1590
|
-
throw new
|
|
2693
|
+
throw new acpError_default("Invalid close position memo");
|
|
1591
2694
|
}
|
|
1592
2695
|
return yield this.acpClient.responseFundsRequest(
|
|
1593
2696
|
memo.id,
|
|
1594
2697
|
accept,
|
|
1595
|
-
payload.data.amount,
|
|
2698
|
+
this.baseFare.formatAmount(payload.data.amount),
|
|
1596
2699
|
reason
|
|
1597
2700
|
);
|
|
1598
2701
|
});
|
|
@@ -1609,29 +2712,30 @@ var AcpJob = class {
|
|
|
1609
2712
|
);
|
|
1610
2713
|
});
|
|
1611
2714
|
}
|
|
1612
|
-
responseRequestClosePosition(
|
|
1613
|
-
return __async(this,
|
|
2715
|
+
responseRequestClosePosition(_0, _1, _2, _3) {
|
|
2716
|
+
return __async(this, arguments, function* (memoId, accept, payload, reason, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
1614
2717
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1615
2718
|
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 0 /* MESSAGE */) {
|
|
1616
|
-
throw new
|
|
2719
|
+
throw new acpError_default("No message memo found");
|
|
1617
2720
|
}
|
|
1618
2721
|
const messagePayload = tryParseJson(memo.content);
|
|
1619
2722
|
if ((messagePayload == null ? void 0 : messagePayload.type) !== "close_position" /* CLOSE_POSITION */) {
|
|
1620
|
-
throw new
|
|
2723
|
+
throw new acpError_default("Invalid close position memo");
|
|
1621
2724
|
}
|
|
1622
2725
|
yield memo.sign(accept, reason);
|
|
1623
2726
|
if (accept) {
|
|
1624
2727
|
return yield this.acpClient.transferFunds(
|
|
1625
2728
|
this.id,
|
|
1626
|
-
payload.amount,
|
|
2729
|
+
new FareAmount(payload.amount, this.baseFare),
|
|
1627
2730
|
this.clientAddress,
|
|
1628
|
-
0,
|
|
2731
|
+
new FareAmount(0, this.baseFare),
|
|
1629
2732
|
0 /* NO_FEE */,
|
|
1630
2733
|
{
|
|
1631
2734
|
type: "close_position" /* CLOSE_POSITION */,
|
|
1632
2735
|
data: payload
|
|
1633
2736
|
},
|
|
1634
|
-
2 /* TRANSACTION
|
|
2737
|
+
2 /* TRANSACTION */,
|
|
2738
|
+
expiredAt
|
|
1635
2739
|
);
|
|
1636
2740
|
}
|
|
1637
2741
|
});
|
|
@@ -1639,61 +2743,63 @@ var AcpJob = class {
|
|
|
1639
2743
|
confirmClosePosition(memoId, accept, reason) {
|
|
1640
2744
|
return __async(this, null, function* () {
|
|
1641
2745
|
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
|
|
2746
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2747
|
+
throw new acpError_default("No payable transfer memo found");
|
|
1644
2748
|
}
|
|
1645
2749
|
const payload = tryParseJson(
|
|
1646
2750
|
memo.content
|
|
1647
2751
|
);
|
|
1648
2752
|
if ((payload == null ? void 0 : payload.type) !== "close_position" /* CLOSE_POSITION */) {
|
|
1649
|
-
throw new
|
|
2753
|
+
throw new acpError_default("Invalid close position memo");
|
|
1650
2754
|
}
|
|
1651
2755
|
yield memo.sign(accept, reason);
|
|
1652
2756
|
});
|
|
1653
2757
|
}
|
|
1654
|
-
positionFulfilled(
|
|
1655
|
-
return __async(this,
|
|
2758
|
+
positionFulfilled(_0) {
|
|
2759
|
+
return __async(this, arguments, function* (payload, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
1656
2760
|
return yield this.acpClient.transferFunds(
|
|
1657
2761
|
this.id,
|
|
1658
|
-
payload.amount,
|
|
2762
|
+
new FareAmount(payload.amount, this.baseFare),
|
|
1659
2763
|
this.clientAddress,
|
|
1660
|
-
0,
|
|
2764
|
+
new FareAmount(0, this.baseFare),
|
|
1661
2765
|
0 /* NO_FEE */,
|
|
1662
2766
|
{
|
|
1663
2767
|
type: "position_fulfilled" /* POSITION_FULFILLED */,
|
|
1664
2768
|
data: payload
|
|
1665
2769
|
},
|
|
1666
|
-
2 /* TRANSACTION
|
|
2770
|
+
2 /* TRANSACTION */,
|
|
2771
|
+
expiredAt
|
|
1667
2772
|
);
|
|
1668
2773
|
});
|
|
1669
2774
|
}
|
|
1670
|
-
unfulfilledPosition(
|
|
1671
|
-
return __async(this,
|
|
2775
|
+
unfulfilledPosition(_0) {
|
|
2776
|
+
return __async(this, arguments, function* (payload, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
1672
2777
|
return yield this.acpClient.transferFunds(
|
|
1673
2778
|
this.id,
|
|
1674
|
-
payload.amount,
|
|
2779
|
+
new FareAmount(payload.amount, this.baseFare),
|
|
1675
2780
|
this.clientAddress,
|
|
1676
|
-
0,
|
|
2781
|
+
new FareAmount(0, this.baseFare),
|
|
1677
2782
|
0 /* NO_FEE */,
|
|
1678
2783
|
{
|
|
1679
2784
|
type: "unfulfilled_position" /* UNFULFILLED_POSITION */,
|
|
1680
2785
|
data: payload
|
|
1681
2786
|
},
|
|
1682
|
-
2 /* TRANSACTION
|
|
2787
|
+
2 /* TRANSACTION */,
|
|
2788
|
+
expiredAt
|
|
1683
2789
|
);
|
|
1684
2790
|
});
|
|
1685
2791
|
}
|
|
1686
2792
|
responseUnfulfilledPosition(memoId, accept, reason) {
|
|
1687
2793
|
return __async(this, null, function* () {
|
|
1688
2794
|
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
|
|
2795
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2796
|
+
throw new acpError_default("No unfulfilled position memo found");
|
|
1691
2797
|
}
|
|
1692
2798
|
const payload = tryParseJson(
|
|
1693
2799
|
memo.content
|
|
1694
2800
|
);
|
|
1695
2801
|
if ((payload == null ? void 0 : payload.type) !== "unfulfilled_position" /* UNFULFILLED_POSITION */) {
|
|
1696
|
-
throw new
|
|
2802
|
+
throw new acpError_default("Invalid unfulfilled position memo");
|
|
1697
2803
|
}
|
|
1698
2804
|
return yield this.acpClient.responseFundsTransfer(memo.id, accept, reason);
|
|
1699
2805
|
});
|
|
@@ -1701,14 +2807,14 @@ var AcpJob = class {
|
|
|
1701
2807
|
responsePositionFulfilled(memoId, accept, reason) {
|
|
1702
2808
|
return __async(this, null, function* () {
|
|
1703
2809
|
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
|
|
2810
|
+
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
|
|
2811
|
+
throw new acpError_default("No position fulfilled memo found");
|
|
1706
2812
|
}
|
|
1707
2813
|
const payload = tryParseJson(
|
|
1708
2814
|
memo.content
|
|
1709
2815
|
);
|
|
1710
2816
|
if ((payload == null ? void 0 : payload.type) !== "position_fulfilled" /* POSITION_FULFILLED */) {
|
|
1711
|
-
throw new
|
|
2817
|
+
throw new acpError_default("Invalid position fulfilled memo");
|
|
1712
2818
|
}
|
|
1713
2819
|
return yield this.acpClient.responseFundsTransfer(memo.id, accept, reason);
|
|
1714
2820
|
});
|
|
@@ -1727,17 +2833,17 @@ var AcpJob = class {
|
|
|
1727
2833
|
);
|
|
1728
2834
|
});
|
|
1729
2835
|
}
|
|
1730
|
-
responseCloseJob(
|
|
1731
|
-
return __async(this,
|
|
2836
|
+
responseCloseJob(_0, _1, _2, _3) {
|
|
2837
|
+
return __async(this, arguments, function* (memoId, accept, fulfilledPositions, reason, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
1732
2838
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1733
2839
|
if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 0 /* MESSAGE */) {
|
|
1734
|
-
throw new
|
|
2840
|
+
throw new acpError_default("No message memo found");
|
|
1735
2841
|
}
|
|
1736
2842
|
const payload = tryParseJson(
|
|
1737
2843
|
memo.content
|
|
1738
2844
|
);
|
|
1739
2845
|
if ((payload == null ? void 0 : payload.type) !== "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */) {
|
|
1740
|
-
throw new
|
|
2846
|
+
throw new acpError_default("Invalid close job and withdraw memo");
|
|
1741
2847
|
}
|
|
1742
2848
|
yield memo.sign(accept, reason);
|
|
1743
2849
|
if (!accept) {
|
|
@@ -1759,15 +2865,16 @@ var AcpJob = class {
|
|
|
1759
2865
|
}
|
|
1760
2866
|
return yield this.acpClient.transferFunds(
|
|
1761
2867
|
this.id,
|
|
1762
|
-
|
|
2868
|
+
new FareAmount(totalAmount, this.baseFare),
|
|
1763
2869
|
this.clientAddress,
|
|
1764
|
-
0,
|
|
2870
|
+
new FareAmount(0, this.baseFare),
|
|
1765
2871
|
0 /* NO_FEE */,
|
|
1766
2872
|
{
|
|
1767
2873
|
type: "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */,
|
|
1768
2874
|
data: fulfilledPositions
|
|
1769
2875
|
},
|
|
1770
|
-
4 /* COMPLETED
|
|
2876
|
+
4 /* COMPLETED */,
|
|
2877
|
+
expiredAt
|
|
1771
2878
|
);
|
|
1772
2879
|
});
|
|
1773
2880
|
}
|
|
@@ -1775,13 +2882,13 @@ var AcpJob = class {
|
|
|
1775
2882
|
return __async(this, null, function* () {
|
|
1776
2883
|
const memo = this.memos.find((m) => m.id === memoId);
|
|
1777
2884
|
if (!memo) {
|
|
1778
|
-
throw new
|
|
2885
|
+
throw new acpError_default("Memo not found");
|
|
1779
2886
|
}
|
|
1780
2887
|
const payload = tryParseJson(
|
|
1781
2888
|
memo.content
|
|
1782
2889
|
);
|
|
1783
2890
|
if ((payload == null ? void 0 : payload.type) !== "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */) {
|
|
1784
|
-
throw new
|
|
2891
|
+
throw new acpError_default("Invalid close job and withdraw memo");
|
|
1785
2892
|
}
|
|
1786
2893
|
yield memo.sign(accept, reason);
|
|
1787
2894
|
});
|
|
@@ -1791,13 +2898,20 @@ var acpJob_default = AcpJob;
|
|
|
1791
2898
|
|
|
1792
2899
|
// src/acpMemo.ts
|
|
1793
2900
|
var AcpMemo = class {
|
|
1794
|
-
constructor(acpClient, id, type, content, nextPhase, expiry) {
|
|
2901
|
+
constructor(acpClient, id, type, content, nextPhase, status, signedReason, expiry, payableDetails) {
|
|
1795
2902
|
this.acpClient = acpClient;
|
|
1796
2903
|
this.id = id;
|
|
1797
2904
|
this.type = type;
|
|
1798
2905
|
this.content = content;
|
|
1799
2906
|
this.nextPhase = nextPhase;
|
|
2907
|
+
this.status = status;
|
|
2908
|
+
this.signedReason = signedReason;
|
|
1800
2909
|
this.expiry = expiry;
|
|
2910
|
+
this.payableDetails = payableDetails;
|
|
2911
|
+
if (this.payableDetails) {
|
|
2912
|
+
this.payableDetails.amount = BigInt(this.payableDetails.amount);
|
|
2913
|
+
this.payableDetails.feeAmount = BigInt(this.payableDetails.feeAmount);
|
|
2914
|
+
}
|
|
1801
2915
|
this.structuredContent = tryParseJson(this.content) || void 0;
|
|
1802
2916
|
}
|
|
1803
2917
|
get payloadType() {
|
|
@@ -1833,10 +2947,10 @@ var acpMemo_default = AcpMemo;
|
|
|
1833
2947
|
// src/acpJobOffering.ts
|
|
1834
2948
|
import Ajv from "ajv";
|
|
1835
2949
|
var AcpJobOffering = class {
|
|
1836
|
-
constructor(acpClient, providerAddress,
|
|
2950
|
+
constructor(acpClient, providerAddress, name, price, requirementSchema) {
|
|
1837
2951
|
this.acpClient = acpClient;
|
|
1838
2952
|
this.providerAddress = providerAddress;
|
|
1839
|
-
this.
|
|
2953
|
+
this.name = name;
|
|
1840
2954
|
this.price = price;
|
|
1841
2955
|
this.requirementSchema = requirementSchema;
|
|
1842
2956
|
this.ajv = new Ajv({ allErrors: true });
|
|
@@ -1847,13 +2961,28 @@ var AcpJobOffering = class {
|
|
|
1847
2961
|
const validator = this.ajv.compile(this.requirementSchema);
|
|
1848
2962
|
const valid = validator(serviceRequirement);
|
|
1849
2963
|
if (!valid) {
|
|
1850
|
-
throw new
|
|
2964
|
+
throw new acpError_default(this.ajv.errorsText(validator.errors));
|
|
1851
2965
|
}
|
|
1852
2966
|
}
|
|
2967
|
+
let finalServiceRequirement = {
|
|
2968
|
+
serviceName: this.name
|
|
2969
|
+
};
|
|
2970
|
+
if (typeof serviceRequirement === "string") {
|
|
2971
|
+
finalServiceRequirement = __spreadProps(__spreadValues({}, finalServiceRequirement), {
|
|
2972
|
+
message: serviceRequirement
|
|
2973
|
+
});
|
|
2974
|
+
} else {
|
|
2975
|
+
finalServiceRequirement = __spreadProps(__spreadValues({}, finalServiceRequirement), {
|
|
2976
|
+
serviceRequirement
|
|
2977
|
+
});
|
|
2978
|
+
}
|
|
1853
2979
|
return yield this.acpClient.initiateJob(
|
|
1854
2980
|
this.providerAddress,
|
|
1855
|
-
|
|
1856
|
-
|
|
2981
|
+
finalServiceRequirement,
|
|
2982
|
+
new FareAmount(
|
|
2983
|
+
this.price,
|
|
2984
|
+
this.acpClient.acpContractClient.config.baseFare
|
|
2985
|
+
),
|
|
1857
2986
|
evaluatorAddress,
|
|
1858
2987
|
expiredAt
|
|
1859
2988
|
);
|
|
@@ -1907,6 +3036,7 @@ var AcpClient = class {
|
|
|
1907
3036
|
data.providerAddress,
|
|
1908
3037
|
data.evaluatorAddress,
|
|
1909
3038
|
data.price,
|
|
3039
|
+
data.priceTokenAddress,
|
|
1910
3040
|
data.memos.map((memo) => {
|
|
1911
3041
|
return new acpMemo_default(
|
|
1912
3042
|
this,
|
|
@@ -1914,7 +3044,10 @@ var AcpClient = class {
|
|
|
1914
3044
|
memo.memoType,
|
|
1915
3045
|
memo.content,
|
|
1916
3046
|
memo.nextPhase,
|
|
1917
|
-
memo.
|
|
3047
|
+
memo.status,
|
|
3048
|
+
memo.signedReason,
|
|
3049
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3050
|
+
memo.payableDetails
|
|
1918
3051
|
);
|
|
1919
3052
|
}),
|
|
1920
3053
|
data.phase,
|
|
@@ -1936,6 +3069,7 @@ var AcpClient = class {
|
|
|
1936
3069
|
data.providerAddress,
|
|
1937
3070
|
data.evaluatorAddress,
|
|
1938
3071
|
data.price,
|
|
3072
|
+
data.priceTokenAddress,
|
|
1939
3073
|
data.memos.map((memo) => {
|
|
1940
3074
|
return new acpMemo_default(
|
|
1941
3075
|
this,
|
|
@@ -1943,7 +3077,10 @@ var AcpClient = class {
|
|
|
1943
3077
|
memo.memoType,
|
|
1944
3078
|
memo.content,
|
|
1945
3079
|
memo.nextPhase,
|
|
1946
|
-
memo.
|
|
3080
|
+
memo.status,
|
|
3081
|
+
memo.signedReason,
|
|
3082
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3083
|
+
memo.payableDetails
|
|
1947
3084
|
);
|
|
1948
3085
|
}),
|
|
1949
3086
|
data.phase,
|
|
@@ -2001,7 +3138,7 @@ var AcpClient = class {
|
|
|
2001
3138
|
this,
|
|
2002
3139
|
agent.walletAddress,
|
|
2003
3140
|
offering.name,
|
|
2004
|
-
offering.
|
|
3141
|
+
offering.priceUsd,
|
|
2005
3142
|
offering.requirementSchema
|
|
2006
3143
|
);
|
|
2007
3144
|
}),
|
|
@@ -2013,18 +3150,22 @@ var AcpClient = class {
|
|
|
2013
3150
|
});
|
|
2014
3151
|
}
|
|
2015
3152
|
initiateJob(_0, _1, _2, _3) {
|
|
2016
|
-
return __async(this, arguments, function* (providerAddress, serviceRequirement,
|
|
3153
|
+
return __async(this, arguments, function* (providerAddress, serviceRequirement, fareAmount, evaluatorAddress, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
|
|
3154
|
+
if (providerAddress === this.acpContractClient.walletAddress) {
|
|
3155
|
+
throw new acpError_default(
|
|
3156
|
+
"Provider address cannot be the same as the client address"
|
|
3157
|
+
);
|
|
3158
|
+
}
|
|
2017
3159
|
const { jobId } = yield this.acpContractClient.createJob(
|
|
2018
3160
|
providerAddress,
|
|
2019
3161
|
evaluatorAddress || this.acpContractClient.walletAddress,
|
|
2020
3162
|
expiredAt
|
|
2021
3163
|
);
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
}
|
|
3164
|
+
yield this.acpContractClient.setBudgetWithPaymentToken(
|
|
3165
|
+
jobId,
|
|
3166
|
+
fareAmount.amount,
|
|
3167
|
+
fareAmount.fare.contractAddress
|
|
3168
|
+
);
|
|
2028
3169
|
yield this.acpContractClient.createMemo(
|
|
2029
3170
|
jobId,
|
|
2030
3171
|
typeof serviceRequirement === "string" ? serviceRequirement : JSON.stringify(serviceRequirement),
|
|
@@ -2050,68 +3191,79 @@ var AcpClient = class {
|
|
|
2050
3191
|
);
|
|
2051
3192
|
});
|
|
2052
3193
|
}
|
|
2053
|
-
payJob(jobId,
|
|
3194
|
+
payJob(jobId, amountBaseUnit, memoId, reason) {
|
|
2054
3195
|
return __async(this, null, function* () {
|
|
2055
|
-
if (
|
|
2056
|
-
yield this.acpContractClient.approveAllowance(
|
|
2057
|
-
parseEther(amount.toString())
|
|
2058
|
-
);
|
|
3196
|
+
if (amountBaseUnit > BigInt(0)) {
|
|
3197
|
+
yield this.acpContractClient.approveAllowance(amountBaseUnit);
|
|
2059
3198
|
}
|
|
2060
3199
|
yield this.acpContractClient.signMemo(memoId, true, reason);
|
|
2061
3200
|
return yield this.acpContractClient.createMemo(
|
|
2062
3201
|
jobId,
|
|
2063
|
-
`Payment
|
|
3202
|
+
`Payment made. ${reason != null ? reason : ""}`,
|
|
2064
3203
|
0 /* MESSAGE */,
|
|
2065
3204
|
false,
|
|
2066
3205
|
3 /* EVALUATION */
|
|
2067
3206
|
);
|
|
2068
3207
|
});
|
|
2069
3208
|
}
|
|
2070
|
-
requestFunds(jobId,
|
|
3209
|
+
requestFunds(jobId, transferFareAmount, recipient, feeFareAmount, feeType, reason, nextPhase, expiredAt) {
|
|
2071
3210
|
return __async(this, null, function* () {
|
|
2072
3211
|
return yield this.acpContractClient.createPayableMemo(
|
|
2073
3212
|
jobId,
|
|
2074
3213
|
JSON.stringify(reason),
|
|
2075
|
-
|
|
3214
|
+
transferFareAmount.amount,
|
|
2076
3215
|
recipient,
|
|
2077
|
-
|
|
3216
|
+
feeFareAmount.amount,
|
|
2078
3217
|
feeType,
|
|
2079
3218
|
nextPhase,
|
|
2080
|
-
6 /* PAYABLE_REQUEST
|
|
3219
|
+
6 /* PAYABLE_REQUEST */,
|
|
3220
|
+
expiredAt
|
|
2081
3221
|
);
|
|
2082
3222
|
});
|
|
2083
3223
|
}
|
|
2084
|
-
responseFundsRequest(memoId, accept,
|
|
3224
|
+
responseFundsRequest(memoId, accept, amountBaseUnit, reason) {
|
|
2085
3225
|
return __async(this, null, function* () {
|
|
2086
3226
|
if (!accept) {
|
|
2087
3227
|
return yield this.acpContractClient.signMemo(memoId, accept, reason);
|
|
2088
3228
|
}
|
|
2089
|
-
if (
|
|
2090
|
-
yield this.acpContractClient.approveAllowance(
|
|
2091
|
-
parseEther(amount.toString())
|
|
2092
|
-
);
|
|
3229
|
+
if (amountBaseUnit > BigInt(0)) {
|
|
3230
|
+
yield this.acpContractClient.approveAllowance(amountBaseUnit);
|
|
2093
3231
|
}
|
|
2094
3232
|
return yield this.acpContractClient.signMemo(memoId, true, reason);
|
|
2095
3233
|
});
|
|
2096
3234
|
}
|
|
2097
|
-
transferFunds(jobId,
|
|
3235
|
+
transferFunds(jobId, transferFareAmount, recipient, feeFareAmount, feeType, reason, nextPhase, expiredAt) {
|
|
2098
3236
|
return __async(this, null, function* () {
|
|
2099
|
-
|
|
2100
|
-
|
|
3237
|
+
if (transferFareAmount.fare.contractAddress === ethFare.contractAddress) {
|
|
3238
|
+
yield this.acpContractClient.wrapEth(transferFareAmount.amount);
|
|
3239
|
+
transferFareAmount = new FareBigInt(transferFareAmount.amount, wethFare);
|
|
3240
|
+
}
|
|
3241
|
+
if (feeFareAmount.amount > 0 && feeFareAmount.fare.contractAddress !== this.acpContractClient.config.baseFare.contractAddress) {
|
|
3242
|
+
throw new acpError_default("Fee token address is not the same as the base fare");
|
|
3243
|
+
}
|
|
3244
|
+
const isFeeTokenDifferent = feeFareAmount.fare.contractAddress !== transferFareAmount.fare.contractAddress;
|
|
3245
|
+
if (isFeeTokenDifferent) {
|
|
2101
3246
|
yield this.acpContractClient.approveAllowance(
|
|
2102
|
-
|
|
3247
|
+
feeFareAmount.amount,
|
|
3248
|
+
feeFareAmount.fare.contractAddress
|
|
2103
3249
|
);
|
|
2104
3250
|
}
|
|
3251
|
+
const finalAmount = isFeeTokenDifferent ? transferFareAmount : transferFareAmount.add(feeFareAmount);
|
|
3252
|
+
yield this.acpContractClient.approveAllowance(
|
|
3253
|
+
finalAmount.amount,
|
|
3254
|
+
transferFareAmount.fare.contractAddress
|
|
3255
|
+
);
|
|
2105
3256
|
return yield this.acpContractClient.createPayableMemo(
|
|
2106
3257
|
jobId,
|
|
2107
3258
|
JSON.stringify(reason),
|
|
2108
|
-
|
|
3259
|
+
transferFareAmount.amount,
|
|
2109
3260
|
recipient,
|
|
2110
|
-
|
|
3261
|
+
feeFareAmount.amount,
|
|
2111
3262
|
feeType,
|
|
2112
3263
|
nextPhase,
|
|
2113
|
-
|
|
2114
|
-
expiredAt
|
|
3264
|
+
8 /* PAYABLE_TRANSFER_ESCROW */,
|
|
3265
|
+
expiredAt,
|
|
3266
|
+
transferFareAmount.fare.contractAddress
|
|
2115
3267
|
);
|
|
2116
3268
|
});
|
|
2117
3269
|
}
|
|
@@ -2153,7 +3305,7 @@ var AcpClient = class {
|
|
|
2153
3305
|
});
|
|
2154
3306
|
const data = yield response.json();
|
|
2155
3307
|
if (data.error) {
|
|
2156
|
-
throw new
|
|
3308
|
+
throw new acpError_default(data.error.message);
|
|
2157
3309
|
}
|
|
2158
3310
|
return data.data.map((job) => {
|
|
2159
3311
|
return new acpJob_default(
|
|
@@ -2163,6 +3315,7 @@ var AcpClient = class {
|
|
|
2163
3315
|
job.providerAddress,
|
|
2164
3316
|
job.evaluatorAddress,
|
|
2165
3317
|
job.price,
|
|
3318
|
+
job.priceTokenAddress,
|
|
2166
3319
|
job.memos.map((memo) => {
|
|
2167
3320
|
return new acpMemo_default(
|
|
2168
3321
|
this,
|
|
@@ -2170,7 +3323,10 @@ var AcpClient = class {
|
|
|
2170
3323
|
memo.memoType,
|
|
2171
3324
|
memo.content,
|
|
2172
3325
|
memo.nextPhase,
|
|
2173
|
-
memo.
|
|
3326
|
+
memo.status,
|
|
3327
|
+
memo.signedReason,
|
|
3328
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3329
|
+
memo.payableDetails
|
|
2174
3330
|
);
|
|
2175
3331
|
}),
|
|
2176
3332
|
job.phase,
|
|
@@ -2178,7 +3334,7 @@ var AcpClient = class {
|
|
|
2178
3334
|
);
|
|
2179
3335
|
});
|
|
2180
3336
|
} catch (error) {
|
|
2181
|
-
throw error;
|
|
3337
|
+
throw new acpError_default("Failed to get active jobs", error);
|
|
2182
3338
|
}
|
|
2183
3339
|
});
|
|
2184
3340
|
}
|
|
@@ -2193,7 +3349,7 @@ var AcpClient = class {
|
|
|
2193
3349
|
});
|
|
2194
3350
|
const data = yield response.json();
|
|
2195
3351
|
if (data.error) {
|
|
2196
|
-
throw new
|
|
3352
|
+
throw new acpError_default(data.error.message);
|
|
2197
3353
|
}
|
|
2198
3354
|
return data.data.map((job) => {
|
|
2199
3355
|
return new acpJob_default(
|
|
@@ -2203,6 +3359,7 @@ var AcpClient = class {
|
|
|
2203
3359
|
job.providerAddress,
|
|
2204
3360
|
job.evaluatorAddress,
|
|
2205
3361
|
job.price,
|
|
3362
|
+
job.priceTokenAddress,
|
|
2206
3363
|
job.memos.map((memo) => {
|
|
2207
3364
|
return new acpMemo_default(
|
|
2208
3365
|
this,
|
|
@@ -2210,7 +3367,10 @@ var AcpClient = class {
|
|
|
2210
3367
|
memo.memoType,
|
|
2211
3368
|
memo.content,
|
|
2212
3369
|
memo.nextPhase,
|
|
2213
|
-
memo.
|
|
3370
|
+
memo.status,
|
|
3371
|
+
memo.signedReason,
|
|
3372
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3373
|
+
memo.payableDetails
|
|
2214
3374
|
);
|
|
2215
3375
|
}),
|
|
2216
3376
|
job.phase,
|
|
@@ -2218,7 +3378,7 @@ var AcpClient = class {
|
|
|
2218
3378
|
);
|
|
2219
3379
|
});
|
|
2220
3380
|
} catch (error) {
|
|
2221
|
-
throw error;
|
|
3381
|
+
throw new acpError_default("Failed to get completed jobs", error);
|
|
2222
3382
|
}
|
|
2223
3383
|
});
|
|
2224
3384
|
}
|
|
@@ -2233,7 +3393,7 @@ var AcpClient = class {
|
|
|
2233
3393
|
});
|
|
2234
3394
|
const data = yield response.json();
|
|
2235
3395
|
if (data.error) {
|
|
2236
|
-
throw new
|
|
3396
|
+
throw new acpError_default(data.error.message);
|
|
2237
3397
|
}
|
|
2238
3398
|
return data.data.map((job) => {
|
|
2239
3399
|
return new acpJob_default(
|
|
@@ -2243,6 +3403,7 @@ var AcpClient = class {
|
|
|
2243
3403
|
job.providerAddress,
|
|
2244
3404
|
job.evaluatorAddress,
|
|
2245
3405
|
job.price,
|
|
3406
|
+
job.priceTokenAddress,
|
|
2246
3407
|
job.memos.map((memo) => {
|
|
2247
3408
|
return new acpMemo_default(
|
|
2248
3409
|
this,
|
|
@@ -2250,7 +3411,10 @@ var AcpClient = class {
|
|
|
2250
3411
|
memo.memoType,
|
|
2251
3412
|
memo.content,
|
|
2252
3413
|
memo.nextPhase,
|
|
2253
|
-
memo.
|
|
3414
|
+
memo.status,
|
|
3415
|
+
memo.signedReason,
|
|
3416
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3417
|
+
memo.payableDetails
|
|
2254
3418
|
);
|
|
2255
3419
|
}),
|
|
2256
3420
|
job.phase,
|
|
@@ -2258,7 +3422,7 @@ var AcpClient = class {
|
|
|
2258
3422
|
);
|
|
2259
3423
|
});
|
|
2260
3424
|
} catch (error) {
|
|
2261
|
-
throw error;
|
|
3425
|
+
throw new acpError_default("Failed to get cancelled jobs", error);
|
|
2262
3426
|
}
|
|
2263
3427
|
});
|
|
2264
3428
|
}
|
|
@@ -2273,7 +3437,7 @@ var AcpClient = class {
|
|
|
2273
3437
|
});
|
|
2274
3438
|
const data = yield response.json();
|
|
2275
3439
|
if (data.error) {
|
|
2276
|
-
throw new
|
|
3440
|
+
throw new acpError_default(data.error.message);
|
|
2277
3441
|
}
|
|
2278
3442
|
const job = data.data;
|
|
2279
3443
|
if (!job) {
|
|
@@ -2286,6 +3450,7 @@ var AcpClient = class {
|
|
|
2286
3450
|
job.providerAddress,
|
|
2287
3451
|
job.evaluatorAddress,
|
|
2288
3452
|
job.price,
|
|
3453
|
+
job.priceTokenAddress,
|
|
2289
3454
|
job.memos.map((memo) => {
|
|
2290
3455
|
return new acpMemo_default(
|
|
2291
3456
|
this,
|
|
@@ -2293,14 +3458,17 @@ var AcpClient = class {
|
|
|
2293
3458
|
memo.memoType,
|
|
2294
3459
|
memo.content,
|
|
2295
3460
|
memo.nextPhase,
|
|
2296
|
-
memo.
|
|
3461
|
+
memo.status,
|
|
3462
|
+
memo.signedReason,
|
|
3463
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3464
|
+
memo.payableDetails
|
|
2297
3465
|
);
|
|
2298
3466
|
}),
|
|
2299
3467
|
job.phase,
|
|
2300
3468
|
job.context
|
|
2301
3469
|
);
|
|
2302
3470
|
} catch (error) {
|
|
2303
|
-
throw error;
|
|
3471
|
+
throw new acpError_default("Failed to get job by id", error);
|
|
2304
3472
|
}
|
|
2305
3473
|
});
|
|
2306
3474
|
}
|
|
@@ -2315,7 +3483,7 @@ var AcpClient = class {
|
|
|
2315
3483
|
});
|
|
2316
3484
|
const data = yield response.json();
|
|
2317
3485
|
if (data.error) {
|
|
2318
|
-
throw new
|
|
3486
|
+
throw new acpError_default(data.error.message);
|
|
2319
3487
|
}
|
|
2320
3488
|
const memo = data.data;
|
|
2321
3489
|
if (!memo) {
|
|
@@ -2327,10 +3495,13 @@ var AcpClient = class {
|
|
|
2327
3495
|
memo.memoType,
|
|
2328
3496
|
memo.content,
|
|
2329
3497
|
memo.nextPhase,
|
|
2330
|
-
memo.
|
|
3498
|
+
memo.status,
|
|
3499
|
+
memo.signedReason,
|
|
3500
|
+
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
3501
|
+
memo.payableDetails
|
|
2331
3502
|
);
|
|
2332
3503
|
} catch (error) {
|
|
2333
|
-
throw error;
|
|
3504
|
+
throw new acpError_default("Failed to get memo by id", error);
|
|
2334
3505
|
}
|
|
2335
3506
|
});
|
|
2336
3507
|
}
|
|
@@ -2355,14 +3526,23 @@ export {
|
|
|
2355
3526
|
acpAbi_default as ACP_ABI,
|
|
2356
3527
|
AcpAgentSort,
|
|
2357
3528
|
acpContractClient_default as AcpContractClient,
|
|
3529
|
+
AcpContractConfig,
|
|
3530
|
+
acpError_default as AcpError,
|
|
2358
3531
|
AcpGraduationStatus,
|
|
2359
3532
|
acpJob_default as AcpJob,
|
|
2360
3533
|
AcpJobPhases,
|
|
2361
3534
|
acpMemo_default as AcpMemo,
|
|
3535
|
+
AcpMemoStatus,
|
|
2362
3536
|
AcpOnlineStatus,
|
|
3537
|
+
Fare,
|
|
3538
|
+
FareAmount,
|
|
3539
|
+
FareBigInt,
|
|
2363
3540
|
MemoType,
|
|
2364
3541
|
PayloadType,
|
|
3542
|
+
PositionDirection,
|
|
2365
3543
|
baseAcpConfig,
|
|
2366
3544
|
baseSepoliaAcpConfig,
|
|
2367
|
-
index_default as default
|
|
3545
|
+
index_default as default,
|
|
3546
|
+
ethFare,
|
|
3547
|
+
wethFare
|
|
2368
3548
|
};
|