@virtuals-protocol/acp-node 0.2.0-beta.6 → 0.2.0-beta.7

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/dist/index.mjs CHANGED
@@ -47,7 +47,7 @@ var require_package = __commonJS({
47
47
  "package.json"(exports, module) {
48
48
  module.exports = {
49
49
  name: "@virtuals-protocol/acp-node",
50
- version: "0.2.0-beta.6",
50
+ version: "0.2.0-beta.7",
51
51
  main: "./dist/index.js",
52
52
  module: "./dist/index.mjs",
53
53
  types: "./dist/index.d.ts",
@@ -79,32 +79,82 @@ var require_package = __commonJS({
79
79
 
80
80
  // src/acpAbi.ts
81
81
  var ACP_ABI = [
82
- { inputs: [], stateMutability: "nonpayable", type: "constructor" },
83
- { inputs: [], name: "AccessControlBadConfirmation", type: "error" },
82
+ {
83
+ inputs: [],
84
+ stateMutability: "nonpayable",
85
+ type: "constructor"
86
+ },
87
+ {
88
+ inputs: [],
89
+ name: "AccessControlBadConfirmation",
90
+ type: "error"
91
+ },
84
92
  {
85
93
  inputs: [
86
- { internalType: "address", name: "account", type: "address" },
87
- { internalType: "bytes32", name: "neededRole", type: "bytes32" }
94
+ {
95
+ internalType: "address",
96
+ name: "account",
97
+ type: "address"
98
+ },
99
+ {
100
+ internalType: "bytes32",
101
+ name: "neededRole",
102
+ type: "bytes32"
103
+ }
88
104
  ],
89
105
  name: "AccessControlUnauthorizedAccount",
90
106
  type: "error"
91
107
  },
92
108
  {
93
- inputs: [{ internalType: "address", name: "target", type: "address" }],
109
+ inputs: [
110
+ {
111
+ internalType: "address",
112
+ name: "target",
113
+ type: "address"
114
+ }
115
+ ],
94
116
  name: "AddressEmptyCode",
95
117
  type: "error"
96
118
  },
97
119
  {
98
- inputs: [{ internalType: "address", name: "account", type: "address" }],
120
+ inputs: [
121
+ {
122
+ internalType: "address",
123
+ name: "account",
124
+ type: "address"
125
+ }
126
+ ],
99
127
  name: "AddressInsufficientBalance",
100
128
  type: "error"
101
129
  },
102
- { inputs: [], name: "FailedInnerCall", type: "error" },
103
- { inputs: [], name: "InvalidInitialization", type: "error" },
104
- { inputs: [], name: "NotInitializing", type: "error" },
105
- { inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
106
130
  {
107
- inputs: [{ internalType: "address", name: "token", type: "address" }],
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
+ ],
108
158
  name: "SafeERC20FailedOperation",
109
159
  type: "error"
110
160
  },
@@ -221,6 +271,25 @@ var ACP_ABI = [
221
271
  name: "JobCreated",
222
272
  type: "event"
223
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
+ },
224
293
  {
225
294
  anonymous: false,
226
295
  inputs: [
@@ -236,7 +305,12 @@ var ACP_ABI = [
236
305
  name: "oldPhase",
237
306
  type: "uint8"
238
307
  },
239
- { indexed: false, internalType: "uint8", name: "phase", type: "uint8" }
308
+ {
309
+ indexed: false,
310
+ internalType: "uint8",
311
+ name: "phase",
312
+ type: "uint8"
313
+ }
240
314
  ],
241
315
  name: "JobPhaseUpdated",
242
316
  type: "event"
@@ -423,8 +497,18 @@ var ACP_ABI = [
423
497
  name: "memoId",
424
498
  type: "uint256"
425
499
  },
426
- { indexed: true, internalType: "address", name: "from", type: "address" },
427
- { indexed: false, internalType: "address", name: "to", type: "address" },
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
+ },
428
512
  {
429
513
  indexed: false,
430
514
  internalType: "address",
@@ -456,8 +540,18 @@ var ACP_ABI = [
456
540
  name: "memoId",
457
541
  type: "uint256"
458
542
  },
459
- { indexed: true, internalType: "address", name: "from", type: "address" },
460
- { indexed: false, internalType: "address", name: "to", type: "address" },
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
+ },
461
555
  {
462
556
  indexed: false,
463
557
  internalType: "address",
@@ -527,7 +621,12 @@ var ACP_ABI = [
527
621
  {
528
622
  anonymous: false,
529
623
  inputs: [
530
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
624
+ {
625
+ indexed: true,
626
+ internalType: "bytes32",
627
+ name: "role",
628
+ type: "bytes32"
629
+ },
531
630
  {
532
631
  indexed: true,
533
632
  internalType: "bytes32",
@@ -547,7 +646,12 @@ var ACP_ABI = [
547
646
  {
548
647
  anonymous: false,
549
648
  inputs: [
550
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
649
+ {
650
+ indexed: true,
651
+ internalType: "bytes32",
652
+ name: "role",
653
+ type: "bytes32"
654
+ },
551
655
  {
552
656
  indexed: true,
553
657
  internalType: "address",
@@ -567,7 +671,12 @@ var ACP_ABI = [
567
671
  {
568
672
  anonymous: false,
569
673
  inputs: [
570
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
674
+ {
675
+ indexed: true,
676
+ internalType: "bytes32",
677
+ name: "role",
678
+ type: "bytes32"
679
+ },
571
680
  {
572
681
  indexed: true,
573
682
  internalType: "address",
@@ -587,87 +696,192 @@ var ACP_ABI = [
587
696
  {
588
697
  inputs: [],
589
698
  name: "ADMIN_ROLE",
590
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
699
+ outputs: [
700
+ {
701
+ internalType: "bytes32",
702
+ name: "",
703
+ type: "bytes32"
704
+ }
705
+ ],
591
706
  stateMutability: "view",
592
707
  type: "function"
593
708
  },
594
709
  {
595
710
  inputs: [],
596
711
  name: "DEFAULT_ADMIN_ROLE",
597
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
712
+ outputs: [
713
+ {
714
+ internalType: "bytes32",
715
+ name: "",
716
+ type: "bytes32"
717
+ }
718
+ ],
598
719
  stateMutability: "view",
599
720
  type: "function"
600
721
  },
601
722
  {
602
723
  inputs: [],
603
724
  name: "PHASE_COMPLETED",
604
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
725
+ outputs: [
726
+ {
727
+ internalType: "uint8",
728
+ name: "",
729
+ type: "uint8"
730
+ }
731
+ ],
605
732
  stateMutability: "view",
606
733
  type: "function"
607
734
  },
608
735
  {
609
736
  inputs: [],
610
737
  name: "PHASE_EVALUATION",
611
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
738
+ outputs: [
739
+ {
740
+ internalType: "uint8",
741
+ name: "",
742
+ type: "uint8"
743
+ }
744
+ ],
612
745
  stateMutability: "view",
613
746
  type: "function"
614
747
  },
615
748
  {
616
749
  inputs: [],
617
750
  name: "PHASE_EXPIRED",
618
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
751
+ outputs: [
752
+ {
753
+ internalType: "uint8",
754
+ name: "",
755
+ type: "uint8"
756
+ }
757
+ ],
619
758
  stateMutability: "view",
620
759
  type: "function"
621
760
  },
622
761
  {
623
762
  inputs: [],
624
763
  name: "PHASE_NEGOTIATION",
625
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
764
+ outputs: [
765
+ {
766
+ internalType: "uint8",
767
+ name: "",
768
+ type: "uint8"
769
+ }
770
+ ],
626
771
  stateMutability: "view",
627
772
  type: "function"
628
773
  },
629
774
  {
630
775
  inputs: [],
631
776
  name: "PHASE_REJECTED",
632
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
777
+ outputs: [
778
+ {
779
+ internalType: "uint8",
780
+ name: "",
781
+ type: "uint8"
782
+ }
783
+ ],
633
784
  stateMutability: "view",
634
785
  type: "function"
635
786
  },
636
787
  {
637
788
  inputs: [],
638
789
  name: "PHASE_REQUEST",
639
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
790
+ outputs: [
791
+ {
792
+ internalType: "uint8",
793
+ name: "",
794
+ type: "uint8"
795
+ }
796
+ ],
640
797
  stateMutability: "view",
641
798
  type: "function"
642
799
  },
643
800
  {
644
801
  inputs: [],
645
802
  name: "PHASE_TRANSACTION",
646
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
803
+ outputs: [
804
+ {
805
+ internalType: "uint8",
806
+ name: "",
807
+ type: "uint8"
808
+ }
809
+ ],
647
810
  stateMutability: "view",
648
811
  type: "function"
649
812
  },
650
813
  {
651
814
  inputs: [],
652
815
  name: "TOTAL_PHASES",
653
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
816
+ outputs: [
817
+ {
818
+ internalType: "uint8",
819
+ name: "",
820
+ type: "uint8"
821
+ }
822
+ ],
654
823
  stateMutability: "view",
655
824
  type: "function"
656
825
  },
657
826
  {
658
827
  inputs: [
659
- { internalType: "address", name: "account", type: "address" },
828
+ {
829
+ internalType: "address",
830
+ name: "account",
831
+ type: "address"
832
+ },
660
833
  {
661
834
  components: [
662
- { internalType: "uint256", name: "id", type: "uint256" },
663
- { internalType: "address", name: "client", type: "address" },
664
- { internalType: "address", name: "provider", type: "address" },
665
- { internalType: "uint256", name: "budget", type: "uint256" },
666
- { internalType: "uint256", name: "amountClaimed", type: "uint256" },
667
- { internalType: "uint8", name: "phase", type: "uint8" },
668
- { internalType: "uint256", name: "memoCount", type: "uint256" },
669
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
670
- { internalType: "address", name: "evaluator", type: "address" }
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
+ }
671
885
  ],
672
886
  internalType: "struct ACPSimple.Job",
673
887
  name: "job",
@@ -675,12 +889,24 @@ var ACP_ABI = [
675
889
  }
676
890
  ],
677
891
  name: "canSign",
678
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
892
+ outputs: [
893
+ {
894
+ internalType: "bool",
895
+ name: "",
896
+ type: "bool"
897
+ }
898
+ ],
679
899
  stateMutability: "pure",
680
900
  type: "function"
681
901
  },
682
902
  {
683
- inputs: [{ internalType: "uint256", name: "id", type: "uint256" }],
903
+ inputs: [
904
+ {
905
+ internalType: "uint256",
906
+ name: "id",
907
+ type: "uint256"
908
+ }
909
+ ],
684
910
  name: "claimBudget",
685
911
  outputs: [],
686
912
  stateMutability: "nonpayable",
@@ -688,132 +914,306 @@ var ACP_ABI = [
688
914
  },
689
915
  {
690
916
  inputs: [
691
- { internalType: "address", name: "provider", type: "address" },
692
- { internalType: "address", name: "evaluator", type: "address" },
693
- { internalType: "uint256", name: "expiredAt", type: "uint256" }
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
+ }
694
932
  ],
695
933
  name: "createJob",
696
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
697
- stateMutability: "nonpayable",
698
- type: "function"
699
- },
700
- {
701
- inputs: [
702
- { internalType: "uint256", name: "jobId", type: "uint256" },
703
- { internalType: "string", name: "content", type: "string" },
934
+ outputs: [
704
935
  {
705
- internalType: "enum InteractionLedger.MemoType",
706
- name: "memoType",
707
- type: "uint8"
708
- },
709
- { internalType: "bool", name: "isSecured", type: "bool" },
710
- { internalType: "uint8", name: "nextPhase", type: "uint8" }
936
+ internalType: "uint256",
937
+ name: "",
938
+ type: "uint256"
939
+ }
711
940
  ],
712
- name: "createMemo",
713
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
714
941
  stateMutability: "nonpayable",
715
942
  type: "function"
716
943
  },
717
944
  {
718
945
  inputs: [
719
- { internalType: "uint256", name: "jobId", type: "uint256" },
720
- { internalType: "string", name: "content", type: "string" },
721
- { internalType: "address", name: "token", type: "address" },
722
- { internalType: "uint256", name: "amount", type: "uint256" },
723
- { internalType: "address", name: "recipient", type: "address" },
724
- { internalType: "uint256", name: "feeAmount", type: "uint256" },
725
946
  {
726
- internalType: "enum ACPSimple.FeeType",
727
- name: "feeType",
728
- type: "uint8"
947
+ internalType: "uint256",
948
+ name: "jobId",
949
+ type: "uint256"
729
950
  },
730
951
  {
731
- internalType: "enum InteractionLedger.MemoType",
732
- name: "memoType",
952
+ internalType: "string",
953
+ name: "content",
954
+ type: "string"
955
+ },
956
+ {
957
+ internalType: "enum InteractionLedger.MemoType",
958
+ name: "memoType",
959
+ type: "uint8"
960
+ },
961
+ {
962
+ internalType: "bool",
963
+ name: "isSecured",
964
+ type: "bool"
965
+ },
966
+ {
967
+ internalType: "uint8",
968
+ name: "nextPhase",
969
+ type: "uint8"
970
+ }
971
+ ],
972
+ name: "createMemo",
973
+ outputs: [
974
+ {
975
+ internalType: "uint256",
976
+ name: "",
977
+ type: "uint256"
978
+ }
979
+ ],
980
+ stateMutability: "nonpayable",
981
+ type: "function"
982
+ },
983
+ {
984
+ inputs: [
985
+ {
986
+ internalType: "uint256",
987
+ name: "jobId",
988
+ type: "uint256"
989
+ },
990
+ {
991
+ internalType: "string",
992
+ name: "content",
993
+ type: "string"
994
+ },
995
+ {
996
+ internalType: "address",
997
+ name: "token",
998
+ type: "address"
999
+ },
1000
+ {
1001
+ internalType: "uint256",
1002
+ name: "amount",
1003
+ type: "uint256"
1004
+ },
1005
+ {
1006
+ internalType: "address",
1007
+ name: "recipient",
1008
+ type: "address"
1009
+ },
1010
+ {
1011
+ internalType: "uint256",
1012
+ name: "feeAmount",
1013
+ type: "uint256"
1014
+ },
1015
+ {
1016
+ internalType: "enum ACPSimple.FeeType",
1017
+ name: "feeType",
1018
+ type: "uint8"
1019
+ },
1020
+ {
1021
+ internalType: "enum InteractionLedger.MemoType",
1022
+ name: "memoType",
733
1023
  type: "uint8"
734
1024
  },
735
- { internalType: "uint8", name: "nextPhase", type: "uint8" },
736
- { internalType: "uint256", name: "expiredAt", type: "uint256" }
1025
+ {
1026
+ internalType: "uint8",
1027
+ name: "nextPhase",
1028
+ type: "uint8"
1029
+ },
1030
+ {
1031
+ internalType: "uint256",
1032
+ name: "expiredAt",
1033
+ type: "uint256"
1034
+ }
737
1035
  ],
738
1036
  name: "createPayableMemo",
739
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1037
+ outputs: [
1038
+ {
1039
+ internalType: "uint256",
1040
+ name: "",
1041
+ type: "uint256"
1042
+ }
1043
+ ],
740
1044
  stateMutability: "nonpayable",
741
1045
  type: "function"
742
1046
  },
743
1047
  {
744
1048
  inputs: [],
745
1049
  name: "evaluatorFeeBP",
746
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1050
+ outputs: [
1051
+ {
1052
+ internalType: "uint256",
1053
+ name: "",
1054
+ type: "uint256"
1055
+ }
1056
+ ],
747
1057
  stateMutability: "view",
748
1058
  type: "function"
749
1059
  },
750
1060
  {
751
1061
  inputs: [
752
- { internalType: "uint256", name: "jobId", type: "uint256" },
753
- { internalType: "uint256", name: "offset", type: "uint256" },
754
- { internalType: "uint256", name: "limit", type: "uint256" }
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
+ }
755
1077
  ],
756
1078
  name: "getAllMemos",
757
1079
  outputs: [
758
1080
  {
759
1081
  components: [
760
- { internalType: "string", name: "content", type: "string" },
1082
+ {
1083
+ internalType: "string",
1084
+ name: "content",
1085
+ type: "string"
1086
+ },
761
1087
  {
762
1088
  internalType: "enum InteractionLedger.MemoType",
763
1089
  name: "memoType",
764
1090
  type: "uint8"
765
1091
  },
766
- { internalType: "bool", name: "isSecured", type: "bool" },
767
- { internalType: "uint8", name: "nextPhase", type: "uint8" },
768
- { internalType: "uint256", name: "jobId", type: "uint256" },
769
- { internalType: "address", name: "sender", type: "address" }
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
+ }
770
1112
  ],
771
1113
  internalType: "struct InteractionLedger.Memo[]",
772
1114
  name: "",
773
1115
  type: "tuple[]"
774
1116
  },
775
- { internalType: "uint256", name: "total", type: "uint256" }
1117
+ {
1118
+ internalType: "uint256",
1119
+ name: "total",
1120
+ type: "uint256"
1121
+ }
776
1122
  ],
777
1123
  stateMutability: "view",
778
1124
  type: "function"
779
1125
  },
780
1126
  {
781
1127
  inputs: [
782
- { internalType: "uint256", name: "jobId", type: "uint256" },
783
- { internalType: "uint8", name: "phase", type: "uint8" }
1128
+ {
1129
+ internalType: "uint256",
1130
+ name: "jobId",
1131
+ type: "uint256"
1132
+ },
1133
+ {
1134
+ internalType: "uint8",
1135
+ name: "phase",
1136
+ type: "uint8"
1137
+ }
784
1138
  ],
785
1139
  name: "getJobPhaseMemoIds",
786
- outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }],
1140
+ outputs: [
1141
+ {
1142
+ internalType: "uint256[]",
1143
+ name: "",
1144
+ type: "uint256[]"
1145
+ }
1146
+ ],
787
1147
  stateMutability: "view",
788
1148
  type: "function"
789
1149
  },
790
1150
  {
791
1151
  inputs: [
792
- { internalType: "uint256", name: "jobId", type: "uint256" },
793
- { internalType: "uint8", name: "phase", type: "uint8" },
794
- { internalType: "uint256", name: "offset", type: "uint256" },
795
- { internalType: "uint256", name: "limit", type: "uint256" }
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
+ }
796
1172
  ],
797
1173
  name: "getMemosForPhase",
798
1174
  outputs: [
799
1175
  {
800
1176
  components: [
801
- { internalType: "string", name: "content", type: "string" },
1177
+ {
1178
+ internalType: "string",
1179
+ name: "content",
1180
+ type: "string"
1181
+ },
802
1182
  {
803
1183
  internalType: "enum InteractionLedger.MemoType",
804
1184
  name: "memoType",
805
1185
  type: "uint8"
806
1186
  },
807
- { internalType: "bool", name: "isSecured", type: "bool" },
808
- { internalType: "uint8", name: "nextPhase", type: "uint8" },
809
- { internalType: "uint256", name: "jobId", type: "uint256" },
810
- { internalType: "address", name: "sender", type: "address" }
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
+ }
811
1207
  ],
812
1208
  internalType: "struct InteractionLedger.Memo[]",
813
1209
  name: "",
814
1210
  type: "tuple[]"
815
1211
  },
816
- { internalType: "uint256", name: "total", type: "uint256" }
1212
+ {
1213
+ internalType: "uint256",
1214
+ name: "total",
1215
+ type: "uint256"
1216
+ }
817
1217
  ],
818
1218
  stateMutability: "view",
819
1219
  type: "function"
@@ -821,21 +1221,47 @@ var ACP_ABI = [
821
1221
  {
822
1222
  inputs: [],
823
1223
  name: "getPhases",
824
- outputs: [{ internalType: "string[7]", name: "", type: "string[7]" }],
1224
+ outputs: [
1225
+ {
1226
+ internalType: "string[7]",
1227
+ name: "",
1228
+ type: "string[7]"
1229
+ }
1230
+ ],
825
1231
  stateMutability: "pure",
826
1232
  type: "function"
827
1233
  },
828
1234
  {
829
- inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
1235
+ inputs: [
1236
+ {
1237
+ internalType: "bytes32",
1238
+ name: "role",
1239
+ type: "bytes32"
1240
+ }
1241
+ ],
830
1242
  name: "getRoleAdmin",
831
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
1243
+ outputs: [
1244
+ {
1245
+ internalType: "bytes32",
1246
+ name: "",
1247
+ type: "bytes32"
1248
+ }
1249
+ ],
832
1250
  stateMutability: "view",
833
1251
  type: "function"
834
1252
  },
835
1253
  {
836
1254
  inputs: [
837
- { internalType: "bytes32", name: "role", type: "bytes32" },
838
- { internalType: "address", name: "account", type: "address" }
1255
+ {
1256
+ internalType: "bytes32",
1257
+ name: "role",
1258
+ type: "bytes32"
1259
+ },
1260
+ {
1261
+ internalType: "address",
1262
+ name: "account",
1263
+ type: "address"
1264
+ }
839
1265
  ],
840
1266
  name: "grantRole",
841
1267
  outputs: [],
@@ -844,20 +1270,50 @@ var ACP_ABI = [
844
1270
  },
845
1271
  {
846
1272
  inputs: [
847
- { internalType: "bytes32", name: "role", type: "bytes32" },
848
- { internalType: "address", name: "account", type: "address" }
1273
+ {
1274
+ internalType: "bytes32",
1275
+ name: "role",
1276
+ type: "bytes32"
1277
+ },
1278
+ {
1279
+ internalType: "address",
1280
+ name: "account",
1281
+ type: "address"
1282
+ }
849
1283
  ],
850
1284
  name: "hasRole",
851
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1285
+ outputs: [
1286
+ {
1287
+ internalType: "bool",
1288
+ name: "",
1289
+ type: "bool"
1290
+ }
1291
+ ],
852
1292
  stateMutability: "view",
853
1293
  type: "function"
854
1294
  },
855
1295
  {
856
1296
  inputs: [
857
- { internalType: "address", name: "paymentTokenAddress", type: "address" },
858
- { internalType: "uint256", name: "evaluatorFeeBP_", type: "uint256" },
859
- { internalType: "uint256", name: "platformFeeBP_", type: "uint256" },
860
- { internalType: "address", name: "platformTreasury_", type: "address" }
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
+ }
861
1317
  ],
862
1318
  name: "initialize",
863
1319
  outputs: [],
@@ -866,100 +1322,244 @@ var ACP_ABI = [
866
1322
  },
867
1323
  {
868
1324
  inputs: [
869
- { internalType: "uint256", name: "jobId", type: "uint256" },
870
- { internalType: "address", name: "account", type: "address" }
1325
+ {
1326
+ internalType: "uint256",
1327
+ name: "jobId",
1328
+ type: "uint256"
1329
+ },
1330
+ {
1331
+ internalType: "address",
1332
+ name: "account",
1333
+ type: "address"
1334
+ }
871
1335
  ],
872
1336
  name: "isJobEvaluator",
873
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1337
+ outputs: [
1338
+ {
1339
+ internalType: "bool",
1340
+ name: "",
1341
+ type: "bool"
1342
+ }
1343
+ ],
874
1344
  stateMutability: "view",
875
1345
  type: "function"
876
1346
  },
877
1347
  {
878
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
1348
+ inputs: [
1349
+ {
1350
+ internalType: "uint256",
1351
+ name: "memoId",
1352
+ type: "uint256"
1353
+ }
1354
+ ],
879
1355
  name: "isPayableMemo",
880
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1356
+ outputs: [
1357
+ {
1358
+ internalType: "bool",
1359
+ name: "",
1360
+ type: "bool"
1361
+ }
1362
+ ],
881
1363
  stateMutability: "view",
882
1364
  type: "function"
883
1365
  },
884
1366
  {
885
- inputs: [{ internalType: "uint256", name: "jobId", type: "uint256" }],
1367
+ inputs: [
1368
+ {
1369
+ internalType: "uint256",
1370
+ name: "jobId",
1371
+ type: "uint256"
1372
+ }
1373
+ ],
886
1374
  name: "jobAdditionalFees",
887
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1375
+ outputs: [
1376
+ {
1377
+ internalType: "uint256",
1378
+ name: "",
1379
+ type: "uint256"
1380
+ }
1381
+ ],
888
1382
  stateMutability: "view",
889
1383
  type: "function"
890
1384
  },
891
1385
  {
892
1386
  inputs: [],
893
1387
  name: "jobCounter",
894
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
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
+ ],
895
1424
  stateMutability: "view",
896
1425
  type: "function"
897
1426
  },
898
1427
  {
899
1428
  inputs: [
900
- { internalType: "uint256", name: "jobId", type: "uint256" },
901
- { internalType: "uint8", name: "phase", type: "uint8" },
902
- { internalType: "uint256", name: "", type: "uint256" }
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
+ }
903
1487
  ],
904
- name: "jobMemoIds",
905
- outputs: [{ internalType: "uint256", name: "memoIds", type: "uint256" }],
906
1488
  stateMutability: "view",
907
1489
  type: "function"
908
1490
  },
909
1491
  {
910
- inputs: [{ internalType: "uint256", name: "jobId", type: "uint256" }],
911
- name: "jobPayment",
1492
+ inputs: [],
1493
+ name: "memoCounter",
912
1494
  outputs: [
913
- { internalType: "address", name: "paymentToken", type: "address" }
1495
+ {
1496
+ internalType: "uint256",
1497
+ name: "",
1498
+ type: "uint256"
1499
+ }
914
1500
  ],
915
1501
  stateMutability: "view",
916
1502
  type: "function"
917
1503
  },
918
1504
  {
919
- inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
920
- name: "jobs",
921
- outputs: [
922
- { internalType: "uint256", name: "id", type: "uint256" },
923
- { internalType: "address", name: "client", type: "address" },
924
- { internalType: "address", name: "provider", type: "address" },
925
- { internalType: "uint256", name: "budget", type: "uint256" },
926
- { internalType: "uint256", name: "amountClaimed", type: "uint256" },
927
- { internalType: "uint8", name: "phase", type: "uint8" },
928
- { internalType: "uint256", name: "memoCount", type: "uint256" },
929
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
930
- { internalType: "address", name: "evaluator", type: "address" }
1505
+ inputs: [
1506
+ {
1507
+ internalType: "uint256",
1508
+ name: "memoId",
1509
+ type: "uint256"
1510
+ }
931
1511
  ],
932
- stateMutability: "view",
933
- type: "function"
934
- },
935
- {
936
- inputs: [],
937
- name: "memoCounter",
938
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
939
- stateMutability: "view",
940
- type: "function"
941
- },
942
- {
943
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
944
1512
  name: "memoExpiredAt",
945
- outputs: [{ internalType: "uint256", name: "expiredAt", type: "uint256" }],
1513
+ outputs: [
1514
+ {
1515
+ internalType: "uint256",
1516
+ name: "expiredAt",
1517
+ type: "uint256"
1518
+ }
1519
+ ],
946
1520
  stateMutability: "view",
947
1521
  type: "function"
948
1522
  },
949
1523
  {
950
- inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1524
+ inputs: [
1525
+ {
1526
+ internalType: "uint256",
1527
+ name: "",
1528
+ type: "uint256"
1529
+ }
1530
+ ],
951
1531
  name: "memos",
952
1532
  outputs: [
953
- { internalType: "string", name: "content", type: "string" },
1533
+ {
1534
+ internalType: "string",
1535
+ name: "content",
1536
+ type: "string"
1537
+ },
954
1538
  {
955
1539
  internalType: "enum InteractionLedger.MemoType",
956
1540
  name: "memoType",
957
1541
  type: "uint8"
958
1542
  },
959
- { internalType: "bool", name: "isSecured", type: "bool" },
960
- { internalType: "uint8", name: "nextPhase", type: "uint8" },
961
- { internalType: "uint256", name: "jobId", type: "uint256" },
962
- { internalType: "address", name: "sender", type: "address" }
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
+ }
963
1563
  ],
964
1564
  stateMutability: "view",
965
1565
  type: "function"
@@ -967,24 +1567,56 @@ var ACP_ABI = [
967
1567
  {
968
1568
  inputs: [],
969
1569
  name: "numEvaluatorsPerJob",
970
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
1570
+ outputs: [
1571
+ {
1572
+ internalType: "uint8",
1573
+ name: "",
1574
+ type: "uint8"
1575
+ }
1576
+ ],
971
1577
  stateMutability: "view",
972
1578
  type: "function"
973
1579
  },
974
1580
  {
975
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
1581
+ inputs: [
1582
+ {
1583
+ internalType: "uint256",
1584
+ name: "memoId",
1585
+ type: "uint256"
1586
+ }
1587
+ ],
976
1588
  name: "payableDetails",
977
1589
  outputs: [
978
- { internalType: "address", name: "token", type: "address" },
979
- { internalType: "uint256", name: "amount", type: "uint256" },
980
- { internalType: "address", name: "recipient", type: "address" },
981
- { internalType: "uint256", name: "feeAmount", type: "uint256" },
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
+ },
982
1610
  {
983
1611
  internalType: "enum ACPSimple.FeeType",
984
1612
  name: "feeType",
985
1613
  type: "uint8"
986
1614
  },
987
- { internalType: "bool", name: "isExecuted", type: "bool" }
1615
+ {
1616
+ internalType: "bool",
1617
+ name: "isExecuted",
1618
+ type: "bool"
1619
+ }
988
1620
  ],
989
1621
  stateMutability: "view",
990
1622
  type: "function"
@@ -992,28 +1624,54 @@ var ACP_ABI = [
992
1624
  {
993
1625
  inputs: [],
994
1626
  name: "paymentToken",
995
- outputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
1627
+ outputs: [
1628
+ {
1629
+ internalType: "contract IERC20",
1630
+ name: "",
1631
+ type: "address"
1632
+ }
1633
+ ],
996
1634
  stateMutability: "view",
997
1635
  type: "function"
998
1636
  },
999
1637
  {
1000
1638
  inputs: [],
1001
1639
  name: "platformFeeBP",
1002
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1640
+ outputs: [
1641
+ {
1642
+ internalType: "uint256",
1643
+ name: "",
1644
+ type: "uint256"
1645
+ }
1646
+ ],
1003
1647
  stateMutability: "view",
1004
1648
  type: "function"
1005
1649
  },
1006
1650
  {
1007
1651
  inputs: [],
1008
1652
  name: "platformTreasury",
1009
- outputs: [{ internalType: "address", name: "", type: "address" }],
1653
+ outputs: [
1654
+ {
1655
+ internalType: "address",
1656
+ name: "",
1657
+ type: "address"
1658
+ }
1659
+ ],
1010
1660
  stateMutability: "view",
1011
1661
  type: "function"
1012
1662
  },
1013
1663
  {
1014
1664
  inputs: [
1015
- { internalType: "bytes32", name: "role", type: "bytes32" },
1016
- { internalType: "address", name: "callerConfirmation", type: "address" }
1665
+ {
1666
+ internalType: "bytes32",
1667
+ name: "role",
1668
+ type: "bytes32"
1669
+ },
1670
+ {
1671
+ internalType: "address",
1672
+ name: "callerConfirmation",
1673
+ type: "address"
1674
+ }
1017
1675
  ],
1018
1676
  name: "renounceRole",
1019
1677
  outputs: [],
@@ -1022,8 +1680,16 @@ var ACP_ABI = [
1022
1680
  },
1023
1681
  {
1024
1682
  inputs: [
1025
- { internalType: "bytes32", name: "role", type: "bytes32" },
1026
- { internalType: "address", name: "account", type: "address" }
1683
+ {
1684
+ internalType: "bytes32",
1685
+ name: "role",
1686
+ type: "bytes32"
1687
+ },
1688
+ {
1689
+ internalType: "address",
1690
+ name: "account",
1691
+ type: "address"
1692
+ }
1027
1693
  ],
1028
1694
  name: "revokeRole",
1029
1695
  outputs: [],
@@ -1032,8 +1698,16 @@ var ACP_ABI = [
1032
1698
  },
1033
1699
  {
1034
1700
  inputs: [
1035
- { internalType: "uint256", name: "jobId", type: "uint256" },
1036
- { internalType: "uint256", name: "amount", type: "uint256" }
1701
+ {
1702
+ internalType: "uint256",
1703
+ name: "jobId",
1704
+ type: "uint256"
1705
+ },
1706
+ {
1707
+ internalType: "uint256",
1708
+ name: "amount",
1709
+ type: "uint256"
1710
+ }
1037
1711
  ],
1038
1712
  name: "setBudget",
1039
1713
  outputs: [],
@@ -1042,9 +1716,44 @@ var ACP_ABI = [
1042
1716
  },
1043
1717
  {
1044
1718
  inputs: [
1045
- { internalType: "uint256", name: "memoId", type: "uint256" },
1046
- { internalType: "bool", name: "isApproved", type: "bool" },
1047
- { internalType: "string", name: "reason", type: "string" }
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
+ }
1048
1757
  ],
1049
1758
  name: "signMemo",
1050
1759
  outputs: [],
@@ -1053,24 +1762,54 @@ var ACP_ABI = [
1053
1762
  },
1054
1763
  {
1055
1764
  inputs: [
1056
- { internalType: "uint256", name: "memoId", type: "uint256" },
1057
- { internalType: "address", name: "signer", type: "address" }
1765
+ {
1766
+ internalType: "uint256",
1767
+ name: "memoId",
1768
+ type: "uint256"
1769
+ },
1770
+ {
1771
+ internalType: "address",
1772
+ name: "signer",
1773
+ type: "address"
1774
+ }
1058
1775
  ],
1059
1776
  name: "signatories",
1060
- outputs: [{ internalType: "uint8", name: "res", type: "uint8" }],
1777
+ outputs: [
1778
+ {
1779
+ internalType: "uint8",
1780
+ name: "res",
1781
+ type: "uint8"
1782
+ }
1783
+ ],
1061
1784
  stateMutability: "view",
1062
1785
  type: "function"
1063
1786
  },
1064
1787
  {
1065
- inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
1788
+ inputs: [
1789
+ {
1790
+ internalType: "bytes4",
1791
+ name: "interfaceId",
1792
+ type: "bytes4"
1793
+ }
1794
+ ],
1066
1795
  name: "supportsInterface",
1067
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1796
+ outputs: [
1797
+ {
1798
+ internalType: "bool",
1799
+ name: "",
1800
+ type: "bool"
1801
+ }
1802
+ ],
1068
1803
  stateMutability: "view",
1069
1804
  type: "function"
1070
1805
  },
1071
1806
  {
1072
1807
  inputs: [
1073
- { internalType: "uint256", name: "evaluatorFeeBP_", type: "uint256" }
1808
+ {
1809
+ internalType: "uint256",
1810
+ name: "evaluatorFeeBP_",
1811
+ type: "uint256"
1812
+ }
1074
1813
  ],
1075
1814
  name: "updateEvaluatorFee",
1076
1815
  outputs: [],
@@ -1079,8 +1818,16 @@ var ACP_ABI = [
1079
1818
  },
1080
1819
  {
1081
1820
  inputs: [
1082
- { internalType: "uint256", name: "platformFeeBP_", type: "uint256" },
1083
- { internalType: "address", name: "platformTreasury_", type: "address" }
1821
+ {
1822
+ internalType: "uint256",
1823
+ name: "platformFeeBP_",
1824
+ type: "uint256"
1825
+ },
1826
+ {
1827
+ internalType: "address",
1828
+ name: "platformTreasury_",
1829
+ type: "address"
1830
+ }
1084
1831
  ],
1085
1832
  name: "updatePlatformFee",
1086
1833
  outputs: [],
@@ -1088,7 +1835,13 @@ var ACP_ABI = [
1088
1835
  type: "function"
1089
1836
  },
1090
1837
  {
1091
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
1838
+ inputs: [
1839
+ {
1840
+ internalType: "uint256",
1841
+ name: "memoId",
1842
+ type: "uint256"
1843
+ }
1844
+ ],
1092
1845
  name: "withdrawEscrowedFunds",
1093
1846
  outputs: [],
1094
1847
  stateMutability: "nonpayable",
@@ -1098,7 +1851,6 @@ var ACP_ABI = [
1098
1851
  var acpAbi_default = ACP_ABI;
1099
1852
 
1100
1853
  // src/acpClient.ts
1101
- import { parseEther } from "viem";
1102
1854
  import { io } from "socket.io-client";
1103
1855
 
1104
1856
  // src/acpContractClient.ts
@@ -1113,7 +1865,8 @@ import { baseSepolia, base } from "@account-kit/infra";
1113
1865
  var baseSepoliaAcpConfig = {
1114
1866
  chain: baseSepolia,
1115
1867
  contractAddress: "0x8Db6B1c839Fc8f6bd35777E194677B67b4D51928",
1116
- virtualsTokenAddress: "0xbfAB80ccc15DF6fb7185f9498d6039317331846a",
1868
+ paymentTokenAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
1869
+ paymentTokenDecimals: 6,
1117
1870
  alchemyRpcUrl: "https://alchemy-proxy.virtuals.io/api/proxy/rpc",
1118
1871
  acpUrl: "https://acpx.virtuals.gg",
1119
1872
  priorityFeeMultiplier: 2,
@@ -1123,7 +1876,8 @@ var baseSepoliaAcpConfig = {
1123
1876
  var baseAcpConfig = {
1124
1877
  chain: base,
1125
1878
  contractAddress: "0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
1126
- virtualsTokenAddress: "0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b",
1879
+ paymentTokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
1880
+ paymentTokenDecimals: 6,
1127
1881
  alchemyRpcUrl: "https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
1128
1882
  acpUrl: "https://acpx.virtuals.io",
1129
1883
  priorityFeeMultiplier: 2,
@@ -1138,7 +1892,8 @@ import {
1138
1892
  encodeFunctionData,
1139
1893
  erc20Abi,
1140
1894
  fromHex,
1141
- http
1895
+ http,
1896
+ parseUnits
1142
1897
  } from "viem";
1143
1898
  import { publicActionsL2 } from "viem/op-stack";
1144
1899
  var MemoType = /* @__PURE__ */ ((MemoType2) => {
@@ -1173,7 +1928,7 @@ var AcpContractClient = class _AcpContractClient {
1173
1928
  this.MAX_RETRIES = 3;
1174
1929
  this.chain = config.chain;
1175
1930
  this.contractAddress = config.contractAddress;
1176
- this.virtualsTokenAddress = config.virtualsTokenAddress;
1931
+ this.paymentTokenAddress = config.paymentTokenAddress;
1177
1932
  this.customRpcUrl = customRpcUrl;
1178
1933
  this.customRpcClient = createPublicClient({
1179
1934
  chain: this.chain,
@@ -1283,6 +2038,9 @@ var AcpContractClient = class _AcpContractClient {
1283
2038
  return fromHex(contractLogs.data, "number");
1284
2039
  });
1285
2040
  }
2041
+ formatAmount(amount) {
2042
+ return parseUnits(amount.toString(), this.config.paymentTokenDecimals);
2043
+ }
1286
2044
  createJob(providerAddress, evaluatorAddress, expireAt) {
1287
2045
  return __async(this, null, function* () {
1288
2046
  try {
@@ -1304,18 +2062,15 @@ var AcpContractClient = class _AcpContractClient {
1304
2062
  }
1305
2063
  });
1306
2064
  }
1307
- approveAllowance(priceInWei) {
1308
- return __async(this, null, function* () {
2065
+ approveAllowance(_0) {
2066
+ return __async(this, arguments, function* (amount, paymentTokenAddress = this.paymentTokenAddress) {
1309
2067
  try {
1310
2068
  const data = encodeFunctionData({
1311
2069
  abi: erc20Abi,
1312
2070
  functionName: "approve",
1313
- args: [this.contractAddress, priceInWei]
2071
+ args: [this.contractAddress, this.formatAmount(amount)]
1314
2072
  });
1315
- return yield this.handleSendUserOperation(
1316
- data,
1317
- this.virtualsTokenAddress
1318
- );
2073
+ return yield this.handleSendUserOperation(data, paymentTokenAddress);
1319
2074
  } catch (error) {
1320
2075
  console.error(`Failed to approve allowance ${error}`);
1321
2076
  throw new Error("Failed to approve allowance");
@@ -1323,7 +2078,7 @@ var AcpContractClient = class _AcpContractClient {
1323
2078
  });
1324
2079
  }
1325
2080
  createPayableMemo(_0, _1, _2, _3, _4, _5, _6, _7, _8) {
1326
- return __async(this, arguments, function* (jobId, content, amount, recipient, feeAmount, feeType, nextPhase, type, expiredAt, token = this.config.virtualsTokenAddress) {
2081
+ return __async(this, arguments, function* (jobId, content, amount, recipient, feeAmount, feeType, nextPhase, type, expiredAt, token = this.paymentTokenAddress) {
1327
2082
  let retries = 3;
1328
2083
  while (retries > 0) {
1329
2084
  try {
@@ -1334,9 +2089,9 @@ var AcpContractClient = class _AcpContractClient {
1334
2089
  jobId,
1335
2090
  content,
1336
2091
  token,
1337
- amount,
2092
+ this.formatAmount(amount),
1338
2093
  recipient,
1339
- feeAmount,
2094
+ this.formatAmount(feeAmount),
1340
2095
  feeType,
1341
2096
  type,
1342
2097
  nextPhase,
@@ -1423,7 +2178,22 @@ var AcpContractClient = class _AcpContractClient {
1423
2178
  const data = encodeFunctionData({
1424
2179
  abi: acpAbi_default,
1425
2180
  functionName: "setBudget",
1426
- args: [jobId, budget]
2181
+ args: [jobId, this.formatAmount(budget)]
2182
+ });
2183
+ return yield this.handleSendUserOperation(data);
2184
+ } catch (error) {
2185
+ console.error(`Failed to set budget ${error}`);
2186
+ throw new Error("Failed to set budget");
2187
+ }
2188
+ });
2189
+ }
2190
+ setBudgetWithPaymentToken(_0, _1) {
2191
+ return __async(this, arguments, function* (jobId, budget, paymentTokenAddress = this.paymentTokenAddress) {
2192
+ try {
2193
+ const data = encodeFunctionData({
2194
+ abi: acpAbi_default,
2195
+ functionName: "setBudgetWithPaymentToken",
2196
+ args: [jobId, this.formatAmount(budget), paymentTokenAddress]
1427
2197
  });
1428
2198
  return yield this.handleSendUserOperation(data);
1429
2199
  } catch (error) {
@@ -1483,20 +2253,45 @@ function tryParseJson(content) {
1483
2253
 
1484
2254
  // src/acpJob.ts
1485
2255
  var AcpJob = class {
1486
- constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, memos, phase, context) {
2256
+ constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, priceTokenAddress, memos, phase, context) {
1487
2257
  this.acpClient = acpClient;
1488
2258
  this.id = id;
1489
2259
  this.clientAddress = clientAddress;
1490
2260
  this.providerAddress = providerAddress;
1491
2261
  this.evaluatorAddress = evaluatorAddress;
1492
2262
  this.price = price;
2263
+ this.priceTokenAddress = priceTokenAddress;
1493
2264
  this.memos = memos;
1494
2265
  this.phase = phase;
1495
2266
  this.context = context;
1496
2267
  }
1497
2268
  get serviceRequirement() {
1498
2269
  var _a;
1499
- return (_a = this.memos.find((m) => m.nextPhase === 1 /* NEGOTIATION */)) == null ? void 0 : _a.content;
2270
+ const content = (_a = this.memos.find(
2271
+ (m) => m.nextPhase === 1 /* NEGOTIATION */
2272
+ )) == null ? void 0 : _a.content;
2273
+ if (!content) {
2274
+ return void 0;
2275
+ }
2276
+ const contentObj = tryParseJson(content);
2277
+ if (!contentObj) {
2278
+ return content;
2279
+ }
2280
+ if (contentObj.serviceRequirement) {
2281
+ return contentObj.serviceRequirement;
2282
+ }
2283
+ return contentObj;
2284
+ }
2285
+ get serviceName() {
2286
+ var _a;
2287
+ const content = (_a = this.memos.find(
2288
+ (m) => m.nextPhase === 1 /* NEGOTIATION */
2289
+ )) == null ? void 0 : _a.content;
2290
+ if (!content) {
2291
+ return void 0;
2292
+ }
2293
+ const contentObj = tryParseJson(content);
2294
+ return contentObj == null ? void 0 : contentObj.serviceName;
1500
2295
  }
1501
2296
  get deliverable() {
1502
2297
  var _a;
@@ -1832,7 +2627,7 @@ var acpJob_default = AcpJob;
1832
2627
 
1833
2628
  // src/acpMemo.ts
1834
2629
  var AcpMemo = class {
1835
- constructor(acpClient, id, type, content, nextPhase, status, signedReason, expiry) {
2630
+ constructor(acpClient, id, type, content, nextPhase, status, signedReason, expiry, payableDetails) {
1836
2631
  this.acpClient = acpClient;
1837
2632
  this.id = id;
1838
2633
  this.type = type;
@@ -1841,6 +2636,7 @@ var AcpMemo = class {
1841
2636
  this.status = status;
1842
2637
  this.signedReason = signedReason;
1843
2638
  this.expiry = expiry;
2639
+ this.payableDetails = payableDetails;
1844
2640
  this.structuredContent = tryParseJson(this.content) || void 0;
1845
2641
  }
1846
2642
  get payloadType() {
@@ -1962,6 +2758,7 @@ var AcpClient = class {
1962
2758
  data.providerAddress,
1963
2759
  data.evaluatorAddress,
1964
2760
  data.price,
2761
+ data.priceTokenAddress,
1965
2762
  data.memos.map((memo) => {
1966
2763
  return new acpMemo_default(
1967
2764
  this,
@@ -1971,7 +2768,8 @@ var AcpClient = class {
1971
2768
  memo.nextPhase,
1972
2769
  memo.status,
1973
2770
  memo.signedReason,
1974
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
2771
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
2772
+ memo.payableDetails
1975
2773
  );
1976
2774
  }),
1977
2775
  data.phase,
@@ -1993,6 +2791,7 @@ var AcpClient = class {
1993
2791
  data.providerAddress,
1994
2792
  data.evaluatorAddress,
1995
2793
  data.price,
2794
+ data.priceTokenAddress,
1996
2795
  data.memos.map((memo) => {
1997
2796
  return new acpMemo_default(
1998
2797
  this,
@@ -2002,7 +2801,8 @@ var AcpClient = class {
2002
2801
  memo.nextPhase,
2003
2802
  memo.status,
2004
2803
  memo.signedReason,
2005
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
2804
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
2805
+ memo.payableDetails
2006
2806
  );
2007
2807
  }),
2008
2808
  data.phase,
@@ -2060,7 +2860,7 @@ var AcpClient = class {
2060
2860
  this,
2061
2861
  agent.walletAddress,
2062
2862
  offering.name,
2063
- offering.price,
2863
+ offering.priceUsd,
2064
2864
  offering.requirementSchema
2065
2865
  );
2066
2866
  }),
@@ -2078,12 +2878,7 @@ var AcpClient = class {
2078
2878
  evaluatorAddress || this.acpContractClient.walletAddress,
2079
2879
  expiredAt
2080
2880
  );
2081
- if (amount > 0) {
2082
- yield this.acpContractClient.setBudget(
2083
- jobId,
2084
- parseEther(amount.toString())
2085
- );
2086
- }
2881
+ yield this.acpContractClient.setBudgetWithPaymentToken(jobId, amount);
2087
2882
  yield this.acpContractClient.createMemo(
2088
2883
  jobId,
2089
2884
  typeof serviceRequirement === "string" ? serviceRequirement : JSON.stringify(serviceRequirement),
@@ -2112,9 +2907,7 @@ var AcpClient = class {
2112
2907
  payJob(jobId, amount, memoId, reason) {
2113
2908
  return __async(this, null, function* () {
2114
2909
  if (amount > 0) {
2115
- yield this.acpContractClient.approveAllowance(
2116
- parseEther(amount.toString())
2117
- );
2910
+ yield this.acpContractClient.approveAllowance(amount);
2118
2911
  }
2119
2912
  yield this.acpContractClient.signMemo(memoId, true, reason);
2120
2913
  return yield this.acpContractClient.createMemo(
@@ -2131,9 +2924,9 @@ var AcpClient = class {
2131
2924
  return yield this.acpContractClient.createPayableMemo(
2132
2925
  jobId,
2133
2926
  JSON.stringify(reason),
2134
- parseEther(amount.toString()),
2927
+ amount,
2135
2928
  recipient,
2136
- parseEther(feeAmount.toString()),
2929
+ feeAmount,
2137
2930
  feeType,
2138
2931
  nextPhase,
2139
2932
  6 /* PAYABLE_REQUEST */,
@@ -2147,9 +2940,7 @@ var AcpClient = class {
2147
2940
  return yield this.acpContractClient.signMemo(memoId, accept, reason);
2148
2941
  }
2149
2942
  if (amount > 0) {
2150
- yield this.acpContractClient.approveAllowance(
2151
- parseEther(amount.toString())
2152
- );
2943
+ yield this.acpContractClient.approveAllowance(amount);
2153
2944
  }
2154
2945
  return yield this.acpContractClient.signMemo(memoId, true, reason);
2155
2946
  });
@@ -2158,16 +2949,14 @@ var AcpClient = class {
2158
2949
  return __async(this, null, function* () {
2159
2950
  const totalAmount = amount + feeAmount;
2160
2951
  if (totalAmount > 0) {
2161
- yield this.acpContractClient.approveAllowance(
2162
- parseEther(totalAmount.toString())
2163
- );
2952
+ yield this.acpContractClient.approveAllowance(totalAmount);
2164
2953
  }
2165
2954
  return yield this.acpContractClient.createPayableMemo(
2166
2955
  jobId,
2167
2956
  JSON.stringify(reason),
2168
- parseEther(amount.toString()),
2957
+ amount,
2169
2958
  recipient,
2170
- parseEther(feeAmount.toString()),
2959
+ feeAmount,
2171
2960
  feeType,
2172
2961
  nextPhase,
2173
2962
  8 /* PAYABLE_TRANSFER_ESCROW */,
@@ -2223,6 +3012,7 @@ var AcpClient = class {
2223
3012
  job.providerAddress,
2224
3013
  job.evaluatorAddress,
2225
3014
  job.price,
3015
+ job.priceTokenAddress,
2226
3016
  job.memos.map((memo) => {
2227
3017
  return new acpMemo_default(
2228
3018
  this,
@@ -2232,7 +3022,8 @@ var AcpClient = class {
2232
3022
  memo.nextPhase,
2233
3023
  memo.status,
2234
3024
  memo.signedReason,
2235
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3025
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3026
+ memo.payableDetails
2236
3027
  );
2237
3028
  }),
2238
3029
  job.phase,
@@ -2265,6 +3056,7 @@ var AcpClient = class {
2265
3056
  job.providerAddress,
2266
3057
  job.evaluatorAddress,
2267
3058
  job.price,
3059
+ job.priceTokenAddress,
2268
3060
  job.memos.map((memo) => {
2269
3061
  return new acpMemo_default(
2270
3062
  this,
@@ -2274,7 +3066,8 @@ var AcpClient = class {
2274
3066
  memo.nextPhase,
2275
3067
  memo.status,
2276
3068
  memo.signedReason,
2277
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3069
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3070
+ memo.payableDetails
2278
3071
  );
2279
3072
  }),
2280
3073
  job.phase,
@@ -2307,6 +3100,7 @@ var AcpClient = class {
2307
3100
  job.providerAddress,
2308
3101
  job.evaluatorAddress,
2309
3102
  job.price,
3103
+ job.priceTokenAddress,
2310
3104
  job.memos.map((memo) => {
2311
3105
  return new acpMemo_default(
2312
3106
  this,
@@ -2316,7 +3110,8 @@ var AcpClient = class {
2316
3110
  memo.nextPhase,
2317
3111
  memo.status,
2318
3112
  memo.signedReason,
2319
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3113
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3114
+ memo.payableDetails
2320
3115
  );
2321
3116
  }),
2322
3117
  job.phase,
@@ -2352,6 +3147,7 @@ var AcpClient = class {
2352
3147
  job.providerAddress,
2353
3148
  job.evaluatorAddress,
2354
3149
  job.price,
3150
+ job.priceTokenAddress,
2355
3151
  job.memos.map((memo) => {
2356
3152
  return new acpMemo_default(
2357
3153
  this,
@@ -2361,7 +3157,8 @@ var AcpClient = class {
2361
3157
  memo.nextPhase,
2362
3158
  memo.status,
2363
3159
  memo.signedReason,
2364
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3160
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3161
+ memo.payableDetails
2365
3162
  );
2366
3163
  }),
2367
3164
  job.phase,
@@ -2397,7 +3194,8 @@ var AcpClient = class {
2397
3194
  memo.nextPhase,
2398
3195
  memo.status,
2399
3196
  memo.signedReason,
2400
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3197
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3198
+ memo.payableDetails
2401
3199
  );
2402
3200
  } catch (error) {
2403
3201
  throw error;