@tomo-inc/chains-service 0.0.18 → 0.0.20

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
@@ -4,8 +4,8 @@ var walletUtils = require('@tomo-inc/wallet-utils');
4
4
  var axios = require('axios');
5
5
  var CryptoJS = require('crypto-js');
6
6
  var Bignumber = require('bignumber.js');
7
- var bitcoinjsLib = require('bitcoinjs-lib');
8
7
  var viem = require('viem');
8
+ var bitcoinjsLib = require('bitcoinjs-lib');
9
9
  var splToken = require('@solana/spl-token');
10
10
  var web3_js = require('@solana/web3.js');
11
11
 
@@ -2868,11 +2868,8 @@ var Tokens = class {
2868
2868
  // return success;
2869
2869
  // }
2870
2870
  };
2871
- ({
2872
- [walletUtils.ChainTypes.BTC]: true,
2873
- [walletUtils.ChainTypes.COSMOS]: true,
2874
- [walletUtils.ChainTypes.DOGE]: true
2875
- });
2871
+
2872
+ // src/base/transaction.ts
2876
2873
  var Transactions = class {
2877
2874
  transactionAPIs;
2878
2875
  constructor(transactionAPIs) {
@@ -3973,7 +3970,7 @@ function fromBase64(base64) {
3973
3970
  function toBase58(data) {
3974
3971
  throw new Error("toBase58 requires bs58 package. Install it: pnpm add bs58");
3975
3972
  }
3976
- var BaseConfig = walletUtils.SupportedChainTypes[walletUtils.ChainTypes.DOGE];
3973
+ var BaseConfig = walletUtils.SupportedChainTypes[walletUtils.ChainTypeEnum.DOGE];
3977
3974
  var BLOCK_CONFIRMATIONS = 1;
3978
3975
  var FEE_RATE_KB = 0.5;
3979
3976
  var DECIMALS = 1e8;
@@ -4471,6 +4468,8 @@ var DogecoinUtils = class {
4471
4468
  }
4472
4469
  }
4473
4470
  };
4471
+
4472
+ // src/dogecoin/service.ts
4474
4473
  var DogecoinService = class _DogecoinService extends BaseService {
4475
4474
  static instance;
4476
4475
  chainType;
@@ -4890,7 +4889,7 @@ var EvmService = class _EvmService extends BaseService {
4890
4889
  });
4891
4890
  if (!success) {
4892
4891
  console.error("queryGasInfo evm", txData, queryGasParams, message, gasInfo);
4893
- const BaseConfig3 = walletUtils.SupportedChainTypes[walletUtils.ChainTypes.EVM];
4892
+ const BaseConfig3 = walletUtils.SupportedChainTypes[walletUtils.ChainTypeEnum.EVM];
4894
4893
  const { gasFee } = BaseConfig3;
4895
4894
  return {
4896
4895
  success: true,
@@ -4959,7 +4958,7 @@ var EvmService = class _EvmService extends BaseService {
4959
4958
  return gas;
4960
4959
  } catch (error) {
4961
4960
  console.warn("Failed to estimate gas:", error);
4962
- const BaseConfig3 = walletUtils.SupportedChainTypes[walletUtils.ChainTypes.EVM];
4961
+ const BaseConfig3 = walletUtils.SupportedChainTypes[walletUtils.ChainTypeEnum.EVM];
4963
4962
  const { gasFee } = BaseConfig3;
4964
4963
  return viem.numberToHex(viem.parseUnits(gasFee.toString(), 18));
4965
4964
  }
@@ -5066,7 +5065,7 @@ var EvmService = class _EvmService extends BaseService {
5066
5065
  }
5067
5066
  }
5068
5067
  };
5069
- var BaseConfig2 = walletUtils.SupportedChainTypes[walletUtils.ChainTypes.SOL];
5068
+ var BaseConfig2 = walletUtils.SupportedChainTypes[walletUtils.ChainTypeEnum.SOL];
5070
5069
  var TOKEN_METADATA_PROGRAM_ID = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
5071
5070
  var MSG_PREFIX = "\xFFsolana offchain";
5072
5071
 
@@ -5463,9 +5462,9 @@ var TomoWallet = class _TomoWallet extends BaseService {
5463
5462
 
5464
5463
  // src/index.ts
5465
5464
  var ChainTypeServices = {
5466
- [walletUtils.ChainTypes.EVM]: EvmService,
5467
- [walletUtils.ChainTypes.SOL]: SolanaService,
5468
- [walletUtils.ChainTypes.DOGE]: DogecoinService
5465
+ [walletUtils.ChainTypeEnum.EVM]: EvmService,
5466
+ [walletUtils.ChainTypeEnum.SOLANA]: SolanaService,
5467
+ [walletUtils.ChainTypeEnum.DOGECOIN]: DogecoinService
5469
5468
  };
5470
5469
 
5471
5470
  exports.AccountType = AccountType;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { ChainTypes, TomoStage } from '@tomo-inc/wallet-utils';
1
+ import { ChainTypeEnum, TomoStage } from '@tomo-inc/wallet-utils';
2
2
  import * as axios from 'axios';
3
3
  import { AxiosInstance } from 'axios';
4
4
  import { Transaction as Transaction$1 } from 'viem';
@@ -22,7 +22,7 @@ interface IAccount {
22
22
  readonly type: AccountType;
23
23
  readonly lastUsedTime?: number;
24
24
  readonly sortIndex?: number;
25
- readonly addresses: Record<ChainTypes, ChainAddress[]>;
25
+ readonly addresses: Record<ChainTypeEnum, ChainAddress[]>;
26
26
  readonly mnemonic: string | null;
27
27
  readonly addressIndex: number;
28
28
  readonly isImported: boolean;
@@ -91,7 +91,7 @@ type SuiNetwork = "mainnet" | "testnet" | "devnet";
91
91
  type DogeNetwork = "mainnet" | "testnet" | "devnet";
92
92
  type TonNetwork = "mainnet" | "testnet" | "devnet";
93
93
  type TronNetwork = "mainnet" | "testnet" | "devnet";
94
- type ChainTypeIds = `${ChainTypes.EVM}:${EVMNetwork}` | `${ChainTypes.BTC}:${BTCNetwork}` | `${ChainTypes.SOL}:${SolNetwork}` | `${ChainTypes.SUI}:${SuiNetwork}` | `${ChainTypes.DOGE}:${DogeNetwork}` | `${ChainTypes.TON}:${TonNetwork}` | `${ChainTypes.TRON}:${TronNetwork}`;
94
+ type ChainTypeIds = `${ChainTypeEnum.EVM}:${EVMNetwork}` | `${ChainTypeEnum.BITCOIN}:${BTCNetwork}` | `${ChainTypeEnum.SOLANA}:${SolNetwork}` | `${ChainTypeEnum.SUI}:${SuiNetwork}` | `${ChainTypeEnum.DOGECOIN}:${DogeNetwork}` | `${ChainTypeEnum.TON}:${TonNetwork}` | `${ChainTypeEnum.TRON}:${TronNetwork}`;
95
95
  interface RemoteChainInfo2 {
96
96
  chainId: number;
97
97
  chainIndex: number;
@@ -151,7 +151,7 @@ interface TransactionsParams {
151
151
  pageLimit?: number;
152
152
  }
153
153
  interface TransactionItem {
154
- chainType: ChainTypes;
154
+ chainType: ChainTypeEnum;
155
155
  chainInfo: {
156
156
  chainId: string;
157
157
  name: string;
@@ -308,10 +308,10 @@ declare class NetworkAPIs extends BasePublicService {
308
308
  currentChainId: string;
309
309
  private constructor();
310
310
  static getInstance(apiBase: IPublicApiBaseConfig, tomoAppInfo: TomoAppInfo): NetworkAPIs;
311
- getCacheId(chainType: ChainTypes | ""): string;
312
- getAllNetworks(chainType: ChainTypes | ""): any[];
313
- getCurrentNetwork(chainType: ChainTypes): Promise<string>;
314
- setCurrentNetwork(chainType: ChainTypes | "", chainId: string): Promise<void>;
311
+ getCacheId(chainType: ChainTypeEnum | ""): string;
312
+ getAllNetworks(chainType: ChainTypeEnum | ""): any[];
313
+ getCurrentNetwork(chainType: ChainTypeEnum): Promise<string>;
314
+ setCurrentNetwork(chainType: ChainTypeEnum | "", chainId: string): Promise<void>;
315
315
  getNetworkByChainId(chainId: string): INetwork | undefined;
316
316
  getNetworkByChainIndex(chainIndex: number): INetwork | undefined;
317
317
  }
@@ -319,9 +319,9 @@ declare class NetworkAPIs extends BasePublicService {
319
319
  declare class Networks {
320
320
  private chainType;
321
321
  networkAPIs: NetworkAPIs;
322
- constructor(networkAPIs: NetworkAPIs, chainType?: ChainTypes);
323
- setChainType(chainType: ChainTypes): void;
324
- getNetworks(chainType?: ChainTypes | ""): Promise<INetwork[]>;
322
+ constructor(networkAPIs: NetworkAPIs, chainType?: ChainTypeEnum);
323
+ setChainType(chainType: ChainTypeEnum): void;
324
+ getNetworks(chainType?: ChainTypeEnum | ""): Promise<INetwork[]>;
325
325
  getNetworkByChainId(chainId: string): Promise<INetwork>;
326
326
  getNetworkByChainIndex(chainIndex: number): Promise<INetwork>;
327
327
  getCurrentNetwork(): Promise<INetwork>;
@@ -514,10 +514,10 @@ declare namespace API {
514
514
 
515
515
  declare class DogecoinService extends BaseService {
516
516
  private static instance;
517
- chainType: ChainTypes | "";
517
+ chainType: ChainTypeEnum | "";
518
518
  rpcService: typeof API;
519
- constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
520
- static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): DogecoinService;
519
+ constructor(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
520
+ static getInstance(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): DogecoinService;
521
521
  requestAccounts(): Promise<string[]>;
522
522
  getAccounts(): Promise<string[]>;
523
523
  getConnectionStatus(): Promise<{
@@ -584,9 +584,9 @@ declare class DogecoinService extends BaseService {
584
584
 
585
585
  declare class EvmService extends BaseService {
586
586
  private static instance;
587
- chainType: ChainTypes | "";
588
- constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
589
- static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): EvmService;
587
+ chainType: ChainTypeEnum | "";
588
+ constructor(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
589
+ static getInstance(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): EvmService;
590
590
  eth_requestAccounts(): Promise<string[]>;
591
591
  eth_accounts(): Promise<string[]>;
592
592
  eth_chainId(): Promise<`0x${string}`>;
@@ -630,11 +630,11 @@ interface QueryRentParams {
630
630
 
631
631
  declare class SolanaService extends BaseService {
632
632
  private static instance;
633
- chainType: ChainTypes | "";
633
+ chainType: ChainTypeEnum | "";
634
634
  rpcUrl: string;
635
635
  private connection;
636
- constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
637
- static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): SolanaService;
636
+ constructor(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
637
+ static getInstance(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): SolanaService;
638
638
  getCurrentWalletAccount(): Promise<any[]>;
639
639
  getAccount(): Promise<{
640
640
  publicKey: string;
@@ -679,9 +679,9 @@ declare class TomoWallet extends BaseService {
679
679
  private walletId;
680
680
  constructor(walletId: string, tomoAppInfo: TomoAppInfo);
681
681
  getInstance(walletId: string, tomoAppInfo: TomoAppInfo): TomoWallet;
682
- supportedChains(chainType?: ChainTypes | ""): Promise<INetwork[]>;
683
- getChainInfo(chainType: ChainTypes, chainId: string): Promise<INetwork>;
684
- isChainSupported(chainType: ChainTypes, chainId: string): Promise<boolean>;
682
+ supportedChains(chainType?: ChainTypeEnum | ""): Promise<INetwork[]>;
683
+ getChainInfo(chainType: ChainTypeEnum, chainId: string): Promise<INetwork>;
684
+ isChainSupported(chainType: ChainTypeEnum, chainId: string): Promise<boolean>;
685
685
  getTransactions({ tokenAddress, chainId, typeList, pageLimit, cursor, }: TransactionsParams): Promise<TransactionsResponse>;
686
686
  }
687
687
 
@@ -784,8 +784,8 @@ declare class DogecoinUtils {
784
784
 
785
785
  declare const ChainTypeServices: {
786
786
  evm: typeof EvmService;
787
- sol: typeof SolanaService;
788
- doge: typeof DogecoinService;
787
+ solana: typeof SolanaService;
788
+ dogecoin: typeof DogecoinService;
789
789
  };
790
790
 
791
791
  export { AccountType, type ChainAddress, ChainTypeServices, API as DogecoinAPI, DogecoinAddress, DogecoinService, DogecoinUtils, EvmService, type IAccount, type IAccountInfo, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, TransactionParser, type TransactionsParams, type TransactionsResponse, TxTypes, addUsedUtxos, createPsbt, decodePsbt, getUsedUtxos, toBitcoin, toSatoshi, type utxoTx };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ChainTypes, TomoStage } from '@tomo-inc/wallet-utils';
1
+ import { ChainTypeEnum, TomoStage } from '@tomo-inc/wallet-utils';
2
2
  import * as axios from 'axios';
3
3
  import { AxiosInstance } from 'axios';
4
4
  import { Transaction as Transaction$1 } from 'viem';
@@ -22,7 +22,7 @@ interface IAccount {
22
22
  readonly type: AccountType;
23
23
  readonly lastUsedTime?: number;
24
24
  readonly sortIndex?: number;
25
- readonly addresses: Record<ChainTypes, ChainAddress[]>;
25
+ readonly addresses: Record<ChainTypeEnum, ChainAddress[]>;
26
26
  readonly mnemonic: string | null;
27
27
  readonly addressIndex: number;
28
28
  readonly isImported: boolean;
@@ -91,7 +91,7 @@ type SuiNetwork = "mainnet" | "testnet" | "devnet";
91
91
  type DogeNetwork = "mainnet" | "testnet" | "devnet";
92
92
  type TonNetwork = "mainnet" | "testnet" | "devnet";
93
93
  type TronNetwork = "mainnet" | "testnet" | "devnet";
94
- type ChainTypeIds = `${ChainTypes.EVM}:${EVMNetwork}` | `${ChainTypes.BTC}:${BTCNetwork}` | `${ChainTypes.SOL}:${SolNetwork}` | `${ChainTypes.SUI}:${SuiNetwork}` | `${ChainTypes.DOGE}:${DogeNetwork}` | `${ChainTypes.TON}:${TonNetwork}` | `${ChainTypes.TRON}:${TronNetwork}`;
94
+ type ChainTypeIds = `${ChainTypeEnum.EVM}:${EVMNetwork}` | `${ChainTypeEnum.BITCOIN}:${BTCNetwork}` | `${ChainTypeEnum.SOLANA}:${SolNetwork}` | `${ChainTypeEnum.SUI}:${SuiNetwork}` | `${ChainTypeEnum.DOGECOIN}:${DogeNetwork}` | `${ChainTypeEnum.TON}:${TonNetwork}` | `${ChainTypeEnum.TRON}:${TronNetwork}`;
95
95
  interface RemoteChainInfo2 {
96
96
  chainId: number;
97
97
  chainIndex: number;
@@ -151,7 +151,7 @@ interface TransactionsParams {
151
151
  pageLimit?: number;
152
152
  }
153
153
  interface TransactionItem {
154
- chainType: ChainTypes;
154
+ chainType: ChainTypeEnum;
155
155
  chainInfo: {
156
156
  chainId: string;
157
157
  name: string;
@@ -308,10 +308,10 @@ declare class NetworkAPIs extends BasePublicService {
308
308
  currentChainId: string;
309
309
  private constructor();
310
310
  static getInstance(apiBase: IPublicApiBaseConfig, tomoAppInfo: TomoAppInfo): NetworkAPIs;
311
- getCacheId(chainType: ChainTypes | ""): string;
312
- getAllNetworks(chainType: ChainTypes | ""): any[];
313
- getCurrentNetwork(chainType: ChainTypes): Promise<string>;
314
- setCurrentNetwork(chainType: ChainTypes | "", chainId: string): Promise<void>;
311
+ getCacheId(chainType: ChainTypeEnum | ""): string;
312
+ getAllNetworks(chainType: ChainTypeEnum | ""): any[];
313
+ getCurrentNetwork(chainType: ChainTypeEnum): Promise<string>;
314
+ setCurrentNetwork(chainType: ChainTypeEnum | "", chainId: string): Promise<void>;
315
315
  getNetworkByChainId(chainId: string): INetwork | undefined;
316
316
  getNetworkByChainIndex(chainIndex: number): INetwork | undefined;
317
317
  }
@@ -319,9 +319,9 @@ declare class NetworkAPIs extends BasePublicService {
319
319
  declare class Networks {
320
320
  private chainType;
321
321
  networkAPIs: NetworkAPIs;
322
- constructor(networkAPIs: NetworkAPIs, chainType?: ChainTypes);
323
- setChainType(chainType: ChainTypes): void;
324
- getNetworks(chainType?: ChainTypes | ""): Promise<INetwork[]>;
322
+ constructor(networkAPIs: NetworkAPIs, chainType?: ChainTypeEnum);
323
+ setChainType(chainType: ChainTypeEnum): void;
324
+ getNetworks(chainType?: ChainTypeEnum | ""): Promise<INetwork[]>;
325
325
  getNetworkByChainId(chainId: string): Promise<INetwork>;
326
326
  getNetworkByChainIndex(chainIndex: number): Promise<INetwork>;
327
327
  getCurrentNetwork(): Promise<INetwork>;
@@ -514,10 +514,10 @@ declare namespace API {
514
514
 
515
515
  declare class DogecoinService extends BaseService {
516
516
  private static instance;
517
- chainType: ChainTypes | "";
517
+ chainType: ChainTypeEnum | "";
518
518
  rpcService: typeof API;
519
- constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
520
- static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): DogecoinService;
519
+ constructor(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
520
+ static getInstance(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): DogecoinService;
521
521
  requestAccounts(): Promise<string[]>;
522
522
  getAccounts(): Promise<string[]>;
523
523
  getConnectionStatus(): Promise<{
@@ -584,9 +584,9 @@ declare class DogecoinService extends BaseService {
584
584
 
585
585
  declare class EvmService extends BaseService {
586
586
  private static instance;
587
- chainType: ChainTypes | "";
588
- constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
589
- static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): EvmService;
587
+ chainType: ChainTypeEnum | "";
588
+ constructor(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
589
+ static getInstance(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): EvmService;
590
590
  eth_requestAccounts(): Promise<string[]>;
591
591
  eth_accounts(): Promise<string[]>;
592
592
  eth_chainId(): Promise<`0x${string}`>;
@@ -630,11 +630,11 @@ interface QueryRentParams {
630
630
 
631
631
  declare class SolanaService extends BaseService {
632
632
  private static instance;
633
- chainType: ChainTypes | "";
633
+ chainType: ChainTypeEnum | "";
634
634
  rpcUrl: string;
635
635
  private connection;
636
- constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
637
- static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): SolanaService;
636
+ constructor(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo);
637
+ static getInstance(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo): SolanaService;
638
638
  getCurrentWalletAccount(): Promise<any[]>;
639
639
  getAccount(): Promise<{
640
640
  publicKey: string;
@@ -679,9 +679,9 @@ declare class TomoWallet extends BaseService {
679
679
  private walletId;
680
680
  constructor(walletId: string, tomoAppInfo: TomoAppInfo);
681
681
  getInstance(walletId: string, tomoAppInfo: TomoAppInfo): TomoWallet;
682
- supportedChains(chainType?: ChainTypes | ""): Promise<INetwork[]>;
683
- getChainInfo(chainType: ChainTypes, chainId: string): Promise<INetwork>;
684
- isChainSupported(chainType: ChainTypes, chainId: string): Promise<boolean>;
682
+ supportedChains(chainType?: ChainTypeEnum | ""): Promise<INetwork[]>;
683
+ getChainInfo(chainType: ChainTypeEnum, chainId: string): Promise<INetwork>;
684
+ isChainSupported(chainType: ChainTypeEnum, chainId: string): Promise<boolean>;
685
685
  getTransactions({ tokenAddress, chainId, typeList, pageLimit, cursor, }: TransactionsParams): Promise<TransactionsResponse>;
686
686
  }
687
687
 
@@ -784,8 +784,8 @@ declare class DogecoinUtils {
784
784
 
785
785
  declare const ChainTypeServices: {
786
786
  evm: typeof EvmService;
787
- sol: typeof SolanaService;
788
- doge: typeof DogecoinService;
787
+ solana: typeof SolanaService;
788
+ dogecoin: typeof DogecoinService;
789
789
  };
790
790
 
791
791
  export { AccountType, type ChainAddress, ChainTypeServices, API as DogecoinAPI, DogecoinAddress, DogecoinService, DogecoinUtils, EvmService, type IAccount, type IAccountInfo, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, TransactionParser, type TransactionsParams, type TransactionsResponse, TxTypes, addUsedUtxos, createPsbt, decodePsbt, getUsedUtxos, toBitcoin, toSatoshi, type utxoTx };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { ChainTypes, SupportedChainTypes, TomoApiDomains, cache, getExplorerUrl } from '@tomo-inc/wallet-utils';
1
+ import { SupportedChainTypes, ChainTypeEnum, TomoApiDomains, cache, getExplorerUrl } from '@tomo-inc/wallet-utils';
2
2
  import axios from 'axios';
3
3
  import CryptoJS from 'crypto-js';
4
4
  import Bignumber, { BigNumber } from 'bignumber.js';
5
- import { Psbt, Transaction, address } from 'bitcoinjs-lib';
6
5
  import { toHex as toHex$1, parseUnits, isAddressEqual, createPublicClient, http, hexToBigInt, numberToHex, isHex, fromHex as fromHex$1, parseTransaction, formatUnits, encodeFunctionData, erc20Abi } from 'viem';
6
+ import { Psbt, Transaction, address } from 'bitcoinjs-lib';
7
7
  import { getAssociatedTokenAddress, createAssociatedTokenAccountInstruction, createTransferInstruction, TOKEN_PROGRAM_ID } from '@solana/spl-token';
8
8
  import { PublicKey, Connection, VersionedTransaction, sendAndConfirmRawTransaction, Transaction as Transaction$1, SystemProgram, LAMPORTS_PER_SOL } from '@solana/web3.js';
9
9
 
@@ -2860,11 +2860,8 @@ var Tokens = class {
2860
2860
  // return success;
2861
2861
  // }
2862
2862
  };
2863
- ({
2864
- [ChainTypes.BTC]: true,
2865
- [ChainTypes.COSMOS]: true,
2866
- [ChainTypes.DOGE]: true
2867
- });
2863
+
2864
+ // src/base/transaction.ts
2868
2865
  var Transactions = class {
2869
2866
  transactionAPIs;
2870
2867
  constructor(transactionAPIs) {
@@ -3965,7 +3962,7 @@ function fromBase64(base64) {
3965
3962
  function toBase58(data) {
3966
3963
  throw new Error("toBase58 requires bs58 package. Install it: pnpm add bs58");
3967
3964
  }
3968
- var BaseConfig = SupportedChainTypes[ChainTypes.DOGE];
3965
+ var BaseConfig = SupportedChainTypes[ChainTypeEnum.DOGE];
3969
3966
  var BLOCK_CONFIRMATIONS = 1;
3970
3967
  var FEE_RATE_KB = 0.5;
3971
3968
  var DECIMALS = 1e8;
@@ -4463,6 +4460,8 @@ var DogecoinUtils = class {
4463
4460
  }
4464
4461
  }
4465
4462
  };
4463
+
4464
+ // src/dogecoin/service.ts
4466
4465
  var DogecoinService = class _DogecoinService extends BaseService {
4467
4466
  static instance;
4468
4467
  chainType;
@@ -4882,7 +4881,7 @@ var EvmService = class _EvmService extends BaseService {
4882
4881
  });
4883
4882
  if (!success) {
4884
4883
  console.error("queryGasInfo evm", txData, queryGasParams, message, gasInfo);
4885
- const BaseConfig3 = SupportedChainTypes[ChainTypes.EVM];
4884
+ const BaseConfig3 = SupportedChainTypes[ChainTypeEnum.EVM];
4886
4885
  const { gasFee } = BaseConfig3;
4887
4886
  return {
4888
4887
  success: true,
@@ -4951,7 +4950,7 @@ var EvmService = class _EvmService extends BaseService {
4951
4950
  return gas;
4952
4951
  } catch (error) {
4953
4952
  console.warn("Failed to estimate gas:", error);
4954
- const BaseConfig3 = SupportedChainTypes[ChainTypes.EVM];
4953
+ const BaseConfig3 = SupportedChainTypes[ChainTypeEnum.EVM];
4955
4954
  const { gasFee } = BaseConfig3;
4956
4955
  return numberToHex(parseUnits(gasFee.toString(), 18));
4957
4956
  }
@@ -5058,7 +5057,7 @@ var EvmService = class _EvmService extends BaseService {
5058
5057
  }
5059
5058
  }
5060
5059
  };
5061
- var BaseConfig2 = SupportedChainTypes[ChainTypes.SOL];
5060
+ var BaseConfig2 = SupportedChainTypes[ChainTypeEnum.SOL];
5062
5061
  var TOKEN_METADATA_PROGRAM_ID = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
5063
5062
  var MSG_PREFIX = "\xFFsolana offchain";
5064
5063
 
@@ -5455,9 +5454,9 @@ var TomoWallet = class _TomoWallet extends BaseService {
5455
5454
 
5456
5455
  // src/index.ts
5457
5456
  var ChainTypeServices = {
5458
- [ChainTypes.EVM]: EvmService,
5459
- [ChainTypes.SOL]: SolanaService,
5460
- [ChainTypes.DOGE]: DogecoinService
5457
+ [ChainTypeEnum.EVM]: EvmService,
5458
+ [ChainTypeEnum.SOLANA]: SolanaService,
5459
+ [ChainTypeEnum.DOGECOIN]: DogecoinService
5461
5460
  };
5462
5461
 
5463
5462
  export { AccountType, ChainTypeServices, rpc_exports as DogecoinAPI, DogecoinAddress, DogecoinService, DogecoinUtils, EvmService, SolanaService, TomoWallet, TransactionParser, TxTypes, addUsedUtxos, createPsbt, decodePsbt, getUsedUtxos, toBitcoin, toSatoshi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomo-inc/chains-service",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "author": "tomo.inc",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -23,7 +23,7 @@
23
23
  "bitcoinjs-lib": "^7.0.0",
24
24
  "crypto-js": "4.2.0",
25
25
  "viem": "2.21.54",
26
- "@tomo-inc/wallet-utils": "0.0.16"
26
+ "@tomo-inc/wallet-utils": "0.0.18"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/supertest": "^2.0.12",
@@ -1,4 +1,4 @@
1
- import { ChainTypes, SupportedChainTypes } from "@tomo-inc/wallet-utils";
1
+ import { ChainTypeEnum, SupportedChainTypes } from "@tomo-inc/wallet-utils";
2
2
  import { INetwork, TomoAppInfo } from "../types";
3
3
  import { BasePublicService } from "./base";
4
4
  import { loadNetworks } from "./network-data";
@@ -39,18 +39,18 @@ export class NetworkAPIs extends BasePublicService {
39
39
  return this.instance;
40
40
  }
41
41
 
42
- public getCacheId(chainType: ChainTypes | ""): string {
42
+ public getCacheId(chainType: ChainTypeEnum | ""): string {
43
43
  return `tomo-${chainType}-currentChainId`;
44
44
  }
45
45
 
46
- public getAllNetworks(chainType: ChainTypes | ""): any[] {
46
+ public getAllNetworks(chainType: ChainTypeEnum | ""): any[] {
47
47
  if (chainType === "") {
48
48
  return this.chains;
49
49
  }
50
50
  return this.chains.filter((chain) => chain.platformType === chainType.toUpperCase());
51
51
  }
52
52
 
53
- public async getCurrentNetwork(chainType: ChainTypes): Promise<string> {
53
+ public async getCurrentNetwork(chainType: ChainTypeEnum): Promise<string> {
54
54
  if (!SupportedChainTypes?.[chainType]) {
55
55
  throw new Error(`Chain ${chainType} is not supported`);
56
56
  }
@@ -60,7 +60,7 @@ export class NetworkAPIs extends BasePublicService {
60
60
  return currentChainId || SupportedChainTypes?.[chainType]?.chainId || this.currentChainId || "";
61
61
  }
62
62
 
63
- public async setCurrentNetwork(chainType: ChainTypes | "", chainId: string): Promise<void> {
63
+ public async setCurrentNetwork(chainType: ChainTypeEnum | "", chainId: string): Promise<void> {
64
64
  if (chainType && !SupportedChainTypes?.[chainType]) {
65
65
  throw new Error(`Chain ${chainType} is not supported`);
66
66
  }
@@ -1,23 +1,23 @@
1
- import { ChainTypes, SupportedChainTypes } from "@tomo-inc/wallet-utils";
1
+ import { ChainTypeEnum, SupportedChainTypes } from "@tomo-inc/wallet-utils";
2
2
 
3
- import { INetwork } from "../types";
4
3
  import { NetworkAPIs } from "../api/network";
4
+ import { INetwork } from "../types";
5
5
 
6
6
  //chainType = all for wallet
7
7
  export class Networks {
8
- private chainType: ChainTypes | "";
8
+ private chainType: ChainTypeEnum | "";
9
9
  public networkAPIs: NetworkAPIs;
10
10
 
11
- public constructor(networkAPIs: NetworkAPIs, chainType?: ChainTypes) {
11
+ public constructor(networkAPIs: NetworkAPIs, chainType?: ChainTypeEnum) {
12
12
  this.chainType = chainType || "";
13
13
  this.networkAPIs = networkAPIs;
14
14
  }
15
15
 
16
- public setChainType(chainType: ChainTypes): void {
16
+ public setChainType(chainType: ChainTypeEnum): void {
17
17
  this.chainType = chainType;
18
18
  }
19
19
 
20
- public async getNetworks(chainType?: ChainTypes | ""): Promise<INetwork[]> {
20
+ public async getNetworks(chainType?: ChainTypeEnum | ""): Promise<INetwork[]> {
21
21
  const networks = this.networkAPIs.getAllNetworks(chainType || "");
22
22
  return networks;
23
23
  }
@@ -1,14 +1,14 @@
1
1
  import { TransactionAPIs } from "../api/transaction";
2
2
  import { QueryGasParams } from "../types";
3
3
 
4
- import { ChainTypes } from "@tomo-inc/wallet-utils";
5
- const MYDOGE_PLATFORM_IN_SERVICE = 4;
4
+ // import { ChainTypeEnum } from "@tomo-inc/wallet-utils";
5
+ // const MYDOGE_PLATFORM_IN_SERVICE = 4;
6
6
 
7
- const notSupportChainTypes = {
8
- [ChainTypes.BTC]: true,
9
- [ChainTypes.COSMOS]: true,
10
- [ChainTypes.DOGE]: true,
11
- };
7
+ // const notSupportChainTypes = {
8
+ // [ChainTypeEnum.BITCOIN]: true,
9
+ // [ChainTypeEnum.COSMOS]: true,
10
+ // [ChainTypeEnum.DOGECOIN]: true,
11
+ // };
12
12
 
13
13
  //src/background/services/socials/tomo.ts
14
14
  export class Transactions {
@@ -1,6 +1,6 @@
1
- import { ChainTypes, SupportedChainTypes } from "@tomo-inc/wallet-utils";
1
+ import { ChainTypeEnum, SupportedChainTypes } from "@tomo-inc/wallet-utils";
2
2
 
3
- export const BaseConfig = SupportedChainTypes[ChainTypes.DOGE] as any;
3
+ export const BaseConfig = SupportedChainTypes[ChainTypeEnum.DOGE] as any;
4
4
 
5
5
  export const BLOCK_CONFIRMATIONS = 1;
6
6
  export const FEE_RATE_KB = 0.5;
@@ -1,35 +1,35 @@
1
- import { ChainTypes } from "@tomo-inc/wallet-utils";
1
+ import { ChainTypeEnum } from "@tomo-inc/wallet-utils";
2
2
 
3
3
  import { BaseService } from "../base/service";
4
4
 
5
5
  import { BigNumber } from "bignumber.js";
6
- import { DogecoinUtils } from "./utils-doge";
7
6
  import { parseUnits, toHex } from "viem";
7
+ import { DogecoinUtils } from "./utils-doge";
8
8
 
9
9
  import { IAccountInfo, QueryGasParams, QueryGasResponse, TomoAppInfo } from "../types";
10
10
  import { TransactionParams } from "./type";
11
11
 
12
+ import * as base from "./base";
12
13
  import * as API from "./rpc";
13
- import * as utils from "./utils";
14
14
  import { DogeTxData } from "./type";
15
- import * as base from "./base";
15
+ import * as utils from "./utils";
16
16
 
17
17
  import { BaseConfig } from "./config";
18
- import { createPsbt, addUsedUtxos, toBitcoin } from "./utils";
18
+ import { addUsedUtxos, createPsbt, toBitcoin } from "./utils";
19
19
 
20
20
  export class DogecoinService extends BaseService {
21
21
  private static instance: DogecoinService;
22
- public chainType: ChainTypes | "";
22
+ public chainType: ChainTypeEnum | "";
23
23
  public rpcService: typeof API;
24
24
 
25
- public constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
25
+ public constructor(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
26
26
  super(tomoAppInfo, accountInfo);
27
27
  this.chainType = chainType;
28
28
  this.rpcService = API;
29
29
  }
30
30
 
31
31
  //singleton
32
- public static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
32
+ public static getInstance(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
33
33
  if (!DogecoinService.instance) {
34
34
  DogecoinService.instance = new DogecoinService(chainType, accountInfo, tomoAppInfo);
35
35
  }
@@ -1,4 +1,4 @@
1
- import { ChainTypes, SupportedChainTypes } from "@tomo-inc/wallet-utils";
1
+ import { ChainTypeEnum, SupportedChainTypes } from "@tomo-inc/wallet-utils";
2
2
  import { BigNumber } from "bignumber.js";
3
3
  import {
4
4
  createPublicClient,
@@ -31,14 +31,14 @@ import { createErc20TxData, getAllTypeChainIds, isEvmChain } from "./utils";
31
31
 
32
32
  export class EvmService extends BaseService {
33
33
  private static instance: EvmService;
34
- public chainType: ChainTypes | "";
34
+ public chainType: ChainTypeEnum | "";
35
35
 
36
- public constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
36
+ public constructor(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
37
37
  super(tomoAppInfo, accountInfo);
38
38
  this.chainType = chainType;
39
39
  }
40
40
 
41
- public static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
41
+ public static getInstance(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
42
42
  if (!EvmService.instance) {
43
43
  EvmService.instance = new EvmService(chainType, accountInfo, tomoAppInfo);
44
44
  }
@@ -67,7 +67,7 @@ export class EvmService extends BaseService {
67
67
  }
68
68
 
69
69
  private async getCurrentChain(): Promise<INetwork> {
70
- this.networks.setChainType(this.chainType as ChainTypes);
70
+ this.networks.setChainType(this.chainType as ChainTypeEnum);
71
71
  const currentNetwork = await this.networks.getCurrentNetwork();
72
72
  return currentNetwork;
73
73
  }
@@ -166,7 +166,7 @@ export class EvmService extends BaseService {
166
166
  if (!success) {
167
167
  console.error("queryGasInfo evm", txData, queryGasParams, message, gasInfo);
168
168
 
169
- const BaseConfig = SupportedChainTypes[ChainTypes.EVM];
169
+ const BaseConfig = SupportedChainTypes[ChainTypeEnum.EVM];
170
170
  const { gasFee } = BaseConfig;
171
171
  return {
172
172
  success: true,
@@ -174,7 +174,7 @@ export class EvmService extends BaseService {
174
174
  };
175
175
  }
176
176
 
177
- const nativeChainId = SupportedChainTypes[this.chainType as ChainTypes].chainId as string;
177
+ const nativeChainId = SupportedChainTypes[this.chainType as ChainTypeEnum].chainId as string;
178
178
  const { nativeCurrency } = await this.networks.getNetworkByChainId(nativeChainId);
179
179
 
180
180
  const { baseFee = 1, gasLimit = 0 } = gasInfo;
@@ -210,7 +210,7 @@ export class EvmService extends BaseService {
210
210
  });
211
211
  }
212
212
  if (chainId) {
213
- this.networks.setChainType(this.chainType as ChainTypes);
213
+ this.networks.setChainType(this.chainType as ChainTypeEnum);
214
214
  const chainInfo: any = await this.networks.getNetworkByChainId(chainId);
215
215
  rpcUrl = chainInfo.rpcUrls[0];
216
216
  } else {
@@ -243,7 +243,7 @@ export class EvmService extends BaseService {
243
243
  console.warn("Failed to estimate gas:", error);
244
244
  // throw new Error(`Failed to estimate gas: ${error}`);
245
245
 
246
- const BaseConfig = SupportedChainTypes[ChainTypes.EVM];
246
+ const BaseConfig = SupportedChainTypes[ChainTypeEnum.EVM];
247
247
  const { gasFee } = BaseConfig;
248
248
  return numberToHex(parseUnits(gasFee.toString(), 18));
249
249
  }
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ChainTypes } from "@tomo-inc/wallet-utils";
1
+ import { ChainTypeEnum } from "@tomo-inc/wallet-utils";
2
2
  import { DogecoinService } from "./dogecoin/service";
3
3
  import { EvmService } from "./evm/service";
4
4
  import { SolanaService } from "./solana/service";
@@ -6,9 +6,9 @@ import { SolanaService } from "./solana/service";
6
6
  export { DogecoinService, EvmService, SolanaService };
7
7
 
8
8
  export const ChainTypeServices = {
9
- [ChainTypes.EVM]: EvmService,
10
- [ChainTypes.SOL]: SolanaService,
11
- [ChainTypes.DOGE]: DogecoinService,
9
+ [ChainTypeEnum.EVM]: EvmService,
10
+ [ChainTypeEnum.SOLANA]: SolanaService,
11
+ [ChainTypeEnum.DOGECOIN]: DogecoinService,
12
12
  };
13
13
 
14
14
  export { TomoWallet } from "./wallet";
@@ -1,5 +1,5 @@
1
- import { ChainTypes, SupportedChainTypes } from "@tomo-inc/wallet-utils";
2
- export const BaseConfig = SupportedChainTypes[ChainTypes.SOL] as any;
1
+ import { ChainTypeEnum, SupportedChainTypes } from "@tomo-inc/wallet-utils";
2
+ export const BaseConfig = SupportedChainTypes[ChainTypeEnum.SOL] as any;
3
3
 
4
4
  export const TOKEN_METADATA_PROGRAM_ID = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";
5
5
  export const MSG_PREFIX = "\xffsolana offchain";
@@ -1,4 +1,4 @@
1
- import { ChainTypes, SupportedChainTypes, TomoApiDomains } from "@tomo-inc/wallet-utils";
1
+ import { ChainTypeEnum, SupportedChainTypes, TomoApiDomains } from "@tomo-inc/wallet-utils";
2
2
 
3
3
  import { BaseService } from "../base/service";
4
4
 
@@ -16,11 +16,11 @@ import * as base from "../dogecoin/base";
16
16
 
17
17
  export class SolanaService extends BaseService {
18
18
  private static instance: SolanaService;
19
- public chainType: ChainTypes | "";
19
+ public chainType: ChainTypeEnum | "";
20
20
  public rpcUrl: string;
21
21
  private connection: Connection;
22
22
 
23
- public constructor(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
23
+ public constructor(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
24
24
  super(tomoAppInfo, accountInfo);
25
25
  this.chainType = chainType;
26
26
  const config: any = {
@@ -38,7 +38,7 @@ export class SolanaService extends BaseService {
38
38
  this.connection = new Connection(rpcUrl, config);
39
39
  }
40
40
 
41
- public static getInstance(chainType: ChainTypes, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
41
+ public static getInstance(chainType: ChainTypeEnum, accountInfo: IAccountInfo, tomoAppInfo: TomoAppInfo) {
42
42
  if (!SolanaService.instance) {
43
43
  SolanaService.instance = new SolanaService(chainType, accountInfo, tomoAppInfo);
44
44
  }
@@ -131,7 +131,7 @@ export class SolanaService extends BaseService {
131
131
  };
132
132
  }
133
133
 
134
- const nativeChainId = SupportedChainTypes[this.chainType as ChainTypes].chainId as string;
134
+ const nativeChainId = SupportedChainTypes[this.chainType as ChainTypeEnum].chainId as string;
135
135
  const { nativeCurrency } = await this.networks.getNetworkByChainId(nativeChainId);
136
136
 
137
137
  const { baseFee = 1, gasLimit = 0 } = gasInfo;
@@ -1,4 +1,4 @@
1
- import { ChainTypes } from "@tomo-inc/wallet-utils";
1
+ import { ChainTypeEnum } from "@tomo-inc/wallet-utils";
2
2
 
3
3
  export interface WalletAccountItem {
4
4
  addresses: object[];
@@ -35,7 +35,7 @@ export interface IAccount {
35
35
  readonly type: AccountType;
36
36
  readonly lastUsedTime?: number;
37
37
  readonly sortIndex?: number;
38
- readonly addresses: Record<ChainTypes, ChainAddress[]>;
38
+ readonly addresses: Record<ChainTypeEnum, ChainAddress[]>;
39
39
 
40
40
  readonly mnemonic: string | null;
41
41
  readonly addressIndex: number;
@@ -1,4 +1,4 @@
1
- import { ChainTypes } from "@tomo-inc/wallet-utils";
1
+ import { ChainTypeEnum } from "@tomo-inc/wallet-utils";
2
2
 
3
3
  export type NativeCurrency = {
4
4
  symbol: string;
@@ -21,13 +21,13 @@ export type TonNetwork = "mainnet" | "testnet" | "devnet";
21
21
  export type TronNetwork = "mainnet" | "testnet" | "devnet";
22
22
 
23
23
  export type ChainTypeIds =
24
- | `${ChainTypes.EVM}:${EVMNetwork}`
25
- | `${ChainTypes.BTC}:${BTCNetwork}`
26
- | `${ChainTypes.SOL}:${SolNetwork}`
27
- | `${ChainTypes.SUI}:${SuiNetwork}`
28
- | `${ChainTypes.DOGE}:${DogeNetwork}`
29
- | `${ChainTypes.TON}:${TonNetwork}`
30
- | `${ChainTypes.TRON}:${TronNetwork}`;
24
+ | `${ChainTypeEnum.EVM}:${EVMNetwork}`
25
+ | `${ChainTypeEnum.BITCOIN}:${BTCNetwork}`
26
+ | `${ChainTypeEnum.SOLANA}:${SolNetwork}`
27
+ | `${ChainTypeEnum.SUI}:${SuiNetwork}`
28
+ | `${ChainTypeEnum.DOGECOIN}:${DogeNetwork}`
29
+ | `${ChainTypeEnum.TON}:${TonNetwork}`
30
+ | `${ChainTypeEnum.TRON}:${TronNetwork}`;
31
31
 
32
32
  export interface RemoteChainInfo2 {
33
33
  chainId: number;
@@ -1,4 +1,4 @@
1
- import { ChainTypes } from "@tomo-inc/wallet-utils";
1
+ import { ChainTypeEnum } from "@tomo-inc/wallet-utils";
2
2
 
3
3
  export enum TxTypes {
4
4
  swap = 1,
@@ -20,7 +20,7 @@ export interface TransactionsParams {
20
20
  }
21
21
 
22
22
  export interface TransactionItem {
23
- chainType: ChainTypes;
23
+ chainType: ChainTypeEnum;
24
24
  chainInfo: {
25
25
  chainId: string;
26
26
  name: string;
package/src/wallet.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  //types
2
- import { ChainTypes, getExplorerUrl } from "@tomo-inc/wallet-utils";
2
+ import { ChainTypeEnum, getExplorerUrl } from "@tomo-inc/wallet-utils";
3
3
 
4
- import { INetwork, NativeCurrency, TomoAppInfo, TransactionsParams, TransactionsResponse } from "./types";
5
4
  import { BaseService } from "./base/service";
5
+ import { INetwork, NativeCurrency, TomoAppInfo, TransactionsParams, TransactionsResponse } from "./types";
6
6
 
7
7
  export class TomoWallet extends BaseService {
8
8
  private static instance: TomoWallet;
@@ -20,19 +20,19 @@ export class TomoWallet extends BaseService {
20
20
  return new TomoWallet(walletId, tomoAppInfo);
21
21
  }
22
22
 
23
- public async supportedChains(chainType?: ChainTypes | ""): Promise<INetwork[]> {
23
+ public async supportedChains(chainType?: ChainTypeEnum | ""): Promise<INetwork[]> {
24
24
  const networks = await this.networks.getNetworks(chainType || "");
25
25
  return networks;
26
26
  }
27
27
 
28
- public async getChainInfo(chainType: ChainTypes, chainId: string): Promise<INetwork> {
28
+ public async getChainInfo(chainType: ChainTypeEnum, chainId: string): Promise<INetwork> {
29
29
  this.networks.setChainType(chainType);
30
30
  const network = await this.networks.getNetworkByChainId(chainId);
31
31
  return network;
32
32
  }
33
33
 
34
34
  //evm chains
35
- public async isChainSupported(chainType: ChainTypes, chainId: string): Promise<boolean> {
35
+ public async isChainSupported(chainType: ChainTypeEnum, chainId: string): Promise<boolean> {
36
36
  this.networks.setChainType(chainType);
37
37
  const chainInfo = await this.networks.getNetworkByChainId(chainId);
38
38
  if (!chainInfo) {
@@ -72,7 +72,7 @@ export class TomoWallet extends BaseService {
72
72
  const chainIndex = item.chainIndex;
73
73
  const chainInfo = (await this.networks.getNetworkByChainIndex(chainIndex)) as INetwork;
74
74
  return {
75
- chainType: chainInfo.platformType.toLowerCase() as ChainTypes,
75
+ chainType: chainInfo.platformType.toLowerCase() as ChainTypeEnum,
76
76
  chainInfo: {
77
77
  chainId: chainInfo.chainId.toString(),
78
78
  name: chainInfo.name,