@enclave-hq/wallet-sdk 1.2.3 → 1.2.5
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/README.md +51 -1
- package/dist/index.d.mts +380 -195
- package/dist/index.js +3117 -141
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3774 -111
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +91 -9
- package/dist/react/index.d.ts +91 -9
- package/dist/react/index.js +3651 -104
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +3625 -82
- package/dist/react/index.mjs.map +1 -1
- package/dist/tron.d.mts +36 -0
- package/dist/tron.js +852 -0
- package/dist/tron.js.map +1 -0
- package/dist/tron.mjs +846 -0
- package/dist/tron.mjs.map +1 -0
- package/dist/wallet-adapter-DRd0xm3N.d.mts +197 -0
- package/package.json +14 -4
- package/dist/index.d.ts +0 -477
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { W as WalletManagerEvents, a as WalletManagerConfig, b as WalletType, A as Account, C as ChainType$1, c as ConnectedWallet, I as IWalletAdapter, d as AddChainParams, T as TransactionReceipt, e as WalletAdapter, f as ContractReadParams, g as ContractWriteParams, h as WalletAvailability, U as UniversalAddress } from './wallet-adapter-DRd0xm3N.mjs';
|
|
2
|
+
export { E as EVMTransaction, i as ISigner, S as StorageData, l as Transaction, k as TronTransaction, j as WalletHistoryRecord, m as WalletState } from './wallet-adapter-DRd0xm3N.mjs';
|
|
3
3
|
import { WalletClient } from 'viem';
|
|
4
|
+
import * as _enclave_hq_chain_utils from '@enclave-hq/chain-utils';
|
|
5
|
+
import { ChainInfo as ChainInfo$1, ChainType as ChainType$2 } from '@enclave-hq/chain-utils';
|
|
6
|
+
import 'eventemitter3';
|
|
4
7
|
|
|
5
8
|
declare class TypedEventEmitter<TEvents extends Record<string, (...args: any[]) => void>> {
|
|
6
9
|
private emitter;
|
|
@@ -11,161 +14,52 @@ declare class TypedEventEmitter<TEvents extends Record<string, (...args: any[])
|
|
|
11
14
|
removeAllListeners<K extends keyof TEvents>(event?: K): this;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
writeContract?(params: ContractWriteParams): Promise<string>;
|
|
61
|
-
estimateGas?(params: ContractWriteParams): Promise<bigint>;
|
|
62
|
-
waitForTransaction?(txHash: string, confirmations?: number): Promise<TransactionReceipt>;
|
|
63
|
-
getProvider(): any;
|
|
64
|
-
getSigner?(): any;
|
|
65
|
-
on(event: string, handler: (...args: any[]) => void): void;
|
|
66
|
-
off(event: string, handler: (...args: any[]) => void): void;
|
|
67
|
-
removeAllListeners(event?: string): void;
|
|
68
|
-
}
|
|
69
|
-
interface ContractReadParams {
|
|
70
|
-
address: string;
|
|
71
|
-
abi: any[];
|
|
72
|
-
functionName: string;
|
|
73
|
-
args?: any[];
|
|
74
|
-
}
|
|
75
|
-
interface ContractWriteParams extends ContractReadParams {
|
|
76
|
-
value?: string;
|
|
77
|
-
gas?: number;
|
|
78
|
-
gasPrice?: string;
|
|
79
|
-
maxFeePerGas?: string;
|
|
80
|
-
maxPriorityFeePerGas?: string;
|
|
81
|
-
}
|
|
82
|
-
interface EVMTransaction {
|
|
83
|
-
to: string;
|
|
84
|
-
value?: string | bigint;
|
|
85
|
-
data?: string;
|
|
86
|
-
gas?: string | bigint;
|
|
87
|
-
gasPrice?: string | bigint;
|
|
88
|
-
maxFeePerGas?: string | bigint;
|
|
89
|
-
maxPriorityFeePerGas?: string | bigint;
|
|
90
|
-
nonce?: number;
|
|
91
|
-
chainId?: number;
|
|
92
|
-
}
|
|
93
|
-
interface TronTransaction {
|
|
94
|
-
txID?: string;
|
|
95
|
-
raw_data?: any;
|
|
96
|
-
raw_data_hex?: string;
|
|
97
|
-
visible?: boolean;
|
|
98
|
-
}
|
|
99
|
-
type Transaction = EVMTransaction | TronTransaction;
|
|
100
|
-
interface TransactionReceipt {
|
|
101
|
-
transactionHash: string;
|
|
102
|
-
blockNumber: number;
|
|
103
|
-
blockHash: string;
|
|
104
|
-
from: string;
|
|
105
|
-
to?: string;
|
|
106
|
-
status: 'success' | 'failed';
|
|
107
|
-
gasUsed: string;
|
|
108
|
-
effectiveGasPrice?: string;
|
|
109
|
-
logs?: any[];
|
|
110
|
-
}
|
|
111
|
-
interface AddChainParams {
|
|
112
|
-
chainId: number;
|
|
113
|
-
chainName: string;
|
|
114
|
-
nativeCurrency: {
|
|
115
|
-
name: string;
|
|
116
|
-
symbol: string;
|
|
117
|
-
decimals: number;
|
|
118
|
-
};
|
|
119
|
-
rpcUrls: string[];
|
|
120
|
-
blockExplorerUrls?: string[];
|
|
121
|
-
iconUrls?: string[];
|
|
122
|
-
}
|
|
123
|
-
interface WalletManagerConfig {
|
|
124
|
-
enableStorage?: boolean;
|
|
125
|
-
storagePrefix?: string;
|
|
126
|
-
defaultChainId?: number;
|
|
127
|
-
defaultTronChainId?: number;
|
|
128
|
-
walletConnectProjectId?: string;
|
|
129
|
-
}
|
|
130
|
-
interface ConnectedWallet {
|
|
131
|
-
account: Account;
|
|
132
|
-
walletType: WalletType;
|
|
133
|
-
chainType: ChainType$1;
|
|
134
|
-
isPrimary: boolean;
|
|
135
|
-
canSwitchChain: boolean;
|
|
136
|
-
adapter: IWalletAdapter;
|
|
137
|
-
}
|
|
138
|
-
interface WalletManagerEvents extends Record<string, (...args: any[]) => void> {
|
|
139
|
-
accountChanged: (account: Account | null) => void;
|
|
140
|
-
chainChanged: (chainId: number, account: Account) => void;
|
|
141
|
-
disconnected: () => void;
|
|
142
|
-
walletAccountChanged: (chainType: ChainType$1, account: Account | null, isPrimary: boolean) => void;
|
|
143
|
-
walletChainChanged: (chainType: ChainType$1, chainId: number, account: Account, isPrimary: boolean) => void;
|
|
144
|
-
walletDisconnected: (chainType: ChainType$1, isPrimary: boolean) => void;
|
|
145
|
-
primaryWalletSwitched: (newPrimary: Account, oldPrimary: Account | null, chainType: ChainType$1) => void;
|
|
146
|
-
error: (error: Error) => void;
|
|
147
|
-
}
|
|
148
|
-
interface WalletHistoryRecord {
|
|
149
|
-
universalAddress: UniversalAddress;
|
|
150
|
-
nativeAddress: string;
|
|
151
|
-
chainId: number;
|
|
152
|
-
chainType: ChainType$1;
|
|
153
|
-
walletType: WalletType;
|
|
154
|
-
lastConnected: number;
|
|
155
|
-
name?: string;
|
|
156
|
-
}
|
|
157
|
-
interface StorageData {
|
|
158
|
-
current: UniversalAddress | null;
|
|
159
|
-
primaryWalletType?: WalletType;
|
|
160
|
-
primaryChainId?: number;
|
|
161
|
-
history: WalletHistoryRecord[];
|
|
162
|
-
}
|
|
163
|
-
interface WalletAvailability {
|
|
164
|
-
walletType: WalletType;
|
|
165
|
-
chainType: ChainType$1;
|
|
166
|
-
isAvailable: boolean;
|
|
167
|
-
downloadUrl?: string;
|
|
168
|
-
detected: boolean;
|
|
17
|
+
interface QRCodeSignerConfig {
|
|
18
|
+
requestId: string;
|
|
19
|
+
requestUrl: string;
|
|
20
|
+
pollUrl?: string;
|
|
21
|
+
pollInterval?: number;
|
|
22
|
+
timeout?: number;
|
|
23
|
+
pollFn?: (requestId: string) => Promise<QRCodeSignResult | null>;
|
|
24
|
+
}
|
|
25
|
+
interface QRCodeSignResult {
|
|
26
|
+
completed: boolean;
|
|
27
|
+
signature?: string;
|
|
28
|
+
error?: string;
|
|
29
|
+
signer?: string;
|
|
30
|
+
}
|
|
31
|
+
declare enum QRCodeSignStatus {
|
|
32
|
+
WAITING = "waiting",
|
|
33
|
+
PENDING = "pending",
|
|
34
|
+
SUCCESS = "success",
|
|
35
|
+
FAILED = "failed",
|
|
36
|
+
TIMEOUT = "timeout",
|
|
37
|
+
CANCELLED = "cancelled"
|
|
38
|
+
}
|
|
39
|
+
declare class QRCodeSigner {
|
|
40
|
+
private config;
|
|
41
|
+
private pollTimer;
|
|
42
|
+
private timeoutTimer;
|
|
43
|
+
private status;
|
|
44
|
+
private qrCodeDataUrl;
|
|
45
|
+
private result;
|
|
46
|
+
constructor(config: QRCodeSignerConfig);
|
|
47
|
+
generateQRCode(options?: {
|
|
48
|
+
width?: number;
|
|
49
|
+
margin?: number;
|
|
50
|
+
color?: {
|
|
51
|
+
dark?: string;
|
|
52
|
+
light?: string;
|
|
53
|
+
};
|
|
54
|
+
}): Promise<string>;
|
|
55
|
+
startPolling(onStatusChange?: (status: QRCodeSignStatus) => void, onResult?: (result: QRCodeSignResult) => void): Promise<string>;
|
|
56
|
+
private defaultPoll;
|
|
57
|
+
stopPolling(): void;
|
|
58
|
+
cancel(): void;
|
|
59
|
+
getStatus(): QRCodeSignStatus;
|
|
60
|
+
getQRCodeUrl(): string;
|
|
61
|
+
getResult(): QRCodeSignResult | null;
|
|
62
|
+
cleanup(): void;
|
|
169
63
|
}
|
|
170
64
|
|
|
171
65
|
declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
@@ -174,8 +68,9 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
174
68
|
private primaryWallet;
|
|
175
69
|
private connectedWallets;
|
|
176
70
|
constructor(config?: WalletManagerConfig);
|
|
177
|
-
|
|
178
|
-
|
|
71
|
+
hasAdapter(type: WalletType): boolean;
|
|
72
|
+
connect(type: WalletType, chainId?: number | number[]): Promise<Account>;
|
|
73
|
+
connectAdditional(type: WalletType, chainId?: number | number[]): Promise<Account>;
|
|
179
74
|
connectWithPrivateKey(privateKey: string, chainId?: number): Promise<Account>;
|
|
180
75
|
disconnect(): Promise<void>;
|
|
181
76
|
disconnectAll(): Promise<void>;
|
|
@@ -185,6 +80,10 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
185
80
|
getWalletByChainType(chainType: ChainType$1): IWalletAdapter | null;
|
|
186
81
|
signMessage(message: string): Promise<string>;
|
|
187
82
|
signMessageWithChainType(message: string, chainType?: ChainType$1): Promise<string>;
|
|
83
|
+
createQRCodeSigner(message: string, config: Omit<QRCodeSignerConfig, 'requestId' | 'requestUrl'> & {
|
|
84
|
+
requestId: string;
|
|
85
|
+
requestUrl: string;
|
|
86
|
+
}): QRCodeSigner;
|
|
188
87
|
signTypedData(typedData: any, chainType?: ChainType$1): Promise<string>;
|
|
189
88
|
signTransaction(transaction: any): Promise<string>;
|
|
190
89
|
signTransactionWithChainType(transaction: any, chainType?: ChainType$1): Promise<string>;
|
|
@@ -192,6 +91,8 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
192
91
|
addChainIfNotExists?: boolean;
|
|
193
92
|
chainConfig?: AddChainParams;
|
|
194
93
|
}): Promise<Account>;
|
|
94
|
+
requestSwitchAccount(targetAddress?: string): Promise<Account>;
|
|
95
|
+
ensureAccount(targetAddress: string): Promise<Account>;
|
|
195
96
|
readContract<T = any>(address: string, abi: any[], functionName: string, args?: any[], chainType?: ChainType$1): Promise<T>;
|
|
196
97
|
writeContract(address: string, abi: any[], functionName: string, args?: any[], options?: {
|
|
197
98
|
value?: string;
|
|
@@ -216,7 +117,8 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
216
117
|
|
|
217
118
|
declare class AdapterRegistry {
|
|
218
119
|
private adapters;
|
|
219
|
-
|
|
120
|
+
private config;
|
|
121
|
+
constructor(config?: WalletManagerConfig);
|
|
220
122
|
private registerDefaultAdapters;
|
|
221
123
|
register(type: WalletType, factory: () => IWalletAdapter): void;
|
|
222
124
|
getAdapter(type: WalletType): IWalletAdapter | null;
|
|
@@ -258,37 +160,6 @@ declare class NetworkError extends WalletSDKError {
|
|
|
258
160
|
constructor(message: string, details?: any);
|
|
259
161
|
}
|
|
260
162
|
|
|
261
|
-
declare abstract class WalletAdapter extends EventEmitter implements IWalletAdapter {
|
|
262
|
-
abstract readonly type: WalletType;
|
|
263
|
-
abstract readonly chainType: ChainType$1;
|
|
264
|
-
abstract readonly name: string;
|
|
265
|
-
readonly icon?: string;
|
|
266
|
-
state: WalletState;
|
|
267
|
-
currentAccount: Account | null;
|
|
268
|
-
abstract connect(chainId?: number): Promise<Account>;
|
|
269
|
-
abstract disconnect(): Promise<void>;
|
|
270
|
-
abstract isAvailable(): Promise<boolean>;
|
|
271
|
-
abstract signMessage(message: string): Promise<string>;
|
|
272
|
-
getAddress(): Promise<string>;
|
|
273
|
-
signTransaction?(_transaction: any): Promise<string>;
|
|
274
|
-
signTypedData?(_typedData: any): Promise<string>;
|
|
275
|
-
switchChain?(_chainId: number): Promise<void>;
|
|
276
|
-
addChain?(_chainConfig: any): Promise<void>;
|
|
277
|
-
readContract<T = any>(_params: ContractReadParams): Promise<T>;
|
|
278
|
-
writeContract(_params: ContractWriteParams): Promise<string>;
|
|
279
|
-
estimateGas(_params: ContractWriteParams): Promise<bigint>;
|
|
280
|
-
waitForTransaction(_txHash: string, _confirmations?: number): Promise<TransactionReceipt>;
|
|
281
|
-
abstract getProvider(): any;
|
|
282
|
-
getSigner?(): any;
|
|
283
|
-
protected ensureConnected(): void;
|
|
284
|
-
protected setState(state: WalletState): void;
|
|
285
|
-
protected setAccount(account: Account | null): void;
|
|
286
|
-
protected emitAccountChanged(account: Account | null): void;
|
|
287
|
-
protected emitChainChanged(chainId: number): void;
|
|
288
|
-
protected emitDisconnected(): void;
|
|
289
|
-
protected emitError(error: Error): void;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
163
|
declare abstract class BrowserWalletAdapter extends WalletAdapter {
|
|
293
164
|
protected abstract getBrowserProvider(): any | undefined;
|
|
294
165
|
isAvailable(): Promise<boolean>;
|
|
@@ -306,12 +177,13 @@ declare class MetaMaskAdapter extends BrowserWalletAdapter {
|
|
|
306
177
|
readonly icon = "https://upload.wikimedia.org/wikipedia/commons/3/36/MetaMask_Fox.svg";
|
|
307
178
|
private walletClient;
|
|
308
179
|
private publicClient;
|
|
309
|
-
connect(chainId?: number): Promise<Account>;
|
|
180
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
310
181
|
signMessage(message: string): Promise<string>;
|
|
311
182
|
signTypedData(typedData: any): Promise<string>;
|
|
312
183
|
signTransaction(transaction: any): Promise<string>;
|
|
313
184
|
switchChain(chainId: number): Promise<void>;
|
|
314
185
|
addChain(chainConfig: AddChainParams): Promise<void>;
|
|
186
|
+
requestSwitchAccount(targetAddress?: string): Promise<Account>;
|
|
315
187
|
readContract<T = any>(params: ContractReadParams): Promise<T>;
|
|
316
188
|
writeContract(params: ContractWriteParams): Promise<string>;
|
|
317
189
|
estimateGas(params: ContractWriteParams): Promise<bigint>;
|
|
@@ -328,13 +200,55 @@ declare class MetaMaskAdapter extends BrowserWalletAdapter {
|
|
|
328
200
|
private getViemChain;
|
|
329
201
|
}
|
|
330
202
|
|
|
203
|
+
declare class WalletConnectAdapter extends WalletAdapter {
|
|
204
|
+
readonly type = WalletType.WALLETCONNECT;
|
|
205
|
+
readonly chainType = ChainType.EVM;
|
|
206
|
+
readonly name = "WalletConnect";
|
|
207
|
+
readonly icon = "https://avatars.githubusercontent.com/u/37784886";
|
|
208
|
+
private provider;
|
|
209
|
+
private walletClient;
|
|
210
|
+
private publicClient;
|
|
211
|
+
private projectId;
|
|
212
|
+
private supportedChains;
|
|
213
|
+
private static providerInstance;
|
|
214
|
+
private static providerProjectId;
|
|
215
|
+
private static providerChains;
|
|
216
|
+
private static isInitializing;
|
|
217
|
+
private static initPromise;
|
|
218
|
+
constructor(projectId: string);
|
|
219
|
+
isAvailable(): Promise<boolean>;
|
|
220
|
+
private isTelegramMiniApp;
|
|
221
|
+
private getTelegramWebApp;
|
|
222
|
+
private closeTelegramDeepLinkPopup;
|
|
223
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
224
|
+
disconnect(): Promise<void>;
|
|
225
|
+
signMessage(message: string): Promise<string>;
|
|
226
|
+
signTypedData(typedData: any): Promise<string>;
|
|
227
|
+
signTransaction(transaction: any): Promise<string>;
|
|
228
|
+
getSupportedChains(): number[];
|
|
229
|
+
switchChain(chainId: number): Promise<void>;
|
|
230
|
+
addChain(chainConfig: AddChainParams): Promise<void>;
|
|
231
|
+
readContract<T = any>(params: ContractReadParams): Promise<T>;
|
|
232
|
+
writeContract(params: ContractWriteParams): Promise<string>;
|
|
233
|
+
estimateGas(params: ContractWriteParams): Promise<bigint>;
|
|
234
|
+
waitForTransaction(txHash: string, confirmations?: number): Promise<TransactionReceipt>;
|
|
235
|
+
getProvider(): any;
|
|
236
|
+
getSigner(): WalletClient | null;
|
|
237
|
+
protected setupEventListeners(): void;
|
|
238
|
+
protected removeEventListeners(): void;
|
|
239
|
+
private handleAccountsChanged;
|
|
240
|
+
private handleChainChanged;
|
|
241
|
+
private handleDisconnect;
|
|
242
|
+
private getViemChain;
|
|
243
|
+
}
|
|
244
|
+
|
|
331
245
|
declare class TronLinkAdapter extends BrowserWalletAdapter {
|
|
332
246
|
readonly type = WalletType.TRONLINK;
|
|
333
247
|
readonly chainType = ChainType.TRON;
|
|
334
248
|
readonly name = "TronWeb";
|
|
335
249
|
readonly icon = "https://www.tronlink.org/static/logoIcon.svg";
|
|
336
250
|
private static readonly TRON_MAINNET_CHAIN_ID;
|
|
337
|
-
connect(chainId?: number): Promise<Account>;
|
|
251
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
338
252
|
signMessage(message: string): Promise<string>;
|
|
339
253
|
signTransaction(transaction: any): Promise<string>;
|
|
340
254
|
readContract<T = any>(params: ContractReadParams): Promise<T>;
|
|
@@ -361,7 +275,7 @@ declare class EVMPrivateKeyAdapter extends WalletAdapter {
|
|
|
361
275
|
private privateKey;
|
|
362
276
|
private walletClient;
|
|
363
277
|
private publicClient;
|
|
364
|
-
connect(chainId?: number): Promise<Account>;
|
|
278
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
365
279
|
disconnect(): Promise<void>;
|
|
366
280
|
isAvailable(): Promise<boolean>;
|
|
367
281
|
setPrivateKey(privateKey: string): void;
|
|
@@ -377,6 +291,277 @@ declare class EVMPrivateKeyAdapter extends WalletAdapter {
|
|
|
377
291
|
private getViemChain;
|
|
378
292
|
}
|
|
379
293
|
|
|
294
|
+
declare enum DeepLinkProviderType {
|
|
295
|
+
TOKENPOCKET = "tokenpocket",
|
|
296
|
+
TRONLINK = "tronlink",
|
|
297
|
+
IMTOKEN = "imtoken",
|
|
298
|
+
METAMASK = "metamask",
|
|
299
|
+
OKX = "okx"
|
|
300
|
+
}
|
|
301
|
+
interface DeepLinkAdapterConfig {
|
|
302
|
+
providerType: DeepLinkProviderType;
|
|
303
|
+
callbackUrl?: string;
|
|
304
|
+
callbackSchema?: string;
|
|
305
|
+
}
|
|
306
|
+
declare class DeepLinkAdapter extends WalletAdapter {
|
|
307
|
+
readonly type: WalletType;
|
|
308
|
+
readonly chainType: ChainType$1;
|
|
309
|
+
readonly name: string;
|
|
310
|
+
readonly icon: string;
|
|
311
|
+
private provider;
|
|
312
|
+
private currentChainId;
|
|
313
|
+
private currentChainType;
|
|
314
|
+
private static pendingActions;
|
|
315
|
+
constructor(config: DeepLinkAdapterConfig);
|
|
316
|
+
private createProvider;
|
|
317
|
+
private setupCallbackHandler;
|
|
318
|
+
isAvailable(): Promise<boolean>;
|
|
319
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
320
|
+
disconnect(): Promise<void>;
|
|
321
|
+
signMessage(message: string): Promise<string>;
|
|
322
|
+
signTransaction(transaction: any): Promise<string>;
|
|
323
|
+
getProvider(): any;
|
|
324
|
+
static handleCallback(): void;
|
|
325
|
+
protected setAccount(account: Account | null): void;
|
|
326
|
+
protected emitDisconnected(): void;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
interface DeepLinkSignMessageParams {
|
|
330
|
+
message: string;
|
|
331
|
+
chainId: number;
|
|
332
|
+
chainType: ChainType$1;
|
|
333
|
+
}
|
|
334
|
+
interface DeepLinkSignTransactionParams {
|
|
335
|
+
transaction: any;
|
|
336
|
+
chainId: number;
|
|
337
|
+
chainType: ChainType$1;
|
|
338
|
+
}
|
|
339
|
+
interface DeepLinkConnectParams {
|
|
340
|
+
chainId: number;
|
|
341
|
+
chainType: ChainType$1;
|
|
342
|
+
}
|
|
343
|
+
interface IDeepLinkProvider {
|
|
344
|
+
readonly name: string;
|
|
345
|
+
readonly icon: string;
|
|
346
|
+
readonly supportedChainTypes: ChainType$1[];
|
|
347
|
+
isAvailable(): Promise<boolean>;
|
|
348
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
349
|
+
url: string;
|
|
350
|
+
actionId: string;
|
|
351
|
+
callbackSchema?: string;
|
|
352
|
+
callbackUrl?: string;
|
|
353
|
+
};
|
|
354
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
355
|
+
url: string;
|
|
356
|
+
actionId: string;
|
|
357
|
+
callbackSchema?: string;
|
|
358
|
+
callbackUrl?: string;
|
|
359
|
+
};
|
|
360
|
+
buildConnectLink?(params: DeepLinkConnectParams): {
|
|
361
|
+
url: string;
|
|
362
|
+
actionId?: string;
|
|
363
|
+
};
|
|
364
|
+
parseCallbackResult(urlParams: URLSearchParams): {
|
|
365
|
+
actionId: string | null;
|
|
366
|
+
result: any | null;
|
|
367
|
+
error: string | null;
|
|
368
|
+
};
|
|
369
|
+
getDefaultCallbackSchema?(): string;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
declare class TokenPocketDeepLinkProvider implements IDeepLinkProvider {
|
|
373
|
+
readonly name = "TokenPocket";
|
|
374
|
+
readonly icon = "https://tokenpocket.pro/icon.png";
|
|
375
|
+
readonly supportedChainTypes: _enclave_hq_chain_utils.ChainType[];
|
|
376
|
+
private callbackUrl?;
|
|
377
|
+
private callbackSchema?;
|
|
378
|
+
constructor(options?: {
|
|
379
|
+
callbackUrl?: string;
|
|
380
|
+
callbackSchema?: string;
|
|
381
|
+
});
|
|
382
|
+
isAvailable(): Promise<boolean>;
|
|
383
|
+
private generateActionId;
|
|
384
|
+
private getCallbackConfig;
|
|
385
|
+
private getBlockchainConfig;
|
|
386
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
387
|
+
url: string;
|
|
388
|
+
actionId: string;
|
|
389
|
+
callbackSchema?: string;
|
|
390
|
+
callbackUrl?: string;
|
|
391
|
+
};
|
|
392
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
393
|
+
url: string;
|
|
394
|
+
actionId: string;
|
|
395
|
+
callbackSchema?: string;
|
|
396
|
+
callbackUrl?: string;
|
|
397
|
+
};
|
|
398
|
+
buildConnectLink(params: DeepLinkConnectParams): {
|
|
399
|
+
url: string;
|
|
400
|
+
actionId?: string;
|
|
401
|
+
};
|
|
402
|
+
parseCallbackResult(urlParams: URLSearchParams): {
|
|
403
|
+
actionId: string | null;
|
|
404
|
+
result: any | null;
|
|
405
|
+
error: string | null;
|
|
406
|
+
};
|
|
407
|
+
getDefaultCallbackSchema(): string;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
declare class TronLinkDeepLinkProvider implements IDeepLinkProvider {
|
|
411
|
+
readonly name = "TronLink";
|
|
412
|
+
readonly icon = "https://www.tronlink.org/static/logoIcon.svg";
|
|
413
|
+
readonly supportedChainTypes: _enclave_hq_chain_utils.ChainType[];
|
|
414
|
+
isAvailable(): Promise<boolean>;
|
|
415
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
416
|
+
url: string;
|
|
417
|
+
actionId: string;
|
|
418
|
+
callbackSchema?: string;
|
|
419
|
+
callbackUrl?: string;
|
|
420
|
+
};
|
|
421
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
422
|
+
url: string;
|
|
423
|
+
actionId: string;
|
|
424
|
+
callbackSchema?: string;
|
|
425
|
+
callbackUrl?: string;
|
|
426
|
+
};
|
|
427
|
+
buildConnectLink(params: DeepLinkConnectParams): {
|
|
428
|
+
url: string;
|
|
429
|
+
actionId?: string;
|
|
430
|
+
};
|
|
431
|
+
parseCallbackResult(_urlParams: URLSearchParams): {
|
|
432
|
+
actionId: string | null;
|
|
433
|
+
result: any | null;
|
|
434
|
+
error: string | null;
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
declare class ImTokenDeepLinkProvider implements IDeepLinkProvider {
|
|
439
|
+
readonly name = "ImToken";
|
|
440
|
+
readonly icon = "https://token.im/static/img/logo.png";
|
|
441
|
+
readonly supportedChainTypes: _enclave_hq_chain_utils.ChainType[];
|
|
442
|
+
private callbackUrl?;
|
|
443
|
+
private callbackSchema?;
|
|
444
|
+
constructor(options?: {
|
|
445
|
+
callbackUrl?: string;
|
|
446
|
+
callbackSchema?: string;
|
|
447
|
+
});
|
|
448
|
+
isAvailable(): Promise<boolean>;
|
|
449
|
+
private generateActionId;
|
|
450
|
+
private getCallbackConfig;
|
|
451
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
452
|
+
url: string;
|
|
453
|
+
actionId: string;
|
|
454
|
+
callbackSchema?: string;
|
|
455
|
+
callbackUrl?: string;
|
|
456
|
+
};
|
|
457
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
458
|
+
url: string;
|
|
459
|
+
actionId: string;
|
|
460
|
+
callbackSchema?: string;
|
|
461
|
+
callbackUrl?: string;
|
|
462
|
+
};
|
|
463
|
+
buildConnectLink(params: DeepLinkConnectParams): {
|
|
464
|
+
url: string;
|
|
465
|
+
actionId?: string;
|
|
466
|
+
};
|
|
467
|
+
parseCallbackResult(urlParams: URLSearchParams): {
|
|
468
|
+
actionId: string | null;
|
|
469
|
+
result: any | null;
|
|
470
|
+
error: string | null;
|
|
471
|
+
};
|
|
472
|
+
getDefaultCallbackSchema(): string;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
declare class MetaMaskDeepLinkProvider implements IDeepLinkProvider {
|
|
476
|
+
readonly name = "MetaMask";
|
|
477
|
+
readonly icon = "https://upload.wikimedia.org/wikipedia/commons/3/36/MetaMask_Fox.svg";
|
|
478
|
+
readonly supportedChainTypes: _enclave_hq_chain_utils.ChainType[];
|
|
479
|
+
isAvailable(): Promise<boolean>;
|
|
480
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
481
|
+
url: string;
|
|
482
|
+
actionId: string;
|
|
483
|
+
callbackSchema?: string;
|
|
484
|
+
callbackUrl?: string;
|
|
485
|
+
};
|
|
486
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
487
|
+
url: string;
|
|
488
|
+
actionId: string;
|
|
489
|
+
callbackSchema?: string;
|
|
490
|
+
callbackUrl?: string;
|
|
491
|
+
};
|
|
492
|
+
buildConnectLink(params: DeepLinkConnectParams): {
|
|
493
|
+
url: string;
|
|
494
|
+
actionId?: string;
|
|
495
|
+
};
|
|
496
|
+
parseCallbackResult(urlParams: URLSearchParams): {
|
|
497
|
+
actionId: string | null;
|
|
498
|
+
result: any | null;
|
|
499
|
+
error: string | null;
|
|
500
|
+
};
|
|
501
|
+
getDefaultCallbackSchema(): string;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
declare class OKXDeepLinkProvider implements IDeepLinkProvider {
|
|
505
|
+
readonly name = "OKX";
|
|
506
|
+
readonly icon = "https://www.okx.com/favicon.ico";
|
|
507
|
+
readonly supportedChainTypes: _enclave_hq_chain_utils.ChainType[];
|
|
508
|
+
isAvailable(): Promise<boolean>;
|
|
509
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
510
|
+
url: string;
|
|
511
|
+
actionId: string;
|
|
512
|
+
callbackSchema?: string;
|
|
513
|
+
callbackUrl?: string;
|
|
514
|
+
};
|
|
515
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
516
|
+
url: string;
|
|
517
|
+
actionId: string;
|
|
518
|
+
callbackSchema?: string;
|
|
519
|
+
callbackUrl?: string;
|
|
520
|
+
};
|
|
521
|
+
buildConnectLink(params: DeepLinkConnectParams): {
|
|
522
|
+
url: string;
|
|
523
|
+
actionId?: string;
|
|
524
|
+
};
|
|
525
|
+
parseCallbackResult(urlParams: URLSearchParams): {
|
|
526
|
+
actionId: string | null;
|
|
527
|
+
result: any | null;
|
|
528
|
+
error: string | null;
|
|
529
|
+
};
|
|
530
|
+
getDefaultCallbackSchema(): string;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
declare enum DeepLinkWalletType {
|
|
534
|
+
TOKENPOCKET = "tokenpocket",
|
|
535
|
+
TRONLINK = "tronlink"
|
|
536
|
+
}
|
|
537
|
+
declare class TronDeepLinkAdapter extends WalletAdapter {
|
|
538
|
+
readonly type = WalletType.TRONLINK;
|
|
539
|
+
readonly chainType = ChainType.TRON;
|
|
540
|
+
readonly name: string;
|
|
541
|
+
readonly icon: string;
|
|
542
|
+
private walletType;
|
|
543
|
+
private callbackUrl?;
|
|
544
|
+
private callbackSchema?;
|
|
545
|
+
private pendingActions;
|
|
546
|
+
private static readonly TRON_MAINNET_CHAIN_ID;
|
|
547
|
+
constructor(walletType?: DeepLinkWalletType, options?: {
|
|
548
|
+
callbackUrl?: string;
|
|
549
|
+
callbackSchema?: string;
|
|
550
|
+
});
|
|
551
|
+
private setupCallbackHandler;
|
|
552
|
+
private checkCallbackFromUrl;
|
|
553
|
+
isAvailable(): Promise<boolean>;
|
|
554
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
555
|
+
disconnect(): Promise<void>;
|
|
556
|
+
signMessage(message: string): Promise<string>;
|
|
557
|
+
signTransaction(transaction: any): Promise<string>;
|
|
558
|
+
readContract<T = any>(_params: ContractReadParams): Promise<T>;
|
|
559
|
+
writeContract(_params: ContractWriteParams): Promise<string>;
|
|
560
|
+
estimateGas(_params: ContractWriteParams): Promise<bigint>;
|
|
561
|
+
waitForTransaction(_txHash: string, _confirmations?: number): Promise<TransactionReceipt>;
|
|
562
|
+
getProvider(): any;
|
|
563
|
+
}
|
|
564
|
+
|
|
380
565
|
interface AuthMessageParams {
|
|
381
566
|
domain: string;
|
|
382
567
|
nonce: string;
|
|
@@ -474,4 +659,4 @@ declare function hexToNumber(hex: string): number;
|
|
|
474
659
|
declare function ensureHexPrefix(value: string): string;
|
|
475
660
|
declare function removeHexPrefix(value: string): string;
|
|
476
661
|
|
|
477
|
-
export {
|
|
662
|
+
export { Account, AdapterRegistry, AddChainParams, AuthMessageGenerator, type AuthMessageParams, BrowserWalletAdapter, CHAIN_INFO, type ChainInfo, ChainNotSupportedError, ChainType$1 as ChainType, ConfigurationError, ConnectedWallet, ConnectionRejectedError, ContractReadParams, ContractWriteParams, DeepLinkAdapter, DeepLinkProviderType, DeepLinkWalletType, EVMPrivateKeyAdapter, type IDeepLinkProvider, IWalletAdapter, ImTokenDeepLinkProvider, MetaMaskAdapter, MetaMaskDeepLinkProvider, MethodNotSupportedError, NetworkError, OKXDeepLinkProvider, type QRCodeSignResult, QRCodeSignStatus, QRCodeSigner, type QRCodeSignerConfig, SUPPORTED_WALLETS, SignatureRejectedError, SignatureVerifier, TokenPocketDeepLinkProvider, TransactionFailedError, TransactionReceipt, TronDeepLinkAdapter, TronLinkAdapter, TronLinkDeepLinkProvider, UniversalAddress, WalletAdapter, WalletAvailability, WalletConnectAdapter, WalletDetector, WalletManager, WalletManagerConfig, WalletManagerEvents, type WalletMetadata, WalletNotAvailableError, WalletNotConnectedError, WalletSDKError, 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 };
|