@solana/connector 0.1.8 → 0.1.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.
Files changed (58) hide show
  1. package/README.md +97 -0
  2. package/dist/chunk-4JT24DIX.js +466 -0
  3. package/dist/chunk-4JT24DIX.js.map +1 -0
  4. package/dist/chunk-4KD6HQQG.js +69 -0
  5. package/dist/chunk-4KD6HQQG.js.map +1 -0
  6. package/dist/{chunk-DSUCH44G.js → chunk-64LV76OK.js} +2 -67
  7. package/dist/chunk-64LV76OK.js.map +1 -0
  8. package/dist/{chunk-FTXIXM43.js → chunk-6AJJJG5B.js} +614 -138
  9. package/dist/chunk-6AJJJG5B.js.map +1 -0
  10. package/dist/chunk-7XHVZW2L.mjs +460 -0
  11. package/dist/chunk-7XHVZW2L.mjs.map +1 -0
  12. package/dist/{chunk-K3BNIGPX.js → chunk-ATYK5OKR.js} +81 -33
  13. package/dist/chunk-ATYK5OKR.js.map +1 -0
  14. package/dist/{chunk-J7DHGLW6.mjs → chunk-DKCZA2QI.mjs} +3 -61
  15. package/dist/chunk-DKCZA2QI.mjs.map +1 -0
  16. package/dist/chunk-FVA4TUI4.mjs +178 -0
  17. package/dist/chunk-FVA4TUI4.mjs.map +1 -0
  18. package/dist/chunk-HO6QNKFM.mjs +61 -0
  19. package/dist/chunk-HO6QNKFM.mjs.map +1 -0
  20. package/dist/chunk-MN7XNCYI.js +230 -0
  21. package/dist/chunk-MN7XNCYI.js.map +1 -0
  22. package/dist/{chunk-6F6M6L7R.mjs → chunk-QOIQBWMP.mjs} +524 -56
  23. package/dist/chunk-QOIQBWMP.mjs.map +1 -0
  24. package/dist/{chunk-TTOKQAPX.mjs → chunk-WGZYKDXF.mjs} +57 -11
  25. package/dist/chunk-WGZYKDXF.mjs.map +1 -0
  26. package/dist/compat.js +10 -9
  27. package/dist/compat.js.map +1 -1
  28. package/dist/compat.mjs +2 -1
  29. package/dist/compat.mjs.map +1 -1
  30. package/dist/headless.d.mts +217 -100
  31. package/dist/headless.d.ts +217 -100
  32. package/dist/headless.js +190 -168
  33. package/dist/headless.mjs +5 -3
  34. package/dist/index.d.mts +3 -3
  35. package/dist/index.d.ts +3 -3
  36. package/dist/index.js +233 -203
  37. package/dist/index.mjs +6 -4
  38. package/dist/react.d.mts +72 -4
  39. package/dist/react.d.ts +72 -4
  40. package/dist/react.js +52 -36
  41. package/dist/react.mjs +2 -2
  42. package/dist/{standard-shim-CT49DM5l.d.mts → standard-shim-BTUm7cur.d.mts} +280 -1
  43. package/dist/{standard-shim-D9guL5fz.d.ts → standard-shim-LsQ97i9T.d.ts} +280 -1
  44. package/dist/walletconnect-D4JN6H2O.js +28 -0
  45. package/dist/walletconnect-D4JN6H2O.js.map +1 -0
  46. package/dist/walletconnect-I3PZUBTA.mjs +3 -0
  47. package/dist/walletconnect-I3PZUBTA.mjs.map +1 -0
  48. package/package.json +6 -2
  49. package/dist/chunk-6F6M6L7R.mjs.map +0 -1
  50. package/dist/chunk-AOIXHVRH.js +0 -535
  51. package/dist/chunk-AOIXHVRH.js.map +0 -1
  52. package/dist/chunk-DSUCH44G.js.map +0 -1
  53. package/dist/chunk-FTXIXM43.js.map +0 -1
  54. package/dist/chunk-G575OAT4.mjs +0 -476
  55. package/dist/chunk-G575OAT4.mjs.map +0 -1
  56. package/dist/chunk-J7DHGLW6.mjs.map +0 -1
  57. package/dist/chunk-K3BNIGPX.js.map +0 -1
  58. package/dist/chunk-TTOKQAPX.mjs.map +0 -1
@@ -117,6 +117,213 @@ interface AccountInfo {
117
117
  raw: WalletAccount;
118
118
  }
119
119
 
