@actalink/commonlib 0.0.2 → 0.0.4

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
@@ -177,14 +177,14 @@ function getChainExplorerByChainId(chainId) {
177
177
 
178
178
  // src/types.ts
179
179
  var TokenLogo = /* @__PURE__ */ ((TokenLogo2) => {
180
- TokenLogo2["ETH"] = "https://pay.daimo.com/chain-logos/ethereum.png";
181
- TokenLogo2["WETH"] = "https://pay.daimo.com/coin-logos/weth.png";
182
- TokenLogo2["USDC"] = "https://pay.daimo.com/coin-logos/usdc.png";
183
- TokenLogo2["EURC"] = "https://pay.daimo.com/coin-logos/eurc.png";
184
- TokenLogo2["USDT"] = "https://pay.daimo.com/coin-logos/usdt.png";
185
- TokenLogo2["DAI"] = "https://pay.daimo.com/coin-logos/dai.png";
186
- TokenLogo2["POL"] = "https://pay.daimo.com/coin-logos/pol.png";
187
- TokenLogo2["BNB"] = "https://pay.daimo.com/coin-logos/bnb.png";
180
+ TokenLogo2["ETH"] = "https://api.acta.link/deposit/v1/logos/ethereum.png";
181
+ TokenLogo2["WETH"] = "https://api.acta.link/deposit/v1/logos/weth.png";
182
+ TokenLogo2["USDC"] = "https://api.acta.link/deposit/v1/logos/usdc.png";
183
+ TokenLogo2["EURC"] = "https://api.acta.link/deposit/v1/logos/eurc.png";
184
+ TokenLogo2["USDT"] = "https://api.acta.link/deposit/v1/logos/usdt.png";
185
+ TokenLogo2["DAI"] = "https://api.acta.link/deposit/v1/logos/dai.png";
186
+ TokenLogo2["POL"] = "https://api.acta.link/deposit/v1/logos/pol.png";
187
+ TokenLogo2["BNB"] = "https://api.acta.link/deposit/v1/logos/bnb.png";
188
188
  return TokenLogo2;
189
189
  })(TokenLogo || {});
190
190
  var ConnectorType = /* @__PURE__ */ ((ConnectorType2) => {
@@ -207,7 +207,7 @@ var arbitrumWETH = token({
207
207
  decimals: 18,
208
208
  name: "Wrapped Ether",
209
209
  symbol: "WETH",
210
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
210
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
211
211
  });
212
212
  var arbitrumUSDC = token({
213
213
  chainId: import_chains2.arbitrum.id,
@@ -216,7 +216,7 @@ var arbitrumUSDC = token({
216
216
  symbol: "USDC",
217
217
  fiatISO: "USD",
218
218
  decimals: 6,
219
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
219
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
220
220
  });
221
221
  var arbitrumDAI = token({
222
222
  chainId: import_chains2.arbitrum.id,
@@ -225,7 +225,7 @@ var arbitrumDAI = token({
225
225
  fiatISO: "USD",
226
226
  name: "Dai Stablecoin",
227
227
  symbol: "DAI",
228
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
228
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
229
229
  });
230
230
  var arbitrumUSDT = token({
231
231
  chainId: import_chains2.arbitrum.id,
@@ -234,7 +234,7 @@ var arbitrumUSDT = token({
234
234
  fiatISO: "USD",
235
235
  name: "Tether USD",
236
236
  symbol: "USDT",
237
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
237
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
238
238
  });
239
239
  var arbitrumUSDCe = token({
240
240
  chainId: import_chains2.arbitrum.id,
@@ -243,7 +243,7 @@ var arbitrumUSDCe = token({
243
243
  fiatISO: "USD",
244
244
  name: "Bridged USD Coin",
245
245
  symbol: "USDCe",
246
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
246
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
247
247
  });
248
248
  var arbitrumTokens = [arbitrumUSDC, arbitrumUSDT];
249
249
  var baseETH = nativeETH(import_chains2.base.id);
@@ -253,7 +253,7 @@ var baseWETH = token({
253
253
  decimals: 18,
254
254
  name: "Wrapped Ether",
255
255
  symbol: "WETH",
256
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
256
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
257
257
  });
258
258
  var baseUSDC = token({
259
259
  chainId: import_chains2.base.id,
@@ -262,7 +262,7 @@ var baseUSDC = token({
262
262
  symbol: "USDC",
263
263
  fiatISO: "USD",
264
264
  decimals: 6,
265
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
265
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
266
266
  });
267
267
  var baseEURC = token({
268
268
  chainId: import_chains2.base.id,
@@ -271,7 +271,7 @@ var baseEURC = token({
271
271
  fiatISO: "EUR",
272
272
  name: "EURC",
273
273
  symbol: "EURC",
274
- logoURI: "https://pay.daimo.com/coin-logos/eurc.png" /* EURC */
274
+ logoURI: "https://api.acta.link/deposit/v1/logos/eurc.png" /* EURC */
275
275
  });
276
276
  var baseUSDbC = token({
277
277
  chainId: import_chains2.base.id,
@@ -280,7 +280,7 @@ var baseUSDbC = token({
280
280
  symbol: "USDbC",
281
281
  fiatISO: "USD",
282
282
  decimals: 6,
283
- logoURI: "https://pay.daimo.com/coin-logos/usdbc.png"
283
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdbc.png"
284
284
  });
285
285
  var baseDAI = token({
286
286
  chainId: import_chains2.base.id,
@@ -289,7 +289,7 @@ var baseDAI = token({
289
289
  symbol: "DAI",
290
290
  fiatISO: "USD",
291
291
  decimals: 18,
292
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
292
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
293
293
  });
294
294
  var baseUSDT = token({
295
295
  chainId: import_chains2.base.id,
@@ -298,14 +298,14 @@ var baseUSDT = token({
298
298
  symbol: "USDT",
299
299
  fiatISO: "USD",
300
300
  decimals: 6,
301
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
301
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
302
302
  });
303
303
  var baseTokens = [baseUSDC, baseUSDT];
304
304
  var bscBNB = nativeToken({
305
305
  chainId: import_chains2.bsc.id,
306
306
  name: "BNB",
307
307
  symbol: "BNB",
308
- logoURI: "https://pay.daimo.com/coin-logos/bnb.png" /* BNB */
308
+ logoURI: "https://api.acta.link/deposit/v1/logos/bnb.png" /* BNB */
309
309
  });
310
310
  var bscWBNB = token({
311
311
  chainId: import_chains2.bsc.id,
@@ -313,7 +313,7 @@ var bscWBNB = token({
313
313
  decimals: 18,
314
314
  name: "Wrapped BNB",
315
315
  symbol: "WBNB",
316
- logoURI: "https://pay.daimo.com/coin-logos/bnb.png" /* BNB */
316
+ logoURI: "https://api.acta.link/deposit/v1/logos/bnb.png" /* BNB */
317
317
  });
318
318
  var bscUSDC = token({
319
319
  chainId: import_chains2.bsc.id,
@@ -322,7 +322,7 @@ var bscUSDC = token({
322
322
  fiatISO: "USD",
323
323
  name: "USD Coin",
324
324
  symbol: "USDC",
325
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
325
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
326
326
  });
327
327
  var bscUSDT = token({
328
328
  chainId: import_chains2.bsc.id,
@@ -331,7 +331,7 @@ var bscUSDT = token({
331
331
  fiatISO: "USD",
332
332
  name: "Tether USD",
333
333
  symbol: "USDT",
334
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
334
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
335
335
  });
336
336
  var bscTokens = [bscUSDT];
337
337
  var ethereumETH = nativeETH(import_chains2.mainnet.id);
@@ -341,7 +341,7 @@ var ethereumWETH = token({
341
341
  decimals: 18,
342
342
  name: "Wrapped Ether",
343
343
  symbol: "WETH",
344
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
344
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
345
345
  });
346
346
  var ethereumUSDC = token({
347
347
  chainId: import_chains2.mainnet.id,
@@ -350,7 +350,7 @@ var ethereumUSDC = token({
350
350
  fiatISO: "USD",
351
351
  name: "USD Coin",
352
352
  symbol: "USDC",
353
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
353
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
354
354
  });
355
355
  var ethereumDAI = token({
356
356
  chainId: import_chains2.mainnet.id,
@@ -359,7 +359,7 @@ var ethereumDAI = token({
359
359
  fiatISO: "USD",
360
360
  name: "Dai Stablecoin",
361
361
  symbol: "DAI",
362
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
362
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
363
363
  });
364
364
  var ethereumUSDT = token({
365
365
  chainId: import_chains2.mainnet.id,
@@ -368,7 +368,7 @@ var ethereumUSDT = token({
368
368
  fiatISO: "USD",
369
369
  name: "Tether USD",
370
370
  symbol: "USDT",
371
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
371
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
372
372
  });
373
373
  var ethereumEURC = token({
374
374
  chainId: import_chains2.mainnet.id,
@@ -377,7 +377,7 @@ var ethereumEURC = token({
377
377
  fiatISO: "EUR",
378
378
  name: "EURC",
379
379
  symbol: "EURC",
380
- logoURI: "https://pay.daimo.com/coin-logos/eurc.png" /* EURC */
380
+ logoURI: "https://api.acta.link/deposit/v1/logos/eurc.png" /* EURC */
381
381
  });
382
382
  var ethereumTokens = [ethereumUSDC, ethereumUSDT];
383
383
  var lineaETH = nativeETH(import_chains2.linea.id);
@@ -387,7 +387,7 @@ var lineaWETH = token({
387
387
  decimals: 18,
388
388
  name: "Wrapped Ether",
389
389
  symbol: "WETH",
390
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
390
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
391
391
  });
392
392
  var lineaUSDC = token({
393
393
  chainId: import_chains2.linea.id,
@@ -396,7 +396,7 @@ var lineaUSDC = token({
396
396
  fiatISO: "USD",
397
397
  name: "USD Coin",
398
398
  symbol: "USDC",
399
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
399
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
400
400
  });
401
401
  var lineaDAI = token({
402
402
  chainId: import_chains2.linea.id,
@@ -405,7 +405,7 @@ var lineaDAI = token({
405
405
  fiatISO: "USD",
406
406
  name: "Dai Stablecoin",
407
407
  symbol: "DAI",
408
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
408
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
409
409
  });
410
410
  var optimismETH = nativeETH(import_chains2.optimism.id);
411
411
  var optimismWETH = token({
@@ -414,7 +414,7 @@ var optimismWETH = token({
414
414
  decimals: 18,
415
415
  name: "Wrapped Ether",
416
416
  symbol: "WETH",
417
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
417
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
418
418
  });
419
419
  var optimismUSDC = token({
420
420
  chainId: import_chains2.optimism.id,
@@ -423,7 +423,7 @@ var optimismUSDC = token({
423
423
  fiatISO: "USD",
424
424
  name: "USD Coin",
425
425
  symbol: "USDC",
426
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
426
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
427
427
  });
428
428
  var optimismDAI = token({
429
429
  chainId: import_chains2.optimism.id,
@@ -432,7 +432,7 @@ var optimismDAI = token({
432
432
  fiatISO: "USD",
433
433
  name: "Dai Stablecoin",
434
434
  symbol: "DAI",
435
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
435
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
436
436
  });
437
437
  var optimismUSDT = token({
438
438
  chainId: import_chains2.optimism.id,
@@ -441,7 +441,7 @@ var optimismUSDT = token({
441
441
  fiatISO: "USD",
442
442
  name: "Tether USD",
443
443
  symbol: "USDT",
444
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
444
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
445
445
  });
446
446
  var optimismUSDCe = token({
447
447
  chainId: import_chains2.optimism.id,
@@ -450,14 +450,14 @@ var optimismUSDCe = token({
450
450
  fiatISO: "USD",
451
451
  name: "Bridged USD Coin",
452
452
  symbol: "USDCe",
453
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
453
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
454
454
  });
455
455
  var optimismTokens = [optimismUSDC, optimismUSDT];
456
456
  var polygonPOL = nativeToken({
457
457
  chainId: import_chains2.polygon.id,
458
458
  name: "Polygon",
459
459
  symbol: "POL",
460
- logoURI: "https://pay.daimo.com/coin-logos/pol.png" /* POL */
460
+ logoURI: "https://api.acta.link/deposit/v1/logos/pol.png" /* POL */
461
461
  });
462
462
  var polygonWPOL = token({
463
463
  chainId: import_chains2.polygon.id,
@@ -465,7 +465,7 @@ var polygonWPOL = token({
465
465
  decimals: 18,
466
466
  name: "Wrapped Polygon",
467
467
  symbol: "WPOL",
468
- logoURI: "https://pay.daimo.com/coin-logos/pol.png" /* POL */
468
+ logoURI: "https://api.acta.link/deposit/v1/logos/pol.png" /* POL */
469
469
  });
470
470
  var polygonWETH = token({
471
471
  chainId: import_chains2.polygon.id,
@@ -473,7 +473,7 @@ var polygonWETH = token({
473
473
  decimals: 18,
474
474
  name: "Wrapped Ether",
475
475
  symbol: "WETH",
476
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
476
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
477
477
  });
478
478
  var polygonUSDC = token({
479
479
  chainId: import_chains2.polygon.id,
@@ -482,7 +482,7 @@ var polygonUSDC = token({
482
482
  fiatISO: "USD",
483
483
  name: "USD Coin",
484
484
  symbol: "USDC",
485
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
485
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
486
486
  });
487
487
  var polygonDAI = token({
488
488
  chainId: import_chains2.polygon.id,
@@ -491,7 +491,7 @@ var polygonDAI = token({
491
491
  fiatISO: "USD",
492
492
  name: "Dai Stablecoin",
493
493
  symbol: "DAI",
494
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
494
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
495
495
  });
496
496
  var polygonUSDT = token({
497
497
  chainId: import_chains2.polygon.id,
@@ -500,7 +500,7 @@ var polygonUSDT = token({
500
500
  fiatISO: "USD",
501
501
  name: "Tether USD",
502
502
  symbol: "USDT",
503
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
503
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
504
504
  });
505
505
  var polygonUSDCe = token({
506
506
  chainId: import_chains2.polygon.id,
@@ -509,7 +509,7 @@ var polygonUSDCe = token({
509
509
  fiatISO: "USD",
510
510
  name: "USD Coin (PoS)",
511
511
  symbol: "USDCe",
512
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
512
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
513
513
  });
514
514
  var polygonTokens = [polygonUSDC, polygonUSDT];
515
515
  var supportedTokensByChain = /* @__PURE__ */ new Map([
@@ -531,7 +531,7 @@ function nativeETH(chainId) {
531
531
  chainId,
532
532
  name: "Ether",
533
533
  symbol: "ETH",
534
- logoURI: "https://pay.daimo.com/chain-logos/ethereum.png" /* ETH */
534
+ logoURI: "https://api.acta.link/deposit/v1/logos/ethereum.png" /* ETH */
535
535
  });
536
536
  }
537
537
  function nativeToken({
@@ -602,7 +602,8 @@ function getTokenByChainIdAndAddress(chainId, address) {
602
602
  const tokens = supportedTokensByChain.get(chain.id);
603
603
  if (!tokens) throw new Error(`Tokens not found for chain ${chainId}.`);
604
604
  const token2 = tokens.find((t) => t.address === address);
605
- if (!token2) throw new Error(`Token ${address} not found for chain ${chainId}.`);
605
+ if (!token2)
606
+ throw new Error(`Token ${address} not found for chain ${chainId}.`);
606
607
  return token2;
607
608
  }
608
609
 
@@ -611,7 +612,6 @@ var import_viem6 = require("viem");
611
612
 
612
613
  // src/account.ts
613
614
  var import_viem4 = require("viem");
614
- var import_accounts3 = require("viem/accounts");
615
615
  var import_account_abstraction2 = require("viem/account-abstraction");
616
616
  var import_sdk2 = require("@zerodev/sdk");
617
617
  var import_constants = require("@zerodev/sdk/constants");
@@ -688,7 +688,7 @@ var ViemClient = class {
688
688
  return allowance;
689
689
  });
690
690
  }
691
- checkAndApproveToken(token2, spender, amount) {
691
+ checkAndApproveToken(token2, spender, amount, allowMaxTokenApproval) {
692
692
  return __async(this, null, function* () {
693
693
  var _a;
694
694
  if (this.walletClient === void 0) {
@@ -713,7 +713,7 @@ var ViemClient = class {
713
713
  data: (0, import_viem2.encodeFunctionData)({
714
714
  abi: (0, import_viem2.parseAbi)(["function approve(address,uint)"]),
715
715
  functionName: "approve",
716
- args: [spender, amount]
716
+ args: [spender, allowMaxTokenApproval ? import_viem2.maxUint256 : amount]
717
717
  })
718
718
  });
719
719
  const receipt = yield this.publicClient().waitForTransactionReceipt({
@@ -1187,28 +1187,17 @@ var ActaAccount = class {
1187
1187
  to: (0, import_viem4.getAddress)(token2.address),
1188
1188
  abi: (0, import_viem4.parseAbi)(["function transferFrom(address,address,uint)"]),
1189
1189
  functionName: "transferFrom",
1190
- args: [fromAddress, smartAccountAddress, BigInt(0)]
1191
- },
1192
- {
1193
- to: (0, import_viem4.getAddress)(token2.address),
1194
- abi: (0, import_viem4.parseAbi)(["function approve(address,uint)"]),
1195
- functionName: "approve",
1196
- args: [paymaster, BigInt(0)]
1197
- },
1198
- {
1199
- to: (0, import_viem4.getAddress)(token2.address),
1200
- abi: (0, import_viem4.parseAbi)(["function transfer(address,uint)"]),
1201
- functionName: "transfer",
1202
1190
  args: [
1191
+ fromAddress,
1203
1192
  "0x061BA68bc8208F4AddBeE86F74F17D77129cCF70",
1204
1193
  BigInt(0)
1205
1194
  ]
1206
1195
  },
1207
1196
  {
1208
1197
  to: (0, import_viem4.getAddress)(token2.address),
1209
- abi: (0, import_viem4.parseAbi)(["function transfer(address,uint)"]),
1210
- functionName: "transfer",
1211
- args: [receiver, BigInt(0)]
1198
+ abi: (0, import_viem4.parseAbi)(["function transferFrom(address,address,uint)"]),
1199
+ functionName: "transferFrom",
1200
+ args: [fromAddress, receiver, BigInt(0)]
1212
1201
  }
1213
1202
  ]
1214
1203
  });
@@ -1244,7 +1233,8 @@ var ActaAccount = class {
1244
1233
  token: tokenSymbol,
1245
1234
  amount,
1246
1235
  receiver,
1247
- feeInclusive
1236
+ feeInclusive,
1237
+ allowMaxTokenApproval
1248
1238
  } = singlePaymentParams;
1249
1239
  if (amount <= BigInt(0)) {
1250
1240
  throw new Error("Amount must be greater than 0.");
@@ -1281,7 +1271,8 @@ var ActaAccount = class {
1281
1271
  yield viemClient.checkAndApproveToken(
1282
1272
  token2,
1283
1273
  smartAccountAddress,
1284
- amountToTransfer
1274
+ amountToTransfer,
1275
+ allowMaxTokenApproval != null ? allowMaxTokenApproval : false
1285
1276
  );
1286
1277
  const userOperation = yield accountClient.prepareUserOperation({
1287
1278
  calls: [
@@ -1289,33 +1280,19 @@ var ActaAccount = class {
1289
1280
  to: (0, import_viem4.getAddress)(token2.address),
1290
1281
  abi: (0, import_viem4.parseAbi)(["function transferFrom(address,address,uint)"]),
1291
1282
  functionName: "transferFrom",
1292
- args: [fromAddress, smartAccountAddress, amountToTransfer]
1293
- },
1294
- {
1295
- to: (0, import_viem4.getAddress)(token2.address),
1296
- abi: (0, import_viem4.parseAbi)(["function approve(address,uint)"]),
1297
- functionName: "approve",
1298
- args: [paymaster, estimatedGasCostInToken]
1299
- },
1300
- {
1301
- to: (0, import_viem4.getAddress)(token2.address),
1302
- abi: (0, import_viem4.parseAbi)(["function transfer(address,uint)"]),
1303
- functionName: "transfer",
1304
1283
  args: [
1284
+ fromAddress,
1305
1285
  "0x061BA68bc8208F4AddBeE86F74F17D77129cCF70",
1306
- ActalinkFeesInToken
1286
+ receiverAmount
1307
1287
  ]
1308
1288
  },
1309
1289
  {
1310
1290
  to: (0, import_viem4.getAddress)(token2.address),
1311
- abi: (0, import_viem4.parseAbi)(["function transfer(address,uint)"]),
1312
- functionName: "transfer",
1313
- args: [receiver, receiverAmount]
1291
+ abi: (0, import_viem4.parseAbi)(["function transferFrom(address,address,uint)"]),
1292
+ functionName: "transferFrom",
1293
+ args: [fromAddress, receiver, estimatedTotalFeesInToken]
1314
1294
  }
1315
- ],
1316
- paymasterContext: {
1317
- token: token2.address
1318
- }
1295
+ ]
1319
1296
  });
1320
1297
  const signature = yield account.signUserOperation(__spreadProps(__spreadValues({}, userOperation), {
1321
1298
  chainId: this.chainId
@@ -1347,7 +1324,8 @@ var ActaAccount = class {
1347
1324
  count,
1348
1325
  intervalUnit,
1349
1326
  startDate,
1350
- endDate
1327
+ endDate,
1328
+ allowMaxTokenApproval
1351
1329
  } = recurringPaymentParams;
1352
1330
  if (amount <= BigInt(0)) {
1353
1331
  throw new Error("Amount must be greater than 0.");
@@ -1369,11 +1347,6 @@ var ActaAccount = class {
1369
1347
  const smartAccountAddress = account.address;
1370
1348
  const viemClient = new ViemClient(this.chainId, this.signer);
1371
1349
  const { paymasterClient, pimlicoClient } = yield this.createAccountHelpers();
1372
- const sessionKeySigner = yield toECDSASigner(
1373
- (0, import_accounts3.privateKeyToAccount)(
1374
- "0x8519baaeb81ebbcf3597d93c2f9790d1eda37097121e844e1b88c1ab77b67ae2"
1375
- )
1376
- );
1377
1350
  const ecdsaValidator = yield (0, import_ecdsa_validator.signerToEcdsaValidator)(
1378
1351
  viemClient.publicClient(),
1379
1352
  {
@@ -1382,7 +1355,7 @@ var ActaAccount = class {
1382
1355
  signer: this.signer
1383
1356
  }
1384
1357
  );
1385
- const sessionKeyAddress = "0x0744F720fe178AC21F25a30263B6269a1C0bB106";
1358
+ const sessionKeyAddress = "0xFDEed8e268D74DF71f3Db7409F8A8290FF1263ED";
1386
1359
  const emptyAccount = (0, import_sdk2.addressToEmptyAccount)(sessionKeyAddress);
1387
1360
  const emptySessionKeySigner = yield toECDSASigner(emptyAccount);
1388
1361
  const {
@@ -1406,7 +1379,8 @@ var ActaAccount = class {
1406
1379
  yield viemClient.checkAndApproveToken(
1407
1380
  token2,
1408
1381
  smartAccountAddress,
1409
- amountToTransfer * BigInt(paymentCount) + estimatedGasCostInToken * BigInt(2) * BigInt(paymentCount)
1382
+ amountToTransfer * BigInt(paymentCount) + estimatedGasCostInToken * BigInt(2) * BigInt(paymentCount),
1383
+ allowMaxTokenApproval != null ? allowMaxTokenApproval : false
1410
1384
  );
1411
1385
  const callPolicy = (0, import_policies2.toCallPolicy)({
1412
1386
  policyVersion: import_policies2.CallPolicyVersion.V0_0_4,
@@ -1421,45 +1395,13 @@ var ActaAccount = class {
1421
1395
  condition: import_policies2.ParamCondition.EQUAL,
1422
1396
  value: signerAddress
1423
1397
  },
1424
- {
1425
- condition: import_policies2.ParamCondition.EQUAL,
1426
- value: smartAccountAddress
1427
- },
1428
- {
1429
- condition: import_policies2.ParamCondition.GREATER_THAN_OR_EQUAL,
1430
- value: 0
1431
- }
1432
- ]
1433
- },
1434
- {
1435
- target: token2.address,
1436
- valueLimit: BigInt(0),
1437
- abi: (0, import_viem4.parseAbi)(["function approve(address,uint)"]),
1438
- functionName: "approve",
1439
- args: [
1440
- {
1441
- condition: import_policies2.ParamCondition.EQUAL,
1442
- value: paymaster
1443
- },
1444
- {
1445
- condition: import_policies2.ParamCondition.GREATER_THAN_OR_EQUAL,
1446
- value: 0
1447
- }
1448
- ]
1449
- },
1450
- {
1451
- target: token2.address,
1452
- valueLimit: BigInt(0),
1453
- abi: (0, import_viem4.parseAbi)(["function transfer(address,uint)"]),
1454
- functionName: "transfer",
1455
- args: [
1456
1398
  {
1457
1399
  condition: import_policies2.ParamCondition.ONE_OF,
1458
- value: ["0xbDCBee616C26D5282227a672C3d0B87EA477A3fe", receiver]
1400
+ value: ["0x061BA68bc8208F4AddBeE86F74F17D77129cCF70", receiver]
1459
1401
  },
1460
1402
  {
1461
- condition: import_policies2.ParamCondition.GREATER_THAN_OR_EQUAL,
1462
- value: 0
1403
+ condition: import_policies2.ParamCondition.LESS_THAN_OR_EQUAL,
1404
+ value: amountToTransfer + amountToTransfer / BigInt(2)
1463
1405
  }
1464
1406
  ]
1465
1407
  }
@@ -1619,7 +1561,8 @@ var ActaDeposit = class {
1619
1561
  this.depositSessionId = "";
1620
1562
  this.status = "not_started";
1621
1563
  this.serviceType = "deposit";
1622
- var _a;
1564
+ this.allowMaxTokenApproval = false;
1565
+ var _a, _b;
1623
1566
  this.connectorType = parameters.connectorType;
1624
1567
  this.walletClient = parameters.walletClient;
1625
1568
  this.signerAddress = parameters.signerAddress;
@@ -1634,6 +1577,7 @@ var ActaDeposit = class {
1634
1577
  this.startDate = parameters.startDate;
1635
1578
  this.endDate = parameters.endDate;
1636
1579
  this.depositSessionId = (_a = parameters.depositSessionId) != null ? _a : "";
1580
+ this.allowMaxTokenApproval = (_b = parameters.allowMaxTokenApproval) != null ? _b : false;
1637
1581
  this.viemClient = new ViemClient(this.chainId, this.walletClient);
1638
1582
  this.account = new ActaAccount(
1639
1583
  this.chainId,
@@ -1797,7 +1741,8 @@ var ActaDeposit = class {
1797
1741
  token: tokenSymbol,
1798
1742
  amount,
1799
1743
  receiver,
1800
- feeInclusive
1744
+ feeInclusive,
1745
+ allowMaxTokenApproval: this.allowMaxTokenApproval
1801
1746
  });
1802
1747
  const txn = yield executeSinglePaymentAPICall(
1803
1748
  `${transactionServiceUrl}execute/single`,
@@ -1889,7 +1834,8 @@ var ActaDeposit = class {
1889
1834
  intervalUnit,
1890
1835
  startDate,
1891
1836
  endDate,
1892
- receiver
1837
+ receiver,
1838
+ allowMaxTokenApproval: this.allowMaxTokenApproval
1893
1839
  });
1894
1840
  const txn = yield scheduleRecurringPaymentsAPICall(
1895
1841
  `${transactionServiceUrl}schedule/recurring`,
@@ -1912,6 +1858,38 @@ var ActaDeposit = class {
1912
1858
  return txn.recurringTransaction.id;
1913
1859
  });
1914
1860
  }
1861
+ getPaymentSteps() {
1862
+ return __async(this, null, function* () {
1863
+ const signerAddress = this.signerAddress;
1864
+ const chainId = this.chainId;
1865
+ const tokenSymbol = this.token;
1866
+ const amount = this.amount;
1867
+ const receiver = this.receiver;
1868
+ const feeInclusive = this.feeInclusive;
1869
+ const count = this.count;
1870
+ if (!signerAddress) return ["allowance", "confirm"];
1871
+ const token2 = getTokenByChainIdAndSymbol(chainId, tokenSymbol);
1872
+ if (!token2) return ["allowance", "confirm"];
1873
+ const smartAccount = yield this.account.createAccount();
1874
+ const { estimatedGasCostInToken, feeExclusiveAmountInToken } = yield this.account.estimateSinglePaymentGas({
1875
+ chainId,
1876
+ amount,
1877
+ feeInclusive,
1878
+ receiver,
1879
+ signerAddress,
1880
+ token: tokenSymbol
1881
+ });
1882
+ const amountToTransfer = feeInclusive ? amount : feeExclusiveAmountInToken;
1883
+ let paymentAmount = (amountToTransfer + estimatedGasCostInToken * BigInt(2)) * BigInt(count != null ? count : 1);
1884
+ const allowance = yield this.viemClient.checkTokenAllowance(
1885
+ token2,
1886
+ signerAddress,
1887
+ smartAccount.address
1888
+ );
1889
+ if (paymentAmount <= allowance) return ["confirm"];
1890
+ return ["allowance", "confirm"];
1891
+ });
1892
+ }
1915
1893
  };
1916
1894
  // Annotate the CommonJS export names for ESM import in node:
1917
1895
  0 && (module.exports = {