@solana/connector 0.1.6 → 0.1.7

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 (38) hide show
  1. package/README.md +45 -45
  2. package/dist/{chunk-VMSZJPR5.mjs → chunk-APQGEW7S.mjs} +82 -11
  3. package/dist/chunk-APQGEW7S.mjs.map +1 -0
  4. package/dist/{chunk-3STZXVXD.mjs → chunk-JK47EFJT.mjs} +940 -381
  5. package/dist/chunk-JK47EFJT.mjs.map +1 -0
  6. package/dist/{chunk-QKVL45F6.mjs → chunk-TQRJYZNK.mjs} +5 -3
  7. package/dist/chunk-TQRJYZNK.mjs.map +1 -0
  8. package/dist/{chunk-JUZVCBAI.js → chunk-VA6LKXCQ.js} +85 -10
  9. package/dist/chunk-VA6LKXCQ.js.map +1 -0
  10. package/dist/{chunk-NQXK7PGX.js → chunk-VZ5Y6DIM.js} +19 -17
  11. package/dist/chunk-VZ5Y6DIM.js.map +1 -0
  12. package/dist/{chunk-ULUYX23Q.js → chunk-Z22V3D4E.js} +949 -388
  13. package/dist/chunk-Z22V3D4E.js.map +1 -0
  14. package/dist/compat.d.mts +1 -1
  15. package/dist/compat.d.ts +1 -1
  16. package/dist/headless.d.mts +99 -7
  17. package/dist/headless.d.ts +99 -7
  18. package/dist/headless.js +128 -112
  19. package/dist/headless.mjs +2 -2
  20. package/dist/index.d.mts +5 -4
  21. package/dist/index.d.ts +5 -4
  22. package/dist/index.js +163 -139
  23. package/dist/index.mjs +3 -3
  24. package/dist/react.d.mts +179 -13
  25. package/dist/react.d.ts +179 -13
  26. package/dist/react.js +36 -28
  27. package/dist/react.mjs +2 -2
  28. package/dist/{transaction-signer-D9d8nxwb.d.mts → transaction-signer-CpGEvp7S.d.mts} +1 -1
  29. package/dist/{transaction-signer-D9d8nxwb.d.ts → transaction-signer-CpGEvp7S.d.ts} +1 -1
  30. package/dist/{wallet-standard-shim--YcrQNRt.d.ts → wallet-standard-shim-D4CYG5sU.d.mts} +35 -6
  31. package/dist/{wallet-standard-shim-Dx7H8Ctf.d.mts → wallet-standard-shim-DiMvGjOk.d.ts} +35 -6
  32. package/package.json +1 -1
  33. package/dist/chunk-3STZXVXD.mjs.map +0 -1
  34. package/dist/chunk-JUZVCBAI.js.map +0 -1
  35. package/dist/chunk-NQXK7PGX.js.map +0 -1
  36. package/dist/chunk-QKVL45F6.mjs.map +0 -1
  37. package/dist/chunk-ULUYX23Q.js.map +0 -1
  38. package/dist/chunk-VMSZJPR5.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export { EnhancedStorage, EnhancedStorageAdapter, SOLANA_CHAIN_IDS, address, base58ToSignatureBytes, chainIdToClusterId, chainIdToClusterType, clusterToChainId, copySignature, createConfig, createEnhancedStorageAccount, createEnhancedStorageCluster, createEnhancedStorageWallet, createKitSignersFromWallet, createMessageSignerFromWallet, createSignableMessage, createSolanaDevnet, createSolanaLocalnet, createSolanaMainnet, createSolanaTestnet, createTransactionSendingSignerFromWallet, detectMessageModification, formatSignature, freezeSigner, getAllExplorerUrls, getChainIdFromCluster, getChainIdFromClusterId, getChainIdFromClusterType, getChainIdFromConnection, getClusterIdFromChainId, getClusterTypeFromChainId, getClusterTypeFromConnection, getDefaultConfig, getDefaultMobileConfig, getLatestBlockhash, getSolanaExplorerUrl, getSolanaFmUrl, getSolscanUrl, getXrayUrl, isAccountAddress, isKitConnection, isKnownSolanaChain, isLegacyConnection, isSolanaChain, isUnifiedConfig, isWalletName, sendRawTransaction, signatureBytesToBase58, updateSignatureDictionary, validateKnownSolanaChain } from './chunk-QKVL45F6.mjs';
