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

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.8",
76
76
  main: "./dist/index.js",
77
77
  module: "./dist/index.mjs",
78
78
  types: "./dist/index.d.ts",
@@ -108,48 +108,105 @@ __export(index_exports, {
108
108
  ACP_ABI: () => acpAbi_default,
109
109
  AcpAgentSort: () => AcpAgentSort,
110
110
  AcpContractClient: () => acpContractClient_default,
111
+ AcpContractConfig: () => AcpContractConfig,
111
112
  AcpGraduationStatus: () => AcpGraduationStatus,
112
113
  AcpJob: () => acpJob_default,
113
114
  AcpJobPhases: () => AcpJobPhases,
114
115
  AcpMemo: () => acpMemo_default,
115
116
  AcpMemoStatus: () => AcpMemoStatus,
116
117
  AcpOnlineStatus: () => AcpOnlineStatus,
118
+ Fare: () => Fare,
119
+ FareAmount: () => FareAmount,
120
+ FareBigInt: () => FareBigInt,
117
121
  MemoType: () => MemoType,
118
122
  PayloadType: () => PayloadType,
123
+ PositionDirection: () => PositionDirection,
119
124
  baseAcpConfig: () => baseAcpConfig,
120
125
  baseSepoliaAcpConfig: () => baseSepoliaAcpConfig,
121
- default: () => index_default
126
+ default: () => index_default,
127
+ ethFare: () => ethFare,
128
+ wethFare: () => wethFare
122
129
  });
123
130
  module.exports = __toCommonJS(index_exports);
124
131
 
125
132
  // src/acpAbi.ts
