@actalink/commonlib 0.0.17 → 0.0.19
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 +76 -18
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +76 -18
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1788,6 +1788,26 @@ function fetchBatchInstructionDetails(url, APIKey) {
|
|
|
1788
1788
|
// src/deposit.ts
|
|
1789
1789
|
var transactionServiceUrl = "https://api.acta.link/transaction/v1/";
|
|
1790
1790
|
var depositServiceUrl = "https://api.acta.link/deposit/v1/";
|
|
1791
|
+
var transactionServiceTestUrl = "https://api.acta.link/transaction/test/v1/";
|
|
1792
|
+
var depositServiceTestUrl = "https://api.acta.link/deposit/test/v1/";
|
|
1793
|
+
var returnEnvUrl = (chainId) => {
|
|
1794
|
+
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
1795
|
+
const testnetChain = testnetChains.find((c) => c.id === chainId);
|
|
1796
|
+
if (!mainnetChain && !testnetChain) {
|
|
1797
|
+
throw new Error(`Chain ${chainId} not supported.`);
|
|
1798
|
+
}
|
|
1799
|
+
if (mainnetChain) {
|
|
1800
|
+
return {
|
|
1801
|
+
envTransactionServiceUrl: transactionServiceUrl,
|
|
1802
|
+
envDepositServiceUrl: depositServiceUrl
|
|
1803
|
+
};
|
|
1804
|
+
} else {
|
|
1805
|
+
return {
|
|
1806
|
+
envTransactionServiceUrl: transactionServiceTestUrl,
|
|
1807
|
+
envDepositServiceUrl: depositServiceTestUrl
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1810
|
+
};
|
|
1791
1811
|
var ActaDeposit = class {
|
|
1792
1812
|
constructor(parameters) {
|
|
1793
1813
|
this.feeInclusive = false;
|
|
@@ -1841,9 +1861,10 @@ var ActaDeposit = class {
|
|
|
1841
1861
|
if (this.paymentType === "recurring" && this.intervalUnit === void 0) {
|
|
1842
1862
|
throw new Error("Interval unit is required for recurring payments.");
|
|
1843
1863
|
}
|
|
1864
|
+
const { envDepositServiceUrl } = returnEnvUrl(this.chainId);
|
|
1844
1865
|
if (this.depositSessionId !== "") {
|
|
1845
1866
|
const session2 = yield verifySessionAPICall(
|
|
1846
|
-
`${
|
|
1867
|
+
`${envDepositServiceUrl}verify-session?sessionId=${this.depositSessionId}`,
|
|
1847
1868
|
this.depositSessionId
|
|
1848
1869
|
);
|
|
1849
1870
|
this.depositSessionId = session2.sessionId;
|
|
@@ -1854,7 +1875,7 @@ var ActaDeposit = class {
|
|
|
1854
1875
|
throw new Error("Token not supported.");
|
|
1855
1876
|
}
|
|
1856
1877
|
const session = yield createSessionAPICall(
|
|
1857
|
-
`${
|
|
1878
|
+
`${envDepositServiceUrl}session`,
|
|
1858
1879
|
{
|
|
1859
1880
|
paymentParams: {
|
|
1860
1881
|
signerAddress: this.signerAddress,
|
|
@@ -1973,6 +1994,7 @@ var ActaDeposit = class {
|
|
|
1973
1994
|
if (!token2) {
|
|
1974
1995
|
throw new Error("Token not supported.");
|
|
1975
1996
|
}
|
|
1997
|
+
const { envTransactionServiceUrl } = returnEnvUrl(chainId);
|
|
1976
1998
|
const rpcParameters = yield this.account.signSinglePaymentOperation({
|
|
1977
1999
|
signerAddress,
|
|
1978
2000
|
chainId,
|
|
@@ -1984,7 +2006,7 @@ var ActaDeposit = class {
|
|
|
1984
2006
|
feebps: 10
|
|
1985
2007
|
});
|
|
1986
2008
|
const txn = yield executeSinglePaymentAPICall(
|
|
1987
|
-
`${
|
|
2009
|
+
`${envTransactionServiceUrl}execute/single`,
|
|
1988
2010
|
rpcParameters,
|
|
1989
2011
|
{
|
|
1990
2012
|
senderAddress: signerAddress,
|
|
@@ -2063,6 +2085,7 @@ var ActaDeposit = class {
|
|
|
2063
2085
|
if (!chainId || !count || !intervalUnit || !startDate || !endDate) {
|
|
2064
2086
|
throw new Error("Invalid parameters.");
|
|
2065
2087
|
}
|
|
2088
|
+
const { envTransactionServiceUrl } = returnEnvUrl(chainId);
|
|
2066
2089
|
const { approval, amountExclusive } = yield this.account.signRecurringPayments({
|
|
2067
2090
|
signerAddress,
|
|
2068
2091
|
chainId,
|
|
@@ -2078,7 +2101,7 @@ var ActaDeposit = class {
|
|
|
2078
2101
|
feebps: 20
|
|
2079
2102
|
});
|
|
2080
2103
|
const txn = yield scheduleRecurringPaymentsAPICall(
|
|
2081
|
-
`${
|
|
2104
|
+
`${envTransactionServiceUrl}schedule/recurring`,
|
|
2082
2105
|
{
|
|
2083
2106
|
amount,
|
|
2084
2107
|
amountExclusive,
|
|
@@ -2137,6 +2160,26 @@ var ActaDeposit = class {
|
|
|
2137
2160
|
// src/billing.ts
|
|
2138
2161
|
var import_viem6 = require("viem");
|
|
2139
2162
|
var transactionServiceUrl2 = "https://api.acta.link/transaction/v1/";
|
|
2163
|
+
var billingServiceUrl = "https://api.acta.link/billing/v1/";
|
|
2164
|
+
var transactionServiceTestUrl2 = "https://api.acta.link/transaction/test/v1/";
|
|
2165
|
+
var returnEnvUrl2 = (chainId) => {
|
|
2166
|
+
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
2167
|
+
const testnetChain = testnetChains.find((c) => c.id === chainId);
|
|
2168
|
+
if (!mainnetChain && !testnetChain) {
|
|
2169
|
+
throw new Error(`Chain ${chainId} not supported.`);
|
|
2170
|
+
}
|
|
2171
|
+
if (mainnetChain) {
|
|
2172
|
+
return {
|
|
2173
|
+
envTransactionServiceUrl: transactionServiceUrl2,
|
|
2174
|
+
envBillingServiceUrl: billingServiceUrl
|
|
2175
|
+
};
|
|
2176
|
+
} else {
|
|
2177
|
+
return {
|
|
2178
|
+
envTransactionServiceUrl: transactionServiceTestUrl2,
|
|
2179
|
+
envBillingServiceUrl: billingServiceUrl
|
|
2180
|
+
};
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2140
2183
|
var ActaBilling = class {
|
|
2141
2184
|
constructor(parameters) {
|
|
2142
2185
|
this.feeInclusive = true;
|
|
@@ -2223,6 +2266,7 @@ var ActaBilling = class {
|
|
|
2223
2266
|
if (!token2) {
|
|
2224
2267
|
throw new Error("Token not supported.");
|
|
2225
2268
|
}
|
|
2269
|
+
const { envTransactionServiceUrl } = returnEnvUrl2(chainId);
|
|
2226
2270
|
const rpcParameters = yield this.account.signSinglePaymentOperation({
|
|
2227
2271
|
signerAddress,
|
|
2228
2272
|
chainId,
|
|
@@ -2234,7 +2278,7 @@ var ActaBilling = class {
|
|
|
2234
2278
|
feebps: 20
|
|
2235
2279
|
});
|
|
2236
2280
|
const txn = yield executeSinglePaymentAPICall(
|
|
2237
|
-
`${
|
|
2281
|
+
`${envTransactionServiceUrl}execute/single`,
|
|
2238
2282
|
rpcParameters,
|
|
2239
2283
|
{
|
|
2240
2284
|
senderAddress: signerAddress,
|
|
@@ -2285,6 +2329,7 @@ var ActaBilling = class {
|
|
|
2285
2329
|
if (!chainId || !count || !intervalUnit || !startDate || !endDate) {
|
|
2286
2330
|
throw new Error("Invalid parameters.");
|
|
2287
2331
|
}
|
|
2332
|
+
const { envTransactionServiceUrl } = returnEnvUrl2(chainId);
|
|
2288
2333
|
const { approval, amountExclusive } = yield this.account.signRecurringPayments({
|
|
2289
2334
|
signerAddress,
|
|
2290
2335
|
chainId,
|
|
@@ -2300,7 +2345,7 @@ var ActaBilling = class {
|
|
|
2300
2345
|
feebps: 20
|
|
2301
2346
|
});
|
|
2302
2347
|
const txn = yield scheduleRecurringPaymentsAPICall(
|
|
2303
|
-
`${
|
|
2348
|
+
`${envTransactionServiceUrl}schedule/recurring`,
|
|
2304
2349
|
{
|
|
2305
2350
|
amount,
|
|
2306
2351
|
amountExclusive,
|
|
@@ -2360,9 +2405,9 @@ var ActaBilling = class {
|
|
|
2360
2405
|
var import_viem7 = require("viem");
|
|
2361
2406
|
var transactionServiceUrl3 = "https://api.acta.link/transaction/v1/";
|
|
2362
2407
|
var batchServiceUrl = "https://api.acta.link/batch/api/v1/";
|
|
2363
|
-
var
|
|
2408
|
+
var transactionServiceTestUrl3 = "https://api.acta.link/transaction/test/v1/";
|
|
2364
2409
|
var batchServiceTestUrl = "https://api.acta.link/batch/test/api/v1/";
|
|
2365
|
-
var
|
|
2410
|
+
var returnEnvUrl3 = (chainId) => {
|
|
2366
2411
|
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
2367
2412
|
const testnetChain = testnetChains.find((c) => c.id === chainId);
|
|
2368
2413
|
if (!mainnetChain && !testnetChain) {
|
|
@@ -2375,19 +2420,23 @@ var returnEnvUrl = (chainId) => {
|
|
|
2375
2420
|
};
|
|
2376
2421
|
} else {
|
|
2377
2422
|
return {
|
|
2378
|
-
envTransactionServiceUrl:
|
|
2423
|
+
envTransactionServiceUrl: transactionServiceTestUrl3,
|
|
2379
2424
|
envBatchServiceUrl: batchServiceTestUrl
|
|
2380
2425
|
};
|
|
2381
2426
|
}
|
|
2382
2427
|
};
|
|
2383
2428
|
var ActaBatch = class {
|
|
2384
2429
|
constructor(parameters) {
|
|
2385
|
-
|
|
2430
|
+
var _a;
|
|
2431
|
+
this.APIkey = (_a = parameters.APIKey) != null ? _a : void 0;
|
|
2386
2432
|
}
|
|
2387
2433
|
createSession(params) {
|
|
2388
2434
|
return __async(this, null, function* () {
|
|
2389
2435
|
try {
|
|
2390
2436
|
const { instructionId, name, signerAddress, token: token2, chainId } = params;
|
|
2437
|
+
if (!this.APIkey) {
|
|
2438
|
+
throw new Error("No API key provided.");
|
|
2439
|
+
}
|
|
2391
2440
|
if (!signerAddress || signerAddress === import_viem7.zeroAddress) {
|
|
2392
2441
|
throw new Error("Signer address is required.");
|
|
2393
2442
|
}
|
|
@@ -2400,7 +2449,7 @@ var ActaBatch = class {
|
|
|
2400
2449
|
if (!instructionId || instructionId === "") {
|
|
2401
2450
|
throw new Error("Instruction id is required");
|
|
2402
2451
|
}
|
|
2403
|
-
const { envBatchServiceUrl } =
|
|
2452
|
+
const { envBatchServiceUrl } = returnEnvUrl3(chainId);
|
|
2404
2453
|
const session = yield createBatchSessionAPICall(
|
|
2405
2454
|
`${envBatchServiceUrl}create/session`,
|
|
2406
2455
|
this.APIkey,
|
|
@@ -2434,11 +2483,14 @@ var ActaBatch = class {
|
|
|
2434
2483
|
walletClient,
|
|
2435
2484
|
instructionId
|
|
2436
2485
|
} = parameters;
|
|
2486
|
+
if (!this.APIkey) {
|
|
2487
|
+
throw new Error("No API key provided.");
|
|
2488
|
+
}
|
|
2437
2489
|
let isFeeInclusive = false;
|
|
2438
2490
|
if (feeInclusive) {
|
|
2439
2491
|
isFeeInclusive = true;
|
|
2440
2492
|
}
|
|
2441
|
-
const { envBatchServiceUrl } =
|
|
2493
|
+
const { envBatchServiceUrl } = returnEnvUrl3(chainId);
|
|
2442
2494
|
const instuctionData = yield fetchBatchInstructionDetails(
|
|
2443
2495
|
`${envBatchServiceUrl}instruction/${instructionId}`,
|
|
2444
2496
|
this.APIkey
|
|
@@ -2517,11 +2569,14 @@ var ActaBatch = class {
|
|
|
2517
2569
|
allowMaxTokenApproval,
|
|
2518
2570
|
instructionId
|
|
2519
2571
|
} = params;
|
|
2572
|
+
if (!this.APIkey) {
|
|
2573
|
+
throw new Error("No API key provided.");
|
|
2574
|
+
}
|
|
2520
2575
|
let isFeeInclusive = false;
|
|
2521
2576
|
if (feeInclusive) {
|
|
2522
2577
|
isFeeInclusive = true;
|
|
2523
2578
|
}
|
|
2524
|
-
const { envBatchServiceUrl } =
|
|
2579
|
+
const { envBatchServiceUrl } = returnEnvUrl3(chainId);
|
|
2525
2580
|
const instuctionData = yield fetchBatchInstructionDetails(
|
|
2526
2581
|
`${envBatchServiceUrl}instruction/${instructionId}`,
|
|
2527
2582
|
this.APIkey
|
|
@@ -2603,11 +2658,14 @@ var ActaBatch = class {
|
|
|
2603
2658
|
instructionId,
|
|
2604
2659
|
executionTime
|
|
2605
2660
|
} = params;
|
|
2661
|
+
if (!this.APIkey) {
|
|
2662
|
+
throw new Error("No API key provided.");
|
|
2663
|
+
}
|
|
2606
2664
|
let isFeeInclusive = false;
|
|
2607
2665
|
if (feeInclusive) {
|
|
2608
2666
|
isFeeInclusive = true;
|
|
2609
2667
|
}
|
|
2610
|
-
const { envBatchServiceUrl } =
|
|
2668
|
+
const { envBatchServiceUrl } = returnEnvUrl3(chainId);
|
|
2611
2669
|
if (executionTime <= Date.now() + 1e3 * 60 * 2) {
|
|
2612
2670
|
throw new Error(
|
|
2613
2671
|
"Execution time must be more than 5 mins from current time."
|
|
@@ -2819,7 +2877,7 @@ var import_account_abstraction2 = require("viem/account-abstraction");
|
|
|
2819
2877
|
var import_policies2 = require("@zerodev/permissions/policies");
|
|
2820
2878
|
var import_semver = require("semver");
|
|
2821
2879
|
var ECDSA_SIGNER_CONTRACT = "0x6A6F069E2a08c2468e7724Ab3250CdBFBA14D4FF";
|
|
2822
|
-
var
|
|
2880
|
+
var billingServiceUrl2 = "https://api.acta.link/billing/v1/";
|
|
2823
2881
|
var depositServiceUrl2 = "https://api.acta.link/deposit/v1/";
|
|
2824
2882
|
var transactionServiceUrl4 = "https://api.acta.link/transaction/v1/";
|
|
2825
2883
|
var toSignerId = (signer) => {
|
|
@@ -3161,7 +3219,7 @@ var createBillingCheckoutSession = (serviceSessionparams) => __async(null, null,
|
|
|
3161
3219
|
var _a, _b, _c, _d;
|
|
3162
3220
|
try {
|
|
3163
3221
|
const sessionData = yield createBillingSessionAPICall(
|
|
3164
|
-
`${
|
|
3222
|
+
`${billingServiceUrl2}paysession/create`,
|
|
3165
3223
|
{
|
|
3166
3224
|
paylinkId: serviceSessionparams.paylinkId,
|
|
3167
3225
|
mode: serviceSessionparams.mode,
|
|
@@ -3186,7 +3244,7 @@ var getBillingPaymentSessionDetails = (serviceSessionparams) => __async(null, nu
|
|
|
3186
3244
|
throw new Error("checkout session ID is required.");
|
|
3187
3245
|
}
|
|
3188
3246
|
const sessionData = yield fetchBillingSessionDetails(
|
|
3189
|
-
`${
|
|
3247
|
+
`${billingServiceUrl2}paysession?checkoutSessionId=${serviceSessionparams.checkoutSessionId}`
|
|
3190
3248
|
);
|
|
3191
3249
|
return sessionData;
|
|
3192
3250
|
});
|
|
@@ -3199,7 +3257,7 @@ var cancelRecurringTransaction = (_0) => __async(null, [_0], function* ({
|
|
|
3199
3257
|
if (serviceType !== "billing" && serviceType !== "deposit")
|
|
3200
3258
|
throw new Error("service is not compatible");
|
|
3201
3259
|
const response = yield fetchRecurringTransactionWithId(
|
|
3202
|
-
`${serviceType === "billing" ?
|
|
3260
|
+
`${serviceType === "billing" ? billingServiceUrl2 : depositServiceUrl2}customer/payment/recurring/info?id=${paymentId}`
|
|
3203
3261
|
);
|
|
3204
3262
|
if (response) {
|
|
3205
3263
|
const viemClient = new ViemClient(chainId, walletClient);
|
package/dist/index.d.cts
CHANGED
|
@@ -67,7 +67,7 @@ interface BillingClassParams extends AbstractPaymentParams {
|
|
|
67
67
|
allowMaxTokenApproval?: boolean;
|
|
68
68
|
}
|
|
69
69
|
interface BatchClassParams {
|
|
70
|
-
APIKey
|
|
70
|
+
APIKey?: string;
|
|
71
71
|
}
|
|
72
72
|
type EstimateSinglePaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams"> & {
|
|
73
73
|
feebps: 20 | 10 | 15;
|
package/dist/index.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ interface BillingClassParams extends AbstractPaymentParams {
|
|
|
67
67
|
allowMaxTokenApproval?: boolean;
|
|
68
68
|
}
|
|
69
69
|
interface BatchClassParams {
|
|
70
|
-
APIKey
|
|
70
|
+
APIKey?: string;
|
|
71
71
|
}
|
|
72
72
|
type EstimateSinglePaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams"> & {
|
|
73
73
|
feebps: 20 | 10 | 15;
|
package/dist/index.js
CHANGED
|
@@ -1715,6 +1715,26 @@ function fetchBatchInstructionDetails(url, APIKey) {
|
|
|
1715
1715
|
// src/deposit.ts
|
|
1716
1716
|
var transactionServiceUrl = "https://api.acta.link/transaction/v1/";
|
|
1717
1717
|
var depositServiceUrl = "https://api.acta.link/deposit/v1/";
|
|
1718
|
+
var transactionServiceTestUrl = "https://api.acta.link/transaction/test/v1/";
|
|
1719
|
+
var depositServiceTestUrl = "https://api.acta.link/deposit/test/v1/";
|
|
1720
|
+
var returnEnvUrl = (chainId) => {
|
|
1721
|
+
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
1722
|
+
const testnetChain = testnetChains.find((c) => c.id === chainId);
|
|
1723
|
+
if (!mainnetChain && !testnetChain) {
|
|
1724
|
+
throw new Error(`Chain ${chainId} not supported.`);
|
|
1725
|
+
}
|
|
1726
|
+
if (mainnetChain) {
|
|
1727
|
+
return {
|
|
1728
|
+
envTransactionServiceUrl: transactionServiceUrl,
|
|
1729
|
+
envDepositServiceUrl: depositServiceUrl
|
|
1730
|
+
};
|
|
1731
|
+
} else {
|
|
1732
|
+
return {
|
|
1733
|
+
envTransactionServiceUrl: transactionServiceTestUrl,
|
|
1734
|
+
envDepositServiceUrl: depositServiceTestUrl
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1718
1738
|
var ActaDeposit = class {
|
|
1719
1739
|
constructor(parameters) {
|
|
1720
1740
|
this.feeInclusive = false;
|
|
@@ -1768,9 +1788,10 @@ var ActaDeposit = class {
|
|
|
1768
1788
|
if (this.paymentType === "recurring" && this.intervalUnit === void 0) {
|
|
1769
1789
|
throw new Error("Interval unit is required for recurring payments.");
|
|
1770
1790
|
}
|
|
1791
|
+
const { envDepositServiceUrl } = returnEnvUrl(this.chainId);
|
|
1771
1792
|
if (this.depositSessionId !== "") {
|
|
1772
1793
|
const session2 = yield verifySessionAPICall(
|
|
1773
|
-
`${
|
|
1794
|
+
`${envDepositServiceUrl}verify-session?sessionId=${this.depositSessionId}`,
|
|
1774
1795
|
this.depositSessionId
|
|
1775
1796
|
);
|
|
1776
1797
|
this.depositSessionId = session2.sessionId;
|
|
@@ -1781,7 +1802,7 @@ var ActaDeposit = class {
|
|
|
1781
1802
|
throw new Error("Token not supported.");
|
|
1782
1803
|
}
|
|
1783
1804
|
const session = yield createSessionAPICall(
|
|
1784
|
-
`${
|
|
1805
|
+
`${envDepositServiceUrl}session`,
|
|
1785
1806
|
{
|
|
1786
1807
|
paymentParams: {
|
|
1787
1808
|
signerAddress: this.signerAddress,
|
|
@@ -1900,6 +1921,7 @@ var ActaDeposit = class {
|
|
|
1900
1921
|
if (!token2) {
|
|
1901
1922
|
throw new Error("Token not supported.");
|
|
1902
1923
|
}
|
|
1924
|
+
const { envTransactionServiceUrl } = returnEnvUrl(chainId);
|
|
1903
1925
|
const rpcParameters = yield this.account.signSinglePaymentOperation({
|
|
1904
1926
|
signerAddress,
|
|
1905
1927
|
chainId,
|
|
@@ -1911,7 +1933,7 @@ var ActaDeposit = class {
|
|
|
1911
1933
|
feebps: 10
|
|
1912
1934
|
});
|
|
1913
1935
|
const txn = yield executeSinglePaymentAPICall(
|
|
1914
|
-
`${
|
|
1936
|
+
`${envTransactionServiceUrl}execute/single`,
|
|
1915
1937
|
rpcParameters,
|
|
1916
1938
|
{
|
|
1917
1939
|
senderAddress: signerAddress,
|
|
@@ -1990,6 +2012,7 @@ var ActaDeposit = class {
|
|
|
1990
2012
|
if (!chainId || !count || !intervalUnit || !startDate || !endDate) {
|
|
1991
2013
|
throw new Error("Invalid parameters.");
|
|
1992
2014
|
}
|
|
2015
|
+
const { envTransactionServiceUrl } = returnEnvUrl(chainId);
|
|
1993
2016
|
const { approval, amountExclusive } = yield this.account.signRecurringPayments({
|
|
1994
2017
|
signerAddress,
|
|
1995
2018
|
chainId,
|
|
@@ -2005,7 +2028,7 @@ var ActaDeposit = class {
|
|
|
2005
2028
|
feebps: 20
|
|
2006
2029
|
});
|
|
2007
2030
|
const txn = yield scheduleRecurringPaymentsAPICall(
|
|
2008
|
-
`${
|
|
2031
|
+
`${envTransactionServiceUrl}schedule/recurring`,
|
|
2009
2032
|
{
|
|
2010
2033
|
amount,
|
|
2011
2034
|
amountExclusive,
|
|
@@ -2064,6 +2087,26 @@ var ActaDeposit = class {
|
|
|
2064
2087
|
// src/billing.ts
|
|
2065
2088
|
import { toHex as toHex3 } from "viem";
|
|
2066
2089
|
var transactionServiceUrl2 = "https://api.acta.link/transaction/v1/";
|
|
2090
|
+
var billingServiceUrl = "https://api.acta.link/billing/v1/";
|
|
2091
|
+
var transactionServiceTestUrl2 = "https://api.acta.link/transaction/test/v1/";
|
|
2092
|
+
var returnEnvUrl2 = (chainId) => {
|
|
2093
|
+
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
2094
|
+
const testnetChain = testnetChains.find((c) => c.id === chainId);
|
|
2095
|
+
if (!mainnetChain && !testnetChain) {
|
|
2096
|
+
throw new Error(`Chain ${chainId} not supported.`);
|
|
2097
|
+
}
|
|
2098
|
+
if (mainnetChain) {
|
|
2099
|
+
return {
|
|
2100
|
+
envTransactionServiceUrl: transactionServiceUrl2,
|
|
2101
|
+
envBillingServiceUrl: billingServiceUrl
|
|
2102
|
+
};
|
|
2103
|
+
} else {
|
|
2104
|
+
return {
|
|
2105
|
+
envTransactionServiceUrl: transactionServiceTestUrl2,
|
|
2106
|
+
envBillingServiceUrl: billingServiceUrl
|
|
2107
|
+
};
|
|
2108
|
+
}
|
|
2109
|
+
};
|
|
2067
2110
|
var ActaBilling = class {
|
|
2068
2111
|
constructor(parameters) {
|
|
2069
2112
|
this.feeInclusive = true;
|
|
@@ -2150,6 +2193,7 @@ var ActaBilling = class {
|
|
|
2150
2193
|
if (!token2) {
|
|
2151
2194
|
throw new Error("Token not supported.");
|
|
2152
2195
|
}
|
|
2196
|
+
const { envTransactionServiceUrl } = returnEnvUrl2(chainId);
|
|
2153
2197
|
const rpcParameters = yield this.account.signSinglePaymentOperation({
|
|
2154
2198
|
signerAddress,
|
|
2155
2199
|
chainId,
|
|
@@ -2161,7 +2205,7 @@ var ActaBilling = class {
|
|
|
2161
2205
|
feebps: 20
|
|
2162
2206
|
});
|
|
2163
2207
|
const txn = yield executeSinglePaymentAPICall(
|
|
2164
|
-
`${
|
|
2208
|
+
`${envTransactionServiceUrl}execute/single`,
|
|
2165
2209
|
rpcParameters,
|
|
2166
2210
|
{
|
|
2167
2211
|
senderAddress: signerAddress,
|
|
@@ -2212,6 +2256,7 @@ var ActaBilling = class {
|
|
|
2212
2256
|
if (!chainId || !count || !intervalUnit || !startDate || !endDate) {
|
|
2213
2257
|
throw new Error("Invalid parameters.");
|
|
2214
2258
|
}
|
|
2259
|
+
const { envTransactionServiceUrl } = returnEnvUrl2(chainId);
|
|
2215
2260
|
const { approval, amountExclusive } = yield this.account.signRecurringPayments({
|
|
2216
2261
|
signerAddress,
|
|
2217
2262
|
chainId,
|
|
@@ -2227,7 +2272,7 @@ var ActaBilling = class {
|
|
|
2227
2272
|
feebps: 20
|
|
2228
2273
|
});
|
|
2229
2274
|
const txn = yield scheduleRecurringPaymentsAPICall(
|
|
2230
|
-
`${
|
|
2275
|
+
`${envTransactionServiceUrl}schedule/recurring`,
|
|
2231
2276
|
{
|
|
2232
2277
|
amount,
|
|
2233
2278
|
amountExclusive,
|
|
@@ -2292,9 +2337,9 @@ import {
|
|
|
2292
2337
|
} from "viem";
|
|
2293
2338
|
var transactionServiceUrl3 = "https://api.acta.link/transaction/v1/";
|
|
2294
2339
|
var batchServiceUrl = "https://api.acta.link/batch/api/v1/";
|
|
2295
|
-
var
|
|
2340
|
+
var transactionServiceTestUrl3 = "https://api.acta.link/transaction/test/v1/";
|
|
2296
2341
|
var batchServiceTestUrl = "https://api.acta.link/batch/test/api/v1/";
|
|
2297
|
-
var
|
|
2342
|
+
var returnEnvUrl3 = (chainId) => {
|
|
2298
2343
|
const mainnetChain = mainnetChains.find((c) => c.id === chainId);
|
|
2299
2344
|
const testnetChain = testnetChains.find((c) => c.id === chainId);
|
|
2300
2345
|
if (!mainnetChain && !testnetChain) {
|
|
@@ -2307,19 +2352,23 @@ var returnEnvUrl = (chainId) => {
|
|
|
2307
2352
|
};
|
|
2308
2353
|
} else {
|
|
2309
2354
|
return {
|
|
2310
|
-
envTransactionServiceUrl:
|
|
2355
|
+
envTransactionServiceUrl: transactionServiceTestUrl3,
|
|
2311
2356
|
envBatchServiceUrl: batchServiceTestUrl
|
|
2312
2357
|
};
|
|
2313
2358
|
}
|
|
2314
2359
|
};
|
|
2315
2360
|
var ActaBatch = class {
|
|
2316
2361
|
constructor(parameters) {
|
|
2317
|
-
|
|
2362
|
+
var _a;
|
|
2363
|
+
this.APIkey = (_a = parameters.APIKey) != null ? _a : void 0;
|
|
2318
2364
|
}
|
|
2319
2365
|
createSession(params) {
|
|
2320
2366
|
return __async(this, null, function* () {
|
|
2321
2367
|
try {
|
|
2322
2368
|
const { instructionId, name, signerAddress, token: token2, chainId } = params;
|
|
2369
|
+
if (!this.APIkey) {
|
|
2370
|
+
throw new Error("No API key provided.");
|
|
2371
|
+
}
|
|
2323
2372
|
if (!signerAddress || signerAddress === zeroAddress5) {
|
|
2324
2373
|
throw new Error("Signer address is required.");
|
|
2325
2374
|
}
|
|
@@ -2332,7 +2381,7 @@ var ActaBatch = class {
|
|
|
2332
2381
|
if (!instructionId || instructionId === "") {
|
|
2333
2382
|
throw new Error("Instruction id is required");
|
|
2334
2383
|
}
|
|
2335
|
-
const { envBatchServiceUrl } =
|
|
2384
|
+
const { envBatchServiceUrl } = returnEnvUrl3(chainId);
|
|
2336
2385
|
const session = yield createBatchSessionAPICall(
|
|
2337
2386
|
`${envBatchServiceUrl}create/session`,
|
|
2338
2387
|
this.APIkey,
|
|
@@ -2366,11 +2415,14 @@ var ActaBatch = class {
|
|
|
2366
2415
|
walletClient,
|
|
2367
2416
|
instructionId
|
|
2368
2417
|
} = parameters;
|
|
2418
|
+
if (!this.APIkey) {
|
|
2419
|
+
throw new Error("No API key provided.");
|
|
2420
|
+
}
|
|
2369
2421
|
let isFeeInclusive = false;
|
|
2370
2422
|
if (feeInclusive) {
|
|
2371
2423
|
isFeeInclusive = true;
|
|
2372
2424
|
}
|
|
2373
|
-
const { envBatchServiceUrl } =
|
|
2425
|
+
const { envBatchServiceUrl } = returnEnvUrl3(chainId);
|
|
2374
2426
|
const instuctionData = yield fetchBatchInstructionDetails(
|
|
2375
2427
|
`${envBatchServiceUrl}instruction/${instructionId}`,
|
|
2376
2428
|
this.APIkey
|
|
@@ -2449,11 +2501,14 @@ var ActaBatch = class {
|
|
|
2449
2501
|
allowMaxTokenApproval,
|
|
2450
2502
|
instructionId
|
|
2451
2503
|
} = params;
|
|
2504
|
+
if (!this.APIkey) {
|
|
2505
|
+
throw new Error("No API key provided.");
|
|
2506
|
+
}
|
|
2452
2507
|
let isFeeInclusive = false;
|
|
2453
2508
|
if (feeInclusive) {
|
|
2454
2509
|
isFeeInclusive = true;
|
|
2455
2510
|
}
|
|
2456
|
-
const { envBatchServiceUrl } =
|
|
2511
|
+
const { envBatchServiceUrl } = returnEnvUrl3(chainId);
|
|
2457
2512
|
const instuctionData = yield fetchBatchInstructionDetails(
|
|
2458
2513
|
`${envBatchServiceUrl}instruction/${instructionId}`,
|
|
2459
2514
|
this.APIkey
|
|
@@ -2535,11 +2590,14 @@ var ActaBatch = class {
|
|
|
2535
2590
|
instructionId,
|
|
2536
2591
|
executionTime
|
|
2537
2592
|
} = params;
|
|
2593
|
+
if (!this.APIkey) {
|
|
2594
|
+
throw new Error("No API key provided.");
|
|
2595
|
+
}
|
|
2538
2596
|
let isFeeInclusive = false;
|
|
2539
2597
|
if (feeInclusive) {
|
|
2540
2598
|
isFeeInclusive = true;
|
|
2541
2599
|
}
|
|
2542
|
-
const { envBatchServiceUrl } =
|
|
2600
|
+
const { envBatchServiceUrl } = returnEnvUrl3(chainId);
|
|
2543
2601
|
if (executionTime <= Date.now() + 1e3 * 60 * 2) {
|
|
2544
2602
|
throw new Error(
|
|
2545
2603
|
"Execution time must be more than 5 mins from current time."
|
|
@@ -2782,7 +2840,7 @@ import {
|
|
|
2782
2840
|
} from "@zerodev/permissions/policies";
|
|
2783
2841
|
import { coerce, gt } from "semver";
|
|
2784
2842
|
var ECDSA_SIGNER_CONTRACT = "0x6A6F069E2a08c2468e7724Ab3250CdBFBA14D4FF";
|
|
2785
|
-
var
|
|
2843
|
+
var billingServiceUrl2 = "https://api.acta.link/billing/v1/";
|
|
2786
2844
|
var depositServiceUrl2 = "https://api.acta.link/deposit/v1/";
|
|
2787
2845
|
var transactionServiceUrl4 = "https://api.acta.link/transaction/v1/";
|
|
2788
2846
|
var toSignerId = (signer) => {
|
|
@@ -3124,7 +3182,7 @@ var createBillingCheckoutSession = (serviceSessionparams) => __async(null, null,
|
|
|
3124
3182
|
var _a, _b, _c, _d;
|
|
3125
3183
|
try {
|
|
3126
3184
|
const sessionData = yield createBillingSessionAPICall(
|
|
3127
|
-
`${
|
|
3185
|
+
`${billingServiceUrl2}paysession/create`,
|
|
3128
3186
|
{
|
|
3129
3187
|
paylinkId: serviceSessionparams.paylinkId,
|
|
3130
3188
|
mode: serviceSessionparams.mode,
|
|
@@ -3149,7 +3207,7 @@ var getBillingPaymentSessionDetails = (serviceSessionparams) => __async(null, nu
|
|
|
3149
3207
|
throw new Error("checkout session ID is required.");
|
|
3150
3208
|
}
|
|
3151
3209
|
const sessionData = yield fetchBillingSessionDetails(
|
|
3152
|
-
`${
|
|
3210
|
+
`${billingServiceUrl2}paysession?checkoutSessionId=${serviceSessionparams.checkoutSessionId}`
|
|
3153
3211
|
);
|
|
3154
3212
|
return sessionData;
|
|
3155
3213
|
});
|
|
@@ -3162,7 +3220,7 @@ var cancelRecurringTransaction = (_0) => __async(null, [_0], function* ({
|
|
|
3162
3220
|
if (serviceType !== "billing" && serviceType !== "deposit")
|
|
3163
3221
|
throw new Error("service is not compatible");
|
|
3164
3222
|
const response = yield fetchRecurringTransactionWithId(
|
|
3165
|
-
`${serviceType === "billing" ?
|
|
3223
|
+
`${serviceType === "billing" ? billingServiceUrl2 : depositServiceUrl2}customer/payment/recurring/info?id=${paymentId}`
|
|
3166
3224
|
);
|
|
3167
3225
|
if (response) {
|
|
3168
3226
|
const viemClient = new ViemClient(chainId, walletClient);
|