2
- export { AccountElement, UnifiedProvider as AppProvider, BalanceElement, ClusterElement, ConnectorProvider, DisconnectElement, TokenListElement, TransactionHistoryElement, UnifiedProvider, WalletListElement, useAccount, useBalance, useCluster, useConnector, useConnectorClient, useGillSolanaClient, useGillTransactionSigner, useKitTransactionSigner, useSolanaClient, useTokens, useTransactionPreparer, useTransactionSigner, useTransactions, useWalletInfo } from './chunk-3STZXVXD.mjs';
3
- export { ClipboardErrorType, ConfigurationError, ConnectionError, ConnectorClient, ConnectorError, ConnectorErrorBoundary, Errors, NetworkError, PUBLIC_RPC_ENDPOINTS, TransactionError, TransactionSignerError, ValidationError, WalletErrorType, copyAddressToClipboard, copySignatureToClipboard, copyToClipboard, createGillTransactionSigner, createKitTransactionSigner, createTransactionSigner, formatAddress, formatNumber, formatSOL, formatTokenAmount, getAddressUrl, getBlockUrl, getChainIdForWalletStandard, getClusterChainId, getClusterExplorerUrl, getClusterName, getClusterRpcUrl, getClusterType, getDefaultRpcUrl, getNetworkDisplayName, getPolyfillStatus, getTokenUrl, getTransactionUrl, getUserFriendlyMessage, getWalletsRegistry, installPolyfills, isClipboardAvailable, isConfigurationError, isConnectionError, isConnectorError, isCryptoAvailable, isDevnet, isDevnetCluster, isLocalCluster, isLocalnet, isMainnet, isMainnetCluster, isNetworkError, isPolyfillInstalled, isTestnet, isTestnetCluster, isTransactionError, isTransactionSignerError, isValidationError, normalizeNetwork, toClusterId, toConnectorError, truncate, withErrorBoundary } from './chunk-VMSZJPR5.mjs';
1
+ export { EnhancedStorage, EnhancedStorageAdapter, SOLANA_CHAIN_IDS, address, base58ToSignatureBytes, chainIdToClusterId, chainIdToClusterType, clusterToChainId, copySignature, createConfig, createEnhancedStorageAccount, createEnhancedStorageCluster, createEnhancedStorageWallet, createKitSignersFromWallet, createMessageSignerFromWallet, createSignableMessage, createSolanaDevnet, createSolanaLocalnet, createSolanaMainnet, createSolanaTestnet, createTransactionSendingSignerFromWallet, detectMessageModification, formatSignature, freezeSigner, getAllExplorerUrls, getChainIdFromCluster, getChainIdFromClusterId, getChainIdFromClusterType, getChainIdFromConnection, getClusterIdFromChainId, getClusterTypeFromChainId, getClusterTypeFromConnection, getDefaultConfig, getDefaultMobileConfig, getLatestBlockhash, getSolanaExplorerUrl, getSolanaFmUrl, getSolscanUrl, getXrayUrl, isAccountAddress, isKitConnection, isKnownSolanaChain, isLegacyConnection, isSolanaChain, isUnifiedConfig, isWalletName, sendRawTransaction, signatureBytesToBase58, updateSignatureDictionary, validateKnownSolanaChain } from './chunk-TQRJYZNK.mjs';
2
+ export { AccountElement, UnifiedProvider as AppProvider, BalanceElement, ClusterElement, ConnectorProvider, DisconnectElement, TokenListElement, TransactionHistoryElement, UnifiedProvider, WalletListElement, clearSharedQueryCache, invalidateSharedQuery, useAccount, useBalance, useCluster, useConnector, useConnectorClient, useGillSolanaClient, useGillTransactionSigner, useKitTransactionSigner, useSolanaClient, useTokens, useTransactionPreparer, useTransactionSigner, useTransactions, useWalletInfo } from './chunk-JK47EFJT.mjs';
3
+ export { ClipboardErrorType, ConfigurationError, ConnectionError, ConnectorClient, ConnectorError, ConnectorErrorBoundary, Errors, NetworkError, PUBLIC_RPC_ENDPOINTS, TransactionError, TransactionSignerError, ValidationError, WalletErrorType, copyAddressToClipboard, copySignatureToClipboard, copyToClipboard, createGillTransactionSigner, createKitTransactionSigner, createTransactionSigner, formatAddress, formatBigIntBalance, formatBigIntUsd, formatLamportsToSolSafe, formatNumber, formatSOL, formatTokenAmount, formatTokenBalanceSafe, getAddressUrl, getBlockUrl, getChainIdForWalletStandard, getClusterChainId, getClusterExplorerUrl, getClusterName, getClusterRpcUrl, getClusterType, getDefaultRpcUrl, getNetworkDisplayName, getPolyfillStatus, getTokenUrl, getTransactionUrl, getUserFriendlyMessage, getWalletsRegistry, installPolyfills, isClipboardAvailable, isConfigurationError, isConnectionError, isConnectorError, isCryptoAvailable, isDevnet, isDevnetCluster, isLocalCluster, isLocalnet, isMainnet, isMainnetCluster, isNetworkError, isPolyfillInstalled, isTestnet, isTestnetCluster, isTransactionError, isTransactionSignerError, isValidationError, normalizeNetwork, toClusterId, toConnectorError, truncate, withErrorBoundary } from './chunk-APQGEW7S.mjs';
4
4
  export { LAMPORTS_PER_SOL, createSolanaClient, getExplorerLink, getPublicSolanaRpcUrl, lamportsToSol, prepareTransaction, solToLamports } from './chunk-QL3IT3TS.mjs';
5
5
  //# sourceMappingURL=index.mjs.map
6
6
  //# sourceMappingURL=index.mjs.map
package/dist/react.d.mts CHANGED
@@ -1,15 +1,16 @@
1
- import { h as UnifiedConfig, d as ConnectorConfig, M as MobileWalletAdapterConfig, i as ClusterType, A as AccountInfo, V as ClipboardResult, Q as SolanaClient } from './wallet-standard-shim-Dx7H8Ctf.mjs';
2
- export { b as ConnectorErrorBoundary, C as ConnectorProvider, c as ConnectorSnapshot, e as ConnectorState, D as DefaultConfigOptions, E as ExtendedConnectorConfig, U as UnifiedConfigOptions, W as WalletInfo, g as WalletStandardAccount, f as WalletStandardWallet, u as useConnector, a as useConnectorClient, w as withErrorBoundary } from './wallet-standard-shim-Dx7H8Ctf.mjs';
1
+ import { h as UnifiedConfig, d as ConnectorConfig, M as MobileWalletAdapterConfig, i as ClusterType, A as AccountInfo, V as ClipboardResult, Q as SolanaClient } from './wallet-standard-shim-D4CYG5sU.mjs';
2
+ export { b as ConnectorErrorBoundary, C as ConnectorProvider, c as ConnectorSnapshot, e as ConnectorState, D as DefaultConfigOptions, E as ExtendedConnectorConfig, U as UnifiedConfigOptions, W as WalletInfo, g as WalletStandardAccount, f as WalletStandardWallet, u as useConnector, a as useConnectorClient, w as withErrorBoundary } from './wallet-standard-shim-D4CYG5sU.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ReactNode, ComponentType, PropsWithChildren } from 'react';
5
5
  import { SolanaCluster, SolanaClusterId } from '@wallet-ui/core';
6
6
  export { SolanaCluster, SolanaClusterId } from '@wallet-ui/core';
7
- import { j as TransactionSigner, b as TransactionSignerCapabilities } from './transaction-signer-D9d8nxwb.mjs';
7
+ import { j as TransactionSigner, b as TransactionSignerCapabilities } from './transaction-signer-CpGEvp7S.mjs';
8
8
  import { TransactionModifyingSigner } from '@solana/signers';
