@actalink/commonlib 0.0.15 → 0.0.16
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.cjs +101 -62
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +102 -63
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -879,7 +879,8 @@ var ActaAccount = class {
|
|
|
879
879
|
chainId,
|
|
880
880
|
token: tokenSymbol,
|
|
881
881
|
amount,
|
|
882
|
-
receiver
|
|
882
|
+
receiver,
|
|
883
|
+
feebps
|
|
883
884
|
} = parameters;
|
|
884
885
|
if (amount <= BigInt(0)) {
|
|
885
886
|
throw new Error("Amount must be greater than 0.");
|
|
@@ -895,11 +896,6 @@ var ActaAccount = class {
|
|
|
895
896
|
if (!token2) {
|
|
896
897
|
throw new Error("Token not found.");
|
|
897
898
|
}
|
|
898
|
-
const quotes = yield pimlicoClient.getTokenQuotes({
|
|
899
|
-
tokens: [token2.address],
|
|
900
|
-
chain: getChainById(chainId)
|
|
901
|
-
});
|
|
902
|
-
const { postOpGas, exchangeRate, paymaster } = quotes[0];
|
|
903
899
|
const userOperation = yield accountClient.prepareUserOperation({
|
|
904
900
|
calls: [
|
|
905
901
|
{
|
|
@@ -920,22 +916,31 @@ var ActaAccount = class {
|
|
|
920
916
|
}
|
|
921
917
|
]
|
|
922
918
|
});
|
|
923
|
-
const
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
);
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
|
|
919
|
+
const quotes = yield pimlicoClient.getTokenQuotes({
|
|
920
|
+
tokens: [token2.address],
|
|
921
|
+
chain: getChainById(chainId)
|
|
922
|
+
});
|
|
923
|
+
const userOperationMaxCost = (0, import_permissionless.getRequiredPrefund)({
|
|
924
|
+
userOperation,
|
|
925
|
+
entryPointVersion: "0.7"
|
|
926
|
+
});
|
|
927
|
+
const postOpGas = quotes[0].postOpGas;
|
|
928
|
+
const exchangeRate = quotes[0].exchangeRate;
|
|
929
|
+
const exchangeRateNativeToUsd = quotes[0].exchangeRateNativeToUsd;
|
|
930
|
+
const maxCostInWei = userOperationMaxCost + postOpGas * userOperation.maxFeePerGas;
|
|
931
|
+
const costInToken = maxCostInWei * exchangeRate / BigInt(1e18);
|
|
932
|
+
const costInUsd = maxCostInWei * exchangeRateNativeToUsd / BigInt(1e18);
|
|
933
|
+
const ActalinkFeesInToken = amount * BigInt(feebps) / BigInt(1e4);
|
|
934
|
+
const estimatedTotalFeesInToken = costInToken + ActalinkFeesInToken;
|
|
930
935
|
const feeInclusiveAmountInToken = amount - estimatedTotalFeesInToken;
|
|
931
936
|
const feeExclusiveAmountInToken = amount + estimatedTotalFeesInToken;
|
|
932
937
|
return {
|
|
933
|
-
estimatedGasCostInToken,
|
|
938
|
+
estimatedGasCostInToken: costInToken,
|
|
934
939
|
ActalinkFeesInToken,
|
|
935
940
|
estimatedTotalFeesInToken,
|
|
936
941
|
feeInclusiveAmountInToken,
|
|
937
942
|
feeExclusiveAmountInToken,
|
|
938
|
-
paymaster,
|
|
943
|
+
paymaster: quotes[0].paymaster,
|
|
939
944
|
userOperation
|
|
940
945
|
};
|
|
941
946
|
});
|
|
@@ -949,7 +954,8 @@ var ActaAccount = class {
|
|
|
949
954
|
receivers,
|
|
950
955
|
feeInclusive,
|
|
951
956
|
walletClient,
|
|
952
|
-
totalAmount
|
|
957
|
+
totalAmount,
|
|
958
|
+
feebps
|
|
953
959
|
} = parameters;
|
|
954
960
|
if (totalAmount <= BigInt(0)) {
|
|
955
961
|
throw new Error("Amount must be greater than 0.");
|
|
@@ -965,14 +971,6 @@ var ActaAccount = class {
|
|
|
965
971
|
if (!token2) {
|
|
966
972
|
throw new Error("Token not found.");
|
|
967
973
|
}
|
|
968
|
-
console.log(`fromAddress: ${fromAddress}`);
|
|
969
|
-
const quotes = yield pimlicoClient.getTokenQuotes({
|
|
970
|
-
tokens: [token2.address],
|
|
971
|
-
chain: getChainById(chainId)
|
|
972
|
-
});
|
|
973
|
-
const { postOpGas, exchangeRate, paymaster } = quotes[0];
|
|
974
|
-
console.log("preparing");
|
|
975
|
-
console.log(token2.address);
|
|
976
974
|
const receiversData = receivers.map((r) => {
|
|
977
975
|
return {
|
|
978
976
|
to: (0, import_viem3.getAddress)(token2.address),
|
|
@@ -997,17 +995,27 @@ var ActaAccount = class {
|
|
|
997
995
|
}
|
|
998
996
|
]
|
|
999
997
|
});
|
|
1000
|
-
const
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
);
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
-
|
|
998
|
+
const quotes = yield pimlicoClient.getTokenQuotes({
|
|
999
|
+
tokens: [token2.address],
|
|
1000
|
+
chain: getChainById(chainId)
|
|
1001
|
+
});
|
|
1002
|
+
const userOperationMaxCost = (0, import_permissionless.getRequiredPrefund)({
|
|
1003
|
+
userOperation,
|
|
1004
|
+
entryPointVersion: "0.7"
|
|
1005
|
+
});
|
|
1006
|
+
const postOpGas = quotes[0].postOpGas;
|
|
1007
|
+
const exchangeRate = quotes[0].exchangeRate;
|
|
1008
|
+
const exchangeRateNativeToUsd = quotes[0].exchangeRateNativeToUsd;
|
|
1009
|
+
const paymaster = quotes[0].paymaster;
|
|
1010
|
+
const maxCostInWei = userOperationMaxCost + postOpGas * userOperation.maxFeePerGas;
|
|
1011
|
+
const costInToken = maxCostInWei * exchangeRate / BigInt(1e18);
|
|
1012
|
+
const costInUsd = maxCostInWei * exchangeRateNativeToUsd / BigInt(1e18);
|
|
1013
|
+
const ActalinkFeesInToken = totalAmount * BigInt(feebps) / BigInt(1e4);
|
|
1014
|
+
const estimatedTotalFeesInToken = costInToken + ActalinkFeesInToken;
|
|
1007
1015
|
const feeInclusiveAmountInToken = totalAmount - estimatedTotalFeesInToken;
|
|
1008
1016
|
const feeExclusiveAmountInToken = totalAmount + estimatedTotalFeesInToken;
|
|
1009
1017
|
return {
|
|
1010
|
-
estimatedGasCostInToken,
|
|
1018
|
+
estimatedGasCostInToken: costInToken,
|
|
1011
1019
|
ActalinkFeesInToken,
|
|
1012
1020
|
estimatedTotalFeesInToken,
|
|
1013
1021
|
feeInclusiveAmountInToken,
|
|
@@ -1030,7 +1038,8 @@ var ActaAccount = class {
|
|
|
1030
1038
|
amount,
|
|
1031
1039
|
receiver,
|
|
1032
1040
|
feeInclusive,
|
|
1033
|
-
allowMaxTokenApproval
|
|
1041
|
+
allowMaxTokenApproval,
|
|
1042
|
+
feebps
|
|
1034
1043
|
} = singlePaymentParams;
|
|
1035
1044
|
if (amount <= BigInt(0)) {
|
|
1036
1045
|
throw new Error("Amount must be greater than 0.");
|
|
@@ -1056,7 +1065,8 @@ var ActaAccount = class {
|
|
|
1056
1065
|
token: tokenSymbol,
|
|
1057
1066
|
amount,
|
|
1058
1067
|
receiver,
|
|
1059
|
-
feeInclusive
|
|
1068
|
+
feeInclusive,
|
|
1069
|
+
feebps
|
|
1060
1070
|
});
|
|
1061
1071
|
const account = yield this.createAccount();
|
|
1062
1072
|
const { accountClient } = yield this.createAccountHelpers();
|
|
@@ -1079,7 +1089,7 @@ var ActaAccount = class {
|
|
|
1079
1089
|
args: [
|
|
1080
1090
|
fromAddress,
|
|
1081
1091
|
"0x26eeCa5956Bf8C01040BAC9e6D7982a0e87F31B4",
|
|
1082
|
-
|
|
1092
|
+
estimatedTotalFeesInToken
|
|
1083
1093
|
]
|
|
1084
1094
|
},
|
|
1085
1095
|
{
|
|
@@ -1119,7 +1129,8 @@ var ActaAccount = class {
|
|
|
1119
1129
|
feeInclusive,
|
|
1120
1130
|
allowMaxTokenApproval,
|
|
1121
1131
|
totalAmount,
|
|
1122
|
-
walletClient
|
|
1132
|
+
walletClient,
|
|
1133
|
+
feebps
|
|
1123
1134
|
} = singlePaymentParams;
|
|
1124
1135
|
if (totalAmount <= BigInt(0)) {
|
|
1125
1136
|
throw new Error("Amount must be greater than 0.");
|
|
@@ -1147,7 +1158,8 @@ var ActaAccount = class {
|
|
|
1147
1158
|
receivers,
|
|
1148
1159
|
feeInclusive,
|
|
1149
1160
|
totalAmount,
|
|
1150
|
-
walletClient
|
|
1161
|
+
walletClient,
|
|
1162
|
+
feebps
|
|
1151
1163
|
});
|
|
1152
1164
|
const account = yield this.createAccount();
|
|
1153
1165
|
const { accountClient } = yield this.createAccountHelpers();
|
|
@@ -1216,7 +1228,8 @@ var ActaAccount = class {
|
|
|
1216
1228
|
intervalUnit,
|
|
1217
1229
|
startDate,
|
|
1218
1230
|
endDate,
|
|
1219
|
-
allowMaxTokenApproval
|
|
1231
|
+
allowMaxTokenApproval,
|
|
1232
|
+
feebps
|
|
1220
1233
|
} = recurringPaymentParams;
|
|
1221
1234
|
if (amount <= BigInt(0)) {
|
|
1222
1235
|
throw new Error("Amount must be greater than 0.");
|
|
@@ -1266,7 +1279,8 @@ var ActaAccount = class {
|
|
|
1266
1279
|
token: tokenSymbol,
|
|
1267
1280
|
amount,
|
|
1268
1281
|
receiver,
|
|
1269
|
-
feeInclusive
|
|
1282
|
+
feeInclusive,
|
|
1283
|
+
feebps
|
|
1270
1284
|
});
|
|
1271
1285
|
const amountToTransfer = feeInclusive ? amount : feeExclusiveAmountInToken;
|
|
1272
1286
|
const receiverAmount = feeInclusive ? feeInclusiveAmountInToken : amount;
|
|
@@ -1345,7 +1359,8 @@ var ActaAccount = class {
|
|
|
1345
1359
|
allowMaxTokenApproval,
|
|
1346
1360
|
receivers,
|
|
1347
1361
|
totalAmount,
|
|
1348
|
-
walletClient
|
|
1362
|
+
walletClient,
|
|
1363
|
+
feebps
|
|
1349
1364
|
} = paymentParams;
|
|
1350
1365
|
if (signerAddress === void 0) {
|
|
1351
1366
|
throw new Error("signer address is not provided.");
|
|
@@ -1392,7 +1407,8 @@ var ActaAccount = class {
|
|
|
1392
1407
|
receivers,
|
|
1393
1408
|
feeInclusive,
|
|
1394
1409
|
totalAmount,
|
|
1395
|
-
walletClient
|
|
1410
|
+
walletClient,
|
|
1411
|
+
feebps
|
|
1396
1412
|
});
|
|
1397
1413
|
const amountToTransfer = feeInclusive ? totalAmount : feeExclusiveAmountInToken;
|
|
1398
1414
|
const receiverAmount = feeInclusive ? feeInclusiveAmountInToken : totalAmount;
|
|
@@ -1774,6 +1790,7 @@ var transactionServiceUrl = "https://api.acta.link/transaction/v1/";
|
|
|
1774
1790
|
var depositServiceUrl = "https://api.acta.link/deposit/v1/";
|
|
1775
1791
|
var ActaDeposit = class {
|
|
1776
1792
|
constructor(parameters) {
|
|
1793
|
+
this.feeInclusive = false;
|
|
1777
1794
|
this.count = 0;
|
|
1778
1795
|
this.intervalUnit = void 0;
|
|
1779
1796
|
this.startDate = void 0;
|
|
@@ -1783,7 +1800,7 @@ var ActaDeposit = class {
|
|
|
1783
1800
|
this.status = "not_started";
|
|
1784
1801
|
this.serviceType = "deposit";
|
|
1785
1802
|
this.allowMaxTokenApproval = false;
|
|
1786
|
-
var _a, _b;
|
|
1803
|
+
var _a, _b, _c;
|
|
1787
1804
|
this.connectorType = parameters.connectorType;
|
|
1788
1805
|
this.walletClient = parameters.walletClient;
|
|
1789
1806
|
this.signerAddress = parameters.signerAddress;
|
|
@@ -1791,14 +1808,14 @@ var ActaDeposit = class {
|
|
|
1791
1808
|
this.token = parameters.token;
|
|
1792
1809
|
this.amount = parameters.amount;
|
|
1793
1810
|
this.receiver = parameters.receiver;
|
|
1794
|
-
this.feeInclusive = parameters.feeInclusive;
|
|
1811
|
+
this.feeInclusive = (_a = parameters.feeInclusive) != null ? _a : false;
|
|
1795
1812
|
this.paymentType = parameters.paymentType;
|
|
1796
1813
|
this.count = parameters.count;
|
|
1797
1814
|
this.intervalUnit = parameters.intervalUnit;
|
|
1798
1815
|
this.startDate = parameters.startDate;
|
|
1799
1816
|
this.endDate = parameters.endDate;
|
|
1800
|
-
this.depositSessionId = (
|
|
1801
|
-
this.allowMaxTokenApproval = (
|
|
1817
|
+
this.depositSessionId = (_b = parameters.depositSessionId) != null ? _b : "";
|
|
1818
|
+
this.allowMaxTokenApproval = (_c = parameters.allowMaxTokenApproval) != null ? _c : false;
|
|
1802
1819
|
this.viemClient = new ViemClient(this.chainId, this.walletClient);
|
|
1803
1820
|
this.account = new ActaAccount(
|
|
1804
1821
|
this.chainId,
|
|
@@ -1963,7 +1980,8 @@ var ActaDeposit = class {
|
|
|
1963
1980
|
amount,
|
|
1964
1981
|
receiver,
|
|
1965
1982
|
feeInclusive,
|
|
1966
|
-
allowMaxTokenApproval: this.allowMaxTokenApproval
|
|
1983
|
+
allowMaxTokenApproval: this.allowMaxTokenApproval,
|
|
1984
|
+
feebps: 10
|
|
1967
1985
|
});
|
|
1968
1986
|
const txn = yield executeSinglePaymentAPICall(
|
|
1969
1987
|
`${transactionServiceUrl}execute/single`,
|
|
@@ -2056,7 +2074,8 @@ var ActaDeposit = class {
|
|
|
2056
2074
|
startDate,
|
|
2057
2075
|
endDate,
|
|
2058
2076
|
receiver,
|
|
2059
|
-
allowMaxTokenApproval: this.allowMaxTokenApproval
|
|
2077
|
+
allowMaxTokenApproval: this.allowMaxTokenApproval,
|
|
2078
|
+
feebps: 20
|
|
2060
2079
|
});
|
|
2061
2080
|
const txn = yield scheduleRecurringPaymentsAPICall(
|
|
2062
2081
|
`${transactionServiceUrl}schedule/recurring`,
|
|
@@ -2099,7 +2118,8 @@ var ActaDeposit = class {
|
|
|
2099
2118
|
feeInclusive,
|
|
2100
2119
|
receiver,
|
|
2101
2120
|
signerAddress,
|
|
2102
|
-
token: tokenSymbol
|
|
2121
|
+
token: tokenSymbol,
|
|
2122
|
+
feebps: 10
|
|
2103
2123
|
});
|
|
2104
2124
|
const amountToTransfer = feeInclusive ? amount : feeExclusiveAmountInToken;
|
|
2105
2125
|
let paymentAmount = (amountToTransfer + estimatedGasCostInToken * BigInt(2)) * BigInt(count != null ? count : 1);
|
|
@@ -2119,6 +2139,7 @@ var import_viem6 = require("viem");
|
|
|
2119
2139
|
var transactionServiceUrl2 = "https://api.acta.link/transaction/v1/";
|
|
2120
2140
|
var ActaBilling = class {
|
|
2121
2141
|
constructor(parameters) {
|
|
2142
|
+
this.feeInclusive = true;
|
|
2122
2143
|
this.count = 0;
|
|
2123
2144
|
this.intervalUnit = void 0;
|
|
2124
2145
|
this.startDate = void 0;
|
|
@@ -2127,7 +2148,7 @@ var ActaBilling = class {
|
|
|
2127
2148
|
this.status = "not_started";
|
|
2128
2149
|
this.serviceType = "deposit";
|
|
2129
2150
|
this.allowMaxTokenApproval = false;
|
|
2130
|
-
var _a;
|
|
2151
|
+
var _a, _b;
|
|
2131
2152
|
this.connectorType = parameters.connectorType;
|
|
2132
2153
|
this.walletClient = parameters.walletClient;
|
|
2133
2154
|
this.signerAddress = parameters.signerAddress;
|
|
@@ -2135,13 +2156,13 @@ var ActaBilling = class {
|
|
|
2135
2156
|
this.token = parameters.token;
|
|
2136
2157
|
this.amount = parameters.amount;
|
|
2137
2158
|
this.receiver = parameters.receiver;
|
|
2138
|
-
this.feeInclusive = parameters.feeInclusive;
|
|
2159
|
+
this.feeInclusive = (_a = parameters.feeInclusive) != null ? _a : true;
|
|
2139
2160
|
this.paymentType = parameters.paymentType;
|
|
2140
2161
|
this.count = parameters.count;
|
|
2141
2162
|
this.intervalUnit = parameters.intervalUnit;
|
|
2142
2163
|
this.startDate = parameters.startDate;
|
|
2143
2164
|
this.endDate = parameters.endDate;
|
|
2144
|
-
this.allowMaxTokenApproval = (
|
|
2165
|
+
this.allowMaxTokenApproval = (_b = parameters.allowMaxTokenApproval) != null ? _b : false;
|
|
2145
2166
|
this.serviceType = parameters.serviceType;
|
|
2146
2167
|
this.viemClient = new ViemClient(this.chainId, this.walletClient);
|
|
2147
2168
|
this.account = new ActaAccount(
|
|
@@ -2209,7 +2230,8 @@ var ActaBilling = class {
|
|
|
2209
2230
|
amount,
|
|
2210
2231
|
receiver,
|
|
2211
2232
|
feeInclusive,
|
|
2212
|
-
allowMaxTokenApproval: this.allowMaxTokenApproval
|
|
2233
|
+
allowMaxTokenApproval: this.allowMaxTokenApproval,
|
|
2234
|
+
feebps: 20
|
|
2213
2235
|
});
|
|
2214
2236
|
const txn = yield executeSinglePaymentAPICall(
|
|
2215
2237
|
`${transactionServiceUrl2}execute/single`,
|
|
@@ -2274,7 +2296,8 @@ var ActaBilling = class {
|
|
|
2274
2296
|
startDate,
|
|
2275
2297
|
endDate,
|
|
2276
2298
|
receiver,
|
|
2277
|
-
allowMaxTokenApproval: this.allowMaxTokenApproval
|
|
2299
|
+
allowMaxTokenApproval: this.allowMaxTokenApproval,
|
|
2300
|
+
feebps: 20
|
|
2278
2301
|
});
|
|
2279
2302
|
const txn = yield scheduleRecurringPaymentsAPICall(
|
|
2280
2303
|
`${transactionServiceUrl2}schedule/recurring`,
|
|
@@ -2317,7 +2340,8 @@ var ActaBilling = class {
|
|
|
2317
2340
|
feeInclusive,
|
|
2318
2341
|
receiver,
|
|
2319
2342
|
signerAddress,
|
|
2320
|
-
token: tokenSymbol
|
|
2343
|
+
token: tokenSymbol,
|
|
2344
|
+
feebps: 20
|
|
2321
2345
|
});
|
|
2322
2346
|
const amountToTransfer = feeInclusive ? amount : feeExclusiveAmountInToken;
|
|
2323
2347
|
let paymentAmount = (amountToTransfer + estimatedGasCostInToken * BigInt(2)) * BigInt(count != null ? count : 1);
|
|
@@ -2410,6 +2434,10 @@ var ActaBatch = class {
|
|
|
2410
2434
|
walletClient,
|
|
2411
2435
|
instructionId
|
|
2412
2436
|
} = parameters;
|
|
2437
|
+
let isFeeInclusive = false;
|
|
2438
|
+
if (feeInclusive) {
|
|
2439
|
+
isFeeInclusive = true;
|
|
2440
|
+
}
|
|
2413
2441
|
const { envBatchServiceUrl } = returnEnvUrl(chainId);
|
|
2414
2442
|
const instuctionData = yield fetchBatchInstructionDetails(
|
|
2415
2443
|
`${envBatchServiceUrl}instruction/${instructionId}`,
|
|
@@ -2452,12 +2480,13 @@ var ActaBatch = class {
|
|
|
2452
2480
|
userOperation
|
|
2453
2481
|
} = yield account.estimateSingleBatchPaymentGas({
|
|
2454
2482
|
chainId,
|
|
2455
|
-
feeInclusive,
|
|
2483
|
+
feeInclusive: isFeeInclusive,
|
|
2456
2484
|
signerAddress,
|
|
2457
2485
|
token: token2,
|
|
2458
2486
|
walletClient,
|
|
2459
2487
|
receivers,
|
|
2460
|
-
totalAmount: totalAmountParsed
|
|
2488
|
+
totalAmount: totalAmountParsed,
|
|
2489
|
+
feebps: 20
|
|
2461
2490
|
});
|
|
2462
2491
|
return {
|
|
2463
2492
|
estimatedGasCostInToken,
|
|
@@ -2488,6 +2517,10 @@ var ActaBatch = class {
|
|
|
2488
2517
|
allowMaxTokenApproval,
|
|
2489
2518
|
instructionId
|
|
2490
2519
|
} = params;
|
|
2520
|
+
let isFeeInclusive = false;
|
|
2521
|
+
if (feeInclusive) {
|
|
2522
|
+
isFeeInclusive = true;
|
|
2523
|
+
}
|
|
2491
2524
|
const { envBatchServiceUrl } = returnEnvUrl(chainId);
|
|
2492
2525
|
const instuctionData = yield fetchBatchInstructionDetails(
|
|
2493
2526
|
`${envBatchServiceUrl}instruction/${instructionId}`,
|
|
@@ -2526,11 +2559,12 @@ var ActaBatch = class {
|
|
|
2526
2559
|
signerAddress,
|
|
2527
2560
|
chainId,
|
|
2528
2561
|
token: tokenSymbol,
|
|
2529
|
-
feeInclusive,
|
|
2562
|
+
feeInclusive: isFeeInclusive,
|
|
2530
2563
|
receivers,
|
|
2531
2564
|
totalAmount: totalAmountParsed,
|
|
2532
2565
|
walletClient,
|
|
2533
|
-
allowMaxTokenApproval
|
|
2566
|
+
allowMaxTokenApproval,
|
|
2567
|
+
feebps: 20
|
|
2534
2568
|
});
|
|
2535
2569
|
const txn = yield executeSingleBatchPaymentAPICall(
|
|
2536
2570
|
`${envBatchServiceUrl}execute/single/batch`,
|
|
@@ -2541,7 +2575,7 @@ var ActaBatch = class {
|
|
|
2541
2575
|
chainId,
|
|
2542
2576
|
tokenAddress: tokenData.address,
|
|
2543
2577
|
amount: (0, import_viem7.toHex)(totalAmountParsed),
|
|
2544
|
-
feeInclusive,
|
|
2578
|
+
feeInclusive: isFeeInclusive,
|
|
2545
2579
|
serviceType: "batch"
|
|
2546
2580
|
},
|
|
2547
2581
|
serviceParams
|
|
@@ -2569,6 +2603,10 @@ var ActaBatch = class {
|
|
|
2569
2603
|
instructionId,
|
|
2570
2604
|
executionTime
|
|
2571
2605
|
} = params;
|
|
2606
|
+
let isFeeInclusive = false;
|
|
2607
|
+
if (feeInclusive) {
|
|
2608
|
+
isFeeInclusive = true;
|
|
2609
|
+
}
|
|
2572
2610
|
const { envBatchServiceUrl } = returnEnvUrl(chainId);
|
|
2573
2611
|
if (executionTime <= Date.now() + 1e3 * 60 * 2) {
|
|
2574
2612
|
throw new Error(
|
|
@@ -2612,12 +2650,13 @@ var ActaBatch = class {
|
|
|
2612
2650
|
signerAddress,
|
|
2613
2651
|
chainId,
|
|
2614
2652
|
token: tokenSymbol,
|
|
2615
|
-
feeInclusive,
|
|
2653
|
+
feeInclusive: isFeeInclusive,
|
|
2616
2654
|
receivers,
|
|
2617
2655
|
totalAmount: totalAmountParsed,
|
|
2618
2656
|
walletClient,
|
|
2619
2657
|
allowMaxTokenApproval,
|
|
2620
|
-
count: 1
|
|
2658
|
+
count: 1,
|
|
2659
|
+
feebps: 20
|
|
2621
2660
|
});
|
|
2622
2661
|
const txn = yield executeScheduleBatchPaymentAPICall(
|
|
2623
2662
|
`${envBatchServiceUrl}execute/schedule/batch`,
|
|
@@ -2627,7 +2666,7 @@ var ActaBatch = class {
|
|
|
2627
2666
|
chainId,
|
|
2628
2667
|
tokenAddress: tokenData.address,
|
|
2629
2668
|
amount: (0, import_viem7.toHex)(totalAmountParsed),
|
|
2630
|
-
feeInclusive,
|
|
2669
|
+
feeInclusive: isFeeInclusive,
|
|
2631
2670
|
serviceType: "batch",
|
|
2632
2671
|
amountExclusive: (0, import_viem7.toHex)(amountExclusive),
|
|
2633
2672
|
approval,
|
package/dist/index.d.cts
CHANGED
|
@@ -52,7 +52,7 @@ interface AbstractPaymentParams {
|
|
|
52
52
|
token: "USDC" | "USDT" | "DAI" | "ETH" | "WETH" | "BNB" | "WBNB" | "USDCe" | "USDbC" | "EURC" | "POL" | "WPOL";
|
|
53
53
|
amount: bigint;
|
|
54
54
|
receiver: Address;
|
|
55
|
-
feeInclusive
|
|
55
|
+
feeInclusive?: boolean;
|
|
56
56
|
paymentType: "single" | "recurring" | "choose";
|
|
57
57
|
count?: number;
|
|
58
58
|
intervalUnit?: "5mins" | "day" | "week" | "month" | "year";
|
|
@@ -69,7 +69,9 @@ interface BillingClassParams extends AbstractPaymentParams {
|
|
|
69
69
|
interface BatchClassParams {
|
|
70
70
|
APIKey: string;
|
|
71
71
|
}
|
|
72
|
-
type EstimateSinglePaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams"
|
|
72
|
+
type EstimateSinglePaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams"> & {
|
|
73
|
+
feebps: 20 | 10 | 15;
|
|
74
|
+
};
|
|
73
75
|
type EstimateSingleBatchPaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams" | "receiver" | "amount" | "token"> & {
|
|
74
76
|
receivers: {
|
|
75
77
|
address: Address;
|
|
@@ -77,6 +79,7 @@ type EstimateSingleBatchPaymentGasParameters = Omit<AbstractPaymentParams, "conn
|
|
|
77
79
|
}[];
|
|
78
80
|
token: "USDC" | "USDT";
|
|
79
81
|
totalAmount: bigint;
|
|
82
|
+
feebps: 20 | 10 | 15;
|
|
80
83
|
};
|
|
81
84
|
type CalculateSingleBatchPaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams" | "receiver" | "amount" | "receivers" | "token"> & {
|
|
82
85
|
token: "USDC" | "USDT";
|
|
@@ -142,6 +145,7 @@ type PermissionAccountParams = {
|
|
|
142
145
|
};
|
|
143
146
|
type SinglePaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "serviceUrl" | "serviceSessionParams" | "count" | "intervalUnit" | "startDate" | "endDate" | "paymentType"> & {
|
|
144
147
|
allowMaxTokenApproval?: boolean;
|
|
148
|
+
feebps: 20 | 10 | 15;
|
|
145
149
|
};
|
|
146
150
|
type SingleBatchPaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "serviceType" | "serviceUrl" | "serviceSessionParams" | "count" | "intervalUnit" | "startDate" | "endDate" | "paymentType" | "receiver" | "amount" | "token"> & {
|
|
147
151
|
allowMaxTokenApproval?: boolean;
|
|
@@ -151,9 +155,11 @@ type SingleBatchPaymentParamsType = Omit<AbstractPaymentParams, "connectorType"
|
|
|
151
155
|
}[];
|
|
152
156
|
token: "USDC" | "USDT";
|
|
153
157
|
totalAmount: bigint;
|
|
158
|
+
feebps: 20 | 10 | 15;
|
|
154
159
|
};
|
|
155
160
|
type ScheduleOrRecurringBatchPaymentParamsType = SingleBatchPaymentParamsType & {
|
|
156
161
|
count: number;
|
|
162
|
+
feebps: 20 | 10 | 15;
|
|
157
163
|
};
|
|
158
164
|
type SingleBatchPaymentClassParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "serviceType" | "serviceUrl" | "serviceSessionParams" | "count" | "intervalUnit" | "startDate" | "endDate" | "paymentType" | "receiver" | "amount" | "token"> & {
|
|
159
165
|
allowMaxTokenApproval?: boolean;
|
|
@@ -166,6 +172,7 @@ type ScheduleBatchPaymentClassParamsType = SingleBatchPaymentClassParamsType & {
|
|
|
166
172
|
type RecurringPaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "serviceUrl" | "serviceSessionParams"> & {
|
|
167
173
|
endDate?: number;
|
|
168
174
|
allowMaxTokenApproval?: boolean;
|
|
175
|
+
feebps: 20 | 10 | 15;
|
|
169
176
|
};
|
|
170
177
|
|
|
171
178
|
declare const arbitrumETH: Token;
|
package/dist/index.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ interface AbstractPaymentParams {
|
|
|
52
52
|
token: "USDC" | "USDT" | "DAI" | "ETH" | "WETH" | "BNB" | "WBNB" | "USDCe" | "USDbC" | "EURC" | "POL" | "WPOL";
|
|
53
53
|
amount: bigint;
|
|
54
54
|
receiver: Address;
|
|
55
|
-
feeInclusive
|
|
55
|
+
feeInclusive?: boolean;
|
|
56
56
|
paymentType: "single" | "recurring" | "choose";
|
|
57
57
|
count?: number;
|
|
58
58
|
intervalUnit?: "5mins" | "day" | "week" | "month" | "year";
|
|
@@ -69,7 +69,9 @@ interface BillingClassParams extends AbstractPaymentParams {
|
|
|
69
69
|
interface BatchClassParams {
|
|
70
70
|
APIKey: string;
|
|
71
71
|
}
|
|
72
|
-
type EstimateSinglePaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams"
|
|
72
|
+
type EstimateSinglePaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams"> & {
|
|
73
|
+
feebps: 20 | 10 | 15;
|
|
74
|
+
};
|
|
73
75
|
type EstimateSingleBatchPaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams" | "receiver" | "amount" | "token"> & {
|
|
74
76
|
receivers: {
|
|
75
77
|
address: Address;
|
|
@@ -77,6 +79,7 @@ type EstimateSingleBatchPaymentGasParameters = Omit<AbstractPaymentParams, "conn
|
|
|
77
79
|
}[];
|
|
78
80
|
token: "USDC" | "USDT";
|
|
79
81
|
totalAmount: bigint;
|
|
82
|
+
feebps: 20 | 10 | 15;
|
|
80
83
|
};
|
|
81
84
|
type CalculateSingleBatchPaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams" | "receiver" | "amount" | "receivers" | "token"> & {
|
|
82
85
|
token: "USDC" | "USDT";
|
|
@@ -142,6 +145,7 @@ type PermissionAccountParams = {
|
|
|
142
145
|
};
|
|
143
146
|
type SinglePaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "serviceUrl" | "serviceSessionParams" | "count" | "intervalUnit" | "startDate" | "endDate" | "paymentType"> & {
|
|
144
147
|
allowMaxTokenApproval?: boolean;
|
|
148
|
+
feebps: 20 | 10 | 15;
|
|
145
149
|
};
|
|
146
150
|
type SingleBatchPaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "serviceType" | "serviceUrl" | "serviceSessionParams" | "count" | "intervalUnit" | "startDate" | "endDate" | "paymentType" | "receiver" | "amount" | "token"> & {
|
|
147
151
|
allowMaxTokenApproval?: boolean;
|
|
@@ -151,9 +155,11 @@ type SingleBatchPaymentParamsType = Omit<AbstractPaymentParams, "connectorType"
|
|
|
151
155
|
}[];
|
|
152
156
|
token: "USDC" | "USDT";
|
|
153
157
|
totalAmount: bigint;
|
|
158
|
+
feebps: 20 | 10 | 15;
|
|
154
159
|
};
|
|
155
160
|
type ScheduleOrRecurringBatchPaymentParamsType = SingleBatchPaymentParamsType & {
|
|
156
161
|
count: number;
|
|
162
|
+
feebps: 20 | 10 | 15;
|
|
157
163
|
};
|
|
158
164
|
type SingleBatchPaymentClassParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "serviceType" | "serviceUrl" | "serviceSessionParams" | "count" | "intervalUnit" | "startDate" | "endDate" | "paymentType" | "receiver" | "amount" | "token"> & {
|
|
159
165
|
allowMaxTokenApproval?: boolean;
|
|
@@ -166,6 +172,7 @@ type ScheduleBatchPaymentClassParamsType = SingleBatchPaymentClassParamsType & {
|
|
|
166
172
|
type RecurringPaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "serviceUrl" | "serviceSessionParams"> & {
|
|
167
173
|
endDate?: number;
|
|
168
174
|
allowMaxTokenApproval?: boolean;
|
|
175
|
+
feebps: 20 | 10 | 15;
|
|
169
176
|
};
|
|
170
177
|
|
|
171
178
|
declare const arbitrumETH: Token;
|
package/dist/index.js
CHANGED
|
@@ -593,7 +593,7 @@ import {
|
|
|
593
593
|
VALIDATOR_TYPE
|
|
594
594
|
} from "@zerodev/sdk/constants";
|
|
595
595
|
import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator";
|
|
596
|
-
import { createSmartAccountClient } from "permissionless";
|
|
596
|
+
import { createSmartAccountClient, getRequiredPrefund } from "permissionless";
|
|
597
597
|
import { createPimlicoClient } from "permissionless/clients/pimlico";
|
|
598
598
|
|
|
599
599
|
// src/rpc.ts
|
|
@@ -806,7 +806,8 @@ var ActaAccount = class {
|
|
|
806
806
|
chainId,
|
|
807
807
|
token: tokenSymbol,
|
|
808
808
|
amount,
|
|
809
|
-
receiver
|
|
809
|
+
receiver,
|
|
810
|
+
feebps
|
|
810
811
|
} = parameters;
|
|
811
812
|
if (amount <= BigInt(0)) {
|
|
812
813
|
throw new Error("Amount must be greater than 0.");
|
|
@@ -822,11 +823,6 @@ var ActaAccount = class {
|
|
|
822
823
|
if (!token2) {
|
|
823
824
|
throw new Error("Token not found.");
|
|
824
825
|
}
|
|
825
|
-
const quotes = yield pimlicoClient.getTokenQuotes({
|
|
826
|
-
tokens: [token2.address],
|
|
827
|
-
chain: getChainById(chainId)
|
|
828
|
-
});
|
|
829
|
-
const { postOpGas, exchangeRate, paymaster } = quotes[0];
|
|
830
826
|
const userOperation = yield accountClient.prepareUserOperation({
|
|
831
827
|
calls: [
|
|
832
828
|
{
|
|
@@ -847,22 +843,31 @@ var ActaAccount = class {
|
|
|
847
843
|
}
|
|
848
844
|
]
|
|
849
845
|
});
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
);
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
|
|
846
|
+
const quotes = yield pimlicoClient.getTokenQuotes({
|
|
847
|
+
tokens: [token2.address],
|
|
848
|
+
chain: getChainById(chainId)
|
|
849
|
+
});
|
|
850
|
+
const userOperationMaxCost = getRequiredPrefund({
|
|
851
|
+
userOperation,
|
|
852
|
+
entryPointVersion: "0.7"
|
|
853
|
+
});
|
|
854
|
+
const postOpGas = quotes[0].postOpGas;
|
|
855
|
+
const exchangeRate = quotes[0].exchangeRate;
|
|
856
|
+
const exchangeRateNativeToUsd = quotes[0].exchangeRateNativeToUsd;
|
|
857
|
+
const maxCostInWei = userOperationMaxCost + postOpGas * userOperation.maxFeePerGas;
|
|
858
|
+
const costInToken = maxCostInWei * exchangeRate / BigInt(1e18);
|
|
859
|
+
const costInUsd = maxCostInWei * exchangeRateNativeToUsd / BigInt(1e18);
|
|
860
|
+
const ActalinkFeesInToken = amount * BigInt(feebps) / BigInt(1e4);
|
|
861
|
+
const estimatedTotalFeesInToken = costInToken + ActalinkFeesInToken;
|
|
857
862
|
const feeInclusiveAmountInToken = amount - estimatedTotalFeesInToken;
|
|
858
863
|
const feeExclusiveAmountInToken = amount + estimatedTotalFeesInToken;
|
|
859
864
|
return {
|
|
860
|
-
estimatedGasCostInToken,
|
|
865
|
+
estimatedGasCostInToken: costInToken,
|
|
861
866
|
ActalinkFeesInToken,
|
|
862
867
|
estimatedTotalFeesInToken,
|
|
863
868
|
feeInclusiveAmountInToken,
|
|
864
869
|
feeExclusiveAmountInToken,
|
|
865
|
-
paymaster,
|
|
870
|
+
paymaster: quotes[0].paymaster,
|
|
866
871
|
userOperation
|
|
867
872
|
};
|
|
868
873
|
});
|
|
@@ -876,7 +881,8 @@ var ActaAccount = class {
|
|
|
876
881
|
receivers,
|
|
877
882
|
feeInclusive,
|
|
878
883
|
walletClient,
|
|
879
|
-
totalAmount
|
|
884
|
+
totalAmount,
|
|
885
|
+
feebps
|
|
880
886
|
} = parameters;
|
|
881
887
|
if (totalAmount <= BigInt(0)) {
|
|
882
888
|
throw new Error("Amount must be greater than 0.");
|
|
@@ -892,14 +898,6 @@ var ActaAccount = class {
|
|
|
892
898
|
if (!token2) {
|
|
893
899
|
throw new Error("Token not found.");
|
|
894
900
|
}
|
|
895
|
-
console.log(`fromAddress: ${fromAddress}`);
|
|
896
|
-
const quotes = yield pimlicoClient.getTokenQuotes({
|
|
897
|
-
tokens: [token2.address],
|
|
898
|
-
chain: getChainById(chainId)
|
|
899
|
-
});
|
|
900
|
-
const { postOpGas, exchangeRate, paymaster } = quotes[0];
|
|
901
|
-
console.log("preparing");
|
|
902
|
-
console.log(token2.address);
|
|
903
901
|
const receiversData = receivers.map((r) => {
|
|
904
902
|
return {
|
|
905
903
|
to: getAddress2(token2.address),
|
|
@@ -924,17 +922,27 @@ var ActaAccount = class {
|
|
|
924
922
|
}
|
|
925
923
|
]
|
|
926
924
|
});
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
);
|
|
931
|
-
const
|
|
932
|
-
|
|
933
|
-
|
|
925
|
+
const quotes = yield pimlicoClient.getTokenQuotes({
|
|
926
|
+
tokens: [token2.address],
|
|
927
|
+
chain: getChainById(chainId)
|
|
928
|
+
});
|
|
929
|
+
const userOperationMaxCost = getRequiredPrefund({
|
|
930
|
+
userOperation,
|
|
931
|
+
entryPointVersion: "0.7"
|
|
932
|
+
});
|
|
933
|
+
const postOpGas = quotes[0].postOpGas;
|
|
934
|
+
const exchangeRate = quotes[0].exchangeRate;
|
|
935
|
+
const exchangeRateNativeToUsd = quotes[0].exchangeRateNativeToUsd;
|
|
936
|
+
const paymaster = quotes[0].paymaster;
|
|
937
|
+
const maxCostInWei = userOperationMaxCost + postOpGas * userOperation.maxFeePerGas;
|
|
938
|
+
const costInToken = maxCostInWei * exchangeRate / BigInt(1e18);
|
|
939
|
+
const costInUsd = maxCostInWei * exchangeRateNativeToUsd / BigInt(1e18);
|
|
940
|
+
const ActalinkFeesInToken = totalAmount * BigInt(feebps) / BigInt(1e4);
|
|
941
|
+
const estimatedTotalFeesInToken = costInToken + ActalinkFeesInToken;
|
|
934
942
|
const feeInclusiveAmountInToken = totalAmount - estimatedTotalFeesInToken;
|
|
935
943
|
const feeExclusiveAmountInToken = totalAmount + estimatedTotalFeesInToken;
|
|
936
944
|
return {
|
|
937
|
-
estimatedGasCostInToken,
|
|
945
|
+
estimatedGasCostInToken: costInToken,
|
|
938
946
|
ActalinkFeesInToken,
|
|
939
947
|
estimatedTotalFeesInToken,
|
|
940
948
|
feeInclusiveAmountInToken,
|
|
@@ -957,7 +965,8 @@ var ActaAccount = class {
|
|
|
957
965
|
amount,
|
|
958
966
|
receiver,
|
|
959
967
|
feeInclusive,
|
|
960
|
-
allowMaxTokenApproval
|
|
968
|
+
allowMaxTokenApproval,
|
|
969
|
+
feebps
|
|
961
970
|
} = singlePaymentParams;
|
|
962
971
|
if (amount <= BigInt(0)) {
|
|
963
972
|
throw new Error("Amount must be greater than 0.");
|
|
@@ -983,7 +992,8 @@ var ActaAccount = class {
|
|
|
983
992
|
token: tokenSymbol,
|
|
984
993
|
amount,
|
|
985
994
|
receiver,
|
|
986
|
-
feeInclusive
|
|
995
|
+
feeInclusive,
|
|
996
|
+
feebps
|
|
987
997
|
});
|
|
988
998
|
const account = yield this.createAccount();
|
|
989
999
|
const { accountClient } = yield this.createAccountHelpers();
|
|
@@ -1006,7 +1016,7 @@ var ActaAccount = class {
|
|
|
1006
1016
|
args: [
|
|
1007
1017
|
fromAddress,
|
|
1008
1018
|
"0x26eeCa5956Bf8C01040BAC9e6D7982a0e87F31B4",
|
|
1009
|
-
|
|
1019
|
+
estimatedTotalFeesInToken
|
|
1010
1020
|
]
|
|
1011
1021
|
},
|
|
1012
1022
|
{
|
|
@@ -1046,7 +1056,8 @@ var ActaAccount = class {
|
|
|
1046
1056
|
feeInclusive,
|
|
1047
1057
|
allowMaxTokenApproval,
|
|
1048
1058
|
totalAmount,
|
|
1049
|
-
walletClient
|
|
1059
|
+
walletClient,
|
|
1060
|
+
feebps
|
|
1050
1061
|
} = singlePaymentParams;
|
|
1051
1062
|
if (totalAmount <= BigInt(0)) {
|
|
1052
1063
|
throw new Error("Amount must be greater than 0.");
|
|
@@ -1074,7 +1085,8 @@ var ActaAccount = class {
|
|
|
1074
1085
|
receivers,
|
|
1075
1086
|
feeInclusive,
|
|
1076
1087
|
totalAmount,
|
|
1077
|
-
walletClient
|
|
1088
|
+
walletClient,
|
|
1089
|
+
feebps
|
|
1078
1090
|
});
|
|
1079
1091
|
const account = yield this.createAccount();
|
|
1080
1092
|
const { accountClient } = yield this.createAccountHelpers();
|
|
@@ -1143,7 +1155,8 @@ var ActaAccount = class {
|
|
|
1143
1155
|
intervalUnit,
|
|
1144
1156
|
startDate,
|
|
1145
1157
|
endDate,
|
|
1146
|
-
allowMaxTokenApproval
|
|
1158
|
+
allowMaxTokenApproval,
|
|
1159
|
+
feebps
|
|
1147
1160
|
} = recurringPaymentParams;
|
|
1148
1161
|
if (amount <= BigInt(0)) {
|
|
1149
1162
|
throw new Error("Amount must be greater than 0.");
|
|
@@ -1193,7 +1206,8 @@ var ActaAccount = class {
|
|
|
1193
1206
|
token: tokenSymbol,
|
|
1194
1207
|
amount,
|
|
1195
1208
|
receiver,
|
|
1196
|
-
feeInclusive
|
|
1209
|
+
feeInclusive,
|
|
1210
|
+
feebps
|
|
1197
1211
|
});
|
|
1198
1212
|
const amountToTransfer = feeInclusive ? amount : feeExclusiveAmountInToken;
|
|
1199
1213
|
const receiverAmount = feeInclusive ? feeInclusiveAmountInToken : amount;
|
|
@@ -1272,7 +1286,8 @@ var ActaAccount = class {
|
|
|
1272
1286
|
allowMaxTokenApproval,
|
|
1273
1287
|
receivers,
|
|
1274
1288
|
totalAmount,
|
|
1275
|
-
walletClient
|
|
1289
|
+
walletClient,
|
|
1290
|
+
feebps
|
|
1276
1291
|
} = paymentParams;
|
|
1277
1292
|
if (signerAddress === void 0) {
|
|
1278
1293
|
throw new Error("signer address is not provided.");
|
|
@@ -1319,7 +1334,8 @@ var ActaAccount = class {
|
|
|
1319
1334
|
receivers,
|
|
1320
1335
|
feeInclusive,
|
|
1321
1336
|
totalAmount,
|
|
1322
|
-
walletClient
|
|
1337
|
+
walletClient,
|
|
1338
|
+
feebps
|
|
1323
1339
|
});
|
|
1324
1340
|
const amountToTransfer = feeInclusive ? totalAmount : feeExclusiveAmountInToken;
|
|
1325
1341
|
const receiverAmount = feeInclusive ? feeInclusiveAmountInToken : totalAmount;
|
|
@@ -1701,6 +1717,7 @@ var transactionServiceUrl = "https://api.acta.link/transaction/v1/";
|
|
|
1701
1717
|
var depositServiceUrl = "https://api.acta.link/deposit/v1/";
|
|
1702
1718
|
var ActaDeposit = class {
|
|
1703
1719
|
constructor(parameters) {
|
|
1720
|
+
this.feeInclusive = false;
|
|
1704
1721
|
this.count = 0;
|
|
1705
1722
|
this.intervalUnit = void 0;
|
|
1706
1723
|
this.startDate = void 0;
|
|
@@ -1710,7 +1727,7 @@ var ActaDeposit = class {
|
|
|
1710
1727
|
this.status = "not_started";
|
|
1711
1728
|
this.serviceType = "deposit";
|
|
1712
1729
|
this.allowMaxTokenApproval = false;
|
|
1713
|
-
var _a, _b;
|
|
1730
|
+
var _a, _b, _c;
|
|
1714
1731
|
this.connectorType = parameters.connectorType;
|
|
1715
1732
|
this.walletClient = parameters.walletClient;
|
|
1716
1733
|
this.signerAddress = parameters.signerAddress;
|
|
@@ -1718,14 +1735,14 @@ var ActaDeposit = class {
|
|
|
1718
1735
|
this.token = parameters.token;
|
|
1719
1736
|
this.amount = parameters.amount;
|
|
1720
1737
|
this.receiver = parameters.receiver;
|
|
1721
|
-
this.feeInclusive = parameters.feeInclusive;
|
|
1738
|
+
this.feeInclusive = (_a = parameters.feeInclusive) != null ? _a : false;
|
|
1722
1739
|
this.paymentType = parameters.paymentType;
|
|
1723
1740
|
this.count = parameters.count;
|
|
1724
1741
|
this.intervalUnit = parameters.intervalUnit;
|
|
1725
1742
|
this.startDate = parameters.startDate;
|
|
1726
1743
|
this.endDate = parameters.endDate;
|
|
1727
|
-
this.depositSessionId = (
|
|
1728
|
-
this.allowMaxTokenApproval = (
|
|
1744
|
+
this.depositSessionId = (_b = parameters.depositSessionId) != null ? _b : "";
|
|
1745
|
+
this.allowMaxTokenApproval = (_c = parameters.allowMaxTokenApproval) != null ? _c : false;
|
|
1729
1746
|
this.viemClient = new ViemClient(this.chainId, this.walletClient);
|
|
1730
1747
|
this.account = new ActaAccount(
|
|
1731
1748
|
this.chainId,
|
|
@@ -1890,7 +1907,8 @@ var ActaDeposit = class {
|
|
|
1890
1907
|
amount,
|
|
1891
1908
|
receiver,
|
|
1892
1909
|
feeInclusive,
|
|
1893
|
-
allowMaxTokenApproval: this.allowMaxTokenApproval
|
|
1910
|
+
allowMaxTokenApproval: this.allowMaxTokenApproval,
|
|
1911
|
+
feebps: 10
|
|
1894
1912
|
});
|
|
1895
1913
|
const txn = yield executeSinglePaymentAPICall(
|
|
1896
1914
|
`${transactionServiceUrl}execute/single`,
|
|
@@ -1983,7 +2001,8 @@ var ActaDeposit = class {
|
|
|
1983
2001
|
startDate,
|
|
1984
2002
|
endDate,
|
|
1985
2003
|
receiver,
|
|
1986
|
-
allowMaxTokenApproval: this.allowMaxTokenApproval
|
|
2004
|
+
allowMaxTokenApproval: this.allowMaxTokenApproval,
|
|
2005
|
+
feebps: 20
|
|
1987
2006
|
});
|
|
1988
2007
|
const txn = yield scheduleRecurringPaymentsAPICall(
|
|
1989
2008
|
`${transactionServiceUrl}schedule/recurring`,
|
|
@@ -2026,7 +2045,8 @@ var ActaDeposit = class {
|
|
|
2026
2045
|
feeInclusive,
|
|
2027
2046
|
receiver,
|
|
2028
2047
|
signerAddress,
|
|
2029
|
-
token: tokenSymbol
|
|
2048
|
+
token: tokenSymbol,
|
|
2049
|
+
feebps: 10
|
|
2030
2050
|
});
|
|
2031
2051
|
const amountToTransfer = feeInclusive ? amount : feeExclusiveAmountInToken;
|
|
2032
2052
|
let paymentAmount = (amountToTransfer + estimatedGasCostInToken * BigInt(2)) * BigInt(count != null ? count : 1);
|
|
@@ -2046,6 +2066,7 @@ import { toHex as toHex3 } from "viem";
|
|
|
2046
2066
|
var transactionServiceUrl2 = "https://api.acta.link/transaction/v1/";
|
|
2047
2067
|
var ActaBilling = class {
|
|
2048
2068
|
constructor(parameters) {
|
|
2069
|
+
this.feeInclusive = true;
|
|
2049
2070
|
this.count = 0;
|
|
2050
2071
|
this.intervalUnit = void 0;
|
|
2051
2072
|
this.startDate = void 0;
|
|
@@ -2054,7 +2075,7 @@ var ActaBilling = class {
|
|
|
2054
2075
|
this.status = "not_started";
|
|
2055
2076
|
this.serviceType = "deposit";
|
|
2056
2077
|
this.allowMaxTokenApproval = false;
|
|
2057
|
-
var _a;
|
|
2078
|
+
var _a, _b;
|
|
2058
2079
|
this.connectorType = parameters.connectorType;
|
|
2059
2080
|
this.walletClient = parameters.walletClient;
|
|
2060
2081
|
this.signerAddress = parameters.signerAddress;
|
|
@@ -2062,13 +2083,13 @@ var ActaBilling = class {
|
|
|
2062
2083
|
this.token = parameters.token;
|
|
2063
2084
|
this.amount = parameters.amount;
|
|
2064
2085
|
this.receiver = parameters.receiver;
|
|
2065
|
-
this.feeInclusive = parameters.feeInclusive;
|
|
2086
|
+
this.feeInclusive = (_a = parameters.feeInclusive) != null ? _a : true;
|
|
2066
2087
|
this.paymentType = parameters.paymentType;
|
|
2067
2088
|
this.count = parameters.count;
|
|
2068
2089
|
this.intervalUnit = parameters.intervalUnit;
|
|
2069
2090
|
this.startDate = parameters.startDate;
|
|
2070
2091
|
this.endDate = parameters.endDate;
|
|
2071
|
-
this.allowMaxTokenApproval = (
|
|
2092
|
+
this.allowMaxTokenApproval = (_b = parameters.allowMaxTokenApproval) != null ? _b : false;
|
|
2072
2093
|
this.serviceType = parameters.serviceType;
|
|
2073
2094
|
this.viemClient = new ViemClient(this.chainId, this.walletClient);
|
|
2074
2095
|
this.account = new ActaAccount(
|
|
@@ -2136,7 +2157,8 @@ var ActaBilling = class {
|
|
|
2136
2157
|
amount,
|
|
2137
2158
|
receiver,
|
|
2138
2159
|
feeInclusive,
|
|
2139
|
-
allowMaxTokenApproval: this.allowMaxTokenApproval
|
|
2160
|
+
allowMaxTokenApproval: this.allowMaxTokenApproval,
|
|
2161
|
+
feebps: 20
|
|
2140
2162
|
});
|
|
2141
2163
|
const txn = yield executeSinglePaymentAPICall(
|
|
2142
2164
|
`${transactionServiceUrl2}execute/single`,
|
|
@@ -2201,7 +2223,8 @@ var ActaBilling = class {
|
|
|
2201
2223
|
startDate,
|
|
2202
2224
|
endDate,
|
|
2203
2225
|
receiver,
|
|
2204
|
-
allowMaxTokenApproval: this.allowMaxTokenApproval
|
|
2226
|
+
allowMaxTokenApproval: this.allowMaxTokenApproval,
|
|
2227
|
+
feebps: 20
|
|
2205
2228
|
});
|
|
2206
2229
|
const txn = yield scheduleRecurringPaymentsAPICall(
|
|
2207
2230
|
`${transactionServiceUrl2}schedule/recurring`,
|
|
@@ -2244,7 +2267,8 @@ var ActaBilling = class {
|
|
|
2244
2267
|
feeInclusive,
|
|
2245
2268
|
receiver,
|
|
2246
2269
|
signerAddress,
|
|
2247
|
-
token: tokenSymbol
|
|
2270
|
+
token: tokenSymbol,
|
|
2271
|
+
feebps: 20
|
|
2248
2272
|
});
|
|
2249
2273
|
const amountToTransfer = feeInclusive ? amount : feeExclusiveAmountInToken;
|
|
2250
2274
|
let paymentAmount = (amountToTransfer + estimatedGasCostInToken * BigInt(2)) * BigInt(count != null ? count : 1);
|
|
@@ -2342,6 +2366,10 @@ var ActaBatch = class {
|
|
|
2342
2366
|
walletClient,
|
|
2343
2367
|
instructionId
|
|
2344
2368
|
} = parameters;
|
|
2369
|
+
let isFeeInclusive = false;
|
|
2370
|
+
if (feeInclusive) {
|
|
2371
|
+
isFeeInclusive = true;
|
|
2372
|
+
}
|
|
2345
2373
|
const { envBatchServiceUrl } = returnEnvUrl(chainId);
|
|
2346
2374
|
const instuctionData = yield fetchBatchInstructionDetails(
|
|
2347
2375
|
`${envBatchServiceUrl}instruction/${instructionId}`,
|
|
@@ -2384,12 +2412,13 @@ var ActaBatch = class {
|
|
|
2384
2412
|
userOperation
|
|
2385
2413
|
} = yield account.estimateSingleBatchPaymentGas({
|
|
2386
2414
|
chainId,
|
|
2387
|
-
feeInclusive,
|
|
2415
|
+
feeInclusive: isFeeInclusive,
|
|
2388
2416
|
signerAddress,
|
|
2389
2417
|
token: token2,
|
|
2390
2418
|
walletClient,
|
|
2391
2419
|
receivers,
|
|
2392
|
-
totalAmount: totalAmountParsed
|
|
2420
|
+
totalAmount: totalAmountParsed,
|
|
2421
|
+
feebps: 20
|
|
2393
2422
|
});
|
|
2394
2423
|
return {
|
|
2395
2424
|
estimatedGasCostInToken,
|
|
@@ -2420,6 +2449,10 @@ var ActaBatch = class {
|
|
|
2420
2449
|
allowMaxTokenApproval,
|
|
2421
2450
|
instructionId
|
|
2422
2451
|
} = params;
|
|
2452
|
+
let isFeeInclusive = false;
|
|
2453
|
+
if (feeInclusive) {
|
|
2454
|
+
isFeeInclusive = true;
|
|
2455
|
+
}
|
|
2423
2456
|
const { envBatchServiceUrl } = returnEnvUrl(chainId);
|
|
2424
2457
|
const instuctionData = yield fetchBatchInstructionDetails(
|
|
2425
2458
|
`${envBatchServiceUrl}instruction/${instructionId}`,
|
|
@@ -2458,11 +2491,12 @@ var ActaBatch = class {
|
|
|
2458
2491
|
signerAddress,
|
|
2459
2492
|
chainId,
|
|
2460
2493
|
token: tokenSymbol,
|
|
2461
|
-
feeInclusive,
|
|
2494
|
+
feeInclusive: isFeeInclusive,
|
|
2462
2495
|
receivers,
|
|
2463
2496
|
totalAmount: totalAmountParsed,
|
|
2464
2497
|
walletClient,
|
|
2465
|
-
allowMaxTokenApproval
|
|
2498
|
+
allowMaxTokenApproval,
|
|
2499
|
+
feebps: 20
|
|
2466
2500
|
});
|
|
2467
2501
|
const txn = yield executeSingleBatchPaymentAPICall(
|
|
2468
2502
|
`${envBatchServiceUrl}execute/single/batch`,
|
|
@@ -2473,7 +2507,7 @@ var ActaBatch = class {
|
|
|
2473
2507
|
chainId,
|
|
2474
2508
|
tokenAddress: tokenData.address,
|
|
2475
2509
|
amount: toHex4(totalAmountParsed),
|
|
2476
|
-
feeInclusive,
|
|
2510
|
+
feeInclusive: isFeeInclusive,
|
|
2477
2511
|
serviceType: "batch"
|
|
2478
2512
|
},
|
|
2479
2513
|
serviceParams
|
|
@@ -2501,6 +2535,10 @@ var ActaBatch = class {
|
|
|
2501
2535
|
instructionId,
|
|
2502
2536
|
executionTime
|
|
2503
2537
|
} = params;
|
|
2538
|
+
let isFeeInclusive = false;
|
|
2539
|
+
if (feeInclusive) {
|
|
2540
|
+
isFeeInclusive = true;
|
|
2541
|
+
}
|
|
2504
2542
|
const { envBatchServiceUrl } = returnEnvUrl(chainId);
|
|
2505
2543
|
if (executionTime <= Date.now() + 1e3 * 60 * 2) {
|
|
2506
2544
|
throw new Error(
|
|
@@ -2544,12 +2582,13 @@ var ActaBatch = class {
|
|
|
2544
2582
|
signerAddress,
|
|
2545
2583
|
chainId,
|
|
2546
2584
|
token: tokenSymbol,
|
|
2547
|
-
feeInclusive,
|
|
2585
|
+
feeInclusive: isFeeInclusive,
|
|
2548
2586
|
receivers,
|
|
2549
2587
|
totalAmount: totalAmountParsed,
|
|
2550
2588
|
walletClient,
|
|
2551
2589
|
allowMaxTokenApproval,
|
|
2552
|
-
count: 1
|
|
2590
|
+
count: 1,
|
|
2591
|
+
feebps: 20
|
|
2553
2592
|
});
|
|
2554
2593
|
const txn = yield executeScheduleBatchPaymentAPICall(
|
|
2555
2594
|
`${envBatchServiceUrl}execute/schedule/batch`,
|
|
@@ -2559,7 +2598,7 @@ var ActaBatch = class {
|
|
|
2559
2598
|
chainId,
|
|
2560
2599
|
tokenAddress: tokenData.address,
|
|
2561
2600
|
amount: toHex4(totalAmountParsed),
|
|
2562
|
-
feeInclusive,
|
|
2601
|
+
feeInclusive: isFeeInclusive,
|
|
2563
2602
|
serviceType: "batch",
|
|
2564
2603
|
amountExclusive: toHex4(amountExclusive),
|
|
2565
2604
|
approval,
|