@actalink/commonlib 0.0.1 → 0.0.3

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
@@ -100,6 +100,7 @@ __export(index_exports, {
100
100
  getPeriodInterval: () => getPeriodInterval,
101
101
  getPimlicoRpcByChainId: () => getPimlicoRpcByChainId,
102
102
  getRpcByChainId: () => getRpcByChainId,
103
+ getTokenByChainIdAndAddress: () => getTokenByChainIdAndAddress,
103
104
  getTokenByChainIdAndSymbol: () => getTokenByChainIdAndSymbol,
104
105
  isKernelVersionAfter: () => isKernelVersionAfter,
105
106
  isPermissionValidatorPlugin: () => isPermissionValidatorPlugin,
@@ -176,14 +177,14 @@ function getChainExplorerByChainId(chainId) {
176
177
 
177
178
  // src/types.ts
178
179
  var TokenLogo = /* @__PURE__ */ ((TokenLogo2) => {
179
- TokenLogo2["ETH"] = "https://pay.daimo.com/chain-logos/ethereum.png";
180
- TokenLogo2["WETH"] = "https://pay.daimo.com/coin-logos/weth.png";
181
- TokenLogo2["USDC"] = "https://pay.daimo.com/coin-logos/usdc.png";
182
- TokenLogo2["EURC"] = "https://pay.daimo.com/coin-logos/eurc.png";
183
- TokenLogo2["USDT"] = "https://pay.daimo.com/coin-logos/usdt.png";
184
- TokenLogo2["DAI"] = "https://pay.daimo.com/coin-logos/dai.png";
185
- TokenLogo2["POL"] = "https://pay.daimo.com/coin-logos/pol.png";
186
- 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";
187
188
  return TokenLogo2;
188
189
  })(TokenLogo || {});
189
190
  var ConnectorType = /* @__PURE__ */ ((ConnectorType2) => {
@@ -206,7 +207,7 @@ var arbitrumWETH = token({
206
207
  decimals: 18,
207
208
  name: "Wrapped Ether",
208
209
  symbol: "WETH",
209
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
210
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
210
211
  });
211
212
  var arbitrumUSDC = token({
212
213
  chainId: import_chains2.arbitrum.id,
@@ -215,7 +216,7 @@ var arbitrumUSDC = token({
215
216
  symbol: "USDC",
216
217
  fiatISO: "USD",
217
218
  decimals: 6,
218
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
219
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
219
220
  });
220
221
  var arbitrumDAI = token({
221
222
  chainId: import_chains2.arbitrum.id,
@@ -224,7 +225,7 @@ var arbitrumDAI = token({
224
225
  fiatISO: "USD",
225
226
  name: "Dai Stablecoin",
226
227
  symbol: "DAI",
227
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
228
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
228
229
  });
229
230
  var arbitrumUSDT = token({
230
231
  chainId: import_chains2.arbitrum.id,
@@ -233,7 +234,7 @@ var arbitrumUSDT = token({
233
234
  fiatISO: "USD",
234
235
  name: "Tether USD",
235
236
  symbol: "USDT",
236
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
237
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
237
238
  });
238
239
  var arbitrumUSDCe = token({
239
240
  chainId: import_chains2.arbitrum.id,
@@ -242,7 +243,7 @@ var arbitrumUSDCe = token({
242
243
  fiatISO: "USD",
243
244
  name: "Bridged USD Coin",
244
245
  symbol: "USDCe",
245
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
246
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
246
247
  });
247
248
  var arbitrumTokens = [arbitrumUSDC, arbitrumUSDT];
248
249
  var baseETH = nativeETH(import_chains2.base.id);
@@ -252,7 +253,7 @@ var baseWETH = token({
252
253
  decimals: 18,
253
254
  name: "Wrapped Ether",
254
255
  symbol: "WETH",
255
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
256
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
256
257
  });
257
258
  var baseUSDC = token({
258
259
  chainId: import_chains2.base.id,
@@ -261,7 +262,7 @@ var baseUSDC = token({
261
262
  symbol: "USDC",
262
263
  fiatISO: "USD",
263
264
  decimals: 6,
264
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
265
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
265
266
  });
266
267
  var baseEURC = token({
267
268
  chainId: import_chains2.base.id,
@@ -270,7 +271,7 @@ var baseEURC = token({
270
271
  fiatISO: "EUR",
271
272
  name: "EURC",
272
273
  symbol: "EURC",
273
- logoURI: "https://pay.daimo.com/coin-logos/eurc.png" /* EURC */
274
+ logoURI: "https://api.acta.link/deposit/v1/logos/eurc.png" /* EURC */
274
275
  });
275
276
  var baseUSDbC = token({
276
277
  chainId: import_chains2.base.id,
@@ -279,7 +280,7 @@ var baseUSDbC = token({
279
280
  symbol: "USDbC",
280
281
  fiatISO: "USD",
281
282
  decimals: 6,
282
- logoURI: "https://pay.daimo.com/coin-logos/usdbc.png"
283
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdbc.png"
283
284
  });
284
285
  var baseDAI = token({
285
286
  chainId: import_chains2.base.id,
@@ -288,7 +289,7 @@ var baseDAI = token({
288
289
  symbol: "DAI",
289
290
  fiatISO: "USD",
290
291
  decimals: 18,
291
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
292
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
292
293
  });
293
294
  var baseUSDT = token({
294
295
  chainId: import_chains2.base.id,
@@ -297,14 +298,14 @@ var baseUSDT = token({
297
298
  symbol: "USDT",
298
299
  fiatISO: "USD",
299
300
  decimals: 6,
300
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
301
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
301
302
  });
302
303
  var baseTokens = [baseUSDC, baseUSDT];
303
304
  var bscBNB = nativeToken({
304
305
  chainId: import_chains2.bsc.id,
305
306
  name: "BNB",
306
307
  symbol: "BNB",
307
- logoURI: "https://pay.daimo.com/coin-logos/bnb.png" /* BNB */
308
+ logoURI: "https://api.acta.link/deposit/v1/logos/bnb.png" /* BNB */
308
309
  });
309
310
  var bscWBNB = token({
310
311
  chainId: import_chains2.bsc.id,
@@ -312,7 +313,7 @@ var bscWBNB = token({
312
313
  decimals: 18,
313
314
  name: "Wrapped BNB",
314
315
  symbol: "WBNB",
315
- logoURI: "https://pay.daimo.com/coin-logos/bnb.png" /* BNB */
316
+ logoURI: "https://api.acta.link/deposit/v1/logos/bnb.png" /* BNB */
316
317
  });
317
318
  var bscUSDC = token({
318
319
  chainId: import_chains2.bsc.id,
@@ -321,7 +322,7 @@ var bscUSDC = token({
321
322
  fiatISO: "USD",
322
323
  name: "USD Coin",
323
324
  symbol: "USDC",
324
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
325
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
325
326
  });
326
327
  var bscUSDT = token({
327
328
  chainId: import_chains2.bsc.id,
@@ -330,7 +331,7 @@ var bscUSDT = token({
330
331
  fiatISO: "USD",
331
332
  name: "Tether USD",
332
333
  symbol: "USDT",
333
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
334
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
334
335
  });
335
336
  var bscTokens = [bscUSDT];
336
337
  var ethereumETH = nativeETH(import_chains2.mainnet.id);
@@ -340,7 +341,7 @@ var ethereumWETH = token({
340
341
  decimals: 18,
341
342
  name: "Wrapped Ether",
342
343
  symbol: "WETH",
343
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
344
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
344
345
  });
345
346
  var ethereumUSDC = token({
346
347
  chainId: import_chains2.mainnet.id,
@@ -349,7 +350,7 @@ var ethereumUSDC = token({
349
350
  fiatISO: "USD",
350
351
  name: "USD Coin",
351
352
  symbol: "USDC",
352
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
353
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
353
354
  });
354
355
  var ethereumDAI = token({
355
356
  chainId: import_chains2.mainnet.id,
@@ -358,7 +359,7 @@ var ethereumDAI = token({
358
359
  fiatISO: "USD",
359
360
  name: "Dai Stablecoin",
360
361
  symbol: "DAI",
361
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
362
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
362
363
  });
363
364
  var ethereumUSDT = token({
364
365
  chainId: import_chains2.mainnet.id,
@@ -367,7 +368,7 @@ var ethereumUSDT = token({
367
368
  fiatISO: "USD",
368
369
  name: "Tether USD",
369
370
  symbol: "USDT",
370
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
371
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
371
372
  });
372
373
  var ethereumEURC = token({
373
374
  chainId: import_chains2.mainnet.id,
@@ -376,7 +377,7 @@ var ethereumEURC = token({
376
377
  fiatISO: "EUR",
377
378
  name: "EURC",
378
379
  symbol: "EURC",
379
- logoURI: "https://pay.daimo.com/coin-logos/eurc.png" /* EURC */
380
+ logoURI: "https://api.acta.link/deposit/v1/logos/eurc.png" /* EURC */
380
381
  });
381
382
  var ethereumTokens = [ethereumUSDC, ethereumUSDT];
382
383
  var lineaETH = nativeETH(import_chains2.linea.id);
@@ -386,7 +387,7 @@ var lineaWETH = token({
386
387
  decimals: 18,
387
388
  name: "Wrapped Ether",
388
389
  symbol: "WETH",
389
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
390
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
390
391
  });
391
392
  var lineaUSDC = token({
392
393
  chainId: import_chains2.linea.id,
@@ -395,7 +396,7 @@ var lineaUSDC = token({
395
396
  fiatISO: "USD",
396
397
  name: "USD Coin",
397
398
  symbol: "USDC",
398
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
399
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
399
400
  });
400
401
  var lineaDAI = token({
401
402
  chainId: import_chains2.linea.id,
@@ -404,7 +405,7 @@ var lineaDAI = token({
404
405
  fiatISO: "USD",
405
406
  name: "Dai Stablecoin",
406
407
  symbol: "DAI",
407
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
408
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
408
409
  });
409
410
  var optimismETH = nativeETH(import_chains2.optimism.id);
410
411
  var optimismWETH = token({
@@ -413,7 +414,7 @@ var optimismWETH = token({
413
414
  decimals: 18,
414
415
  name: "Wrapped Ether",
415
416
  symbol: "WETH",
416
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
417
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
417
418
  });
418
419
  var optimismUSDC = token({
419
420
  chainId: import_chains2.optimism.id,
@@ -422,7 +423,7 @@ var optimismUSDC = token({
422
423
  fiatISO: "USD",
423
424
  name: "USD Coin",
424
425
  symbol: "USDC",
425
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
426
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
426
427
  });
427
428
  var optimismDAI = token({
428
429
  chainId: import_chains2.optimism.id,
@@ -431,7 +432,7 @@ var optimismDAI = token({
431
432
  fiatISO: "USD",
432
433
  name: "Dai Stablecoin",
433
434
  symbol: "DAI",
434
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
435
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
435
436
  });
436
437
  var optimismUSDT = token({
437
438
  chainId: import_chains2.optimism.id,
@@ -440,7 +441,7 @@ var optimismUSDT = token({
440
441
  fiatISO: "USD",
441
442
  name: "Tether USD",
442
443
  symbol: "USDT",
443
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
444
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
444
445
  });
445
446
  var optimismUSDCe = token({
446
447
  chainId: import_chains2.optimism.id,
@@ -449,14 +450,14 @@ var optimismUSDCe = token({
449
450
  fiatISO: "USD",
450
451
  name: "Bridged USD Coin",
451
452
  symbol: "USDCe",
452
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
453
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
453
454
  });
454
455
  var optimismTokens = [optimismUSDC, optimismUSDT];
455
456
  var polygonPOL = nativeToken({
456
457
  chainId: import_chains2.polygon.id,
457
458
  name: "Polygon",
458
459
  symbol: "POL",
459
- logoURI: "https://pay.daimo.com/coin-logos/pol.png" /* POL */
460
+ logoURI: "https://api.acta.link/deposit/v1/logos/pol.png" /* POL */
460
461
  });
461
462
  var polygonWPOL = token({
462
463
  chainId: import_chains2.polygon.id,
@@ -464,7 +465,7 @@ var polygonWPOL = token({
464
465
  decimals: 18,
465
466
  name: "Wrapped Polygon",
466
467
  symbol: "WPOL",
467
- logoURI: "https://pay.daimo.com/coin-logos/pol.png" /* POL */
468
+ logoURI: "https://api.acta.link/deposit/v1/logos/pol.png" /* POL */
468
469
  });
469
470
  var polygonWETH = token({
470
471
  chainId: import_chains2.polygon.id,
@@ -472,7 +473,7 @@ var polygonWETH = token({
472
473
  decimals: 18,
473
474
  name: "Wrapped Ether",
474
475
  symbol: "WETH",
475
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
476
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
476
477
  });
477
478
  var polygonUSDC = token({
478
479
  chainId: import_chains2.polygon.id,
@@ -481,7 +482,7 @@ var polygonUSDC = token({
481
482
  fiatISO: "USD",
482
483
  name: "USD Coin",
483
484
  symbol: "USDC",
484
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
485
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
485
486
  });
486
487
  var polygonDAI = token({
487
488
  chainId: import_chains2.polygon.id,
@@ -490,7 +491,7 @@ var polygonDAI = token({
490
491
  fiatISO: "USD",
491
492
  name: "Dai Stablecoin",
492
493
  symbol: "DAI",
493
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
494
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
494
495
  });
495
496
  var polygonUSDT = token({
496
497
  chainId: import_chains2.polygon.id,
@@ -499,7 +500,7 @@ var polygonUSDT = token({
499
500
  fiatISO: "USD",
500
501
  name: "Tether USD",
501
502
  symbol: "USDT",
502
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
503
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
503
504
  });
504
505
  var polygonUSDCe = token({
505
506
  chainId: import_chains2.polygon.id,
@@ -508,7 +509,7 @@ var polygonUSDCe = token({
508
509
  fiatISO: "USD",
509
510
  name: "USD Coin (PoS)",
510
511
  symbol: "USDCe",
511
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
512
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
512
513
  });
513
514
  var polygonTokens = [polygonUSDC, polygonUSDT];
514
515
  var supportedTokensByChain = /* @__PURE__ */ new Map([
@@ -530,7 +531,7 @@ function nativeETH(chainId) {
530
531
  chainId,
531
532
  name: "Ether",
532
533
  symbol: "ETH",
533
- logoURI: "https://pay.daimo.com/chain-logos/ethereum.png" /* ETH */
534
+ logoURI: "https://api.acta.link/deposit/v1/logos/ethereum.png" /* ETH */
534
535
  });
535
536
  }
536
537
  function nativeToken({
@@ -595,6 +596,16 @@ var tokensCommonSymbols = [
595
596
  "POL",
596
597
  "WPOL"
597
598
  ];
599
+ function getTokenByChainIdAndAddress(chainId, address) {
600
+ const chain = getChainById(chainId);
601
+ if (!chain) throw new Error(`Chain ${chainId} not supported.`);
602
+ const tokens = supportedTokensByChain.get(chain.id);
603
+ if (!tokens) throw new Error(`Tokens not found for chain ${chainId}.`);
604
+ const token2 = tokens.find((t) => t.address === address);
605
+ if (!token2)
606
+ throw new Error(`Token ${address} not found for chain ${chainId}.`);
607
+ return token2;
608
+ }
598
609
 
599
610
  // src/deposit.ts
600
611
  var import_viem6 = require("viem");
@@ -678,7 +689,7 @@ var ViemClient = class {
678
689
  return allowance;
679
690
  });
680
691
  }
681
- checkAndApproveToken(token2, spender, amount) {
692
+ checkAndApproveToken(token2, spender, amount, allowMaxTokenApproval) {
682
693
  return __async(this, null, function* () {
683
694
  var _a;
684
695
  if (this.walletClient === void 0) {
@@ -694,7 +705,7 @@ var ViemClient = class {
694
705
  signerAddress,
695
706
  spender
696
707
  );
697
- if (allowance < amount) {
708
+ if (allowance < amount || allowMaxTokenApproval) {
698
709
  const txn = yield this.walletClient.sendTransaction({
699
710
  to: token2.address,
700
711
  account: signerAddress,
@@ -703,7 +714,7 @@ var ViemClient = class {
703
714
  data: (0, import_viem2.encodeFunctionData)({
704
715
  abi: (0, import_viem2.parseAbi)(["function approve(address,uint)"]),
705
716
  functionName: "approve",
706
- args: [spender, amount]
717
+ args: [spender, allowMaxTokenApproval ? import_viem2.maxUint256 : amount]
707
718
  })
708
719
  });
709
720
  const receipt = yield this.publicClient().waitForTransactionReceipt({
@@ -1234,7 +1245,8 @@ var ActaAccount = class {
1234
1245
  token: tokenSymbol,
1235
1246
  amount,
1236
1247
  receiver,
1237
- feeInclusive
1248
+ feeInclusive,
1249
+ allowMaxTokenApproval
1238
1250
  } = singlePaymentParams;
1239
1251
  if (amount <= BigInt(0)) {
1240
1252
  throw new Error("Amount must be greater than 0.");
@@ -1271,7 +1283,8 @@ var ActaAccount = class {
1271
1283
  yield viemClient.checkAndApproveToken(
1272
1284
  token2,
1273
1285
  smartAccountAddress,
1274
- amountToTransfer
1286
+ amountToTransfer,
1287
+ allowMaxTokenApproval != null ? allowMaxTokenApproval : false
1275
1288
  );
1276
1289
  const userOperation = yield accountClient.prepareUserOperation({
1277
1290
  calls: [
@@ -1337,7 +1350,8 @@ var ActaAccount = class {
1337
1350
  count,
1338
1351
  intervalUnit,
1339
1352
  startDate,
1340
- endDate
1353
+ endDate,
1354
+ allowMaxTokenApproval
1341
1355
  } = recurringPaymentParams;
1342
1356
  if (amount <= BigInt(0)) {
1343
1357
  throw new Error("Amount must be greater than 0.");
@@ -1396,7 +1410,8 @@ var ActaAccount = class {
1396
1410
  yield viemClient.checkAndApproveToken(
1397
1411
  token2,
1398
1412
  smartAccountAddress,
1399
- amountToTransfer * BigInt(paymentCount) + estimatedGasCostInToken * BigInt(2) * BigInt(paymentCount)
1413
+ amountToTransfer * BigInt(paymentCount) + estimatedGasCostInToken * BigInt(2) * BigInt(paymentCount),
1414
+ allowMaxTokenApproval != null ? allowMaxTokenApproval : false
1400
1415
  );
1401
1416
  const callPolicy = (0, import_policies2.toCallPolicy)({
1402
1417
  policyVersion: import_policies2.CallPolicyVersion.V0_0_4,
@@ -1609,7 +1624,8 @@ var ActaDeposit = class {
1609
1624
  this.depositSessionId = "";
1610
1625
  this.status = "not_started";
1611
1626
  this.serviceType = "deposit";
1612
- var _a;
1627
+ this.allowMaxTokenApproval = false;
1628
+ var _a, _b;
1613
1629
  this.connectorType = parameters.connectorType;
1614
1630
  this.walletClient = parameters.walletClient;
1615
1631
  this.signerAddress = parameters.signerAddress;
@@ -1624,6 +1640,7 @@ var ActaDeposit = class {
1624
1640
  this.startDate = parameters.startDate;
1625
1641
  this.endDate = parameters.endDate;
1626
1642
  this.depositSessionId = (_a = parameters.depositSessionId) != null ? _a : "";
1643
+ this.allowMaxTokenApproval = (_b = parameters.allowMaxTokenApproval) != null ? _b : false;
1627
1644
  this.viemClient = new ViemClient(this.chainId, this.walletClient);
1628
1645
  this.account = new ActaAccount(
1629
1646
  this.chainId,
@@ -1787,7 +1804,8 @@ var ActaDeposit = class {
1787
1804
  token: tokenSymbol,
1788
1805
  amount,
1789
1806
  receiver,
1790
- feeInclusive
1807
+ feeInclusive,
1808
+ allowMaxTokenApproval: this.allowMaxTokenApproval
1791
1809
  });
1792
1810
  const txn = yield executeSinglePaymentAPICall(
1793
1811
  `${transactionServiceUrl}execute/single`,
@@ -1879,7 +1897,8 @@ var ActaDeposit = class {
1879
1897
  intervalUnit,
1880
1898
  startDate,
1881
1899
  endDate,
1882
- receiver
1900
+ receiver,
1901
+ allowMaxTokenApproval: this.allowMaxTokenApproval
1883
1902
  });
1884
1903
  const txn = yield scheduleRecurringPaymentsAPICall(
1885
1904
  `${transactionServiceUrl}schedule/recurring`,
@@ -1948,6 +1967,7 @@ var ActaDeposit = class {
1948
1967
  getPeriodInterval,
1949
1968
  getPimlicoRpcByChainId,
1950
1969
  getRpcByChainId,
1970
+ getTokenByChainIdAndAddress,
1951
1971
  getTokenByChainIdAndSymbol,
1952
1972
  isKernelVersionAfter,
1953
1973
  isPermissionValidatorPlugin,
package/dist/index.d.cts CHANGED
@@ -19,14 +19,14 @@ import { KernelSmartAccountImplementation } from '@zerodev/sdk/accounts';
19
19
  import * as viem__types_actions_siwe_verifySiweMessage_js from 'viem/_types/actions/siwe/verifySiweMessage.js';
20
20
 
21
21
  declare enum TokenLogo {
22
- ETH = "https://pay.daimo.com/chain-logos/ethereum.png",
23
- WETH = "https://pay.daimo.com/coin-logos/weth.png",
24
- USDC = "https://pay.daimo.com/coin-logos/usdc.png",
25
- EURC = "https://pay.daimo.com/coin-logos/eurc.png",
26
- USDT = "https://pay.daimo.com/coin-logos/usdt.png",
27
- DAI = "https://pay.daimo.com/coin-logos/dai.png",
28
- POL = "https://pay.daimo.com/coin-logos/pol.png",
29
- BNB = "https://pay.daimo.com/coin-logos/bnb.png"
22
+ ETH = "https://api.acta.link/deposit/v1/logos/ethereum.png",
23
+ WETH = "https://api.acta.link/deposit/v1/logos/weth.png",
24
+ USDC = "https://api.acta.link/deposit/v1/logos/usdc.png",
25
+ EURC = "https://api.acta.link/deposit/v1/logos/eurc.png",
26
+ USDT = "https://api.acta.link/deposit/v1/logos/usdt.png",
27
+ DAI = "https://api.acta.link/deposit/v1/logos/dai.png",
28
+ POL = "https://api.acta.link/deposit/v1/logos/pol.png",
29
+ BNB = "https://api.acta.link/deposit/v1/logos/bnb.png"
30
30
  }
31
31
  type Token = {
32
32
  chainId: number;
@@ -60,6 +60,7 @@ interface AbstractPaymentParams {
60
60
  }
61
61
  interface DepositClassParams extends AbstractPaymentParams {
62
62
  depositSessionId?: string;
63
+ allowMaxTokenApproval?: boolean;
63
64
  }
64
65
  type EstimateSinglePaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams">;
65
66
  type ModularSigner = {
@@ -120,9 +121,12 @@ type PermissionAccountParams = {
120
121
  privateKey?: Hex;
121
122
  eip7702Auth?: SignAuthorizationReturnType;
122
123
  };
123
- type SinglePaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "serviceUrl" | "serviceSessionParams" | "count" | "intervalUnit" | "startDate" | "endDate" | "paymentType">;
124
+ type SinglePaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "serviceUrl" | "serviceSessionParams" | "count" | "intervalUnit" | "startDate" | "endDate" | "paymentType"> & {
125
+ allowMaxTokenApproval?: boolean;
126
+ };
124
127
  type RecurringPaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "serviceUrl" | "serviceSessionParams"> & {
125
128
  endDate?: number;
129
+ allowMaxTokenApproval?: boolean;
126
130
  };
127
131
 
128
132
  declare const arbitrumETH: Token;
@@ -177,6 +181,7 @@ declare function token({ chainId, address, name, symbol, decimals, fiatISO, logo
177
181
  }): Token;
178
182
  declare function getTokenByChainIdAndSymbol(chainId: number, symbol: string): Token | undefined;
179
183
  declare const tokensCommonSymbols: string[];
184
+ declare function getTokenByChainIdAndAddress(chainId: number, address: Address): Token | undefined;
180
185
 
181
186
  declare const supportedChains: Chain[];
182
187
  declare function getChainById(chainId: number): Chain | undefined;
@@ -202,6 +207,7 @@ declare class ActaDeposit {
202
207
  private readonly account;
203
208
  private readonly viemClient;
204
209
  private readonly serviceType;
210
+ private readonly allowMaxTokenApproval;
205
211
  constructor(parameters: DepositClassParams);
206
212
  createSession(serviceSessionparams: {
207
213
  projectId: string;
@@ -9180,7 +9186,7 @@ declare class ViemClient {
9180
9186
  } & viem.ExactPartial<Pick<viem.PublicActions<viem.HttpTransport<undefined, false>, viem.Chain | undefined, undefined>, "call" | "getChainId" | "prepareTransactionRequest" | "sendRawTransaction" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<viem.WalletActions<viem.Chain | undefined, undefined>, "sendTransaction" | "writeContract">>>(fn: (client: viem.Client<viem.HttpTransport<undefined, false>, viem.Chain | undefined, undefined, viem.PublicRpcSchema, viem.PublicActions<viem.HttpTransport<undefined, false>, viem.Chain | undefined>>) => client) => viem.Client<viem.HttpTransport<undefined, false>, viem.Chain | undefined, undefined, viem.PublicRpcSchema, { [K in keyof client]: client[K]; } & viem.PublicActions<viem.HttpTransport<undefined, false>, viem.Chain | undefined>>;
9181
9187
  };
9182
9188
  checkTokenAllowance(token: Token, owner: Address, spender: Address): Promise<bigint>;
9183
- checkAndApproveToken(token: Token, spender: Address, amount: bigint): Promise<bigint>;
9189
+ checkAndApproveToken(token: Token, spender: Address, amount: bigint, allowMaxTokenApproval: boolean): Promise<bigint>;
9184
9190
  }
9185
9191
 
9186
9192
  declare function getRpcByChainId(chainId: number): string | undefined;
@@ -9239,4 +9245,4 @@ declare function executeSinglePaymentAPICall(url: string, userOperation: RpcUser
9239
9245
  serviceType: string;
9240
9246
  }, serviceParams: any): Promise<any>;
9241
9247
 
9242
- export { type AbstractPaymentParams, ActaAccount, ActaDeposit, ConnectorType, type DepositClassParams, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeSinglePaymentAPICall, getChainById, getChainExplorerByChainId, getPeriodInterval, getPimlicoRpcByChainId, getRpcByChainId, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, sendRequest, serializePermissionAccount, serializePermissionAccountParams, supportedChains, supportedTokensByChain, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
9248
+ export { type AbstractPaymentParams, ActaAccount, ActaDeposit, ConnectorType, type DepositClassParams, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeSinglePaymentAPICall, getChainById, getChainExplorerByChainId, getPeriodInterval, getPimlicoRpcByChainId, getRpcByChainId, getTokenByChainIdAndAddress, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, sendRequest, serializePermissionAccount, serializePermissionAccountParams, supportedChains, supportedTokensByChain, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
package/dist/index.d.ts CHANGED
@@ -19,14 +19,14 @@ import { KernelSmartAccountImplementation } from '@zerodev/sdk/accounts';
19
19
  import * as viem__types_actions_siwe_verifySiweMessage_js from 'viem/_types/actions/siwe/verifySiweMessage.js';
20
20
 
21
21
  declare enum TokenLogo {
22
- ETH = "https://pay.daimo.com/chain-logos/ethereum.png",
23
- WETH = "https://pay.daimo.com/coin-logos/weth.png",
24
- USDC = "https://pay.daimo.com/coin-logos/usdc.png",
25
- EURC = "https://pay.daimo.com/coin-logos/eurc.png",
26
- USDT = "https://pay.daimo.com/coin-logos/usdt.png",
27
- DAI = "https://pay.daimo.com/coin-logos/dai.png",
28
- POL = "https://pay.daimo.com/coin-logos/pol.png",
29
- BNB = "https://pay.daimo.com/coin-logos/bnb.png"
22
+ ETH = "https://api.acta.link/deposit/v1/logos/ethereum.png",
23
+ WETH = "https://api.acta.link/deposit/v1/logos/weth.png",
24
+ USDC = "https://api.acta.link/deposit/v1/logos/usdc.png",
25
+ EURC = "https://api.acta.link/deposit/v1/logos/eurc.png",
26
+ USDT = "https://api.acta.link/deposit/v1/logos/usdt.png",
27
+ DAI = "https://api.acta.link/deposit/v1/logos/dai.png",
28
+ POL = "https://api.acta.link/deposit/v1/logos/pol.png",
29
+ BNB = "https://api.acta.link/deposit/v1/logos/bnb.png"
30
30
  }
31
31
  type Token = {
32
32
  chainId: number;
@@ -60,6 +60,7 @@ interface AbstractPaymentParams {
60
60
  }
61
61
  interface DepositClassParams extends AbstractPaymentParams {
62
62
  depositSessionId?: string;
63
+ allowMaxTokenApproval?: boolean;
63
64
  }
64
65
  type EstimateSinglePaymentGasParameters = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "count" | "intervalUnit" | "startDate" | "endDate" | "serviceUrl" | "serviceParams" | "serviceSessionParams">;
65
66
  type ModularSigner = {
@@ -120,9 +121,12 @@ type PermissionAccountParams = {
120
121
  privateKey?: Hex;
121
122
  eip7702Auth?: SignAuthorizationReturnType;
122
123
  };
123
- type SinglePaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "serviceUrl" | "serviceSessionParams" | "count" | "intervalUnit" | "startDate" | "endDate" | "paymentType">;
124
+ type SinglePaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "serviceUrl" | "serviceSessionParams" | "count" | "intervalUnit" | "startDate" | "endDate" | "paymentType"> & {
125
+ allowMaxTokenApproval?: boolean;
126
+ };
124
127
  type RecurringPaymentParamsType = Omit<AbstractPaymentParams, "connectorType" | "signer" | "walletClient" | "serviceType" | "paymentType" | "serviceUrl" | "serviceSessionParams"> & {
125
128
  endDate?: number;
129
+ allowMaxTokenApproval?: boolean;
126
130
  };
127
131
 
128
132
  declare const arbitrumETH: Token;
@@ -177,6 +181,7 @@ declare function token({ chainId, address, name, symbol, decimals, fiatISO, logo
177
181
  }): Token;
178
182
  declare function getTokenByChainIdAndSymbol(chainId: number, symbol: string): Token | undefined;
179
183
  declare const tokensCommonSymbols: string[];
184
+ declare function getTokenByChainIdAndAddress(chainId: number, address: Address): Token | undefined;
180
185
 
181
186
  declare const supportedChains: Chain[];
182
187
  declare function getChainById(chainId: number): Chain | undefined;
@@ -202,6 +207,7 @@ declare class ActaDeposit {
202
207
  private readonly account;
203
208
  private readonly viemClient;
204
209
  private readonly serviceType;
210
+ private readonly allowMaxTokenApproval;
205
211
  constructor(parameters: DepositClassParams);
206
212
  createSession(serviceSessionparams: {
207
213
  projectId: string;
@@ -9180,7 +9186,7 @@ declare class ViemClient {
9180
9186
  } & viem.ExactPartial<Pick<viem.PublicActions<viem.HttpTransport<undefined, false>, viem.Chain | undefined, undefined>, "call" | "getChainId" | "prepareTransactionRequest" | "sendRawTransaction" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "readContract" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<viem.WalletActions<viem.Chain | undefined, undefined>, "sendTransaction" | "writeContract">>>(fn: (client: viem.Client<viem.HttpTransport<undefined, false>, viem.Chain | undefined, undefined, viem.PublicRpcSchema, viem.PublicActions<viem.HttpTransport<undefined, false>, viem.Chain | undefined>>) => client) => viem.Client<viem.HttpTransport<undefined, false>, viem.Chain | undefined, undefined, viem.PublicRpcSchema, { [K in keyof client]: client[K]; } & viem.PublicActions<viem.HttpTransport<undefined, false>, viem.Chain | undefined>>;
9181
9187
  };
9182
9188
  checkTokenAllowance(token: Token, owner: Address, spender: Address): Promise<bigint>;
9183
- checkAndApproveToken(token: Token, spender: Address, amount: bigint): Promise<bigint>;
9189
+ checkAndApproveToken(token: Token, spender: Address, amount: bigint, allowMaxTokenApproval: boolean): Promise<bigint>;
9184
9190
  }
9185
9191
 
9186
9192
  declare function getRpcByChainId(chainId: number): string | undefined;
@@ -9239,4 +9245,4 @@ declare function executeSinglePaymentAPICall(url: string, userOperation: RpcUser
9239
9245
  serviceType: string;
9240
9246
  }, serviceParams: any): Promise<any>;
9241
9247
 
9242
- export { type AbstractPaymentParams, ActaAccount, ActaDeposit, ConnectorType, type DepositClassParams, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeSinglePaymentAPICall, getChainById, getChainExplorerByChainId, getPeriodInterval, getPimlicoRpcByChainId, getRpcByChainId, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, sendRequest, serializePermissionAccount, serializePermissionAccountParams, supportedChains, supportedTokensByChain, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
9248
+ export { type AbstractPaymentParams, ActaAccount, ActaDeposit, ConnectorType, type DepositClassParams, type EstimateSinglePaymentGasParameters, type ExportPermissionAccountParams, HttpMethod, type ModularSigner, type PermissionAccountParams, type PermissionData, type PermissionPlugin, type PermissionPluginParams, type Policy, PolicyFlags, type PolicyParams, type RecurringPaymentParamsType, type SinglePaymentParamsType, type Token, TokenLogo, ViemClient, arbitrumDAI, arbitrumETH, arbitrumUSDC, arbitrumUSDCe, arbitrumUSDT, arbitrumWETH, base64ToBytes, baseDAI, baseETH, baseEURC, baseUSDC, baseUSDT, baseUSDbC, baseWETH, bscBNB, bscUSDC, bscUSDT, bscWBNB, bytesToBase64, createPolicyFromParams, createSessionAPICall, decodeParamsFromInitCode, deserializePermissionAccount, deserializePermissionAccountParams, ethereumDAI, ethereumETH, ethereumEURC, ethereumUSDC, ethereumUSDT, ethereumWETH, executeSinglePaymentAPICall, getChainById, getChainExplorerByChainId, getPeriodInterval, getPimlicoRpcByChainId, getRpcByChainId, getTokenByChainIdAndAddress, getTokenByChainIdAndSymbol, isKernelVersionAfter, isPermissionValidatorPlugin, lineaDAI, lineaETH, lineaUSDC, lineaWETH, optimismDAI, optimismETH, optimismUSDC, optimismUSDCe, optimismUSDT, optimismWETH, polygonDAI, polygonPOL, polygonUSDC, polygonUSDCe, polygonUSDT, polygonWETH, polygonWPOL, scheduleRecurringPaymentsAPICall, sendRequest, serializePermissionAccount, serializePermissionAccountParams, supportedChains, supportedTokensByChain, toECDSASigner, toPermissionValidator, toPolicyId, toSignerId, token, tokensCommonSymbols, verifySessionAPICall };
package/dist/index.js CHANGED
@@ -86,14 +86,14 @@ function getChainExplorerByChainId(chainId) {
86
86
 
87
87
  // src/types.ts
88
88
  var TokenLogo = /* @__PURE__ */ ((TokenLogo2) => {
89
- TokenLogo2["ETH"] = "https://pay.daimo.com/chain-logos/ethereum.png";
90
- TokenLogo2["WETH"] = "https://pay.daimo.com/coin-logos/weth.png";
91
- TokenLogo2["USDC"] = "https://pay.daimo.com/coin-logos/usdc.png";
92
- TokenLogo2["EURC"] = "https://pay.daimo.com/coin-logos/eurc.png";
93
- TokenLogo2["USDT"] = "https://pay.daimo.com/coin-logos/usdt.png";
94
- TokenLogo2["DAI"] = "https://pay.daimo.com/coin-logos/dai.png";
95
- TokenLogo2["POL"] = "https://pay.daimo.com/coin-logos/pol.png";
96
- TokenLogo2["BNB"] = "https://pay.daimo.com/coin-logos/bnb.png";
89
+ TokenLogo2["ETH"] = "https://api.acta.link/deposit/v1/logos/ethereum.png";
90
+ TokenLogo2["WETH"] = "https://api.acta.link/deposit/v1/logos/weth.png";
91
+ TokenLogo2["USDC"] = "https://api.acta.link/deposit/v1/logos/usdc.png";
92
+ TokenLogo2["EURC"] = "https://api.acta.link/deposit/v1/logos/eurc.png";
93
+ TokenLogo2["USDT"] = "https://api.acta.link/deposit/v1/logos/usdt.png";
94
+ TokenLogo2["DAI"] = "https://api.acta.link/deposit/v1/logos/dai.png";
95
+ TokenLogo2["POL"] = "https://api.acta.link/deposit/v1/logos/pol.png";
96
+ TokenLogo2["BNB"] = "https://api.acta.link/deposit/v1/logos/bnb.png";
97
97
  return TokenLogo2;
98
98
  })(TokenLogo || {});
99
99
  var ConnectorType = /* @__PURE__ */ ((ConnectorType2) => {
@@ -116,7 +116,7 @@ var arbitrumWETH = token({
116
116
  decimals: 18,
117
117
  name: "Wrapped Ether",
118
118
  symbol: "WETH",
119
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
119
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
120
120
  });
121
121
  var arbitrumUSDC = token({
122
122
  chainId: arbitrum2.id,
@@ -125,7 +125,7 @@ var arbitrumUSDC = token({
125
125
  symbol: "USDC",
126
126
  fiatISO: "USD",
127
127
  decimals: 6,
128
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
128
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
129
129
  });
130
130
  var arbitrumDAI = token({
131
131
  chainId: arbitrum2.id,
@@ -134,7 +134,7 @@ var arbitrumDAI = token({
134
134
  fiatISO: "USD",
135
135
  name: "Dai Stablecoin",
136
136
  symbol: "DAI",
137
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
137
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
138
138
  });
139
139
  var arbitrumUSDT = token({
140
140
  chainId: arbitrum2.id,
@@ -143,7 +143,7 @@ var arbitrumUSDT = token({
143
143
  fiatISO: "USD",
144
144
  name: "Tether USD",
145
145
  symbol: "USDT",
146
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
146
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
147
147
  });
148
148
  var arbitrumUSDCe = token({
149
149
  chainId: arbitrum2.id,
@@ -152,7 +152,7 @@ var arbitrumUSDCe = token({
152
152
  fiatISO: "USD",
153
153
  name: "Bridged USD Coin",
154
154
  symbol: "USDCe",
155
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
155
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
156
156
  });
157
157
  var arbitrumTokens = [arbitrumUSDC, arbitrumUSDT];
158
158
  var baseETH = nativeETH(base2.id);
@@ -162,7 +162,7 @@ var baseWETH = token({
162
162
  decimals: 18,
163
163
  name: "Wrapped Ether",
164
164
  symbol: "WETH",
165
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
165
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
166
166
  });
167
167
  var baseUSDC = token({
168
168
  chainId: base2.id,
@@ -171,7 +171,7 @@ var baseUSDC = token({
171
171
  symbol: "USDC",
172
172
  fiatISO: "USD",
173
173
  decimals: 6,
174
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
174
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
175
175
  });
176
176
  var baseEURC = token({
177
177
  chainId: base2.id,
@@ -180,7 +180,7 @@ var baseEURC = token({
180
180
  fiatISO: "EUR",
181
181
  name: "EURC",
182
182
  symbol: "EURC",
183
- logoURI: "https://pay.daimo.com/coin-logos/eurc.png" /* EURC */
183
+ logoURI: "https://api.acta.link/deposit/v1/logos/eurc.png" /* EURC */
184
184
  });
185
185
  var baseUSDbC = token({
186
186
  chainId: base2.id,
@@ -189,7 +189,7 @@ var baseUSDbC = token({
189
189
  symbol: "USDbC",
190
190
  fiatISO: "USD",
191
191
  decimals: 6,
192
- logoURI: "https://pay.daimo.com/coin-logos/usdbc.png"
192
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdbc.png"
193
193
  });
194
194
  var baseDAI = token({
195
195
  chainId: base2.id,
@@ -198,7 +198,7 @@ var baseDAI = token({
198
198
  symbol: "DAI",
199
199
  fiatISO: "USD",
200
200
  decimals: 18,
201
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
201
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
202
202
  });
203
203
  var baseUSDT = token({
204
204
  chainId: base2.id,
@@ -207,14 +207,14 @@ var baseUSDT = token({
207
207
  symbol: "USDT",
208
208
  fiatISO: "USD",
209
209
  decimals: 6,
210
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
210
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
211
211
  });
212
212
  var baseTokens = [baseUSDC, baseUSDT];
213
213
  var bscBNB = nativeToken({
214
214
  chainId: bsc2.id,
215
215
  name: "BNB",
216
216
  symbol: "BNB",
217
- logoURI: "https://pay.daimo.com/coin-logos/bnb.png" /* BNB */
217
+ logoURI: "https://api.acta.link/deposit/v1/logos/bnb.png" /* BNB */
218
218
  });
219
219
  var bscWBNB = token({
220
220
  chainId: bsc2.id,
@@ -222,7 +222,7 @@ var bscWBNB = token({
222
222
  decimals: 18,
223
223
  name: "Wrapped BNB",
224
224
  symbol: "WBNB",
225
- logoURI: "https://pay.daimo.com/coin-logos/bnb.png" /* BNB */
225
+ logoURI: "https://api.acta.link/deposit/v1/logos/bnb.png" /* BNB */
226
226
  });
227
227
  var bscUSDC = token({
228
228
  chainId: bsc2.id,
@@ -231,7 +231,7 @@ var bscUSDC = token({
231
231
  fiatISO: "USD",
232
232
  name: "USD Coin",
233
233
  symbol: "USDC",
234
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
234
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
235
235
  });
236
236
  var bscUSDT = token({
237
237
  chainId: bsc2.id,
@@ -240,7 +240,7 @@ var bscUSDT = token({
240
240
  fiatISO: "USD",
241
241
  name: "Tether USD",
242
242
  symbol: "USDT",
243
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
243
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
244
244
  });
245
245
  var bscTokens = [bscUSDT];
246
246
  var ethereumETH = nativeETH(mainnet2.id);
@@ -250,7 +250,7 @@ var ethereumWETH = token({
250
250
  decimals: 18,
251
251
  name: "Wrapped Ether",
252
252
  symbol: "WETH",
253
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
253
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
254
254
  });
255
255
  var ethereumUSDC = token({
256
256
  chainId: mainnet2.id,
@@ -259,7 +259,7 @@ var ethereumUSDC = token({
259
259
  fiatISO: "USD",
260
260
  name: "USD Coin",
261
261
  symbol: "USDC",
262
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
262
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
263
263
  });
264
264
  var ethereumDAI = token({
265
265
  chainId: mainnet2.id,
@@ -268,7 +268,7 @@ var ethereumDAI = token({
268
268
  fiatISO: "USD",
269
269
  name: "Dai Stablecoin",
270
270
  symbol: "DAI",
271
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
271
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
272
272
  });
273
273
  var ethereumUSDT = token({
274
274
  chainId: mainnet2.id,
@@ -277,7 +277,7 @@ var ethereumUSDT = token({
277
277
  fiatISO: "USD",
278
278
  name: "Tether USD",
279
279
  symbol: "USDT",
280
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
280
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
281
281
  });
282
282
  var ethereumEURC = token({
283
283
  chainId: mainnet2.id,
@@ -286,7 +286,7 @@ var ethereumEURC = token({
286
286
  fiatISO: "EUR",
287
287
  name: "EURC",
288
288
  symbol: "EURC",
289
- logoURI: "https://pay.daimo.com/coin-logos/eurc.png" /* EURC */
289
+ logoURI: "https://api.acta.link/deposit/v1/logos/eurc.png" /* EURC */
290
290
  });
291
291
  var ethereumTokens = [ethereumUSDC, ethereumUSDT];
292
292
  var lineaETH = nativeETH(linea.id);
@@ -296,7 +296,7 @@ var lineaWETH = token({
296
296
  decimals: 18,
297
297
  name: "Wrapped Ether",
298
298
  symbol: "WETH",
299
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
299
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
300
300
  });
301
301
  var lineaUSDC = token({
302
302
  chainId: linea.id,
@@ -305,7 +305,7 @@ var lineaUSDC = token({
305
305
  fiatISO: "USD",
306
306
  name: "USD Coin",
307
307
  symbol: "USDC",
308
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
308
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
309
309
  });
310
310
  var lineaDAI = token({
311
311
  chainId: linea.id,
@@ -314,7 +314,7 @@ var lineaDAI = token({
314
314
  fiatISO: "USD",
315
315
  name: "Dai Stablecoin",
316
316
  symbol: "DAI",
317
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
317
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
318
318
  });
319
319
  var optimismETH = nativeETH(optimism2.id);
320
320
  var optimismWETH = token({
@@ -323,7 +323,7 @@ var optimismWETH = token({
323
323
  decimals: 18,
324
324
  name: "Wrapped Ether",
325
325
  symbol: "WETH",
326
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
326
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
327
327
  });
328
328
  var optimismUSDC = token({
329
329
  chainId: optimism2.id,
@@ -332,7 +332,7 @@ var optimismUSDC = token({
332
332
  fiatISO: "USD",
333
333
  name: "USD Coin",
334
334
  symbol: "USDC",
335
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
335
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
336
336
  });
337
337
  var optimismDAI = token({
338
338
  chainId: optimism2.id,
@@ -341,7 +341,7 @@ var optimismDAI = token({
341
341
  fiatISO: "USD",
342
342
  name: "Dai Stablecoin",
343
343
  symbol: "DAI",
344
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
344
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
345
345
  });
346
346
  var optimismUSDT = token({
347
347
  chainId: optimism2.id,
@@ -350,7 +350,7 @@ var optimismUSDT = token({
350
350
  fiatISO: "USD",
351
351
  name: "Tether USD",
352
352
  symbol: "USDT",
353
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
353
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
354
354
  });
355
355
  var optimismUSDCe = token({
356
356
  chainId: optimism2.id,
@@ -359,14 +359,14 @@ var optimismUSDCe = token({
359
359
  fiatISO: "USD",
360
360
  name: "Bridged USD Coin",
361
361
  symbol: "USDCe",
362
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
362
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
363
363
  });
364
364
  var optimismTokens = [optimismUSDC, optimismUSDT];
365
365
  var polygonPOL = nativeToken({
366
366
  chainId: polygon2.id,
367
367
  name: "Polygon",
368
368
  symbol: "POL",
369
- logoURI: "https://pay.daimo.com/coin-logos/pol.png" /* POL */
369
+ logoURI: "https://api.acta.link/deposit/v1/logos/pol.png" /* POL */
370
370
  });
371
371
  var polygonWPOL = token({
372
372
  chainId: polygon2.id,
@@ -374,7 +374,7 @@ var polygonWPOL = token({
374
374
  decimals: 18,
375
375
  name: "Wrapped Polygon",
376
376
  symbol: "WPOL",
377
- logoURI: "https://pay.daimo.com/coin-logos/pol.png" /* POL */
377
+ logoURI: "https://api.acta.link/deposit/v1/logos/pol.png" /* POL */
378
378
  });
379
379
  var polygonWETH = token({
380
380
  chainId: polygon2.id,
@@ -382,7 +382,7 @@ var polygonWETH = token({
382
382
  decimals: 18,
383
383
  name: "Wrapped Ether",
384
384
  symbol: "WETH",
385
- logoURI: "https://pay.daimo.com/coin-logos/weth.png" /* WETH */
385
+ logoURI: "https://api.acta.link/deposit/v1/logos/weth.png" /* WETH */
386
386
  });
387
387
  var polygonUSDC = token({
388
388
  chainId: polygon2.id,
@@ -391,7 +391,7 @@ var polygonUSDC = token({
391
391
  fiatISO: "USD",
392
392
  name: "USD Coin",
393
393
  symbol: "USDC",
394
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
394
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
395
395
  });
396
396
  var polygonDAI = token({
397
397
  chainId: polygon2.id,
@@ -400,7 +400,7 @@ var polygonDAI = token({
400
400
  fiatISO: "USD",
401
401
  name: "Dai Stablecoin",
402
402
  symbol: "DAI",
403
- logoURI: "https://pay.daimo.com/coin-logos/dai.png" /* DAI */
403
+ logoURI: "https://api.acta.link/deposit/v1/logos/dai.png" /* DAI */
404
404
  });
405
405
  var polygonUSDT = token({
406
406
  chainId: polygon2.id,
@@ -409,7 +409,7 @@ var polygonUSDT = token({
409
409
  fiatISO: "USD",
410
410
  name: "Tether USD",
411
411
  symbol: "USDT",
412
- logoURI: "https://pay.daimo.com/coin-logos/usdt.png" /* USDT */
412
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdt.png" /* USDT */
413
413
  });
414
414
  var polygonUSDCe = token({
415
415
  chainId: polygon2.id,
@@ -418,7 +418,7 @@ var polygonUSDCe = token({
418
418
  fiatISO: "USD",
419
419
  name: "USD Coin (PoS)",
420
420
  symbol: "USDCe",
421
- logoURI: "https://pay.daimo.com/coin-logos/usdc.png" /* USDC */
421
+ logoURI: "https://api.acta.link/deposit/v1/logos/usdc.png" /* USDC */
422
422
  });
423
423
  var polygonTokens = [polygonUSDC, polygonUSDT];
424
424
  var supportedTokensByChain = /* @__PURE__ */ new Map([
@@ -440,7 +440,7 @@ function nativeETH(chainId) {
440
440
  chainId,
441
441
  name: "Ether",
442
442
  symbol: "ETH",
443
- logoURI: "https://pay.daimo.com/chain-logos/ethereum.png" /* ETH */
443
+ logoURI: "https://api.acta.link/deposit/v1/logos/ethereum.png" /* ETH */
444
444
  });
445
445
  }
446
446
  function nativeToken({
@@ -505,6 +505,16 @@ var tokensCommonSymbols = [
505
505
  "POL",
506
506
  "WPOL"
507
507
  ];
508
+ function getTokenByChainIdAndAddress(chainId, address) {
509
+ const chain = getChainById(chainId);
510
+ if (!chain) throw new Error(`Chain ${chainId} not supported.`);
511
+ const tokens = supportedTokensByChain.get(chain.id);
512
+ if (!tokens) throw new Error(`Tokens not found for chain ${chainId}.`);
513
+ const token2 = tokens.find((t) => t.address === address);
514
+ if (!token2)
515
+ throw new Error(`Token ${address} not found for chain ${chainId}.`);
516
+ return token2;
517
+ }
508
518
 
509
519
  // src/deposit.ts
510
520
  import { toHex as toHex2, zeroAddress as zeroAddress4 } from "viem";
@@ -574,7 +584,8 @@ import {
574
584
  http,
575
585
  createPublicClient,
576
586
  parseAbi,
577
- encodeFunctionData
587
+ encodeFunctionData,
588
+ maxUint256
578
589
  } from "viem";
579
590
  var ViemClient = class {
580
591
  constructor(chainId, walletClient) {
@@ -600,7 +611,7 @@ var ViemClient = class {
600
611
  return allowance;
601
612
  });
602
613
  }
603
- checkAndApproveToken(token2, spender, amount) {
614
+ checkAndApproveToken(token2, spender, amount, allowMaxTokenApproval) {
604
615
  return __async(this, null, function* () {
605
616
  var _a;
606
617
  if (this.walletClient === void 0) {
@@ -616,7 +627,7 @@ var ViemClient = class {
616
627
  signerAddress,
617
628
  spender
618
629
  );
619
- if (allowance < amount) {
630
+ if (allowance < amount || allowMaxTokenApproval) {
620
631
  const txn = yield this.walletClient.sendTransaction({
621
632
  to: token2.address,
622
633
  account: signerAddress,
@@ -625,7 +636,7 @@ var ViemClient = class {
625
636
  data: encodeFunctionData({
626
637
  abi: parseAbi(["function approve(address,uint)"]),
627
638
  functionName: "approve",
628
- args: [spender, amount]
639
+ args: [spender, allowMaxTokenApproval ? maxUint256 : amount]
629
640
  })
630
641
  });
631
642
  const receipt = yield this.publicClient().waitForTransactionReceipt({
@@ -1190,7 +1201,8 @@ var ActaAccount = class {
1190
1201
  token: tokenSymbol,
1191
1202
  amount,
1192
1203
  receiver,
1193
- feeInclusive
1204
+ feeInclusive,
1205
+ allowMaxTokenApproval
1194
1206
  } = singlePaymentParams;
1195
1207
  if (amount <= BigInt(0)) {
1196
1208
  throw new Error("Amount must be greater than 0.");
@@ -1227,7 +1239,8 @@ var ActaAccount = class {
1227
1239
  yield viemClient.checkAndApproveToken(
1228
1240
  token2,
1229
1241
  smartAccountAddress,
1230
- amountToTransfer
1242
+ amountToTransfer,
1243
+ allowMaxTokenApproval != null ? allowMaxTokenApproval : false
1231
1244
  );
1232
1245
  const userOperation = yield accountClient.prepareUserOperation({
1233
1246
  calls: [
@@ -1293,7 +1306,8 @@ var ActaAccount = class {
1293
1306
  count,
1294
1307
  intervalUnit,
1295
1308
  startDate,
1296
- endDate
1309
+ endDate,
1310
+ allowMaxTokenApproval
1297
1311
  } = recurringPaymentParams;
1298
1312
  if (amount <= BigInt(0)) {
1299
1313
  throw new Error("Amount must be greater than 0.");
@@ -1352,7 +1366,8 @@ var ActaAccount = class {
1352
1366
  yield viemClient.checkAndApproveToken(
1353
1367
  token2,
1354
1368
  smartAccountAddress,
1355
- amountToTransfer * BigInt(paymentCount) + estimatedGasCostInToken * BigInt(2) * BigInt(paymentCount)
1369
+ amountToTransfer * BigInt(paymentCount) + estimatedGasCostInToken * BigInt(2) * BigInt(paymentCount),
1370
+ allowMaxTokenApproval != null ? allowMaxTokenApproval : false
1356
1371
  );
1357
1372
  const callPolicy = toCallPolicy2({
1358
1373
  policyVersion: CallPolicyVersion.V0_0_4,
@@ -1565,7 +1580,8 @@ var ActaDeposit = class {
1565
1580
  this.depositSessionId = "";
1566
1581
  this.status = "not_started";
1567
1582
  this.serviceType = "deposit";
1568
- var _a;
1583
+ this.allowMaxTokenApproval = false;
1584
+ var _a, _b;
1569
1585
  this.connectorType = parameters.connectorType;
1570
1586
  this.walletClient = parameters.walletClient;
1571
1587
  this.signerAddress = parameters.signerAddress;
@@ -1580,6 +1596,7 @@ var ActaDeposit = class {
1580
1596
  this.startDate = parameters.startDate;
1581
1597
  this.endDate = parameters.endDate;
1582
1598
  this.depositSessionId = (_a = parameters.depositSessionId) != null ? _a : "";
1599
+ this.allowMaxTokenApproval = (_b = parameters.allowMaxTokenApproval) != null ? _b : false;
1583
1600
  this.viemClient = new ViemClient(this.chainId, this.walletClient);
1584
1601
  this.account = new ActaAccount(
1585
1602
  this.chainId,
@@ -1743,7 +1760,8 @@ var ActaDeposit = class {
1743
1760
  token: tokenSymbol,
1744
1761
  amount,
1745
1762
  receiver,
1746
- feeInclusive
1763
+ feeInclusive,
1764
+ allowMaxTokenApproval: this.allowMaxTokenApproval
1747
1765
  });
1748
1766
  const txn = yield executeSinglePaymentAPICall(
1749
1767
  `${transactionServiceUrl}execute/single`,
@@ -1835,7 +1853,8 @@ var ActaDeposit = class {
1835
1853
  intervalUnit,
1836
1854
  startDate,
1837
1855
  endDate,
1838
- receiver
1856
+ receiver,
1857
+ allowMaxTokenApproval: this.allowMaxTokenApproval
1839
1858
  });
1840
1859
  const txn = yield scheduleRecurringPaymentsAPICall(
1841
1860
  `${transactionServiceUrl}schedule/recurring`,
@@ -1903,6 +1922,7 @@ export {
1903
1922
  getPeriodInterval,
1904
1923
  getPimlicoRpcByChainId,
1905
1924
  getRpcByChainId,
1925
+ getTokenByChainIdAndAddress,
1906
1926
  getTokenByChainIdAndSymbol,
1907
1927
  isKernelVersionAfter,
1908
1928
  isPermissionValidatorPlugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actalink/commonlib",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "author": "Actalink",
5
5
  "license": "MIT license",
6
6
  "publishConfig": {