@solana/connector 0.1.10 → 0.2.0

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 (55) hide show
  1. package/README.md +344 -88
  2. package/dist/{chunk-MN7XNCYI.js → chunk-BJAVJQLK.js} +6 -6
  3. package/dist/{chunk-MN7XNCYI.js.map → chunk-BJAVJQLK.js.map} +1 -1
  4. package/dist/{chunk-6AJJJG5B.js → chunk-BZ2VBJCZ.js} +618 -415
  5. package/dist/chunk-BZ2VBJCZ.js.map +1 -0
  6. package/dist/{chunk-ATYK5OKR.js → chunk-EM4KNOKG.js} +614 -194
  7. package/dist/chunk-EM4KNOKG.js.map +1 -0
  8. package/dist/{chunk-4JT24DIX.js → chunk-HN5AJF7F.js} +61 -20
  9. package/dist/chunk-HN5AJF7F.js.map +1 -0
  10. package/dist/{chunk-FVA4TUI4.mjs → chunk-HPQ5T32K.mjs} +4 -4
  11. package/dist/{chunk-FVA4TUI4.mjs.map → chunk-HPQ5T32K.mjs.map} +1 -1
  12. package/dist/{chunk-QOIQBWMP.mjs → chunk-IDTUFDNB.mjs} +531 -339
  13. package/dist/chunk-IDTUFDNB.mjs.map +1 -0
  14. package/dist/{chunk-WGZYKDXF.mjs → chunk-RTXUS5KG.mjs} +529 -115
  15. package/dist/chunk-RTXUS5KG.mjs.map +1 -0
  16. package/dist/{chunk-64LV76OK.js → chunk-SITQ4JWM.js} +23 -2
  17. package/dist/chunk-SITQ4JWM.js.map +1 -0
  18. package/dist/{chunk-7XHVZW2L.mjs → chunk-UCISIAOG.mjs} +60 -19
  19. package/dist/chunk-UCISIAOG.mjs.map +1 -0
  20. package/dist/{chunk-DKCZA2QI.mjs → chunk-ZZTY3O4N.mjs} +21 -3
  21. package/dist/chunk-ZZTY3O4N.mjs.map +1 -0
  22. package/dist/compat.d.mts +1 -1
  23. package/dist/compat.d.ts +1 -1
  24. package/dist/compat.js +2 -2
  25. package/dist/compat.mjs +1 -1
  26. package/dist/headless.d.mts +25 -7
  27. package/dist/headless.d.ts +25 -7
  28. package/dist/headless.js +196 -132
  29. package/dist/headless.mjs +4 -4
  30. package/dist/index.d.mts +4 -4
  31. package/dist/index.d.ts +4 -4
  32. package/dist/index.js +255 -175
  33. package/dist/index.mjs +5 -5
  34. package/dist/react.d.mts +230 -8
  35. package/dist/react.d.ts +230 -8
  36. package/dist/react.js +78 -42
  37. package/dist/react.mjs +2 -2
  38. package/dist/{standard-shim-BTUm7cur.d.mts → standard-shim-CGB88PPO.d.mts} +396 -54
  39. package/dist/{standard-shim-LsQ97i9T.d.ts → standard-shim-tmnQelaJ.d.ts} +396 -54
  40. package/dist/{transaction-signer-T-KVQFi8.d.ts → transaction-signer-7NaYmP5w.d.mts} +1 -0
  41. package/dist/{transaction-signer-T-KVQFi8.d.mts → transaction-signer-7NaYmP5w.d.ts} +1 -0
  42. package/dist/{walletconnect-D4JN6H2O.js → walletconnect-447EY3OJ.js} +8 -8
  43. package/dist/{walletconnect-D4JN6H2O.js.map → walletconnect-447EY3OJ.js.map} +1 -1
  44. package/dist/walletconnect-U455PO4I.mjs +3 -0
  45. package/dist/{walletconnect-I3PZUBTA.mjs.map → walletconnect-U455PO4I.mjs.map} +1 -1
  46. package/package.json +1 -1
  47. package/dist/chunk-4JT24DIX.js.map +0 -1
  48. package/dist/chunk-64LV76OK.js.map +0 -1
  49. package/dist/chunk-6AJJJG5B.js.map +0 -1
  50. package/dist/chunk-7XHVZW2L.mjs.map +0 -1
  51. package/dist/chunk-ATYK5OKR.js.map +0 -1
  52. package/dist/chunk-DKCZA2QI.mjs.map +0 -1
  53. package/dist/chunk-QOIQBWMP.mjs.map +0 -1
  54. package/dist/chunk-WGZYKDXF.mjs.map +0 -1
  55. package/dist/walletconnect-I3PZUBTA.mjs +0 -3
