@enclave-hq/wallet-sdk 1.2.3 → 1.2.4
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 +413 -10
- package/dist/index.d.ts +413 -10
- package/dist/index.js +3492 -107
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3454 -76
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +88 -9
- package/dist/react/index.d.ts +88 -9
- package/dist/react/index.js +3341 -79
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +3315 -57
- package/dist/react/index.mjs.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -98,6 +98,52 @@ function YourApp() {
|
|
|
98
98
|
}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
### QR Code Signing (扫码签名)
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import React, { useState } from 'react'
|
|
105
|
+
import { useQRCodeSigner, QRCodeModal } from '@enclave-hq/wallet-sdk/react'
|
|
106
|
+
|
|
107
|
+
function SignButton() {
|
|
108
|
+
const [showModal, setShowModal] = useState(false)
|
|
109
|
+
|
|
110
|
+
const { qrCodeDataUrl, status, startSign, cancel, error } = useQRCodeSigner({
|
|
111
|
+
requestId: `sign-${Date.now()}`,
|
|
112
|
+
requestUrl: `https://example.com/sign?requestId=sign-${Date.now()}`,
|
|
113
|
+
pollUrl: 'https://api.example.com/sign/status',
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const handleSign = async () => {
|
|
117
|
+
setShowModal(true)
|
|
118
|
+
try {
|
|
119
|
+
const signature = await startSign()
|
|
120
|
+
console.log('Signature:', signature)
|
|
121
|
+
setShowModal(false)
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error('Sign failed:', error)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<>
|
|
129
|
+
<button onClick={handleSign}>扫码签名</button>
|
|
130
|
+
|
|
131
|
+
<QRCodeModal
|
|
132
|
+
isOpen={showModal}
|
|
133
|
+
onClose={() => {
|
|
134
|
+
cancel()
|
|
135
|
+
setShowModal(false)
|
|
136
|
+
}}
|
|
137
|
+
qrCodeDataUrl={qrCodeDataUrl}
|
|
138
|
+
status={status}
|
|
139
|
+
error={error}
|
|
140
|
+
title="使用钱包扫码签名"
|
|
141
|
+
/>
|
|
142
|
+
</>
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
101
147
|
## 🎯 Core Concepts
|
|
102
148
|
|
|
103
149
|
### Universal Address
|
|
@@ -138,9 +184,11 @@ const wallets = walletManager.getConnectedWallets()
|
|
|
138
184
|
|--------|------------|--------|
|
|
139
185
|
| MetaMask | EVM | ✅ Supported |
|
|
140
186
|
| TronLink | Tron | ✅ Supported |
|
|
141
|
-
| WalletConnect | EVM |
|
|
187
|
+
| WalletConnect | EVM | ✅ Supported |
|
|
188
|
+
| WalletConnect Tron | Tron | ✅ Supported |
|
|
142
189
|
| Coinbase Wallet | EVM | 🚧 Coming Soon |
|
|
143
190
|
| Private Key | EVM/Tron | ✅ Dev Only |
|
|
191
|
+
| QR Code Signing | EVM/Tron | ✅ Supported |
|
|
144
192
|
|
|
145
193
|
## 📖 Documentation
|
|
146
194
|
|
|
@@ -152,6 +200,8 @@ Full documentation is available in the `/docs` folder:
|
|
|
152
200
|
- [Integration Guide](../docs/wallet-sdk/INTEGRATION.md)
|
|
153
201
|
- [State Management](../docs/wallet-sdk/STATE_AND_ACCOUNT.md)
|
|
154
202
|
- [Standards & Signing](../docs/wallet-sdk/STANDARDS.md)
|
|
203
|
+
- [QR Code Signing](./docs/QR_CODE_SIGNING.md) - 二维码签名功能
|
|
204
|
+
- [TRON Wallet Signing](./docs/TRON_WALLET_SIGNING.md) - TRON 钱包签名支持
|
|
155
205
|
|
|
156
206
|
## 🧪 Running the Example
|
|
157
207
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import * as _enclave_hq_chain_utils from '@enclave-hq/chain-utils';
|
|
1
2
|
import { ChainType as ChainType$2, ChainInfo as ChainInfo$1 } from '@enclave-hq/chain-utils';
|
|
2
3
|
import EventEmitter from 'eventemitter3';
|
|
3
4
|
import { WalletClient } from 'viem';
|
|
5
|
+
import { WalletConnectWallet } from '@tronweb3/walletconnect-tron';
|
|
4
6
|
|
|
5
7
|
declare class TypedEventEmitter<TEvents extends Record<string, (...args: any[]) => void>> {
|
|
6
8
|
private emitter;
|
|
@@ -19,7 +21,9 @@ declare enum WalletType {
|
|
|
19
21
|
COINBASE_WALLET = "coinbase-wallet",
|
|
20
22
|
TRONLINK = "tronlink",
|
|
21
23
|
WALLETCONNECT_TRON = "walletconnect-tron",
|
|
22
|
-
PRIVATE_KEY = "private-key"
|
|
24
|
+
PRIVATE_KEY = "private-key",
|
|
25
|
+
DEEP_LINK_EVM = "deep-link-evm",
|
|
26
|
+
DEEP_LINK_TRON = "deep-link-tron"
|
|
23
27
|
}
|
|
24
28
|
declare enum WalletState {
|
|
25
29
|
DISCONNECTED = "disconnected",
|
|
@@ -48,9 +52,10 @@ interface IWalletAdapter extends ISigner {
|
|
|
48
52
|
readonly icon?: string;
|
|
49
53
|
state: WalletState;
|
|
50
54
|
currentAccount: Account | null;
|
|
51
|
-
connect(chainId?: number): Promise<Account>;
|
|
55
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
52
56
|
disconnect(): Promise<void>;
|
|
53
57
|
isAvailable(): Promise<boolean>;
|
|
58
|
+
isConnected(): boolean;
|
|
54
59
|
signMessage(message: string): Promise<string>;
|
|
55
60
|
signTransaction?(transaction: Transaction): Promise<string>;
|
|
56
61
|
signTypedData?(typedData: any): Promise<string>;
|
|
@@ -168,14 +173,63 @@ interface WalletAvailability {
|
|
|
168
173
|
detected: boolean;
|
|
169
174
|
}
|
|
170
175
|
|
|
176
|
+
interface QRCodeSignerConfig {
|
|
177
|
+
requestId: string;
|
|
178
|
+
requestUrl: string;
|
|
179
|
+
pollUrl?: string;
|
|
180
|
+
pollInterval?: number;
|
|
181
|
+
timeout?: number;
|
|
182
|
+
pollFn?: (requestId: string) => Promise<QRCodeSignResult | null>;
|
|
183
|
+
}
|
|
184
|
+
interface QRCodeSignResult {
|
|
185
|
+
completed: boolean;
|
|
186
|
+
signature?: string;
|
|
187
|
+
error?: string;
|
|
188
|
+
signer?: string;
|
|
189
|
+
}
|
|
190
|
+
declare enum QRCodeSignStatus {
|
|
191
|
+
WAITING = "waiting",
|
|
192
|
+
PENDING = "pending",
|
|
193
|
+
SUCCESS = "success",
|
|
194
|
+
FAILED = "failed",
|
|
195
|
+
TIMEOUT = "timeout",
|
|
196
|
+
CANCELLED = "cancelled"
|
|
197
|
+
}
|
|
198
|
+
declare class QRCodeSigner {
|
|
199
|
+
private config;
|
|
200
|
+
private pollTimer;
|
|
201
|
+
private timeoutTimer;
|
|
202
|
+
private status;
|
|
203
|
+
private qrCodeDataUrl;
|
|
204
|
+
private result;
|
|
205
|
+
constructor(config: QRCodeSignerConfig);
|
|
206
|
+
generateQRCode(options?: {
|
|
207
|
+
width?: number;
|
|
208
|
+
margin?: number;
|
|
209
|
+
color?: {
|
|
210
|
+
dark?: string;
|
|
211
|
+
light?: string;
|
|
212
|
+
};
|
|
213
|
+
}): Promise<string>;
|
|
214
|
+
startPolling(onStatusChange?: (status: QRCodeSignStatus) => void, onResult?: (result: QRCodeSignResult) => void): Promise<string>;
|
|
215
|
+
private defaultPoll;
|
|
216
|
+
stopPolling(): void;
|
|
217
|
+
cancel(): void;
|
|
218
|
+
getStatus(): QRCodeSignStatus;
|
|
219
|
+
getQRCodeUrl(): string;
|
|
220
|
+
getResult(): QRCodeSignResult | null;
|
|
221
|
+
cleanup(): void;
|
|
222
|
+
}
|
|
223
|
+
|
|
171
224
|
declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
172
225
|
private config;
|
|
173
226
|
private registry;
|
|
174
227
|
private primaryWallet;
|
|
175
228
|
private connectedWallets;
|
|
176
229
|
constructor(config?: WalletManagerConfig);
|
|
177
|
-
|
|
178
|
-
|
|
230
|
+
hasAdapter(type: WalletType): boolean;
|
|
231
|
+
connect(type: WalletType, chainId?: number | number[]): Promise<Account>;
|
|
232
|
+
connectAdditional(type: WalletType, chainId?: number | number[]): Promise<Account>;
|
|
179
233
|
connectWithPrivateKey(privateKey: string, chainId?: number): Promise<Account>;
|
|
180
234
|
disconnect(): Promise<void>;
|
|
181
235
|
disconnectAll(): Promise<void>;
|
|
@@ -185,6 +239,10 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
185
239
|
getWalletByChainType(chainType: ChainType$1): IWalletAdapter | null;
|
|
186
240
|
signMessage(message: string): Promise<string>;
|
|
187
241
|
signMessageWithChainType(message: string, chainType?: ChainType$1): Promise<string>;
|
|
242
|
+
createQRCodeSigner(message: string, config: Omit<QRCodeSignerConfig, 'requestId' | 'requestUrl'> & {
|
|
243
|
+
requestId: string;
|
|
244
|
+
requestUrl: string;
|
|
245
|
+
}): QRCodeSigner;
|
|
188
246
|
signTypedData(typedData: any, chainType?: ChainType$1): Promise<string>;
|
|
189
247
|
signTransaction(transaction: any): Promise<string>;
|
|
190
248
|
signTransactionWithChainType(transaction: any, chainType?: ChainType$1): Promise<string>;
|
|
@@ -216,7 +274,8 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
216
274
|
|
|
217
275
|
declare class AdapterRegistry {
|
|
218
276
|
private adapters;
|
|
219
|
-
|
|
277
|
+
private config;
|
|
278
|
+
constructor(config?: WalletManagerConfig);
|
|
220
279
|
private registerDefaultAdapters;
|
|
221
280
|
register(type: WalletType, factory: () => IWalletAdapter): void;
|
|
222
281
|
getAdapter(type: WalletType): IWalletAdapter | null;
|
|
@@ -265,9 +324,10 @@ declare abstract class WalletAdapter extends EventEmitter implements IWalletAdap
|
|
|
265
324
|
readonly icon?: string;
|
|
266
325
|
state: WalletState;
|
|
267
326
|
currentAccount: Account | null;
|
|
268
|
-
abstract connect(chainId?: number): Promise<Account>;
|
|
327
|
+
abstract connect(chainId?: number | number[]): Promise<Account>;
|
|
269
328
|
abstract disconnect(): Promise<void>;
|
|
270
329
|
abstract isAvailable(): Promise<boolean>;
|
|
330
|
+
isConnected(): boolean;
|
|
271
331
|
abstract signMessage(message: string): Promise<string>;
|
|
272
332
|
getAddress(): Promise<string>;
|
|
273
333
|
signTransaction?(_transaction: any): Promise<string>;
|
|
@@ -306,7 +366,7 @@ declare class MetaMaskAdapter extends BrowserWalletAdapter {
|
|
|
306
366
|
readonly icon = "https://upload.wikimedia.org/wikipedia/commons/3/36/MetaMask_Fox.svg";
|
|
307
367
|
private walletClient;
|
|
308
368
|
private publicClient;
|
|
309
|
-
connect(chainId?: number): Promise<Account>;
|
|
369
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
310
370
|
signMessage(message: string): Promise<string>;
|
|
311
371
|
signTypedData(typedData: any): Promise<string>;
|
|
312
372
|
signTransaction(transaction: any): Promise<string>;
|
|
@@ -328,13 +388,55 @@ declare class MetaMaskAdapter extends BrowserWalletAdapter {
|
|
|
328
388
|
private getViemChain;
|
|
329
389
|
}
|
|
330
390
|
|
|
391
|
+
declare class WalletConnectAdapter extends WalletAdapter {
|
|
392
|
+
readonly type = WalletType.WALLETCONNECT;
|
|
393
|
+
readonly chainType = ChainType.EVM;
|
|
394
|
+
readonly name = "WalletConnect";
|
|
395
|
+
readonly icon = "https://avatars.githubusercontent.com/u/37784886";
|
|
396
|
+
private provider;
|
|
397
|
+
private walletClient;
|
|
398
|
+
private publicClient;
|
|
399
|
+
private projectId;
|
|
400
|
+
private supportedChains;
|
|
401
|
+
private static providerInstance;
|
|
402
|
+
private static providerProjectId;
|
|
403
|
+
private static providerChains;
|
|
404
|
+
private static isInitializing;
|
|
405
|
+
private static initPromise;
|
|
406
|
+
constructor(projectId: string);
|
|
407
|
+
isAvailable(): Promise<boolean>;
|
|
408
|
+
private isTelegramMiniApp;
|
|
409
|
+
private getTelegramWebApp;
|
|
410
|
+
private closeTelegramDeepLinkPopup;
|
|
411
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
412
|
+
disconnect(): Promise<void>;
|
|
413
|
+
signMessage(message: string): Promise<string>;
|
|
414
|
+
signTypedData(typedData: any): Promise<string>;
|
|
415
|
+
signTransaction(transaction: any): Promise<string>;
|
|
416
|
+
getSupportedChains(): number[];
|
|
417
|
+
switchChain(chainId: number): Promise<void>;
|
|
418
|
+
addChain(chainConfig: AddChainParams): Promise<void>;
|
|
419
|
+
readContract<T = any>(params: ContractReadParams): Promise<T>;
|
|
420
|
+
writeContract(params: ContractWriteParams): Promise<string>;
|
|
421
|
+
estimateGas(params: ContractWriteParams): Promise<bigint>;
|
|
422
|
+
waitForTransaction(txHash: string, confirmations?: number): Promise<TransactionReceipt>;
|
|
423
|
+
getProvider(): any;
|
|
424
|
+
getSigner(): WalletClient | null;
|
|
425
|
+
protected setupEventListeners(): void;
|
|
426
|
+
protected removeEventListeners(): void;
|
|
427
|
+
private handleAccountsChanged;
|
|
428
|
+
private handleChainChanged;
|
|
429
|
+
private handleDisconnect;
|
|
430
|
+
private getViemChain;
|
|
431
|
+
}
|
|
432
|
+
|
|
331
433
|
declare class TronLinkAdapter extends BrowserWalletAdapter {
|
|
332
434
|
readonly type = WalletType.TRONLINK;
|
|
333
435
|
readonly chainType = ChainType.TRON;
|
|
334
436
|
readonly name = "TronWeb";
|
|
335
437
|
readonly icon = "https://www.tronlink.org/static/logoIcon.svg";
|
|
336
438
|
private static readonly TRON_MAINNET_CHAIN_ID;
|
|
337
|
-
connect(chainId?: number): Promise<Account>;
|
|
439
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
338
440
|
signMessage(message: string): Promise<string>;
|
|
339
441
|
signTransaction(transaction: any): Promise<string>;
|
|
340
442
|
readContract<T = any>(params: ContractReadParams): Promise<T>;
|
|
@@ -354,6 +456,36 @@ declare class TronLinkAdapter extends BrowserWalletAdapter {
|
|
|
354
456
|
private handleDisconnect;
|
|
355
457
|
}
|
|
356
458
|
|
|
459
|
+
declare class WalletConnectTronAdapter extends WalletAdapter {
|
|
460
|
+
readonly type = WalletType.WALLETCONNECT_TRON;
|
|
461
|
+
readonly chainType = ChainType.TRON;
|
|
462
|
+
readonly name = "WalletConnect (Tron)";
|
|
463
|
+
readonly icon = "https://avatars.githubusercontent.com/u/37784886";
|
|
464
|
+
private wallet;
|
|
465
|
+
private projectId;
|
|
466
|
+
private currentAddress;
|
|
467
|
+
private static readonly TRON_MAINNET_CHAIN_ID;
|
|
468
|
+
private static walletInstance;
|
|
469
|
+
private static walletProjectId;
|
|
470
|
+
constructor(projectId: string);
|
|
471
|
+
isAvailable(): Promise<boolean>;
|
|
472
|
+
private isTelegramMiniApp;
|
|
473
|
+
restoreSession(chainId?: number | number[]): Promise<Account | null>;
|
|
474
|
+
private initializeWallet;
|
|
475
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
476
|
+
disconnect(): Promise<void>;
|
|
477
|
+
signMessage(message: string): Promise<string>;
|
|
478
|
+
signTransaction(transaction: any): Promise<string>;
|
|
479
|
+
readContract<T = any>(_params: ContractReadParams): Promise<T>;
|
|
480
|
+
writeContract(_params: ContractWriteParams): Promise<string>;
|
|
481
|
+
estimateGas(_params: ContractWriteParams): Promise<bigint>;
|
|
482
|
+
waitForTransaction(_txHash: string, _confirmations?: number): Promise<TransactionReceipt>;
|
|
483
|
+
private setupEventListeners;
|
|
484
|
+
private removeEventListeners;
|
|
485
|
+
getProvider(): WalletConnectWallet | null;
|
|
486
|
+
static clearWalletInstance(): void;
|
|
487
|
+
}
|
|
488
|
+
|
|
357
489
|
declare class EVMPrivateKeyAdapter extends WalletAdapter {
|
|
358
490
|
readonly type = WalletType.PRIVATE_KEY;
|
|
359
491
|
readonly chainType = ChainType.EVM;
|
|
@@ -361,7 +493,7 @@ declare class EVMPrivateKeyAdapter extends WalletAdapter {
|
|
|
361
493
|
private privateKey;
|
|
362
494
|
private walletClient;
|
|
363
495
|
private publicClient;
|
|
364
|
-
connect(chainId?: number): Promise<Account>;
|
|
496
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
365
497
|
disconnect(): Promise<void>;
|
|
366
498
|
isAvailable(): Promise<boolean>;
|
|
367
499
|
setPrivateKey(privateKey: string): void;
|
|
@@ -377,6 +509,277 @@ declare class EVMPrivateKeyAdapter extends WalletAdapter {
|
|
|
377
509
|
private getViemChain;
|
|
378
510
|
}
|
|
379
511
|
|
|
512
|
+
declare enum DeepLinkProviderType {
|
|
513
|
+
TOKENPOCKET = "tokenpocket",
|
|
514
|
+
TRONLINK = "tronlink",
|
|
515
|
+
IMTOKEN = "imtoken",
|
|
516
|
+
METAMASK = "metamask",
|
|
517
|
+
OKX = "okx"
|
|
518
|
+
}
|
|
519
|
+
interface DeepLinkAdapterConfig {
|
|
520
|
+
providerType: DeepLinkProviderType;
|
|
521
|
+
callbackUrl?: string;
|
|
522
|
+
callbackSchema?: string;
|
|
523
|
+
}
|
|
524
|
+
declare class DeepLinkAdapter extends WalletAdapter {
|
|
525
|
+
readonly type: WalletType;
|
|
526
|
+
readonly chainType: ChainType$1;
|
|
527
|
+
readonly name: string;
|
|
528
|
+
readonly icon: string;
|
|
529
|
+
private provider;
|
|
530
|
+
private currentChainId;
|
|
531
|
+
private currentChainType;
|
|
532
|
+
private static pendingActions;
|
|
533
|
+
constructor(config: DeepLinkAdapterConfig);
|
|
534
|
+
private createProvider;
|
|
535
|
+
private setupCallbackHandler;
|
|
536
|
+
isAvailable(): Promise<boolean>;
|
|
537
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
538
|
+
disconnect(): Promise<void>;
|
|
539
|
+
signMessage(message: string): Promise<string>;
|
|
540
|
+
signTransaction(transaction: any): Promise<string>;
|
|
541
|
+
getProvider(): any;
|
|
542
|
+
static handleCallback(): void;
|
|
543
|
+
protected setAccount(account: Account | null): void;
|
|
544
|
+
protected emitDisconnected(): void;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
interface DeepLinkSignMessageParams {
|
|
548
|
+
message: string;
|
|
549
|
+
chainId: number;
|
|
550
|
+
chainType: ChainType$1;
|
|
551
|
+
}
|
|
552
|
+
interface DeepLinkSignTransactionParams {
|
|
553
|
+
transaction: any;
|
|
554
|
+
chainId: number;
|
|
555
|
+
chainType: ChainType$1;
|
|
556
|
+
}
|
|
557
|
+
interface DeepLinkConnectParams {
|
|
558
|
+
chainId: number;
|
|
559
|
+
chainType: ChainType$1;
|
|
560
|
+
}
|
|
561
|
+
interface IDeepLinkProvider {
|
|
562
|
+
readonly name: string;
|
|
563
|
+
readonly icon: string;
|
|
564
|
+
readonly supportedChainTypes: ChainType$1[];
|
|
565
|
+
isAvailable(): Promise<boolean>;
|
|
566
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
567
|
+
url: string;
|
|
568
|
+
actionId: string;
|
|
569
|
+
callbackSchema?: string;
|
|
570
|
+
callbackUrl?: string;
|
|
571
|
+
};
|
|
572
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
573
|
+
url: string;
|
|
574
|
+
actionId: string;
|
|
575
|
+
callbackSchema?: string;
|
|
576
|
+
callbackUrl?: string;
|
|
577
|
+
};
|
|
578
|
+
buildConnectLink?(params: DeepLinkConnectParams): {
|
|
579
|
+
url: string;
|
|
580
|
+
actionId?: string;
|
|
581
|
+
};
|
|
582
|
+
parseCallbackResult(urlParams: URLSearchParams): {
|
|
583
|
+
actionId: string | null;
|
|
584
|
+
result: any | null;
|
|
585
|
+
error: string | null;
|
|
586
|
+
};
|
|
587
|
+
getDefaultCallbackSchema?(): string;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
declare class TokenPocketDeepLinkProvider implements IDeepLinkProvider {
|
|
591
|
+
readonly name = "TokenPocket";
|
|
592
|
+
readonly icon = "https://tokenpocket.pro/icon.png";
|
|
593
|
+
readonly supportedChainTypes: _enclave_hq_chain_utils.ChainType[];
|
|
594
|
+
private callbackUrl?;
|
|
595
|
+
private callbackSchema?;
|
|
596
|
+
constructor(options?: {
|
|
597
|
+
callbackUrl?: string;
|
|
598
|
+
callbackSchema?: string;
|
|
599
|
+
});
|
|
600
|
+
isAvailable(): Promise<boolean>;
|
|
601
|
+
private generateActionId;
|
|
602
|
+
private getCallbackConfig;
|
|
603
|
+
private getBlockchainConfig;
|
|
604
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
605
|
+
url: string;
|
|
606
|
+
actionId: string;
|
|
607
|
+
callbackSchema?: string;
|
|
608
|
+
callbackUrl?: string;
|
|
609
|
+
};
|
|
610
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
611
|
+
url: string;
|
|
612
|
+
actionId: string;
|
|
613
|
+
callbackSchema?: string;
|
|
614
|
+
callbackUrl?: string;
|
|
615
|
+
};
|
|
616
|
+
buildConnectLink(params: DeepLinkConnectParams): {
|
|
617
|
+
url: string;
|
|
618
|
+
actionId?: string;
|
|
619
|
+
};
|
|
620
|
+
parseCallbackResult(urlParams: URLSearchParams): {
|
|
621
|
+
actionId: string | null;
|
|
622
|
+
result: any | null;
|
|
623
|
+
error: string | null;
|
|
624
|
+
};
|
|
625
|
+
getDefaultCallbackSchema(): string;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
declare class TronLinkDeepLinkProvider implements IDeepLinkProvider {
|
|
629
|
+
readonly name = "TronLink";
|
|
630
|
+
readonly icon = "https://www.tronlink.org/static/logoIcon.svg";
|
|
631
|
+
readonly supportedChainTypes: _enclave_hq_chain_utils.ChainType[];
|
|
632
|
+
isAvailable(): Promise<boolean>;
|
|
633
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
634
|
+
url: string;
|
|
635
|
+
actionId: string;
|
|
636
|
+
callbackSchema?: string;
|
|
637
|
+
callbackUrl?: string;
|
|
638
|
+
};
|
|
639
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
640
|
+
url: string;
|
|
641
|
+
actionId: string;
|
|
642
|
+
callbackSchema?: string;
|
|
643
|
+
callbackUrl?: string;
|
|
644
|
+
};
|
|
645
|
+
buildConnectLink(params: DeepLinkConnectParams): {
|
|
646
|
+
url: string;
|
|
647
|
+
actionId?: string;
|
|
648
|
+
};
|
|
649
|
+
parseCallbackResult(_urlParams: URLSearchParams): {
|
|
650
|
+
actionId: string | null;
|
|
651
|
+
result: any | null;
|
|
652
|
+
error: string | null;
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
declare class ImTokenDeepLinkProvider implements IDeepLinkProvider {
|
|
657
|
+
readonly name = "ImToken";
|
|
658
|
+
readonly icon = "https://token.im/static/img/logo.png";
|
|
659
|
+
readonly supportedChainTypes: _enclave_hq_chain_utils.ChainType[];
|
|
660
|
+
private callbackUrl?;
|
|
661
|
+
private callbackSchema?;
|
|
662
|
+
constructor(options?: {
|
|
663
|
+
callbackUrl?: string;
|
|
664
|
+
callbackSchema?: string;
|
|
665
|
+
});
|
|
666
|
+
isAvailable(): Promise<boolean>;
|
|
667
|
+
private generateActionId;
|
|
668
|
+
private getCallbackConfig;
|
|
669
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
670
|
+
url: string;
|
|
671
|
+
actionId: string;
|
|
672
|
+
callbackSchema?: string;
|
|
673
|
+
callbackUrl?: string;
|
|
674
|
+
};
|
|
675
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
676
|
+
url: string;
|
|
677
|
+
actionId: string;
|
|
678
|
+
callbackSchema?: string;
|
|
679
|
+
callbackUrl?: string;
|
|
680
|
+
};
|
|
681
|
+
buildConnectLink(params: DeepLinkConnectParams): {
|
|
682
|
+
url: string;
|
|
683
|
+
actionId?: string;
|
|
684
|
+
};
|
|
685
|
+
parseCallbackResult(urlParams: URLSearchParams): {
|
|
686
|
+
actionId: string | null;
|
|
687
|
+
result: any | null;
|
|
688
|
+
error: string | null;
|
|
689
|
+
};
|
|
690
|
+
getDefaultCallbackSchema(): string;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
declare class MetaMaskDeepLinkProvider implements IDeepLinkProvider {
|
|
694
|
+
readonly name = "MetaMask";
|
|
695
|
+
readonly icon = "https://upload.wikimedia.org/wikipedia/commons/3/36/MetaMask_Fox.svg";
|
|
696
|
+
readonly supportedChainTypes: _enclave_hq_chain_utils.ChainType[];
|
|
697
|
+
isAvailable(): Promise<boolean>;
|
|
698
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
699
|
+
url: string;
|
|
700
|
+
actionId: string;
|
|
701
|
+
callbackSchema?: string;
|
|
702
|
+
callbackUrl?: string;
|
|
703
|
+
};
|
|
704
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
705
|
+
url: string;
|
|
706
|
+
actionId: string;
|
|
707
|
+
callbackSchema?: string;
|
|
708
|
+
callbackUrl?: string;
|
|
709
|
+
};
|
|
710
|
+
buildConnectLink(params: DeepLinkConnectParams): {
|
|
711
|
+
url: string;
|
|
712
|
+
actionId?: string;
|
|
713
|
+
};
|
|
714
|
+
parseCallbackResult(urlParams: URLSearchParams): {
|
|
715
|
+
actionId: string | null;
|
|
716
|
+
result: any | null;
|
|
717
|
+
error: string | null;
|
|
718
|
+
};
|
|
719
|
+
getDefaultCallbackSchema(): string;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
declare class OKXDeepLinkProvider implements IDeepLinkProvider {
|
|
723
|
+
readonly name = "OKX";
|
|
724
|
+
readonly icon = "https://www.okx.com/favicon.ico";
|
|
725
|
+
readonly supportedChainTypes: _enclave_hq_chain_utils.ChainType[];
|
|
726
|
+
isAvailable(): Promise<boolean>;
|
|
727
|
+
buildSignMessageLink(params: DeepLinkSignMessageParams): {
|
|
728
|
+
url: string;
|
|
729
|
+
actionId: string;
|
|
730
|
+
callbackSchema?: string;
|
|
731
|
+
callbackUrl?: string;
|
|
732
|
+
};
|
|
733
|
+
buildSignTransactionLink(params: DeepLinkSignTransactionParams): {
|
|
734
|
+
url: string;
|
|
735
|
+
actionId: string;
|
|
736
|
+
callbackSchema?: string;
|
|
737
|
+
callbackUrl?: string;
|
|
738
|
+
};
|
|
739
|
+
buildConnectLink(params: DeepLinkConnectParams): {
|
|
740
|
+
url: string;
|
|
741
|
+
actionId?: string;
|
|
742
|
+
};
|
|
743
|
+
parseCallbackResult(urlParams: URLSearchParams): {
|
|
744
|
+
actionId: string | null;
|
|
745
|
+
result: any | null;
|
|
746
|
+
error: string | null;
|
|
747
|
+
};
|
|
748
|
+
getDefaultCallbackSchema(): string;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
declare enum DeepLinkWalletType {
|
|
752
|
+
TOKENPOCKET = "tokenpocket",
|
|
753
|
+
TRONLINK = "tronlink"
|
|
754
|
+
}
|
|
755
|
+
declare class TronDeepLinkAdapter extends WalletAdapter {
|
|
756
|
+
readonly type = WalletType.TRONLINK;
|
|
757
|
+
readonly chainType = ChainType.TRON;
|
|
758
|
+
readonly name: string;
|
|
759
|
+
readonly icon: string;
|
|
760
|
+
private walletType;
|
|
761
|
+
private callbackUrl?;
|
|
762
|
+
private callbackSchema?;
|
|
763
|
+
private pendingActions;
|
|
764
|
+
private static readonly TRON_MAINNET_CHAIN_ID;
|
|
765
|
+
constructor(walletType?: DeepLinkWalletType, options?: {
|
|
766
|
+
callbackUrl?: string;
|
|
767
|
+
callbackSchema?: string;
|
|
768
|
+
});
|
|
769
|
+
private setupCallbackHandler;
|
|
770
|
+
private checkCallbackFromUrl;
|
|
771
|
+
isAvailable(): Promise<boolean>;
|
|
772
|
+
connect(chainId?: number | number[]): Promise<Account>;
|
|
773
|
+
disconnect(): Promise<void>;
|
|
774
|
+
signMessage(message: string): Promise<string>;
|
|
775
|
+
signTransaction(transaction: any): Promise<string>;
|
|
776
|
+
readContract<T = any>(_params: ContractReadParams): Promise<T>;
|
|
777
|
+
writeContract(_params: ContractWriteParams): Promise<string>;
|
|
778
|
+
estimateGas(_params: ContractWriteParams): Promise<bigint>;
|
|
779
|
+
waitForTransaction(_txHash: string, _confirmations?: number): Promise<TransactionReceipt>;
|
|
780
|
+
getProvider(): any;
|
|
781
|
+
}
|
|
782
|
+
|
|
380
783
|
interface AuthMessageParams {
|
|
381
784
|
domain: string;
|
|
382
785
|
nonce: string;
|
|
@@ -474,4 +877,4 @@ declare function hexToNumber(hex: string): number;
|
|
|
474
877
|
declare function ensureHexPrefix(value: string): string;
|
|
475
878
|
declare function removeHexPrefix(value: string): string;
|
|
476
879
|
|
|
477
|
-
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 ISigner, 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 };
|
|
880
|
+
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, DeepLinkAdapter, DeepLinkProviderType, DeepLinkWalletType, EVMPrivateKeyAdapter, type EVMTransaction, type IDeepLinkProvider, type ISigner, type IWalletAdapter, ImTokenDeepLinkProvider, MetaMaskAdapter, MetaMaskDeepLinkProvider, MethodNotSupportedError, NetworkError, OKXDeepLinkProvider, type QRCodeSignResult, QRCodeSignStatus, QRCodeSigner, type QRCodeSignerConfig, SUPPORTED_WALLETS, SignatureRejectedError, SignatureVerifier, type StorageData, TokenPocketDeepLinkProvider, type Transaction, TransactionFailedError, type TransactionReceipt, TronDeepLinkAdapter, TronLinkAdapter, TronLinkDeepLinkProvider, type TronTransaction, type UniversalAddress, WalletAdapter, type WalletAvailability, WalletConnectAdapter, WalletConnectTronAdapter, 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 };
|