120
+ /**
121
+ * WalletConnect configuration types
122
+ *
123
+ * Types for configuring WalletConnect integration with the connector.
124
+ * WalletConnect uses Solana JSON-RPC methods as documented at:
125
+ * https://docs.walletconnect.network/wallet-sdk/chain-support/solana
126
+ */
127
+ /**
128
+ * WalletConnect app metadata
129
+ * Required for session establishment with mobile/desktop wallets
130
+ */
131
+ interface WalletConnectMetadata {
132
+ /** Application name displayed to the user in the wallet */
133
+ name: string;
134
+ /** Brief description of the application */
135
+ description: string;
136
+ /** Application URL (used for verification) */
137
+ url: string;
138
+ /** Array of icon URLs for the application */
139
+ icons: string[];
140
+ }
141
+ /**
142
+ * Configuration for WalletConnect integration
143
+ *
144
+ * When enabled, ConnectorKit registers a virtual "WalletConnect" wallet
145
+ * into the Wallet Standard registry. This wallet proxies all signing
146
+ * operations through WalletConnect's Solana JSON-RPC methods.
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * const config = getDefaultConfig({
151
+ * appName: 'My App',
152
+ * walletConnect: {
153
+ * enabled: true,
154
+ * projectId: process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID!,
155
+ * metadata: {
156
+ * name: 'My App',
157
+ * description: 'My Solana Application',
158
+ * url: 'https://myapp.com',
159
+ * icons: ['https://myapp.com/icon.png'],
160
+ * },
161
+ * onDisplayUri: (uri) => {
162
+ * // Show QR code or deep link with this URI
163
+ * console.log('WalletConnect URI:', uri);
164
+ * },
165
+ * },
166
+ * });
167
+ * ```
168
+ */
169
+ interface WalletConnectConfig {
170
+ /**
171
+ * Enable WalletConnect integration.
172
+ * When true, a "WalletConnect" wallet is registered in the Wallet Standard registry.
173
+ * @default false
174
+ */
175
+ enabled?: boolean;
176
+ /**
177
+ * WalletConnect Cloud project ID.
178
+ * Get one at https://cloud.walletconnect.com/
179
+ */
180
+ projectId: string;
181
+ /**
182
+ * Application metadata shown to users during connection.
183
+ */
184
+ metadata: WalletConnectMetadata;
185
+ /**
186
+ * Default Solana chain/cluster for WalletConnect sessions.
187
+ * Used as fallback if getCurrentChain is not provided.
188
+ * Uses ConnectorKit's cluster ID format.
189
+ * @default 'solana:mainnet'
190
+ */
191
+ defaultChain?: 'solana:mainnet' | 'solana:devnet' | 'solana:testnet';
192
+ /**
193
+ * Callback to get the current chain/cluster dynamically.
194
+ * When provided, this is called before each request to determine the chain.
195
+ * This allows WalletConnect to follow the app's cluster selection.
196
+ *
197
+ * @returns The current chain ID (e.g., 'solana:mainnet', 'solana:devnet')
198
+ */
199
+ getCurrentChain?: () => 'solana:mainnet' | 'solana:devnet' | 'solana:testnet';
200
+ /**
201
+ * Callback invoked when WalletConnect needs to display a connection URI.
202
+ * The app should render this as a QR code or use it for deep linking.
203
+ *
204
+ * If not provided, the URI will be logged to console in development.
205
+ *
206
+ * @param uri - The WalletConnect pairing URI (starts with "wc:")
207
+ */
208
+ onDisplayUri?: (uri: string) => void;
209
+ /**
210
+ * Callback invoked when a WalletConnect session is established.
211
+ */
212
+ onSessionEstablished?: () => void;
213
+ /**
214
+ * Callback invoked when a WalletConnect session is disconnected.
215
+ */
216
+ onSessionDisconnected?: () => void;
217
+ /**
218
+ * Optional relay URL override.
219
+ * @default 'wss://relay.walletconnect.org'
220
+ */
221
+ relayUrl?: string;
222
+ }
223
+ /**
224
+ * Internal transport interface for WalletConnect provider
225
+ * Used by the shim wallet to communicate with WalletConnect
226
+ */
227
+ interface WalletConnectTransport {
228
+ /** Establish connection and create/restore session */
229
+ connect(): Promise<void>;
230
+ /** Disconnect the current session */
231
+ disconnect(): Promise<void>;
232
+ /** Send a JSON-RPC request to the connected wallet */
233
+ request<T = unknown>(args: {
234
+ method: string;
235
+ params: unknown;
236
+ chainId?: string;
237
+ }): Promise<T>;
238
+ /** Check if there's an active session */
239
+ isConnected(): boolean;
240
+ /** Get accounts from the current session namespaces (if available) */
241
+ getSessionAccounts(): string[];
242
+ }
243
+ /**
244
+ * WalletConnect Solana account response
245
+ * Response format from solana_getAccounts and solana_requestAccounts
246
+ */
247
+ interface WalletConnectSolanaAccount {
248
+ /** Base58-encoded public key */
249
+ pubkey: string;
250
+ }
251
+ /**
252
+ * WalletConnect sign message params
253
+ * Parameters for solana_signMessage
254
+ */
255
+ interface WalletConnectSignMessageParams {
256
+ /** Base58-encoded message bytes */
257
+ message: string;
258
+ /** Base58-encoded public key of the signer */
259
+ pubkey: string;
260
+ }
261
+ /**
262
+ * WalletConnect sign message result
263
+ * Response from solana_signMessage
264
+ */
265
+ interface WalletConnectSignMessageResult {
266
+ /** Base58-encoded signature */
267
+ signature: string;
268
+ }
269
+ /**
270
+ * WalletConnect sign transaction params
271
+ * Parameters for solana_signTransaction
272
+ */
273
+ interface WalletConnectSignTransactionParams {
274
+ /** Base64-encoded serialized transaction */
275
+ transaction: string;
276
+ }
277
+ /**
278
+ * WalletConnect sign transaction result
279
+ * Response from solana_signTransaction
280
+ */
281
+ interface WalletConnectSignTransactionResult {
282
+ /** Base58-encoded signature */
283
+ signature: string;
284
+ /** Optional: Base64-encoded signed transaction (if wallet returns full tx) */
285
+ transaction?: string;
286
+ }
287
+ /**
288
+ * WalletConnect sign all transactions params
289
+ * Parameters for solana_signAllTransactions
290
+ */
291
+ interface WalletConnectSignAllTransactionsParams {
292
+ /** Array of Base64-encoded serialized transactions */
293
+ transactions: string[];
294
+ }
295
+ /**
296
+ * WalletConnect sign all transactions result
297
+ * Response from solana_signAllTransactions
298
+ */
299
+ interface WalletConnectSignAllTransactionsResult {
300
+ /** Array of Base64-encoded signed transactions */
301
+ transactions: string[];
302
+ }
303
+ /**
304
+ * WalletConnect sign and send transaction params
305
+ * Parameters for solana_signAndSendTransaction
306
+ */
307
+ interface WalletConnectSignAndSendTransactionParams {
308
+ /** Base64-encoded serialized transaction */
309
+ transaction: string;
310
+ /** Optional send options */
311
+ sendOptions?: {
312
+ skipPreflight?: boolean;
313
+ preflightCommitment?: 'processed' | 'confirmed' | 'finalized' | 'recent' | 'single' | 'singleGossip' | 'root' | 'max';
314
+ maxRetries?: number;
315
+ minContextSlot?: number;
316
+ };
317
+ }
318
+ /**
319
+ * WalletConnect sign and send transaction result
320
+ * Response from solana_signAndSendTransaction
321
+ */
322
+ interface WalletConnectSignAndSendTransactionResult {
323
+ /** Base58-encoded transaction signature (transaction ID) */
324
+ signature: string;
325
+ }
326
+
120
327
  /**
121
328
  * CoinGecko API configuration for price fetching.
122
329
  *
@@ -212,6 +419,12 @@ interface ConnectorConfig {
212
419
  * Configure API key for higher rate limits and retry behavior for 429 responses.
213
420
  */