package/README.md CHANGED
@@ -54,13 +54,11 @@ export function Providers({ children }: { children: React.ReactNode }) {
54
54
  {
55
55
  id: 'solana:mainnet' as const,
56
56
  label: 'Mainnet (Custom RPC)',
57
- name: 'mainnet-beta' as const,
58
57
  url: customRpcUrl,
59
58
  },
60
59
  {
61
60
  id: 'solana:devnet' as const,
62
61
  label: 'Devnet',
63
- name: 'devnet' as const,
64
62
  url: 'https://api.devnet.solana.com',
65
63
  },
66
64
  ]
@@ -97,22 +95,38 @@ export function Providers({ children }: { children: React.ReactNode }) {
97
95
  ```typescript
98
96
  'use client';
99
97
 
100
- import { useConnector, useAccount } from '@solana/connector';
98
+ import { useConnector } from '@solana/connector/react';
101
99
 
102
100
  export function ConnectButton() {
103
- const { wallets, select, disconnect, connected, connecting, selectedWallet, selectedAccount } = useConnector();
104
- const { address, formatted, copy } = useAccount();
101
+ const {
102
+ connectors,
103
+ connectWallet,
104
+ disconnectWallet,
105
+ isConnected,
106
+ isConnecting,
107
+ isError,
108
+ walletError,
109
+ account,
110
+ } = useConnector();
105
111
 
106
- if (connecting) {
107
- return <button disabled>Connecting...</button>;
112
+ if (isError) {
113
+ return (
114
+ <div>
115
+ <p>Error: {walletError?.message ?? 'Unknown error'}</p>
116
+ </div>
117
+ );
108
118
  }
109
119
 
110
- if (!connected) {
120
+ if (!isConnected) {
111
121
  return (
112
122
  <div>
113
- {wallets.map(w => (
114
- <button key={w.wallet.name} onClick={() => select(w.wallet.name)}>
115
- Connect {w.wallet.name}
123
+ {connectors.map(connector => (
124
+ <button
125
+ key={connector.id}
126
+ onClick={() => connectWallet(connector.id)}
127
+ disabled={isConnecting || !connector.ready}
128
+ >
129
+ {isConnecting ? 'Connecting...' : `Connect ${connector.name}`}
116
130
  </button>
117
131
  ))}
118
132
  </div>
@@ -121,8 +135,10 @@ export function ConnectButton() {
121
135
 
122
136
  return (
123
137
  <div>
124
- <button onClick={copy}>{formatted}</button>
125
- <button onClick={disconnect}>Disconnect</button>
138
+ <span>{account}</span>
139
+ <button onClick={disconnectWallet}>
140
+ Disconnect
141
+ </button>
126
142
  </div>
127
143
  );
128
144
  }
@@ -141,21 +157,37 @@ These are the main hooks you'll use in your components.
141
157
  Main hook for wallet connection and state.
142
158
 
143
159
  ```typescript
144
- import { useConnector } from '@solana/connector';
160
+ import { useConnector } from '@solana/connector/react';
145
161
 
146
162
  function Component() {
147
163
  const {
148
- // State
149
- wallets, // WalletInfo[] - All available wallets
150
- selectedWallet, // Wallet | null - Currently connected wallet
151
- selectedAccount, // string | null - Currently selected account address
152
- accounts, // AccountInfo[] - Connected accounts
153
- connected, // boolean - Connection status
154
- connecting, // boolean - Connecting in progress
155
-
156
- // Actions
157
- select, // (walletName: string) => Promise<void>
158
- disconnect, // () => Promise<void>
164
+ // vNext state (recommended)
165
+ connectors, // WalletConnectorMetadata[] - available wallet connectors
166
+ walletStatus, // WalletStatus - discriminated union state machine
167
+ connectorId, // WalletConnectorId | null - connected connector id
168
+ connector, // WalletConnectorMetadata | null - connected connector metadata
169
+ account, // Address | null - selected account address
170
+ sessionAccounts, // SessionAccount[] - all accounts in session
171
+ isConnected, // boolean - shorthand
172
+ isConnecting, // boolean - shorthand
173
+ isError, // boolean - shorthand
174
+ walletError, // Error | null - set when status is 'error'
175
+
176
+ // vNext actions (recommended)
177
+ connectWallet, // (connectorId, options?) => Promise<void>
178
+ disconnectWallet, // () => Promise<void>
179
+
180
+ // Legacy fields (deprecated; kept for backwards compatibility)
181
+ wallets,
182
+ selectedWallet,
183
+ selectedAccount,
184
+ accounts,
185
+ connected,
186
+ connecting,
187
+
188
+ // Legacy actions (deprecated; kept for backwards compatibility)
189
+ select,
190
+ disconnect,
159
191
  } = useConnector();
160
192
  }
161
193
  ```
@@ -165,32 +197,37 @@ function Component() {
165
197
  ```typescript
166
198
  'use client';
167
199
 
168
- import { useConnector } from '@solana/connector';
169
- import { useState } from 'react';
200
+ import { useConnector } from '@solana/connector/react';
170
201
 
171
202
  export function ConnectButton() {
172
- const [isModalOpen, setIsModalOpen] = useState(false);
173
- const { connected, connecting, selectedWallet, selectedAccount, wallets, select } = useConnector();
203
+ const { connectors, connectWallet, disconnectWallet, isConnected, isConnecting, account } = useConnector();
174
204
 
175
- if (connecting) {
205
+ if (isConnecting) {
176
206
  return <button disabled>Connecting...</button>;
177
207
  }
178
208
 
179
- if (connected && selectedAccount && selectedWallet) {
180
- const shortAddress = `${selectedAccount.slice(0, 4)}...${selectedAccount.slice(-4)}`;
209
+ if (isConnected && account) {
210
+ const shortAddress = `${account.slice(0, 4)}...${account.slice(-4)}`;
181
211
  return (
182
212
  <div>
183
213
  <span>{shortAddress}</span>
184
- <button onClick={() => select(selectedWallet.name)}>Switch Wallet</button>
214
+ <button onClick={disconnectWallet}>Disconnect</button>
185
215
  </div>
186
216
  );
187
217
  }
188
218
 
189
219
  return (
190
- <>
191
- <button onClick={() => setIsModalOpen(true)}>Connect Wallet</button>
192
- {/* Wallet selection modal */}
193
- </>
220
+ <div>
221
+ {connectors.map(connector => (
222
+ <button
223
+ key={connector.id}
224
+ onClick={() => connectWallet(connector.id)}
225
+ disabled={isConnecting || !connector.ready}
226
+ >
227
+ Connect {connector.name}
228
+ </button>
229
+ ))}
230
+ </div>
194
231
  );
195
232
  }
196
233
  ```
@@ -308,6 +345,214 @@ function Component() {
308
345
 
309
346
  ---
310
347
 
348
+ ## vNext API (Recommended)
349
+
350
+ The vNext API provides a cleaner, more type-safe approach to wallet connections using stable connector IDs and a wallet status state machine.
351
+
352
+ You can access the same vNext state + actions either through the focused hooks below, or via `useConnector()` (single hook) which also includes legacy compatibility fields.
353
+
354
+ ### `useWallet()`
355
+
356
+ Primary hook for wallet status in vNext. Uses a discriminated union for type-safe status checks.
357
+
358
+ ```typescript
359
+ import { useWallet } from '@solana/connector/react';
360
+
361
+ function Component() {
362
+ const {
363
+ status, // 'disconnected' | 'connecting' | 'connected' | 'error'
364
+ isConnected, // boolean shorthand
365
+ isConnecting,// boolean shorthand
366
+ account, // Address | null - Selected account address
367
+ accounts, // SessionAccount[] - All available accounts
368
+ connectorId, // WalletConnectorId | null - Connected wallet ID
369
+ error, // Error | null - Error if status is 'error'
370
+ } = useWallet();
371
+
372
+ if (status === 'connected') {
373
+ // TypeScript knows account is non-null here
374
+ return <p>Connected: {account}</p>;
375
+ }
376
+ }
377
+ ```
378
+
379
+ ### `useWalletConnectors()`
380
+
381
+ Get available wallet connectors with stable IDs.
382
+
383
+ ```typescript
384
+ import { useWalletConnectors } from '@solana/connector/react';
385
+
386
+ function WalletList() {
387
+ const connectors = useWalletConnectors();
388
+
389
+ return (
390
+ <ul>
391
+ {connectors.map(connector => (
392
+ <li key={connector.id}>
393
+ <img src={connector.icon} alt={connector.name} />
394
+ {connector.name}
395
+ {connector.ready ? '✓' : 'Not Ready'}
396
+ </li>
397
+ ))}
398
+ </ul>
399
+ );
400
+ }
401
+ ```
402
+
403
+ ### `useConnectWallet()`
404
+
405
+ Connect to a wallet using its stable connector ID.
406
+
407
+ ```typescript
408
+ import { useConnectWallet, useWalletConnectors } from '@solana/connector/react';
409
+
410
+ function ConnectButton() {
411
+ const { connect, isConnecting, error, resetError } = useConnectWallet();
412
+ const connectors = useWalletConnectors();
413
+
414
+ return (
415
+ <div>
416
+ {connectors.map(connector => (
417
+ <button
418
+ key={connector.id}
419
+ onClick={() => connect(connector.id)}
420
+ disabled={isConnecting || !connector.ready}
421
+ >
422
+ Connect {connector.name}
423
+ </button>
424
+ ))}
425
+ {error && (
426
+ <p>
427
+ Error: {error.message}
428
+ <button onClick={resetError}>Dismiss</button>
429
+ </p>
430
+ )}
431
+ </div>
432
+ );
433
+ }
434
+ ```
435
+
436
+ ### `useDisconnectWallet()`
437
+
438
+ Disconnect the current wallet session.
439
+
440
+ ```typescript
441
+ import { useDisconnectWallet, useWallet } from '@solana/connector/react';
442
+
443
+ function DisconnectButton() {
444
+ const { isConnected } = useWallet();
445
+ const { disconnect, isDisconnecting } = useDisconnectWallet();
446
+
447
+ if (!isConnected) return null;
448
+
449
+ return (
450
+ <button onClick={disconnect} disabled={isDisconnecting}>
451
+ {isDisconnecting ? 'Disconnecting...' : 'Disconnect'}
452
+ </button>
453
+ );
454
+ }
455
+ ```
456
+
457
+ ### Silent-First Auto-Connect
458
+
459
+ The vNext API supports silent-first auto-connect, which attempts to reconnect without prompting the user:
460
+
461
+ ```typescript
462
+ const { connect } = useConnectWallet();
463
+
464
+ // Silent connect (won't prompt user)
465
+ await connect('wallet-standard:phantom', {
466
+ silent: true,
467
+ allowInteractiveFallback: false,
468
+ });
469
+
470
+ // Silent-first with interactive fallback (prompts if silent fails)
471
+ await connect('wallet-standard:phantom', {
472
+ silent: true,
473
+ allowInteractiveFallback: true,
474
+ });
475
+ ```
476
+
477
+ ---
478
+
479
+ ## Migration Guide (Legacy → vNext)
480
+
481
+ ### Connect by Wallet Name → Connect by Connector ID
482
+
483
+ **Before (Legacy):**
484
+
485
+ ```typescript
486
+ const { select, wallets } = useConnector();
487
+ await select('Phantom');
488
+ ```
489
+
490
+ **After (vNext):**
491
+
492
+ ```typescript
493
+ const { connect } = useConnectWallet();
494
+ await connect('wallet-standard:phantom');
495
+ // Or use connectors from useWalletConnectors()
496
+ ```
497
+
498
+ ### Check Connection Status
499
+
500
+ **Before (Legacy):**
501
+
502
+ ```typescript
503
+ const { connected, connecting } = useConnector();
504
+ if (connected) {
505
+ /* ... */
506
+ }
507
+ ```
508
+
509
+ **After (vNext):**
510
+
511
+ ```typescript
512
+ const { status, isConnected, isConnecting } = useWallet();
513
+ if (status === 'connected') {
514
+ /* ... */
515
+ }
516
+ // Or use the boolean shorthand:
517
+ if (isConnected) {
518
+ /* ... */
519
+ }
520
+ ```
521
+
522
+ ### Get Selected Account
523
+
524
+ **Before (Legacy):**
525
+
526
+ ```typescript
527
+ const { selectedAccount } = useConnector();
528
+ ```
529
+
530
+ **After (vNext):**
531
+
532
+ ```typescript
533
+ const { account } = useWallet();
534
+ // Or for full account info:
535
+ const { accounts, account } = useWallet();
536
+ ```
537
+
538
+ ### Disconnect
539
+
540
+ **Before (Legacy):**
541
+
542
+ ```typescript
543
+ const { disconnect } = useConnector();
544
+ await disconnect();
545
+ ```
546
+
547
+ **After (vNext):**
548
+
549
+ ```typescript
550
+ const { disconnect } = useDisconnectWallet();
551
+ await disconnect();
552
+ ```
553
+
554
+ ---
555
+
311
556
  ## Transaction Signing
312
557
 
313
558
  ConnectorKit provides powerful transaction signing capabilities with support for both legacy `@solana/web3.js` and modern `@solana/kit` APIs.
@@ -578,13 +823,11 @@ const config = getDefaultConfig({
578
823
  {
579
824
  id: 'solana:mainnet' as const,
580
825
  label: 'Mainnet (Custom RPC)',
581
- name: 'mainnet-beta' as const,
582
826
  url: 'https://my-custom-rpc.com',
583
827
  },
584
828
  {
585
829
  id: 'solana:devnet' as const,
586
830
  label: 'Devnet',
587
- name: 'devnet' as const,
588
831
  url: 'https://api.devnet.solana.com',
589
832
  },
590
833
  ],
@@ -620,69 +863,62 @@ npm install @walletconnect/universal-provider
620
863
 
621
864
  Visit [cloud.walletconnect.com](https://cloud.walletconnect.com/) and create a project to get your `projectId`.
622
865
 
623
- **3. Configure WalletConnect in your app:**
866
+ **3. Enable WalletConnect in your config:**
624
867
 
625
868
  ```typescript
869
+ 'use client';
870
+
626
871
  import { getDefaultConfig } from '@solana/connector/headless';
627
- import { useState } from 'react';
872
+ import { useMemo } from 'react';
873
+ import { AppProvider } from '@solana/connector/react';
628
874
 
629
875
  export function Providers({ children }: { children: React.ReactNode }) {
630
- const [walletConnectUri, setWalletConnectUri] = useState<string | null>(null);
631
-
632
876
  const connectorConfig = useMemo(() => {
633
877
  return getDefaultConfig({
634
878
  appName: 'My App',
635
879
  appUrl: 'https://myapp.com',
636
- walletConnect: {
637
- enabled: true,
638
- projectId: process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID!,
639
- metadata: {
640
- name: 'My App',
641
- description: 'My Solana Application',
642
- url: 'https://myapp.com',
643
- icons: ['https://myapp.com/icon.png'],
644
- },
645
- // Handle the WalletConnect URI for QR code display
646
- onDisplayUri: (uri) => {
647
- setWalletConnectUri(uri);
648
- },
649
- onSessionEstablished: () => {
650
- setWalletConnectUri(null);
651
- },
652
- },
880
+ // Reads NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID from env
881
+ walletConnect: true,
653
882
  });
654
883
  }, []);
655
884
 
656
885
  return (
657
886
  <AppProvider connectorConfig={connectorConfig}>
658
887
  {children}
659
- {/* Render QR code modal when URI is available */}
660
- {walletConnectUri && (
661
- <WalletConnectQRModal
662
- uri={walletConnectUri}
663
- onClose={() => setWalletConnectUri(null)}
664
- />
665
- )}
888
+ <WalletConnectQRModal />
666
889
  </AppProvider>
667
890
  );
668
891
  }
669
892
  ```
670
893
 
671
- **4. Create a QR code modal:**
894
+ **4. Render a QR code when a pairing URI is available:**
672
895
 
673
896
  ```typescript
674
- import QRCode from 'qrcode.react'; // npm install qrcode.react
897
+ 'use client';
898
+
899
+ import { useConnector } from '@solana/connector/react';
900
+ import { QRCodeSVG } from 'qrcode.react'; // npm install qrcode.react
901
+
902
+ export function WalletConnectQRModal() {
903
+ const { walletConnectUri, clearWalletConnectUri } = useConnector();
904
+
905
+ if (!walletConnectUri) return null;
675
906
 
676
- function WalletConnectQRModal({ uri, onClose }: { uri: string; onClose: () => void }) {
677
907
  return (
678
- <div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50">
679
- <div className="bg-white rounded-xl p-6 max-w-sm">
680
- <h2 className="text-lg font-semibold mb-4">Scan with your wallet</h2>
681
- <QRCode value={uri} size={256} />
682
- <p className="text-sm text-gray-500 mt-4 text-center">
908
+ <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50">
909
+ <div className="w-full max-w-sm rounded-xl bg-white p-6">
910
+ <h2 className="text-lg font-semibold">Scan with your wallet</h2>
911
+ <div className="mt-4 flex justify-center">
912
+ <QRCodeSVG value={walletConnectUri} size={256} />
913
+ </div>
914
+ <p className="mt-4 text-center text-sm text-gray-500">
683
915
  Open your WalletConnect-compatible wallet and scan this QR code
684
916
  </p>
685
- <button onClick={onClose} className="mt-4 w-full py-2 bg-gray-100 rounded">
917
+ <button
918
+ type="button"
919
+ onClick={clearWalletConnectUri}
920
+ className="mt-4 w-full rounded bg-gray-100 py-2"
921
+ >
686
922
  Cancel
687
923
  </button>
688
924
  </div>
@@ -691,9 +927,10 @@ function WalletConnectQRModal({ uri, onClose }: { uri: string; onClose: () => vo
691
927
  }
692
928
  ```
693
929
 
694
- Once enabled, "WalletConnect" appears as a wallet option in your wallet list. When selected, the `onDisplayUri` callback fires with a URI that should be displayed as a QR code for mobile wallet scanning.
930
+ Once enabled, "WalletConnect" appears as a connector (id: `walletconnect`) in your wallet list. When selected, `useConnector().walletConnectUri` will be set to a `wc:` URI that you can display as a QR code or use for deep linking.
695
931
 
696
932
  **Supported WalletConnect Solana methods:**
933
+
697
934
  - `solana_getAccounts` / `solana_requestAccounts` - Get connected accounts
698
935
  - `solana_signMessage` - Sign arbitrary messages
699
936
  - `solana_signTransaction` - Sign transactions
@@ -758,7 +995,6 @@ const config = getDefaultConfig({
758
995
  {
759
996
  id: 'solana:mainnet' as const,
760
997
  label: 'Mainnet',
761
- name: 'mainnet-beta' as const,
762
998
  url: `${getOrigin()}/api/rpc`, // Proxy URL
763
999
  },
764
1000
  // ... other clusters
@@ -1091,27 +1327,28 @@ if (!result.success) {
1091
1327
  Use `ConnectorClient` for non-React frameworks:
1092
1328
 
1093
1329
  ```typescript
1094
- import { ConnectorClient, getDefaultConfig } from '@solana/connector/headless';
1330
+ import { ConnectorClient, getDefaultConfig, createConnectorId } from '@solana/connector/headless';
1095
1331
 
1096
1332
  // Create client
1097
1333
  const client = new ConnectorClient(getDefaultConfig({ appName: 'My App' }));
1098
1334
 
1099
1335
  // Get state
1100
1336
  const state = client.getSnapshot();
1101
- console.log('Wallets:', state.wallets);
1337
+ console.log('Connectors:', state.connectors);
1102
1338
 
1103
- // Connect
1104
- await client.select('Phantom');
1339
+ // Connect (vNext)
1340
+ await client.connectWallet(createConnectorId('Phantom'));
1105
1341
 
1106
1342
  // Subscribe to changes
1107
1343
  const unsubscribe = client.subscribe(state => {
1108
1344
  console.log('State updated:', state);
1109
1345
  });
1110
1346
 
1111
- // Disconnect
1112
- await client.disconnect();
1347
+ // Disconnect (vNext)
1348
+ await client.disconnectWallet();
1113
1349
 
1114
1350
  // Cleanup
1351
+ unsubscribe();
1115
1352
  client.destroy();
1116
1353
  ```
1117
1354
 
@@ -1159,7 +1396,7 @@ const config = getDefaultConfig({
1159
1396
 
1160
1397
  ```typescript
1161
1398
  // Full library - includes React and headless
1162
- import { ConnectorProvider, useConnector, useAccount } from '@solana/connector';
1399
+ import { AppProvider, useConnector, getDefaultConfig } from '@solana/connector';
1163
1400
  ```
1164
1401
 
1165
1402
  ### Headless Export (Framework Agnostic)
@@ -1173,7 +1410,7 @@ import { ConnectorClient, getDefaultConfig } from '@solana/connector/headless';
1173
1410
 
1174
1411
  ```typescript
1175
1412
  // React-specific exports only
1176
- import { useConnector, useAccount } from '@solana/connector/react';
1413
+ import { AppProvider, useConnector, useWallet, useConnectWallet } from '@solana/connector/react';
1177
1414
  ```
1178
1415
 
1179
1416
  ---
@@ -1182,9 +1419,20 @@ import { useConnector, useAccount } from '@solana/connector/react';
1182
1419
 
1183
1420
  ### Hooks
1184
1421
 
1422
+ #### vNext Hooks (Recommended)
1423
+
1424
+ | Hook | Description | Returns |
1425
+ | ----------------------- | --------------------------- | ----------------------------------------------------------------- |
1426
+ | `useWallet()` | Wallet status state machine | `{ status, isConnected, isConnecting, account, accounts, error }` |
1427
+ | `useWalletConnectors()` | Available wallet connectors | `WalletConnectorMetadata[]` |
1428
+ | `useConnectWallet()` | Connect by connector ID | `{ connect, isConnecting, error, resetError }` |
1429
+ | `useDisconnectWallet()` | Disconnect current wallet | `{ disconnect, isDisconnecting }` |
1430
+
1431
+ #### Legacy Hooks
1432
+
1185
1433
  | Hook | Description | Returns |
1186
1434
  | --------------------------- | --------------------------------------- | ---------------------------------------------------------------------------------- |
1187
- | `useConnector()` | Main wallet connection hook | `{ wallets, selectedWallet, accounts, connected, connecting, select, disconnect }` |
1435
+ | `useConnector()` | Main wallet connection hook (vNext + legacy) | `ConnectorSnapshot` |
1188
1436
  | `useAccount()` | Account management hook | `{ address, formatted, copy, copied, accounts, selectAccount }` |
1189
1437
  | `useCluster()` | Network/cluster management hook | `{ cluster, clusters, setCluster, isMainnet, isDevnet, rpcUrl }` |
1190
1438
  | `useWalletInfo()` | Wallet metadata hook | `{ name, icon, wallet, connecting }` |
@@ -1220,7 +1468,7 @@ import type {
1220
1468
  // Configuration
1221
1469
  ConnectorConfig,
1222
1470
  DefaultConfigOptions,
1223
- UnifiedConfig,
1471
+ ExtendedConnectorConfig,
1224
1472
 
1225
1473
  // State & Info
1226
1474
  ConnectorState,
@@ -1236,6 +1484,14 @@ import type {
1236
1484
  SolanaCluster,
1237
1485
  SolanaClusterId,
1238
1486
 
1487
+ // vNext Session Types
1488
+ WalletConnectorId,
1489
+ WalletConnectorMetadata,
1490
+ WalletSession,
1491
+ WalletStatus,
1492
+ SessionAccount,
1493
+ ConnectOptions,
1494
+
1239
1495
  // Hook Returns
1240
1496
  UseClusterReturn,
1241
1497
  UseAccountReturn,
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk6AJJJG5B_js = require('./chunk-6AJJJG5B.js');
4
- var chunk64LV76OK_js = require('./chunk-64LV76OK.js');
3
+ var chunkBZ2VBJCZ_js = require('./chunk-BZ2VBJCZ.js');
4
+ var chunkSITQ4JWM_js = require('./chunk-SITQ4JWM.js');
5
5
  var core = require('@wallet-ui/core');
6
6
  var signers = require('@solana/signers');
7
7
  var addresses = require('@solana/addresses');
@@ -63,7 +63,7 @@ var SOLANA_CHAIN_IDS = {
63
63
  "solana:testnet": SOLANA_CHAIN_IDS.testnet
64
64
  };
65
65
  function getChainIdFromCluster(cluster) {
66
- let clusterType = chunk6AJJJG5B_js.getClusterType(cluster);
66
+ let clusterType = chunkBZ2VBJCZ_js.getClusterType(cluster);
67
67
  return clusterType === "localnet" || clusterType === "custom" ? null : getChainIdFromClusterType(clusterType);
68
68
  }
69
69
  function getChainIdFromClusterId(clusterId) {
@@ -140,7 +140,7 @@ function getSolanaExplorerUrl(signature, options = {}) {
140
140
  if (normalizedCluster === "localnet")
141
141
  return `https://explorer.solana.com/tx/${signature}?cluster=custom&customUrl=${encodeURIComponent(customUrl || "http://localhost:8899")}`;
142
142
  let explorerCluster = ["mainnet", "devnet", "testnet"].includes(normalizedCluster) ? normalizedCluster : "devnet";
143
- return chunk64LV76OK_js.getExplorerLink({
143
+ return chunkSITQ4JWM_js.getExplorerLink({
144
144
  transaction: signature,
145
145
  cluster: explorerCluster
146
146
  });
@@ -226,5 +226,5 @@ exports.isSolanaChain = isSolanaChain;
226
226
  exports.isWalletName = isWalletName;
227
227
  exports.sendRawTransaction = sendRawTransaction;
228
228
  exports.validateKnownSolanaChain = validateKnownSolanaChain;
229
- //# sourceMappingURL=chunk-MN7XNCYI.js.map
230
- //# sourceMappingURL=chunk-MN7XNCYI.js.map
229
+ //# sourceMappingURL=chunk-BJAVJQLK.js.map
230
+ //# sourceMappingURL=chunk-BJAVJQLK.js.map