@actalink/commonlib 0.0.40 → 0.0.41

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 CHANGED
@@ -60,7 +60,8 @@ __export(index_exports, {
60
60
  ActaAccount: () => ActaAccount,
61
61
  ActaBatch: () => ActaBatch,
62
62
  ActaBilling: () => ActaBilling,
63
- ActaDeposit: () => ActaDeposit,
63
+ ActaFlexBatch: () => ActaFlexBatch,
64
+ ActaFlexDeposit: () => ActaFlexDeposit,
64
65
  ConnectorType: () => ConnectorType,
65
66
  HttpMethod: () => HttpMethod,
66
67
  PolicyFlags: () => PolicyFlags,
@@ -669,7 +670,7 @@ function getTokenByChainIdAndAddress(chainId, address) {
669
670
  return token2;
670
671
  }
671
672
 
672
- // src/deposit.ts
673
+ // src/flexdeposit.ts
673
674
  var import_viem5 = require("viem");
674
675
 
675
676
  // src/account.ts
@@ -1845,11 +1846,11 @@ function fetchBatchInstructionDetails(url, APIKey) {
1845
1846
  });
1846
1847
  }
1847
1848
 
1848
- // src/deposit.ts
1849
- var transactionServiceUrl = "https://api.acta.link/bexo/transaction/v1/";
1850
- var depositServiceUrl = "https://api.acta.link/bexo/v1/";
1851
- var transactionServiceTestUrl = "https://api.acta.link/bexo/transaction/test/v1/";
1852
- var depositServiceTestUrl = "https://api.acta.link/bexo/test/v1/";
1849
+ // src/flexdeposit.ts
1850
+ var transactionServiceUrl = "https://flex-api.acta.link/flex/deposit/transaction/v1/";
1851
+ var depositServiceUrl = "https://flex-api.acta.link/flex/deposit/v1/";
1852
+ var transactionServiceTestUrl = "https://flex-api.acta.link/flex/deposit/transaction/test/v1/";
1853
+ var depositServiceTestUrl = "https://flex-api.acta.link/flex/deposit/test/v1/";
1853
1854
  var returnEnvUrl = (chainId) => {
1854
1855
  const mainnetChain = mainnetChains.find((c) => c.id === chainId);
1855
1856
  const testnetChain = testnetChains.find((c) => c.id === chainId);
@@ -1868,7 +1869,7 @@ var returnEnvUrl = (chainId) => {
1868
1869
  };
1869
1870
  }
1870
1871
  };
