@actalink/commonlib 0.0.26 → 0.0.28
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 +37 -22
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +40 -26
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -137,6 +137,7 @@ __export(index_exports, {
|
|
|
137
137
|
polygonWETH: () => polygonWETH,
|
|
138
138
|
polygonWPOL: () => polygonWPOL,
|
|
139
139
|
scheduleRecurringPaymentsAPICall: () => scheduleRecurringPaymentsAPICall,
|
|
140
|
+
scheduleSubscriptionPaymentsAPICall: () => scheduleSubscriptionPaymentsAPICall,
|
|
140
141
|
sendRequest: () => sendRequest,
|
|
141
142
|
sepoliaUSDC: () => sepoliaUSDC,
|
|
142
143
|
serializePermissionAccountParams: () => serializePermissionAccountParams,
|
|
@@ -1645,6 +1646,23 @@ function scheduleRecurringPaymentsAPICall(url, params) {
|
|
|
1645
1646
|
return response.data;
|
|
1646
1647
|
});
|
|
1647
1648
|
}
|
|
1649
|
+
function scheduleSubscriptionPaymentsAPICall(url, paymentParams, serviceParams) {
|
|
1650
|
+
return __async(this, null, function* () {
|
|
1651
|
+
const parsedParams = {
|
|
1652
|
+
paymentParams: __spreadProps(__spreadValues({}, paymentParams), {
|
|
1653
|
+
amount: (0, import_viem4.toHex)(paymentParams.amount),
|
|
1654
|
+
amountExclusive: (0, import_viem4.toHex)(paymentParams.amountExclusive)
|
|
1655
|
+
}),
|
|
1656
|
+
serviceParams
|
|
1657
|
+
};
|
|
1658
|
+
const response = yield sendRequest({
|
|
1659
|
+
url,
|
|
1660
|
+
method: "post" /* Post */,
|
|
1661
|
+
body: parsedParams
|
|
1662
|
+
});
|
|
1663
|
+
return response.data;
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1648
1666
|
function createBillingSessionAPICall(url, sessionBodyParams) {
|
|
1649
1667
|
return __async(this, null, function* () {
|
|
1650
1668
|
const response = yield sendRequest({
|
|
@@ -1794,7 +1812,7 @@ var ActaDeposit = class {
|
|
|
1794
1812
|
this.serviceSessionParams = void 0;
|
|
1795
1813
|
this.depositSessionId = "";
|
|
1796
1814
|
this.status = "not_started";
|
|
1797
|
-
this.serviceType = "
|
|
1815
|
+
this.serviceType = "bexo";
|
|
1798
1816
|
this.allowMaxTokenApproval = false;
|
|
1799
1817
|
var _a, _b, _c;
|
|
1800
1818
|
this.connectorType = parameters.connectorType;
|
|
@@ -1919,7 +1937,7 @@ var ActaDeposit = class {
|
|
|
1919
1937
|
return __async(this, null, function* () {
|
|
1920
1938
|
try {
|
|
1921
1939
|
if (this.paymentType === "single") {
|
|
1922
|
-
const paymentParams = this.serviceType === "
|
|
1940
|
+
const paymentParams = this.serviceType === "bexo" ? __spreadProps(__spreadValues({}, servicePaymentParams), {
|
|
1923
1941
|
depositSessionId: this.depositSessionId
|
|
1924
1942
|
}) : servicePaymentParams;
|
|
1925
1943
|
const id = yield this.createSinglePayment(paymentParams);
|
|
@@ -1928,7 +1946,7 @@ var ActaDeposit = class {
|
|
|
1928
1946
|
if (this.paymentType === "choose") {
|
|
1929
1947
|
}
|
|
1930
1948
|
if (this.paymentType === "recurring") {
|
|
1931
|
-
const paymentParams = this.serviceType === "
|
|
1949
|
+
const paymentParams = this.serviceType === "bexo" ? __spreadProps(__spreadValues({}, servicePaymentParams), {
|
|
1932
1950
|
depositSessionId: this.depositSessionId
|
|
1933
1951
|
}) : servicePaymentParams;
|
|
1934
1952
|
const id = yield this.createRecurringPayments(paymentParams);
|
|
@@ -2135,10 +2153,8 @@ var ActaDeposit = class {
|
|
|
2135
2153
|
|
|
2136
2154
|
// src/billing.ts
|
|
2137
2155
|
var import_viem6 = require("viem");
|
|
2138
|
-
var
|
|
2139
|
-
var
|
|
2140
|
-
var transactionServiceTestUrl2 = "https://api.acta.link/transaction/test/v1/";
|
|
2141
|
-
var billingServiceTestUrl = "https://api.acta.link/pay/test/v1/";
|
|
2156
|
+
var billingServiceUrl = "https://api.acta.link/pay/api/v1/";
|
|
2157
|
+
var billingServiceTestUrl = "https://api.acta.link/pay/test/api/v1/";
|
|
2142
2158
|
var returnEnvUrl2 = (chainId) => {
|
|
2143
2159
|
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
2144
2160
|
const testnetChain = testnetChains.find((c) => c.id === chainId);
|
|
@@ -2147,12 +2163,10 @@ var returnEnvUrl2 = (chainId) => {
|
|
|
2147
2163
|
}
|
|
2148
2164
|
if (mainnetChain) {
|
|
2149
2165
|
return {
|
|
2150
|
-
envTransactionServiceUrl: transactionServiceUrl2,
|
|
2151
2166
|
envBillingServiceUrl: billingServiceUrl
|
|
2152
2167
|
};
|
|
2153
2168
|
} else {
|
|
2154
2169
|
return {
|
|
2155
|
-
envTransactionServiceUrl: transactionServiceTestUrl2,
|
|
2156
2170
|
envBillingServiceUrl: billingServiceTestUrl
|
|
2157
2171
|
};
|
|
2158
2172
|
}
|
|
@@ -2243,7 +2257,7 @@ var ActaBilling = class {
|
|
|
2243
2257
|
if (!token2) {
|
|
2244
2258
|
throw new Error("Token not supported.");
|
|
2245
2259
|
}
|
|
2246
|
-
const {
|
|
2260
|
+
const { envBillingServiceUrl } = returnEnvUrl2(chainId);
|
|
2247
2261
|
const rpcParameters = yield this.account.signSinglePaymentOperation({
|
|
2248
2262
|
signerAddress,
|
|
2249
2263
|
chainId,
|
|
@@ -2255,7 +2269,7 @@ var ActaBilling = class {
|
|
|
2255
2269
|
feebps: 20
|
|
2256
2270
|
});
|
|
2257
2271
|
const txn = yield executeSinglePaymentAPICall(
|
|
2258
|
-
`${
|
|
2272
|
+
`${envBillingServiceUrl}execute/single`,
|
|
2259
2273
|
rpcParameters,
|
|
2260
2274
|
{
|
|
2261
2275
|
senderAddress: signerAddress,
|
|
@@ -2306,7 +2320,7 @@ var ActaBilling = class {
|
|
|
2306
2320
|
if (!chainId || !count || !intervalUnit || !startDate || !endDate) {
|
|
2307
2321
|
throw new Error("Invalid parameters.");
|
|
2308
2322
|
}
|
|
2309
|
-
const {
|
|
2323
|
+
const { envBillingServiceUrl } = returnEnvUrl2(chainId);
|
|
2310
2324
|
const { approval, amountExclusive } = yield this.account.signRecurringPayments({
|
|
2311
2325
|
signerAddress,
|
|
2312
2326
|
chainId,
|
|
@@ -2321,8 +2335,8 @@ var ActaBilling = class {
|
|
|
2321
2335
|
allowMaxTokenApproval: this.allowMaxTokenApproval,
|
|
2322
2336
|
feebps: 20
|
|
2323
2337
|
});
|
|
2324
|
-
const txn = yield
|
|
2325
|
-
`${
|
|
2338
|
+
const txn = yield scheduleSubscriptionPaymentsAPICall(
|
|
2339
|
+
`${envBillingServiceUrl}schedule/subscription`,
|
|
2326
2340
|
{
|
|
2327
2341
|
amount,
|
|
2328
2342
|
amountExclusive,
|
|
@@ -2336,9 +2350,9 @@ var ActaBilling = class {
|
|
|
2336
2350
|
startAt: startDate,
|
|
2337
2351
|
endAt: endDate,
|
|
2338
2352
|
approval,
|
|
2339
|
-
serviceParams: servicePaymentParams,
|
|
2340
2353
|
serviceType
|
|
2341
|
-
}
|
|
2354
|
+
},
|
|
2355
|
+
__spreadValues({}, servicePaymentParams)
|
|
2342
2356
|
);
|
|
2343
2357
|
return txn.recurringTransaction.id;
|
|
2344
2358
|
});
|
|
@@ -2380,9 +2394,9 @@ var ActaBilling = class {
|
|
|
2380
2394
|
|
|
2381
2395
|
// src/batch.ts
|
|
2382
2396
|
var import_viem7 = require("viem");
|
|
2383
|
-
var
|
|
2397
|
+
var transactionServiceUrl2 = "https://api.acta.link/transaction/v1/";
|
|
2384
2398
|
var batchServiceUrl = "https://api.acta.link/batch/api/v1/";
|
|
2385
|
-
var
|
|
2399
|
+
var transactionServiceTestUrl2 = "https://api.acta.link/transaction/test/v1/";
|
|
2386
2400
|
var batchServiceTestUrl = "https://api.acta.link/batch/test/api/v1/";
|
|
2387
2401
|
var returnEnvUrl3 = (chainId) => {
|
|
2388
2402
|
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
@@ -2392,12 +2406,12 @@ var returnEnvUrl3 = (chainId) => {
|
|
|
2392
2406
|
}
|
|
2393
2407
|
if (mainnetChain) {
|
|
2394
2408
|
return {
|
|
2395
|
-
envTransactionServiceUrl:
|
|
2409
|
+
envTransactionServiceUrl: transactionServiceUrl2,
|
|
2396
2410
|
envBatchServiceUrl: batchServiceUrl
|
|
2397
2411
|
};
|
|
2398
2412
|
} else {
|
|
2399
2413
|
return {
|
|
2400
|
-
envTransactionServiceUrl:
|
|
2414
|
+
envTransactionServiceUrl: transactionServiceTestUrl2,
|
|
2401
2415
|
envBatchServiceUrl: batchServiceTestUrl
|
|
2402
2416
|
};
|
|
2403
2417
|
}
|
|
@@ -2856,7 +2870,7 @@ var import_semver = require("semver");
|
|
|
2856
2870
|
var ECDSA_SIGNER_CONTRACT = "0x6A6F069E2a08c2468e7724Ab3250CdBFBA14D4FF";
|
|
2857
2871
|
var billingServiceUrl2 = "https://api.acta.link/pay/v1/";
|
|
2858
2872
|
var depositServiceUrl2 = "https://api.acta.link/deposit/v1/";
|
|
2859
|
-
var
|
|
2873
|
+
var transactionServiceUrl3 = "https://api.acta.link/transaction/v1/";
|
|
2860
2874
|
var billingServiceTestUrl2 = "https://api.acta.link/pay/test/v1/";
|
|
2861
2875
|
var toSignerId = (signer) => {
|
|
2862
2876
|
return (0, import_viem8.encodeAbiParameters)(
|
|
@@ -3256,7 +3270,7 @@ var cancelRecurringTransaction = (_0) => __async(null, [_0], function* ({
|
|
|
3256
3270
|
});
|
|
3257
3271
|
console.log(rpcParameters);
|
|
3258
3272
|
const txn = yield cancelRecurringPaymentAPICall(
|
|
3259
|
-
`${
|
|
3273
|
+
`${transactionServiceUrl3}execute/cancel`,
|
|
3260
3274
|
rpcParameters,
|
|
3261
3275
|
{
|
|
3262
3276
|
chainId,
|
|
@@ -3352,6 +3366,7 @@ var cancelRecurringTransaction = (_0) => __async(null, [_0], function* ({
|
|
|
3352
3366
|
polygonWETH,
|
|
3353
3367
|
polygonWPOL,
|
|
3354
3368
|
scheduleRecurringPaymentsAPICall,
|
|
3369
|
+
scheduleSubscriptionPaymentsAPICall,
|
|
3355
3370
|
sendRequest,
|
|
3356
3371
|
sepoliaUSDC,
|
|
3357
3372
|
serializePermissionAccountParams,
|
package/dist/index.d.cts
CHANGED
|
@@ -12007,6 +12007,21 @@ declare function scheduleRecurringPaymentsAPICall(url: string, params: {
|
|
|
12007
12007
|
approval: string;
|
|
12008
12008
|
serviceParams: any;
|
|
12009
12009
|
}): Promise<any>;
|
|
12010
|
+
declare function scheduleSubscriptionPaymentsAPICall(url: string, paymentParams: {
|
|
12011
|
+
senderAddress: string;
|
|
12012
|
+
receiverAddress: string;
|
|
12013
|
+
chainId: number;
|
|
12014
|
+
tokenAddress: string;
|
|
12015
|
+
amount: bigint;
|
|
12016
|
+
amountExclusive: bigint;
|
|
12017
|
+
feeInclusive: boolean;
|
|
12018
|
+
serviceType: string;
|
|
12019
|
+
intervalUnit: string;
|
|
12020
|
+
intervalCount: number;
|
|
12021
|
+
startAt: number;
|
|
12022
|
+
endAt: number;
|
|
12023
|
+
approval: string;
|
|
12024
|
+
}, serviceParams: any): Promise<any>;
|
|
12010
12025
|
declare function createBillingSessionAPICall(url: string, sessionBodyParams: {
|
|
12011
12026
|
paylinkId: string;
|
|
12012
12027
|
mode: "paylink";
|
|
@@ -12063,4 +12078,4 @@ declare function createBatchSessionAPICall(url: string, APIKey: string, params:
|
|
|
12063
12078
|
}): Promise<any>;
|
|
12064
12079
|
declare function fetchBatchInstructionDetails(url: string, APIKey: string): Promise<any>;
|
|
12065
12080
|
|
|
12066
|
-
export { type AbstractPaymentParams, ActaAccount, ActaBatch, ActaBilling, ActaDeposit, type BatchClassParams, type BillingClassParams, type CalculateSingleBatchPaymentGasParameters, ConnectorType, type DepositClassParams, type EstimateSingleBatchPaymentGasParameters, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type ScheduleBatchPaymentClassParamsType, type ScheduleBatchPaymentWithoutKeyClassParamsType, type ScheduleOrRecurringBatchPaymentParamsType, type SingleBatchPaymentClassParamsType, type SingleBatchPaymentParamsType, type SingleBatchPaymentWithoutKeyClassParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseSepoliaUSDC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, cancelRecurringPaymentAPICall, cancelRecurringTransaction, createBatchSessionAPICall, createBillingCheckoutSession, createBillingSessionAPICall, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeScheduleBatchPaymentAPICall, executeSingleBatchPaymentAPICall, executeSinglePaymentAPICall, fetchBatchInstructionDetails, fetchBillingSessionDetails, fetchRecurringTransactionWithId, getBillingPaymentSessionDetails, getChainById, getChainExplorerByChainId, getPeriodInterval, getRpcByChainId, getTokenByChainIdAndAddress, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, mainnetChains, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonAmoyUSDC, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, sendRequest, sepoliaUSDC, serializePermissionAccountParams, supportedChains, supportedTokensByChain, testnetChains, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
|
|
12081
|
+
export { type AbstractPaymentParams, ActaAccount, ActaBatch, ActaBilling, ActaDeposit, type BatchClassParams, type BillingClassParams, type CalculateSingleBatchPaymentGasParameters, ConnectorType, type DepositClassParams, type EstimateSingleBatchPaymentGasParameters, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type ScheduleBatchPaymentClassParamsType, type ScheduleBatchPaymentWithoutKeyClassParamsType, type ScheduleOrRecurringBatchPaymentParamsType, type SingleBatchPaymentClassParamsType, type SingleBatchPaymentParamsType, type SingleBatchPaymentWithoutKeyClassParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseSepoliaUSDC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, cancelRecurringPaymentAPICall, cancelRecurringTransaction, createBatchSessionAPICall, createBillingCheckoutSession, createBillingSessionAPICall, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeScheduleBatchPaymentAPICall, executeSingleBatchPaymentAPICall, executeSinglePaymentAPICall, fetchBatchInstructionDetails, fetchBillingSessionDetails, fetchRecurringTransactionWithId, getBillingPaymentSessionDetails, getChainById, getChainExplorerByChainId, getPeriodInterval, getRpcByChainId, getTokenByChainIdAndAddress, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, mainnetChains, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonAmoyUSDC, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, scheduleSubscriptionPaymentsAPICall, sendRequest, sepoliaUSDC, serializePermissionAccountParams, supportedChains, supportedTokensByChain, testnetChains, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
|
package/dist/index.d.ts
CHANGED
|
@@ -12007,6 +12007,21 @@ declare function scheduleRecurringPaymentsAPICall(url: string, params: {
|
|
|
12007
12007
|
approval: string;
|
|
12008
12008
|
serviceParams: any;
|
|
12009
12009
|
}): Promise<any>;
|
|
12010
|
+
declare function scheduleSubscriptionPaymentsAPICall(url: string, paymentParams: {
|
|
12011
|
+
senderAddress: string;
|
|
12012
|
+
receiverAddress: string;
|
|
12013
|
+
chainId: number;
|
|
12014
|
+
tokenAddress: string;
|
|
12015
|
+
amount: bigint;
|
|
12016
|
+
amountExclusive: bigint;
|
|
12017
|
+
feeInclusive: boolean;
|
|
12018
|
+
serviceType: string;
|
|
12019
|
+
intervalUnit: string;
|
|
12020
|
+
intervalCount: number;
|
|
12021
|
+
startAt: number;
|
|
12022
|
+
endAt: number;
|
|
12023
|
+
approval: string;
|
|
12024
|
+
}, serviceParams: any): Promise<any>;
|
|
12010
12025
|
declare function createBillingSessionAPICall(url: string, sessionBodyParams: {
|
|
12011
12026
|
paylinkId: string;
|
|
12012
12027
|
mode: "paylink";
|
|
@@ -12063,4 +12078,4 @@ declare function createBatchSessionAPICall(url: string, APIKey: string, params:
|
|
|
12063
12078
|
}): Promise<any>;
|
|
12064
12079
|
declare function fetchBatchInstructionDetails(url: string, APIKey: string): Promise<any>;
|
|
12065
12080
|
|
|
12066
|
-
export { type AbstractPaymentParams, ActaAccount, ActaBatch, ActaBilling, ActaDeposit, type BatchClassParams, type BillingClassParams, type CalculateSingleBatchPaymentGasParameters, ConnectorType, type DepositClassParams, type EstimateSingleBatchPaymentGasParameters, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type ScheduleBatchPaymentClassParamsType, type ScheduleBatchPaymentWithoutKeyClassParamsType, type ScheduleOrRecurringBatchPaymentParamsType, type SingleBatchPaymentClassParamsType, type SingleBatchPaymentParamsType, type SingleBatchPaymentWithoutKeyClassParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseSepoliaUSDC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, cancelRecurringPaymentAPICall, cancelRecurringTransaction, createBatchSessionAPICall, createBillingCheckoutSession, createBillingSessionAPICall, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeScheduleBatchPaymentAPICall, executeSingleBatchPaymentAPICall, executeSinglePaymentAPICall, fetchBatchInstructionDetails, fetchBillingSessionDetails, fetchRecurringTransactionWithId, getBillingPaymentSessionDetails, getChainById, getChainExplorerByChainId, getPeriodInterval, getRpcByChainId, getTokenByChainIdAndAddress, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, mainnetChains, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonAmoyUSDC, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, sendRequest, sepoliaUSDC, serializePermissionAccountParams, supportedChains, supportedTokensByChain, testnetChains, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
|
|
12081
|
+
export { type AbstractPaymentParams, ActaAccount, ActaBatch, ActaBilling, ActaDeposit, type BatchClassParams, type BillingClassParams, type CalculateSingleBatchPaymentGasParameters, ConnectorType, type DepositClassParams, type EstimateSingleBatchPaymentGasParameters, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type ScheduleBatchPaymentClassParamsType, type ScheduleBatchPaymentWithoutKeyClassParamsType, type ScheduleOrRecurringBatchPaymentParamsType, type SingleBatchPaymentClassParamsType, type SingleBatchPaymentParamsType, type SingleBatchPaymentWithoutKeyClassParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseSepoliaUSDC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, cancelRecurringPaymentAPICall, cancelRecurringTransaction, createBatchSessionAPICall, createBillingCheckoutSession, createBillingSessionAPICall, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeScheduleBatchPaymentAPICall, executeSingleBatchPaymentAPICall, executeSinglePaymentAPICall, fetchBatchInstructionDetails, fetchBillingSessionDetails, fetchRecurringTransactionWithId, getBillingPaymentSessionDetails, getChainById, getChainExplorerByChainId, getPeriodInterval, getRpcByChainId, getTokenByChainIdAndAddress, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, mainnetChains, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonAmoyUSDC, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, scheduleSubscriptionPaymentsAPICall, sendRequest, sepoliaUSDC, serializePermissionAccountParams, supportedChains, supportedTokensByChain, testnetChains, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
|
package/dist/index.js
CHANGED
|
@@ -1573,6 +1573,23 @@ function scheduleRecurringPaymentsAPICall(url, params) {
|
|
|
1573
1573
|
return response.data;
|
|
1574
1574
|
});
|
|
1575
1575
|
}
|
|
1576
|
+
function scheduleSubscriptionPaymentsAPICall(url, paymentParams, serviceParams) {
|
|
1577
|
+
return __async(this, null, function* () {
|
|
1578
|
+
const parsedParams = {
|
|
1579
|
+
paymentParams: __spreadProps(__spreadValues({}, paymentParams), {
|
|
1580
|
+
amount: toHex(paymentParams.amount),
|
|
1581
|
+
amountExclusive: toHex(paymentParams.amountExclusive)
|
|
1582
|
+
}),
|
|
1583
|
+
serviceParams
|
|
1584
|
+
};
|
|
1585
|
+
const response = yield sendRequest({
|
|
1586
|
+
url,
|
|
1587
|
+
method: "post" /* Post */,
|
|
1588
|
+
body: parsedParams
|
|
1589
|
+
});
|
|
1590
|
+
return response.data;
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1576
1593
|
function createBillingSessionAPICall(url, sessionBodyParams) {
|
|
1577
1594
|
return __async(this, null, function* () {
|
|
1578
1595
|
const response = yield sendRequest({
|
|
@@ -1722,7 +1739,7 @@ var ActaDeposit = class {
|
|
|
1722
1739
|
this.serviceSessionParams = void 0;
|
|
1723
1740
|
this.depositSessionId = "";
|
|
1724
1741
|
this.status = "not_started";
|
|
1725
|
-
this.serviceType = "
|
|
1742
|
+
this.serviceType = "bexo";
|
|
1726
1743
|
this.allowMaxTokenApproval = false;
|
|
1727
1744
|
var _a, _b, _c;
|
|
1728
1745
|
this.connectorType = parameters.connectorType;
|
|
@@ -1847,7 +1864,7 @@ var ActaDeposit = class {
|
|
|
1847
1864
|
return __async(this, null, function* () {
|
|
1848
1865
|
try {
|
|
1849
1866
|
if (this.paymentType === "single") {
|
|
1850
|
-
const paymentParams = this.serviceType === "
|
|
1867
|
+
const paymentParams = this.serviceType === "bexo" ? __spreadProps(__spreadValues({}, servicePaymentParams), {
|
|
1851
1868
|
depositSessionId: this.depositSessionId
|
|
1852
1869
|
}) : servicePaymentParams;
|
|
1853
1870
|
const id = yield this.createSinglePayment(paymentParams);
|
|
@@ -1856,7 +1873,7 @@ var ActaDeposit = class {
|
|
|
1856
1873
|
if (this.paymentType === "choose") {
|
|
1857
1874
|
}
|
|
1858
1875
|
if (this.paymentType === "recurring") {
|
|
1859
|
-
const paymentParams = this.serviceType === "
|
|
1876
|
+
const paymentParams = this.serviceType === "bexo" ? __spreadProps(__spreadValues({}, servicePaymentParams), {
|
|
1860
1877
|
depositSessionId: this.depositSessionId
|
|
1861
1878
|
}) : servicePaymentParams;
|
|
1862
1879
|
const id = yield this.createRecurringPayments(paymentParams);
|
|
@@ -2063,10 +2080,8 @@ var ActaDeposit = class {
|
|
|
2063
2080
|
|
|
2064
2081
|
// src/billing.ts
|
|
2065
2082
|
import { toHex as toHex3 } from "viem";
|
|
2066
|
-
var
|
|
2067
|
-
var
|
|
2068
|
-
var transactionServiceTestUrl2 = "https://api.acta.link/transaction/test/v1/";
|
|
2069
|
-
var billingServiceTestUrl = "https://api.acta.link/pay/test/v1/";
|
|
2083
|
+
var billingServiceUrl = "https://api.acta.link/pay/api/v1/";
|
|
2084
|
+
var billingServiceTestUrl = "https://api.acta.link/pay/test/api/v1/";
|
|
2070
2085
|
var returnEnvUrl2 = (chainId) => {
|
|
2071
2086
|
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
2072
2087
|
const testnetChain = testnetChains.find((c) => c.id === chainId);
|
|
@@ -2075,12 +2090,10 @@ var returnEnvUrl2 = (chainId) => {
|
|
|
2075
2090
|
}
|
|
2076
2091
|
if (mainnetChain) {
|
|
2077
2092
|
return {
|
|
2078
|
-
envTransactionServiceUrl: transactionServiceUrl2,
|
|
2079
2093
|
envBillingServiceUrl: billingServiceUrl
|
|
2080
2094
|
};
|
|
2081
2095
|
} else {
|
|
2082
2096
|
return {
|
|
2083
|
-
envTransactionServiceUrl: transactionServiceTestUrl2,
|
|
2084
2097
|
envBillingServiceUrl: billingServiceTestUrl
|
|
2085
2098
|
};
|
|
2086
2099
|
}
|
|
@@ -2171,7 +2184,7 @@ var ActaBilling = class {
|
|
|
2171
2184
|
if (!token2) {
|
|
2172
2185
|
throw new Error("Token not supported.");
|
|
2173
2186
|
}
|
|
2174
|
-
const {
|
|
2187
|
+
const { envBillingServiceUrl } = returnEnvUrl2(chainId);
|
|
2175
2188
|
const rpcParameters = yield this.account.signSinglePaymentOperation({
|
|
2176
2189
|
signerAddress,
|
|
2177
2190
|
chainId,
|
|
@@ -2183,7 +2196,7 @@ var ActaBilling = class {
|
|
|
2183
2196
|
feebps: 20
|
|
2184
2197
|
});
|
|
2185
2198
|
const txn = yield executeSinglePaymentAPICall(
|
|
2186
|
-
`${
|
|
2199
|
+
`${envBillingServiceUrl}execute/single`,
|
|
2187
2200
|
rpcParameters,
|
|
2188
2201
|
{
|
|
2189
2202
|
senderAddress: signerAddress,
|
|
@@ -2234,7 +2247,7 @@ var ActaBilling = class {
|
|
|
2234
2247
|
if (!chainId || !count || !intervalUnit || !startDate || !endDate) {
|
|
2235
2248
|
throw new Error("Invalid parameters.");
|
|
2236
2249
|
}
|
|
2237
|
-
const {
|
|
2250
|
+
const { envBillingServiceUrl } = returnEnvUrl2(chainId);
|
|
2238
2251
|
const { approval, amountExclusive } = yield this.account.signRecurringPayments({
|
|
2239
2252
|
signerAddress,
|
|
2240
2253
|
chainId,
|
|
@@ -2249,8 +2262,8 @@ var ActaBilling = class {
|
|
|
2249
2262
|
allowMaxTokenApproval: this.allowMaxTokenApproval,
|
|
2250
2263
|
feebps: 20
|
|
2251
2264
|
});
|
|
2252
|
-
const txn = yield
|
|
2253
|
-
`${
|
|
2265
|
+
const txn = yield scheduleSubscriptionPaymentsAPICall(
|
|
2266
|
+
`${envBillingServiceUrl}schedule/subscription`,
|
|
2254
2267
|
{
|
|
2255
2268
|
amount,
|
|
2256
2269
|
amountExclusive,
|
|
@@ -2264,9 +2277,9 @@ var ActaBilling = class {
|
|
|
2264
2277
|
startAt: startDate,
|
|
2265
2278
|
endAt: endDate,
|
|
2266
2279
|
approval,
|
|
2267
|
-
serviceParams: servicePaymentParams,
|
|
2268
2280
|
serviceType
|
|
2269
|
-
}
|
|
2281
|
+
},
|
|
2282
|
+
__spreadValues({}, servicePaymentParams)
|
|
2270
2283
|
);
|
|
2271
2284
|
return txn.recurringTransaction.id;
|
|
2272
2285
|
});
|
|
@@ -2311,11 +2324,11 @@ import {
|
|
|
2311
2324
|
getAddress as getAddress3,
|
|
2312
2325
|
parseUnits,
|
|
2313
2326
|
toHex as toHex4,
|
|
2314
|
-
zeroAddress as
|
|
2327
|
+
zeroAddress as zeroAddress4
|
|
2315
2328
|
} from "viem";
|
|
2316
|
-
var
|
|
2329
|
+
var transactionServiceUrl2 = "https://api.acta.link/transaction/v1/";
|
|
2317
2330
|
var batchServiceUrl = "https://api.acta.link/batch/api/v1/";
|
|
2318
|
-
var
|
|
2331
|
+
var transactionServiceTestUrl2 = "https://api.acta.link/transaction/test/v1/";
|
|
2319
2332
|
var batchServiceTestUrl = "https://api.acta.link/batch/test/api/v1/";
|
|
2320
2333
|
var returnEnvUrl3 = (chainId) => {
|
|
2321
2334
|
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
@@ -2325,12 +2338,12 @@ var returnEnvUrl3 = (chainId) => {
|
|
|
2325
2338
|
}
|
|
2326
2339
|
if (mainnetChain) {
|
|
2327
2340
|
return {
|
|
2328
|
-
envTransactionServiceUrl:
|
|
2341
|
+
envTransactionServiceUrl: transactionServiceUrl2,
|
|
2329
2342
|
envBatchServiceUrl: batchServiceUrl
|
|
2330
2343
|
};
|
|
2331
2344
|
} else {
|
|
2332
2345
|
return {
|
|
2333
|
-
envTransactionServiceUrl:
|
|
2346
|
+
envTransactionServiceUrl: transactionServiceTestUrl2,
|
|
2334
2347
|
envBatchServiceUrl: batchServiceTestUrl
|
|
2335
2348
|
};
|
|
2336
2349
|
}
|
|
@@ -2347,7 +2360,7 @@ var ActaBatch = class {
|
|
|
2347
2360
|
if (!this.APIkey) {
|
|
2348
2361
|
throw new Error("No API key provided.");
|
|
2349
2362
|
}
|
|
2350
|
-
if (!signerAddress || signerAddress ===
|
|
2363
|
+
if (!signerAddress || signerAddress === zeroAddress4) {
|
|
2351
2364
|
throw new Error("Signer address is required.");
|
|
2352
2365
|
}
|
|
2353
2366
|
if (!name || name === "") {
|
|
@@ -2795,7 +2808,7 @@ import {
|
|
|
2795
2808
|
encodeAbiParameters,
|
|
2796
2809
|
keccak256,
|
|
2797
2810
|
slice,
|
|
2798
|
-
zeroAddress as
|
|
2811
|
+
zeroAddress as zeroAddress5,
|
|
2799
2812
|
decodeFunctionData,
|
|
2800
2813
|
hexToBigInt as hexToBigInt2
|
|
2801
2814
|
} from "viem";
|
|
@@ -2820,7 +2833,7 @@ import { coerce, gt } from "semver";
|
|
|
2820
2833
|
var ECDSA_SIGNER_CONTRACT = "0x6A6F069E2a08c2468e7724Ab3250CdBFBA14D4FF";
|
|
2821
2834
|
var billingServiceUrl2 = "https://api.acta.link/pay/v1/";
|
|
2822
2835
|
var depositServiceUrl2 = "https://api.acta.link/deposit/v1/";
|
|
2823
|
-
var
|
|
2836
|
+
var transactionServiceUrl3 = "https://api.acta.link/transaction/v1/";
|
|
2824
2837
|
var billingServiceTestUrl2 = "https://api.acta.link/pay/test/v1/";
|
|
2825
2838
|
var toSignerId = (signer) => {
|
|
2826
2839
|
return encodeAbiParameters(
|
|
@@ -2907,7 +2920,7 @@ function toPermissionValidator2(_0, _1) {
|
|
|
2907
2920
|
return __spreadProps(__spreadValues({}, signer.account), {
|
|
2908
2921
|
supportedKernelVersions: ">=0.3.0",
|
|
2909
2922
|
validatorType: "PERMISSION",
|
|
2910
|
-
address:
|
|
2923
|
+
address: zeroAddress5,
|
|
2911
2924
|
source: "PermissionValidator",
|
|
2912
2925
|
getEnableData,
|
|
2913
2926
|
getIdentifier: getPermissionId,
|
|
@@ -3220,7 +3233,7 @@ var cancelRecurringTransaction = (_0) => __async(null, [_0], function* ({
|
|
|
3220
3233
|
});
|
|
3221
3234
|
console.log(rpcParameters);
|
|
3222
3235
|
const txn = yield cancelRecurringPaymentAPICall(
|
|
3223
|
-
`${
|
|
3236
|
+
`${transactionServiceUrl3}execute/cancel`,
|
|
3224
3237
|
rpcParameters,
|
|
3225
3238
|
{
|
|
3226
3239
|
chainId,
|
|
@@ -3315,6 +3328,7 @@ export {
|
|
|
3315
3328
|
polygonWETH,
|
|
3316
3329
|
polygonWPOL,
|
|
3317
3330
|
scheduleRecurringPaymentsAPICall,
|
|
3331
|
+
scheduleSubscriptionPaymentsAPICall,
|
|
3318
3332
|
sendRequest,
|
|
3319
3333
|
sepoliaUSDC,
|
|
3320
3334
|
serializePermissionAccountParams,
|