126
133
  var ACP_ABI = [
127
- { inputs: [], stateMutability: "nonpayable", type: "constructor" },
128
- { inputs: [], name: "AccessControlBadConfirmation", type: "error" },
134
+ {
135
+ inputs: [],
136
+ stateMutability: "nonpayable",
137
+ type: "constructor"
138
+ },
139
+ {
140
+ inputs: [],
141
+ name: "AccessControlBadConfirmation",
142
+ type: "error"
143
+ },
129
144
  {
130
145
  inputs: [
131
- { internalType: "address", name: "account", type: "address" },
132
- { internalType: "bytes32", name: "neededRole", type: "bytes32" }
146
+ {
147
+ internalType: "address",
148
+ name: "account",
149
+ type: "address"
150
+ },
151
+ {
152
+ internalType: "bytes32",
153
+ name: "neededRole",
154
+ type: "bytes32"
155
+ }
133
156
  ],
134
157
  name: "AccessControlUnauthorizedAccount",
135
158
  type: "error"
136
159
  },
137
160
  {
138
- inputs: [{ internalType: "address", name: "target", type: "address" }],
161
+ inputs: [
162
+ {
163
+ internalType: "address",
164
+ name: "target",
165
+ type: "address"
166
+ }
167
+ ],
139
168
  name: "AddressEmptyCode",
140
169
  type: "error"
141
170
  },
142
171
  {
143
- inputs: [{ internalType: "address", name: "account", type: "address" }],
172
+ inputs: [
173
+ {
174
+ internalType: "address",
175
+ name: "account",
176
+ type: "address"
177
+ }
178
+ ],
144
179
  name: "AddressInsufficientBalance",
145
180
  type: "error"
146
181
  },
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
182
  {
152
- inputs: [{ internalType: "address", name: "token", type: "address" }],
183
+ inputs: [],
184
+ name: "FailedInnerCall",
185
+ type: "error"
186
+ },
187
+ {
188
+ inputs: [],
189
+ name: "InvalidInitialization",
190
+ type: "error"
191
+ },
192
+ {
193
+ inputs: [],
194
+ name: "NotInitializing",
195
+ type: "error"
196
+ },
197
+ {
198
+ inputs: [],
199
+ name: "ReentrancyGuardReentrantCall",
200
+ type: "error"
201
+ },
202
+ {
203
+ inputs: [
204
+ {
205
+ internalType: "address",
206
+ name: "token",
207
+ type: "address"
208
+ }
209
+ ],
153
210
  name: "SafeERC20FailedOperation",
154
211
  type: "error"
155
212
  },
@@ -266,6 +323,25 @@ var ACP_ABI = [
266
323
  name: "JobCreated",
267
324
  type: "event"
268
325
  },
326
+ {
327
+ anonymous: false,
328
+ inputs: [
329
+ {
330
+ indexed: true,
331
+ internalType: "uint256",
332
+ name: "jobId",
333
+ type: "uint256"
334
+ },
335
+ {
336
+ indexed: true,
337
+ internalType: "address",
338
+ name: "paymentToken",
339
+ type: "address"
340
+ }
341
+ ],
342
+ name: "JobPaymentTokenSet",
343
+ type: "event"
344
+ },
269
345
  {
270
346
  anonymous: false,
271
347
  inputs: [
@@ -281,7 +357,12 @@ var ACP_ABI = [
281
357
  name: "oldPhase",
282
358
  type: "uint8"
283
359
  },
284
- { indexed: false, internalType: "uint8", name: "phase", type: "uint8" }
360
+ {
361
+ indexed: false,
362
+ internalType: "uint8",
363
+ name: "phase",
364
+ type: "uint8"
365
+ }
285
366
  ],
286
367
  name: "JobPhaseUpdated",
287
368
  type: "event"
@@ -468,8 +549,18 @@ var ACP_ABI = [
468
549
  name: "memoId",
469
550
  type: "uint256"
470
551
  },
471
- { indexed: true, internalType: "address", name: "from", type: "address" },
472
- { indexed: false, internalType: "address", name: "to", type: "address" },
552
+ {
553
+ indexed: true,
554
+ internalType: "address",
555
+ name: "from",
556
+ type: "address"
557
+ },
558
+ {
559
+ indexed: false,
560
+ internalType: "address",
561
+ name: "to",
562
+ type: "address"
563
+ },
473
564
  {
474
565
  indexed: false,
475
566
  internalType: "address",
@@ -501,8 +592,18 @@ var ACP_ABI = [
501
592
  name: "memoId",
502
593
  type: "uint256"
503
594
  },
504
- { indexed: true, internalType: "address", name: "from", type: "address" },
505
- { indexed: false, internalType: "address", name: "to", type: "address" },
595
+ {
596
+ indexed: true,
597
+ internalType: "address",
598
+ name: "from",
599
+ type: "address"
600
+ },
601
+ {
602
+ indexed: false,
603
+ internalType: "address",
604
+ name: "to",
605
+ type: "address"
606
+ },
506
607
  {
507
608
  indexed: false,
508
609
  internalType: "address",
@@ -572,7 +673,12 @@ var ACP_ABI = [
572
673
  {
573
674
  anonymous: false,
574
675
  inputs: [
575
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
676
+ {
677
+ indexed: true,
678
+ internalType: "bytes32",
679
+ name: "role",
680
+ type: "bytes32"
681
+ },
576
682
  {
577
683
  indexed: true,
578
684
  internalType: "bytes32",
@@ -592,7 +698,12 @@ var ACP_ABI = [
592
698
  {
593
699
  anonymous: false,
594
700
  inputs: [
595
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
701
+ {
702
+ indexed: true,
703
+ internalType: "bytes32",
704
+ name: "role",
705
+ type: "bytes32"
706
+ },
596
707
  {
597
708
  indexed: true,
598
709
  internalType: "address",
@@ -612,7 +723,12 @@ var ACP_ABI = [
612
723
  {
613
724
  anonymous: false,
614
725
  inputs: [
615
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
726
+ {
727
+ indexed: true,
728
+ internalType: "bytes32",
729
+ name: "role",
730
+ type: "bytes32"
731
+ },
616
732
  {
617
733
  indexed: true,
618
734
  internalType: "address",
@@ -632,87 +748,192 @@ var ACP_ABI = [
632
748
  {
633
749
  inputs: [],
634
750
  name: "ADMIN_ROLE",
635
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
751
+ outputs: [
752
+ {
753
+ internalType: "bytes32",
754
+ name: "",
755
+ type: "bytes32"
756
+ }
757
+ ],
636
758
  stateMutability: "view",
637
759
  type: "function"
638
760
  },
639
761
  {
640
762
  inputs: [],
641
763
  name: "DEFAULT_ADMIN_ROLE",
642
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
764
+ outputs: [
765
+ {
766
+ internalType: "bytes32",
767
+ name: "",
768
+ type: "bytes32"
769
+ }
770
+ ],
643
771
  stateMutability: "view",
644
772
  type: "function"
645
773
  },
646
774
  {
647
775
  inputs: [],
648
776
  name: "PHASE_COMPLETED",
649
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
777
+ outputs: [
778
+ {
779
+ internalType: "uint8",
780
+ name: "",
781
+ type: "uint8"
782
+ }
783
+ ],
650
784
  stateMutability: "view",
651
785
  type: "function"
652
786
  },
653
787
  {
654
788
  inputs: [],
655
789
  name: "PHASE_EVALUATION",
656
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
790
+ outputs: [
791
+ {
792
+ internalType: "uint8",
793
+ name: "",
794
+ type: "uint8"
795
+ }
796
+ ],
657
797
  stateMutability: "view",
658
798
  type: "function"
659
799
  },
660
800
  {
661
801
  inputs: [],
662
802
  name: "PHASE_EXPIRED",
663
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
803
+ outputs: [
804
+ {
805
+ internalType: "uint8",
806
+ name: "",
807
+ type: "uint8"
808
+ }
809
+ ],
664
810
  stateMutability: "view",
665
811
  type: "function"
666
812
  },
667
813
  {
668
814
  inputs: [],
669
815
  name: "PHASE_NEGOTIATION",
670
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
816
+ outputs: [
817
+ {
818
+ internalType: "uint8",
819
+ name: "",
820
+ type: "uint8"
821
+ }
822
+ ],
671
823
  stateMutability: "view",
672
824
  type: "function"
673
825
  },
674
826
  {
675
827
  inputs: [],
676
828
  name: "PHASE_REJECTED",
677
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
829
+ outputs: [
830
+ {
831
+ internalType: "uint8",
832
+ name: "",
833
+ type: "uint8"
834
+ }
835
+ ],
678
836
  stateMutability: "view",
679
837
  type: "function"
680
838
  },
681
839
  {
682
840
  inputs: [],
683
841
  name: "PHASE_REQUEST",
684
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
842
+ outputs: [
843
+ {
844
+ internalType: "uint8",
845
+ name: "",
846
+ type: "uint8"
847
+ }
848
+ ],
685
849
  stateMutability: "view",
686
850
  type: "function"
687
851
  },
688
852
  {
689
853
  inputs: [],
690
854
  name: "PHASE_TRANSACTION",
691
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
855
+ outputs: [
856
+ {
857
+ internalType: "uint8",
858
+ name: "",
859
+ type: "uint8"
860
+ }
861
+ ],
692
862
  stateMutability: "view",
693
863
  type: "function"
694
864
  },
695
865
  {
696
866
  inputs: [],
697
867
  name: "TOTAL_PHASES",
698
- outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
868
+ outputs: [
869
+ {
870
+ internalType: "uint8",
871
+ name: "",
872
+ type: "uint8"
873
+ }
874
+ ],
699
875
  stateMutability: "view",
700
876
  type: "function"
701
877
  },
702
878
  {
703
879
  inputs: [
704
- { internalType: "address", name: "account", type: "address" },
880
+ {
881
+ internalType: "address",
882
+ name: "account",
883
+ type: "address"
884
+ },
705
885
  {
706
886
  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" }
887
+ {
888
+ internalType: "uint256",
889
+ name: "id",
890
+ type: "uint256"
891
+ },
892
+ {
893
+ internalType: "address",
894
+ name: "client",
895
+ type: "address"
896
+ },
897
+ {
898
+ internalType: "address",
899
+ name: "provider",
900
+ type: "address"
901
+ },
902
+ {
903
+ internalType: "uint256",
904
+ name: "budget",
905
+ type: "uint256"
906
+ },
907
+ {
908
+ internalType: "uint256",
909
+ name: "amountClaimed",
910
+ type: "uint256"
911
+ },
912
+ {
913
+ internalType: "uint8",
914
+ name: "phase",
915
+ type: "uint8"
916
+ },
917
+ {
918
+ internalType: "uint256",
919
+ name: "memoCount",
920
+ type: "uint256"
921
+ },
922
+ {
923
+ internalType: "uint256",
924
+ name: "expiredAt",
925
+ type: "uint256"
926
+ },
927
+ {
928
+ internalType: "address",
929
+ name: "evaluator",
930
+ type: "address"
931
+ },
932
+ {
933
+ internalType: "contract IERC20",
934
+ name: "jobPaymentToken",
935
+ type: "address"
936
+ }
716
937
  ],
717
938
  internalType: "struct ACPSimple.Job",
718
939
  name: "job",
@@ -720,12 +941,24 @@ var ACP_ABI = [
720
941
  }
721
942
  ],
722
943
  name: "canSign",
723
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
944
+ outputs: [
945
+ {
946
+ internalType: "bool",
947
+ name: "",
948
+ type: "bool"
949
+ }
950
+ ],
724
951
  stateMutability: "pure",
725
952
  type: "function"
726
953
  },
727
954
  {
728
- inputs: [{ internalType: "uint256", name: "id", type: "uint256" }],
955
+ inputs: [
956
+ {
957
+ internalType: "uint256",
958
+ name: "id",
959
+ type: "uint256"
960
+ }
961
+ ],
729
962
  name: "claimBudget",
730
963
  outputs: [],
731
964
  stateMutability: "nonpayable",
@@ -733,40 +966,104 @@ var ACP_ABI = [
733
966
  },
734
967
  {
735
968
  inputs: [
736
- { internalType: "address", name: "provider", type: "address" },
737
- { internalType: "address", name: "evaluator", type: "address" },
738
- { internalType: "uint256", name: "expiredAt", type: "uint256" }
969
+ {
970
+ internalType: "address",
971
+ name: "provider",
972
+ type: "address"
973
+ },
974
+ {
975
+ internalType: "address",
976
+ name: "evaluator",
977
+ type: "address"
978
+ },
979
+ {
980
+ internalType: "uint256",
981
+ name: "expiredAt",
982
+ type: "uint256"
983
+ }
739
984
  ],
740
985
  name: "createJob",
741
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
986
+ outputs: [
987
+ {
988
+ internalType: "uint256",
989
+ name: "",
990
+ type: "uint256"
991
+ }
992
+ ],
742
993
  stateMutability: "nonpayable",
743
994
  type: "function"
744
995
  },
745
996
  {
746
997
  inputs: [
747
- { internalType: "uint256", name: "jobId", type: "uint256" },
748
- { internalType: "string", name: "content", type: "string" },
749
998
  {
750
- internalType: "enum InteractionLedger.MemoType",
751
- name: "memoType",
752
- type: "uint8"
999
+ internalType: "uint256",
1000
+ name: "jobId",
1001
+ type: "uint256"
753
1002
  },
754
- { internalType: "bool", name: "isSecured", type: "bool" },
755
- { internalType: "uint8", name: "nextPhase", type: "uint8" }
1003
+ {
1004
+ internalType: "string",
1005
+ name: "content",
1006
+ type: "string"
1007
+ },
1008
+ {
1009
+ internalType: "enum InteractionLedger.MemoType",
1010
+ name: "memoType",
1011
+ type: "uint8"
1012
+ },
1013
+ {
1014
+ internalType: "bool",
1015
+ name: "isSecured",
1016
+ type: "bool"
1017
+ },
1018
+ {
1019
+ internalType: "uint8",
1020
+ name: "nextPhase",
1021
+ type: "uint8"
1022
+ }
756
1023
  ],
757
1024
  name: "createMemo",
758
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1025
+ outputs: [
1026
+ {
1027
+ internalType: "uint256",
1028
+ name: "",
1029
+ type: "uint256"
1030
+ }
1031
+ ],
759
1032
  stateMutability: "nonpayable",
760
1033
  type: "function"
761
1034
  },
762
1035
  {
763
1036
  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" },
1037
+ {
1038
+ internalType: "uint256",
1039
+ name: "jobId",
1040
+ type: "uint256"
1041
+ },
1042
+ {
1043
+ internalType: "string",
1044
+ name: "content",
1045
+ type: "string"
1046
+ },
1047
+ {
1048
+ internalType: "address",
1049
+ name: "token",
1050
+ type: "address"
1051
+ },
1052
+ {
1053
+ internalType: "uint256",
1054
+ name: "amount",
1055
+ type: "uint256"
1056
+ },
1057
+ {
1058
+ internalType: "address",
1059
+ name: "recipient",
1060
+ type: "address"
1061
+ },
1062
+ {
1063
+ internalType: "uint256",
1064
+ name: "feeAmount",
1065
+ type: "uint256"
1066
+ },
770
1067
  {
771
1068
  internalType: "enum ACPSimple.FeeType",
772
1069
  name: "feeType",
@@ -777,88 +1074,198 @@ var ACP_ABI = [
777
1074
  name: "memoType",
778
1075
  type: "uint8"
779
1076
  },
780
- { internalType: "uint8", name: "nextPhase", type: "uint8" },
781
- { internalType: "uint256", name: "expiredAt", type: "uint256" }
1077
+ {
1078
+ internalType: "uint8",
1079
+ name: "nextPhase",
1080
+ type: "uint8"
1081
+ },
1082
+ {
1083
+ internalType: "uint256",
1084
+ name: "expiredAt",
1085
+ type: "uint256"
1086
+ }
782
1087
  ],
783
1088
  name: "createPayableMemo",
784
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1089
+ outputs: [
1090
+ {
1091
+ internalType: "uint256",
1092
+ name: "",
1093
+ type: "uint256"
1094
+ }
1095
+ ],
785
1096
  stateMutability: "nonpayable",
786
1097
  type: "function"
787
1098
  },
788
1099
  {
789
1100
  inputs: [],
790
1101
  name: "evaluatorFeeBP",
791
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1102
+ outputs: [
1103
+ {
1104
+ internalType: "uint256",
1105
+ name: "",
1106
+ type: "uint256"
1107
+ }
1108
+ ],
792
1109
  stateMutability: "view",
793
1110
  type: "function"
794
1111
  },
795
1112
  {
796
1113
  inputs: [
797
- { internalType: "uint256", name: "jobId", type: "uint256" },
798
- { internalType: "uint256", name: "offset", type: "uint256" },
799
- { internalType: "uint256", name: "limit", type: "uint256" }
1114
+ {
1115
+ internalType: "uint256",
1116
+ name: "jobId",
1117
+ type: "uint256"
1118
+ },
1119
+ {
1120
+ internalType: "uint256",
1121
+ name: "offset",
1122
+ type: "uint256"
1123
+ },
1124
+ {
1125
+ internalType: "uint256",
1126
+ name: "limit",
1127
+ type: "uint256"
1128
+ }
800
1129
  ],
801
1130
  name: "getAllMemos",
802
1131
  outputs: [
803
1132
  {
804
1133
  components: [
805
- { internalType: "string", name: "content", type: "string" },
1134
+ {
1135
+ internalType: "string",
1136
+ name: "content",
1137
+ type: "string"
1138
+ },
806
1139
  {
807
1140
  internalType: "enum InteractionLedger.MemoType",
808
1141
  name: "memoType",
809
1142
  type: "uint8"
810
1143
  },
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" }
1144
+ {
1145
+ internalType: "bool",
1146
+ name: "isSecured",
1147
+ type: "bool"
1148
+ },
1149
+ {
1150
+ internalType: "uint8",
1151
+ name: "nextPhase",
1152
+ type: "uint8"
1153
+ },
1154
+ {
1155
+ internalType: "uint256",
1156
+ name: "jobId",
1157
+ type: "uint256"
1158
+ },
1159
+ {
1160
+ internalType: "address",
1161
+ name: "sender",
1162
+ type: "address"
1163
+ }
815
1164
  ],
816
1165
  internalType: "struct InteractionLedger.Memo[]",
817
1166
  name: "",
818
1167
  type: "tuple[]"
819
1168
  },
820
- { internalType: "uint256", name: "total", type: "uint256" }
1169
+ {
1170
+ internalType: "uint256",
1171
+ name: "total",
1172
+ type: "uint256"
1173
+ }
821
1174
  ],
822
1175
  stateMutability: "view",
823
1176
  type: "function"
824
1177
  },
825
1178
  {
826
1179
  inputs: [
827
- { internalType: "uint256", name: "jobId", type: "uint256" },
828
- { internalType: "uint8", name: "phase", type: "uint8" }
1180
+ {
1181
+ internalType: "uint256",
1182
+ name: "jobId",
1183
+ type: "uint256"
1184
+ },
1185
+ {
1186
+ internalType: "uint8",
1187
+ name: "phase",
1188
+ type: "uint8"
1189
+ }
829
1190
  ],
830
1191
  name: "getJobPhaseMemoIds",
831
- outputs: [{ internalType: "uint256[]", name: "", type: "uint256[]" }],
1192
+ outputs: [
1193
+ {
1194
+ internalType: "uint256[]",
1195
+ name: "",
1196
+ type: "uint256[]"
1197
+ }
1198
+ ],
832
1199
  stateMutability: "view",
833
1200
  type: "function"
834
1201
  },
835
1202
  {
836
1203
  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" }
1204
+ {
1205
+ internalType: "uint256",
1206
+ name: "jobId",
1207
+ type: "uint256"
1208
+ },
1209
+ {
1210
+ internalType: "uint8",
1211
+ name: "phase",
1212
+ type: "uint8"
1213
+ },
1214
+ {
1215
+ internalType: "uint256",
1216
+ name: "offset",
1217
+ type: "uint256"
1218
+ },
1219
+ {
1220
+ internalType: "uint256",
1221
+ name: "limit",
1222
+ type: "uint256"
1223
+ }
841
1224
  ],
842
1225
  name: "getMemosForPhase",
843
1226
  outputs: [
844
1227
  {
845
1228
  components: [
846
- { internalType: "string", name: "content", type: "string" },
1229
+ {
1230
+ internalType: "string",
1231
+ name: "content",
1232
+ type: "string"
1233
+ },
847
1234
  {
848
1235
  internalType: "enum InteractionLedger.MemoType",
849
1236
  name: "memoType",
850
1237
  type: "uint8"
851
1238
  },
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" }
1239
+ {
1240
+ internalType: "bool",
1241
+ name: "isSecured",
1242
+ type: "bool"
1243
+ },
1244
+ {
1245
+ internalType: "uint8",
1246
+ name: "nextPhase",
1247
+ type: "uint8"
1248
+ },
1249
+ {
1250
+ internalType: "uint256",
1251
+ name: "jobId",
1252
+ type: "uint256"
1253
+ },
1254
+ {
1255
+ internalType: "address",
1256
+ name: "sender",
1257
+ type: "address"
1258
+ }
856
1259
  ],
857
1260
  internalType: "struct InteractionLedger.Memo[]",
858
1261
  name: "",
859
1262
  type: "tuple[]"
860
1263
  },
861
- { internalType: "uint256", name: "total", type: "uint256" }
1264
+ {
1265
+ internalType: "uint256",
1266
+ name: "total",
1267
+ type: "uint256"
1268
+ }
862
1269
  ],
863
1270
  stateMutability: "view",
864
1271
  type: "function"
@@ -866,317 +1273,878 @@ var ACP_ABI = [
866
1273
  {
867
1274
  inputs: [],
868
1275
  name: "getPhases",
869
- outputs: [{ internalType: "string[7]", name: "", type: "string[7]" }],
1276
+ outputs: [
1277
+ {
1278
+ internalType: "string[7]",
1279
+ name: "",
1280
+ type: "string[7]"
1281
+ }
1282
+ ],
870
1283
  stateMutability: "pure",
871
1284
  type: "function"
872
1285
  },
873
1286
  {
874
- inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
1287
+ inputs: [
1288
+ {
1289
+ internalType: "bytes32",
1290
+ name: "role",
1291
+ type: "bytes32"
1292
+ }
1293
+ ],
875
1294
  name: "getRoleAdmin",
876
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
1295
+ outputs: [
1296
+ {
1297
+ internalType: "bytes32",
1298
+ name: "",
1299
+ type: "bytes32"
1300
+ }
1301
+ ],
1302
+ stateMutability: "view",
1303
+ type: "function"
1304
+ },
1305
+ {
1306
+ inputs: [
1307
+ {
1308
+ internalType: "bytes32",
1309
+ name: "role",
1310
+ type: "bytes32"
1311
+ },
1312
+ {
1313
+ internalType: "address",
1314
+ name: "account",
1315
+ type: "address"
1316
+ }
1317
+ ],
1318
+ name: "grantRole",
1319
+ outputs: [],
1320
+ stateMutability: "nonpayable",
1321
+ type: "function"
1322
+ },
1323
+ {
1324
+ inputs: [
1325
+ {
1326
+ internalType: "bytes32",
1327
+ name: "role",
1328
+ type: "bytes32"
1329
+ },
1330
+ {
1331
+ internalType: "address",
1332
+ name: "account",
1333
+ type: "address"
1334
+ }
1335
+ ],
1336
+ name: "hasRole",
1337
+ outputs: [
1338
+ {
1339
+ internalType: "bool",
1340
+ name: "",
1341
+ type: "bool"
1342
+ }
1343
+ ],
877
1344
  stateMutability: "view",
878
1345
  type: "function"
879
1346
  },
880
1347
  {
881
1348
  inputs: [
882
- { internalType: "bytes32", name: "role", type: "bytes32" },
883
- { internalType: "address", name: "account", type: "address" }
1349
+ {
1350
+ internalType: "address",
1351
+ name: "paymentTokenAddress",
1352
+ type: "address"
1353
+ },
1354
+ {
1355
+ internalType: "uint256",
1356
+ name: "evaluatorFeeBP_",
1357
+ type: "uint256"
1358
+ },
1359
+ {
1360
+ internalType: "uint256",
1361
+ name: "platformFeeBP_",
1362
+ type: "uint256"
1363
+ },
1364
+ {
1365
+ internalType: "address",
1366
+ name: "platformTreasury_",
1367
+ type: "address"
1368
+ }
1369
+ ],
1370
+ name: "initialize",
1371
+ outputs: [],
1372
+ stateMutability: "nonpayable",
1373
+ type: "function"
1374
+ },
1375
+ {
1376
+ inputs: [
1377
+ {
1378
+ internalType: "uint256",
1379
+ name: "jobId",
1380
+ type: "uint256"
1381
+ },
1382
+ {
1383
+ internalType: "address",
1384
+ name: "account",
1385
+ type: "address"
1386
+ }
1387
+ ],
1388
+ name: "isJobEvaluator",
1389
+ outputs: [
1390
+ {
1391
+ internalType: "bool",
1392
+ name: "",
1393
+ type: "bool"
1394
+ }
1395
+ ],
1396
+ stateMutability: "view",
1397
+ type: "function"
1398
+ },
1399
+ {
1400
+ inputs: [
1401
+ {
1402
+ internalType: "uint256",
1403
+ name: "memoId",
1404
+ type: "uint256"
1405
+ }
1406
+ ],
1407
+ name: "isPayableMemo",
1408
+ outputs: [
1409
+ {
1410
+ internalType: "bool",
1411
+ name: "",
1412
+ type: "bool"
1413
+ }
1414
+ ],
1415
+ stateMutability: "view",
1416
+ type: "function"
1417
+ },
1418
+ {
1419
+ inputs: [
1420
+ {
1421
+ internalType: "uint256",
1422
+ name: "jobId",
1423
+ type: "uint256"
1424
+ }
1425
+ ],
1426
+ name: "jobAdditionalFees",
1427
+ outputs: [
1428
+ {
1429
+ internalType: "uint256",
1430
+ name: "",
1431
+ type: "uint256"
1432
+ }
1433
+ ],
1434
+ stateMutability: "view",
1435
+ type: "function"
1436
+ },
1437
+ {
1438
+ inputs: [],
1439
+ name: "jobCounter",
1440
+ outputs: [
1441
+ {
1442
+ internalType: "uint256",
1443
+ name: "",
1444
+ type: "uint256"
1445
+ }
1446
+ ],
1447
+ stateMutability: "view",
1448
+ type: "function"
1449
+ },
1450
+ {
1451
+ inputs: [
1452
+ {
1453
+ internalType: "uint256",
1454
+ name: "jobId",
1455
+ type: "uint256"
1456
+ },
1457
+ {
1458
+ internalType: "uint8",
1459
+ name: "phase",
1460
+ type: "uint8"
1461
+ },
1462
+ {
1463
+ internalType: "uint256",
1464
+ name: "",
1465
+ type: "uint256"
1466
+ }
1467
+ ],
1468
+ name: "jobMemoIds",
1469
+ outputs: [
1470
+ {
1471
+ internalType: "uint256",
1472
+ name: "memoIds",
1473
+ type: "uint256"
1474
+ }
1475
+ ],
1476
+ stateMutability: "view",
1477
+ type: "function"
1478
+ },
1479
+ {
1480
+ inputs: [
1481
+ {
1482
+ internalType: "uint256",
1483
+ name: "",
1484
+ type: "uint256"
1485
+ }
1486
+ ],
1487
+ name: "jobs",
1488
+ outputs: [
1489
+ {
1490
+ internalType: "uint256",
1491
+ name: "id",
1492
+ type: "uint256"
1493
+ },
1494
+ {
1495
+ internalType: "address",
1496
+ name: "client",
1497
+ type: "address"
1498
+ },
1499
+ {
1500
+ internalType: "address",
1501
+ name: "provider",
1502
+ type: "address"
1503
+ },
1504
+ {
1505
+ internalType: "uint256",
1506
+ name: "budget",
1507
+ type: "uint256"
1508
+ },
1509
+ {
1510
+ internalType: "uint256",
1511
+ name: "amountClaimed",
1512
+ type: "uint256"
1513
+ },
1514
+ {
1515
+ internalType: "uint8",
1516
+ name: "phase",
1517
+ type: "uint8"
1518
+ },
1519
+ {
1520
+ internalType: "uint256",
1521
+ name: "memoCount",
1522
+ type: "uint256"
1523
+ },
1524
+ {
1525
+ internalType: "uint256",
1526
+ name: "expiredAt",
1527
+ type: "uint256"
1528
+ },
1529
+ {
1530
+ internalType: "address",
1531
+ name: "evaluator",
1532
+ type: "address"
1533
+ },
1534
+ {
1535
+ internalType: "contract IERC20",
1536
+ name: "jobPaymentToken",
1537
+ type: "address"
1538
+ }
1539
+ ],
1540
+ stateMutability: "view",
1541
+ type: "function"
1542
+ },
1543
+ {
1544
+ inputs: [],
1545
+ name: "memoCounter",
1546
+ outputs: [
1547
+ {
1548
+ internalType: "uint256",
1549
+ name: "",
1550
+ type: "uint256"
1551
+ }
1552
+ ],
1553
+ stateMutability: "view",
1554
+ type: "function"
1555
+ },
1556
+ {
1557
+ inputs: [
1558
+ {
1559
+ internalType: "uint256",
1560
+ name: "memoId",
1561
+ type: "uint256"
1562
+ }
1563
+ ],
1564
+ name: "memoExpiredAt",
1565
+ outputs: [
1566
+ {
1567
+ internalType: "uint256",
1568
+ name: "expiredAt",
1569
+ type: "uint256"
1570
+ }
1571
+ ],
1572
+ stateMutability: "view",
1573
+ type: "function"
1574
+ },
1575
+ {
1576
+ inputs: [
1577
+ {
1578
+ internalType: "uint256",
1579
+ name: "",
1580
+ type: "uint256"
1581
+ }
1582
+ ],
1583
+ name: "memos",
1584
+ outputs: [
1585
+ {
1586
+ internalType: "string",
1587
+ name: "content",
1588
+ type: "string"
1589
+ },
1590
+ {
1591
+ internalType: "enum InteractionLedger.MemoType",
1592
+ name: "memoType",
1593
+ type: "uint8"
1594
+ },
1595
+ {
1596
+ internalType: "bool",
1597
+ name: "isSecured",
1598
+ type: "bool"
1599
+ },
1600
+ {
1601
+ internalType: "uint8",
1602
+ name: "nextPhase",
1603
+ type: "uint8"
1604
+ },
1605
+ {
1606
+ internalType: "uint256",
1607
+ name: "jobId",
1608
+ type: "uint256"
1609
+ },
1610
+ {
1611
+ internalType: "address",
1612
+ name: "sender",
1613
+ type: "address"
1614
+ }
1615
+ ],
1616
+ stateMutability: "view",
1617
+ type: "function"
1618
+ },
1619
+ {
1620
+ inputs: [],
1621
+ name: "numEvaluatorsPerJob",
1622
+ outputs: [
1623
+ {
1624
+ internalType: "uint8",
1625
+ name: "",
1626
+ type: "uint8"
1627
+ }
1628
+ ],
1629
+ stateMutability: "view",
1630
+ type: "function"
1631
+ },
1632
+ {
1633
+ inputs: [
1634
+ {
1635
+ internalType: "uint256",
1636
+ name: "memoId",
1637
+ type: "uint256"
1638
+ }
1639
+ ],
1640
+ name: "payableDetails",
1641
+ outputs: [
1642
+ {
1643
+ internalType: "address",
1644
+ name: "token",
1645
+ type: "address"
1646
+ },
1647
+ {
1648
+ internalType: "uint256",
1649
+ name: "amount",
1650
+ type: "uint256"
1651
+ },
1652
+ {
1653
+ internalType: "address",
1654
+ name: "recipient",
1655
+ type: "address"
1656
+ },
1657
+ {
1658
+ internalType: "uint256",
1659
+ name: "feeAmount",
1660
+ type: "uint256"
1661
+ },
1662
+ {
1663
+ internalType: "enum ACPSimple.FeeType",
1664
+ name: "feeType",
1665
+ type: "uint8"
1666
+ },
1667
+ {
1668
+ internalType: "bool",
1669
+ name: "isExecuted",
1670
+ type: "bool"
1671
+ }
1672
+ ],
1673
+ stateMutability: "view",
1674
+ type: "function"
1675
+ },
1676
+ {
1677
+ inputs: [],
1678
+ name: "paymentToken",
1679
+ outputs: [
1680
+ {
1681
+ internalType: "contract IERC20",
1682
+ name: "",
1683
+ type: "address"
1684
+ }
1685
+ ],
1686
+ stateMutability: "view",
1687
+ type: "function"
1688
+ },
1689
+ {
1690
+ inputs: [],
1691
+ name: "platformFeeBP",
1692
+ outputs: [
1693
+ {
1694
+ internalType: "uint256",
1695
+ name: "",
1696
+ type: "uint256"
1697
+ }
1698
+ ],
1699
+ stateMutability: "view",
1700
+ type: "function"
1701
+ },
1702
+ {
1703
+ inputs: [],
1704
+ name: "platformTreasury",
1705
+ outputs: [
1706
+ {
1707
+ internalType: "address",
1708
+ name: "",
1709
+ type: "address"
1710
+ }
1711
+ ],
1712
+ stateMutability: "view",
1713
+ type: "function"
1714
+ },
1715
+ {
1716
+ inputs: [
1717
+ {
1718
+ internalType: "bytes32",
1719
+ name: "role",
1720
+ type: "bytes32"
1721
+ },
1722
+ {
1723
+ internalType: "address",
1724
+ name: "callerConfirmation",
1725
+ type: "address"
1726
+ }
1727
+ ],
1728
+ name: "renounceRole",
1729
+ outputs: [],
1730
+ stateMutability: "nonpayable",
1731
+ type: "function"
1732
+ },
1733
+ {
1734
+ inputs: [
1735
+ {
1736
+ internalType: "bytes32",
1737
+ name: "role",
1738
+ type: "bytes32"
1739
+ },
1740
+ {
1741
+ internalType: "address",
1742
+ name: "account",
1743
+ type: "address"
1744
+ }
1745
+ ],
1746
+ name: "revokeRole",
1747
+ outputs: [],
1748
+ stateMutability: "nonpayable",
1749
+ type: "function"
1750
+ },
1751
+ {
1752
+ inputs: [
1753
+ {
1754
+ internalType: "uint256",
1755
+ name: "jobId",
1756
+ type: "uint256"
1757
+ },
1758
+ {
1759
+ internalType: "uint256",
1760
+ name: "amount",
1761
+ type: "uint256"
1762
+ }
1763
+ ],
1764
+ name: "setBudget",
1765
+ outputs: [],
1766
+ stateMutability: "nonpayable",
1767
+ type: "function"
1768
+ },
1769
+ {
1770
+ inputs: [
1771
+ {
1772
+ internalType: "uint256",
1773
+ name: "jobId",
1774
+ type: "uint256"
1775
+ },
1776
+ {
1777
+ internalType: "uint256",
1778
+ name: "amount",
1779
+ type: "uint256"
1780
+ },
1781
+ {
1782
+ internalType: "contract IERC20",
1783
+ name: "jobPaymentToken_",
1784
+ type: "address"
1785
+ }
1786
+ ],
1787
+ name: "setBudgetWithPaymentToken",
1788
+ outputs: [],
1789
+ stateMutability: "nonpayable",
1790
+ type: "function"
1791
+ },
1792
+ {
1793
+ inputs: [
1794
+ {
1795
+ internalType: "uint256",
1796
+ name: "memoId",
1797
+ type: "uint256"
1798
+ },
1799
+ {
1800
+ internalType: "bool",
1801
+ name: "isApproved",
1802
+ type: "bool"
1803
+ },
1804
+ {
1805
+ internalType: "string",
1806
+ name: "reason",
1807
+ type: "string"
1808
+ }
1809
+ ],
1810
+ name: "signMemo",
1811
+ outputs: [],
1812
+ stateMutability: "nonpayable",
1813
+ type: "function"
1814
+ },
1815
+ {
1816
+ inputs: [
1817
+ {
1818
+ internalType: "uint256",
1819
+ name: "memoId",
1820
+ type: "uint256"
1821
+ },
1822
+ {
1823
+ internalType: "address",
1824
+ name: "signer",
1825
+ type: "address"
1826
+ }
1827
+ ],
1828
+ name: "signatories",
1829
+ outputs: [
1830
+ {
1831
+ internalType: "uint8",
1832
+ name: "res",
1833
+ type: "uint8"
1834
+ }
1835
+ ],
1836
+ stateMutability: "view",
1837
+ type: "function"
1838
+ },
1839
+ {
1840
+ inputs: [
1841
+ {
1842
+ internalType: "bytes4",
1843
+ name: "interfaceId",
1844
+ type: "bytes4"
1845
+ }
1846
+ ],
1847
+ name: "supportsInterface",
1848
+ outputs: [
1849
+ {
1850
+ internalType: "bool",
1851
+ name: "",
1852
+ type: "bool"
1853
+ }
1854
+ ],
1855
+ stateMutability: "view",
1856
+ type: "function"
1857
+ },
1858
+ {
1859
+ inputs: [
1860
+ {
1861
+ internalType: "uint256",
1862
+ name: "evaluatorFeeBP_",
1863
+ type: "uint256"
1864
+ }
1865
+ ],
1866
+ name: "updateEvaluatorFee",
1867
+ outputs: [],
1868
+ stateMutability: "nonpayable",
1869
+ type: "function"
1870
+ },
1871
+ {
1872
+ inputs: [
1873
+ {
1874
+ internalType: "uint256",
1875
+ name: "platformFeeBP_",
1876
+ type: "uint256"
1877
+ },
1878
+ {
1879
+ internalType: "address",
1880
+ name: "platformTreasury_",
1881
+ type: "address"
1882
+ }
1883
+ ],
1884
+ name: "updatePlatformFee",
1885
+ outputs: [],
1886
+ stateMutability: "nonpayable",
1887
+ type: "function"
1888
+ },
1889
+ {
1890
+ inputs: [
1891
+ {
1892
+ internalType: "uint256",
1893
+ name: "memoId",
1894
+ type: "uint256"
1895
+ }
1896
+ ],
1897
+ name: "withdrawEscrowedFunds",
1898
+ outputs: [],
1899
+ stateMutability: "nonpayable",
1900
+ type: "function"
1901
+ }
1902
+ ];
1903
+ var acpAbi_default = ACP_ABI;
1904
+
1905
+ // src/acpClient.ts
1906
+ var import_socket = require("socket.io-client");
1907
+
1908
+ // src/acpContractClient.ts
1909
+ var import_core = require("@aa-sdk/core");
1910
+ var import_infra2 = require("@account-kit/infra");
1911
+ var import_smart_contracts = require("@account-kit/smart-contracts");
1912
+ var import_viem2 = require("viem");
1913
+
1914
+ // src/acpConfigs.ts
1915
+ var import_infra = require("@account-kit/infra");
1916
+
1917
+ // src/acpFare.ts
1918
+ var import_viem = require("viem");
1919
+ var Fare = class {
1920
+ constructor(contractAddress, decimals) {
1921
+ this.contractAddress = contractAddress;
1922
+ this.decimals = decimals;
1923
+ }
1924
+ formatAmount(amount) {
1925
+ return (0, import_viem.parseUnits)(amount.toString(), this.decimals);
1926
+ }
1927
+ };
1928
+ var FareAmount = class _FareAmount {
1929
+ constructor(fareAmount, fare) {
1930
+ this.amount = fare.formatAmount(
1931
+ this.truncateTo6Decimals(fareAmount.toString())
1932
+ );
1933
+ this.fare = fare;
1934
+ }
1935
+ truncateTo6Decimals(input) {
1936
+ const [intPart, decPart = ""] = input.split(".");
1937
+ if (decPart === "") {
1938
+ return parseFloat(intPart);
1939
+ }
1940
+ const truncated = decPart.slice(0, 6).padEnd(6, "0");
1941
+ return parseFloat(`${intPart}.${truncated}`);
1942
+ }
1943
+ add(other) {
1944
+ if (this.fare.contractAddress !== other.fare.contractAddress) {
1945
+ throw new Error("Token addresses do not match");
1946
+ }
1947
+ return new _FareAmount(Number(this.amount + other.amount), this.fare);
1948
+ }
1949
+ };
1950
+ var FareBigInt = class _FareBigInt {
1951
+ constructor(amount, fare) {
1952
+ this.amount = amount;
1953
+ this.fare = fare;
1954
+ }
1955
+ add(other) {
1956
+ if (this.fare.contractAddress !== other.fare.contractAddress) {
1957
+ throw new Error("Token addresses do not match");
1958
+ }
1959
+ return new _FareBigInt(this.amount + other.amount, this.fare);
1960
+ }
1961
+ };
1962
+ var wethFare = new Fare("0x4200000000000000000000000000000000000006", 18);
1963
+ var ethFare = new Fare(import_viem.ethAddress, 18);
1964
+
1965
+ // src/acpConfigs.ts
1966
+ var AcpContractConfig = class {
1967
+ constructor(chain, contractAddress, baseFare, alchemyRpcUrl, acpUrl, rpcEndpoint) {
1968
+ this.chain = chain;
1969
+ this.contractAddress = contractAddress;
1970
+ this.baseFare = baseFare;
1971
+ this.alchemyRpcUrl = alchemyRpcUrl;
1972
+ this.acpUrl = acpUrl;
1973
+ this.rpcEndpoint = rpcEndpoint;
1974
+ }
1975
+ };
1976
+ var baseSepoliaAcpConfig = new AcpContractConfig(
1977
+ import_infra.baseSepolia,
1978
+ "0x8Db6B1c839Fc8f6bd35777E194677B67b4D51928",
1979
+ new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6),
1980
+ "https://alchemy-proxy.virtuals.io/api/proxy/rpc",
1981
+ "https://acpx.virtuals.gg"
1982
+ );
1983
+ var baseAcpConfig = new AcpContractConfig(
1984
+ import_infra.base,
1985
+ "0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
1986
+ new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6),
1987
+ "https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
1988
+ "https://acpx.virtuals.io"
1989
+ );
1990
+
1991
+ // src/wethAbi.ts
1992
+ var WETH_ABI = [
1993
+ {
1994
+ anonymous: false,
1995
+ inputs: [
1996
+ { indexed: true, internalType: "address", name: "src", type: "address" },
1997
+ { indexed: true, internalType: "address", name: "guy", type: "address" },
1998
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
884
1999
  ],
885
- name: "grantRole",
886
- outputs: [],
887
- stateMutability: "nonpayable",
888
- type: "function"
2000
+ name: "Approval",
2001
+ type: "event"
889
2002
  },
890
2003
  {
2004
+ anonymous: false,
891
2005
  inputs: [
892
- { internalType: "bytes32", name: "role", type: "bytes32" },
893
- { internalType: "address", name: "account", type: "address" }
2006
+ { indexed: true, internalType: "address", name: "dst", type: "address" },
2007
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
894
2008
  ],
895
- name: "hasRole",
896
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
897
- stateMutability: "view",
898
- type: "function"
2009
+ name: "Deposit",
2010
+ type: "event"
899
2011
  },
900
2012
  {
2013
+ anonymous: false,
901
2014
  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" }
2015
+ { indexed: true, internalType: "address", name: "src", type: "address" },
2016
+ { indexed: true, internalType: "address", name: "dst", type: "address" },
2017
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
906
2018
  ],
907
- name: "initialize",
908
- outputs: [],
909
- stateMutability: "nonpayable",
910
- type: "function"
2019
+ name: "Transfer",
2020
+ type: "event"
911
2021
  },
912
2022
  {
2023
+ anonymous: false,
913
2024
  inputs: [
914
- { internalType: "uint256", name: "jobId", type: "uint256" },
915
- { internalType: "address", name: "account", type: "address" }
2025
+ { indexed: true, internalType: "address", name: "src", type: "address" },
2026
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
916
2027
  ],
917
- name: "isJobEvaluator",
918
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
919
- stateMutability: "view",
920
- type: "function"
921
- },
922
- {
923
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
924
- name: "isPayableMemo",
925
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
926
- stateMutability: "view",
927
- type: "function"
928
- },
929
- {
930
- inputs: [{ internalType: "uint256", name: "jobId", type: "uint256" }],
931
- name: "jobAdditionalFees",
932
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
933
- stateMutability: "view",
934
- type: "function"
935
- },
936
- {
937
- inputs: [],
938
- name: "jobCounter",
939
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
940
- stateMutability: "view",
941
- type: "function"
2028
+ name: "Withdrawal",
2029
+ type: "event"
942
2030
  },
2031
+ { payable: true, stateMutability: "payable", type: "fallback" },
943
2032
  {
2033
+ constant: true,
944
2034
  inputs: [
945
- { internalType: "uint256", name: "jobId", type: "uint256" },
946
- { internalType: "uint8", name: "phase", type: "uint8" },
947
- { internalType: "uint256", name: "", type: "uint256" }
948
- ],
949
- name: "jobMemoIds",
950
- outputs: [{ internalType: "uint256", name: "memoIds", type: "uint256" }],
951
- stateMutability: "view",
952
- type: "function"
953
- },
954
- {
955
- inputs: [{ internalType: "uint256", name: "jobId", type: "uint256" }],
956
- name: "jobPayment",
957
- outputs: [
958
- { internalType: "address", name: "paymentToken", type: "address" }
2035
+ { internalType: "address", name: "", type: "address" },
2036
+ { internalType: "address", name: "", type: "address" }
959
2037
  ],
2038
+ name: "allowance",
2039
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2040
+ payable: false,
960
2041
  stateMutability: "view",
961
2042
  type: "function"
962
2043
  },
963
2044
  {
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" }
2045
+ constant: false,
2046
+ inputs: [
2047
+ { internalType: "address", name: "guy", type: "address" },
2048
+ { internalType: "uint256", name: "wad", type: "uint256" }
976
2049
  ],
977
- stateMutability: "view",
2050
+ name: "approve",
2051
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
2052
+ payable: false,
2053
+ stateMutability: "nonpayable",
978
2054
  type: "function"
979
2055
  },
980
2056
  {
981
- inputs: [],
982
- name: "memoCounter",
2057
+ constant: true,
2058
+ inputs: [{ internalType: "address", name: "", type: "address" }],
2059
+ name: "balanceOf",
983
2060
  outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2061
+ payable: false,
984
2062
  stateMutability: "view",
985
2063
  type: "function"
986
2064
  },
987
2065
  {
988
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
989
- name: "memoExpiredAt",
990
- outputs: [{ internalType: "uint256", name: "expiredAt", type: "uint256" }],
991
- stateMutability: "view",
992
- type: "function"
993
- },
994
- {
995
- inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
996
- name: "memos",
997
- outputs: [
998
- { internalType: "string", name: "content", type: "string" },
999
- {
1000
- internalType: "enum InteractionLedger.MemoType",
1001
- name: "memoType",
1002
- type: "uint8"
1003
- },
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" }
1008
- ],
1009
- stateMutability: "view",
1010
- type: "function"
1011
- },
1012
- {
2066
+ constant: true,
1013
2067
  inputs: [],
1014
- name: "numEvaluatorsPerJob",
2068
+ name: "decimals",
1015
2069
  outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
2070
+ payable: false,
1016
2071
  stateMutability: "view",
1017
2072
  type: "function"
1018
2073
  },
1019
2074
  {
1020
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
1021
- name: "payableDetails",
1022
- 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" },
1027
- {
1028
- internalType: "enum ACPSimple.FeeType",
1029
- name: "feeType",
1030
- type: "uint8"
1031
- },
1032
- { internalType: "bool", name: "isExecuted", type: "bool" }
1033
- ],
1034
- stateMutability: "view",
2075
+ constant: false,
2076
+ inputs: [],
2077
+ name: "deposit",
2078
+ outputs: [],
2079
+ payable: true,
2080
+ stateMutability: "payable",
1035
2081
  type: "function"
1036
2082
  },
1037
2083
  {
2084
+ constant: true,
1038
2085
  inputs: [],
1039
- name: "paymentToken",
1040
- outputs: [{ internalType: "contract IERC20", name: "", type: "address" }],
2086
+ name: "name",
2087
+ outputs: [{ internalType: "string", name: "", type: "string" }],
2088
+ payable: false,
1041
2089
  stateMutability: "view",
1042
2090
  type: "function"
1043
2091
  },
1044
2092
  {
2093
+ constant: true,
1045
2094
  inputs: [],
1046
- name: "platformFeeBP",
1047
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2095
+ name: "symbol",
2096
+ outputs: [{ internalType: "string", name: "", type: "string" }],
2097
+ payable: false,
1048
2098
  stateMutability: "view",
1049
2099
  type: "function"
1050
2100
  },
1051
2101
  {
2102
+ constant: true,
1052
2103
  inputs: [],
1053
- name: "platformTreasury",
1054
- outputs: [{ internalType: "address", name: "", type: "address" }],
2104
+ name: "totalSupply",
2105
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2106
+ payable: false,
1055
2107
  stateMutability: "view",
1056
2108
  type: "function"
1057
2109
  },
1058
2110
  {
2111
+ constant: false,
1059
2112
  inputs: [
1060
- { internalType: "bytes32", name: "role", type: "bytes32" },
1061
- { internalType: "address", name: "callerConfirmation", type: "address" }
1062
- ],
1063
- name: "renounceRole",
1064
- outputs: [],
1065
- stateMutability: "nonpayable",
1066
- type: "function"
1067
- },
1068
- {
1069
- inputs: [
1070
- { internalType: "bytes32", name: "role", type: "bytes32" },
1071
- { internalType: "address", name: "account", type: "address" }
1072
- ],
1073
- name: "revokeRole",
1074
- outputs: [],
1075
- stateMutability: "nonpayable",
1076
- type: "function"
1077
- },
1078
- {
1079
- inputs: [
1080
- { internalType: "uint256", name: "jobId", type: "uint256" },
1081
- { internalType: "uint256", name: "amount", type: "uint256" }
1082
- ],
1083
- name: "setBudget",
1084
- outputs: [],
1085
- stateMutability: "nonpayable",
1086
- type: "function"
1087
- },
1088
- {
1089
- inputs: [
1090
- { internalType: "uint256", name: "memoId", type: "uint256" },
1091
- { internalType: "bool", name: "isApproved", type: "bool" },
1092
- { internalType: "string", name: "reason", type: "string" }
1093
- ],
1094
- name: "signMemo",
1095
- outputs: [],
1096
- stateMutability: "nonpayable",
1097
- type: "function"
1098
- },
1099
- {
1100
- inputs: [
1101
- { internalType: "uint256", name: "memoId", type: "uint256" },
1102
- { internalType: "address", name: "signer", type: "address" }
2113
+ { internalType: "address", name: "dst", type: "address" },
2114
+ { internalType: "uint256", name: "wad", type: "uint256" }
1103
2115
  ],
1104
- name: "signatories",
1105
- outputs: [{ internalType: "uint8", name: "res", type: "uint8" }],
1106
- stateMutability: "view",
1107
- type: "function"
1108
- },
1109
- {
1110
- inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
1111
- name: "supportsInterface",
2116
+ name: "transfer",
1112
2117
  outputs: [{ internalType: "bool", name: "", type: "bool" }],
1113
- stateMutability: "view",
1114
- type: "function"
1115
- },
1116
- {
1117
- inputs: [
1118
- { internalType: "uint256", name: "evaluatorFeeBP_", type: "uint256" }
1119
- ],
1120
- name: "updateEvaluatorFee",
1121
- outputs: [],
2118
+ payable: false,
1122
2119
  stateMutability: "nonpayable",
1123
2120
  type: "function"
1124
2121
  },
1125
2122
  {
2123
+ constant: false,
1126
2124
  inputs: [
1127
- { internalType: "uint256", name: "platformFeeBP_", type: "uint256" },
1128
- { internalType: "address", name: "platformTreasury_", type: "address" }
2125
+ { internalType: "address", name: "src", type: "address" },
2126
+ { internalType: "address", name: "dst", type: "address" },
2127
+ { internalType: "uint256", name: "wad", type: "uint256" }
1129
2128
  ],
1130
- name: "updatePlatformFee",
1131
- outputs: [],
2129
+ name: "transferFrom",
2130
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
2131
+ payable: false,
1132
2132
  stateMutability: "nonpayable",
1133
2133
  type: "function"
1134
2134
  },
1135
2135
  {
1136
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
1137
- name: "withdrawEscrowedFunds",
2136
+ constant: false,
2137
+ inputs: [{ internalType: "uint256", name: "wad", type: "uint256" }],
2138
+ name: "withdraw",
1138
2139
  outputs: [],
2140
+ payable: false,
1139
2141
  stateMutability: "nonpayable",
1140
2142
  type: "function"
1141
2143
  }
1142
2144
  ];
1143
- var acpAbi_default = ACP_ABI;
1144
-
1145
- // src/acpClient.ts
1146
- var import_viem2 = require("viem");
1147
- var import_socket = require("socket.io-client");
1148
-
1149
- // src/acpContractClient.ts
1150
- var import_core = require("@aa-sdk/core");
1151
- var import_infra2 = require("@account-kit/infra");
1152
- var import_smart_contracts = require("@account-kit/smart-contracts");
1153
-
1154
- // src/configs.ts
1155
- var import_infra = require("@account-kit/infra");
1156
- var baseSepoliaAcpConfig = {
1157
- chain: import_infra.baseSepolia,
1158
- contractAddress: "0x8Db6B1c839Fc8f6bd35777E194677B67b4D51928",
1159
- virtualsTokenAddress: "0xbfAB80ccc15DF6fb7185f9498d6039317331846a",
1160
- alchemyRpcUrl: "https://alchemy-proxy.virtuals.io/api/proxy/rpc",
1161
- acpUrl: "https://acpx.virtuals.gg",
1162
- priorityFeeMultiplier: 2,
1163
- maxFeePerGas: 2e7,
1164
- maxPriorityFeePerGas: 21e6
1165
- };
1166
- var baseAcpConfig = {
1167
- chain: import_infra.base,
1168
- contractAddress: "0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
1169
- virtualsTokenAddress: "0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b",
1170
- alchemyRpcUrl: "https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
1171
- acpUrl: "https://acpx.virtuals.io",
1172
- priorityFeeMultiplier: 2,
1173
- maxFeePerGas: 2e7,
1174
- maxPriorityFeePerGas: 21e6
1175
- };
2145
+ var wethAbi_default = WETH_ABI;
1176
2146
 
1177
2147
  // src/acpContractClient.ts
1178
- var import_viem = require("viem");
1179
- var import_op_stack = require("viem/op-stack");
1180
2148
  var MemoType = /* @__PURE__ */ ((MemoType2) => {
1181
2149
  MemoType2[MemoType2["MESSAGE"] = 0] = "MESSAGE";
1182
2150
  MemoType2[MemoType2["CONTEXT_URL"] = 1] = "CONTEXT_URL";
@@ -1200,30 +2168,26 @@ var AcpJobPhases = /* @__PURE__ */ ((AcpJobPhases2) => {
1200
2168
  return AcpJobPhases2;
1201
2169
  })(AcpJobPhases || {});
1202
2170
  var AcpContractClient = class _AcpContractClient {
1203
- constructor(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig, customRpcUrl) {
2171
+ // private paymentTokenAddress: Address;
2172
+ constructor(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
1204
2173
  this.walletPrivateKey = walletPrivateKey;
1205
2174
  this.sessionEntityKeyId = sessionEntityKeyId;
1206
2175
  this.agentWalletAddress = agentWalletAddress;
1207
2176
  this.config = config;
1208
- this.customRpcUrl = customRpcUrl;
1209
2177
  this.MAX_RETRIES = 3;
2178
+ this.PRIORITY_FEE_MULTIPLIER = 2;
2179
+ this.MAX_FEE_PER_GAS = 2e7;
2180
+ this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
1210
2181
  this.chain = config.chain;
1211
2182
  this.contractAddress = config.contractAddress;
1212
- this.virtualsTokenAddress = config.virtualsTokenAddress;
1213
- this.customRpcUrl = customRpcUrl;
1214
- this.customRpcClient = (0, import_viem.createPublicClient)({
1215
- chain: this.chain,
1216
- transport: this.customRpcUrl ? (0, import_viem.http)(this.customRpcUrl) : (0, import_viem.http)()
1217
- }).extend((0, import_op_stack.publicActionsL2)());
1218
- }
1219
- static build(_0, _1, _2, _3) {
1220
- return __async(this, arguments, function* (walletPrivateKey, sessionEntityKeyId, agentWalletAddress, customRpcUrl, config = baseAcpConfig) {
2183
+ }
2184
+ static build(_0, _1, _2) {
2185
+ return __async(this, arguments, function* (walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
1221
2186
  const acpContractClient = new _AcpContractClient(
1222
2187
  walletPrivateKey,
1223
2188
  sessionEntityKeyId,
1224
2189
  agentWalletAddress,
1225
- config,
1226
- customRpcUrl
2190
+ config
1227
2191
  );
1228
2192
  yield acpContractClient.init();
1229
2193
  return acpContractClient;
@@ -1258,21 +2222,17 @@ var AcpContractClient = class _AcpContractClient {
1258
2222
  }
1259
2223
  calculateGasFees() {
1260
2224
  return __async(this, null, function* () {
1261
- const { maxFeePerGas, maxPriorityFeePerGas } = yield this.customRpcClient.estimateFeesPerGas();
1262
- let finalMaxFeePerGas = maxFeePerGas;
1263
- let priorityFeeMultiplier = Number(this.config.priorityFeeMultiplier) || 2;
1264
- const overrideMaxFeePerGas = this.config.maxFeePerGas || maxFeePerGas;
1265
- const overrideMaxPriorityFeePerGas = this.config.maxPriorityFeePerGas || maxPriorityFeePerGas;
1266
- finalMaxFeePerGas = BigInt(overrideMaxFeePerGas) + BigInt(overrideMaxPriorityFeePerGas) * BigInt(Math.max(0, priorityFeeMultiplier - 1));
2225
+ const finalMaxFeePerGas = BigInt(this.MAX_FEE_PER_GAS) + BigInt(this.MAX_PRIORITY_FEE_PER_GAS) * BigInt(Math.max(0, this.PRIORITY_FEE_MULTIPLIER - 1));
1267
2226
  return finalMaxFeePerGas;
1268
2227
  });
1269
2228
  }
1270
2229
  handleSendUserOperation(_0) {
1271
- return __async(this, arguments, function* (data, contractAddress = this.contractAddress) {
2230
+ return __async(this, arguments, function* (data, contractAddress = this.contractAddress, value) {
1272
2231
  const payload = {
1273
2232
  uo: {
1274
2233
  target: contractAddress,
1275
- data
2234
+ data,
2235
+ value
1276
2236
  },
1277
2237
  overrides: {}
1278
2238
  };
@@ -1316,13 +2276,13 @@ var AcpContractClient = class _AcpContractClient {
1316
2276
  if (!contractLogs) {
1317
2277
  throw new Error("Failed to get contract logs");
1318
2278
  }
1319
- return (0, import_viem.fromHex)(contractLogs.data, "number");
2279
+ return (0, import_viem2.fromHex)(contractLogs.data, "number");
1320
2280
  });
1321
2281
  }
1322
2282
  createJob(providerAddress, evaluatorAddress, expireAt) {
1323
2283
  return __async(this, null, function* () {
1324
2284
  try {
1325
- const data = (0, import_viem.encodeFunctionData)({
2285
+ const data = (0, import_viem2.encodeFunctionData)({
1326
2286
  abi: acpAbi_default,
1327
2287
  functionName: "createJob",
1328
2288
  args: [
@@ -1340,18 +2300,15 @@ var AcpContractClient = class _AcpContractClient {
1340
2300
  }
1341
2301
  });
1342
2302
  }
1343
- approveAllowance(priceInWei) {
1344
- return __async(this, null, function* () {
2303
+ approveAllowance(_0) {
2304
+ return __async(this, arguments, function* (amountBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
1345
2305
  try {
1346
- const data = (0, import_viem.encodeFunctionData)({
1347
- abi: import_viem.erc20Abi,
2306
+ const data = (0, import_viem2.encodeFunctionData)({
2307
+ abi: import_viem2.erc20Abi,
1348
2308
  functionName: "approve",
1349
- args: [this.contractAddress, priceInWei]
2309
+ args: [this.contractAddress, amountBaseUnit]
1350
2310
  });
1351
- return yield this.handleSendUserOperation(
1352
- data,
1353
- this.virtualsTokenAddress
1354
- );
2311
+ return yield this.handleSendUserOperation(data, paymentTokenAddress);
1355
2312
  } catch (error) {
1356
2313
  console.error(`Failed to approve allowance ${error}`);
1357
2314
  throw new Error("Failed to approve allowance");
@@ -1359,20 +2316,20 @@ var AcpContractClient = class _AcpContractClient {
1359
2316
  });
1360
2317
  }
1361
2318
  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) {
2319
+ return __async(this, arguments, function* (jobId, content, amountBaseUnit, recipient, feeAmountBaseUnit, feeType, nextPhase, type, expiredAt, token = this.config.baseFare.contractAddress) {
1363
2320
  let retries = 3;
1364
2321
  while (retries > 0) {
1365
2322
  try {
1366
- const data = (0, import_viem.encodeFunctionData)({
2323
+ const data = (0, import_viem2.encodeFunctionData)({
1367
2324
  abi: acpAbi_default,
1368
2325
  functionName: "createPayableMemo",
1369
2326
  args: [
1370
2327
  jobId,
1371
2328
  content,
1372
2329
  token,
1373
- amount,
2330
+ amountBaseUnit,
1374
2331
  recipient,
1375
- feeAmount,
2332
+ feeAmountBaseUnit,
1376
2333
  feeType,
1377
2334
  type,
1378
2335
  nextPhase,
@@ -1403,7 +2360,7 @@ var AcpContractClient = class _AcpContractClient {
1403
2360
  createMemo(jobId, content, type, isSecured, nextPhase) {
1404
2361
  return __async(this, null, function* () {
1405
2362
  try {
1406
- const data = (0, import_viem.encodeFunctionData)({
2363
+ const data = (0, import_viem2.encodeFunctionData)({
1407
2364
  abi: acpAbi_default,
1408
2365
  functionName: "createMemo",
1409
2366
  args: [jobId, content, type, isSecured, nextPhase]
@@ -1427,7 +2384,7 @@ var AcpContractClient = class _AcpContractClient {
1427
2384
  if (!contractLogs) {
1428
2385
  throw new Error("Failed to get contract logs");
1429
2386
  }
1430
- const decoded = (0, import_viem.decodeEventLog)({
2387
+ const decoded = (0, import_viem2.decodeEventLog)({
1431
2388
  abi: acpAbi_default,
1432
2389
  data: contractLogs.data,
1433
2390
  topics: contractLogs.topics
@@ -1441,7 +2398,7 @@ var AcpContractClient = class _AcpContractClient {
1441
2398
  signMemo(memoId, isApproved, reason) {
1442
2399
  return __async(this, null, function* () {
1443
2400
  try {
1444
- const data = (0, import_viem.encodeFunctionData)({
2401
+ const data = (0, import_viem2.encodeFunctionData)({
1445
2402
  abi: acpAbi_default,
1446
2403
  functionName: "signMemo",
1447
2404
  args: [memoId, isApproved, reason]
@@ -1453,13 +2410,28 @@ var AcpContractClient = class _AcpContractClient {
1453
2410
  }
1454
2411
  });
1455
2412
  }
1456
- setBudget(jobId, budget) {
2413
+ setBudget(jobId, budgetBaseUnit) {
1457
2414
  return __async(this, null, function* () {
1458
2415
  try {
1459
- const data = (0, import_viem.encodeFunctionData)({
2416
+ const data = (0, import_viem2.encodeFunctionData)({
1460
2417
  abi: acpAbi_default,
1461
2418
  functionName: "setBudget",
1462
- args: [jobId, budget]
2419
+ args: [jobId, budgetBaseUnit]
2420
+ });
2421
+ return yield this.handleSendUserOperation(data);
2422
+ } catch (error) {
2423
+ console.error(`Failed to set budget ${error}`);
2424
+ throw new Error("Failed to set budget");
2425
+ }
2426
+ });
2427
+ }
2428
+ setBudgetWithPaymentToken(_0, _1) {
2429
+ return __async(this, arguments, function* (jobId, budgetBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
2430
+ try {
2431
+ const data = (0, import_viem2.encodeFunctionData)({
2432
+ abi: acpAbi_default,
2433
+ functionName: "setBudgetWithPaymentToken",
2434
+ args: [jobId, budgetBaseUnit, paymentTokenAddress]
1463
2435
  });
1464
2436
  return yield this.handleSendUserOperation(data);
1465
2437
  } catch (error) {
@@ -1468,6 +2440,24 @@ var AcpContractClient = class _AcpContractClient {
1468
2440
  }
1469
2441
  });
1470
2442
  }
2443
+ wrapEth(amountBaseUnit) {
2444
+ return __async(this, null, function* () {
2445
+ try {
2446
+ const data = (0, import_viem2.encodeFunctionData)({
2447
+ abi: wethAbi_default,
2448
+ functionName: "deposit"
2449
+ });
2450
+ return yield this.handleSendUserOperation(
2451
+ data,
2452
+ wethFare.contractAddress,
2453
+ amountBaseUnit
2454
+ );
2455
+ } catch (error) {
2456
+ console.error(`Failed to wrap eth ${error}`);
2457
+ throw new Error("Failed to wrap eth");
2458
+ }
2459
+ });
2460
+ }
1471
2461
  };
1472
2462
  var acpContractClient_default = AcpContractClient;
1473
2463
 
@@ -1500,6 +2490,8 @@ var AcpOnlineStatus = /* @__PURE__ */ ((AcpOnlineStatus2) => {
1500
2490
  var PayloadType = /* @__PURE__ */ ((PayloadType2) => {
1501
2491
  PayloadType2["FUND_RESPONSE"] = "fund_response";
1502
2492
  PayloadType2["OPEN_POSITION"] = "open_position";
2493
+ PayloadType2["SWAP_TOKEN"] = "swap_token";
2494
+ PayloadType2["RESPONSE_SWAP_TOKEN"] = "response_swap_token";
1503
2495
  PayloadType2["CLOSE_PARTIAL_POSITION"] = "close_partial_position";
1504
2496
  PayloadType2["CLOSE_POSITION"] = "close_position";
1505
2497
  PayloadType2["POSITION_FULFILLED"] = "position_fulfilled";
@@ -1507,6 +2499,11 @@ var PayloadType = /* @__PURE__ */ ((PayloadType2) => {
1507
2499
  PayloadType2["UNFULFILLED_POSITION"] = "unfulfilled_position";
1508
2500
  return PayloadType2;
1509
2501
  })(PayloadType || {});
2502
+ var PositionDirection = /* @__PURE__ */ ((PositionDirection2) => {
2503
+ PositionDirection2["LONG"] = "long";
2504
+ PositionDirection2["SHORT"] = "short";
2505
+ return PositionDirection2;
2506
+ })(PositionDirection || {});
1510
2507
 
1511
2508
  // src/utils.ts
1512
2509
  function tryParseJson(content) {
@@ -1519,20 +2516,46 @@ function tryParseJson(content) {
1519
2516
 
1520
2517
  // src/acpJob.ts
1521
2518
  var AcpJob = class {
1522
- constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, memos, phase, context) {
2519
+ constructor(acpClient, id, clientAddress, providerAddress, evaluatorAddress, price, priceTokenAddress, memos, phase, context) {
1523
2520
  this.acpClient = acpClient;
1524
2521
  this.id = id;
1525
2522
  this.clientAddress = clientAddress;
1526
2523
  this.providerAddress = providerAddress;
1527
2524
  this.evaluatorAddress = evaluatorAddress;
1528
2525
  this.price = price;
2526
+ this.priceTokenAddress = priceTokenAddress;
1529
2527
  this.memos = memos;
1530
2528
  this.phase = phase;
1531
2529
  this.context = context;
2530
+ this.baseFare = acpClient.acpContractClient.config.baseFare;
1532
2531
  }
1533
2532
  get serviceRequirement() {
1534
2533
  var _a;
1535
- return (_a = this.memos.find((m) => m.nextPhase === 1 /* NEGOTIATION */)) == null ? void 0 : _a.content;
2534
+ const content = (_a = this.memos.find(
2535
+ (m) => m.nextPhase === 1 /* NEGOTIATION */
2536
+ )) == null ? void 0 : _a.content;
2537
+ if (!content) {
2538
+ return void 0;
2539
+ }
2540
+ const contentObj = tryParseJson(content);
2541
+ if (!contentObj) {
2542
+ return content;
2543
+ }
2544
+ if (contentObj.serviceRequirement) {
2545
+ return contentObj.serviceRequirement;
2546
+ }
2547
+ return contentObj;
2548
+ }
2549
+ get serviceName() {
2550
+ var _a;
2551
+ const content = (_a = this.memos.find(
2552
+ (m) => m.nextPhase === 1 /* NEGOTIATION */
2553
+ )) == null ? void 0 : _a.content;
2554
+ if (!content) {
2555
+ return void 0;
2556
+ }
2557
+ const contentObj = tryParseJson(content);
2558
+ return contentObj == null ? void 0 : contentObj.serviceName;
1536
2559
  }
1537
2560
  get deliverable() {
1538
2561
  var _a;
@@ -1558,7 +2581,12 @@ var AcpJob = class {
1558
2581
  if (!memo) {
1559
2582
  throw new Error("No transaction memo found");
1560
2583
  }
1561
- return yield this.acpClient.payJob(this.id, amount, memo.id, reason);
2584
+ return yield this.acpClient.payJob(
2585
+ this.id,
2586
+ this.baseFare.formatAmount(amount),
2587
+ memo.id,
2588
+ reason
2589
+ );
1562
2590
  });
1563
2591
  }
1564
2592
  respond(accept, payload, reason) {
@@ -1603,11 +2631,12 @@ var AcpJob = class {
1603
2631
  if (payload.length === 0) {
1604
2632
  throw new Error("No positions to open");
1605
2633
  }
2634
+ const sumAmount = payload.reduce((acc, curr) => acc + curr.amount, 0);
1606
2635
  return yield this.acpClient.transferFunds(
1607
2636
  this.id,
1608
- payload.reduce((acc, curr) => acc + curr.amount, 0),
2637
+ new FareAmount(sumAmount, this.baseFare),
1609
2638
  walletAddress || this.providerAddress,
1610
- feeAmount,
2639
+ new FareAmount(feeAmount, this.baseFare),
1611
2640
  1 /* IMMEDIATE_FEE */,
1612
2641
  {
1613
2642
  type: "open_position" /* OPEN_POSITION */,
@@ -1618,6 +2647,55 @@ var AcpJob = class {
1618
2647
  );
1619
2648
  });
1620
2649
  }
2650
+ swapToken(payload, decimals, feeAmount, walletAddress) {
2651
+ return __async(this, null, function* () {
2652
+ return yield this.acpClient.transferFunds(
2653
+ this.id,
2654
+ new FareAmount(
2655
+ payload.amount,
2656
+ new Fare(payload.fromContractAddress, decimals)
2657
+ ),
2658
+ walletAddress || this.providerAddress,
2659
+ new FareAmount(feeAmount, this.baseFare),
2660
+ 1 /* IMMEDIATE_FEE */,
2661
+ {
2662
+ type: "swap_token" /* SWAP_TOKEN */,
2663
+ data: payload
2664
+ },
2665
+ 2 /* TRANSACTION */,
2666
+ new Date(Date.now() + 1e3 * 60 * 30)
2667
+ );
2668
+ });
2669
+ }
2670
+ responseSwapToken(memoId, accept, reason) {
2671
+ return __async(this, null, function* () {
2672
+ const memo = this.memos.find((m) => m.id === memoId);
2673
+ if ((memo == null ? void 0 : memo.nextPhase) !== 2 /* TRANSACTION */ || (memo == null ? void 0 : memo.type) !== 8 /* PAYABLE_TRANSFER_ESCROW */) {
2674
+ throw new Error("No swap token memo found");
2675
+ }
2676
+ const payload = tryParseJson(
2677
+ memo.content
2678
+ );
2679
+ if ((payload == null ? void 0 : payload.type) !== "swap_token" /* SWAP_TOKEN */) {
2680
+ throw new Error("Invalid swap token memo");
2681
+ }
2682
+ return yield memo.sign(accept, reason);
2683
+ });
2684
+ }
2685
+ transferFunds(_0, _1, _2) {
2686
+ return __async(this, arguments, function* (payload, fareAmount, walletAddress, expiredAt = new Date(Date.now() + 1e3 * 60 * 30)) {
2687
+ return yield this.acpClient.transferFunds(
2688
+ this.id,
2689
+ fareAmount,
2690
+ walletAddress || this.clientAddress,
2691
+ new FareAmount(0, this.baseFare),
2692
+ 0 /* NO_FEE */,
2693
+ payload,
2694
+ 2 /* TRANSACTION */,
2695
+ expiredAt
2696
+ );
2697
+ });
2698
+ }
1621
2699
  responseOpenPosition(memoId, accept, reason) {
1622
2700
  return __async(this, null, function* () {
1623
2701
  const memo = this.memos.find((m) => m.id === memoId);
@@ -1637,9 +2715,9 @@ var AcpJob = class {
1637
2715
  return __async(this, arguments, function* (payload, expireAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
1638
2716
  return yield this.acpClient.requestFunds(
1639
2717
  this.id,
1640
- payload.amount,
2718
+ new FareAmount(payload.amount, this.baseFare),
1641
2719
  this.clientAddress,
1642
- 0,
2720
+ new FareAmount(0, this.baseFare),
1643
2721
  0 /* NO_FEE */,
1644
2722
  {
1645
2723
  type: "close_partial_position" /* CLOSE_PARTIAL_POSITION */,
@@ -1665,7 +2743,7 @@ var AcpJob = class {
1665
2743
  return yield this.acpClient.responseFundsRequest(
1666
2744
  memo.id,
1667
2745
  accept,
1668
- payload.data.amount,
2746
+ this.baseFare.formatAmount(payload.data.amount),
1669
2747
  reason
1670
2748
  );
1671
2749
  });
@@ -1696,9 +2774,9 @@ var AcpJob = class {
1696
2774
  if (accept) {
1697
2775
  return yield this.acpClient.transferFunds(
1698
2776
  this.id,
1699
- payload.amount,
2777
+ new FareAmount(payload.amount, this.baseFare),
1700
2778
  this.clientAddress,
1701
- 0,
2779
+ new FareAmount(0, this.baseFare),
1702
2780
  0 /* NO_FEE */,
1703
2781
  {
1704
2782
  type: "close_position" /* CLOSE_POSITION */,
@@ -1729,9 +2807,9 @@ var AcpJob = class {
1729
2807
  return __async(this, arguments, function* (payload, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
1730
2808
  return yield this.acpClient.transferFunds(
1731
2809
  this.id,
1732
- payload.amount,
2810
+ new FareAmount(payload.amount, this.baseFare),
1733
2811
  this.clientAddress,
1734
- 0,
2812
+ new FareAmount(0, this.baseFare),
1735
2813
  0 /* NO_FEE */,
1736
2814
  {
1737
2815
  type: "position_fulfilled" /* POSITION_FULFILLED */,
@@ -1746,9 +2824,9 @@ var AcpJob = class {
1746
2824
  return __async(this, arguments, function* (payload, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
1747
2825
  return yield this.acpClient.transferFunds(
1748
2826
  this.id,
1749
- payload.amount,
2827
+ new FareAmount(payload.amount, this.baseFare),
1750
2828
  this.clientAddress,
1751
- 0,
2829
+ new FareAmount(0, this.baseFare),
1752
2830
  0 /* NO_FEE */,
1753
2831
  {
1754
2832
  type: "unfulfilled_position" /* UNFULFILLED_POSITION */,
@@ -1835,9 +2913,9 @@ var AcpJob = class {
1835
2913
  }
1836
2914
  return yield this.acpClient.transferFunds(
1837
2915
  this.id,
1838
- fulfilledPositions.reduce((acc, curr) => acc + curr.amount, 0),
2916
+ new FareAmount(totalAmount, this.baseFare),
1839
2917
  this.clientAddress,
1840
- 0,
2918
+ new FareAmount(0, this.baseFare),
1841
2919
  0 /* NO_FEE */,
1842
2920
  {
1843
2921
  type: "close_job_and_withdraw" /* CLOSE_JOB_AND_WITHDRAW */,
@@ -1868,7 +2946,7 @@ var acpJob_default = AcpJob;
1868
2946
 
1869
2947
  // src/acpMemo.ts
1870
2948
  var AcpMemo = class {
1871
- constructor(acpClient, id, type, content, nextPhase, status, signedReason, expiry) {
2949
+ constructor(acpClient, id, type, content, nextPhase, status, signedReason, expiry, payableDetails) {
1872
2950
  this.acpClient = acpClient;
1873
2951
  this.id = id;
1874
2952
  this.type = type;
@@ -1877,6 +2955,11 @@ var AcpMemo = class {
1877
2955
  this.status = status;
1878
2956
  this.signedReason = signedReason;
1879
2957
  this.expiry = expiry;
2958
+ this.payableDetails = payableDetails;
2959
+ if (this.payableDetails) {
2960
+ this.payableDetails.amount = BigInt(this.payableDetails.amount);
2961
+ this.payableDetails.feeAmount = BigInt(this.payableDetails.feeAmount);
2962
+ }
1880
2963
  this.structuredContent = tryParseJson(this.content) || void 0;
1881
2964
  }
1882
2965
  get payloadType() {
@@ -1944,7 +3027,10 @@ var AcpJobOffering = class {
1944
3027
  return yield this.acpClient.initiateJob(
1945
3028
  this.providerAddress,
1946
3029
  finalServiceRequirement,
1947
- this.price,
3030
+ new FareAmount(
3031
+ this.price,
3032
+ this.acpClient.acpContractClient.config.baseFare
3033
+ ),
1948
3034
  evaluatorAddress,
1949
3035
  expiredAt
1950
3036
  );
@@ -1998,6 +3084,7 @@ var AcpClient = class {
1998
3084
  data.providerAddress,
1999
3085
  data.evaluatorAddress,
2000
3086
  data.price,
3087
+ data.priceTokenAddress,
2001
3088
  data.memos.map((memo) => {
2002
3089
  return new acpMemo_default(
2003
3090
  this,
@@ -2007,7 +3094,8 @@ var AcpClient = class {
2007
3094
  memo.nextPhase,
2008
3095
  memo.status,
2009
3096
  memo.signedReason,
2010
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3097
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3098
+ memo.payableDetails
2011
3099
  );
2012
3100
  }),
2013
3101
  data.phase,
@@ -2029,6 +3117,7 @@ var AcpClient = class {
2029
3117
  data.providerAddress,
2030
3118
  data.evaluatorAddress,
2031
3119
  data.price,
3120
+ data.priceTokenAddress,
2032
3121
  data.memos.map((memo) => {
2033
3122
  return new acpMemo_default(
2034
3123
  this,
@@ -2038,7 +3127,8 @@ var AcpClient = class {
2038
3127
  memo.nextPhase,
2039
3128
  memo.status,
2040
3129
  memo.signedReason,
2041
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3130
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3131
+ memo.payableDetails
2042
3132
  );
2043
3133
  }),
2044
3134
  data.phase,
@@ -2096,7 +3186,7 @@ var AcpClient = class {
2096
3186
  this,
2097
3187
  agent.walletAddress,
2098
3188
  offering.name,
2099
- offering.price,
3189
+ offering.priceUsd,
2100
3190
  offering.requirementSchema
2101
3191
  );
2102
3192
  }),
@@ -2108,18 +3198,22 @@ var AcpClient = class {
2108
3198
  });
2109
3199
  }
2110
3200
  initiateJob(_0, _1, _2, _3) {
2111
- return __async(this, arguments, function* (providerAddress, serviceRequirement, amount, evaluatorAddress, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
3201
+ return __async(this, arguments, function* (providerAddress, serviceRequirement, fareAmount, evaluatorAddress, expiredAt = new Date(Date.now() + 1e3 * 60 * 60 * 24)) {
3202
+ if (providerAddress === this.acpContractClient.walletAddress) {
3203
+ throw new Error(
3204
+ "Provider address cannot be the same as the client address"
3205
+ );
3206
+ }
2112
3207
  const { jobId } = yield this.acpContractClient.createJob(
2113
3208
  providerAddress,
2114
3209
  evaluatorAddress || this.acpContractClient.walletAddress,
2115
3210
  expiredAt
2116
3211
  );
2117
- if (amount > 0) {
2118
- yield this.acpContractClient.setBudget(
2119
- jobId,
2120
- (0, import_viem2.parseEther)(amount.toString())
2121
- );
2122
- }
3212
+ yield this.acpContractClient.setBudgetWithPaymentToken(
3213
+ jobId,
3214
+ fareAmount.amount,
3215
+ fareAmount.fare.contractAddress
3216
+ );
2123
3217
  yield this.acpContractClient.createMemo(
2124
3218
  jobId,
2125
3219
  typeof serviceRequirement === "string" ? serviceRequirement : JSON.stringify(serviceRequirement),
@@ -2145,31 +3239,29 @@ var AcpClient = class {
2145
3239
  );
2146
3240
  });
2147
3241
  }
2148
- payJob(jobId, amount, memoId, reason) {
3242
+ payJob(jobId, amountBaseUnit, memoId, reason) {
2149
3243
  return __async(this, null, function* () {
2150
- if (amount > 0) {
2151
- yield this.acpContractClient.approveAllowance(
2152
- (0, import_viem2.parseEther)(amount.toString())
2153
- );
3244
+ if (amountBaseUnit > BigInt(0)) {
3245
+ yield this.acpContractClient.approveAllowance(amountBaseUnit);
2154
3246
  }
2155
3247
  yield this.acpContractClient.signMemo(memoId, true, reason);
2156
3248
  return yield this.acpContractClient.createMemo(
2157
3249
  jobId,
2158
- `Payment of ${amount} made. ${reason != null ? reason : ""}`,
3250
+ `Payment made. ${reason != null ? reason : ""}`,
2159
3251
  0 /* MESSAGE */,
2160
3252
  false,
2161
3253
  3 /* EVALUATION */
2162
3254
  );
2163
3255
  });
2164
3256
  }
2165
- requestFunds(jobId, amount, recipient, feeAmount, feeType, reason, nextPhase, expiredAt) {
3257
+ requestFunds(jobId, transferFareAmount, recipient, feeFareAmount, feeType, reason, nextPhase, expiredAt) {
2166
3258
  return __async(this, null, function* () {
2167
3259
  return yield this.acpContractClient.createPayableMemo(
2168
3260
  jobId,
2169
3261
  JSON.stringify(reason),
2170
- (0, import_viem2.parseEther)(amount.toString()),
3262
+ transferFareAmount.amount,
2171
3263
  recipient,
2172
- (0, import_viem2.parseEther)(feeAmount.toString()),
3264
+ feeFareAmount.amount,
2173
3265
  feeType,
2174
3266
  nextPhase,
2175
3267
  6 /* PAYABLE_REQUEST */,
@@ -2177,37 +3269,49 @@ var AcpClient = class {
2177
3269
  );
2178
3270
  });
2179
3271
  }
2180
- responseFundsRequest(memoId, accept, amount, reason) {
3272
+ responseFundsRequest(memoId, accept, amountBaseUnit, reason) {
2181
3273
  return __async(this, null, function* () {
2182
3274
  if (!accept) {
2183
3275
  return yield this.acpContractClient.signMemo(memoId, accept, reason);
2184
3276
  }
2185
- if (amount > 0) {
2186
- yield this.acpContractClient.approveAllowance(
2187
- (0, import_viem2.parseEther)(amount.toString())
2188
- );
3277
+ if (amountBaseUnit > BigInt(0)) {
3278
+ yield this.acpContractClient.approveAllowance(amountBaseUnit);
2189
3279
  }
2190
3280
  return yield this.acpContractClient.signMemo(memoId, true, reason);
2191
3281
  });
2192
3282
  }
2193
- transferFunds(jobId, amount, recipient, feeAmount, feeType, reason, nextPhase, expiredAt) {
3283
+ transferFunds(jobId, transferFareAmount, recipient, feeFareAmount, feeType, reason, nextPhase, expiredAt) {
2194
3284
  return __async(this, null, function* () {
2195
- const totalAmount = amount + feeAmount;
2196
- if (totalAmount > 0) {
3285
+ if (transferFareAmount.fare.contractAddress === ethFare.contractAddress) {
3286
+ yield this.acpContractClient.wrapEth(transferFareAmount.amount);
3287
+ transferFareAmount = new FareBigInt(transferFareAmount.amount, wethFare);
3288
+ }
3289
+ if (feeFareAmount.amount > 0 && feeFareAmount.fare.contractAddress !== this.acpContractClient.config.baseFare.contractAddress) {
3290
+ throw new Error("Fee token address is not the same as the base fare");
3291
+ }
3292
+ const isFeeTokenDifferent = feeFareAmount.fare.contractAddress !== transferFareAmount.fare.contractAddress;
3293
+ if (isFeeTokenDifferent) {
2197
3294
  yield this.acpContractClient.approveAllowance(
2198
- (0, import_viem2.parseEther)(totalAmount.toString())
3295
+ feeFareAmount.amount,
3296
+ feeFareAmount.fare.contractAddress
2199
3297
  );
2200
3298
  }
3299
+ const finalAmount = isFeeTokenDifferent ? transferFareAmount : transferFareAmount.add(feeFareAmount);
3300
+ yield this.acpContractClient.approveAllowance(
3301
+ finalAmount.amount,
3302
+ transferFareAmount.fare.contractAddress
3303
+ );
2201
3304
  return yield this.acpContractClient.createPayableMemo(
2202
3305
  jobId,
2203
3306
  JSON.stringify(reason),
2204
- (0, import_viem2.parseEther)(amount.toString()),
3307
+ transferFareAmount.amount,
2205
3308
  recipient,
2206
- (0, import_viem2.parseEther)(feeAmount.toString()),
3309
+ feeFareAmount.amount,
2207
3310
  feeType,
2208
3311
  nextPhase,
2209
3312
  8 /* PAYABLE_TRANSFER_ESCROW */,
2210
- expiredAt
3313
+ expiredAt,
3314
+ transferFareAmount.fare.contractAddress
2211
3315
  );
2212
3316
  });
2213
3317
  }
@@ -2259,6 +3363,7 @@ var AcpClient = class {
2259
3363
  job.providerAddress,
2260
3364
  job.evaluatorAddress,
2261
3365
  job.price,
3366
+ job.priceTokenAddress,
2262
3367
  job.memos.map((memo) => {
2263
3368
  return new acpMemo_default(
2264
3369
  this,
@@ -2268,7 +3373,8 @@ var AcpClient = class {
2268
3373
  memo.nextPhase,
2269
3374
  memo.status,
2270
3375
  memo.signedReason,
2271
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3376
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3377
+ memo.payableDetails
2272
3378
  );
2273
3379
  }),
2274
3380
  job.phase,
@@ -2301,6 +3407,7 @@ var AcpClient = class {
2301
3407
  job.providerAddress,
2302
3408
  job.evaluatorAddress,
2303
3409
  job.price,
3410
+ job.priceTokenAddress,
2304
3411
  job.memos.map((memo) => {
2305
3412
  return new acpMemo_default(
2306
3413
  this,
@@ -2310,7 +3417,8 @@ var AcpClient = class {
2310
3417
  memo.nextPhase,
2311
3418
  memo.status,
2312
3419
  memo.signedReason,
2313
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3420
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3421
+ memo.payableDetails
2314
3422
  );
2315
3423
  }),
2316
3424
  job.phase,
@@ -2343,6 +3451,7 @@ var AcpClient = class {
2343
3451
  job.providerAddress,
2344
3452
  job.evaluatorAddress,
2345
3453
  job.price,
3454
+ job.priceTokenAddress,
2346
3455
  job.memos.map((memo) => {
2347
3456
  return new acpMemo_default(
2348
3457
  this,
@@ -2352,7 +3461,8 @@ var AcpClient = class {
2352
3461
  memo.nextPhase,
2353
3462
  memo.status,
2354
3463
  memo.signedReason,
2355
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3464
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3465
+ memo.payableDetails
2356
3466
  );
2357
3467
  }),
2358
3468
  job.phase,
@@ -2388,6 +3498,7 @@ var AcpClient = class {
2388
3498
  job.providerAddress,
2389
3499
  job.evaluatorAddress,
2390
3500
  job.price,
3501
+ job.priceTokenAddress,
2391
3502
  job.memos.map((memo) => {
2392
3503
  return new acpMemo_default(
2393
3504
  this,
@@ -2397,7 +3508,8 @@ var AcpClient = class {
2397
3508
  memo.nextPhase,
2398
3509
  memo.status,
2399
3510
  memo.signedReason,
2400
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3511
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3512
+ memo.payableDetails
2401
3513
  );
2402
3514
  }),
2403
3515
  job.phase,
@@ -2433,7 +3545,8 @@ var AcpClient = class {
2433
3545
  memo.nextPhase,
2434
3546
  memo.status,
2435
3547
  memo.signedReason,
2436
- memo.expiry ? new Date(parseInt(memo.expiry)) : void 0
3548
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3549
+ memo.payableDetails
2437
3550
  );
2438
3551
  } catch (error) {
2439
3552
  throw error;
@@ -2462,14 +3575,21 @@ var index_default = acpClient_default;
2462
3575
  ACP_ABI,
2463
3576
  AcpAgentSort,
2464
3577
  AcpContractClient,
3578
+ AcpContractConfig,
2465
3579
  AcpGraduationStatus,
2466
3580
  AcpJob,
2467
3581
  AcpJobPhases,
2468
3582
  AcpMemo,
2469
3583
  AcpMemoStatus,
2470
3584
  AcpOnlineStatus,
3585
+ Fare,
3586
+ FareAmount,
3587
+ FareBigInt,
2471
3588
  MemoType,
2472
3589
  PayloadType,
3590
+ PositionDirection,
2473
3591
  baseAcpConfig,
2474
- baseSepoliaAcpConfig
3592
+ baseSepoliaAcpConfig,
3593
+ ethFare,
3594
+ wethFare
2475
3595
  });