@enclave-hq/wallet-sdk 1.0.0 → 1.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.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ChainType as ChainType$2, ChainInfo as ChainInfo$1 } from '@enclave-hq/chain-utils';
1
2
  import EventEmitter from 'eventemitter3';
2
3
  import { WalletClient } from 'viem';
3
4
 
@@ -10,12 +11,8 @@ declare class TypedEventEmitter<TEvents extends Record<string, (...args: any[])
10
11
  removeAllListeners<K extends keyof TEvents>(event?: K): this;
11
12
  }
12
13
 
13
- declare enum ChainType {
14
- EVM = "evm",
15
- TRON = "tron",
16
- SOLANA = "solana",
17
- COSMOS = "cosmos"
18
- }
14
+ declare const ChainType$1: typeof ChainType$2;
15
+ type ChainType$1 = ChainType$2;
19
16
  declare enum WalletType {
20
17
  METAMASK = "metamask",
21
18
  WALLETCONNECT = "walletconnect",
@@ -35,14 +32,14 @@ interface Account {
35
32
  universalAddress: UniversalAddress;
36
33
  nativeAddress: string;
37
34
  chainId: number;
38
- chainType: ChainType;
35
+ chainType: ChainType$1;
39
36
  isActive: boolean;
40
37
  balance?: string;
41
38
  name?: string;
42
39
  }
43
40
  interface IWalletAdapter {
44
41
  readonly type: WalletType;
45
- readonly chainType: ChainType;
42
+ readonly chainType: ChainType$1;
46
43
  readonly name: string;
47
44
  readonly icon?: string;
48
45
  state: WalletState;
@@ -51,7 +48,7 @@ interface IWalletAdapter {
51
48
  disconnect(): Promise<void>;
52
49
  isAvailable(): Promise<boolean>;
53
50
  signMessage(message: string): Promise<string>;
54
- signTransaction?(transaction: any): Promise<string>;
51
+ signTransaction?(transaction: Transaction): Promise<string>;
55
52
  signTypedData?(typedData: any): Promise<string>;
56
53
  switchChain?(chainId: number): Promise<void>;
57
54
  addChain?(chainConfig: AddChainParams): Promise<void>;
@@ -76,6 +73,24 @@ interface ContractWriteParams extends ContractReadParams {
76
73
  gas?: number;
77
74
  gasPrice?: string;
78
75
  }
76
+ interface EVMTransaction {
77
+ to: string;
78
+ value?: string | bigint;
79
+ data?: string;
80
+ gas?: string | bigint;
81
+ gasPrice?: string | bigint;
82
+ maxFeePerGas?: string | bigint;
83
+ maxPriorityFeePerGas?: string | bigint;
84
+ nonce?: number;
85
+ chainId?: number;
86
+ }
87
+ interface TronTransaction {
88
+ txID?: string;
89
+ raw_data?: any;
90
+ raw_data_hex?: string;
91
+ visible?: boolean;
92
+ }
93
+ type Transaction = EVMTransaction | TronTransaction;
79
94
  interface TransactionReceipt {
80
95
  transactionHash: string;
81
96
  blockNumber: number;
@@ -109,7 +124,7 @@ interface WalletManagerConfig {
109
124
  interface ConnectedWallet {
110
125
  account: Account;
111
126
  walletType: WalletType;
112
- chainType: ChainType;
127
+ chainType: ChainType$1;
113
128
  isPrimary: boolean;
114
129
  canSwitchChain: boolean;
115
130
  adapter: IWalletAdapter;
@@ -118,17 +133,17 @@ interface WalletManagerEvents extends Record<string, (...args: any[]) => void> {
118
133
  accountChanged: (account: Account | null) => void;
119
134
  chainChanged: (chainId: number, account: Account) => void;
120
135
  disconnected: () => void;
121
- walletAccountChanged: (chainType: ChainType, account: Account | null, isPrimary: boolean) => void;
122
- walletChainChanged: (chainType: ChainType, chainId: number, account: Account, isPrimary: boolean) => void;
123
- walletDisconnected: (chainType: ChainType, isPrimary: boolean) => void;
124
- primaryWalletSwitched: (newPrimary: Account, oldPrimary: Account | null, chainType: ChainType) => void;
136
+ walletAccountChanged: (chainType: ChainType$1, account: Account | null, isPrimary: boolean) => void;
137
+ walletChainChanged: (chainType: ChainType$1, chainId: number, account: Account, isPrimary: boolean) => void;
138
+ walletDisconnected: (chainType: ChainType$1, isPrimary: boolean) => void;
139
+ primaryWalletSwitched: (newPrimary: Account, oldPrimary: Account | null, chainType: ChainType$1) => void;
125
140
  error: (error: Error) => void;
126
141
  }
127
142
  interface WalletHistoryRecord {
128
143
  universalAddress: UniversalAddress;
129
144
  nativeAddress: string;
130
145
  chainId: number;
131
- chainType: ChainType;
146
+ chainType: ChainType$1;
132
147
  walletType: WalletType;
133
148
  lastConnected: number;
134
149
  name?: string;
@@ -139,7 +154,7 @@ interface StorageData {
139
154
  }
140
155
  interface WalletAvailability {
141
156
  walletType: WalletType;
142
- chainType: ChainType;
157
+ chainType: ChainType$1;
143
158
  isAvailable: boolean;
144
159
  downloadUrl?: string;
145
160
  detected: boolean;
@@ -156,27 +171,29 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
156
171
  connectWithPrivateKey(privateKey: string, chainId?: number): Promise<Account>;
157
172
  disconnect(): Promise<void>;
158
173
  disconnectAll(): Promise<void>;
159
- switchPrimaryWallet(chainType: ChainType): Promise<Account>;
174
+ switchPrimaryWallet(chainType: ChainType$1): Promise<Account>;
160
175
  getPrimaryAccount(): Account | null;
161
176
  getConnectedWallets(): ConnectedWallet[];
162
- getWalletByChainType(chainType: ChainType): IWalletAdapter | null;
177
+ getWalletByChainType(chainType: ChainType$1): IWalletAdapter | null;
163
178
  signMessage(message: string): Promise<string>;
164
- signMessageWithChainType(message: string, chainType?: ChainType): Promise<string>;
165
- signTypedData(typedData: any, chainType?: ChainType): Promise<string>;
179
+ signMessageWithChainType(message: string, chainType?: ChainType$1): Promise<string>;
180
+ signTypedData(typedData: any, chainType?: ChainType$1): Promise<string>;
181
+ signTransaction(transaction: any): Promise<string>;
182
+ signTransactionWithChainType(transaction: any, chainType?: ChainType$1): Promise<string>;
166
183
  requestSwitchChain(chainId: number, options?: {
167
184
  addChainIfNotExists?: boolean;
168
185
  chainConfig?: AddChainParams;
169
186
  }): Promise<Account>;
170
- readContract<T = any>(address: string, abi: any[], functionName: string, args?: any[], chainType?: ChainType): Promise<T>;
187
+ readContract<T = any>(address: string, abi: any[], functionName: string, args?: any[], chainType?: ChainType$1): Promise<T>;
171
188
  writeContract(address: string, abi: any[], functionName: string, args?: any[], options?: {
172
189
  value?: string;
173
190
  gas?: number;
174
191
  gasPrice?: string;
175
- }, chainType?: ChainType): Promise<string>;
176
- estimateGas(address: string, abi: any[], functionName: string, args?: any[], chainType?: ChainType): Promise<bigint>;
177
- waitForTransaction(txHash: string, confirmations?: number, chainType?: ChainType): Promise<TransactionReceipt>;
192
+ }, chainType?: ChainType$1): Promise<string>;
193
+ estimateGas(address: string, abi: any[], functionName: string, args?: any[], chainType?: ChainType$1): Promise<bigint>;
194
+ waitForTransaction(txHash: string, confirmations?: number, chainType?: ChainType$1): Promise<TransactionReceipt>;
178
195
  getProvider(): any;
179
- getProviderByChainType(chainType: ChainType): any;
196
+ getProviderByChainType(chainType: ChainType$1): any;
180
197
  private setPrimaryWallet;
181
198
  private canSwitchChain;
182
199
  private setupAdapterListeners;
@@ -195,7 +212,7 @@ declare class AdapterRegistry {
195
212
  getAdapter(type: WalletType): IWalletAdapter | null;
196
213
  has(type: WalletType): boolean;
197
214
  getRegisteredTypes(): WalletType[];
198
- getAdapterTypesByChainType(chainType: ChainType): WalletType[];
215
+ getAdapterTypesByChainType(chainType: ChainType$1): WalletType[];
199
216
  }
200
217
 
201
218
  declare class WalletSDKError extends Error {
@@ -233,7 +250,7 @@ declare class NetworkError extends WalletSDKError {
233
250
 
234
251
  declare abstract class WalletAdapter extends EventEmitter implements IWalletAdapter {
235
252
  abstract readonly type: WalletType;
236
- abstract readonly chainType: ChainType;
253
+ abstract readonly chainType: ChainType$1;
237
254
  abstract readonly name: string;
238
255
  readonly icon?: string;
239
256
  state: WalletState;
@@ -281,6 +298,7 @@ declare class MetaMaskAdapter extends BrowserWalletAdapter {
281
298
  connect(chainId?: number): Promise<Account>;
282
299
  signMessage(message: string): Promise<string>;
283
300
  signTypedData(typedData: any): Promise<string>;
301
+ signTransaction(transaction: any): Promise<string>;
284
302
  switchChain(chainId: number): Promise<void>;
285
303
  addChain(chainConfig: AddChainParams): Promise<void>;
286
304
  readContract<T = any>(params: ContractReadParams): Promise<T>;
@@ -307,12 +325,20 @@ declare class TronLinkAdapter extends BrowserWalletAdapter {
307
325
  private static readonly TRON_MAINNET_CHAIN_ID;
308
326
  connect(chainId?: number): Promise<Account>;
309
327
  signMessage(message: string): Promise<string>;
328
+ signTransaction(transaction: any): Promise<string>;
329
+ readContract<T = any>(params: ContractReadParams): Promise<T>;
330
+ writeContract(params: ContractWriteParams): Promise<string>;
331
+ waitForTransaction(txHash: string, _confirmations?: number): Promise<TransactionReceipt>;
310
332
  getProvider(): any;
311
333
  protected getBrowserProvider(): any | undefined;
312
334
  private getTronWeb;
313
335
  protected getDownloadUrl(): string;
314
336
  protected setupEventListeners(): void;
315
337
  protected removeEventListeners(): void;
338
+ private pollingInterval;
339
+ private lastKnownAddress;
340
+ private startPolling;
341
+ private stopPolling;
316
342
  private handleAccountsChanged;
317
343
  private handleDisconnect;
318
344
  }
@@ -350,14 +376,14 @@ interface AuthMessageParams {
350
376
  declare class AuthMessageGenerator {
351
377
  private readonly domain;
352
378
  constructor(domain: string);
353
- generateAuthMessage(chainType: ChainType, nonce: string, chainId: number, timestamp?: number, statement?: string): string;
379
+ generateAuthMessage(chainType: ChainType$1, nonce: string, chainId: number, timestamp?: number, statement?: string): string;
354
380
  private generateEIP191Message;
355
381
  private generateTIP191Message;
356
382
  static generateNonce(): string;
357
383
  }
358
384
 
359
385
  declare class SignatureVerifier {
360
- verifySignature(message: string, signature: string, expectedAddress: string, chainType: ChainType): Promise<boolean>;
386
+ verifySignature(message: string, signature: string, expectedAddress: string, chainType: ChainType$1): Promise<boolean>;
361
387
  private verifyEIP191Signature;
362
388
  private verifyTIP191Signature;
363
389
  }
@@ -375,7 +401,7 @@ declare class WalletDetector {
375
401
  interface WalletMetadata {
376
402
  type: WalletType;
377
403
  name: string;
378
- chainType: ChainType;
404
+ chainType: ChainType$1;
379
405
  icon?: string;
380
406
  downloadUrl?: string;
381
407
  description?: string;
@@ -405,10 +431,9 @@ declare function isValidTronHexAddress(address: string): boolean;
405
431
  declare function compareTronAddresses(a: string, b: string): boolean;
406
432
  declare function shortenTronAddress(address: string, chars?: number): string;
407
433
 
408
- interface ChainInfo {
434
+ interface ChainInfo extends Omit<ChainInfo$1, 'nativeChainId' | 'slip44'> {
409
435
  id: number;
410
- name: string;
411
- chainType: ChainType;
436
+ slip44?: number;
412
437
  nativeCurrency: {
413
438
  name: string;
414
439
  symbol: string;
@@ -420,15 +445,15 @@ interface ChainInfo {
420
445
  }
421
446
  declare const CHAIN_INFO: Record<number, ChainInfo>;
422
447
  declare function getChainInfo(chainId: number): ChainInfo | undefined;
423
- declare function getChainType(chainId: number): ChainType | undefined;
448
+ declare function getChainType(chainId: number): ChainType$2 | undefined;
424
449
  declare function isEVMChain(chainId: number): boolean;
425
450
  declare function isTronChain(chainId: number): boolean;
426
451
 
427
- declare function validateAddress(address: string, chainType: ChainType): boolean;
452
+ declare function validateAddress(address: string, chainType: ChainType$1): boolean;
428
453
  declare function validateAddressForChain(address: string, chainId: number): boolean;
429
454
  declare function isValidChainId(chainId: number): boolean;
430
455
  declare function isValidSignature(signature: string): boolean;
431
- declare function isValidTransactionHash(txHash: string, chainType: ChainType): boolean;
456
+ declare function isValidTransactionHash(txHash: string, chainType: ChainType$1): boolean;
432
457
 
433
458
  declare function isHex(value: string): boolean;
434
459
  declare function toHex(value: string): string;
@@ -438,4 +463,4 @@ declare function hexToNumber(hex: string): number;
438
463
  declare function ensureHexPrefix(value: string): string;
439
464
  declare function removeHexPrefix(value: string): string;
440
465
 
441
- export { type Account, AdapterRegistry, type AddChainParams, AuthMessageGenerator, type AuthMessageParams, BrowserWalletAdapter, CHAIN_INFO, type ChainInfo, ChainNotSupportedError, ChainType, ConfigurationError, type ConnectedWallet, ConnectionRejectedError, type ContractReadParams, type ContractWriteParams, EVMPrivateKeyAdapter, type IWalletAdapter, MetaMaskAdapter, MethodNotSupportedError, NetworkError, SUPPORTED_WALLETS, SignatureRejectedError, SignatureVerifier, type StorageData, TransactionFailedError, type TransactionReceipt, TronLinkAdapter, type UniversalAddress, WalletAdapter, type WalletAvailability, WalletDetector, type WalletHistoryRecord, WalletManager, type WalletManagerConfig, type WalletManagerEvents, type WalletMetadata, WalletNotAvailableError, WalletNotConnectedError, WalletSDKError, WalletState, WalletType, compareEVMAddresses, compareTronAddresses, compareUniversalAddresses, createUniversalAddress, WalletManager as default, ensureHexPrefix, formatEVMAddress, fromHex, getAddressFromUniversalAddress, getChainIdFromUniversalAddress, getChainInfo, getChainType, getEVMWallets, getTronWallets, getWalletMetadata, hexToNumber, isEVMChain, isHex, isTronChain, isValidChainId, isValidEVMAddress, isValidSignature, isValidTransactionHash, isValidTronAddress, isValidTronHexAddress, isValidUniversalAddress, numberToHex, parseUniversalAddress, removeHexPrefix, shortenAddress, shortenTronAddress, toHex, validateAddress, validateAddressForChain };
466
+ export { type Account, AdapterRegistry, type AddChainParams, AuthMessageGenerator, type AuthMessageParams, BrowserWalletAdapter, CHAIN_INFO, type ChainInfo, ChainNotSupportedError, ChainType$1 as ChainType, ConfigurationError, type ConnectedWallet, ConnectionRejectedError, type ContractReadParams, type ContractWriteParams, EVMPrivateKeyAdapter, type EVMTransaction, type IWalletAdapter, MetaMaskAdapter, MethodNotSupportedError, NetworkError, SUPPORTED_WALLETS, SignatureRejectedError, SignatureVerifier, type StorageData, type Transaction, TransactionFailedError, type TransactionReceipt, TronLinkAdapter, type TronTransaction, type UniversalAddress, WalletAdapter, type WalletAvailability, WalletDetector, type WalletHistoryRecord, WalletManager, type WalletManagerConfig, type WalletManagerEvents, type WalletMetadata, WalletNotAvailableError, WalletNotConnectedError, WalletSDKError, WalletState, WalletType, compareEVMAddresses, compareTronAddresses, compareUniversalAddresses, createUniversalAddress, WalletManager as default, ensureHexPrefix, formatEVMAddress, fromHex, getAddressFromUniversalAddress, getChainIdFromUniversalAddress, getChainInfo, getChainType, getEVMWallets, getTronWallets, getWalletMetadata, hexToNumber, isEVMChain, isHex, isTronChain, isValidChainId, isValidEVMAddress, isValidSignature, isValidTransactionHash, isValidTronAddress, isValidTronHexAddress, isValidUniversalAddress, numberToHex, parseUniversalAddress, removeHexPrefix, shortenAddress, shortenTronAddress, toHex, validateAddress, validateAddressForChain };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ChainType as ChainType$2, ChainInfo as ChainInfo$1 } from '@enclave-hq/chain-utils';
1
2
  import EventEmitter from 'eventemitter3';
2
3
  import { WalletClient } from 'viem';
3
4
 
@@ -10,12 +11,8 @@ declare class TypedEventEmitter<TEvents extends Record<string, (...args: any[])
10
11
  removeAllListeners<K extends keyof TEvents>(event?: K): this;
11
12
  }
12
13
 
13
- declare enum ChainType {
14
- EVM = "evm",
15
- TRON = "tron",
16
- SOLANA = "solana",
17
- COSMOS = "cosmos"
18
- }
14
+ declare const ChainType$1: typeof ChainType$2;
15
+ type ChainType$1 = ChainType$2;
19
16
  declare enum WalletType {
20
17
  METAMASK = "metamask",
21
18
  WALLETCONNECT = "walletconnect",
@@ -35,14 +32,14 @@ interface Account {
35
32
  universalAddress: UniversalAddress;
36
33
  nativeAddress: string;
37
34
  chainId: number;
38
- chainType: ChainType;
35
+ chainType: ChainType$1;
39
36
  isActive: boolean;
40
37
  balance?: string;
41
38
  name?: string;
42
39
  }
43
40
  interface IWalletAdapter {
44
41
  readonly type: WalletType;
45
- readonly chainType: ChainType;
42
+ readonly chainType: ChainType$1;
46
43
  readonly name: string;
47
44
  readonly icon?: string;
48
45
  state: WalletState;
@@ -51,7 +48,7 @@ interface IWalletAdapter {
51
48
  disconnect(): Promise<void>;
52
49
  isAvailable(): Promise<boolean>;
53
50
  signMessage(message: string): Promise<string>;
54
- signTransaction?(transaction: any): Promise<string>;
51
+ signTransaction?(transaction: Transaction): Promise<string>;
55
52
  signTypedData?(typedData: any): Promise<string>;
56
53
  switchChain?(chainId: number): Promise<void>;
57
54
  addChain?(chainConfig: AddChainParams): Promise<void>;
@@ -76,6 +73,24 @@ interface ContractWriteParams extends ContractReadParams {
76
73
  gas?: number;
77
74
  gasPrice?: string;
78
75
  }
76
+ interface EVMTransaction {
77
+ to: string;
78
+ value?: string | bigint;
79
+ data?: string;
80
+ gas?: string | bigint;
81
+ gasPrice?: string | bigint;
82
+ maxFeePerGas?: string | bigint;
83
+ maxPriorityFeePerGas?: string | bigint;
84
+ nonce?: number;
85
+ chainId?: number;
86
+ }
87
+ interface TronTransaction {
88
+ txID?: string;
89
+ raw_data?: any;
90
+ raw_data_hex?: string;
91
+ visible?: boolean;
92
+ }
93
+ type Transaction = EVMTransaction | TronTransaction;
79
94
  interface TransactionReceipt {
80
95
  transactionHash: string;
81
96
  blockNumber: number;
@@ -109,7 +124,7 @@ interface WalletManagerConfig {
109
124
  interface ConnectedWallet {
110
125
  account: Account;
111
126
  walletType: WalletType;
112
- chainType: ChainType;
127
+ chainType: ChainType$1;
113
128
  isPrimary: boolean;
114
129
  canSwitchChain: boolean;
115
130
  adapter: IWalletAdapter;
@@ -118,17 +133,17 @@ interface WalletManagerEvents extends Record<string, (...args: any[]) => void> {
118
133
  accountChanged: (account: Account | null) => void;
119
134
  chainChanged: (chainId: number, account: Account) => void;
120
135
  disconnected: () => void;
121
- walletAccountChanged: (chainType: ChainType, account: Account | null, isPrimary: boolean) => void;
122
- walletChainChanged: (chainType: ChainType, chainId: number, account: Account, isPrimary: boolean) => void;
123
- walletDisconnected: (chainType: ChainType, isPrimary: boolean) => void;
124
- primaryWalletSwitched: (newPrimary: Account, oldPrimary: Account | null, chainType: ChainType) => void;
136
+ walletAccountChanged: (chainType: ChainType$1, account: Account | null, isPrimary: boolean) => void;
137
+ walletChainChanged: (chainType: ChainType$1, chainId: number, account: Account, isPrimary: boolean) => void;
138
+ walletDisconnected: (chainType: ChainType$1, isPrimary: boolean) => void;
139
+ primaryWalletSwitched: (newPrimary: Account, oldPrimary: Account | null, chainType: ChainType$1) => void;
125
140
  error: (error: Error) => void;
126
141
  }
127
142
  interface WalletHistoryRecord {
128
143
  universalAddress: UniversalAddress;
129
144
  nativeAddress: string;
130
145
  chainId: number;
131
- chainType: ChainType;
146
+ chainType: ChainType$1;
132
147
  walletType: WalletType;
133
148
  lastConnected: number;
134
149
  name?: string;
@@ -139,7 +154,7 @@ interface StorageData {
139
154
  }
140
155
  interface WalletAvailability {
141
156
  walletType: WalletType;
142
- chainType: ChainType;
157
+ chainType: ChainType$1;
143
158
  isAvailable: boolean;
144
159
  downloadUrl?: string;
145
160
  detected: boolean;
@@ -156,27 +171,29 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
156
171
  connectWithPrivateKey(privateKey: string, chainId?: number): Promise<Account>;
157
172
  disconnect(): Promise<void>;
158
173
  disconnectAll(): Promise<void>;
159
- switchPrimaryWallet(chainType: ChainType): Promise<Account>;
174
+ switchPrimaryWallet(chainType: ChainType$1): Promise<Account>;
160
175
  getPrimaryAccount(): Account | null;
161
176
  getConnectedWallets(): ConnectedWallet[];
162
- getWalletByChainType(chainType: ChainType): IWalletAdapter | null;
177
+ getWalletByChainType(chainType: ChainType$1): IWalletAdapter | null;
163
178
  signMessage(message: string): Promise<string>;
164
- signMessageWithChainType(message: string, chainType?: ChainType): Promise<string>;
165
- signTypedData(typedData: any, chainType?: ChainType): Promise<string>;
179
+ signMessageWithChainType(message: string, chainType?: ChainType$1): Promise<string>;
180
+ signTypedData(typedData: any, chainType?: ChainType$1): Promise<string>;
181
+ signTransaction(transaction: any): Promise<string>;
182
+ signTransactionWithChainType(transaction: any, chainType?: ChainType$1): Promise<string>;
166
183
  requestSwitchChain(chainId: number, options?: {
167
184
  addChainIfNotExists?: boolean;
168
185
  chainConfig?: AddChainParams;
169
186
  }): Promise<Account>;
170
- readContract<T = any>(address: string, abi: any[], functionName: string, args?: any[], chainType?: ChainType): Promise<T>;
187
+ readContract<T = any>(address: string, abi: any[], functionName: string, args?: any[], chainType?: ChainType$1): Promise<T>;
171
188
  writeContract(address: string, abi: any[], functionName: string, args?: any[], options?: {
172
189
  value?: string;
173
190
  gas?: number;
174
191
  gasPrice?: string;
175
- }, chainType?: ChainType): Promise<string>;
176
- estimateGas(address: string, abi: any[], functionName: string, args?: any[], chainType?: ChainType): Promise<bigint>;
177
- waitForTransaction(txHash: string, confirmations?: number, chainType?: ChainType): Promise<TransactionReceipt>;
192
+ }, chainType?: ChainType$1): Promise<string>;
193
+ estimateGas(address: string, abi: any[], functionName: string, args?: any[], chainType?: ChainType$1): Promise<bigint>;
194
+ waitForTransaction(txHash: string, confirmations?: number, chainType?: ChainType$1): Promise<TransactionReceipt>;
178
195
  getProvider(): any;
179
- getProviderByChainType(chainType: ChainType): any;
196
+ getProviderByChainType(chainType: ChainType$1): any;
180
197
  private setPrimaryWallet;
181
198
  private canSwitchChain;
182
199
  private setupAdapterListeners;
@@ -195,7 +212,7 @@ declare class AdapterRegistry {
195
212
  getAdapter(type: WalletType): IWalletAdapter | null;
196
213
  has(type: WalletType): boolean;
197
214
  getRegisteredTypes(): WalletType[];
198
- getAdapterTypesByChainType(chainType: ChainType): WalletType[];
215
+ getAdapterTypesByChainType(chainType: ChainType$1): WalletType[];
199
216
  }
200
217
 
201
218
  declare class WalletSDKError extends Error {
@@ -233,7 +250,7 @@ declare class NetworkError extends WalletSDKError {
233
250
 
234
251
  declare abstract class WalletAdapter extends EventEmitter implements IWalletAdapter {
235
252
  abstract readonly type: WalletType;
236
- abstract readonly chainType: ChainType;
253
+ abstract readonly chainType: ChainType$1;
237
254
  abstract readonly name: string;
238
255
  readonly icon?: string;
239
256
  state: WalletState;
@@ -281,6 +298,7 @@ declare class MetaMaskAdapter extends BrowserWalletAdapter {
281
298
  connect(chainId?: number): Promise<Account>;
282
299
  signMessage(message: string): Promise<string>;
283
300
  signTypedData(typedData: any): Promise<string>;
301
+ signTransaction(transaction: any): Promise<string>;
284
302
  switchChain(chainId: number): Promise<void>;
285
303
  addChain(chainConfig: AddChainParams): Promise<void>;
286
304
  readContract<T = any>(params: ContractReadParams): Promise<T>;
@@ -307,12 +325,20 @@ declare class TronLinkAdapter extends BrowserWalletAdapter {
307
325
  private static readonly TRON_MAINNET_CHAIN_ID;
308
326
  connect(chainId?: number): Promise<Account>;
309
327
  signMessage(message: string): Promise<string>;
328
+ signTransaction(transaction: any): Promise<string>;
329
+ readContract<T = any>(params: ContractReadParams): Promise<T>;
330
+ writeContract(params: ContractWriteParams): Promise<string>;
331
+ waitForTransaction(txHash: string, _confirmations?: number): Promise<TransactionReceipt>;
310
332
  getProvider(): any;
311
333
  protected getBrowserProvider(): any | undefined;
312
334
  private getTronWeb;
313
335
  protected getDownloadUrl(): string;
314
336
  protected setupEventListeners(): void;
315
337
  protected removeEventListeners(): void;
338
+ private pollingInterval;
339
+ private lastKnownAddress;
340
+ private startPolling;
341
+ private stopPolling;
316
342
  private handleAccountsChanged;
317
343
  private handleDisconnect;
318
344
  }
@@ -350,14 +376,14 @@ interface AuthMessageParams {
350
376
  declare class AuthMessageGenerator {
351
377
  private readonly domain;
352
378
  constructor(domain: string);
353
- generateAuthMessage(chainType: ChainType, nonce: string, chainId: number, timestamp?: number, statement?: string): string;
379
+ generateAuthMessage(chainType: ChainType$1, nonce: string, chainId: number, timestamp?: number, statement?: string): string;
354
380
  private generateEIP191Message;
355
381
  private generateTIP191Message;
356
382
  static generateNonce(): string;
357
383
  }
358
384
 
359
385
  declare class SignatureVerifier {
360
- verifySignature(message: string, signature: string, expectedAddress: string, chainType: ChainType): Promise<boolean>;
386
+ verifySignature(message: string, signature: string, expectedAddress: string, chainType: ChainType$1): Promise<boolean>;
361
387
  private verifyEIP191Signature;
362
388
  private verifyTIP191Signature;
363
389
  }
@@ -375,7 +401,7 @@ declare class WalletDetector {
375
401
  interface WalletMetadata {
376
402
  type: WalletType;
377
403
  name: string;
378
- chainType: ChainType;
404
+ chainType: ChainType$1;
379
405
  icon?: string;
380
406
  downloadUrl?: string;
381
407
  description?: string;
@@ -405,10 +431,9 @@ declare function isValidTronHexAddress(address: string): boolean;
405
431
  declare function compareTronAddresses(a: string, b: string): boolean;
406
432
  declare function shortenTronAddress(address: string, chars?: number): string;
407
433
 
408
- interface ChainInfo {
434
+ interface ChainInfo extends Omit<ChainInfo$1, 'nativeChainId' | 'slip44'> {
409
435
  id: number;
410
- name: string;
411
- chainType: ChainType;
436
+ slip44?: number;
412
437
  nativeCurrency: {
413
438
  name: string;
414
439
  symbol: string;
@@ -420,15 +445,15 @@ interface ChainInfo {
420
445
  }
421
446
  declare const CHAIN_INFO: Record<number, ChainInfo>;
422
447
  declare function getChainInfo(chainId: number): ChainInfo | undefined;
423
- declare function getChainType(chainId: number): ChainType | undefined;
448
+ declare function getChainType(chainId: number): ChainType$2 | undefined;
424
449
  declare function isEVMChain(chainId: number): boolean;
425
450
  declare function isTronChain(chainId: number): boolean;
426
451
 
427
- declare function validateAddress(address: string, chainType: ChainType): boolean;
452
+ declare function validateAddress(address: string, chainType: ChainType$1): boolean;
428
453
  declare function validateAddressForChain(address: string, chainId: number): boolean;
429
454
  declare function isValidChainId(chainId: number): boolean;
430
455
  declare function isValidSignature(signature: string): boolean;
431
- declare function isValidTransactionHash(txHash: string, chainType: ChainType): boolean;
456
+ declare function isValidTransactionHash(txHash: string, chainType: ChainType$1): boolean;
432
457
 
433
458
  declare function isHex(value: string): boolean;
434
459
  declare function toHex(value: string): string;
@@ -438,4 +463,4 @@ declare function hexToNumber(hex: string): number;
438
463
  declare function ensureHexPrefix(value: string): string;
439
464
  declare function removeHexPrefix(value: string): string;
440
465
 
441
- export { type Account, AdapterRegistry, type AddChainParams, AuthMessageGenerator, type AuthMessageParams, BrowserWalletAdapter, CHAIN_INFO, type ChainInfo, ChainNotSupportedError, ChainType, ConfigurationError, type ConnectedWallet, ConnectionRejectedError, type ContractReadParams, type ContractWriteParams, EVMPrivateKeyAdapter, type IWalletAdapter, MetaMaskAdapter, MethodNotSupportedError, NetworkError, SUPPORTED_WALLETS, SignatureRejectedError, SignatureVerifier, type StorageData, TransactionFailedError, type TransactionReceipt, TronLinkAdapter, type UniversalAddress, WalletAdapter, type WalletAvailability, WalletDetector, type WalletHistoryRecord, WalletManager, type WalletManagerConfig, type WalletManagerEvents, type WalletMetadata, WalletNotAvailableError, WalletNotConnectedError, WalletSDKError, WalletState, WalletType, compareEVMAddresses, compareTronAddresses, compareUniversalAddresses, createUniversalAddress, WalletManager as default, ensureHexPrefix, formatEVMAddress, fromHex, getAddressFromUniversalAddress, getChainIdFromUniversalAddress, getChainInfo, getChainType, getEVMWallets, getTronWallets, getWalletMetadata, hexToNumber, isEVMChain, isHex, isTronChain, isValidChainId, isValidEVMAddress, isValidSignature, isValidTransactionHash, isValidTronAddress, isValidTronHexAddress, isValidUniversalAddress, numberToHex, parseUniversalAddress, removeHexPrefix, shortenAddress, shortenTronAddress, toHex, validateAddress, validateAddressForChain };
466
+ export { type Account, AdapterRegistry, type AddChainParams, AuthMessageGenerator, type AuthMessageParams, BrowserWalletAdapter, CHAIN_INFO, type ChainInfo, ChainNotSupportedError, ChainType$1 as ChainType, ConfigurationError, type ConnectedWallet, ConnectionRejectedError, type ContractReadParams, type ContractWriteParams, EVMPrivateKeyAdapter, type EVMTransaction, type IWalletAdapter, MetaMaskAdapter, MethodNotSupportedError, NetworkError, SUPPORTED_WALLETS, SignatureRejectedError, SignatureVerifier, type StorageData, type Transaction, TransactionFailedError, type TransactionReceipt, TronLinkAdapter, type TronTransaction, type UniversalAddress, WalletAdapter, type WalletAvailability, WalletDetector, type WalletHistoryRecord, WalletManager, type WalletManagerConfig, type WalletManagerEvents, type WalletMetadata, WalletNotAvailableError, WalletNotConnectedError, WalletSDKError, WalletState, WalletType, compareEVMAddresses, compareTronAddresses, compareUniversalAddresses, createUniversalAddress, WalletManager as default, ensureHexPrefix, formatEVMAddress, fromHex, getAddressFromUniversalAddress, getChainIdFromUniversalAddress, getChainInfo, getChainType, getEVMWallets, getTronWallets, getWalletMetadata, hexToNumber, isEVMChain, isHex, isTronChain, isValidChainId, isValidEVMAddress, isValidSignature, isValidTransactionHash, isValidTronAddress, isValidTronHexAddress, isValidUniversalAddress, numberToHex, parseUniversalAddress, removeHexPrefix, shortenAddress, shortenTronAddress, toHex, validateAddress, validateAddressForChain };