214
421
  coingecko?: CoinGeckoConfig;
422
+ /**
423
+ * WalletConnect configuration for connecting via QR code / deep link.
424
+ * When enabled, a "WalletConnect" wallet is registered in the Wallet Standard registry.
425
+ * @see https://docs.walletconnect.network/wallet-sdk/chain-support/solana
426
+ */
427
+ walletConnect?: WalletConnectConfig;
215
428
  }
216
429
  /**
217
430
  * Health check information for connector diagnostics
@@ -363,8 +576,14 @@ declare class ConnectorClient {
363
576
  private healthMonitor;
364
577
  private initialized;
365
578
  private config;
579
+ private walletConnectRegistration;
366
580
  constructor(config?: ConnectorConfig);
367
581
  private initialize;
582
+ /**
583
+ * Initialize WalletConnect integration
584
+ * Dynamically imports and registers the WalletConnect wallet
585
+ */
586
+ private initializeWalletConnect;
368
587
  select(walletName: string): Promise<void>;
369
588
  disconnect(): Promise<void>;
370
589
  selectAccount(address: string): Promise<void>;
@@ -441,6 +660,62 @@ interface DefaultConfigOptions {
441
660
  * @see https://docs.coingecko.com/reference/introduction for rate limit details
442
661
  */
443
662
  coingecko?: CoinGeckoConfig;
663
+ /**
664
+ * WalletConnect configuration for connecting via QR code / deep link.
665
+ * When enabled, a "WalletConnect" wallet appears in the wallet list.
666
+ *
667
+ * Can be:
668
+ * - `true` to enable with auto-detected project ID from NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID env var
669
+ * - An object with optional overrides (projectId, metadata, etc.)
670
+ * - `undefined` or `false` to disable
671
+ *
672
+ * When using `true` or minimal config, the following are auto-configured:
673
+ * - `projectId`: Read from NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID
674
+ * - `metadata.name`: Uses appName
675
+ * - `metadata.url`: Uses appUrl or window.location.origin
676
+ * - `metadata.description`: Auto-generated from appName
677
+ * - `metadata.icons`: Uses appUrl/icon.svg
678
+ * - `getCurrentChain`: Auto-reads from cluster storage
679
+ * - `onDisplayUri/onSessionEstablished/onSessionDisconnected`: Auto-wired by AppProvider
680
+ *
681
+ * @example
682
+ * ```ts
683
+ * // Simplest - just enable it (reads project ID from env)
684
+ * getDefaultConfig({ appName: 'My App', walletConnect: true })
685
+ *
686
+ * // With explicit project ID
687
+ * getDefaultConfig({
688
+ * appName: 'My App',
689
+ * walletConnect: { projectId: 'my-project-id' }
690
+ * })
691
+ * ```
692
+ *
693
+ * @see https://docs.walletconnect.network/wallet-sdk/chain-support/solana
694
+ */
695
+ walletConnect?: boolean | SimplifiedWalletConnectConfig;
696
+ }
697
+ /**
698
+ * Simplified WalletConnect configuration
699
+ * Most fields are auto-generated from appName/appUrl if not provided
700
+ */
701
+ interface SimplifiedWalletConnectConfig {
702
+ /**
703
+ * WalletConnect Cloud project ID.
704
+ * If not provided, reads from NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID env var.
705
+ */
706
+ projectId?: string;
707
+ /**
708
+ * Optional metadata overrides. Merged with auto-generated metadata.
709
+ */
710
+ metadata?: Partial<WalletConnectConfig['metadata']>;
711
+ /**
712
+ * Default chain. Defaults to 'solana:mainnet'.
713
+ */
714
+ defaultChain?: WalletConnectConfig['defaultChain'];
715
+ /**
716
+ * Optional relay URL override.
717
+ */
718
+ relayUrl?: string;
444
719
  }
