@solana/connector 0.1.7 → 0.1.8

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 (50) hide show
  1. package/README.md +83 -5
  2. package/dist/{chunk-APQGEW7S.mjs → chunk-6F6M6L7R.mjs} +73 -165
  3. package/dist/chunk-6F6M6L7R.mjs.map +1 -0
  4. package/dist/{chunk-VZ5Y6DIM.js → chunk-AOIXHVRH.js} +80 -235
  5. package/dist/chunk-AOIXHVRH.js.map +1 -0
  6. package/dist/chunk-DSUCH44G.js +678 -0
  7. package/dist/chunk-DSUCH44G.js.map +1 -0
  8. package/dist/{chunk-VA6LKXCQ.js → chunk-FTXIXM43.js} +157 -263
  9. package/dist/chunk-FTXIXM43.js.map +1 -0
  10. package/dist/{chunk-TQRJYZNK.mjs → chunk-G575OAT4.mjs} +71 -218
  11. package/dist/chunk-G575OAT4.mjs.map +1 -0
  12. package/dist/chunk-J7DHGLW6.mjs +638 -0
  13. package/dist/chunk-J7DHGLW6.mjs.map +1 -0
  14. package/dist/{chunk-Z22V3D4E.js → chunk-K3BNIGPX.js} +95 -37
  15. package/dist/chunk-K3BNIGPX.js.map +1 -0
  16. package/dist/{chunk-JK47EFJT.mjs → chunk-TTOKQAPX.mjs} +65 -14
  17. package/dist/chunk-TTOKQAPX.mjs.map +1 -0
  18. package/dist/compat.d.mts +1 -1
  19. package/dist/compat.d.ts +1 -1
  20. package/dist/compat.js +40 -39
  21. package/dist/compat.js.map +1 -1
  22. package/dist/compat.mjs +39 -38
  23. package/dist/compat.mjs.map +1 -1
  24. package/dist/headless.d.mts +447 -151
  25. package/dist/headless.d.ts +447 -151
  26. package/dist/headless.js +214 -194
  27. package/dist/headless.mjs +3 -3
  28. package/dist/index.d.mts +7 -6
  29. package/dist/index.d.ts +7 -6
  30. package/dist/index.js +268 -224
  31. package/dist/index.mjs +4 -4
  32. package/dist/react.d.mts +108 -7
  33. package/dist/react.d.ts +108 -7
  34. package/dist/react.js +54 -30
  35. package/dist/react.mjs +2 -2
  36. package/dist/{wallet-standard-shim-DiMvGjOk.d.ts → standard-shim-CT49DM5l.d.mts} +38 -247
  37. package/dist/{wallet-standard-shim-D4CYG5sU.d.mts → standard-shim-D9guL5fz.d.ts} +38 -247
  38. package/dist/{transaction-signer-CpGEvp7S.d.mts → transaction-signer-T-KVQFi8.d.mts} +1 -1
  39. package/dist/{transaction-signer-CpGEvp7S.d.ts → transaction-signer-T-KVQFi8.d.ts} +1 -1
  40. package/package.json +3 -3
  41. package/dist/chunk-APQGEW7S.mjs.map +0 -1
  42. package/dist/chunk-I64FD2EH.js +0 -312
  43. package/dist/chunk-I64FD2EH.js.map +0 -1
  44. package/dist/chunk-JK47EFJT.mjs.map +0 -1
  45. package/dist/chunk-QL3IT3TS.mjs +0 -299
  46. package/dist/chunk-QL3IT3TS.mjs.map +0 -1
  47. package/dist/chunk-TQRJYZNK.mjs.map +0 -1
  48. package/dist/chunk-VA6LKXCQ.js.map +0 -1
  49. package/dist/chunk-VZ5Y6DIM.js.map +0 -1
  50. package/dist/chunk-Z22V3D4E.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { c as TransactionActivity, d as TransactionActivityStatus } from './transaction-signer-CpGEvp7S.js';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode, Component, ErrorInfo } from 'react';
3
+ import { w as TransactionActivity, x as TransactionActivityStatus } from './transaction-signer-T-KVQFi8.mjs';
2
4
  import { SolanaClusterId, SolanaCluster } from '@wallet-ui/core';
3
5
  import { Wallet, WalletAccount, IdentifierArray } from '@wallet-standard/base';
4
6
  import { Address } from '@solana/addresses';
5
- import React, { ReactNode, Component, ErrorInfo } from 'react';
6
- import * as react_jsx_runtime from 'react/jsx-runtime';
7
7
  import { Signature } from '@solana/keys';
8
8
  import { AuthorizationCache, ChainSelector, SolanaMobileWalletAdapterWallet } from '@solana-mobile/wallet-standard-mobile';
9
9
  import { DevnetUrl, MainnetUrl, TestnetUrl, Rpc, SolanaRpcApi, RpcSubscriptions, SolanaRpcSubscriptionsApi } from '@solana/kit';