1871
- var ActaDeposit = class {
1872
+ var ActaFlexDeposit = class {
1872
1873
  constructor(parameters) {
1873
1874
  this.feeInclusive = false;
1874
1875
  this.count = 0;
@@ -2217,11 +2218,471 @@ var ActaDeposit = class {
2217
2218
  }
2218
2219
  };
2219
2220
 
2220
- // src/billing.ts
2221
+ // src/flexbatch.ts
2221
2222
  var import_viem6 = require("viem");
2223
+ var batchServiceUrl = "https://flex-api.acta.link/flex/batch/api/v1/";
2224
+ var batchServiceTestUrl = "https://flex-api.acta.link/flex/batch/test/api/v1/";
2225
+ var returnEnvUrl2 = (chainId) => {
2226
+ const mainnetChain = mainnetChains.find((c) => c.id === chainId);
2227
+ const testnetChain = testnetChains.find((c) => c.id === chainId);
2228
+ if (!mainnetChain && !testnetChain) {
2229
+ throw new Error(`Chain ${chainId} not supported.`);
2230
+ }
2231
+ if (mainnetChain) {
2232
+ return {
2233
+ envBatchServiceUrl: batchServiceUrl
2234
+ };
2235
+ } else {
2236
+ return {
2237
+ envBatchServiceUrl: batchServiceTestUrl
2238
+ };
2239
+ }
2240
+ };
2241
+ var ActaFlexBatch = class {
2242
+ constructor(parameters) {
2243
+ var _a;
2244
+ this.APIkey = (_a = parameters.APIKey) != null ? _a : void 0;
2245
+ }
2246
+ createSession(params) {
2247
+ return __async(this, null, function* () {
2248
+ try {
2249
+ const { instructionId, name, signerAddress, token: token2, chainId } = params;
2250
+ if (!this.APIkey) {
2251
+ throw new Error("No API key provided.");
2252
+ }
2253
+ if (!signerAddress || signerAddress === import_viem6.zeroAddress) {
2254
+ throw new Error("Signer address is required.");
2255
+ }
2256
+ if (!name || name === "") {
2257
+ throw new Error("Name of Batch payment is required");
2258
+ }
2259
+ if (!token2) {
2260
+ throw new Error("Token symbol is required");
2261
+ }
2262
+ if (!instructionId || instructionId === "") {
2263
+ throw new Error("Instruction id is required");
2264
+ }
2265
+ const { envBatchServiceUrl } = returnEnvUrl2(chainId);
2266
+ const session = yield createBatchSessionAPICall(
2267
+ `${envBatchServiceUrl}create/session`,
2268
+ this.APIkey,
2269
+ {
2270
+ name,
2271
+ chainId,
2272
+ instructionId,
2273
+ signerAddress,
2274
+ token: token2
2275
+ }
2276
+ );
2277
+ console.log(session);
2278
+ const sessionId = session.id;
2279
+ return sessionId;
2280
+ } catch (error) {
2281
+ if (error instanceof Error) {
2282
+ throw new Error(error.message);
2283
+ }
2284
+ throw new Error("Failed to create session.");
2285
+ }
2286
+ });
2287
+ }
2288
+ estimateSinglePaymentGas(parameters) {
2289
+ return __async(this, null, function* () {
2290
+ try {
2291
+ const {
2292
+ chainId,
2293
+ feeInclusive,
2294
+ signerAddress,
2295
+ token: token2,
2296
+ walletClient,
2297
+ instructionId
2298
+ } = parameters;
2299
+ if (!this.APIkey) {
2300
+ throw new Error("No API key provided.");
2301
+ }
2302
+ let isFeeInclusive = false;
2303
+ if (feeInclusive) {
2304
+ isFeeInclusive = true;
2305
+ }
2306
+ const { envBatchServiceUrl } = returnEnvUrl2(chainId);
2307
+ const instuctionData = yield fetchBatchInstructionDetails(
2308
+ `${envBatchServiceUrl}instruction/${instructionId}`,
2309
+ this.APIkey
2310
+ );
2311
+ if (instuctionData.receivers.length === 0 || instuctionData.receivers.length === void 0) {
2312
+ throw new Error("Instruction not found");
2313
+ }
2314
+ const tokenData = getTokenByChainIdAndSymbol(chainId, token2);
2315
+ if (!tokenData) {
2316
+ throw new Error("Token not supported");
2317
+ }
2318
+ const totalAmount = instuctionData.totalAmount;
2319
+ const totalAmountParsed = BigInt(
2320
+ (0, import_viem6.parseUnits)(totalAmount, tokenData.decimals)
2321
+ );
2322
+ const receivers = instuctionData.receivers.map(
2323
+ (i) => {
2324
+ const receiver = (0, import_viem6.getAddress)(i.address);
2325
+ const tokenAmount = BigInt((0, import_viem6.parseUnits)(i.amount, tokenData.decimals));
2326
+ return {
2327
+ address: receiver,
2328
+ amount: tokenAmount
2329
+ };
2330
+ }
2331
+ );
2332
+ const viemClient = new ViemClient(chainId, walletClient);
2333
+ const account = new ActaAccount(
2334
+ chainId,
2335
+ viemClient.publicClient(),
2336
+ walletClient
2337
+ );
2338
+ const {
2339
+ estimatedGasCostInToken,
2340
+ ActalinkFeesInToken,
2341
+ feeInclusiveAmountInToken,
2342
+ feeExclusiveAmountInToken,
2343
+ estimatedTotalFeesInToken,
2344
+ paymaster,
2345
+ userOperation
2346
+ } = yield account.estimateSingleBatchPaymentGas({
2347
+ chainId,
2348
+ feeInclusive: isFeeInclusive,
2349
+ signerAddress,
2350
+ token: token2,
2351
+ walletClient,
2352
+ receivers,
2353
+ totalAmount: totalAmountParsed,
2354
+ feebps: 20
2355
+ });
2356
+ return {
2357
+ estimatedGasCostInToken,
2358
+ ActalinkFeesInToken,
2359
+ feeInclusiveAmountInToken,
2360
+ feeExclusiveAmountInToken,
2361
+ estimatedTotalFeesInToken,
2362
+ paymaster,
2363
+ userOperation
2364
+ };
2365
+ } catch (error) {
2366
+ if (error instanceof Error) {
2367
+ throw new Error(error.message);
2368
+ }
2369
+ throw new Error("Failed to estimate single payment gas.");
2370
+ }
2371
+ });
2372
+ }
2373
+ createSingleBatchPayment(params, serviceParams) {
2374
+ return __async(this, null, function* () {
2375
+ try {
2376
+ const {
2377
+ chainId,
2378
+ feeInclusive,
2379
+ signerAddress,
2380
+ token: tokenSymbol,
2381
+ walletClient,
2382
+ allowMaxTokenApproval,
2383
+ instructionId
2384
+ } = params;
2385
+ if (!this.APIkey) {
2386
+ throw new Error("No API key provided.");
2387
+ }
2388
+ let isFeeInclusive = false;
2389
+ if (feeInclusive) {
2390
+ isFeeInclusive = true;
2391
+ }
2392
+ const { envBatchServiceUrl } = returnEnvUrl2(chainId);
2393
+ const instuctionData = yield fetchBatchInstructionDetails(
2394
+ `${envBatchServiceUrl}instruction/${instructionId}`,
2395
+ this.APIkey
2396
+ );
2397
+ if (instuctionData.receivers.length === 0 || instuctionData.receivers.length === void 0) {
2398
+ throw new Error("Instruction not found");
2399
+ }
2400
+ console.log(instuctionData);
2401
+ const tokenData = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
2402
+ if (!tokenData) {
2403
+ throw new Error("Token not supported");
2404
+ }
2405
+ const totalAmount = instuctionData.totalAmount;
2406
+ const totalAmountParsed = BigInt(
2407
+ (0, import_viem6.parseUnits)(totalAmount, tokenData.decimals)
2408
+ );
2409
+ const receivers = instuctionData.receivers.map(
2410
+ (i) => {
2411
+ const receiver = (0, import_viem6.getAddress)(i.address);
2412
+ const tokenAmount = BigInt((0, import_viem6.parseUnits)(i.amount, tokenData.decimals));
2413
+ return {
2414
+ address: receiver,
2415
+ amount: tokenAmount
2416
+ };
2417
+ }
2418
+ );
2419
+ const viemClient = new ViemClient(chainId, walletClient);
2420
+ const account = new ActaAccount(
2421
+ chainId,
2422
+ viemClient.publicClient(),
2423
+ walletClient
2424
+ );
2425
+ console.log("signing");
2426
+ const rpcParameters = yield account.signSingleBatchOperation({
2427
+ signerAddress,
2428
+ chainId,
2429
+ token: tokenSymbol,
2430
+ feeInclusive: isFeeInclusive,
2431
+ receivers,
2432
+ totalAmount: totalAmountParsed,
2433
+ walletClient,
2434
+ allowMaxTokenApproval,
2435
+ feebps: 20
2436
+ });
2437
+ const txn = yield executeSingleBatchPaymentAPICall(
2438
+ `${envBatchServiceUrl}execute/single/batch`,
2439
+ this.APIkey,
2440
+ rpcParameters,
2441
+ {
2442
+ senderAddress: signerAddress,
2443
+ chainId,
2444
+ tokenAddress: tokenData.address,
2445
+ amount: (0, import_viem6.toHex)(totalAmountParsed),
2446
+ feeInclusive: isFeeInclusive,
2447
+ serviceType: "batch"
2448
+ },
2449
+ serviceParams
2450
+ );
2451
+ return txn;
2452
+ } catch (error) {
2453
+ if (error instanceof Error) {
2454
+ throw new Error(error.message);
2455
+ }
2456
+ throw new Error("Failed to create payment.");
2457
+ }
2458
+ });
2459
+ }
2460
+ createScheduleBatchPayment(params, serviceParams) {
2461
+ return __async(this, null, function* () {
2462
+ try {
2463
+ const {
2464
+ chainId,
2465
+ feeInclusive,
2466
+ signerAddress,
2467
+ token: tokenSymbol,
2468
+ walletClient,
2469
+ allowMaxTokenApproval,
2470
+ instructionId,
2471
+ executionTime
2472
+ } = params;
2473
+ if (!this.APIkey) {
2474
+ throw new Error("No API key provided.");
2475
+ }
2476
+ let isFeeInclusive = false;
2477
+ if (feeInclusive) {
2478
+ isFeeInclusive = true;
2479
+ }
2480
+ const { envBatchServiceUrl } = returnEnvUrl2(chainId);
2481
+ if (executionTime <= Date.now() + 1e3 * 60 * 2) {
2482
+ throw new Error(
2483
+ "Execution time must be more than 5 mins from current time."
2484
+ );
2485
+ }
2486
+ const instuctionData = yield fetchBatchInstructionDetails(
2487
+ `${envBatchServiceUrl}instruction/${instructionId}`,
2488
+ this.APIkey
2489
+ );
2490
+ if (instuctionData.receivers.length === 0 || instuctionData.receivers.length === void 0) {
2491
+ throw new Error("Instruction not found");
2492
+ }
2493
+ console.log(instuctionData);
2494
+ const tokenData = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
2495
+ if (!tokenData) {
2496
+ throw new Error("Token not supported");
2497
+ }
2498
+ const totalAmount = instuctionData.totalAmount;
2499
+ const totalAmountParsed = BigInt(
2500
+ (0, import_viem6.parseUnits)(totalAmount, tokenData.decimals)
2501
+ );
2502
+ const receivers = instuctionData.receivers.map(
2503
+ (i) => {
2504
+ const receiver = (0, import_viem6.getAddress)(i.address);
2505
+ const tokenAmount = BigInt((0, import_viem6.parseUnits)(i.amount, tokenData.decimals));
2506
+ return {
2507
+ address: receiver,
2508
+ amount: tokenAmount
2509
+ };
2510
+ }
2511
+ );
2512
+ const viemClient = new ViemClient(chainId, walletClient);
2513
+ const account = new ActaAccount(
2514
+ chainId,
2515
+ viemClient.publicClient(),
2516
+ walletClient
2517
+ );
2518
+ console.log("signing");
2519
+ const { amountExclusive, approval } = yield account.signRecurringOrScheduleBatchPayments({
2520
+ signerAddress,
2521
+ chainId,
2522
+ token: tokenSymbol,
2523
+ feeInclusive: isFeeInclusive,
2524
+ receivers,
2525
+ totalAmount: totalAmountParsed,
2526
+ walletClient,
2527
+ allowMaxTokenApproval,
2528
+ count: 1,
2529
+ feebps: 20
2530
+ });
2531
+ const txn = yield executeScheduleBatchPaymentAPICall(
2532
+ `${envBatchServiceUrl}execute/schedule/batch`,
2533
+ this.APIkey,
2534
+ {
2535
+ senderAddress: signerAddress,
2536
+ chainId,
2537
+ tokenAddress: tokenData.address,
2538
+ amount: (0, import_viem6.toHex)(totalAmountParsed),
2539
+ feeInclusive: isFeeInclusive,
2540
+ serviceType: "batch",
2541
+ amountExclusive: (0, import_viem6.toHex)(amountExclusive),
2542
+ approval,
2543
+ executionAt: executionTime
2544
+ },
2545
+ {
2546
+ sessionId: serviceParams.sessionId
2547
+ }
2548
+ );
2549
+ console.log(txn);
2550
+ return txn.transaction.id;
2551
+ } catch (error) {
2552
+ console.log(error);
2553
+ if (error instanceof Error) {
2554
+ throw new Error(error.message);
2555
+ }
2556
+ throw new Error("Failed to create payment.");
2557
+ }
2558
+ });
2559
+ }
2560
+ createSingleBatchPaymentWithoutKey(params, serviceParams) {
2561
+ return __async(this, null, function* () {
2562
+ try {
2563
+ const {
2564
+ chainId,
2565
+ feeInclusive,
2566
+ signerAddress,
2567
+ token: tokenSymbol,
2568
+ walletClient,
2569
+ allowMaxTokenApproval,
2570
+ receivers,
2571
+ totalAmount
2572
+ } = params;
2573
+ let isFeeInclusive = false;
2574
+ if (feeInclusive) {
2575
+ isFeeInclusive = true;
2576
+ }
2577
+ const tokenData = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
2578
+ if (!tokenData) {
2579
+ throw new Error("Token not supported");
2580
+ }
2581
+ const viemClient = new ViemClient(chainId, walletClient);
2582
+ const account = new ActaAccount(
2583
+ chainId,
2584
+ viemClient.publicClient(),
2585
+ walletClient
2586
+ );
2587
+ console.log("signing");
2588
+ const rpcParameters = yield account.signSingleBatchOperation({
2589
+ signerAddress,
2590
+ chainId,
2591
+ token: tokenSymbol,
2592
+ feeInclusive: isFeeInclusive,
2593
+ receivers,
2594
+ totalAmount,
2595
+ walletClient,
2596
+ allowMaxTokenApproval,
2597
+ feebps: 20
2598
+ });
2599
+ return {
2600
+ senderAddress: signerAddress,
2601
+ chainId,
2602
+ tokenAddress: tokenData.address,
2603
+ amount: (0, import_viem6.toHex)(totalAmount),
2604
+ feeInclusive: isFeeInclusive,
2605
+ serviceType: "batch",
2606
+ sessionId: serviceParams.sessionId,
2607
+ rpcParameters
2608
+ };
2609
+ } catch (error) {
2610
+ if (error instanceof Error) {
2611
+ throw new Error(error.message);
2612
+ }
2613
+ throw new Error("Failed to create payment.");
2614
+ }
2615
+ });
2616
+ }
2617
+ createScheduleBatchPaymentWithoutKey(params, serviceParams) {
2618
+ return __async(this, null, function* () {
2619
+ try {
2620
+ const {
2621
+ chainId,
2622
+ feeInclusive,
2623
+ signerAddress,
2624
+ token: tokenSymbol,
2625
+ walletClient,
2626
+ allowMaxTokenApproval,
2627
+ executionTime,
2628
+ receivers,
2629
+ totalAmount
2630
+ } = params;
2631
+ let isFeeInclusive = false;
2632
+ if (feeInclusive) {
2633
+ isFeeInclusive = true;
2634
+ }
2635
+ const tokenData = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
2636
+ if (!tokenData) {
2637
+ throw new Error("Token not supported");
2638
+ }
2639
+ const viemClient = new ViemClient(chainId, walletClient);
2640
+ const account = new ActaAccount(
2641
+ chainId,
2642
+ viemClient.publicClient(),
2643
+ walletClient
2644
+ );
2645
+ console.log("signing");
2646
+ const { amountExclusive, approval } = yield account.signRecurringOrScheduleBatchPayments({
2647
+ signerAddress,
2648
+ chainId,
2649
+ token: tokenSymbol,
2650
+ feeInclusive: isFeeInclusive,
2651
+ receivers,
2652
+ totalAmount,
2653
+ walletClient,
2654
+ allowMaxTokenApproval,
2655
+ count: 1,
2656
+ feebps: 20
2657
+ });
2658
+ return {
2659
+ senderAddress: signerAddress,
2660
+ chainId,
2661
+ tokenAddress: tokenData.address,
2662
+ amount: (0, import_viem6.toHex)(totalAmount),
2663
+ feeInclusive: isFeeInclusive,
2664
+ serviceType: "batch",
2665
+ amountExclusive: (0, import_viem6.toHex)(amountExclusive),
2666
+ approval,
2667
+ executionAt: executionTime,
2668
+ sessionId: serviceParams.sessionId
2669
+ };
2670
+ } catch (error) {
2671
+ console.log(error);
2672
+ if (error instanceof Error) {
2673
+ throw new Error(error.message);
2674
+ }
2675
+ throw new Error("Failed to create payment.");
2676
+ }
2677
+ });
2678
+ }
2679
+ };
2680
+
2681
+ // src/billing.ts
2682
+ var import_viem7 = require("viem");
2222
2683
  var billingServiceUrl = "https://api.acta.link/pay/api/v1/";
2223
2684
  var billingServiceTestUrl = "https://api.acta.link/pay/test/api/v1/";
2224
- var returnEnvUrl2 = (chainId) => {
2685
+ var returnEnvUrl3 = (chainId) => {
2225
2686
  const mainnetChain = mainnetChains.find((c) => c.id === chainId);
2226
2687
  const testnetChain = testnetChains.find((c) => c.id === chainId);
2227
2688
  if (!mainnetChain && !testnetChain) {
@@ -2323,7 +2784,7 @@ var ActaBilling = class {
2323
2784
  if (!token2) {
2324
2785
  throw new Error("Token not supported.");
2325
2786
  }
2326
- const { envBillingServiceUrl } = returnEnvUrl2(chainId);
2787
+ const { envBillingServiceUrl } = returnEnvUrl3(chainId);
2327
2788
  const rpcParameters = yield this.account.signSinglePaymentOperation({
2328
2789
  signerAddress,
2329
2790
  chainId,
@@ -2342,7 +2803,7 @@ var ActaBilling = class {
2342
2803
  receiverAddress: receiver,
2343
2804
  chainId,
2344
2805
  tokenAddress: token2.address,
2345
- amount: (0, import_viem6.toHex)(amount),
2806
+ amount: (0, import_viem7.toHex)(amount),
2346
2807
  feeInclusive,
2347
2808
  serviceType
2348
2809
  },
@@ -2386,7 +2847,7 @@ var ActaBilling = class {
2386
2847
  if (!chainId || !count || !intervalUnit || !startDate || !endDate) {
2387
2848
  throw new Error("Invalid parameters.");
2388
2849
  }
2389
- const { envBillingServiceUrl } = returnEnvUrl2(chainId);
2850
+ const { envBillingServiceUrl } = returnEnvUrl3(chainId);
2390
2851
  const { approval, amountExclusive } = yield this.account.signRecurringPayments({
2391
2852
  signerAddress,
2392
2853
  chainId,
@@ -2459,10 +2920,10 @@ var ActaBilling = class {
2459
2920
  };
2460
2921
 
2461
2922
  // src/batch.ts
2462
- var import_viem7 = require("viem");
2463
- var batchServiceUrl = "https://api.acta.link/bexo/api/v1/";
2464
- var batchServiceTestUrl = "https://api.acta.link/bexo/test/api/v1/";
2465
- var returnEnvUrl3 = (chainId) => {
2923
+ var import_viem8 = require("viem");
2924
+ var batchServiceUrl2 = "https://api.acta.link/bexo/api/v1/";
2925
+ var batchServiceTestUrl2 = "https://api.acta.link/bexo/test/api/v1/";
2926
+ var returnEnvUrl4 = (chainId) => {
2466
2927
  const mainnetChain = mainnetChains.find((c) => c.id === chainId);
2467
2928
  const testnetChain = testnetChains.find((c) => c.id === chainId);
2468
2929
  if (!mainnetChain && !testnetChain) {
@@ -2470,11 +2931,11 @@ var returnEnvUrl3 = (chainId) => {
2470
2931
  }
2471
2932
  if (mainnetChain) {
2472
2933
  return {
2473
- envBatchServiceUrl: batchServiceUrl
2934
+ envBatchServiceUrl: batchServiceUrl2
2474
2935
  };
2475
2936
  } else {
2476
2937
  return {
2477
- envBatchServiceUrl: batchServiceTestUrl
2938
+ envBatchServiceUrl: batchServiceTestUrl2
2478
2939
  };
2479
2940
  }
2480
2941
  };
@@ -2490,7 +2951,7 @@ var ActaBatch = class {
2490
2951
  if (!this.APIkey) {
2491
2952
  throw new Error("No API key provided.");
2492
2953
  }
2493
- if (!signerAddress || signerAddress === import_viem7.zeroAddress) {
2954
+ if (!signerAddress || signerAddress === import_viem8.zeroAddress) {
2494
2955
  throw new Error("Signer address is required.");
2495
2956
  }
2496
2957
  if (!name || name === "") {
@@ -2502,7 +2963,7 @@ var ActaBatch = class {
2502
2963
  if (!instructionId || instructionId === "") {
2503
2964
  throw new Error("Instruction id is required");
2504
2965
  }
2505
- const { envBatchServiceUrl } = returnEnvUrl3(chainId);
2966
+ const { envBatchServiceUrl } = returnEnvUrl4(chainId);
2506
2967
  const session = yield createBatchSessionAPICall(
2507
2968
  `${envBatchServiceUrl}create/session`,
2508
2969
  this.APIkey,
@@ -2543,7 +3004,7 @@ var ActaBatch = class {
2543
3004
  if (feeInclusive) {
2544
3005
  isFeeInclusive = true;
2545
3006
  }
2546
- const { envBatchServiceUrl } = returnEnvUrl3(chainId);
3007
+ const { envBatchServiceUrl } = returnEnvUrl4(chainId);
2547
3008
  const instuctionData = yield fetchBatchInstructionDetails(
2548
3009
  `${envBatchServiceUrl}instruction/${instructionId}`,
2549
3010
  this.APIkey
@@ -2557,12 +3018,12 @@ var ActaBatch = class {
2557
3018
  }
2558
3019
  const totalAmount = instuctionData.totalAmount;
2559
3020
  const totalAmountParsed = BigInt(
2560
- (0, import_viem7.parseUnits)(totalAmount, tokenData.decimals)
3021
+ (0, import_viem8.parseUnits)(totalAmount, tokenData.decimals)
2561
3022
  );
2562
3023
  const receivers = instuctionData.receivers.map(
2563
3024
  (i) => {
2564
- const receiver = (0, import_viem7.getAddress)(i.address);
2565
- const tokenAmount = BigInt((0, import_viem7.parseUnits)(i.amount, tokenData.decimals));
3025
+ const receiver = (0, import_viem8.getAddress)(i.address);
3026
+ const tokenAmount = BigInt((0, import_viem8.parseUnits)(i.amount, tokenData.decimals));
2566
3027
  return {
2567
3028
  address: receiver,
2568
3029
  amount: tokenAmount
@@ -2629,7 +3090,7 @@ var ActaBatch = class {
2629
3090
  if (feeInclusive) {
2630
3091
  isFeeInclusive = true;
2631
3092
  }
2632
- const { envBatchServiceUrl } = returnEnvUrl3(chainId);
3093
+ const { envBatchServiceUrl } = returnEnvUrl4(chainId);
2633
3094
  const instuctionData = yield fetchBatchInstructionDetails(
2634
3095
  `${envBatchServiceUrl}instruction/${instructionId}`,
2635
3096
  this.APIkey
@@ -2644,12 +3105,12 @@ var ActaBatch = class {
2644
3105
  }
2645
3106
  const totalAmount = instuctionData.totalAmount;
2646
3107
  const totalAmountParsed = BigInt(
2647
- (0, import_viem7.parseUnits)(totalAmount, tokenData.decimals)
3108
+ (0, import_viem8.parseUnits)(totalAmount, tokenData.decimals)
2648
3109
  );
2649
3110
  const receivers = instuctionData.receivers.map(
2650
3111
  (i) => {
2651
- const receiver = (0, import_viem7.getAddress)(i.address);
2652
- const tokenAmount = BigInt((0, import_viem7.parseUnits)(i.amount, tokenData.decimals));
3112
+ const receiver = (0, import_viem8.getAddress)(i.address);
3113
+ const tokenAmount = BigInt((0, import_viem8.parseUnits)(i.amount, tokenData.decimals));
2653
3114
  return {
2654
3115
  address: receiver,
2655
3116
  amount: tokenAmount
@@ -2682,7 +3143,7 @@ var ActaBatch = class {
2682
3143
  senderAddress: signerAddress,
2683
3144
  chainId,
2684
3145
  tokenAddress: tokenData.address,
2685
- amount: (0, import_viem7.toHex)(totalAmountParsed),
3146
+ amount: (0, import_viem8.toHex)(totalAmountParsed),
2686
3147
  feeInclusive: isFeeInclusive,
2687
3148
  serviceType: "batch"
2688
3149
  },
@@ -2717,7 +3178,7 @@ var ActaBatch = class {
2717
3178
  if (feeInclusive) {
2718
3179
  isFeeInclusive = true;
2719
3180
  }
2720
- const { envBatchServiceUrl } = returnEnvUrl3(chainId);
3181
+ const { envBatchServiceUrl } = returnEnvUrl4(chainId);
2721
3182
  if (executionTime <= Date.now() + 1e3 * 60 * 2) {
2722
3183
  throw new Error(
2723
3184
  "Execution time must be more than 5 mins from current time."
@@ -2737,12 +3198,12 @@ var ActaBatch = class {
2737
3198
  }
2738
3199
  const totalAmount = instuctionData.totalAmount;
2739
3200
  const totalAmountParsed = BigInt(
2740
- (0, import_viem7.parseUnits)(totalAmount, tokenData.decimals)
3201
+ (0, import_viem8.parseUnits)(totalAmount, tokenData.decimals)
2741
3202
  );
2742
3203
  const receivers = instuctionData.receivers.map(
2743
3204
  (i) => {
2744
- const receiver = (0, import_viem7.getAddress)(i.address);
2745
- const tokenAmount = BigInt((0, import_viem7.parseUnits)(i.amount, tokenData.decimals));
3205
+ const receiver = (0, import_viem8.getAddress)(i.address);
3206
+ const tokenAmount = BigInt((0, import_viem8.parseUnits)(i.amount, tokenData.decimals));
2746
3207
  return {
2747
3208
  address: receiver,
2748
3209
  amount: tokenAmount
@@ -2775,10 +3236,10 @@ var ActaBatch = class {
2775
3236
  senderAddress: signerAddress,
2776
3237
  chainId,
2777
3238
  tokenAddress: tokenData.address,
2778
- amount: (0, import_viem7.toHex)(totalAmountParsed),
3239
+ amount: (0, import_viem8.toHex)(totalAmountParsed),
2779
3240
  feeInclusive: isFeeInclusive,
2780
3241
  serviceType: "batch",
2781
- amountExclusive: (0, import_viem7.toHex)(amountExclusive),
3242
+ amountExclusive: (0, import_viem8.toHex)(amountExclusive),
2782
3243
  approval,
2783
3244
  executionAt: executionTime
2784
3245
  },
@@ -2840,7 +3301,7 @@ var ActaBatch = class {
2840
3301
  senderAddress: signerAddress,
2841
3302
  chainId,
2842
3303
  tokenAddress: tokenData.address,
2843
- amount: (0, import_viem7.toHex)(totalAmount),
3304
+ amount: (0, import_viem8.toHex)(totalAmount),
2844
3305
  feeInclusive: isFeeInclusive,
2845
3306
  serviceType: "batch",
2846
3307
  sessionId: serviceParams.sessionId,
@@ -2899,10 +3360,10 @@ var ActaBatch = class {
2899
3360
  senderAddress: signerAddress,
2900
3361
  chainId,
2901
3362
  tokenAddress: tokenData.address,
2902
- amount: (0, import_viem7.toHex)(totalAmount),
3363
+ amount: (0, import_viem8.toHex)(totalAmount),
2903
3364
  feeInclusive: isFeeInclusive,
2904
3365
  serviceType: "batch",
2905
- amountExclusive: (0, import_viem7.toHex)(amountExclusive),
3366
+ amountExclusive: (0, import_viem8.toHex)(amountExclusive),
2906
3367
  approval,
2907
3368
  executionAt: executionTime,
2908
3369
  sessionId: serviceParams.sessionId
@@ -2921,7 +3382,7 @@ var ActaBatch = class {
2921
3382
  // src/utils.ts
2922
3383
  var import_sdk2 = require("@zerodev/sdk");
2923
3384
  var import_accounts = require("@zerodev/sdk/accounts");
2924
- var import_viem8 = require("viem");
3385
+ var import_viem9 = require("viem");
2925
3386
  var import_accounts2 = require("viem/accounts");
2926
3387
  var import_actions = require("viem/actions");
2927
3388
  var import_utils2 = require("viem/utils");
@@ -2934,9 +3395,9 @@ var depositServiceUrl2 = "https://api.acta.link/bexo/v1/";
2934
3395
  var transactionServiceUrl2 = "https://api.acta.link/transaction/v1/";
2935
3396
  var billingServiceTestUrl2 = "https://api.acta.link/pay/test/v1/";
2936
3397
  var toSignerId = (signer) => {
2937
- return (0, import_viem8.encodeAbiParameters)(
3398
+ return (0, import_viem9.encodeAbiParameters)(
2938
3399
  [{ name: "signerData", type: "bytes" }],
2939
- [(0, import_viem8.concat)([signer.signerContractAddress, signer.getSignerData()])]
3400
+ [(0, import_viem9.concat)([signer.signerContractAddress, signer.getSignerData()])]
2940
3401
  );
2941
3402
  };
2942
3403
  function toECDSASigner2(_0) {
@@ -2973,11 +3434,11 @@ function toECDSASigner2(_0) {
2973
3434
  });
2974
3435
  }
2975
3436
  var toPolicyId = (policies) => {
2976
- return (0, import_viem8.encodeAbiParameters)(
3437
+ return (0, import_viem9.encodeAbiParameters)(
2977
3438
  [{ name: "policiesData", type: "bytes[]" }],
2978
3439
  [
2979
3440
  policies.map(
2980
- (policy) => (0, import_viem8.concat)([policy.getPolicyInfoInBytes(), policy.getPolicyData()])
3441
+ (policy) => (0, import_viem9.concat)([policy.getPolicyInfoInBytes(), policy.getPolicyData()])
2981
3442
  )
2982
3443
  ]
2983
3444
  );
@@ -2995,38 +3456,38 @@ function toPermissionValidator2(_0, _1) {
2995
3456
  throw new Error("Only EntryPoint 0.7 is supported");
2996
3457
  }
2997
3458
  const getEnableData = (_kernelAccountAddress) => __async(null, null, function* () {
2998
- const enableData = (0, import_viem8.encodeAbiParameters)(
3459
+ const enableData = (0, import_viem9.encodeAbiParameters)(
2999
3460
  [{ name: "policyAndSignerData", type: "bytes[]" }],
3000
3461
  [
3001
3462
  [
3002
3463
  ...policies.map(
3003
- (policy) => (0, import_viem8.concat)([policy.getPolicyInfoInBytes(), policy.getPolicyData()])
3464
+ (policy) => (0, import_viem9.concat)([policy.getPolicyInfoInBytes(), policy.getPolicyData()])
3004
3465
  ),
3005
- (0, import_viem8.concat)([flag, signer.signerContractAddress, signer.getSignerData()])
3466
+ (0, import_viem9.concat)([flag, signer.signerContractAddress, signer.getSignerData()])
3006
3467
  ]
3007
3468
  ]
3008
3469
  );
3009
3470
  return enableData;
3010
3471
  });
3011
3472
  const getPermissionId = () => {
3012
- const pIdData = (0, import_viem8.encodeAbiParameters)(
3473
+ const pIdData = (0, import_viem9.encodeAbiParameters)(
3013
3474
  [{ name: "policyAndSignerData", type: "bytes[]" }],
3014
3475
  [[toPolicyId(policies), flag, toSignerId(signer)]]
3015
3476
  );
3016
- return (0, import_viem8.slice)((0, import_viem8.keccak256)(pIdData), 0, 4);
3477
+ return (0, import_viem9.slice)((0, import_viem9.keccak256)(pIdData), 0, 4);
3017
3478
  };
3018
3479
  return __spreadProps(__spreadValues({}, signer.account), {
3019
3480
  supportedKernelVersions: ">=0.3.0",
3020
3481
  validatorType: "PERMISSION",
3021
- address: import_viem8.zeroAddress,
3482
+ address: import_viem9.zeroAddress,
3022
3483
  source: "PermissionValidator",
3023
3484
  getEnableData,
3024
3485
  getIdentifier: getPermissionId,
3025
3486
  signMessage: (_02) => __async(null, [_02], function* ({ message }) {
3026
- return (0, import_viem8.concat)(["0xff", yield signer.account.signMessage({ message })]);
3487
+ return (0, import_viem9.concat)(["0xff", yield signer.account.signMessage({ message })]);
3027
3488
  }),
3028
3489
  signTypedData: (typedData) => __async(null, null, function* () {
3029
- return (0, import_viem8.concat)(["0xff", yield signer.account.signTypedData(typedData)]);
3490
+ return (0, import_viem9.concat)(["0xff", yield signer.account.signTypedData(typedData)]);
3030
3491
  }),
3031
3492
  signUserOperation: (userOperation) => __async(null, null, function* () {
3032
3493
  const userOpHash = (0, import_account_abstraction2.getUserOperationHash)({
@@ -3040,7 +3501,7 @@ function toPermissionValidator2(_0, _1) {
3040
3501
  const signature = yield signer.account.signMessage({
3041
3502
  message: { raw: userOpHash }
3042
3503
  });
3043
- return (0, import_viem8.concat)(["0xff", signature]);
3504
+ return (0, import_viem9.concat)(["0xff", signature]);
3044
3505
  }),
3045
3506
  getNonceKey(_accountAddress, customNonceKey) {
3046
3507
  return __async(this, null, function* () {
@@ -3052,7 +3513,7 @@ function toPermissionValidator2(_0, _1) {
3052
3513
  },
3053
3514
  getStubSignature(_userOperation) {
3054
3515
  return __async(this, null, function* () {
3055
- return (0, import_viem8.concat)(["0xff", signer.getDummySignature()]);
3516
+ return (0, import_viem9.concat)(["0xff", signer.getDummySignature()]);
3056
3517
  });
3057
3518
  },
3058
3519
  getPluginSerializationParams: () => {
@@ -3189,12 +3650,12 @@ var decodeParamsFromInitCode = (initCode, kernelVersion) => {
3189
3650
  };
3190
3651
  }
3191
3652
  try {
3192
- deployWithFactoryFunctionData = (0, import_viem8.decodeFunctionData)({
3653
+ deployWithFactoryFunctionData = (0, import_viem9.decodeFunctionData)({
3193
3654
  abi: import_sdk2.KernelFactoryStakerAbi,
3194
3655
  data: initCode
3195
3656
  });
3196
3657
  } catch (error) {
3197
- deployWithFactoryFunctionData = (0, import_viem8.decodeFunctionData)({
3658
+ deployWithFactoryFunctionData = (0, import_viem9.decodeFunctionData)({
3198
3659
  abi: import_sdk2.KernelV3FactoryAbi,
3199
3660
  data: initCode
3200
3661
  });
@@ -3205,12 +3666,12 @@ var decodeParamsFromInitCode = (initCode, kernelVersion) => {
3205
3666
  index = BigInt(deployWithFactoryFunctionData.args[2]);
3206
3667
  let initializeFunctionData;
3207
3668
  if (kernelVersion === "0.3.0") {
3208
- initializeFunctionData = (0, import_viem8.decodeFunctionData)({
3669
+ initializeFunctionData = (0, import_viem9.decodeFunctionData)({
3209
3670
  abi: import_sdk2.KernelV3AccountAbi,
3210
3671
  data: deployWithFactoryFunctionData.args[1]
3211
3672
  });
3212
3673
  } else {
3213
- initializeFunctionData = (0, import_viem8.decodeFunctionData)({
3674
+ initializeFunctionData = (0, import_viem9.decodeFunctionData)({
3214
3675
  abi: import_sdk2.KernelV3_1AccountAbi,
3215
3676
  data: deployWithFactoryFunctionData.args[1]
3216
3677
  });
@@ -3228,12 +3689,12 @@ var decodeParamsFromInitCode = (initCode, kernelVersion) => {
3228
3689
  index = BigInt(deployWithFactoryFunctionData.args[1]);
3229
3690
  let initializeFunctionData;
3230
3691
  if (kernelVersion === "0.3.0") {
3231
- initializeFunctionData = (0, import_viem8.decodeFunctionData)({
3692
+ initializeFunctionData = (0, import_viem9.decodeFunctionData)({
3232
3693
  abi: import_sdk2.KernelV3AccountAbi,
3233
3694
  data: deployWithFactoryFunctionData.args[0]
3234
3695
  });
3235
3696
  } else {
3236
- initializeFunctionData = (0, import_viem8.decodeFunctionData)({
3697
+ initializeFunctionData = (0, import_viem9.decodeFunctionData)({
3237
3698
  abi: import_sdk2.KernelV3_1AccountAbi,
3238
3699
  data: deployWithFactoryFunctionData.args[0]
3239
3700
  });
@@ -3336,12 +3797,12 @@ var cancelRecurringTransaction = (_0) => __async(null, [_0], function* ({
3336
3797
  );
3337
3798
  console.log(`sender: ${response.senderAddress}`);
3338
3799
  console.log(`receiver: ${response.receiverAddress}`);
3339
- console.log(`amountEx: ${(0, import_viem8.hexToBigInt)(response.amountExclusive)}`);
3800
+ console.log(`amountEx: ${(0, import_viem9.hexToBigInt)(response.amountExclusive)}`);
3340
3801
  console.log(`token: ${response.tokenAddress}`);
3341
3802
  const rpcParameters = yield account.signRecurringTransactionCancellation({
3342
3803
  signerAddress: response.senderAddress,
3343
3804
  receiverAddress: response.receiverAddress,
3344
- amountExclusive: (0, import_viem8.hexToBigInt)(response.amountExclusive),
3805
+ amountExclusive: (0, import_viem9.hexToBigInt)(response.amountExclusive),
3345
3806
  token: response.tokenAddress
3346
3807
  });
3347
3808
  console.log(rpcParameters);
@@ -3365,7 +3826,8 @@ var cancelRecurringTransaction = (_0) => __async(null, [_0], function* ({
3365
3826
  ActaAccount,
3366
3827
  ActaBatch,
3367
3828
  ActaBilling,
3368
- ActaDeposit,
3829
+ ActaFlexBatch,
3830
+ ActaFlexDeposit,
3369
3831
  ConnectorType,
3370
3832
  HttpMethod,
3371
3833
  PolicyFlags,