@tomo-inc/wallet-connect-protocol 0.0.8 → 0.0.10
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/MIGRATION.md +101 -0
- package/README.md +605 -290
- package/dist/index.cjs +111 -528
- package/dist/index.d.cts +668 -148
- package/dist/index.d.ts +668 -148
- package/dist/index.js +746 -315
- package/package.json +5 -18
- package/VANILLA_JS.md +0 -491
- package/dist/chunk-32KOSJUW.js +0 -839
- package/dist/vanilla-2_OWCFEZ.d.cts +0 -705
- package/dist/vanilla-2_OWCFEZ.d.ts +0 -705
- package/dist/vanilla.cjs +0 -828
- package/dist/vanilla.d.cts +0 -1
- package/dist/vanilla.d.ts +0 -1
- package/dist/vanilla.js +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,169 +1,689 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* WalletConnect configuration type definition
|
|
3
|
+
*/
|
|
4
|
+
interface WalletConnectConfig {
|
|
5
|
+
/** WalletConnect Project ID (get from https://cloud.walletconnect.com) */
|
|
6
|
+
projectId: string;
|
|
7
|
+
/** application metadata */
|
|
8
|
+
metadata: {
|
|
9
|
+
/** application name */
|
|
10
|
+
name: string;
|
|
11
|
+
/** application description */
|
|
12
|
+
description: string;
|
|
13
|
+
/** application website address */
|
|
14
|
+
url: string;
|
|
15
|
+
/** application icon URL */
|
|
16
|
+
icons: string[];
|
|
17
|
+
};
|
|
18
|
+
/** optional configuration */
|
|
19
|
+
relayUrl?: string;
|
|
20
|
+
/** authentication options */
|
|
21
|
+
auth?: AuthOptions;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* session information
|
|
25
|
+
*/
|
|
26
|
+
interface SessionInfo {
|
|
27
|
+
/** session topic/ID */
|
|
28
|
+
topic: string;
|
|
29
|
+
/** peer information */
|
|
30
|
+
peer: {
|
|
31
|
+
metadata: {
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
url: string;
|
|
35
|
+
icons: string[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/** namespace configuration */
|
|
39
|
+
namespaces: Record<string, any>;
|
|
40
|
+
/** expiry timestamp */
|
|
41
|
+
expiry: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* connection request parameters
|
|
45
|
+
*/
|
|
46
|
+
interface ConnectParams {
|
|
47
|
+
/** optional pairing topic */
|
|
48
|
+
pairingTopic?: string;
|
|
49
|
+
/** required namespaces */
|
|
50
|
+
requiredNamespaces?: Record<string, NamespaceConfig>;
|
|
51
|
+
/** optional namespaces */
|
|
52
|
+
optionalNamespaces?: Record<string, NamespaceConfig>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* namespace configuration
|
|
56
|
+
*/
|
|
57
|
+
interface NamespaceConfig {
|
|
58
|
+
/** chain ID list */
|
|
59
|
+
chains: string[];
|
|
60
|
+
/** supported methods */
|
|
61
|
+
methods: string[];
|
|
62
|
+
/** subscribed events */
|
|
63
|
+
events: string[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* supported blockchain types
|
|
67
|
+
*/
|
|
68
|
+
declare enum ChainType {
|
|
69
|
+
/** Ethereum and EVM compatible chains */
|
|
70
|
+
EIP155 = "eip155",
|
|
71
|
+
/** Solana */
|
|
72
|
+
SOLANA = "solana",
|
|
73
|
+
/** Aptos */
|
|
74
|
+
APTOS = "aptos",
|
|
75
|
+
/** Cosmos */
|
|
76
|
+
COSMOS = "cosmos",
|
|
77
|
+
/** Polkadot */
|
|
78
|
+
POLKADOT = "polkadot",
|
|
79
|
+
/** Near */
|
|
80
|
+
NEAR = "near"
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* QR code options
|
|
84
|
+
*/
|
|
85
|
+
interface QRCodeOptions {
|
|
86
|
+
/** QR code width (pixels) */
|
|
87
|
+
width?: number;
|
|
88
|
+
/** QR code height (pixels) */
|
|
89
|
+
height?: number;
|
|
90
|
+
/** error correction level */
|
|
91
|
+
errorCorrectionLevel?: "L" | "M" | "Q" | "H";
|
|
92
|
+
/** margin */
|
|
93
|
+
margin?: number;
|
|
94
|
+
/** color configuration */
|
|
95
|
+
color?: {
|
|
96
|
+
dark?: string;
|
|
97
|
+
light?: string;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* event types
|
|
102
|
+
*/
|
|
103
|
+
type WalletConnectEvent = "session_proposal" | "session_update" | "session_delete" | "session_request" | "display_uri";
|
|
104
|
+
/**
|
|
105
|
+
* event handler type
|
|
106
|
+
*/
|
|
107
|
+
type EventHandler<T = any> = (data: T) => void | Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Authentication method
|
|
110
|
+
*/
|
|
111
|
+
declare enum AuthMethod {
|
|
112
|
+
/** Standard WalletConnect connection */
|
|
113
|
+
STANDARD = "standard",
|
|
114
|
+
/** Sign-In with Ethereum (SIWE) */
|
|
115
|
+
SIWE = "siwe"
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Authentication options
|
|
119
|
+
*/
|
|
120
|
+
interface AuthOptions {
|
|
121
|
+
/** Authentication method */
|
|
122
|
+
method?: AuthMethod;
|
|
123
|
+
/** SIWE specific options */
|
|
124
|
+
siwe?: {
|
|
125
|
+
/** Domain requesting the signing */
|
|
126
|
+
domain: string;
|
|
127
|
+
/** Statement to present to user */
|
|
128
|
+
statement?: string;
|
|
129
|
+
/** URI of the application */
|
|
130
|
+
uri: string;
|
|
131
|
+
/** Resources the user wishes to access */
|
|
132
|
+
resources?: string[];
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* WalletConnect client class
|
|
138
|
+
* wraps the core functionality of WalletConnect
|
|
139
|
+
*/
|
|
140
|
+
declare class WalletConnectClient {
|
|
141
|
+
private signClient;
|
|
142
|
+
private config;
|
|
143
|
+
private eventHandlers;
|
|
144
|
+
private initialized;
|
|
145
|
+
constructor(config: WalletConnectConfig);
|
|
146
|
+
/**
|
|
147
|
+
* initialize WalletConnect client
|
|
148
|
+
*/
|
|
149
|
+
initialize(): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* set event listeners
|
|
152
|
+
*/
|
|
153
|
+
private setupEventListeners;
|
|
154
|
+
/**
|
|
155
|
+
* create pairing connection and generate URI
|
|
156
|
+
* @param params connection parameters
|
|
157
|
+
* @returns WalletConnect URI
|
|
158
|
+
*/
|
|
159
|
+
connect(params?: ConnectParams): Promise<string>;
|
|
160
|
+
/**
|
|
161
|
+
* generate QR code (Base64 format)
|
|
162
|
+
* @param uri WalletConnect URI
|
|
163
|
+
* @param options QR code options
|
|
164
|
+
* @returns Base64 formatted QR code image
|
|
165
|
+
*/
|
|
166
|
+
generateQRCode(uri: string, options?: QRCodeOptions): Promise<string>;
|
|
167
|
+
/**
|
|
168
|
+
* generate QR code (Canvas format)
|
|
169
|
+
* @param canvas Canvas element
|
|
170
|
+
* @param uri WalletConnect URI
|
|
171
|
+
* @param options QR code options
|
|
172
|
+
*/
|
|
173
|
+
generateQRCodeToCanvas(canvas: HTMLCanvasElement, uri: string, options?: QRCodeOptions): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* get all active sessions
|
|
176
|
+
* @returns session information array
|
|
177
|
+
*/
|
|
178
|
+
getActiveSessions(): SessionInfo[];
|
|
179
|
+
/**
|
|
180
|
+
* disconnect specified session
|
|
181
|
+
* @param topic session topic/ID
|
|
182
|
+
*/
|
|
183
|
+
disconnectSession(topic: string): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* listen to events
|
|
186
|
+
* @param event event name
|
|
187
|
+
* @param handler event handler
|
|
188
|
+
*/
|
|
189
|
+
on<T = any>(event: WalletConnectEvent, handler: EventHandler<T>): void;
|
|
190
|
+
/**
|
|
191
|
+
* remove event listener
|
|
192
|
+
* @param event event name
|
|
193
|
+
* @param handler event handler
|
|
194
|
+
*/
|
|
195
|
+
off<T = any>(event: WalletConnectEvent, handler: EventHandler<T>): void;
|
|
196
|
+
/**
|
|
197
|
+
* trigger event
|
|
198
|
+
* @param event event name
|
|
199
|
+
* @param data event data
|
|
200
|
+
*/
|
|
201
|
+
private emit;
|
|
202
|
+
/**
|
|
203
|
+
* send JSON-RPC request to wallet
|
|
204
|
+
* @param params request parameters
|
|
205
|
+
* @returns request result
|
|
206
|
+
*/
|
|
207
|
+
sendRequest(params: {
|
|
208
|
+
topic: string;
|
|
209
|
+
chainId: string;
|
|
210
|
+
request: {
|
|
211
|
+
method: string;
|
|
212
|
+
params: any[];
|
|
213
|
+
};
|
|
214
|
+
}): Promise<any>;
|
|
215
|
+
/**
|
|
216
|
+
* destroy client
|
|
217
|
+
*/
|
|
218
|
+
destroy(): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* get if client is initialized
|
|
221
|
+
*/
|
|
222
|
+
isInitialized(): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* get configuration information
|
|
225
|
+
*/
|
|
226
|
+
getConfig(): WalletConnectConfig;
|
|
227
|
+
}
|
|
5
228
|
|
|
6
229
|
/**
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
230
|
+
* utility functions
|
|
231
|
+
*/
|
|
232
|
+
/**
|
|
233
|
+
* validate WalletConnect URI format
|
|
234
|
+
* @param uri WalletConnect URI
|
|
235
|
+
* @returns whether valid
|
|
236
|
+
*/
|
|
237
|
+
declare function isValidWalletConnectUri(uri: string): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* parse WalletConnect URI
|
|
240
|
+
* @param uri WalletConnect URI
|
|
241
|
+
* @returns parsed object
|
|
242
|
+
*/
|
|
243
|
+
declare function parseWalletConnectUri(uri: string): {
|
|
244
|
+
topic: string;
|
|
245
|
+
version: string;
|
|
246
|
+
symKey?: string;
|
|
247
|
+
relay?: {
|
|
248
|
+
protocol: string;
|
|
249
|
+
data?: string;
|
|
250
|
+
};
|
|
251
|
+
} | null;
|
|
252
|
+
/**
|
|
253
|
+
* format address (shorten display)
|
|
254
|
+
* @param address full address
|
|
255
|
+
* @param startLength start length
|
|
256
|
+
* @param endLength end length
|
|
257
|
+
* @returns formatted address
|
|
258
|
+
*/
|
|
259
|
+
declare function formatAddress(address: string, startLength?: number, endLength?: number): string;
|
|
260
|
+
/**
|
|
261
|
+
* extract address from account string
|
|
262
|
+
* @param account account string (format: chainId:address)
|
|
263
|
+
* @returns address
|
|
264
|
+
*/
|
|
265
|
+
declare function extractAddressFromAccount(account: string): string;
|
|
266
|
+
/**
|
|
267
|
+
* extract chain ID from account string
|
|
268
|
+
* @param account account string (format: namespace:chainId:address)
|
|
269
|
+
* @returns chain ID
|
|
270
|
+
*/
|
|
271
|
+
declare function extractChainIdFromAccount(account: string): string;
|
|
272
|
+
/**
|
|
273
|
+
* check if session is expired
|
|
274
|
+
* @param expiry expiry timestamp (seconds)
|
|
275
|
+
* @returns whether expired
|
|
276
|
+
*/
|
|
277
|
+
declare function isSessionExpired(expiry: number): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* get session remaining time
|
|
280
|
+
* @param expiry expiry timestamp (seconds)
|
|
281
|
+
* @returns remaining seconds
|
|
282
|
+
*/
|
|
283
|
+
declare function getSessionTimeRemaining(expiry: number): number;
|
|
284
|
+
/**
|
|
285
|
+
* format timestamp to readable format
|
|
286
|
+
* @param timestamp timestamp (seconds)
|
|
287
|
+
* @returns formatted timestamp string
|
|
288
|
+
*/
|
|
289
|
+
declare function formatTimestamp(timestamp: number): string;
|
|
290
|
+
/**
|
|
291
|
+
* check if is mobile device
|
|
292
|
+
* @returns whether is mobile device
|
|
293
|
+
*/
|
|
294
|
+
declare function isMobile(): boolean;
|
|
295
|
+
/**
|
|
296
|
+
* generate deep link
|
|
297
|
+
* @param uri WalletConnect URI
|
|
298
|
+
* @param walletName wallet name (optional)
|
|
299
|
+
* @returns deep link
|
|
300
|
+
*/
|
|
301
|
+
declare function generateDeepLink(uri: string, walletName?: string): string;
|
|
302
|
+
/**
|
|
303
|
+
* copy text to clipboard
|
|
304
|
+
* @param text text to copy
|
|
305
|
+
* @returns whether successful
|
|
306
|
+
*/
|
|
307
|
+
declare function copyToClipboard(text: string): Promise<boolean>;
|
|
308
|
+
/**
|
|
309
|
+
* format error message
|
|
310
|
+
* @param error error object
|
|
311
|
+
* @returns formatted error message
|
|
312
|
+
*/
|
|
313
|
+
declare function formatError(error: any): string;
|
|
314
|
+
/**
|
|
315
|
+
* validate chain ID format
|
|
316
|
+
* @param chainId chain ID
|
|
317
|
+
* @returns whether valid
|
|
318
|
+
*/
|
|
319
|
+
declare function isValidChainId(chainId: string): boolean;
|
|
320
|
+
/**
|
|
321
|
+
* parse chain ID
|
|
322
|
+
* @param chainId chain ID (format: namespace:reference)
|
|
323
|
+
* @returns parsed result
|
|
324
|
+
*/
|
|
325
|
+
declare function parseChainId(chainId: string): {
|
|
326
|
+
namespace: string;
|
|
327
|
+
reference: string;
|
|
328
|
+
} | null;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* multi-chain support configuration
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Ethereum (EVM compatible chains) namespace configuration
|
|
336
|
+
*/
|
|
337
|
+
declare const EIP155_NAMESPACE: NamespaceConfig;
|
|
338
|
+
/**
|
|
339
|
+
* Solana namespace configuration
|
|
340
|
+
*/
|
|
341
|
+
declare const SOLANA_NAMESPACE: NamespaceConfig;
|
|
342
|
+
/**
|
|
343
|
+
* Aptos namespace configuration
|
|
344
|
+
*/
|
|
345
|
+
declare const APTOS_NAMESPACE: NamespaceConfig;
|
|
346
|
+
/**
|
|
347
|
+
* Cosmos namespace configuration
|
|
348
|
+
*/
|
|
349
|
+
declare const COSMOS_NAMESPACE: NamespaceConfig;
|
|
350
|
+
/**
|
|
351
|
+
* Polkadot namespace configuration
|
|
352
|
+
*/
|
|
353
|
+
declare const POLKADOT_NAMESPACE: NamespaceConfig;
|
|
354
|
+
/**
|
|
355
|
+
* Near namespace configuration
|
|
356
|
+
*/
|
|
357
|
+
declare const NEAR_NAMESPACE: NamespaceConfig;
|
|
358
|
+
/**
|
|
359
|
+
* commonly used EVM chains configuration
|
|
360
|
+
*/
|
|
361
|
+
declare const EVM_CHAINS: {
|
|
362
|
+
ETHEREUM_MAINNET: string;
|
|
363
|
+
ETHEREUM_GOERLI: string;
|
|
364
|
+
ETHEREUM_SEPOLIA: string;
|
|
365
|
+
POLYGON: string;
|
|
366
|
+
POLYGON_MUMBAI: string;
|
|
367
|
+
ARBITRUM: string;
|
|
368
|
+
ARBITRUM_GOERLI: string;
|
|
369
|
+
OPTIMISM: string;
|
|
370
|
+
OPTIMISM_GOERLI: string;
|
|
371
|
+
BSC: string;
|
|
372
|
+
BSC_TESTNET: string;
|
|
373
|
+
AVALANCHE: string;
|
|
374
|
+
AVALANCHE_FUJI: string;
|
|
375
|
+
FANTOM: string;
|
|
376
|
+
CRONOS: string;
|
|
377
|
+
GNOSIS: string;
|
|
378
|
+
BASE: string;
|
|
379
|
+
ZKSYNC: string;
|
|
380
|
+
LINEA: string;
|
|
381
|
+
SCROLL: string;
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Solana chains configuration
|
|
385
|
+
*/
|
|
386
|
+
declare const SOLANA_CHAINS: {
|
|
387
|
+
MAINNET: string;
|
|
388
|
+
DEVNET: string;
|
|
389
|
+
TESTNET: string;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Aptos chains configuration
|
|
393
|
+
*/
|
|
394
|
+
declare const APTOS_CHAINS: {
|
|
395
|
+
MAINNET: string;
|
|
396
|
+
TESTNET: string;
|
|
397
|
+
DEVNET: string;
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* create multi-chain namespaces configuration
|
|
401
|
+
*/
|
|
402
|
+
declare function createMultiChainNamespaces(chains: string[]): Record<string, NamespaceConfig>;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Sign-In with Ethereum (SIWE) Support
|
|
406
|
+
* Implementation of EIP-4361: Sign-In with Ethereum
|
|
407
|
+
*/
|
|
408
|
+
/**
|
|
409
|
+
* SIWE configuration options
|
|
410
|
+
*/
|
|
411
|
+
interface SiweConfig {
|
|
412
|
+
/** Domain requesting the signing */
|
|
413
|
+
domain: string;
|
|
414
|
+
/** Statement to present to user (optional) */
|
|
415
|
+
statement?: string;
|
|
416
|
+
/** URI of the application */
|
|
417
|
+
uri: string;
|
|
418
|
+
/** Version of the SIWE message (default: "1") */
|
|
419
|
+
version?: string;
|
|
420
|
+
/** Chain ID */
|
|
421
|
+
chainId: number;
|
|
422
|
+
/** Nonce for preventing replay attacks */
|
|
423
|
+
nonce?: string;
|
|
424
|
+
/** ISO 8601 datetime string of current time */
|
|
425
|
+
issuedAt?: string;
|
|
426
|
+
/** ISO 8601 datetime string when message expires */
|
|
427
|
+
expirationTime?: string;
|
|
428
|
+
/** ISO 8601 datetime string when message becomes valid */
|
|
429
|
+
notBefore?: string;
|
|
430
|
+
/** Request ID */
|
|
431
|
+
requestId?: string;
|
|
432
|
+
/** Resources the user wishes to access */
|
|
433
|
+
resources?: string[];
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* SIWE message and signature result
|
|
437
|
+
*/
|
|
438
|
+
interface SiweResult {
|
|
439
|
+
/** The SIWE message that was signed */
|
|
440
|
+
message: string;
|
|
441
|
+
/** The signature */
|
|
442
|
+
signature: string;
|
|
443
|
+
/** The address that signed */
|
|
444
|
+
address: string;
|
|
445
|
+
/** Parsed SIWE message object */
|
|
446
|
+
siweMessage: any;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Create a SIWE message
|
|
450
|
+
*/
|
|
451
|
+
declare function createSiweMessage(config: SiweConfig, address: string): Promise<string>;
|
|
452
|
+
/**
|
|
453
|
+
* Parse a SIWE message
|
|
454
|
+
*/
|
|
455
|
+
declare function parseSiweMessage(message: string): Promise<any>;
|
|
456
|
+
/**
|
|
457
|
+
* Verify a SIWE signature
|
|
458
|
+
*/
|
|
459
|
+
declare function verifySiweSignature(params: {
|
|
460
|
+
message: string;
|
|
461
|
+
signature: string;
|
|
462
|
+
nonce?: string;
|
|
463
|
+
domain?: string;
|
|
464
|
+
time?: string;
|
|
465
|
+
}): Promise<{
|
|
466
|
+
success: boolean;
|
|
467
|
+
data?: any;
|
|
468
|
+
error?: string;
|
|
469
|
+
}>;
|
|
470
|
+
/**
|
|
471
|
+
* Create SIWE configuration from session
|
|
472
|
+
*/
|
|
473
|
+
declare function createSiweConfigFromSession(params: {
|
|
474
|
+
domain: string;
|
|
475
|
+
uri: string;
|
|
476
|
+
chainId: number;
|
|
477
|
+
statement?: string;
|
|
478
|
+
resources?: string[];
|
|
479
|
+
}): SiweConfig;
|
|
480
|
+
/**
|
|
481
|
+
* SIWE authentication flow helper
|
|
482
|
+
*/
|
|
483
|
+
declare class SiweAuth {
|
|
484
|
+
private config;
|
|
485
|
+
constructor(config: Omit<SiweConfig, "nonce" | "issuedAt">);
|
|
486
|
+
/**
|
|
487
|
+
* Create the message to sign
|
|
488
|
+
*/
|
|
489
|
+
createMessage(address: string): Promise<string>;
|
|
490
|
+
/**
|
|
491
|
+
* Verify the signature
|
|
492
|
+
*/
|
|
493
|
+
verify(message: string, signature: string): Promise<{
|
|
494
|
+
success: boolean;
|
|
495
|
+
data?: any;
|
|
496
|
+
error?: string;
|
|
497
|
+
}>;
|
|
498
|
+
/**
|
|
499
|
+
* Get the nonce
|
|
500
|
+
*/
|
|
501
|
+
getNonce(): string;
|
|
502
|
+
/**
|
|
503
|
+
* Refresh nonce (for new sign-in attempts)
|
|
504
|
+
*/
|
|
505
|
+
refreshNonce(): void;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* WalletConnect Wallet List API
|
|
510
|
+
*
|
|
511
|
+
* Fetch all supported wallets using WalletConnect Cloud Explorer API
|
|
512
|
+
* API Documentation: https://explorer-api.walletconnect.com/docs
|
|
513
|
+
*/
|
|
514
|
+
interface WalletImage {
|
|
515
|
+
id: string;
|
|
516
|
+
image_id: string;
|
|
517
|
+
image_url: string;
|
|
518
|
+
}
|
|
519
|
+
interface WalletMetadata {
|
|
520
|
+
shortName: string;
|
|
521
|
+
colors: {
|
|
522
|
+
primary?: string;
|
|
523
|
+
secondary?: string;
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
interface WalletPlatform {
|
|
527
|
+
native?: string;
|
|
528
|
+
universal?: string;
|
|
529
|
+
}
|
|
530
|
+
interface WalletApp {
|
|
531
|
+
browser?: string;
|
|
532
|
+
ios?: string;
|
|
533
|
+
android?: string;
|
|
534
|
+
mac?: string;
|
|
535
|
+
windows?: string;
|
|
536
|
+
linux?: string;
|
|
537
|
+
chrome?: string;
|
|
538
|
+
firefox?: string;
|
|
539
|
+
safari?: string;
|
|
540
|
+
edge?: string;
|
|
541
|
+
opera?: string;
|
|
542
|
+
}
|
|
543
|
+
interface Wallet {
|
|
544
|
+
id: string;
|
|
545
|
+
name: string;
|
|
546
|
+
homepage: string;
|
|
547
|
+
image_id: string;
|
|
548
|
+
image_url?: WalletImage;
|
|
549
|
+
order?: number;
|
|
550
|
+
mobile_link?: string;
|
|
551
|
+
desktop_link?: string;
|
|
552
|
+
webapp_link?: string;
|
|
553
|
+
app_type?: string;
|
|
554
|
+
rdns?: string;
|
|
555
|
+
metadata?: WalletMetadata;
|
|
556
|
+
app?: WalletApp;
|
|
557
|
+
injected?: Array<{
|
|
558
|
+
namespace: string;
|
|
559
|
+
injected_id: string;
|
|
560
|
+
}>;
|
|
561
|
+
mobile?: WalletPlatform;
|
|
562
|
+
desktop?: WalletPlatform;
|
|
563
|
+
}
|
|
564
|
+
interface WalletListResponse {
|
|
565
|
+
count: number;
|
|
566
|
+
data: Wallet[];
|
|
567
|
+
}
|
|
568
|
+
interface WalletListOptions {
|
|
569
|
+
/** Project ID (obtain from WalletConnect Cloud) */
|
|
570
|
+
projectId?: string;
|
|
571
|
+
/** Number of entries per page (default 100) */
|
|
572
|
+
entries?: number;
|
|
573
|
+
/** Page number (default 1) */
|
|
574
|
+
page?: number;
|
|
575
|
+
/** Search keyword */
|
|
576
|
+
search?: string;
|
|
577
|
+
/** Filter by chain */
|
|
578
|
+
chains?: string;
|
|
579
|
+
/** Include image URLs */
|
|
580
|
+
include?: string;
|
|
581
|
+
/** Exclude specific wallets */
|
|
582
|
+
exclude?: string;
|
|
583
|
+
/** Recommended wallet IDs */
|
|
584
|
+
recommendedIds?: string;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Get all WalletConnect supported wallets
|
|
588
|
+
*
|
|
589
|
+
* @param options Query options
|
|
590
|
+
* @returns Wallet list
|
|
44
591
|
*
|
|
45
592
|
* @example
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
593
|
+
* ```typescript
|
|
594
|
+
* // Get all wallets
|
|
595
|
+
* const wallets = await getWalletConnectWallets({ projectId: 'your-project-id' });
|
|
48
596
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* }}
|
|
61
|
-
* autoInit
|
|
62
|
-
* >
|
|
63
|
-
* <YourApp />
|
|
64
|
-
* </WalletConnectProvider>
|
|
65
|
-
* );
|
|
66
|
-
* }
|
|
597
|
+
* // Search wallets
|
|
598
|
+
* const results = await getWalletConnectWallets({
|
|
599
|
+
* projectId: 'your-project-id',
|
|
600
|
+
* search: 'metamask'
|
|
601
|
+
* });
|
|
602
|
+
*
|
|
603
|
+
* // Filter by chain
|
|
604
|
+
* const ethWallets = await getWalletConnectWallets({
|
|
605
|
+
* projectId: 'your-project-id',
|
|
606
|
+
* chains: 'eip155:1'
|
|
607
|
+
* });
|
|
67
608
|
* ```
|
|
68
609
|
*/
|
|
69
|
-
declare function
|
|
610
|
+
declare function getWalletConnectWallets(options?: WalletListOptions): Promise<WalletListResponse>;
|
|
70
611
|
/**
|
|
71
|
-
*
|
|
612
|
+
* Get all wallets (automatically handles pagination)
|
|
72
613
|
*
|
|
73
|
-
* @
|
|
74
|
-
*
|
|
75
|
-
|
|
614
|
+
* @param options Query options
|
|
615
|
+
* @returns Complete list of all wallets
|
|
616
|
+
*/
|
|
617
|
+
declare function getAllWallets(options?: WalletListOptions): Promise<Wallet[]>;
|
|
618
|
+
/**
|
|
619
|
+
* Get specific wallet by ID
|
|
76
620
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
621
|
+
* @param walletId Wallet ID
|
|
622
|
+
* @param projectId Project ID
|
|
623
|
+
* @returns Wallet information
|
|
624
|
+
*/
|
|
625
|
+
declare function getWalletById(walletId: string, projectId?: string): Promise<Wallet | null>;
|
|
626
|
+
/**
|
|
627
|
+
* Search wallets
|
|
80
628
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
|
|
85
|
-
|
|
629
|
+
* @param query Search keyword
|
|
630
|
+
* @param options Additional options
|
|
631
|
+
* @returns Matching wallet list
|
|
632
|
+
*/
|
|
633
|
+
declare function searchWallets(query: string, options?: Omit<WalletListOptions, "search">): Promise<Wallet[]>;
|
|
634
|
+
/**
|
|
635
|
+
* Get wallets that support a specific chain
|
|
86
636
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
*
|
|
94
|
-
* ```
|
|
637
|
+
* @param chainId Chain ID (CAIP-2 format, e.g. 'eip155:1')
|
|
638
|
+
* @param options Additional options
|
|
639
|
+
* @returns Wallets that support the chain
|
|
640
|
+
*/
|
|
641
|
+
declare function getWalletsByChain(chainId: string, options?: Omit<WalletListOptions, "chains">): Promise<Wallet[]>;
|
|
642
|
+
/**
|
|
643
|
+
* Get recommended wallet list
|
|
95
644
|
*
|
|
96
|
-
* @
|
|
645
|
+
* @param walletIds List of recommended wallet IDs
|
|
646
|
+
* @param options Additional options
|
|
647
|
+
* @returns Recommended wallet list
|
|
97
648
|
*/
|
|
98
|
-
declare function
|
|
99
|
-
|
|
649
|
+
declare function getRecommendedWallets(walletIds: string[], options?: Omit<WalletListOptions, "recommendedIds">): Promise<Wallet[]>;
|
|
100
650
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* @param options
|
|
104
|
-
* @returns
|
|
105
|
-
*/
|
|
106
|
-
declare function
|
|
107
|
-
qrCode: string | null;
|
|
108
|
-
loading: boolean;
|
|
109
|
-
error: Error | null;
|
|
110
|
-
generate: (targetUri?: string) => Promise<void>;
|
|
111
|
-
};
|
|
112
|
-
|
|
651
|
+
* Get mobile wallet list
|
|
652
|
+
*
|
|
653
|
+
* @param options Query options
|
|
654
|
+
* @returns Mobile wallet list
|
|
655
|
+
*/
|
|
656
|
+
declare function getMobileWallets(options?: WalletListOptions): Promise<Wallet[]>;
|
|
113
657
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
disconnect: (sessionTopic?: string) => Promise<void>;
|
|
121
|
-
refresh: () => void;
|
|
122
|
-
isExpired: boolean;
|
|
123
|
-
getAccounts: (session?: SessionInfo) => string[];
|
|
124
|
-
getChains: (session?: SessionInfo) => string[];
|
|
125
|
-
hasSession: boolean;
|
|
126
|
-
};
|
|
127
|
-
|
|
658
|
+
* Get desktop wallet list
|
|
659
|
+
*
|
|
660
|
+
* @param options Query options
|
|
661
|
+
* @returns Desktop wallet list
|
|
662
|
+
*/
|
|
663
|
+
declare function getDesktopWallets(options?: WalletListOptions): Promise<Wallet[]>;
|
|
128
664
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
onConnect?: (uri: string) => void;
|
|
136
|
-
onError?: (error: Error) => void;
|
|
137
|
-
}): {
|
|
138
|
-
connect: () => Promise<string>;
|
|
139
|
-
uri: string | null;
|
|
140
|
-
qrCode: string | null;
|
|
141
|
-
connecting: boolean;
|
|
142
|
-
error: Error | null;
|
|
143
|
-
reset: () => void;
|
|
144
|
-
};
|
|
145
|
-
|
|
665
|
+
* Get browser extension wallet list
|
|
666
|
+
*
|
|
667
|
+
* @param options Query options
|
|
668
|
+
* @returns Browser extension wallet list
|
|
669
|
+
*/
|
|
670
|
+
declare function getBrowserWallets(options?: WalletListOptions): Promise<Wallet[]>;
|
|
146
671
|
/**
|
|
147
|
-
*
|
|
672
|
+
* Popular wallet ID list
|
|
148
673
|
*/
|
|
149
|
-
declare
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
message?: string;
|
|
163
|
-
signature?: string;
|
|
164
|
-
error?: string;
|
|
165
|
-
} | null;
|
|
166
|
-
isAuthenticated: boolean;
|
|
674
|
+
declare const POPULAR_WALLET_IDS: {
|
|
675
|
+
readonly METAMASK: "c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96";
|
|
676
|
+
readonly TRUST: "4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0";
|
|
677
|
+
readonly RAINBOW: "1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369";
|
|
678
|
+
readonly COINBASE: "fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa";
|
|
679
|
+
readonly SAFE: "225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f";
|
|
680
|
+
readonly ARGENT: "bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6";
|
|
681
|
+
readonly ZERION: "ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18";
|
|
682
|
+
readonly IMTOKEN: "ef333840daf915aafdc4a004525502d6d49d77bd9c65e0642dbaefb3c2893bef";
|
|
683
|
+
readonly OKX: "971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709";
|
|
684
|
+
readonly PHANTOM: "a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393";
|
|
685
|
+
readonly TOKENPOCKET: "20459438007b75f4f4acb98bf29aa3b800550309646d375da5fd4aac6c2a2c66";
|
|
686
|
+
readonly BITGET: "7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26";
|
|
167
687
|
};
|
|
168
688
|
|
|
169
|
-
export { QRCodeOptions, SessionInfo, SiweConfig, WalletConnectClient, WalletConnectConfig,
|
|
689
|
+
export { APTOS_CHAINS, APTOS_NAMESPACE, AuthMethod, type AuthOptions, COSMOS_NAMESPACE, ChainType, type ConnectParams, EIP155_NAMESPACE, EVM_CHAINS, type EventHandler, NEAR_NAMESPACE, type NamespaceConfig, POLKADOT_NAMESPACE, POPULAR_WALLET_IDS, type QRCodeOptions, SOLANA_CHAINS, SOLANA_NAMESPACE, type SessionInfo, SiweAuth, type SiweConfig, type SiweResult, type Wallet, type WalletApp, WalletConnectClient, type WalletConnectConfig, type WalletConnectEvent, type WalletImage, type WalletListOptions, type WalletListResponse, type WalletMetadata, type WalletPlatform, copyToClipboard, createMultiChainNamespaces, createSiweConfigFromSession, createSiweMessage, extractAddressFromAccount, extractChainIdFromAccount, formatAddress, formatError, formatTimestamp, generateDeepLink, getAllWallets, getBrowserWallets, getDesktopWallets, getMobileWallets, getRecommendedWallets, getSessionTimeRemaining, getWalletById, getWalletConnectWallets, getWalletsByChain, isMobile, isSessionExpired, isValidChainId, isValidWalletConnectUri, parseChainId, parseSiweMessage, parseWalletConnectUri, searchWallets, verifySiweSignature };
|