9
9
  import { TransactionMessage, TransactionMessageWithFeePayer, TransactionMessageWithBlockhashLifetime } from '@solana/kit';
10
10
  export { Wallet, WalletAccount } from '@wallet-standard/base';
11
11
  import '@solana/addresses';
12
12
  import '@solana/keys';
13
+ import '@solana-mobile/wallet-standard-mobile';
13
14
  import '@solana/transaction-messages';
14
15
  import '@solana/web3.js';
15
16
 
@@ -511,6 +512,25 @@ interface TokenBalance {
511
512
  /** Token logo URL if known */
512
513
  logo?: string;
513
514
  }
515
+ /**
516
+ * Options for useBalance hook
517
+ */
518
+ interface UseBalanceOptions {
519
+ /** Whether the hook is enabled (default: true) */
520
+ enabled?: boolean;
521
+ /** Whether to auto-refresh balance (default: true) */
522
+ autoRefresh?: boolean;
523
+ /** Refresh interval in milliseconds (default: 30000) */
524
+ refreshInterval?: number;
525
+ /** Time in ms to consider data fresh (default: 0) */
526
+ staleTimeMs?: number;
527
+ /** Time in ms to keep cache after unmount (default: 300000) */
528
+ cacheTimeMs?: number;
529
+ /** Whether to refetch on mount (default: 'stale') */
530
+ refetchOnMount?: boolean | 'stale';
531
+ /** Override the Solana client from provider */
532
+ client?: SolanaClient | null;
533
+ }
514
534
  interface UseBalanceReturn {
515
535
  /** SOL balance in SOL (not lamports) */
516
536
  solBalance: number;
@@ -524,14 +544,27 @@ interface UseBalanceReturn {
524
544
  isLoading: boolean;
525
545
  /** Error if balance fetch failed */
526
546
  error: Error | null;
527
- /** Refetch balance */
528
- refetch: () => Promise<void>;
547
+ /** Refetch balance, optionally with an abort signal */
548
+ refetch: (options?: {
549
+ signal?: AbortSignal;
550
+ }) => Promise<void>;
551
+ /** Abort any in-flight balance fetch */
552
+ abort: () => void;
529
553
  /** Last updated timestamp */
530
554
  lastUpdated: Date | null;
531
555
  }
532
556
  /**
533
557
  * Hook for fetching wallet balance (SOL and tokens).
534
558
  *
559
+ * Features:
560
+ * - Automatic request deduplication across components
561
+ * - Shared data with useTokens (single RPC query)
562
+ * - Token-2022 support
563
+ * - Shared polling interval (ref-counted)
564
+ * - Configurable auto-refresh behavior
565
+ * - Abort support for in-flight requests
566
+ * - Optional client override
567
+ *
535
568
  * @example Basic usage
536
569
  * ```tsx
537
570
  * function Balance() {
@@ -542,6 +575,23 @@ interface UseBalanceReturn {
542
575
  * }
543
576
  * ```
544
577
  *
578
+ * @example With options
579
+ * ```tsx
580
+ * function Balance() {
581
+ * const { formattedSol, refetch, abort } = useBalance({
582
+ * autoRefresh: false, // Disable polling
583
+ * staleTimeMs: 10000, // Consider data fresh for 10s
584
+ * });
585
+ *
586
+ * return (
587
+ * <div>
588
+ * {formattedSol}
589
+ * <button onClick={() => refetch()}>Refresh</button>
590
+ * </div>
591
+ * );
592
+ * }
593
+ * ```
594
+ *
545
595
  * @example With token balances
546
596
  * ```tsx
547
597
  * function TokenBalances() {
@@ -559,7 +609,7 @@ interface UseBalanceReturn {
559
609
  * }
560
610
  * ```
561
611
  */
562
- declare function useBalance(): UseBalanceReturn;
612
+ declare function useBalance(options?: UseBalanceOptions): UseBalanceReturn;
563
613
 
564
614
  interface TransactionInfo {
565
615
  /** Transaction signature */
@@ -573,7 +623,7 @@ interface TransactionInfo {
573
623
  /** Error message if failed */
574
624
  error?: string;
575
625
  /** Transaction type (if detected) */
576
- type: 'sent' | 'received' | 'swap' | 'nft' | 'stake' | 'program' | 'unknown';
626
+ type: 'sent' | 'received' | 'swap' | 'nft' | 'stake' | 'program' | 'tokenAccountClosed' | 'unknown';
577
627
  /** Direction for transfers */
578
628
  direction?: 'in' | 'out';
579
629
  /** Amount in SOL (for transfers) */
@@ -594,8 +644,32 @@ interface TransactionInfo {
594
644
  formattedTime: string;
595
645
  /** Explorer URL */
596
646
  explorerUrl: string;
647
+ /** Swap from token (only for swap transactions) */
648
+ swapFromToken?: {
649
+ mint: string;
650
+ symbol?: string;
651
+ icon?: string;
652
+ };
653
+ /** Swap to token (only for swap transactions) */
654
+ swapToToken?: {
655
+ mint: string;
656
+ symbol?: string;
657
+ icon?: string;
658
+ };
659
+ /** Primary program ID involved in the transaction (best-effort) */
660
+ programId?: string;
661
+ /** Friendly name for the primary program if known */
662
+ programName?: string;
663
+ /** All program IDs involved in the transaction (best-effort) */
664
+ programIds?: string[];
665
+ /** Parsed instruction types (best-effort, only available for some programs in `jsonParsed` mode) */
666
+ instructionTypes?: string[];
667
+ /** Number of top-level instructions in the transaction message (best-effort) */
668
+ instructionCount?: number;
597
669
  }
598
670
  interface UseTransactionsOptions {
671
+ /** Whether the hook is enabled (default: true) */
672
+ enabled?: boolean;
599
673
  /** Number of transactions to fetch */
600
674
  limit?: number;
601
675
  /** Whether to auto-refresh */
@@ -604,6 +678,21 @@ interface UseTransactionsOptions {
604
678
  refreshInterval?: number;
605
679
  /** Fetch full transaction details (slower but more info) */
606
680
  fetchDetails?: boolean;
681
+ /**
682
+ * Max concurrent `getTransaction` RPC calls when `fetchDetails` is true.
683
+ * Lower this if you see throttling on public RPCs.
684
+ *
685
+ * @default 6
686
+ */
687
+ detailsConcurrency?: number;
688
+ /** Time in ms to consider data fresh (default: 0) */
689
+ staleTimeMs?: number;
690
+ /** Time in ms to keep cache after unmount (default: 300000) */
691
+ cacheTimeMs?: number;
692
+ /** Whether to refetch on mount (default: 'stale') */
693
+ refetchOnMount?: boolean | 'stale';
694
+ /** Override the Solana client from provider */
695
+ client?: SolanaClient | null;
607
696
  }
608
697
  interface UseTransactionsReturn {
609
698
  /** List of transactions */
@@ -616,8 +705,12 @@ interface UseTransactionsReturn {
616
705
  hasMore: boolean;
617
706
  /** Load more transactions */
618
707
  loadMore: () => Promise<void>;
619
- /** Refetch transactions */
620
- refetch: () => Promise<void>;
708
+ /** Refetch transactions, optionally with an abort signal */
709
+ refetch: (options?: {
710
+ signal?: AbortSignal;
711
+ }) => Promise<void>;
712
+ /** Abort any in-flight transaction fetch */
713
+ abort: () => void;
621
714
  /** Last updated timestamp */
622
715
  lastUpdated: Date | null;
623
716
  }
@@ -671,8 +764,12 @@ interface Token {
671
764
  isFrozen: boolean;
672
765
  /** Owner address */
673
766
  owner: string;
767
+ /** Which token program (token or token-2022) */
768
+ programId?: 'token' | 'token-2022';
674
769
  }
675
770
  interface UseTokensOptions {
771
+ /** Whether the hook is enabled (default: true) */
772
+ enabled?: boolean;
676
773
  /** Whether to include zero balance tokens */
677
774
  includeZeroBalance?: boolean;
678
775
  /** Whether to auto-refresh */
@@ -683,6 +780,14 @@ interface UseTokensOptions {
683
780
  fetchMetadata?: boolean;
684
781
  /** Include native SOL balance */
685
782
  includeNativeSol?: boolean;
783
+ /** Time in ms to consider data fresh (default: 0) */
784
+ staleTimeMs?: number;
785
+ /** Time in ms to keep cache after unmount (default: 300000) */
786
+ cacheTimeMs?: number;
787
+ /** Whether to refetch on mount (default: 'stale') */
788
+ refetchOnMount?: boolean | 'stale';
789
+ /** Override the Solana client from provider */
790
+ client?: SolanaClient | null;
686
791
  }
687
792
  interface UseTokensReturn {
688
793
  /** List of tokens */
@@ -691,8 +796,12 @@ interface UseTokensReturn {
691
796
  isLoading: boolean;
692
797
  /** Error if fetch failed */
693
798
  error: Error | null;
694
- /** Refetch tokens */
695
- refetch: () => Promise<void>;
799
+ /** Refetch tokens, optionally with an abort signal */
800
+ refetch: (options?: {
801
+ signal?: AbortSignal;
802
+ }) => Promise<void>;
803
+ /** Abort any in-flight token fetch */
804
+ abort: () => void;
696
805
  /** Last updated timestamp */
697
806
  lastUpdated: Date | null;
698
807
  /** Total number of token accounts */
@@ -702,6 +811,15 @@ interface UseTokensReturn {
702
811
  * Hook for fetching wallet token holdings.
703
812
  * Fetches metadata (name, symbol, icon) from Solana Token List API and USD prices from CoinGecko.
704
813
  *
814
+ * Features:
815
+ * - Automatic request deduplication across components
816
+ * - Shared data with useBalance (single RPC query)
817
+ * - Token-2022 support
818
+ * - Shared polling interval (ref-counted)
819
+ * - Configurable auto-refresh behavior
820
+ * - Abort support for in-flight requests
821
+ * - Optional client override
822
+ *
705
823
  * @example Basic usage
706
824
  * ```tsx
707
825
  * function TokenList() {
@@ -722,9 +840,38 @@ interface UseTokensReturn {
722
840
  * );
723
841
  * }
724
842
  * ```
843
+ *
844
+ * @example With options
845
+ * ```tsx
846
+ * function TokenList() {
847
+ * const { tokens, refetch, abort } = useTokens({
848
+ * autoRefresh: true,
849
+ * refreshInterval: 30000,
850
+ * includeNativeSol: true,
851
+ * });
852
+ *
853
+ * return (
854
+ * <div>
855
+ * {tokens.map(token => (
856
+ * <div key={token.mint}>{token.symbol}: {token.formatted}</div>
857
+ * ))}
858
+ * <button onClick={() => refetch()}>Refresh</button>
859
+ * </div>
860
+ * );
861
+ * }
862
+ * ```
725
863
  */
726
864
  declare function useTokens(options?: UseTokensOptions): UseTokensReturn;
727
865
 
866
+ /**
867
+ * Invalidate a query, causing it to refetch on next access
868
+ */
869
+ declare function invalidateSharedQuery(key: string): void;
870
+ /**
871
+ * Clear all cached queries (useful for logout/disconnect)
872
+ */
873
+ declare function clearSharedQueryCache(): void;
874
+
728
875
  interface DisconnectElementProps {
729
876
  /** Display variant */
730
877
  variant?: 'button' | 'menuitem' | 'link';
@@ -1032,6 +1179,20 @@ interface TransactionHistoryElementRenderProps {
1032
1179
  interface TransactionHistoryElementProps {
1033
1180
  /** Number of transactions to display */
1034
1181
  limit?: number;
1182
+ /**
1183
+ * Fetch full transaction details (slower, but enables richer parsing like token icons + swap detection).
1184
+ *
1185
+ * Passed through to `useTransactions({ fetchDetails })`.
1186
+ * @default true
1187
+ */
1188
+ fetchDetails?: boolean;
1189
+ /**
1190
+ * Max concurrent `getTransaction` RPC calls when `fetchDetails` is true.
1191
+ *
1192
+ * Passed through to `useTransactions({ detailsConcurrency })`.
1193
+ * @default 6
1194
+ */
1195
+ detailsConcurrency?: number;
1035
1196
  /** Show transaction status */
1036
1197
  showStatus?: boolean;
1037
1198
  /** Show transaction time */
@@ -1062,6 +1223,11 @@ interface TransactionHistoryElementProps {
1062
1223
  * <TransactionHistoryElement limit={10} showLoadMore />
1063
1224
  * ```
1064
1225
  *
1226
+ * @example Throttle-safe details fetching (recommended for public RPCs)
1227
+ * ```tsx
1228
+ * <TransactionHistoryElement limit={10} fetchDetails detailsConcurrency={4} />
1229
+ * ```
1230
+ *
1065
1231
  * @example Custom item render
1066
1232
  * ```tsx
1067
1233
  * <TransactionHistoryElement
@@ -1073,7 +1239,7 @@ interface TransactionHistoryElementProps {
1073
1239
  * />
1074
1240
  * ```
1075
1241
  */
1076
- declare function TransactionHistoryElement({ limit, showStatus, showTime, className, variant, showLoadMore, showSkeleton, render, renderItem, }: TransactionHistoryElementProps): react_jsx_runtime.JSX.Element;
1242
+ declare function TransactionHistoryElement({ limit, fetchDetails, detailsConcurrency, showStatus, showTime, className, variant, showLoadMore, showSkeleton, render, renderItem, }: TransactionHistoryElementProps): react_jsx_runtime.JSX.Element;
1077
1243
  declare namespace TransactionHistoryElement {
1078
1244
  var displayName: string;
1079
1245
  }
@@ -1133,4 +1299,4 @@ declare namespace TokenListElement {
1133
1299
  var displayName: string;
1134
1300
  }
1135
1301
 
1136
- export { AccountElement, type AccountElementProps, type AccountElementRenderProps, AccountInfo, UnifiedProvider as AppProvider, BalanceElement, type BalanceElementProps, type BalanceElementRenderProps, ClusterElement, type ClusterElementProps, type ClusterElementRenderProps, ClusterType, ConnectorConfig, DisconnectElement, type DisconnectElementProps, MobileWalletAdapterConfig, type Token, type TokenBalance, TokenListElement, type TokenListElementProps, type TokenListElementRenderProps, TransactionHistoryElement, type TransactionHistoryElementProps, type TransactionHistoryElementRenderProps, type TransactionInfo, type TransactionPrepareOptions, UnifiedConfig, UnifiedProvider, type UnifiedProviderProps, type UseAccountReturn, type UseBalanceReturn, type UseClusterReturn, type UseGillSolanaClientReturn, type UseGillTransactionSignerReturn, type UseKitTransactionSignerReturn, type UseSolanaClientReturn, type UseTokensOptions, type UseTokensReturn, type UseTransactionPreparerReturn, type UseTransactionSignerReturn, type UseTransactionsOptions, type UseTransactionsReturn, type UseWalletInfoReturn, WalletListElement, type WalletListElementProps, type WalletListElementRenderProps, type WalletListElementWalletProps, useAccount, useBalance, useCluster, useGillSolanaClient, useGillTransactionSigner, useKitTransactionSigner, useSolanaClient, useTokens, useTransactionPreparer, useTransactionSigner, useTransactions, useWalletInfo };
1302
+ export { AccountElement, type AccountElementProps, type AccountElementRenderProps, AccountInfo, UnifiedProvider as AppProvider, BalanceElement, type BalanceElementProps, type BalanceElementRenderProps, ClusterElement, type ClusterElementProps, type ClusterElementRenderProps, ClusterType, ConnectorConfig, DisconnectElement, type DisconnectElementProps, MobileWalletAdapterConfig, type Token, type TokenBalance, TokenListElement, type TokenListElementProps, type TokenListElementRenderProps, TransactionHistoryElement, type TransactionHistoryElementProps, type TransactionHistoryElementRenderProps, type TransactionInfo, type TransactionPrepareOptions, UnifiedConfig, UnifiedProvider, type UnifiedProviderProps, type UseAccountReturn, type UseBalanceOptions, type UseBalanceReturn, type UseClusterReturn, type UseGillSolanaClientReturn, type UseGillTransactionSignerReturn, type UseKitTransactionSignerReturn, type UseSolanaClientReturn, type UseTokensOptions, type UseTokensReturn, type UseTransactionPreparerReturn, type UseTransactionSignerReturn, type UseTransactionsOptions, type UseTransactionsReturn, type UseWalletInfoReturn, WalletListElement, type WalletListElementProps, type WalletListElementRenderProps, type WalletListElementWalletProps, clearSharedQueryCache, invalidateSharedQuery, useAccount, useBalance, useCluster, useGillSolanaClient, useGillTransactionSigner, useKitTransactionSigner, useSolanaClient, useTokens, useTransactionPreparer, useTransactionSigner, useTransactions, useWalletInfo };
package/dist/react.d.ts CHANGED
@@ -1,15 +1,16 @@
1
- import { h as UnifiedConfig, d as ConnectorConfig, M as MobileWalletAdapterConfig, i as ClusterType, A as AccountInfo, V as ClipboardResult, Q as SolanaClient } from './wallet-standard-shim--YcrQNRt.js';
2
- export { b as ConnectorErrorBoundary, C as ConnectorProvider, c as ConnectorSnapshot, e as ConnectorState, D as DefaultConfigOptions, E as ExtendedConnectorConfig, U as UnifiedConfigOptions, W as WalletInfo, g as WalletStandardAccount, f as WalletStandardWallet, u as useConnector, a as useConnectorClient, w as withErrorBoundary } from './wallet-standard-shim--YcrQNRt.js';
1
+ import { h as UnifiedConfig, d as ConnectorConfig, M as MobileWalletAdapterConfig, i as ClusterType, A as AccountInfo, V as ClipboardResult, Q as SolanaClient } from './wallet-standard-shim-DiMvGjOk.js';
2
+ export { b as ConnectorErrorBoundary, C as ConnectorProvider, c as ConnectorSnapshot, e as ConnectorState, D as DefaultConfigOptions, E as ExtendedConnectorConfig, U as UnifiedConfigOptions, W as WalletInfo, g as WalletStandardAccount, f as WalletStandardWallet, u as useConnector, a as useConnectorClient, w as withErrorBoundary } from './wallet-standard-shim-DiMvGjOk.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ReactNode, ComponentType, PropsWithChildren } from 'react';
5
5
  import { SolanaCluster, SolanaClusterId } from '@wallet-ui/core';
6
6
  export { SolanaCluster, SolanaClusterId } from '@wallet-ui/core';
7
- import { j as TransactionSigner, b as TransactionSignerCapabilities } from './transaction-signer-D9d8nxwb.js';
7
+ import { j as TransactionSigner, b as TransactionSignerCapabilities } from './transaction-signer-CpGEvp7S.js';
8
8
  import { TransactionModifyingSigner } from '@solana/signers';
9
9
  import { TransactionMessage, TransactionMessageWithFeePayer, TransactionMessageWithBlockhashLifetime } from '@solana/kit';
10
10
  export { Wallet, WalletAccount } from '@wallet-standard/base';
11
11
  import '@solana/addresses';
12
12
  import '@solana/keys';
13
+ import '@solana-mobile/wallet-standard-mobile';
13
14
  import '@solana/transaction-messages';
14
15
  import '@solana/web3.js';
15
16
 
@@ -511,6 +512,25 @@ interface TokenBalance {
511
512
  /** Token logo URL if known */
512
513
  logo?: string;
513
514
  }
515
+ /**
516
+ * Options for useBalance hook
517
+ */
518
+ interface UseBalanceOptions {
519
+ /** Whether the hook is enabled (default: true) */
520
+ enabled?: boolean;
521
+ /** Whether to auto-refresh balance (default: true) */
522
+ autoRefresh?: boolean;
523
+ /** Refresh interval in milliseconds (default: 30000) */
524
+ refreshInterval?: number;
525
+ /** Time in ms to consider data fresh (default: 0) */
526
+ staleTimeMs?: number;
527
+ /** Time in ms to keep cache after unmount (default: 300000) */
528
+ cacheTimeMs?: number;
529
+ /** Whether to refetch on mount (default: 'stale') */
530
+ refetchOnMount?: boolean | 'stale';
531
+ /** Override the Solana client from provider */
532
+ client?: SolanaClient | null;
533
+ }
514
534
  interface UseBalanceReturn {
515
535
  /** SOL balance in SOL (not lamports) */
516
536
  solBalance: number;
@@ -524,14 +544,27 @@ interface UseBalanceReturn {
524
544
  isLoading: boolean;
525
545
  /** Error if balance fetch failed */
526
546
  error: Error | null;
527
- /** Refetch balance */
528
- refetch: () => Promise<void>;
547
+ /** Refetch balance, optionally with an abort signal */
548
+ refetch: (options?: {
549
+ signal?: AbortSignal;
550
+ }) => Promise<void>;
551
+ /** Abort any in-flight balance fetch */
552
+ abort: () => void;
529
553
  /** Last updated timestamp */
530
554
  lastUpdated: Date | null;
531
555
  }
532
556
  /**
533
557
  * Hook for fetching wallet balance (SOL and tokens).
534
558
  *
559
+ * Features:
560
+ * - Automatic request deduplication across components
561
+ * - Shared data with useTokens (single RPC query)
562
+ * - Token-2022 support
563
+ * - Shared polling interval (ref-counted)
564
+ * - Configurable auto-refresh behavior
565
+ * - Abort support for in-flight requests
566
+ * - Optional client override
567
+ *
535
568
  * @example Basic usage
536
569
  * ```tsx
537
570
  * function Balance() {
@@ -542,6 +575,23 @@ interface UseBalanceReturn {
542
575
  * }
543
576
  * ```
544
577
  *
578
+ * @example With options
579
+ * ```tsx
580
+ * function Balance() {
581
+ * const { formattedSol, refetch, abort } = useBalance({
582
+ * autoRefresh: false, // Disable polling
583
+ * staleTimeMs: 10000, // Consider data fresh for 10s
584
+ * });
585
+ *
586
+ * return (
587
+ * <div>
588
+ * {formattedSol}
589
+ * <button onClick={() => refetch()}>Refresh</button>
590
+ * </div>
591
+ * );
592
+ * }
593
+ * ```
594
+ *
545
595
  * @example With token balances
546
596
  * ```tsx
547
597
  * function TokenBalances() {
@@ -559,7 +609,7 @@ interface UseBalanceReturn {
559
609
  * }
560
610
  * ```
561
611
  */
562
- declare function useBalance(): UseBalanceReturn;
612
+ declare function useBalance(options?: UseBalanceOptions): UseBalanceReturn;
563
613
 
564
614
  interface TransactionInfo {
565
615
  /** Transaction signature */
@@ -573,7 +623,7 @@ interface TransactionInfo {
573
623
  /** Error message if failed */
574
624
  error?: string;
575
625
  /** Transaction type (if detected) */
576
- type: 'sent' | 'received' | 'swap' | 'nft' | 'stake' | 'program' | 'unknown';
626
+ type: 'sent' | 'received' | 'swap' | 'nft' | 'stake' | 'program' | 'tokenAccountClosed' | 'unknown';
577
627
  /** Direction for transfers */
578
628
  direction?: 'in' | 'out';
579
629
  /** Amount in SOL (for transfers) */
@@ -594,8 +644,32 @@ interface TransactionInfo {
594
644
  formattedTime: string;
595
645
  /** Explorer URL */
596
646
  explorerUrl: string;
647
+ /** Swap from token (only for swap transactions) */
648
+ swapFromToken?: {
649
+ mint: string;
650
+ symbol?: string;
651
+ icon?: string;
652
+ };
653
+ /** Swap to token (only for swap transactions) */
654
+ swapToToken?: {
655
+ mint: string;
656
+ symbol?: string;
657
+ icon?: string;
658
+ };
659
+ /** Primary program ID involved in the transaction (best-effort) */
660
+ programId?: string;
661
+ /** Friendly name for the primary program if known */
662
+ programName?: string;
663
+ /** All program IDs involved in the transaction (best-effort) */
664
+ programIds?: string[];
665
+ /** Parsed instruction types (best-effort, only available for some programs in `jsonParsed` mode) */
666
+ instructionTypes?: string[];
667
+ /** Number of top-level instructions in the transaction message (best-effort) */
668
+ instructionCount?: number;
597
669
  }
598
670
  interface UseTransactionsOptions {
671
+ /** Whether the hook is enabled (default: true) */
672
+ enabled?: boolean;
599
673
  /** Number of transactions to fetch */
600
674
  limit?: number;
601
675
  /** Whether to auto-refresh */
@@ -604,6 +678,21 @@ interface UseTransactionsOptions {
604
678
  refreshInterval?: number;
605
679
  /** Fetch full transaction details (slower but more info) */
606
680
  fetchDetails?: boolean;
681
+ /**
682
+ * Max concurrent `getTransaction` RPC calls when `fetchDetails` is true.
683
+ * Lower this if you see throttling on public RPCs.
684
+ *
685
+ * @default 6
686
+ */
687
+ detailsConcurrency?: number;
688
+ /** Time in ms to consider data fresh (default: 0) */
689
+ staleTimeMs?: number;
690
+ /** Time in ms to keep cache after unmount (default: 300000) */
691
+ cacheTimeMs?: number;
692
+ /** Whether to refetch on mount (default: 'stale') */
693
+ refetchOnMount?: boolean | 'stale';
694
+ /** Override the Solana client from provider */
695
+ client?: SolanaClient | null;
607
696
  }
608
697
  interface UseTransactionsReturn {
609
698
  /** List of transactions */
@@ -616,8 +705,12 @@ interface UseTransactionsReturn {
616
705
  hasMore: boolean;
617
706
  /** Load more transactions */
618
707
  loadMore: () => Promise<void>;
619
- /** Refetch transactions */
620
- refetch: () => Promise<void>;
708
+ /** Refetch transactions, optionally with an abort signal */
709
+ refetch: (options?: {
710
+ signal?: AbortSignal;
711
+ }) => Promise<void>;
712
+ /** Abort any in-flight transaction fetch */
713
+ abort: () => void;
621
714
  /** Last updated timestamp */
622
715
  lastUpdated: Date | null;
623
716
  }
@@ -671,8 +764,12 @@ interface Token {
671
764
  isFrozen: boolean;
672
765
  /** Owner address */
673
766
  owner: string;
767
+ /** Which token program (token or token-2022) */
768
+ programId?: 'token' | 'token-2022';
674
769
  }
675
770
  interface UseTokensOptions {
771
+ /** Whether the hook is enabled (default: true) */
772
+ enabled?: boolean;
676
773
  /** Whether to include zero balance tokens */
677
774
  includeZeroBalance?: boolean;
678
775
  /** Whether to auto-refresh */
@@ -683,6 +780,14 @@ interface UseTokensOptions {
683
780
  fetchMetadata?: boolean;
684
781
  /** Include native SOL balance */
685
782
  includeNativeSol?: boolean;
783
+ /** Time in ms to consider data fresh (default: 0) */
784
+ staleTimeMs?: number;
785
+ /** Time in ms to keep cache after unmount (default: 300000) */
786
+ cacheTimeMs?: number;
787
+ /** Whether to refetch on mount (default: 'stale') */
788
+ refetchOnMount?: boolean | 'stale';
789
+ /** Override the Solana client from provider */
790
+ client?: SolanaClient | null;
686
791
  }
687
792
  interface UseTokensReturn {
688
793
  /** List of tokens */
@@ -691,8 +796,12 @@ interface UseTokensReturn {
691
796
  isLoading: boolean;
692
797
  /** Error if fetch failed */
693
798
  error: Error | null;
694
- /** Refetch tokens */
695
- refetch: () => Promise<void>;
799
+ /** Refetch tokens, optionally with an abort signal */
800
+ refetch: (options?: {
801
+ signal?: AbortSignal;
802
+ }) => Promise<void>;
803
+ /** Abort any in-flight token fetch */
804
+ abort: () => void;
696
805
  /** Last updated timestamp */
697
806
  lastUpdated: Date | null;
698
807
  /** Total number of token accounts */
@@ -702,6 +811,15 @@ interface UseTokensReturn {
702
811
  * Hook for fetching wallet token holdings.
703
812
  * Fetches metadata (name, symbol, icon) from Solana Token List API and USD prices from CoinGecko.
704
813
  *
814
+ * Features:
815
+ * - Automatic request deduplication across components
816
+ * - Shared data with useBalance (single RPC query)
817
+ * - Token-2022 support
818
+ * - Shared polling interval (ref-counted)
819
+ * - Configurable auto-refresh behavior
820
+ * - Abort support for in-flight requests
821
+ * - Optional client override
822
+ *
705
823
  * @example Basic usage
706
824
  * ```tsx
707
825
  * function TokenList() {
@@ -722,9 +840,38 @@ interface UseTokensReturn {
722
840
  * );
723
841
  * }
724
842
  * ```
843
+ *
844
+ * @example With options
845
+ * ```tsx
846
+ * function TokenList() {
847
+ * const { tokens, refetch, abort } = useTokens({
848
+ * autoRefresh: true,
849
+ * refreshInterval: 30000,
850
+ * includeNativeSol: true,
851
+ * });
852
+ *
853
+ * return (
854
+ * <div>
855
+ * {tokens.map(token => (
856
+ * <div key={token.mint}>{token.symbol}: {token.formatted}</div>
857
+ * ))}
858
+ * <button onClick={() => refetch()}>Refresh</button>
859
+ * </div>
860
+ * );
861
+ * }
862
+ * ```
725
863
  */
726
864
  declare function useTokens(options?: UseTokensOptions): UseTokensReturn;
727
865
 
866
+ /**
867
+ * Invalidate a query, causing it to refetch on next access
868
+ */
869
+ declare function invalidateSharedQuery(key: string): void;
870
+ /**
871
+ * Clear all cached queries (useful for logout/disconnect)
872
+ */
873
+ declare function clearSharedQueryCache(): void;
874
+
728
875
  interface DisconnectElementProps {
729
876
  /** Display variant */
730
877
  variant?: 'button' | 'menuitem' | 'link';
@@ -1032,6 +1179,20 @@ interface TransactionHistoryElementRenderProps {
1032
1179
  interface TransactionHistoryElementProps {
1033
1180
  /** Number of transactions to display */
1034
1181
  limit?: number;
1182
+ /**
1183
+ * Fetch full transaction details (slower, but enables richer parsing like token icons + swap detection).
1184
+ *
1185
+ * Passed through to `useTransactions({ fetchDetails })`.
1186
+ * @default true
1187
+ */
1188
+ fetchDetails?: boolean;
1189
+ /**
1190
+ * Max concurrent `getTransaction` RPC calls when `fetchDetails` is true.
1191
+ *
1192
+ * Passed through to `useTransactions({ detailsConcurrency })`.
1193
+ * @default 6
1194
+ */
1195
+ detailsConcurrency?: number;
1035
1196
  /** Show transaction status */
1036
1197
  showStatus?: boolean;
1037
1198
  /** Show transaction time */
@@ -1062,6 +1223,11 @@ interface TransactionHistoryElementProps {
1062
1223
  * <TransactionHistoryElement limit={10} showLoadMore />
1063
1224
  * ```
1064
1225
  *
1226
+ * @example Throttle-safe details fetching (recommended for public RPCs)
1227
+ * ```tsx
1228
+ * <TransactionHistoryElement limit={10} fetchDetails detailsConcurrency={4} />
1229
+ * ```
1230
+ *
1065
1231
  * @example Custom item render
1066
1232
  * ```tsx
1067
1233
  * <TransactionHistoryElement
@@ -1073,7 +1239,7 @@ interface TransactionHistoryElementProps {
1073
1239
  * />
1074
1240
  * ```
1075
1241
  */
1076
- declare function TransactionHistoryElement({ limit, showStatus, showTime, className, variant, showLoadMore, showSkeleton, render, renderItem, }: TransactionHistoryElementProps): react_jsx_runtime.JSX.Element;
1242
+ declare function TransactionHistoryElement({ limit, fetchDetails, detailsConcurrency, showStatus, showTime, className, variant, showLoadMore, showSkeleton, render, renderItem, }: TransactionHistoryElementProps): react_jsx_runtime.JSX.Element;
1077
1243
  declare namespace TransactionHistoryElement {
1078
1244
  var displayName: string;
1079
1245
  }
@@ -1133,4 +1299,4 @@ declare namespace TokenListElement {
1133
1299
  var displayName: string;
1134
1300
  }
1135
1301
 
1136
- export { AccountElement, type AccountElementProps, type AccountElementRenderProps, AccountInfo, UnifiedProvider as AppProvider, BalanceElement, type BalanceElementProps, type BalanceElementRenderProps, ClusterElement, type ClusterElementProps, type ClusterElementRenderProps, ClusterType, ConnectorConfig, DisconnectElement, type DisconnectElementProps, MobileWalletAdapterConfig, type Token, type TokenBalance, TokenListElement, type TokenListElementProps, type TokenListElementRenderProps, TransactionHistoryElement, type TransactionHistoryElementProps, type TransactionHistoryElementRenderProps, type TransactionInfo, type TransactionPrepareOptions, UnifiedConfig, UnifiedProvider, type UnifiedProviderProps, type UseAccountReturn, type UseBalanceReturn, type UseClusterReturn, type UseGillSolanaClientReturn, type UseGillTransactionSignerReturn, type UseKitTransactionSignerReturn, type UseSolanaClientReturn, type UseTokensOptions, type UseTokensReturn, type UseTransactionPreparerReturn, type UseTransactionSignerReturn, type UseTransactionsOptions, type UseTransactionsReturn, type UseWalletInfoReturn, WalletListElement, type WalletListElementProps, type WalletListElementRenderProps, type WalletListElementWalletProps, useAccount, useBalance, useCluster, useGillSolanaClient, useGillTransactionSigner, useKitTransactionSigner, useSolanaClient, useTokens, useTransactionPreparer, useTransactionSigner, useTransactions, useWalletInfo };
1302
+ export { AccountElement, type AccountElementProps, type AccountElementRenderProps, AccountInfo, UnifiedProvider as AppProvider, BalanceElement, type BalanceElementProps, type BalanceElementRenderProps, ClusterElement, type ClusterElementProps, type ClusterElementRenderProps, ClusterType, ConnectorConfig, DisconnectElement, type DisconnectElementProps, MobileWalletAdapterConfig, type Token, type TokenBalance, TokenListElement, type TokenListElementProps, type TokenListElementRenderProps, TransactionHistoryElement, type TransactionHistoryElementProps, type TransactionHistoryElementRenderProps, type TransactionInfo, type TransactionPrepareOptions, UnifiedConfig, UnifiedProvider, type UnifiedProviderProps, type UseAccountReturn, type UseBalanceOptions, type UseBalanceReturn, type UseClusterReturn, type UseGillSolanaClientReturn, type UseGillTransactionSignerReturn, type UseKitTransactionSignerReturn, type UseSolanaClientReturn, type UseTokensOptions, type UseTokensReturn, type UseTransactionPreparerReturn, type UseTransactionSignerReturn, type UseTransactionsOptions, type UseTransactionsReturn, type UseWalletInfoReturn, WalletListElement, type WalletListElementProps, type WalletListElementRenderProps, type WalletListElementWalletProps, clearSharedQueryCache, invalidateSharedQuery, useAccount, useBalance, useCluster, useGillSolanaClient, useGillTransactionSigner, useKitTransactionSigner, useSolanaClient, useTokens, useTransactionPreparer, useTransactionSigner, useTransactions, useWalletInfo };