@@ -542,249 +542,6 @@ declare function ConnectorProvider({ children, config, mobile, }: {
542
542
  declare function useConnector(): ConnectorSnapshot;
543
543
  declare function useConnectorClient(): ConnectorClient | null;
544
544
 
545
- /**
546
- * @solana/connector - Network utilities
547
- *
548
- * Utilities for translating between different Solana network naming conventions.
549
- * Ensures compatibility with WalletUI (SolanaClusterId) and Gill types.
550
- *
551
- * Primary type: SolanaNetwork - normalized network names
552
- * External integration: Use WalletUI's SolanaClusterId for cluster operations
553
- */
554
-
555
- /**
556
- * Normalized Solana network names
557
- *
558
- * This is the canonical network type used throughout the connector.
559
- * Use `toClusterId()` to convert to WalletUI's SolanaClusterId format.
560
- * Aligned with Gill's SolanaClusterMoniker type.
561
- */
562
- type SolanaNetwork = 'mainnet' | 'devnet' | 'testnet' | 'localnet';
563
- /**
564
- * Public RPC endpoints for each Solana network
565
- *
566
- * ⚠️ WARNING: These are public, rate-limited endpoints provided by Solana Labs.
567
- * For production applications, use a dedicated RPC provider like:
568
- * - Triton (https://triton.one)
569
- * - Helius (https://helius.dev)
570
- * - QuickNode (https://quicknode.com)
571
- * - Alchemy (https://alchemy.com)
572
- *
573
- * Note: These values are now sourced from Gill's getPublicSolanaRpcUrl for consistency.
574
- * Kept here for reference and backward compatibility.
575
- */
576
- declare const PUBLIC_RPC_ENDPOINTS: Record<SolanaNetwork, string>;
577
- /**
578
- * Normalize network name to standard format
579
- * Accepts various naming conventions and returns the canonical SolanaNetwork format
580
- *
581
- * @example
582
- * normalizeNetwork('mainnet-beta') // Returns: 'mainnet'
583
- * normalizeNetwork('mainnet') // Returns: 'mainnet'
584
- * normalizeNetwork('MAINNET') // Returns: 'mainnet'
585
- */
586
- declare function normalizeNetwork(network: string): SolanaNetwork;
587
- /**
588
- * Convert network name to WalletUI cluster ID format
589
- *
590
- * WalletUI uses the 'solana:network' format for cluster identification.
591
- *
592
- * @example
593
- * toClusterId('mainnet') // Returns: 'solana:mainnet'
594
- * toClusterId('mainnet-beta') // Returns: 'solana:mainnet' (normalized)
595
- */
596
- declare function toClusterId(network: string): SolanaClusterId;
597
- /**
598
- * Get the public RPC URL for a network
599
- *
600
- * ⚠️ Returns public, rate-limited endpoints. For production, use a dedicated RPC provider.
601
- *
602
- * Now uses Gill's getPublicSolanaRpcUrl for consistency with the Gill ecosystem.
603
- * Falls back to localnet URL for unknown networks.
604
- *
605
- * @example
606
- * getDefaultRpcUrl('mainnet') // Returns: 'https://api.mainnet-beta.solana.com'
607
- * getDefaultRpcUrl('devnet') // Returns: 'https://api.devnet.solana.com'
608
- */
609
- declare function getDefaultRpcUrl(network: string): string;
610
- /**
611
- * Check if a network is mainnet
612
- *
613
- * @example
614
- * isMainnet('mainnet') // Returns: true
615
- * isMainnet('mainnet-beta') // Returns: true
616
- * isMainnet('devnet') // Returns: false
617
- */
618
- declare function isMainnet(network: string): boolean;
619
- /**
620
- * Check if a network is devnet
621
- *
622
- * @example
623
- * isDevnet('devnet') // Returns: true
624
- * isDevnet('mainnet') // Returns: false
625
- */
626
- declare function isDevnet(network: string): boolean;
627
- /**
628
- * Check if a network is testnet
629
- *
630
- * @example
631
- * isTestnet('testnet') // Returns: true
632
- * isTestnet('mainnet') // Returns: false
633
- */
634
- declare function isTestnet(network: string): boolean;
635
- /**
636
- * Check if a network is localnet
637
- *
638
- * @example
639
- * isLocalnet('localnet') // Returns: true
640
- * isLocalnet('mainnet') // Returns: false
641
- */
642
- declare function isLocalnet(network: string): boolean;
643
- /**
644
- * Get a user-friendly display name for a network
645
- *
646
- * @example
647
- * getNetworkDisplayName('mainnet-beta') // Returns: 'Mainnet'
648
- * getNetworkDisplayName('devnet') // Returns: 'Devnet'
649
- */
650
- declare function getNetworkDisplayName(network: string): string;
651
-
652
- /**
653
- * @solana/connector - Unified configuration
654
- *
655
- * Simplified configuration for apps using ConnectorKit
656
- * Eliminates config duplication and provides a single source of truth
657
- */
658
-
659
- /**
660
- * Options for creating a unified configuration
661
- * Maintains type safety while providing flexibility
662
- */
663
- interface UnifiedConfigOptions extends DefaultConfigOptions {
664
- /**
665
- * Custom RPC URL (optional - overrides default for network)
666
- * Note: For production apps, use environment variables to avoid exposing API keys
667
- * @see packages/connector/src/utils/cluster.ts for secure RPC URL patterns
668
- */
669
- rpcUrl?: string;
670
- }
671
- /**
672
- * Unified configuration output
673
- * Contains all configs needed for ConnectorKit and integrations
674
- *
675
- * Important: The `rpcUrl` property is intended for:
676
- * 1. Server-side rendering (SSR) setup
677
- * 2. Passing to external libraries that need RPC configuration
678
- * 3. Development/testing environments
679
- *
680
- * For production client-side code, use the connector client's `getRpcUrl()` method
681
- * which supports environment variable patterns and proxy configurations.
682
- */
683
- interface UnifiedConfig {
684
- /** ConnectorKit configuration */
685
- connectorConfig: ExtendedConnectorConfig;
686
- /** Mobile Wallet Adapter configuration (optional) */
687
- mobile?: MobileWalletAdapterConfig;
688
- /** Normalized network name ('mainnet', 'devnet', 'testnet', 'localnet') */
689
- network: SolanaNetwork;
690
- /**
691
- * RPC endpoint URL
692
- * For external library integration only - client code should use connector client
693
- * @deprecated in client components - use `useConnectorClient().getRpcUrl()` instead
694
- */
695
- rpcUrl: string;
696
- /** Application metadata */
697
- app: {
698
- name: string;
699
- url: string;
700
- };
701
- }
702
- /**
703
- * Create a unified configuration for ConnectorKit
704
- *
705
- * This helper eliminates configuration duplication by creating all necessary
706
- * configs from a single source of truth. It automatically handles network
707
- * name translation between different conventions.
708
- *
709
- * @example Basic usage
710
- * ```tsx
711
- * import { createConfig, AppProvider } from '@solana/connector';
712
- *
713
- * const config = createConfig({
714
- * appName: 'My App',
715
- * network: 'mainnet', // Works with 'mainnet' or 'mainnet-beta'
716
- * enableMobile: true
717
- * });
718
- *
719
- * <AppProvider config={config}>
720
- * {children}
721
- * </AppProvider>
722
- * ```
723
- *
724
- * @example Integration with external libraries
725
- * ```tsx
726
- * import { createConfig, AppProvider } from '@solana/connector';
727
- * import { ArmaProvider } from '@armadura/sdk';
728
- *
729
- * const config = createConfig({
730
- * appName: 'My App',
731
- * network: 'mainnet',
732
- * });
733
- *
734
- * <AppProvider config={config}>
735
- * <ArmaProvider
736
- * config={{
737
- * network: config.network,
738
- * rpcUrl: config.rpcUrl, // Safe - for external library initialization
739
- * providers: [...]
740
- * }}
741
- * useConnector="auto"
742
- * >
743
- * {children}
744
- * </ArmaProvider>
745
- * </AppProvider>
746
- * ```
747
- *
748
- * @example Production with environment variables
749
- * ```tsx
750
- * // Use environment variables to avoid exposing API keys
751
- * const config = createConfig({
752
- * appName: 'My App',
753
- * network: 'mainnet',
754
- * // RPC URL comes from process.env on server
755
- * // Client-side code should use connector client's getRpcUrl()
756
- * });
757
- * ```
758
- *
759
- * @example Custom clusters
760
- * ```tsx
761
- * const config = createConfig({
762
- * appName: 'My App',
763
- * network: 'mainnet',
764
- * customClusters: [
765
- * {
766
- * id: 'solana:custom',
767
- * label: 'Custom RPC',
768
- * url: process.env.CUSTOM_RPC_URL || 'https://...'
769
- * }
770
- * ]
771
- * });
772
- * ```
773
- */
774
- declare function createConfig(options: UnifiedConfigOptions): UnifiedConfig;
775
- /**
776
- * Type guard to check if a config is a unified config
777
- *
778
- * @example
779
- * ```ts
780
- * if (isUnifiedConfig(someConfig)) {
781
- * // TypeScript knows this is UnifiedConfig
782
- * console.log(someConfig.network, someConfig.rpcUrl);
783
- * }
784
- * ```
785
- */
786
- declare function isUnifiedConfig(config: unknown): config is UnifiedConfig;
787
-
788
545
  declare enum WalletErrorType {
789
546
  CONNECTION_FAILED = "CONNECTION_FAILED",
790
547
  TRANSACTION_FAILED = "TRANSACTION_FAILED",
@@ -1157,9 +914,43 @@ interface WalletsRegistry {
1157
914
  }
1158
915
  type WalletStandardWallet = Wallet;
1159
916
  type WalletStandardAccount = WalletAccount;
917
+ /**
918
+ * Promise that resolves when the wallet registry is initialized and ready.
919
+ *
920
+ * Use this when you need deterministic wallet detection (e.g., auto-reconnect,
921
+ * checking if a specific wallet is installed before showing UI).
922
+ *
923
+ * Resolves immediately if the registry is already available.
924
+ * Rejects only on fatal errors (e.g., module load failure in browser environment).
925
+ *
926
+ * @example
927
+ * ```ts
928
+ * import { ready, getWalletsRegistry } from '@solana/connector';
929
+ *
930
+ * // Wait for registry to be ready before detecting wallets
931
+ * await ready;
932
+ * const wallets = getWalletsRegistry().get();
933
+ * ```
934
+ */
935
+ declare const ready: Promise<void>;
1160
936
  /**
1161
937
  * Get the wallets registry - simplified approach
938
+ *
939
+ * ⚠️ RACE CONDITION WARNING:
940
+ * The dynamic import of '@wallet-standard/app' is asynchronous. If `window.navigator.wallets`
941
+ * is not pre-populated by a wallet extension, the registry may be undefined briefly during
942
+ * initial page load. Calls to `getWalletsRegistry().get()` during this window will return
943
+ * an empty array as graceful degradation.
944
+ *
945
+ * For deterministic wallet detection (e.g., auto-reconnect, pre-checking wallet availability),
946
+ * await the exported `ready` Promise before calling `get()`:
947
+ *
948
+ * @example
949
+ * ```ts
950
+ * await ready;
951
+ * const wallets = getWalletsRegistry().get(); // Guaranteed to have registry loaded
952
+ * ```
1162
953
  */
1163
954
  declare function getWalletsRegistry(): WalletsRegistry;
1164
955
 
1165
- export { copySignatureToClipboard as $, type AccountInfo as A, type StorageOptions as B, ConnectorProvider as C, type DefaultConfigOptions as D, type ExtendedConnectorConfig as E, type EnhancedStorageAccountOptions as F, type EnhancedStorageClusterOptions as G, type EnhancedStorageWalletOptions as H, WalletErrorType as I, type WalletError as J, getPublicSolanaRpcUrl as K, type Listener as L, type MobileWalletAdapterConfig as M, createSolanaClient as N, type SolanaClusterMoniker as O, type ModifiedClusterUrl as P, type SolanaClient as Q, type CreateSolanaClientArgs as R, type StorageAdapter as S, ClipboardErrorType as T, type UnifiedConfigOptions as U, type ClipboardResult as V, type WalletInfo as W, type CopyOptions as X, isClipboardAvailable as Y, copyToClipboard as Z, copyAddressToClipboard as _, useConnectorClient as a, getClusterRpcUrl as a0, getClusterExplorerUrl as a1, getTransactionUrl as a2, getAddressUrl as a3, getTokenUrl as a4, getBlockUrl as a5, isMainnetCluster as a6, isDevnetCluster as a7, isTestnetCluster as a8, isLocalCluster as a9, getClusterName as aa, getClusterType as ab, getClusterChainId as ac, getChainIdForWalletStandard as ad, type SolanaNetwork as ae, PUBLIC_RPC_ENDPOINTS as af, normalizeNetwork as ag, toClusterId as ah, getDefaultRpcUrl as ai, isMainnet as aj, isDevnet as ak, isTestnet as al, isLocalnet as am, getNetworkDisplayName as an, ConnectorErrorBoundary as b, type ConnectorSnapshot as c, type ConnectorConfig as d, type ConnectorState as e, type WalletStandardWallet as f, type WalletStandardAccount as g, type UnifiedConfig as h, type ClusterType as i, ConnectorClient as j, getWalletsRegistry as k, getDefaultConfig as l, getDefaultMobileConfig as m, createConfig as n, isUnifiedConfig as o, type WalletName as p, type AccountAddress as q, isWalletName as r, isAccountAddress as s, type ConnectorHealth as t, useConnector as u, type ConnectorDebugMetrics as v, withErrorBoundary as w, type ConnectorDebugState as x, type ConnectorEvent as y, type ConnectorEventListener as z };
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 };
@@ -1,9 +1,9 @@
1
- import { c as TransactionActivity, d as TransactionActivityStatus } from './transaction-signer-CpGEvp7S.mjs';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode, Component, ErrorInfo } from 'react';
3
+ import { w as TransactionActivity, x as TransactionActivityStatus } from './transaction-signer-T-KVQFi8.js';
2
4
  import { SolanaClusterId, SolanaCluster } from '@wallet-ui/core';
3
5
  import { Wallet, WalletAccount, IdentifierArray } from '@wallet-standard/base';
4
6
  import { Address } from '@solana/addresses';
5
- import React, { ReactNode, Component, ErrorInfo } from 'react';
6
- import * as react_jsx_runtime from 'react/jsx-runtime';
7
7
  import { Signature } from '@solana/keys';
8
8
  import { AuthorizationCache, ChainSelector, SolanaMobileWalletAdapterWallet } from '@solana-mobile/wallet-standard-mobile';
9
9
  import { DevnetUrl, MainnetUrl, TestnetUrl, Rpc, SolanaRpcApi, RpcSubscriptions, SolanaRpcSubscriptionsApi } from '@solana/kit';
@@ -542,249 +542,6 @@ declare function ConnectorProvider({ children, config, mobile, }: {
542
542
  declare function useConnector(): ConnectorSnapshot;
543
543
  declare function useConnectorClient(): ConnectorClient | null;
544
544
 
545
- /**
546
- * @solana/connector - Network utilities
547
- *
548
- * Utilities for translating between different Solana network naming conventions.
549
- * Ensures compatibility with WalletUI (SolanaClusterId) and Gill types.
550
- *
551
- * Primary type: SolanaNetwork - normalized network names
552
- * External integration: Use WalletUI's SolanaClusterId for cluster operations
553
- */
554
-
555
- /**
556
- * Normalized Solana network names
557
- *
558
- * This is the canonical network type used throughout the connector.
559
- * Use `toClusterId()` to convert to WalletUI's SolanaClusterId format.
560
- * Aligned with Gill's SolanaClusterMoniker type.
561
- */
562
- type SolanaNetwork = 'mainnet' | 'devnet' | 'testnet' | 'localnet';
563
- /**
564
- * Public RPC endpoints for each Solana network
565
- *
566
- * ⚠️ WARNING: These are public, rate-limited endpoints provided by Solana Labs.
567
- * For production applications, use a dedicated RPC provider like:
568
- * - Triton (https://triton.one)
569
- * - Helius (https://helius.dev)
570
- * - QuickNode (https://quicknode.com)
571
- * - Alchemy (https://alchemy.com)
572
- *
573
- * Note: These values are now sourced from Gill's getPublicSolanaRpcUrl for consistency.
574
- * Kept here for reference and backward compatibility.
575
- */
576
- declare const PUBLIC_RPC_ENDPOINTS: Record<SolanaNetwork, string>;
577
- /**
578
- * Normalize network name to standard format
579
- * Accepts various naming conventions and returns the canonical SolanaNetwork format
580
- *
581
- * @example
582
- * normalizeNetwork('mainnet-beta') // Returns: 'mainnet'
583
- * normalizeNetwork('mainnet') // Returns: 'mainnet'
584
- * normalizeNetwork('MAINNET') // Returns: 'mainnet'
585
- */
586
- declare function normalizeNetwork(network: string): SolanaNetwork;
587
- /**
588
- * Convert network name to WalletUI cluster ID format
589
- *
590
- * WalletUI uses the 'solana:network' format for cluster identification.
591
- *
592
- * @example
593
- * toClusterId('mainnet') // Returns: 'solana:mainnet'
594
- * toClusterId('mainnet-beta') // Returns: 'solana:mainnet' (normalized)
595
- */
596
- declare function toClusterId(network: string): SolanaClusterId;
597
- /**
598
- * Get the public RPC URL for a network
599
- *
600
- * ⚠️ Returns public, rate-limited endpoints. For production, use a dedicated RPC provider.
601
- *
602
- * Now uses Gill's getPublicSolanaRpcUrl for consistency with the Gill ecosystem.
603
- * Falls back to localnet URL for unknown networks.
604
- *
605
- * @example
606
- * getDefaultRpcUrl('mainnet') // Returns: 'https://api.mainnet-beta.solana.com'
607
- * getDefaultRpcUrl('devnet') // Returns: 'https://api.devnet.solana.com'
608
- */
609
- declare function getDefaultRpcUrl(network: string): string;
610
- /**
611
- * Check if a network is mainnet
612
- *
613
- * @example
614
- * isMainnet('mainnet') // Returns: true
615
- * isMainnet('mainnet-beta') // Returns: true
616
- * isMainnet('devnet') // Returns: false
617
- */
618
- declare function isMainnet(network: string): boolean;
619
- /**
620
- * Check if a network is devnet
621
- *
622
- * @example
623
- * isDevnet('devnet') // Returns: true
624
- * isDevnet('mainnet') // Returns: false
625
- */
626
- declare function isDevnet(network: string): boolean;
627
- /**
628
- * Check if a network is testnet
629
- *
630
- * @example
631
- * isTestnet('testnet') // Returns: true
632
- * isTestnet('mainnet') // Returns: false
633
- */
634
- declare function isTestnet(network: string): boolean;
635
- /**
636
- * Check if a network is localnet
637
- *
638
- * @example
639
- * isLocalnet('localnet') // Returns: true
640
- * isLocalnet('mainnet') // Returns: false
641
- */
642
- declare function isLocalnet(network: string): boolean;
643
- /**
644
- * Get a user-friendly display name for a network
645
- *
646
- * @example
647
- * getNetworkDisplayName('mainnet-beta') // Returns: 'Mainnet'
648
- * getNetworkDisplayName('devnet') // Returns: 'Devnet'
649
- */
650
- declare function getNetworkDisplayName(network: string): string;
651
-
652
- /**
653
- * @solana/connector - Unified configuration
654
- *
655
- * Simplified configuration for apps using ConnectorKit
656
- * Eliminates config duplication and provides a single source of truth
657
- */
658
-
659
- /**
660
- * Options for creating a unified configuration
661
- * Maintains type safety while providing flexibility
662
- */
663
- interface UnifiedConfigOptions extends DefaultConfigOptions {
664
- /**
665
- * Custom RPC URL (optional - overrides default for network)
666
- * Note: For production apps, use environment variables to avoid exposing API keys
667
- * @see packages/connector/src/utils/cluster.ts for secure RPC URL patterns
668
- */
669
- rpcUrl?: string;
670
- }
671
- /**
672
- * Unified configuration output
673
- * Contains all configs needed for ConnectorKit and integrations
674
- *
675
- * Important: The `rpcUrl` property is intended for:
676
- * 1. Server-side rendering (SSR) setup
677
- * 2. Passing to external libraries that need RPC configuration
678
- * 3. Development/testing environments
679
- *
680
- * For production client-side code, use the connector client's `getRpcUrl()` method
681
- * which supports environment variable patterns and proxy configurations.
682
- */
683
- interface UnifiedConfig {
684
- /** ConnectorKit configuration */
685
- connectorConfig: ExtendedConnectorConfig;
686
- /** Mobile Wallet Adapter configuration (optional) */
687
- mobile?: MobileWalletAdapterConfig;
688
- /** Normalized network name ('mainnet', 'devnet', 'testnet', 'localnet') */
689
- network: SolanaNetwork;
690
- /**
691
- * RPC endpoint URL
692
- * For external library integration only - client code should use connector client
693
- * @deprecated in client components - use `useConnectorClient().getRpcUrl()` instead
694
- */
695
- rpcUrl: string;
696
- /** Application metadata */
697
- app: {
698
- name: string;
699
- url: string;
700
- };
701
- }
702
- /**
703
- * Create a unified configuration for ConnectorKit
704
- *
705
- * This helper eliminates configuration duplication by creating all necessary
706
- * configs from a single source of truth. It automatically handles network
707
- * name translation between different conventions.
708
- *
709
- * @example Basic usage
710
- * ```tsx
711
- * import { createConfig, AppProvider } from '@solana/connector';
712
- *
713
- * const config = createConfig({
714
- * appName: 'My App',
715
- * network: 'mainnet', // Works with 'mainnet' or 'mainnet-beta'
716
- * enableMobile: true
717
- * });
718
- *
719
- * <AppProvider config={config}>
720
- * {children}
721
- * </AppProvider>
722
- * ```
723
- *
724
- * @example Integration with external libraries
725
- * ```tsx
726
- * import { createConfig, AppProvider } from '@solana/connector';
727
- * import { ArmaProvider } from '@armadura/sdk';
728
- *
729
- * const config = createConfig({
730
- * appName: 'My App',
731
- * network: 'mainnet',
732
- * });
733
- *
734
- * <AppProvider config={config}>
735
- * <ArmaProvider
736
- * config={{
737
- * network: config.network,
738
- * rpcUrl: config.rpcUrl, // Safe - for external library initialization
739
- * providers: [...]
740
- * }}
741
- * useConnector="auto"
742
- * >
743
- * {children}
744
- * </ArmaProvider>
745
- * </AppProvider>
746
- * ```
747
- *
748
- * @example Production with environment variables
749
- * ```tsx
750
- * // Use environment variables to avoid exposing API keys
751
- * const config = createConfig({
752
- * appName: 'My App',
753
- * network: 'mainnet',
754
- * // RPC URL comes from process.env on server
755
- * // Client-side code should use connector client's getRpcUrl()
756
- * });
757
- * ```
758
- *
759
- * @example Custom clusters
760
- * ```tsx
761
- * const config = createConfig({
762
- * appName: 'My App',
763
- * network: 'mainnet',
764
- * customClusters: [
765
- * {
766
- * id: 'solana:custom',
767
- * label: 'Custom RPC',
768
- * url: process.env.CUSTOM_RPC_URL || 'https://...'
769
- * }
770
- * ]
771
- * });
772
- * ```
773
- */
774
- declare function createConfig(options: UnifiedConfigOptions): UnifiedConfig;
775
- /**
776
- * Type guard to check if a config is a unified config
777
- *
778
- * @example
779
- * ```ts
780
- * if (isUnifiedConfig(someConfig)) {
781
- * // TypeScript knows this is UnifiedConfig
782
- * console.log(someConfig.network, someConfig.rpcUrl);
783
- * }
784
- * ```
785
- */
786
- declare function isUnifiedConfig(config: unknown): config is UnifiedConfig;
787
-
788
545
  declare enum WalletErrorType {
789
546
  CONNECTION_FAILED = "CONNECTION_FAILED",
790
547
  TRANSACTION_FAILED = "TRANSACTION_FAILED",
@@ -1157,9 +914,43 @@ interface WalletsRegistry {
1157
914
  }
1158
915
  type WalletStandardWallet = Wallet;
1159
916
  type WalletStandardAccount = WalletAccount;
917
+ /**
918
+ * Promise that resolves when the wallet registry is initialized and ready.
919
+ *
920
+ * Use this when you need deterministic wallet detection (e.g., auto-reconnect,
921
+ * checking if a specific wallet is installed before showing UI).
922
+ *
923
+ * Resolves immediately if the registry is already available.
924
+ * Rejects only on fatal errors (e.g., module load failure in browser environment).
925
+ *
926
+ * @example
927
+ * ```ts
928
+ * import { ready, getWalletsRegistry } from '@solana/connector';
929
+ *
930
+ * // Wait for registry to be ready before detecting wallets
931
+ * await ready;
932
+ * const wallets = getWalletsRegistry().get();
933
+ * ```
934
+ */
935
+ declare const ready: Promise<void>;
1160
936
  /**
1161
937
  * Get the wallets registry - simplified approach
938
+ *
939
+ * ⚠️ RACE CONDITION WARNING:
940
+ * The dynamic import of '@wallet-standard/app' is asynchronous. If `window.navigator.wallets`
941
+ * is not pre-populated by a wallet extension, the registry may be undefined briefly during
942
+ * initial page load. Calls to `getWalletsRegistry().get()` during this window will return
943
+ * an empty array as graceful degradation.
944
+ *
945
+ * For deterministic wallet detection (e.g., auto-reconnect, pre-checking wallet availability),
946
+ * await the exported `ready` Promise before calling `get()`:
947
+ *
948
+ * @example
949
+ * ```ts
950
+ * await ready;
951
+ * const wallets = getWalletsRegistry().get(); // Guaranteed to have registry loaded
952
+ * ```
1162
953
  */
1163
954
  declare function getWalletsRegistry(): WalletsRegistry;
1164
955
 
1165
- export { copySignatureToClipboard as $, type AccountInfo as A, type StorageOptions as B, ConnectorProvider as C, type DefaultConfigOptions as D, type ExtendedConnectorConfig as E, type EnhancedStorageAccountOptions as F, type EnhancedStorageClusterOptions as G, type EnhancedStorageWalletOptions as H, WalletErrorType as I, type WalletError as J, getPublicSolanaRpcUrl as K, type Listener as L, type MobileWalletAdapterConfig as M, createSolanaClient as N, type SolanaClusterMoniker as O, type ModifiedClusterUrl as P, type SolanaClient as Q, type CreateSolanaClientArgs as R, type StorageAdapter as S, ClipboardErrorType as T, type UnifiedConfigOptions as U, type ClipboardResult as V, type WalletInfo as W, type CopyOptions as X, isClipboardAvailable as Y, copyToClipboard as Z, copyAddressToClipboard as _, useConnectorClient as a, getClusterRpcUrl as a0, getClusterExplorerUrl as a1, getTransactionUrl as a2, getAddressUrl as a3, getTokenUrl as a4, getBlockUrl as a5, isMainnetCluster as a6, isDevnetCluster as a7, isTestnetCluster as a8, isLocalCluster as a9, getClusterName as aa, getClusterType as ab, getClusterChainId as ac, getChainIdForWalletStandard as ad, type SolanaNetwork as ae, PUBLIC_RPC_ENDPOINTS as af, normalizeNetwork as ag, toClusterId as ah, getDefaultRpcUrl as ai, isMainnet as aj, isDevnet as ak, isTestnet as al, isLocalnet as am, getNetworkDisplayName as an, ConnectorErrorBoundary as b, type ConnectorSnapshot as c, type ConnectorConfig as d, type ConnectorState as e, type WalletStandardWallet as f, type WalletStandardAccount as g, type UnifiedConfig as h, type ClusterType as i, ConnectorClient as j, getWalletsRegistry as k, getDefaultConfig as l, getDefaultMobileConfig as m, createConfig as n, isUnifiedConfig as o, type WalletName as p, type AccountAddress as q, isWalletName as r, isAccountAddress as s, type ConnectorHealth as t, useConnector as u, type ConnectorDebugMetrics as v, withErrorBoundary as w, type ConnectorDebugState as x, type ConnectorEvent as y, type ConnectorEventListener as z };
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 };
@@ -198,4 +198,4 @@ declare class TransactionSignerError extends TransactionError {
198
198
  */
199
199
  declare function isTransactionSignerError(error: unknown): error is TransactionSignerError;
200
200
 
201
- export { ConnectorError as C, Errors as E, NetworkError as N, type SolanaTransaction as S, type TransactionSignerConfig as T, ValidationError as V, type SignedTransaction as a, type TransactionSignerCapabilities as b, type TransactionActivity as c, type TransactionActivityStatus as d, type TransactionMethod as e, type TransactionMetadata as f, createTransactionSigner as g, TransactionSignerError as h, isTransactionSignerError as i, type TransactionSigner as j, ConnectionError as k, ConfigurationError as l, TransactionError as m, isConnectorError as n, isConnectionError as o, isValidationError as p, isConfigurationError as q, isNetworkError as r, isTransactionError as s, toConnectorError as t, getUserFriendlyMessage as u, type ConnectionErrorCode as v, type ValidationErrorCode as w, type ConfigurationErrorCode as x, type NetworkErrorCode as y, type TransactionErrorCode as z };
201
+ export { ConnectorError as C, Errors as E, NetworkError as N, type SolanaTransaction as S, TransactionSignerError as T, ValidationError as V, type TransactionSigner as a, ConnectionError as b, createTransactionSigner as c, ConfigurationError as d, TransactionError as e, isConnectorError as f, isConnectionError as g, isValidationError as h, isTransactionSignerError as i, isConfigurationError as j, isNetworkError as k, isTransactionError as l, getUserFriendlyMessage as m, type ConnectionErrorCode as n, type ValidationErrorCode as o, type ConfigurationErrorCode as p, type NetworkErrorCode as q, type TransactionErrorCode as r, type TransactionSignerConfig as s, toConnectorError as t, type SignedTransaction as u, type TransactionSignerCapabilities as v, type TransactionActivity as w, type TransactionActivityStatus as x, type TransactionMethod as y, type TransactionMetadata as z };
@@ -198,4 +198,4 @@ declare class TransactionSignerError extends TransactionError {
198
198
  */
199
199
  declare function isTransactionSignerError(error: unknown): error is TransactionSignerError;
200
200
 
201
- export { ConnectorError as C, Errors as E, NetworkError as N, type SolanaTransaction as S, type TransactionSignerConfig as T, ValidationError as V, type SignedTransaction as a, type TransactionSignerCapabilities as b, type TransactionActivity as c, type TransactionActivityStatus as d, type TransactionMethod as e, type TransactionMetadata as f, createTransactionSigner as g, TransactionSignerError as h, isTransactionSignerError as i, type TransactionSigner as j, ConnectionError as k, ConfigurationError as l, TransactionError as m, isConnectorError as n, isConnectionError as o, isValidationError as p, isConfigurationError as q, isNetworkError as r, isTransactionError as s, toConnectorError as t, getUserFriendlyMessage as u, type ConnectionErrorCode as v, type ValidationErrorCode as w, type ConfigurationErrorCode as x, type NetworkErrorCode as y, type TransactionErrorCode as z };
201
+ export { ConnectorError as C, Errors as E, NetworkError as N, type SolanaTransaction as S, TransactionSignerError as T, ValidationError as V, type TransactionSigner as a, ConnectionError as b, createTransactionSigner as c, ConfigurationError as d, TransactionError as e, isConnectorError as f, isConnectionError as g, isValidationError as h, isTransactionSignerError as i, isConfigurationError as j, isNetworkError as k, isTransactionError as l, getUserFriendlyMessage as m, type ConnectionErrorCode as n, type ValidationErrorCode as o, type ConfigurationErrorCode as p, type NetworkErrorCode as q, type TransactionErrorCode as r, type TransactionSignerConfig as s, toConnectorError as t, type SignedTransaction as u, type TransactionSignerCapabilities as v, type TransactionActivity as w, type TransactionActivityStatus as x, type TransactionMethod as y, type TransactionMetadata as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/connector",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Headless wallet connector client and React provider built on Wallet Standard",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -62,7 +62,6 @@
62
62
  }
63
63
  },
64
64
  "dependencies": {
65
- "@nanostores/persistent": "^1.1.0",
66
65
  "@solana-mobile/wallet-standard-mobile": "^0.4.3",
67
66
  "@solana/webcrypto-ed25519-polyfill": "^4.0.0",
68
67
  "@solana/addresses": "^5.0.0",
@@ -75,7 +74,8 @@
75
74
  "@wallet-standard/app": "^1.1.0",
76
75
  "@wallet-standard/base": "^1.1.0",
77
76
  "@wallet-standard/features": "^1.1.0",
78
- "@wallet-ui/core": "^2.1.0"
77
+ "@wallet-ui/core": "^2.1.0",
78
+ "zod": "^4.0.0"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@testing-library/jest-dom": "^6.9.1",