@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.js CHANGED
@@ -72,7 +72,7 @@ var require_package = __commonJS({
72
72
  "package.json"(exports2, module2) {
73
73
  module2.exports = {
74
74
  name: "@virtuals-protocol/acp-node",
75
- version: "0.2.0-beta.6",
75
+ version: "0.2.0-beta.7",
76
76
  main: "./dist/index.js",
77
77
  module: "./dist/index.mjs",
78
78
  types: "./dist/index.d.ts",
@@ -124,32 +124,82 @@ module.exports = __toCommonJS(index_exports);
124
124
 
125
125
  // src/acpAbi.ts
126
126
  var ACP_ABI = [
127
- { inputs: [], stateMutability: "nonpayable", type: "constructor" },
128
- { inputs: [], name: "AccessControlBadConfirmation", type: "error" },
127
+ {
128
+ inputs: [],
129
+ stateMutability: "nonpayable",
130
+ type: "constructor"
131
+ },
132
+ {
133
+ inputs: [],
134
+ name: "AccessControlBadConfirmation",
135
+ type: "error"
136
+ },
129
137
  {
130
138
  inputs: [
131
- { internalType: "address", name: "account", type: "address" },
132
- { internalType: "bytes32", name: "neededRole", type: "bytes32" }
139
+ {
140
+ internalType: "address",
141
+ name: "account",
142
+ type: "address"
143
+ },
144
+ {
145
+ internalType: "bytes32",
146
+ name: "neededRole",
147
+ type: "bytes32"
148
+ }
133
149
  ],
134
150
  name: "AccessControlUnauthorizedAccount",
135
151
  type: "error"
136
152
  },
137
153
  {
138
- inputs: [{ internalType: "address", name: "target", type: "address" }],
154
+ inputs: [
155
+ {
156
+ internalType: "address",
157
+ name: "target",
158
+ type: "address"
159
+ }
160
+ ],
139
161
  name: "AddressEmptyCode",
140
162
  type: "error"
141
163
  },
142
164
  {
143
- inputs: [{ internalType: "address", name: "account", type: "address" }],
165
+ inputs: [
166
+ {
167
+ internalType: "address",
168
+ name: "account",
169
+ type: "address"
170
+ }
171
+ ],
144
172
  name: "AddressInsufficientBalance",
145
173
  type: "error"
146
174
  },
147
- { inputs: [], name: "FailedInnerCall", type: "error" },
148
- { inputs: [], name: "InvalidInitialization", type: "error" },
149
- { inputs: [], name: "NotInitializing", type: "error" },
150
- { inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
151
175
  {
152
- inputs: [{ internalType: "address", name: "token", type: "address" }],
176
+ inputs: [],
177
+ name: "FailedInnerCall",
178
+ type: "error"
179
+ },
180
+ {
181
+ inputs: [],
182
+ name: "InvalidInitialization",
183
+ type: "error"
184
+ },
185
+ {
186
+ inputs: [],
187
+ name: "NotInitializing",
188
+ type: "error"
189
+ },
190
+ {
191
+ inputs: [],
192
+ name: "ReentrancyGuardReentrantCall",
193
+ type: "error"
194
+ },
195
+ {
196
+ inputs: [
197
+ {
198
+ internalType: "address",
199
+ name: "token",
200
+ type: "address"
201
+ }
202
+ ],
153
203
  name: "SafeERC20FailedOperation",
154
204
  type: "error"
155
205
  },
@@ -266,6 +316,25 @@ var ACP_ABI = [
266
316
  name: "JobCreated",
267
317
  type: "event"
268
318
  },
319
+ {
320
+ anonymous: false,
321
+ inputs: [
322
+ {
323
+ indexed: true,
324
+ internalType: "uint256",
325
+ name: "jobId",
326
+ type: "uint256"
327
+ },
328
+ {
329
+ indexed: true,
330
+ internalType: "address",
331
+ name: "paymentToken",
332
+ type: "address"
333
+ }
334
+ ],
335
+ name: "JobPaymentTokenSet",
336
+ type: "event"
337
+ },
269
338
  {
270
339
  anonymous: false,
271
340
  inputs: [
@@ -281,7 +350,12 @@ var ACP_ABI = [
281
350
  name: "oldPhase",
282
351
  type: "uint8"
283
352
  },
284
- { indexed: false, internalType: "uint8", name: "phase", type: "uint8" }
353
+ {
354
+ indexed: false,
355
+ internalType: "uint8",
356
+ name: "phase",
357
+ type: "uint8"
358
+ }
285
359
  ],
286
360
  name: "JobPhaseUpdated",
287
361
  type: "event"
@@ -468,8 +542,18 @@ var ACP_ABI = [
468
542
  name: "memoId",
469
543
  type: "uint256"
470
544
  },
471
- { indexed: true, internalType: "address", name: "from", type: "address" },
472
- { indexed: false, internalType: "address", name: "to", type: "address" },
545
+ {
546
+ indexed: true,
547
+ internalType: "address",
548
+ name: "from",
549
+ type: "address"
550
+ },
551
+ {
552
+ indexed: false,
553
+ internalType: "address",
554
+ name: "to",
555
+ type: "address"
556
+ },
473
557
  {
474
558
  indexed: false,
475
559
  internalType: "address",
@@ -501,8 +585,18 @@ var ACP_ABI = [
501
585
  name: "memoId",
502
586
  type: "uint256"
503
587
  },
504
- { indexed: true, internalType: "address", name: "from", type: "address" },
505
- { indexed: false, internalType: "address", name: "to", type: "address" },
588
+ {
589
+ indexed: true,
590
+ internalType: "address",
591
+ name: "from",
592
+ type: "address"
593
+ },
594
+ {
595
+ indexed: false,
596
+ internalType: "address",
597
+ name: "to",
598
+ type: "address"
599
+ },
506
600
  {
507
601
  indexed: false,
508
602
  internalType: "address",
@@ -572,7 +666,12 @@ var ACP_ABI = [
572
666
  {
573
667
  anonymous: false,
574
668
  inputs: [
575
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
669
+ {
670
+ indexed: true,
671
+ internalType: "bytes32",
672
+ name: "role",
673
+ type: "bytes32"
674
+ },
576
675
  {
577
676
  indexed: true,
578
677
  internalType: "bytes32",
@@ -592,7 +691,12 @@ var ACP_ABI = [
592
691
  {
593
692
  anonymous: false,
594
693
  inputs: [
595
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
694
+ {
695
+ indexed: true,
696
+ internalType: "bytes32",
697
+ name: "role",
698
+ type: "bytes32"
699
+ },
596
700
  {
597
701
  indexed: true,
598
702
  internalType: "address",
@@ -612,7 +716,12 @@ var ACP_ABI = [
612
716
  {
613
717
  anonymous: false,
614
718
  inputs: [
615
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
719
+ {
720
+ indexed: true,
721
+ internalType: "bytes32",
722
+ name: "role",
723
+ type: "bytes32"
724
+ },
616
725
  {
617
726
  indexed: true,
618
727
  internalType: "address",
@@ -632,87 +741,192 @@ var ACP_ABI = [
632
741
  {
633
742
  inputs: [],
634
743
  name: "ADMIN_ROLE",
635
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
744
+ outputs: [
745
+ {
746
+ internalType: "bytes32",
747
+ name: "",
748
+ type: "bytes32"
749
+ }
750
+ ],
636
751
  stateMutability: "view",
637
752
  type: "function"
638
753
  },
639
754
  {
640
755
  inputs: [],
641
756
  name: "DEFAULT_ADMIN_ROLE",
642
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
757
+ outputs: [
758
+ {
759
+ internalType: "bytes32",
760
+ name: "",
761
+ type: "bytes32"
762
+ }
763
+ ],
643
764
  stateMutability: "view",
644
765
  type: "function"
645
766
  },
646
767
  {
647
768
  inputs: [],
648
769
  name: "PHASE_COMPLETED",
649
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
770
+ outputs: [
771
+ {
772
+ internalType: "uint8",
773
+ name: "",
774
+ type: "uint8"
775
+ }
776
+ ],
650
777
  stateMutability: "view",
651
778
  type: "function"
652
779
  },
653
780
  {
654
781
  inputs: [],
655
782
  name: "PHASE_EVALUATION",
656
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
783
+ outputs: [
784
+ {
785
+ internalType: "uint8",
786
+ name: "",
787
+ type: "uint8"
788
+ }
789
+ ],
657
790
  stateMutability: "view",
658
791
  type: "function"
659
792
  },
660
793
  {
661
794
  inputs: [],
662
795
  name: "PHASE_EXPIRED",
663
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
796
+ outputs: [
797
+ {
798
+ internalType: "uint8",
799
+ name: "",
800
+ type: "uint8"
801
+ }
802
+ ],
664
803
  stateMutability: "view",
665
804
  type: "function"
666
805
  },
667
806
  {
668
807
  inputs: [],
669
808
  name: "PHASE_NEGOTIATION",
670
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
809
+ outputs: [
810
+ {
811
+ internalType: "uint8",
812
+ name: "",
813
+ type: "uint8"
814
+ }
815
+ ],
671
816
  stateMutability: "view",
672
817
  type: "function"
673
818
  },
674
819
  {
675
820
  inputs: [],
676
821
  name: "PHASE_REJECTED",
677
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
822
+ outputs: [
823
+ {
824
+ internalType: "uint8",
825
+ name: "",
826
+ type: "uint8"
827
+ }
828
+ ],
678
829
  stateMutability: "view",
679
830
  type: "function"
680
831
  },
681
832
  {
682
833
  inputs: [],
683
834
  name: "PHASE_REQUEST",
684
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
835
+ outputs: [
836
+ {
837
+ internalType: "uint8",
838
+ name: "",
839
+ type: "uint8"
840
+ }
841
+ ],
685
842
  stateMutability: "view",
686
843
  type: "function"
687
844
  },
688
845
  {
689
846
  inputs: [],
690
847
  name: "PHASE_TRANSACTION",
691
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
848
+ outputs: [
849
+ {
850
+ internalType: "uint8",
851
+ name: "",
852
+ type: "uint8"
853
+ }
854
+ ],
692
855
  stateMutability: "view",
693
856
  type: "function"
694
857
  },
695
858
  {
696
859
  inputs: [],
697
860
  name: "TOTAL_PHASES",
698
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
861
+ outputs: [
862
+ {
863
+ internalType: "uint8",
864
+ name: "",
865
+ type: "uint8"
866
+ }
867
+ ],
699
868
  stateMutability: "view",
700
869
  type: "function"
701
870
  },
702
871
  {
703
872
  inputs: [
704
- { internalType: "address", name: "account", type: "address" },
873
+ {
874
+ internalType: "address",
875
+ name: "account",
876
+ type: "address"
877
+ },
705
878
  {
706
879
  components: [
707
- { internalType: "uint256", name: "id", type: "uint256" },
708
- { internalType: "address", name: "client", type: "address" },
709
- { internalType: "address", name: "provider", type: "address" },
710
- { internalType: "uint256", name: "budget", type: "uint256" },
711
- { internalType: "uint256", name: "amountClaimed", type: "uint256" },
712
- { internalType: "uint8", name: "phase", type: "uint8" },
713
- { internalType: "uint256", name: "memoCount", type: "uint256" },
714
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
715
- { internalType: "address", name: "evaluator", type: "address" }
880
+ {
881
+ internalType: "uint256",
882
+ name: "id",
883
+ type: "uint256"
884
+ },
885
+ {
886
+ internalType: "address",
887
+ name: "client",
888
+ type: "address"
889
+ },
890
+ {
891
+ internalType: "address",
892
+ name: "provider",
893
+ type: "address"
894
+ },
895
+ {
896
+ internalType: "uint256",
897
+ name: "budget",
898
+ type: "uint256"
899
+ },
900
+ {
901
+ internalType: "uint256",
902
+ name: "amountClaimed",
903
+ type: "uint256"
904
+ },
905
+ {
906
+ internalType: "uint8",
907
+ name: "phase",
908
+ type: "uint8"
909
+ },
910
+ {
911
+ internalType: "uint256",
912
+ name: "memoCount",
913
+ type: "uint256"
914
+ },
915
+ {
916
+ internalType: "uint256",
917
+ name: "expiredAt",
918
+ type: "uint256"
919
+ },
920
+ {
921
+ internalType: "address",
922
+ name: "evaluator",
923
+ type: "address"
924
+ },
925
+ {
926
+ internalType: "contract IERC20",
927
+ name: "jobPaymentToken",
928
+ type: "address"
929
+ }
716
930
  ],
717
931
  internalType: "struct ACPSimple.Job",
718
932
  name: "job",
@@ -720,12 +934,24 @@ var ACP_ABI = [
720
934
  }
721
935
  ],
722
936
  name: "canSign",
723
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
937
+ outputs: [
938
+ {
939
+ internalType: "bool",
940
+ name: "",
941
+ type: "bool"
942
+ }
943
+ ],
724
944
  stateMutability: "pure",
725
945
  type: "function"
726
946
  },
727
947
  {
728
- inputs: [{ internalType: "uint256", name: "id", type: "uint256" }],
948
+ inputs: [
949
+ {
950
+ internalType: "uint256",
951
+ name: "id",
952
+ type: "uint256"
953
+ }
954
+ ],
729
955
  name: "claimBudget",
730
956
  outputs: [],
731
957
  stateMutability: "nonpayable",
@@ -733,132 +959,306 @@ var ACP_ABI = [
733
959
  },
734
960
  {
735
961
  inputs: [
736
- { internalType: "address", name: "provider", type: "address" },
737
- { internalType: "address", name: "evaluator", type: "address" },
738
- { internalType: "uint256", name: "expiredAt", type: "uint256" }
962
+ {
963
+ internalType: "address",
964
+ name: "provider",
965
+ type: "address"
966
+ },
967
+ {
968
+ internalType: "address",
969
+ name: "evaluator",
970
+ type: "address"
971
+ },
972
+ {
973
+ internalType: "uint256",
974
+ name: "expiredAt",
975
+ type: "uint256"
976
+ }
739
977
  ],
740
978
  name: "createJob",
741
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
742
- stateMutability: "nonpayable",
743
- type: "function"
744
- },
745
- {
746
- inputs: [
747
- { internalType: "uint256", name: "jobId", type: "uint256" },
748
- { internalType: "string", name: "content", type: "string" },
979
+ outputs: [
749
980
  {
750
- internalType: "enum InteractionLedger.MemoType",
751
- name: "memoType",
752
- type: "uint8"
753
- },
754
- { internalType: "bool", name: "isSecured", type: "bool" },
755
- { internalType: "uint8", name: "nextPhase", type: "uint8" }
981
+ internalType: "uint256",
982
+ name: "",
983
+ type: "uint256"
984
+ }
756
985
  ],
757
- name: "createMemo",
758
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
759
986
  stateMutability: "nonpayable",
760
987
  type: "function"
761
988
  },
762
989
  {
763
990
  inputs: [
764
- { internalType: "uint256", name: "jobId", type: "uint256" },
765
- { internalType: "string", name: "content", type: "string" },
766
- { internalType: "address", name: "token", type: "address" },
767
- { internalType: "uint256", name: "amount", type: "uint256" },
768
- { internalType: "address", name: "recipient", type: "address" },
769
- { internalType: "uint256", name: "feeAmount", type: "uint256" },
770
991
  {
771
- internalType: "enum ACPSimple.FeeType",
772
- name: "feeType",
773
- type: "uint8"
992
+ internalType: "uint256",
993
+ name: "jobId",
994
+ type: "uint256"
774
995
  },
775
996
  {
776
- internalType: "enum InteractionLedger.MemoType",
777
- name: "memoType",
997
+ internalType: "string",
998
+ name: "content",
999
+ type: "string"
1000
+ },
1001
+ {
1002
+ internalType: "enum InteractionLedger.MemoType",
1003
+ name: "memoType",
1004
+ type: "uint8"
1005
+ },
1006
+ {
1007
+ internalType: "bool",
1008
+ name: "isSecured",
1009
+ type: "bool"
1010
+ },
1011
+ {
1012
+ internalType: "uint8",
1013
+ name: "nextPhase",
1014
+ type: "uint8"
1015
+ }
1016
+ ],
1017
+ name: "createMemo",
1018
+ outputs: [
1019
+ {
1020
+ internalType: "uint256",
1021
+ name: "",
1022
+ type: "uint256"
1023
+ }
1024
+ ],
1025
+ stateMutability: "nonpayable",
1026
+ type: "function"
1027
+ },
1028
+ {
1029
+ inputs: [
1030
+ {
1031
+ internalType: "uint256",
1032
+ name: "jobId",
1033
+ type: "uint256"
1034
+ },
1035
+ {
1036
+ internalType: "string",
1037
+ name: "content",
1038
+ type: "string"
1039
+ },
1040
+ {
1041
+ internalType: "address",
1042
+ name: "token",
1043
+ type: "address"
1044
+ },
1045
+ {
1046
+ internalType: "uint256",
1047
+ name: "amount",
1048
+ type: "uint256"
1049
+ },
1050
+ {
1051
+ internalType: "address",
1052
+ name: "recipient",
1053
+ type: "address"
1054
+ },
1055
+ {
1056
+ internalType: "uint256",
1057
+ name: "feeAmount",
1058
+ type: "uint256"
1059
+ },
1060
+ {
1061
+ internalType: "enum ACPSimple.FeeType",
1062
+ name: "feeType",
1063
+ type: "uint8"
1064
+ },
1065
+ {
1066
+ internalType: "enum InteractionLedger.MemoType",
1067
+ name: "memoType",
778
1068
  type: "uint8"
779
1069
  },
780
- { internalType: "uint8", name: "nextPhase", type: "uint8" },
781
- { internalType: "uint256", name: "expiredAt", type: "uint256" }
1070
+ {
1071
+ internalType: "uint8",
1072
+ name: "nextPhase",
1073
+ type: "uint8"
1074
+ },
1075
+ {
1076
+ internalType: "uint256",
1077
+ name: "expiredAt",
1078
+ type: "uint256"
1079
+ }
782
1080
  ],
783
1081
  name: "createPayableMemo",
784
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1082
+ outputs: [
1083
+ {
1084
+ internalType: "uint256",
1085
+ name: "",
1086
+ type: "uint256"
1087
+ }
1088
+ ],
785
1089
  stateMutability: "nonpayable",
786
1090
  type: "function"
787
1091
  },
788
1092
  {
789
1093
  inputs: [],
790
1094
  name: "evaluatorFeeBP",
791
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1095
+ outputs: [
1096
+ {
1097
+ internalType: "uint256",
1098
+ name: "",
1099
+ type: "uint256"
1100
+ }
1101
+ ],
792
1102
  stateMutability: "view",
793
1103
  type: "function"
794
1104
  },
795
1105
  {
796
1106
  inputs: [
797
- { internalType: "uint256", name: "jobId", type: "uint256" },
798
- { internalType: "uint256", name: "offset", type: "uint256" },
799
- { internalType: "uint256", name: "limit", type: "uint256" }
1107
+ {
1108
+ internalType: "uint256",
1109
+ name: "jobId",
1110
+ type: "uint256"
1111
+ },
1112
+ {
1113
+ internalType: "uint256",
1114
+ name: "offset",
1115
+ type: "uint256"
1116
+ },
1117
+ {
1118
+ internalType: "uint256",
1119
+ name: "limit",
1120
+ type: "uint256"
1121
+ }
800
1122
  ],
801
1123
  name: "getAllMemos",
802
1124
  outputs: [
803
1125
  {
804
1126
  components: [
805
- { internalType: "string", name: "content", type: "string" },
1127
+ {
1128
+ internalType: "string",
1129
+ name: "content",
1130
+ type: "string"
1131
+ },
806
1132
  {
807
1133
  internalType: "enum InteractionLedger.MemoType",
808
1134
  name: "memoType",
809
1135
  type: "uint8"
810
1136
  },
811
- { internalType: "bool", name: "isSecured", type: "bool" },
812
- { internalType: "uint8", name: "nextPhase", type: "uint8" },
813
- { internalType: "uint256", name: "jobId", type: "uint256" },
814
- { internalType: "address", name: "sender", type: "address" }
1137
+ {
1138
+ internalType: "bool",
1139
+ name: "isSecured",
1140
+ type: "bool"
1141
+ },
1142
+ {
1143
+ internalType: "uint8",
1144
+ name: "nextPhase",
1145
+ type: "uint8"
1146
+ },
1147
+ {
1148
+ internalType: "uint256",
1149
+ name: "jobId",
1150
+ type: "uint256"
1151
+ },
1152
+ {
1153
+ internalType: "address",
1154
+ name: "sender",
1155
+ type: "address"
1156
+ }
815
1157
  ],
816
1158
  internalType: "struct InteractionLedger.Memo[]",
817
1159
  name: "",
818
1160
  type: "tuple[]"
819
1161
  },
820
- { internalType: "uint256", name: "total", type: "uint256" }
1162
+ {
1163
+ internalType: "uint256",
1164
+ name: "total",
1165
+ type: "uint256"
1166
+ }
821
1167
  ],
822
1168
  stateMutability: "view",
823
1169
  type: "function"
824
1170
  },
825
1171
  {
826
1172
  inputs: [
827
- { internalType: "uint256", name: "jobId", type: "uint256" },
828
- { internalType: "uint8", name: "phase", type: "uint8" }
1173
+ {
1174
+ internalType: "uint256",
1175
+ name: "jobId",
1176
+ type: "uint256"
1177
+ },
1178
+ {
1179
+ internalType: "uint8",
1180
+ name: "phase",
1181
+ type: "uint8"
1182
+ }
829
1183
  ],
830
1184
  name: "getJobPhaseMemoIds",
831
- outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }],
1185
+ outputs: [
1186
+ {
1187
+ internalType: "uint256[]",
1188
+ name: "",
1189
+ type: "uint256[]"
1190
+ }
1191
+ ],
832
1192
  stateMutability: "view",
833
1193
  type: "function"
834
1194
  },
835
1195
  {
836
1196
  inputs: [
837
- { internalType: "uint256", name: "jobId", type: "uint256" },
838
- { internalType: "uint8", name: "phase", type: "uint8" },
839
- { internalType: "uint256", name: "offset", type: "uint256" },
840
- { internalType: "uint256", name: "limit", type: "uint256" }
1197
+ {
1198
+ internalType: "uint256",
1199
+ name: "jobId",
1200
+ type: "uint256"
1201
+ },
1202
+ {
1203
+ internalType: "uint8",
1204
+ name: "phase",
1205
+ type: "uint8"
1206
+ },
1207
+ {
1208
+ internalType: "uint256",
1209
+ name: "offset",
1210
+ type: "uint256"
1211
+ },
1212
+ {
1213
+ internalType: "uint256",
1214
+ name: "limit",
1215
+ type: "uint256"
1216
+ }
841
1217
  ],
842
1218
  name: "getMemosForPhase",
843
1219
  outputs: [
844
1220
  {
845
1221
  components: [
846
- { internalType: "string", name: "content", type: "string" },
1222
+ {
1223
+ internalType: "string",
1224
+ name: "content",
1225
+ type: "string"
1226
+ },
847
1227
  {
848
1228
  internalType: "enum InteractionLedger.MemoType",
849
1229
  name: "memoType",
850
1230
  type: "uint8"
851
1231
  },
852
- { internalType: "bool", name: "isSecured", type: "bool" },
853
- { internalType: "uint8", name: "nextPhase", type: "uint8" },
854
- { internalType: "uint256", name: "jobId", type: "uint256" },
855
- { internalType: "address", name: "sender", type: "address" }
1232
+ {
1233
+ internalType: "bool",
1234
+ name: "isSecured",
1235
+ type: "bool"
1236
+ },
1237
+ {
1238
+ internalType: "uint8",
1239
+ name: "nextPhase",
1240
+ type: "uint8"
1241
+ },
1242
+ {
1243
+ internalType: "uint256",
1244
+ name: "jobId",
1245
+ type: "uint256"
1246
+ },
1247
+ {
1248
+ internalType: "address",
1249
+ name: "sender",
1250
+ type: "address"
1251
+ }
856
1252
  ],
857
1253
  internalType: "struct InteractionLedger.Memo[]",
858
1254
  name: "",
859
1255
  type: "tuple[]"
860
1256
  },
861
- { internalType: "uint256", name: "total", type: "uint256" }
1257
+ {
1258
+ internalType: "uint256",
1259
+ name: "total",
1260
+ type: "uint256"
1261
+ }
862
1262
  ],
863
1263
  stateMutability: "view",
864
1264
  type: "function"
@@ -866,21 +1266,47 @@ var ACP_ABI = [
866
1266
  {
867
1267
  inputs: [],
868
1268
  name: "getPhases",
869
- outputs: [{ internalType: "string[7]", name: "", type: "string[7]" }],
1269
+ outputs: [
1270
+ {
1271
+ internalType: "string[7]",
1272
+ name: "",
1273
+ type: "string[7]"
1274
+ }
1275
+ ],
870
1276
  stateMutability: "pure",
871
1277
  type: "function"
872
1278
  },
873
1279
  {
874
- inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
1280
+ inputs: [
1281
+ {
1282
+ internalType: "bytes32",
1283
+ name: "role",
1284
+ type: "bytes32"
1285
+ }
1286
+ ],
875
1287
  name: "getRoleAdmin",
876
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
1288
+ outputs: [
1289
+ {
1290
+ internalType: "bytes32",
1291
+ name: "",
1292
+ type: "bytes32"
1293
+ }
1294
+ ],
877
1295
  stateMutability: "view",
878
1296
  type: "function"
879
1297
  },
880
1298
  {
881
1299
  inputs: [
882
- { internalType: "bytes32", name: "role", type: "bytes32" },
883
- { internalType: "address", name: "account", type: "address" }
1300
+ {
1301
+ internalType: "bytes32",
1302
+ name: "role",
1303
+ type: "bytes32"
1304
+ },
1305
+ {
1306
+ internalType: "address",
1307
+ name: "account",
1308
+ type: "address"
1309
+ }
884
1310
  ],
885
1311
  name: "grantRole",
886
1312
  outputs: [],
@@ -889,20 +1315,50 @@ var ACP_ABI = [
889
1315
  },
890
1316
  {
891
1317
  inputs: [
892
- { internalType: "bytes32", name: "role", type: "bytes32" },
893
- { internalType: "address", name: "account", type: "address" }
1318
+ {
1319
+ internalType: "bytes32",
1320
+ name: "role",
1321
+ type: "bytes32"
1322
+ },
1323
+ {
1324
+ internalType: "address",
1325
+ name: "account",
1326
+ type: "address"
1327
+ }
894
1328
  ],
895
1329
  name: "hasRole",
896
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1330
+ outputs: [
1331
+ {
1332
+ internalType: "bool",
1333
+ name: "",
1334
+ type: "bool"
1335
+ }
1336
+ ],
897
1337
  stateMutability: "view",
898
1338
  type: "function"
899
1339
  },
900
1340
  {
901
1341
  inputs: [
902
- { internalType: "address", name: "paymentTokenAddress", type: "address" },
903
- { internalType: "uint256", name: "evaluatorFeeBP_", type: "uint256" },
904
- { internalType: "uint256", name: "platformFeeBP_", type: "uint256" },
905
- { internalType: "address", name: "platformTreasury_", type: "address" }
1342
+ {
1343
+ internalType: "address",
1344
+ name: "paymentTokenAddress",
1345
+ type: "address"
1346
+ },
1347
+ {
1348
+ internalType: "uint256",
1349
+ name: "evaluatorFeeBP_",
1350
+ type: "uint256"
1351
+ },
1352
+ {
1353
+ internalType: "uint256",
1354
+ name: "platformFeeBP_",
1355
+ type: "uint256"
1356
+ },
1357
+ {
1358
+ internalType: "address",
1359
+ name: "platformTreasury_",
1360
+ type: "address"
1361
+ }
906
1362
  ],
907
1363
  name: "initialize",
908
1364
  outputs: [],
@@ -911,100 +1367,244 @@ var ACP_ABI = [
911
1367
  },
912
1368
  {
913
1369
  inputs: [
914
- { internalType: "uint256", name: "jobId", type: "uint256" },
915
- { internalType: "address", name: "account", type: "address" }
1370
+ {
1371
+ internalType: "uint256",
1372
+ name: "jobId",
1373
+ type: "uint256"
1374
+ },
1375
+ {
1376
+ internalType: "address",
1377
+ name: "account",
1378
+ type: "address"
1379
+ }
916
1380
  ],
917
1381
  name: "isJobEvaluator",
918
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1382
+ outputs: [
1383
+ {
1384
+ internalType: "bool",
1385
+ name: "",
1386
+ type: "bool"
1387
+ }
1388
+ ],
919
1389
  stateMutability: "view",
920
1390
  type: "function"
921
1391
  },
922
1392
  {
923
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
1393
+ inputs: [
1394
+ {
1395
+ internalType: "uint256",
1396
+ name: "memoId",
1397
+ type: "uint256"
1398
+ }
1399
+ ],
924
1400
  name: "isPayableMemo",
925
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1401
+ outputs: [
1402
+ {
1403
+ internalType: "bool",
1404
+ name: "",
1405
+ type: "bool"
1406
+ }
1407
+ ],
926
1408
  stateMutability: "view",
927
1409
  type: "function"
928
1410
  },
929
1411
  {
930
- inputs: [{ internalType: "uint256", name: "jobId", type: "uint256" }],
1412
+ inputs: [
1413
+ {
1414
+ internalType: "uint256",
1415
+ name: "jobId",
1416
+ type: "uint256"
1417
+ }
1418
+ ],
931
1419
  name: "jobAdditionalFees",
932
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1420
+ outputs: [
1421
+ {
1422
+ internalType: "uint256",
1423
+ name: "",
1424
+ type: "uint256"
1425
+ }
1426
+ ],
933
1427
  stateMutability: "view",
934
1428
  type: "function"
935
1429
  },
936
1430
  {
937
1431
  inputs: [],
938
1432
  name: "jobCounter",
939
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1433
+ outputs: [
1434
+ {
1435
+ internalType: "uint256",
1436
+ name: "",
1437
+ type: "uint256"
1438
+ }
1439
+ ],
1440
+ stateMutability: "view",
1441
+ type: "function"
1442
+ },
1443
+ {
1444
+ inputs: [
1445
+ {
1446
+ internalType: "uint256",
1447
+ name: "jobId",
1448
+ type: "uint256"
1449
+ },
1450
+ {
1451
+ internalType: "uint8",
1452
+ name: "phase",
1453
+ type: "uint8"
1454
+ },
1455
+ {
1456
+ internalType: "uint256",
1457
+ name: "",
1458
+ type: "uint256"
1459
+ }
1460
+ ],
1461
+ name: "jobMemoIds",
1462
+ outputs: [
1463
+ {
1464
+ internalType: "uint256",
1465
+ name: "memoIds",
1466
+ type: "uint256"
1467
+ }
1468
+ ],
940
1469
  stateMutability: "view",
941
1470
  type: "function"
942
1471
  },
943
1472
  {
944
1473
  inputs: [
945
- { internalType: "uint256", name: "jobId", type: "uint256" },
946
- { internalType: "uint8", name: "phase", type: "uint8" },
947
- { internalType: "uint256", name: "", type: "uint256" }
1474
+ {
1475
+ internalType: "uint256",
1476
+ name: "",
1477
+ type: "uint256"
1478
+ }
1479
+ ],
1480
+ name: "jobs",
1481
+ outputs: [
1482
+ {
1483
+ internalType: "uint256",
1484
+ name: "id",
1485
+ type: "uint256"
1486
+ },
1487
+ {
1488
+ internalType: "address",
1489
+ name: "client",
1490
+ type: "address"
1491
+ },
1492
+ {
1493
+ internalType: "address",
1494
+ name: "provider",
1495
+ type: "address"
1496
+ },
1497
+ {
1498
+ internalType: "uint256",
1499
+ name: "budget",
1500
+ type: "uint256"
1501
+ },
1502
+ {
1503
+ internalType: "uint256",
1504
+ name: "amountClaimed",
1505
+ type: "uint256"
1506
+ },
1507
+ {
1508
+ internalType: "uint8",
1509
+ name: "phase",
1510
+ type: "uint8"
1511
+ },
1512
+ {
1513
+ internalType: "uint256",
1514
+ name: "memoCount",
1515
+ type: "uint256"
1516
+ },
1517
+ {
1518
+ internalType: "uint256",
1519
+ name: "expiredAt",
1520
+ type: "uint256"
1521
+ },
1522
+ {
1523
+ internalType: "address",
1524
+ name: "evaluator",
1525
+ type: "address"
1526
+ },
1527
+ {
1528
+ internalType: "contract IERC20",
1529
+ name: "jobPaymentToken",
1530
+ type: "address"
1531
+ }
948
1532
  ],
949
- name: "jobMemoIds",
950
- outputs: [{ internalType: "uint256", name: "memoIds", type: "uint256" }],
951
1533
  stateMutability: "view",
952
1534
  type: "function"
953
1535
  },
954
1536
  {
955
- inputs: [{ internalType: "uint256", name: "jobId", type: "uint256" }],
956
- name: "jobPayment",
1537
+ inputs: [],
1538
+ name: "memoCounter",
957
1539
  outputs: [
958
- { internalType: "address", name: "paymentToken", type: "address" }
1540
+ {
1541
+ internalType: "uint256",
1542
+ name: "",
1543
+ type: "uint256"
1544
+ }
959
1545
  ],
960
1546
  stateMutability: "view",
961
1547
  type: "function"
962
1548
  },
963
1549
  {
964
- inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
965
- name: "jobs",
966
- outputs: [
967
- { internalType: "uint256", name: "id", type: "uint256" },
968
- { internalType: "address", name: "client", type: "address" },
969
- { internalType: "address", name: "provider", type: "address" },
970
- { internalType: "uint256", name: "budget", type: "uint256" },
971
- { internalType: "uint256", name: "amountClaimed", type: "uint256" },
972
- { internalType: "uint8", name: "phase", type: "uint8" },
973
- { internalType: "uint256", name: "memoCount", type: "uint256" },
974
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
975
- { internalType: "address", name: "evaluator", type: "address" }
1550
+ inputs: [
1551
+ {
1552
+ internalType: "uint256",
1553
+ name: "memoId",
1554
+ type: "uint256"
1555
+ }
976
1556
  ],
977
- stateMutability: "view",
978
- type: "function"
979
- },
980
- {
981
- inputs: [],
982
- name: "memoCounter",
983
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
984
- stateMutability: "view",
985
- type: "function"
986
- },
987
- {
988
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
989
1557
  name: "memoExpiredAt",
990
- outputs: [{ internalType: "uint256", name: "expiredAt", type: "uint256" }],
1558
+ outputs: [
1559
+ {
1560
+ internalType: "uint256",
1561
+ name: "expiredAt",
1562
+ type: "uint256"
1563
+ }
1564
+ ],
991
1565
  stateMutability: "view",
992
1566
  type: "function"
993
1567
  },
994
1568
  {
995
- inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1569
+ inputs: [
1570
+ {
1571
+ internalType: "uint256",
1572
+ name: "",
1573
+ type: "uint256"
1574
+ }
1575
+ ],
996
1576
  name: "memos",
997
1577
  outputs: [
998
- { internalType: "string", name: "content", type: "string" },
1578
+ {
1579
+ internalType: "string",
1580
+ name: "content",
1581
+ type: "string"
1582
+ },
999
1583
  {
1000
1584
  internalType: "enum InteractionLedger.MemoType",
1001
1585
  name: "memoType",
1002
1586
  type: "uint8"
1003
1587
  },
1004
- { internalType: "bool", name: "isSecured", type: "bool" },
1005
- { internalType: "uint8", name: "nextPhase", type: "uint8" },
1006
- { internalType: "uint256", name: "jobId", type: "uint256" },
1007
- { internalType: "address", name: "sender", type: "address" }
1588
+ {
1589
+ internalType: "bool",
1590
+ name: "isSecured",
1591
+ type: "bool"
1592
+ },
1593
+ {
1594
+ internalType: "uint8",
1595
+ name: "nextPhase",
1596
+ type: "uint8"
1597
+ },
1598
+ {
1599
+ internalType: "uint256",
1600
+ name: "jobId",
1601
+ type: "uint256"
1602
+ },
1603
+ {
1604
+ internalType: "address",
1605
+ name: "sender",
1606
+ type: "address"
1607
+ }
1008
1608
  ],
1009
1609
  stateMutability: "view",
1010
1610
  type: "function"
@@ -1012,24 +1612,56 @@ var ACP_ABI = [
1012
1612
  {
1013
1613
  inputs: [],
1014
1614
  name: "numEvaluatorsPerJob",
1015
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
1615
+ outputs: [
1616
+ {
1617
+ internalType: "uint8",
1618
+ name: "",
1619
+ type: "uint8"
1620
+ }
1621
+ ],
1016
1622
  stateMutability: "view",
1017
1623
  type: "function"
1018
1624
  },
1019
1625
  {
1020
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
1626
+ inputs: [
1627
+ {
1628
+ internalType: "uint256",
1629
+ name: "memoId",
1630
+ type: "uint256"
1631
+ }
1632
+ ],
1021
1633
  name: "payableDetails",
1022
1634
  outputs: [
1023
- { internalType: "address", name: "token", type: "address" },
1024
- { internalType: "uint256", name: "amount", type: "uint256" },
1025
- { internalType: "address", name: "recipient", type: "address" },
1026
- { internalType: "uint256", name: "feeAmount", type: "uint256" },
1635
+ {
1636
+ internalType: "address",
1637
+ name: "token",
1638
+ type: "address"
1639
+ },
1640
+ {
1641
+ internalType: "uint256",
1642
+ name: "amount",
1643
+ type: "uint256"
1644
+ },
1645
+ {
1646
+ internalType: "address",
1647
+ name: "recipient",
1648
+ type: "address"
1649
+ },
1650
+ {
1651
+ internalType: "uint256",
1652
+ name: "feeAmount",
1653
+ type: "uint256"
1654
+ },
1027
1655
  {
1028
1656
  internalType: "enum ACPSimple.FeeType",
1029
1657
  name: "feeType",
1030
1658
  type: "uint8"
1031
1659
  },
1032
- { internalType: "bool", name: "isExecuted", type: "bool" }
1660
+ {
1661
+ internalType: "bool",
1662
+ name: "isExecuted",
1663
+ type: "bool"
1664
+ }
1033
1665
  ],
1034
1666
  stateMutability: "view",
1035
1667
  type: "function"
@@ -1037,28 +1669,54 @@ var ACP_ABI = [
1037
1669
  {
1038
1670
  inputs: [],
1039
1671
  name: "paymentToken",
1040
- outputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
1672
+ outputs: [
1673
+ {
1674
+ internalType: "contract IERC20",
1675
+ name: "",
1676
+ type: "address"
1677
+ }
1678
+ ],
1041
1679
  stateMutability: "view",
1042
1680
  type: "function"
1043
1681
  },
1044
1682
  {
1045
1683
  inputs: [],
1046
1684
  name: "platformFeeBP",
1047
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1685
+ outputs: [
1686
+ {
1687
+ internalType: "uint256",
1688
+ name: "",
1689
+ type: "uint256"
1690
+ }
1691
+ ],
1048
1692
  stateMutability: "view",
1049
1693
  type: "function"
1050
1694
  },
1051
1695
  {
1052
1696
  inputs: [],
1053
1697
  name: "platformTreasury",
1054
- outputs: [{ internalType: "address", name: "", type: "address" }],
1698
+ outputs: [
1699
+ {
1700
+ internalType: "address",
1701
+ name: "",
1702
+ type: "address"
1703
+ }
1704
+ ],
1055
1705
  stateMutability: "view",
1056
1706
  type: "function"
1057
1707
  },
1058
1708
  {
1059
1709
  inputs: [
1060
- { internalType: "bytes32", name: "role", type: "bytes32" },
1061
- { internalType: "address", name: "callerConfirmation", type: "address" }
1710
+ {
1711
+ internalType: "bytes32",
1712
+ name: "role",
1713
+ type: "bytes32"
1714
+ },
1715
+ {
1716
+ internalType: "address",
1717
+ name: "callerConfirmation",
1718
+ type: "address"
1719
+ }
1062
1720
  ],
1063
1721
  name: "renounceRole",
1064
1722
  outputs: [],
@@ -1067,8 +1725,16 @@ var ACP_ABI = [
1067
1725
  },
1068
1726
  {
1069
1727
  inputs: [
1070
- { internalType: "bytes32", name: "role", type: "bytes32" },
1071
- { internalType: "address", name: "account", type: "address" }
1728
+ {
1729
+ internalType: "bytes32",
1730
+ name: "role",
1731
+ type: "bytes32"
1732
+ },
1733
+ {
1734
+ internalType: "address",
1735
+ name: "account",
1736
+ type: "address"
1737
+ }
1072
1738
  ],
1073
1739
  name: "revokeRole",
1074
1740
  outputs: [],
@@ -1077,8 +1743,16 @@ var ACP_ABI = [
1077
1743
  },
1078
1744
  {
1079
1745
  inputs: [
1080
- { internalType: "uint256", name: "jobId", type: "uint256" },
1081
- { internalType: "uint256", name: "amount", type: "uint256" }
1746
+ {
1747
+ internalType: "uint256",
1748
+ name: "jobId",
1749
+ type: "uint256"
1750
+ },
1751
+ {
1752
+ internalType: "uint256",
1753
+ name: "amount",
1754
+ type: "uint256"
1755
+ }
1082
1756
  ],
1083
1757
  name: "setBudget",
1084
1758
  outputs: [],
@@ -1087,9 +1761,44 @@ var ACP_ABI = [
1087
1761
  },
1088
1762
  {
1089
1763
  inputs: [
1090
- { internalType: "uint256", name: "memoId", type: "uint256" },
1091
- { internalType: "bool", name: "isApproved", type: "bool" },
1092
- { internalType: "string", name: "reason", type: "string" }
1764
+ {
1765
+ internalType: "uint256",
1766
+ name: "jobId",
1767
+ type: "uint256"
1768
+ },
1769
+ {
1770
+ internalType: "uint256",
1771
+ name: "amount",
1772
+ type: "uint256"
1773
+ },
1774
+ {
1775
+ internalType: "contract IERC20",
1776
+ name: "jobPaymentToken_",
1777
+ type: "address"
1778
+ }
1779
+ ],
1780
+ name: "setBudgetWithPaymentToken",
1781
+ outputs: [],
1782
+ stateMutability: "nonpayable",
1783
+ type: "function"
1784
+ },
1785
+ {
1786
+ inputs: [
1787
+ {
1788
+ internalType: "uint256",
1789
+ name: "memoId",
1790
+ type: "uint256"
1791
+ },
1792
+ {
1793
+ internalType: "bool",
1794
+ name: "isApproved",
1795
+ type: "bool"
1796
+ },
1797
+ {
1798
+ internalType: "string",
1799
+ name: "reason",
1800
+ type: "string"
1801
+ }
1093
1802
  ],
1094
1803
  name: "signMemo",
1095
1804
  outputs: [],
@@ -1098,24 +1807,54 @@ var ACP_ABI = [
1098
1807
  },
1099
1808
  {
1100
1809
  inputs: [
1101
- { internalType: "uint256", name: "memoId", type: "uint256" },
1102
- { internalType: "address", name: "signer", type: "address" }
1810
+ {
1811
+ internalType: "uint256",
1812
+ name: "memoId",
1813
+ type: "uint256"
1814
+ },
1815
+ {
1816
+ internalType: "address",
1817
+ name: "signer",
1818
+ type: "address"
1819
+ }
1103
1820
  ],
1104
1821
  name: "signatories",
1105
- outputs: [{ internalType: "uint8", name: "res", type: "uint8" }],
1822
+ outputs: [
1823
+ {
1824
+ internalType: "uint8",
1825
+ name: "res",
1826
+ type: "uint8"
1827
+ }
1828
+ ],
1106
1829
  stateMutability: "view",
1107
1830
  type: "function"
1108
1831
  },
1109
1832
  {
1110
- inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
1833
+ inputs: [
1834
+ {
1835
+ internalType: "bytes4",
1836
+ name: "interfaceId",
1837
+ type: "bytes4"
1838
+ }
1839
+ ],
1111
1840
  name: "supportsInterface",
1112
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1841
+ outputs: [
1842
+ {
1843
+ internalType: "bool",
1844
+ name: "",
1845
+ type: "bool"
1846
+ }
1847
+ ],
1113
1848
  stateMutability: "view",
1114
1849
  type: "function"
1115
1850
  },
1116
1851
  {
1117
1852
  inputs: [
1118
- { internalType: "uint256", name: "evaluatorFeeBP_", type: "uint256" }
1853
+ {
1854
+ internalType: "uint256",
1855
+ name: "evaluatorFeeBP_",
1856
+ type: "uint256"
1857
+ }
1119
1858
  ],
1120
1859
  name: "updateEvaluatorFee",
1121
1860
  outputs: [],
@@ -1124,8 +1863,16 @@ var ACP_ABI = [
1124
1863
  },
1125
1864
  {
1126
1865
  inputs: [
1127
- { internalType: "uint256", name: "platformFeeBP_", type: "uint256" },
1128
- { internalType: "address", name: "platformTreasury_", type: "address" }
1866
+ {
1867
+ internalType: "uint256",
1868
+ name: "platformFeeBP_",
1869
+ type: "uint256"
1870
+ },
1871
+ {
1872
+ internalType: "address",
1873
+ name: "platformTreasury_",
1874
+ type: "address"
1875
+ }
1129
1876
  ],
1130
1877
  name: "updatePlatformFee",
1131
1878
  outputs: [],
@@ -1133,7 +1880,13 @@ var ACP_ABI = [
1133
1880
  type: "function"
1134
1881
  },
1135
1882
  {
1136
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
1883
+ inputs: [
1884
+ {
1885
+ internalType: "uint256",
1886
+ name: "memoId",
1887
+ type: "uint256"
1888
+ }
1889
+ ],
1137
1890
  name: "withdrawEscrowedFunds",
1138
1891
  outputs: [],
1139
1892
  stateMutability: "nonpayable",
@@ -1143,7 +1896,6 @@ var ACP_ABI = [
1143
1896
  var acpAbi_default = ACP_ABI;
1144
1897
 
1145
1898
  // src/acpClient.ts
1146
- var import_viem2 = require("viem");
1147
1899
  var import_socket = require("socket.io-client");
1148
1900
 
1149
1901
  // src/acpContractClient.ts
@@ -1156,7 +1908,8 @@ var import_infra = require("@account-kit/infra");
1156
1908
  var baseSepoliaAcpConfig = {
1157
1909
  chain: import_infra.baseSepolia,
1158
1910
  contractAddress: "0x8Db6B1c839Fc8f6bd35777E194677B67b4D51928",
1159
- virtualsTokenAddress: "0xbfAB80ccc15DF6fb7185f9498d6039317331846a",
1911
+ paymentTokenAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
1912
+ paymentTokenDecimals: 6,
1160
1913
  alchemyRpcUrl: "https://alchemy-proxy.virtuals.io/api/proxy/rpc",
1161
1914
  acpUrl: "https://acpx.virtuals.gg",
1162
1915
  priorityFeeMultiplier: 2,
@@ -1166,7 +1919,8 @@ var baseSepoliaAcpConfig = {
1166
1919
  var baseAcpConfig = {
1167
1920
  chain: import_infra.base,
1168
1921
  contractAddress: "0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
1169
- virtualsTokenAddress: "0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b",
1922
+ paymentTokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
1923
+ paymentTokenDecimals: 6,
1170
1924
  alchemyRpcUrl: "https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
1171
1925
  acpUrl: "https://acpx.virtuals.io",
1172
1926
  priorityFeeMultiplier: 2,
@@ -1209,7 +1963,7 @@ var AcpContractClient = class _AcpContractClient {
1209
1963
  this.MAX_RETRIES = 3;
1210
1964
  this.chain = config.chain;
1211
1965
  this.contractAddress = config.contractAddress;
1212
- this.virtualsTokenAddress = config.virtualsTokenAddress;
1966
+ this.paymentTokenAddress = config.paymentTokenAddress;
1213
1967
  this.customRpcUrl = customRpcUrl;
1214
1968
  this.customRpcClient = (0, import_viem.createPublicClient)({
1215
1969
  chain: this.chain,
@@ -1319,6 +2073,9 @@ var AcpContractClient = class _AcpContractClient {
1319
2073
  return (0, import_viem.fromHex)(contractLogs.data, "number");
1320
2074
  });
1321
2075
  }
2076
+ formatAmount(amount) {
2077
+ return (0, import_viem.parseUnits)(amount.toString(), this.config.paymentTokenDecimals);
2078
+ }
1322
2079
  createJob(providerAddress, evaluatorAddress, expireAt) {
1323
2080
  return __async(this, null, function* () {
1324
2081
  try {
@@ -1340,18 +2097,15 @@ var AcpContractClient = class _AcpContractClient {
1340
2097
  }
1341
2098
  });
1342
2099
  }
1343
- approveAllowance(priceInWei) {
1344
- return __async(this, null, function* () {
2100
+ approveAllowance(_0) {
2101
+ return __async(this, arguments, function* (amount, paymentTokenAddress = this.paymentTokenAddress) {
1345
2102
  try {
1346
2103
  const data = (0, import_viem.encodeFunctionData)({
1347
2104
  abi: import_viem.erc20Abi,
1348
2105
  functionName: "approve",
1349
- args: [this.contractAddress, priceInWei]
2106
+ args: [this.contractAddress, this.formatAmount(amount)]
1350
2107
  });
1351
- return yield this.handleSendUserOperation(
1352
- data,
1353
- this.virtualsTokenAddress
1354
- );
2108
+ return yield this.handleSendUserOperation(data, paymentTokenAddress);
1355
2109
  } catch (error) {
1356
2110
  console.error(`Failed to approve allowance ${error}`);
1357
2111
  throw new Error("Failed to approve allowance");
@@ -1359,7 +2113,7 @@ var AcpContractClient = class _AcpContractClient {
1359
2113
  });
1360
2114
  }
1361
2115
  createPayableMemo(_0, _1, _2, _3, _4, _5, _6, _7, _8) {
1362
- return __async(this, arguments, function* (jobId, content, amount, recipient, feeAmount, feeType, nextPhase, type, expiredAt, token = this.config.virtualsTokenAddress) {
2116
+ return __async(this, arguments, function* (jobId, content, amount, recipient, feeAmount, feeType, nextPhase, type, expiredAt, token = this.paymentTokenAddress) {
1363
2117
  let retries = 3;
1364
2118
  while (retries > 0) {
1365
2119
  try {
@@ -1370,9 +2124,9 @@ var AcpContractClient = class _AcpContractClient {
1370
2124
  jobId,
1371
2125
  content,
1372
2126
  token,
1373
- amount,
2127
+ this.formatAmount(amount),
1374
2128
  recipient,
1375
- feeAmount,
2129
+ this.formatAmount(feeAmount),
1376
2130
  feeType,
1377
2131
  type,
1378
2132
  nextPhase,
@@ -1459,7 +2213,22 @@ var AcpContractClient = class _AcpContractClient {
1459
2213
  const data = (0, import_viem.encodeFunctionData)({
1460
2214
  abi: acpAbi_default,
1461
2215
  functionName: "setBudget",
1462
- args: [jobId, budget]
2216
+ args: [jobId, this.formatAmount(budget)]
2217
+ });
2218
+ return yield this.handleSendUserOperation(data);
2219
+ } catch (error) {
2220
+ console.error(`Failed to set budget ${error}`);
2221
+ throw new Error("Failed to set budget");
2222
+ }
2223
+ });
2224
+ }
2225
+ setBudgetWithPaymentToken(_0, _1) {
2226
+ return __async(this, arguments, function* (jobId, budget, paymentTokenAddress = this.paymentTokenAddress) {
2227
+ try {
2228
+ const data = (0, import_viem.encodeFunctionData)({
2229
+ abi: acpAbi_default,
2230
+ functionName: "setBudgetWithPaymentToken",
2231
+ args: [jobId, this.formatAmount(budget), paymentTokenAddress]
1463
2232
  });
1464
2233
  return yield this.handleSendUserOperation(data);
1465
2234
  } catch (error) {
@@ -1519,20 +2288,45 @@ function tryParseJson(content) {
1519
2288
 
1520
2289
  // src/acpJob.ts
1521
2290
  var AcpJob = class {
1522
- constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, memos, phase, context) {
2291
+ constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, priceTokenAddress, memos, phase, context) {
1523
2292
  this.acpClient = acpClient;
1524
2293
  this.id = id;
1525
2294
  this.clientAddress = clientAddress;
1526
2295
  this.providerAddress = providerAddress;
1527
2296
  this.evaluatorAddress = evaluatorAddress;
1528
2297
  this.price = price;
2298
+ this.priceTokenAddress = priceTokenAddress;
1529
2299
  this.memos = memos;
1530
2300
  this.phase = phase;
1531
2301
  this.context = context;
1532
2302
  }
1533
2303
  get serviceRequirement() {
1534
2304
  var _a;
1535
- return (_a = this.memos.find((m) => m.nextPhase === 1 /* NEGOTIATION */)) == null ? void 0 : _a.content;
2305
+ const content = (_a = this.memos.find(
2306
+ (m) => m.nextPhase === 1 /* NEGOTIATION */
2307
+ )) == null ? void 0 : _a.content;
2308
+ if (!content) {
2309
+ return void 0;
2310
+ }
2311
+ const contentObj = tryParseJson(content);
2312
+ if (!contentObj) {
2313
+ return content;
2314
+ }
2315
+ if (contentObj.serviceRequirement) {
2316
+ return contentObj.serviceRequirement;
2317
+ }
2318
+ return contentObj;
2319
+ }
2320
+ get serviceName() {
2321
+ var _a;
2322
+ const content = (_a = this.memos.find(
2323
+ (m) => m.nextPhase === 1 /* NEGOTIATION */
2324
+ )) == null ? void 0 : _a.content;
2325
+ if (!content) {
2326
+ return void 0;
2327
+ }
2328
+ const contentObj = tryParseJson(content);
2329
+ return contentObj == null ? void 0 : contentObj.serviceName;
1536
2330
  }
1537
2331
  get deliverable() {
1538
2332
  var _a;
@@ -1868,7 +2662,7 @@ var acpJob_default = AcpJob;
1868
2662
 
1869
2663
  // src/acpMemo.ts
1870
2664
  var AcpMemo = class {
1871
- constructor(acpClient, id, type, content, nextPhase, status, signedReason, expiry) {
2665
+ constructor(acpClient, id, type, content, nextPhase, status, signedReason, expiry, payableDetails) {
1872
2666
  this.acpClient = acpClient;
1873
2667
  this.id = id;
1874
2668
  this.type = type;
@@ -1877,6 +2671,7 @@ var AcpMemo = class {
1877
2671
  this.status = status;
1878
2672
  this.signedReason = signedReason;
1879
2673
  this.expiry = expiry;
2674
+ this.payableDetails = payableDetails;
1880
2675
  this.structuredContent = tryParseJson(this.content) || void 0;
1881
2676
  }
1882
2677
  get payloadType() {
@@ -1998,6 +2793,7 @@ var AcpClient = class {
1998
2793
  data.providerAddress,
1999
2794
  data.evaluatorAddress,
2000
2795
  data.price,
2796
+ data.priceTokenAddress,
2001
2797
  data.memos.map((memo) => {
2002
2798
  return new acpMemo_default(
2003
2799
  this,
@@ -2007,7 +2803,8 @@ var AcpClient = class {
2007
2803
  memo.nextPhase,
2008
2804
  memo.status,
2009
2805
  memo.signedReason,
2010
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
2806
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
2807
+ memo.payableDetails
2011
2808
  );
2012
2809
  }),
2013
2810
  data.phase,
@@ -2029,6 +2826,7 @@ var AcpClient = class {
2029
2826
  data.providerAddress,
2030
2827
  data.evaluatorAddress,
2031
2828
  data.price,
2829
+ data.priceTokenAddress,
2032
2830
  data.memos.map((memo) => {
2033
2831
  return new acpMemo_default(
2034
2832
  this,
@@ -2038,7 +2836,8 @@ var AcpClient = class {
2038
2836
  memo.nextPhase,
2039
2837
  memo.status,
2040
2838
  memo.signedReason,
2041
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
2839
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
2840
+ memo.payableDetails
2042
2841
  );
2043
2842
  }),
2044
2843
  data.phase,
@@ -2096,7 +2895,7 @@ var AcpClient = class {
2096
2895
  this,
2097
2896
  agent.walletAddress,
2098
2897
  offering.name,
2099
- offering.price,
2898
+ offering.priceUsd,
2100
2899
  offering.requirementSchema
2101
2900
  );
2102
2901
  }),
@@ -2114,12 +2913,7 @@ var AcpClient = class {
2114
2913
  evaluatorAddress || this.acpContractClient.walletAddress,
2115
2914
  expiredAt
2116
2915
  );
2117
- if (amount > 0) {
2118
- yield this.acpContractClient.setBudget(
2119
- jobId,
2120
- (0, import_viem2.parseEther)(amount.toString())
2121
- );
2122
- }
2916
+ yield this.acpContractClient.setBudgetWithPaymentToken(jobId, amount);
2123
2917
  yield this.acpContractClient.createMemo(
2124
2918
  jobId,
2125
2919
  typeof serviceRequirement === "string" ? serviceRequirement : JSON.stringify(serviceRequirement),
@@ -2148,9 +2942,7 @@ var AcpClient = class {
2148
2942
  payJob(jobId, amount, memoId, reason) {
2149
2943
  return __async(this, null, function* () {
2150
2944
  if (amount > 0) {
2151
- yield this.acpContractClient.approveAllowance(
2152
- (0, import_viem2.parseEther)(amount.toString())
2153
- );
2945
+ yield this.acpContractClient.approveAllowance(amount);
2154
2946
  }
2155
2947
  yield this.acpContractClient.signMemo(memoId, true, reason);
2156
2948
  return yield this.acpContractClient.createMemo(
@@ -2167,9 +2959,9 @@ var AcpClient = class {
2167
2959
  return yield this.acpContractClient.createPayableMemo(
2168
2960
  jobId,
2169
2961
  JSON.stringify(reason),
2170
- (0, import_viem2.parseEther)(amount.toString()),
2962
+ amount,
2171
2963
  recipient,
2172
- (0, import_viem2.parseEther)(feeAmount.toString()),
2964
+ feeAmount,
2173
2965
  feeType,
2174
2966
  nextPhase,
2175
2967
  6 /* PAYABLE_REQUEST */,
@@ -2183,9 +2975,7 @@ var AcpClient = class {
2183
2975
  return yield this.acpContractClient.signMemo(memoId, accept, reason);
2184
2976
  }
2185
2977
  if (amount > 0) {
2186
- yield this.acpContractClient.approveAllowance(
2187
- (0, import_viem2.parseEther)(amount.toString())
2188
- );
2978
+ yield this.acpContractClient.approveAllowance(amount);
2189
2979
  }
2190
2980
  return yield this.acpContractClient.signMemo(memoId, true, reason);
2191
2981
  });
@@ -2194,16 +2984,14 @@ var AcpClient = class {
2194
2984
  return __async(this, null, function* () {
2195
2985
  const totalAmount = amount + feeAmount;
2196
2986
  if (totalAmount > 0) {
2197
- yield this.acpContractClient.approveAllowance(
2198
- (0, import_viem2.parseEther)(totalAmount.toString())
2199
- );
2987
+ yield this.acpContractClient.approveAllowance(totalAmount);
2200
2988
  }
2201
2989
  return yield this.acpContractClient.createPayableMemo(
2202
2990
  jobId,
2203
2991
  JSON.stringify(reason),
2204
- (0, import_viem2.parseEther)(amount.toString()),
2992
+ amount,
2205
2993
  recipient,
2206
- (0, import_viem2.parseEther)(feeAmount.toString()),
2994
+ feeAmount,
2207
2995
  feeType,
2208
2996
  nextPhase,
2209
2997
  8 /* PAYABLE_TRANSFER_ESCROW */,
@@ -2259,6 +3047,7 @@ var AcpClient = class {
2259
3047
  job.providerAddress,
2260
3048
  job.evaluatorAddress,
2261
3049
  job.price,
3050
+ job.priceTokenAddress,
2262
3051
  job.memos.map((memo) => {
2263
3052
  return new acpMemo_default(
2264
3053
  this,
@@ -2268,7 +3057,8 @@ var AcpClient = class {
2268
3057
  memo.nextPhase,
2269
3058
  memo.status,
2270
3059
  memo.signedReason,
2271
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3060
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3061
+ memo.payableDetails
2272
3062
  );
2273
3063
  }),
2274
3064
  job.phase,
@@ -2301,6 +3091,7 @@ var AcpClient = class {
2301
3091
  job.providerAddress,
2302
3092
  job.evaluatorAddress,
2303
3093
  job.price,
3094
+ job.priceTokenAddress,
2304
3095
  job.memos.map((memo) => {
2305
3096
  return new acpMemo_default(
2306
3097
  this,
@@ -2310,7 +3101,8 @@ var AcpClient = class {
2310
3101
  memo.nextPhase,
2311
3102
  memo.status,
2312
3103
  memo.signedReason,
2313
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3104
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3105
+ memo.payableDetails
2314
3106
  );
2315
3107
  }),
2316
3108
  job.phase,
@@ -2343,6 +3135,7 @@ var AcpClient = class {
2343
3135
  job.providerAddress,
2344
3136
  job.evaluatorAddress,
2345
3137
  job.price,
3138
+ job.priceTokenAddress,
2346
3139
  job.memos.map((memo) => {
2347
3140
  return new acpMemo_default(
2348
3141
  this,
@@ -2352,7 +3145,8 @@ var AcpClient = class {
2352
3145
  memo.nextPhase,
2353
3146
  memo.status,
2354
3147
  memo.signedReason,
2355
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3148
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3149
+ memo.payableDetails
2356
3150
  );
2357
3151
  }),
2358
3152
  job.phase,
@@ -2388,6 +3182,7 @@ var AcpClient = class {
2388
3182
  job.providerAddress,
2389
3183
  job.evaluatorAddress,
2390
3184
  job.price,
3185
+ job.priceTokenAddress,
2391
3186
  job.memos.map((memo) => {
2392
3187
  return new acpMemo_default(
2393
3188
  this,
@@ -2397,7 +3192,8 @@ var AcpClient = class {
2397
3192
  memo.nextPhase,
2398
3193
  memo.status,
2399
3194
  memo.signedReason,
2400
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3195
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3196
+ memo.payableDetails
2401
3197
  );
2402
3198
  }),
2403
3199
  job.phase,
@@ -2433,7 +3229,8 @@ var AcpClient = class {
2433
3229
  memo.nextPhase,
2434
3230
  memo.status,
2435
3231
  memo.signedReason,
2436
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3232
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3233
+ memo.payableDetails
2437
3234
  );
2438
3235
  } catch (error) {
2439
3236
  throw error;