445
720
  /** Extended ConnectorConfig with app metadata */
446
721
  interface ExtendedConnectorConfig extends ConnectorConfig {
@@ -521,6 +796,10 @@ type ConnectorSnapshot = ReturnType<ConnectorClient['getSnapshot']> & {
521
796
  select: (walletName: string) => Promise<void>;
522
797
  disconnect: () => Promise<void>;
523
798
  selectAccount: (address: string) => Promise<void>;
799
+ /** WalletConnect URI for QR code display (null when not connecting via WalletConnect) */
800
+ walletConnectUri: string | null;
801
+ /** Clear the WalletConnect URI (call when modal closes or connection completes) */
802
+ clearWalletConnectUri: () => void;
524
803
  };
525
804
  interface MobileWalletAdapterConfig {
526
805
  appIdentity: {
@@ -953,4 +1232,4 @@ declare const ready: Promise<void>;
953
1232
  */
954
1233
  declare function getWalletsRegistry(): WalletsRegistry;
955
1234
 
956
- export { getClusterExplorerUrl as $, type AccountInfo as A, type CoinGeckoConfig as B, ConnectorProvider as C, type DefaultConfigOptions as D, type ExtendedConnectorConfig as E, type ConnectorHealth as F, type ConnectorDebugMetrics as G, type ConnectorDebugState as H, type ConnectorEvent as I, type ConnectorEventListener as J, type StorageAdapter as K, type Listener as L, type MobileWalletAdapterConfig as M, type StorageOptions as N, type EnhancedStorageAccountOptions as O, type EnhancedStorageClusterOptions as P, type EnhancedStorageWalletOptions as Q, ClipboardErrorType as R, type SolanaClusterMoniker as S, type ClipboardResult as T, type CopyOptions as U, isClipboardAvailable as V, type WalletInfo as W, copyToClipboard as X, copyAddressToClipboard as Y, copySignatureToClipboard as Z, getClusterRpcUrl as _, useConnectorClient as a, getTransactionUrl as a0, getAddressUrl as a1, getTokenUrl as a2, getBlockUrl as a3, isMainnetCluster as a4, isDevnetCluster as a5, isTestnetCluster as a6, isLocalCluster as a7, getClusterName as a8, getClusterType as a9, getClusterChainId as aa, getChainIdForWalletStandard as ab, ConnectorErrorBoundary as b, type ConnectorSnapshot as c, type ConnectorConfig as d, type ConnectorState as e, type WalletStandardWallet as f, type WalletStandardAccount as g, type ClusterType as h, ConnectorClient as i, getDefaultConfig as j, getDefaultMobileConfig as k, getWalletsRegistry as l, WalletErrorType as m, type WalletError as n, getPublicSolanaRpcUrl as o, createSolanaClient as p, type ModifiedClusterUrl as q, ready as r, type SolanaClient as s, type CreateSolanaClientArgs as t, useConnector as u, type WalletName as v, withErrorBoundary as w, type AccountAddress as x, isWalletName as y, isAccountAddress as z };
1235
+ export { type WalletConnectSignTransactionResult as $, type AccountInfo as A, type WalletName as B, ConnectorProvider as C, type DefaultConfigOptions as D, type ExtendedConnectorConfig as E, type AccountAddress as F, isWalletName as G, isAccountAddress as H, type CoinGeckoConfig as I, type ConnectorHealth as J, type ConnectorDebugMetrics as K, type ConnectorDebugState as L, type MobileWalletAdapterConfig as M, type Listener as N, type ConnectorEvent as O, type ConnectorEventListener as P, type StorageAdapter as Q, type StorageOptions as R, type SimplifiedWalletConnectConfig as S, type EnhancedStorageAccountOptions as T, type EnhancedStorageClusterOptions as U, type EnhancedStorageWalletOptions as V, type WalletInfo as W, type WalletConnectSolanaAccount as X, type WalletConnectSignMessageParams as Y, type WalletConnectSignMessageResult as Z, type WalletConnectSignTransactionParams as _, useConnectorClient as a, type WalletConnectSignAllTransactionsParams as a0, type WalletConnectSignAllTransactionsResult as a1, type WalletConnectSignAndSendTransactionParams as a2, type WalletConnectSignAndSendTransactionResult as a3, ClipboardErrorType as a4, type ClipboardResult as a5, type CopyOptions as a6, isClipboardAvailable as a7, copyToClipboard as a8, copyAddressToClipboard as a9, copySignatureToClipboard as aa, getClusterRpcUrl as ab, getClusterExplorerUrl as ac, getTransactionUrl as ad, getAddressUrl as ae, getTokenUrl as af, getBlockUrl as ag, isMainnetCluster as ah, isDevnetCluster as ai, isTestnetCluster as aj, isLocalCluster as ak, getClusterName as al, getClusterType as am, getClusterChainId as an, getChainIdForWalletStandard as ao, getDefaultMobileConfig as b, ConnectorErrorBoundary as c, type ConnectorSnapshot as d, type ConnectorConfig as e, type ConnectorState as f, getDefaultConfig as g, type WalletStandardWallet as h, type WalletStandardAccount as i, type ClusterType as j, ConnectorClient as k, getWalletsRegistry as l, WalletErrorType as m, type WalletError as n, getPublicSolanaRpcUrl as o, createSolanaClient as p, type SolanaClusterMoniker as q, ready as r, type ModifiedClusterUrl as s, type SolanaClient as t, useConnector as u, type CreateSolanaClientArgs as v, withErrorBoundary as w, type WalletConnectConfig as x, type WalletConnectMetadata as y, type WalletConnectTransport as z };
@@ -117,6 +117,213 @@ interface AccountInfo {
117
117
  raw: WalletAccount;
118
118
  }
119
119
 
120
+ /**
121
+ * WalletConnect configuration types
122
+ *
123
+ * Types for configuring WalletConnect integration with the connector.
124
+ * WalletConnect uses Solana JSON-RPC methods as documented at:
125
+ * https://docs.walletconnect.network/wallet-sdk/chain-support/solana
126
+ */
127
+ /**
128
+ * WalletConnect app metadata
129
+ * Required for session establishment with mobile/desktop wallets
130
+ */
131
+ interface WalletConnectMetadata {
132
+ /** Application name displayed to the user in the wallet */
133
+ name: string;
134
+ /** Brief description of the application */
135
+ description: string;
136
+ /** Application URL (used for verification) */
137
+ url: string;
138
+ /** Array of icon URLs for the application */
139
+ icons: string[];
140
+ }
141
+ /**
142
+ * Configuration for WalletConnect integration
143
+ *
144
+ * When enabled, ConnectorKit registers a virtual "WalletConnect" wallet
145
+ * into the Wallet Standard registry. This wallet proxies all signing
146
+ * operations through WalletConnect's Solana JSON-RPC methods.
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * const config = getDefaultConfig({
151
+ * appName: 'My App',
152
+ * walletConnect: {
153
+ * enabled: true,
154
+ * projectId: process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID!,
155
+ * metadata: {
156
+ * name: 'My App',
157
+ * description: 'My Solana Application',
158
+ * url: 'https://myapp.com',
159
+ * icons: ['https://myapp.com/icon.png'],
160
+ * },
161
+ * onDisplayUri: (uri) => {
162
+ * // Show QR code or deep link with this URI
163
+ * console.log('WalletConnect URI:', uri);
164
+ * },
165
+ * },
166
+ * });
167
+ * ```
168
+ */
169
+ interface WalletConnectConfig {
170
+ /**
171
+ * Enable WalletConnect integration.
172
+ * When true, a "WalletConnect" wallet is registered in the Wallet Standard registry.
173
+ * @default false
174
+ */
175
+ enabled?: boolean;
176
+ /**
177
+ * WalletConnect Cloud project ID.
178
+ * Get one at https://cloud.walletconnect.com/
179
+ */
180
+ projectId: string;
181
+ /**
182
+ * Application metadata shown to users during connection.
183
+ */
184
+ metadata: WalletConnectMetadata;
185
+ /**
186
+ * Default Solana chain/cluster for WalletConnect sessions.
187
+ * Used as fallback if getCurrentChain is not provided.
188
+ * Uses ConnectorKit's cluster ID format.
189
+ * @default 'solana:mainnet'
190
+ */
191
+ defaultChain?: 'solana:mainnet' | 'solana:devnet' | 'solana:testnet';
192
+ /**
193
+ * Callback to get the current chain/cluster dynamically.
194
+ * When provided, this is called before each request to determine the chain.
195
+ * This allows WalletConnect to follow the app's cluster selection.
196
+ *
197
+ * @returns The current chain ID (e.g., 'solana:mainnet', 'solana:devnet')
198
+ */
199
+ getCurrentChain?: () => 'solana:mainnet' | 'solana:devnet' | 'solana:testnet';
200
+ /**
201
+ * Callback invoked when WalletConnect needs to display a connection URI.
202
+ * The app should render this as a QR code or use it for deep linking.
203
+ *
204
+ * If not provided, the URI will be logged to console in development.
205
+ *
206
+ * @param uri - The WalletConnect pairing URI (starts with "wc:")
207
+ */
208
+ onDisplayUri?: (uri: string) => void;
209
+ /**
210
+ * Callback invoked when a WalletConnect session is established.
211
+ */
212
+ onSessionEstablished?: () => void;
213
+ /**
214
+ * Callback invoked when a WalletConnect session is disconnected.
215
+ */
216
+ onSessionDisconnected?: () => void;
217
+ /**
218
+ * Optional relay URL override.
219
+ * @default 'wss://relay.walletconnect.org'
220
+ */
221
+ relayUrl?: string;
222
+ }
223
+ /**
224
+ * Internal transport interface for WalletConnect provider
225
+ * Used by the shim wallet to communicate with WalletConnect
226
+ */
227
+ interface WalletConnectTransport {
228
+ /** Establish connection and create/restore session */
229
+ connect(): Promise<void>;
230
+ /** Disconnect the current session */
231
+ disconnect(): Promise<void>;
232
+ /** Send a JSON-RPC request to the connected wallet */
233
+ request<T = unknown>(args: {
234
+ method: string;
235
+ params: unknown;
236
+ chainId?: string;
237
+ }): Promise<T>;
238
+ /** Check if there's an active session */
239
+ isConnected(): boolean;
240
+ /** Get accounts from the current session namespaces (if available) */
241
+ getSessionAccounts(): string[];
242
+ }
243
+ /**
244
+ * WalletConnect Solana account response
245
+ * Response format from solana_getAccounts and solana_requestAccounts
246
+ */
247
+ interface WalletConnectSolanaAccount {
248
+ /** Base58-encoded public key */
249
+ pubkey: string;
250
+ }
251
+ /**
252
+ * WalletConnect sign message params
253
+ * Parameters for solana_signMessage
254
+ */
255
+ interface WalletConnectSignMessageParams {
256
+ /** Base58-encoded message bytes */
257
+ message: string;
258
+ /** Base58-encoded public key of the signer */
259
+ pubkey: string;
260
+ }
261
+ /**
262
+ * WalletConnect sign message result
263
+ * Response from solana_signMessage
264
+ */
265
+ interface WalletConnectSignMessageResult {
266
+ /** Base58-encoded signature */
267
+ signature: string;
268
+ }
269
+ /**
270
+ * WalletConnect sign transaction params
271
+ * Parameters for solana_signTransaction
272
+ */
273
+ interface WalletConnectSignTransactionParams {
274
+ /** Base64-encoded serialized transaction */
275
+ transaction: string;
276
+ }
277
+ /**
278
+ * WalletConnect sign transaction result
279
+ * Response from solana_signTransaction
280
+ */
281
+ interface WalletConnectSignTransactionResult {
282
+ /** Base58-encoded signature */
283
+ signature: string;
284
+ /** Optional: Base64-encoded signed transaction (if wallet returns full tx) */
285
+ transaction?: string;
286
+ }
287
+ /**
288
+ * WalletConnect sign all transactions params
289
+ * Parameters for solana_signAllTransactions
290
+ */
291
+ interface WalletConnectSignAllTransactionsParams {
292
+ /** Array of Base64-encoded serialized transactions */
293
+ transactions: string[];
294
+ }
295
+ /**
296
+ * WalletConnect sign all transactions result
297
+ * Response from solana_signAllTransactions
298
+ */
299
+ interface WalletConnectSignAllTransactionsResult {
300
+ /** Array of Base64-encoded signed transactions */
301
+ transactions: string[];
302
+ }
303
+ /**
304
+ * WalletConnect sign and send transaction params
305
+ * Parameters for solana_signAndSendTransaction
306
+ */
307
+ interface WalletConnectSignAndSendTransactionParams {
308
+ /** Base64-encoded serialized transaction */
309
+ transaction: string;
310
+ /** Optional send options */
311
+ sendOptions?: {
312
+ skipPreflight?: boolean;
313
+ preflightCommitment?: 'processed' | 'confirmed' | 'finalized' | 'recent' | 'single' | 'singleGossip' | 'root' | 'max';
314
+ maxRetries?: number;
315
+ minContextSlot?: number;
316
+ };
317
+ }
318
+ /**
319
+ * WalletConnect sign and send transaction result
320
+ * Response from solana_signAndSendTransaction
321
+ */
322
+ interface WalletConnectSignAndSendTransactionResult {
323
+ /** Base58-encoded transaction signature (transaction ID) */
324
+ signature: string;
325
+ }
326
+
120
327
  /**
121
328
  * CoinGecko API configuration for price fetching.
122
329
  *
@@ -212,6 +419,12 @@ interface ConnectorConfig {
212
419
  * Configure API key for higher rate limits and retry behavior for 429 responses.
213
420
  */
214
421
  coingecko?: CoinGeckoConfig;
422
+ /**
423
+ * WalletConnect configuration for connecting via QR code / deep link.
424
+ * When enabled, a "WalletConnect" wallet is registered in the Wallet Standard registry.
425
+ * @see https://docs.walletconnect.network/wallet-sdk/chain-support/solana
426
+ */
427
+ walletConnect?: WalletConnectConfig;
215
428
  }
216
429
  /**
217
430
  * Health check information for connector diagnostics
@@ -363,8 +576,14 @@ declare class ConnectorClient {
363
576
  private healthMonitor;
364
577
  private initialized;
365
578
  private config;
579
+ private walletConnectRegistration;
366
580
  constructor(config?: ConnectorConfig);
367
581
  private initialize;
582
+ /**
583
+ * Initialize WalletConnect integration
584
+ * Dynamically imports and registers the WalletConnect wallet
585
+ */
586
+ private initializeWalletConnect;
368
587
  select(walletName: string): Promise<void>;
369
588
  disconnect(): Promise<void>;
370
589
  selectAccount(address: string): Promise<void>;
@@ -441,6 +660,62 @@ interface DefaultConfigOptions {
441
660
  * @see https://docs.coingecko.com/reference/introduction for rate limit details
442
661
  */
443
662
  coingecko?: CoinGeckoConfig;
663
+ /**
664
+ * WalletConnect configuration for connecting via QR code / deep link.
665
+ * When enabled, a "WalletConnect" wallet appears in the wallet list.
666
+ *
667
+ * Can be:
668
+ * - `true` to enable with auto-detected project ID from NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID env var
669
+ * - An object with optional overrides (projectId, metadata, etc.)
670
+ * - `undefined` or `false` to disable
671
+ *
672
+ * When using `true` or minimal config, the following are auto-configured:
673
+ * - `projectId`: Read from NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID
674
+ * - `metadata.name`: Uses appName
675
+ * - `metadata.url`: Uses appUrl or window.location.origin
676
+ * - `metadata.description`: Auto-generated from appName
677
+ * - `metadata.icons`: Uses appUrl/icon.svg
678
+ * - `getCurrentChain`: Auto-reads from cluster storage
679
+ * - `onDisplayUri/onSessionEstablished/onSessionDisconnected`: Auto-wired by AppProvider
680
+ *
681
+ * @example
682
+ * ```ts
683
+ * // Simplest - just enable it (reads project ID from env)
684
+ * getDefaultConfig({ appName: 'My App', walletConnect: true })
685
+ *
686
+ * // With explicit project ID
687
+ * getDefaultConfig({
688
+ * appName: 'My App',
689
+ * walletConnect: { projectId: 'my-project-id' }
690
+ * })
691
+ * ```
692
+ *
693
+ * @see https://docs.walletconnect.network/wallet-sdk/chain-support/solana
694
+ */
695
+ walletConnect?: boolean | SimplifiedWalletConnectConfig;
696
+ }
697
+ /**
698
+ * Simplified WalletConnect configuration
699
+ * Most fields are auto-generated from appName/appUrl if not provided
700
+ */
701
+ interface SimplifiedWalletConnectConfig {
702
+ /**
703
+ * WalletConnect Cloud project ID.
704
+ * If not provided, reads from NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID env var.
705
+ */
706
+ projectId?: string;
707
+ /**
708
+ * Optional metadata overrides. Merged with auto-generated metadata.
709
+ */
710
+ metadata?: Partial<WalletConnectConfig['metadata']>;
711
+ /**
712
+ * Default chain. Defaults to 'solana:mainnet'.
713
+ */
714
+ defaultChain?: WalletConnectConfig['defaultChain'];
715
+ /**
716
+ * Optional relay URL override.
717
+ */
718
+ relayUrl?: string;
444
719
  }
445
720
  /** Extended ConnectorConfig with app metadata */
446
721
  interface ExtendedConnectorConfig extends ConnectorConfig {
@@ -521,6 +796,10 @@ type ConnectorSnapshot = ReturnType<ConnectorClient['getSnapshot']> & {
521
796
  select: (walletName: string) => Promise<void>;
522
797
  disconnect: () => Promise<void>;
523
798
  selectAccount: (address: string) => Promise<void>;
799
+ /** WalletConnect URI for QR code display (null when not connecting via WalletConnect) */
800
+ walletConnectUri: string | null;
801
+ /** Clear the WalletConnect URI (call when modal closes or connection completes) */
802
+ clearWalletConnectUri: () => void;
524
803
  };
525
804
  interface MobileWalletAdapterConfig {
526
805
  appIdentity: {
@@ -953,4 +1232,4 @@ declare const ready: Promise<void>;
953
1232
  */
954
1233
  declare function getWalletsRegistry(): WalletsRegistry;
955
1234
 
956
- export { getClusterExplorerUrl as $, type AccountInfo as A, type CoinGeckoConfig as B, ConnectorProvider as C, type DefaultConfigOptions as D, type ExtendedConnectorConfig as E, type ConnectorHealth as F, type ConnectorDebugMetrics as G, type ConnectorDebugState as H, type ConnectorEvent as I, type ConnectorEventListener as J, type StorageAdapter as K, type Listener as L, type MobileWalletAdapterConfig as M, type StorageOptions as N, type EnhancedStorageAccountOptions as O, type EnhancedStorageClusterOptions as P, type EnhancedStorageWalletOptions as Q, ClipboardErrorType as R, type SolanaClusterMoniker as S, type ClipboardResult as T, type CopyOptions as U, isClipboardAvailable as V, type WalletInfo as W, copyToClipboard as X, copyAddressToClipboard as Y, copySignatureToClipboard as Z, getClusterRpcUrl as _, useConnectorClient as a, getTransactionUrl as a0, getAddressUrl as a1, getTokenUrl as a2, getBlockUrl as a3, isMainnetCluster as a4, isDevnetCluster as a5, isTestnetCluster as a6, isLocalCluster as a7, getClusterName as a8, getClusterType as a9, getClusterChainId as aa, getChainIdForWalletStandard as ab, ConnectorErrorBoundary as b, type ConnectorSnapshot as c, type ConnectorConfig as d, type ConnectorState as e, type WalletStandardWallet as f, type WalletStandardAccount as g, type ClusterType as h, ConnectorClient as i, getDefaultConfig as j, getDefaultMobileConfig as k, getWalletsRegistry as l, WalletErrorType as m, type WalletError as n, getPublicSolanaRpcUrl as o, createSolanaClient as p, type ModifiedClusterUrl as q, ready as r, type SolanaClient as s, type CreateSolanaClientArgs as t, useConnector as u, type WalletName as v, withErrorBoundary as w, type AccountAddress as x, isWalletName as y, isAccountAddress as z };
1235
+ export { type WalletConnectSignTransactionResult as $, type AccountInfo as A, type WalletName as B, ConnectorProvider as C, type DefaultConfigOptions as D, type ExtendedConnectorConfig as E, type AccountAddress as F, isWalletName as G, isAccountAddress as H, type CoinGeckoConfig as I, type ConnectorHealth as J, type ConnectorDebugMetrics as K, type ConnectorDebugState as L, type MobileWalletAdapterConfig as M, type Listener as N, type ConnectorEvent as O, type ConnectorEventListener as P, type StorageAdapter as Q, type StorageOptions as R, type SimplifiedWalletConnectConfig as S, type EnhancedStorageAccountOptions as T, type EnhancedStorageClusterOptions as U, type EnhancedStorageWalletOptions as V, type WalletInfo as W, type WalletConnectSolanaAccount as X, type WalletConnectSignMessageParams as Y, type WalletConnectSignMessageResult as Z, type WalletConnectSignTransactionParams as _, useConnectorClient as a, type WalletConnectSignAllTransactionsParams as a0, type WalletConnectSignAllTransactionsResult as a1, type WalletConnectSignAndSendTransactionParams as a2, type WalletConnectSignAndSendTransactionResult as a3, ClipboardErrorType as a4, type ClipboardResult as a5, type CopyOptions as a6, isClipboardAvailable as a7, copyToClipboard as a8, copyAddressToClipboard as a9, copySignatureToClipboard as aa, getClusterRpcUrl as ab, getClusterExplorerUrl as ac, getTransactionUrl as ad, getAddressUrl as ae, getTokenUrl as af, getBlockUrl as ag, isMainnetCluster as ah, isDevnetCluster as ai, isTestnetCluster as aj, isLocalCluster as ak, getClusterName as al, getClusterType as am, getClusterChainId as an, getChainIdForWalletStandard as ao, getDefaultMobileConfig as b, ConnectorErrorBoundary as c, type ConnectorSnapshot as d, type ConnectorConfig as e, type ConnectorState as f, getDefaultConfig as g, type WalletStandardWallet as h, type WalletStandardAccount as i, type ClusterType as j, ConnectorClient as k, getWalletsRegistry as l, WalletErrorType as m, type WalletError as n, getPublicSolanaRpcUrl as o, createSolanaClient as p, type SolanaClusterMoniker as q, ready as r, type ModifiedClusterUrl as s, type SolanaClient as t, useConnector as u, type CreateSolanaClientArgs as v, withErrorBoundary as w, type WalletConnectConfig as x, type WalletConnectMetadata as y, type WalletConnectTransport as z };
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var chunk4JT24DIX_js = require('./chunk-4JT24DIX.js');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "createMockWalletConnectTransport", {
8
+ enumerable: true,
9
+ get: function () { return chunk4JT24DIX_js.createMockWalletConnectTransport; }
10
+ });
11
+ Object.defineProperty(exports, "createWalletConnectTransport", {
12
+ enumerable: true,
13
+ get: function () { return chunk4JT24DIX_js.createWalletConnectTransport; }
14
+ });
15
+ Object.defineProperty(exports, "createWalletConnectWallet", {
16
+ enumerable: true,
17
+ get: function () { return chunk4JT24DIX_js.createWalletConnectWallet; }
18
+ });
19
+ Object.defineProperty(exports, "isWalletConnectAvailable", {
20
+ enumerable: true,
21
+ get: function () { return chunk4JT24DIX_js.isWalletConnectAvailable; }
22
+ });
23
+ Object.defineProperty(exports, "registerWalletConnectWallet", {
24
+ enumerable: true,
25
+ get: function () { return chunk4JT24DIX_js.registerWalletConnectWallet; }
26
+ });
27
+ //# sourceMappingURL=walletconnect-D4JN6H2O.js.map
28
+ //# sourceMappingURL=walletconnect-D4JN6H2O.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"walletconnect-D4JN6H2O.js"}
@@ -0,0 +1,3 @@
1
+ export { createMockWalletConnectTransport, createWalletConnectTransport, createWalletConnectWallet, isWalletConnectAvailable, registerWalletConnectWallet } from './chunk-7XHVZW2L.mjs';
2
+ //# sourceMappingURL=walletconnect-I3PZUBTA.mjs.map
3
+ //# sourceMappingURL=walletconnect-I3PZUBTA.mjs.map