@actalink/commonlib 0.0.1 → 0.0.2

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,
@@ -595,6 +596,15 @@ 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) throw new Error(`Token ${address} not found for chain ${chainId}.`);
606
+ return token2;
607
+ }
598
608
 
599
609
  // src/deposit.ts
600
610
  var import_viem6 = require("viem");
@@ -1948,6 +1958,7 @@ var ActaDeposit = class {
1948
1958
  getPeriodInterval,
1949
1959
  getPimlicoRpcByChainId,
1950
1960
  getRpcByChainId,
1961
+ getTokenByChainIdAndAddress,
1951
1962
  getTokenByChainIdAndSymbol,
1952
1963
  isKernelVersionAfter,
1953
1964
  isPermissionValidatorPlugin,
package/dist/index.d.cts CHANGED
@@ -177,6 +177,7 @@ declare function token({ chainId, address, name, symbol, decimals, fiatISO, logo
177
177
  }): Token;
178
178
  declare function getTokenByChainIdAndSymbol(chainId: number, symbol: string): Token | undefined;
179
179
  declare const tokensCommonSymbols: string[];
180
+ declare function getTokenByChainIdAndAddress(chainId: number, address: Address): Token | undefined;
180
181
 
181
182
  declare const supportedChains: Chain[];
182
183
  declare function getChainById(chainId: number): Chain | undefined;
@@ -9239,4 +9240,4 @@ declare function executeSinglePaymentAPICall(url: string, userOperation: RpcUser
9239
9240
  serviceType: string;
9240
9241
  }, serviceParams: any): Promise<any>;
9241
9242
 
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 };
9243
+ 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
@@ -177,6 +177,7 @@ declare function token({ chainId, address, name, symbol, decimals, fiatISO, logo
177
177
  }): Token;
178
178
  declare function getTokenByChainIdAndSymbol(chainId: number, symbol: string): Token | undefined;
179
179
  declare const tokensCommonSymbols: string[];
180
+ declare function getTokenByChainIdAndAddress(chainId: number, address: Address): Token | undefined;
180
181
 
181
182
  declare const supportedChains: Chain[];
182
183
  declare function getChainById(chainId: number): Chain | undefined;
@@ -9239,4 +9240,4 @@ declare function executeSinglePaymentAPICall(url: string, userOperation: RpcUser
9239
9240
  serviceType: string;
9240
9241
  }, serviceParams: any): Promise<any>;
9241
9242
 
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 };
9243
+ 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
@@ -505,6 +505,15 @@ 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) throw new Error(`Token ${address} not found for chain ${chainId}.`);
515
+ return token2;
516
+ }
508
517
 
509
518
  // src/deposit.ts
510
519
  import { toHex as toHex2, zeroAddress as zeroAddress4 } from "viem";
@@ -1903,6 +1912,7 @@ export {
1903
1912
  getPeriodInterval,
1904
1913
  getPimlicoRpcByChainId,
1905
1914
  getRpcByChainId,
1915
+ getTokenByChainIdAndAddress,
1906
1916
  getTokenByChainIdAndSymbol,
1907
1917
  isKernelVersionAfter,
1908
1918
  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.2",
4
4
  "author": "Actalink",
5
5
  "license": "MIT license",
6
6
  "publishConfig": {