@moon-x/react-sdk 0.10.0 → 0.12.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.
@@ -1,5 +1,5 @@
1
1
  import { PublicWallet, BaseGetBalanceParams, TransactionCommitment, BaseGetTokenAccountsParams, TransactionEncoding, BaseSendTransactionParams, BaseUIOptions, BaseSignMessageParams, BaseSignTransactionParams, TransactionUIOptions, PublicEthereumWallet } from '@moon-x/core/types';
2
- import { B as BaseWalletHooks } from './base-wallet-CzJLpndu.js';
2
+ import { B as BaseWalletHooks } from './base-wallet-SjY7osPg.js';
3
3
  import { EthereumFundingConfig } from '@moon-x/core';
4
4
 
5
5
  interface EthereumProvider {
@@ -1,5 +1,5 @@
1
1
  import { PublicWallet, BaseGetBalanceParams, TransactionCommitment, BaseGetTokenAccountsParams, TransactionEncoding, BaseSendTransactionParams, BaseUIOptions, BaseSignMessageParams, BaseSignTransactionParams, TransactionUIOptions, PublicEthereumWallet } from '@moon-x/core/types';
2
- import { B as BaseWalletHooks } from './base-wallet-CzJLpndu.mjs';
2
+ import { B as BaseWalletHooks } from './base-wallet-SjY7osPg.mjs';
3
3
  import { EthereumFundingConfig } from '@moon-x/core';
4
4
 
5
5
  interface EthereumProvider {
package/dist/index.d.mts CHANGED
@@ -1,12 +1,13 @@
1
1
  export { LoginWithEmailState, PasskeyStatusEntry, RegisterPasskeyResult, UseAddPasskeyResult, UseEphemeralSignerResult, UseLoginWithEmailCallbacks, UsePasskeyStatusResult, UseRemovePasskeyResult, useAddPasskey, useEphemeralSigner, useLoginWithEmail, usePasskeyStatus, useRegisterPasskey, useRemovePasskey, useUser } from '@moon-x/core/react';
2
- import { WalletListEntry, LogoutResponse, EmailOtpFlowState, AuthAppearance, SendEmailOtpResponse, PrefillConfig, WalletChainType, PasskeyEnrollConfig, SignMessageConfig, ExportKeyConfig, SignTransactionConfig, SendTransactionConfig, ChainConfigItem, Wallet, FlexibleTheme, DisplayMode, AppearanceModeTokens } from '@moon-x/core/types';
2
+ import { WalletListEntry, AuthAppearance, PrefillConfig, WalletChainType, PasskeyEnrollConfig, SignMessageConfig, ExportKeyConfig, SignTransactionConfig, SendTransactionConfig, ChainConfigItem, LogoutResponse, EmailOtpFlowState, SendEmailOtpResponse, Wallet, FlexibleTheme, DisplayMode, AppearanceModeTokens } from '@moon-x/core/types';
3
3
  export { AppearanceBackdrop, AppearanceBorderRadius, AppearanceCard, AppearanceColors, AppearanceComponents, AppearanceLogo, AppearanceModeTokens, AppearanceTypography, AuthAppearance, Chain, ChainConfigItem, ChainEntry, ComponentStyle, DisplayMode, EphemeralSigner, EphemeralSignerChain, EphemeralSignerScheme, EphemeralSignerWallet, EvmChainEntry, Factor, IdpProvider, ListEphemeralSignersResult, Network, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, PublicEthereumWallet, PublicWallet, RevokeEphemeralSignerParams, SolanaChainEntry, WalletConnectConfig, WalletListEntry } from '@moon-x/core/types';
4
4
  import React$1, { ReactNode } from 'react';
5
- export { e as ethereum } from './ethereum-lovLlqC2.mjs';
6
- export { s as solana } from './solana-BVrNImZ1.mjs';
5
+ export { e as ethereum } from './ethereum-DIGoC1pP.mjs';
6
+ export { s as solana } from './solana-nqJKbWX0.mjs';
7
+ export { t as tron } from './tron-KzJqr-zA.mjs';
7
8
  export { buildChainIndex, estimateEvmGas, estimateEvmGasReserve, getChainById, getEvmGasPrice, getEvmMaxPriorityFeePerGas, getEvmNonce, getRpcUrl, isChainSupported, isEvmEntry, normalizeChainKey, resolveChainEntry, resolveRpcUrl, resolveSolanaChainEntry, resolveWsUrl, validateChainConfig } from '@moon-x/core/lib';
8
9
  export { arbitrum, arbitrumSepolia, avalanche, avalancheFuji, base, baseSepolia, bsc, bscTestnet, goerli, holesky, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, sepolia } from 'viem/chains';
9
- import './base-wallet-CzJLpndu.mjs';
10
+ import './base-wallet-SjY7osPg.mjs';
10
11
  import '@moon-x/core';
11
12
 
12
13
  type OAuthProvider$1 = "google" | "apple";
@@ -42,17 +43,34 @@ interface BaseConnectedEthereumWallet {
42
43
  wallet_type: "ethereum";
43
44
  chain_id?: string;
44
45
  connector?: any;
46
+ /** Backend `wallet_client_type`, e.g. "metamask". */
47
+ walletClientType?: string;
48
+ /** Sign a message with the connected wallet (returns a hex signature). */
49
+ signMessage?: (message: string | Uint8Array) => Promise<string>;
50
+ /** Best-effort disconnect. */
51
+ disconnect?: () => Promise<void>;
45
52
  }
46
53
  interface BaseConnectedSolanaWallet {
47
54
  public_address: string;
48
55
  wallet_type: "solana";
49
56
  chain_id?: string;
57
+ /** Backend `wallet_client_type`, e.g. "phantom". */
58
+ walletClientType?: string;
59
+ /** Sign a message with the connected wallet (returns a base58 signature). */
60
+ signMessage?: (message: string | Uint8Array) => Promise<string>;
61
+ /** Best-effort disconnect. */
62
+ disconnect?: () => Promise<void>;
50
63
  }
51
64
  interface ConnectWalletParams {
52
65
  description?: string;
53
66
  walletList?: WalletListEntry[];
54
67
  walletChainType?: "ethereum" | "solana" | "ethereum-and-solana";
55
- mode?: "signIn" | "link";
68
+ /**
69
+ * "connect" (default) connects an external wallet client-side and resolves
70
+ * with it. "signIn"/"link" are SIWE/SIWS authentication intents that aren't
71
+ * implemented yet — they reject rather than silently succeed.
72
+ */
73
+ mode?: "connect" | "signIn" | "link";
56
74
  }
57
75
 
58
76
  interface ConnectWalletCallbacks {
@@ -68,6 +86,96 @@ interface UseConnectWallet {
68
86
  }
69
87
  declare function useConnectWallet(callbacks?: ConnectWalletCallbacks): UseConnectWallet;
70
88
 
89
+ /**
90
+ * Public types for the external-wallet connection layer.
91
+ *
92
+ * This layer is *connect-only*: it discovers installed external wallets
93
+ * (MetaMask/Phantom/etc.), connects one, and exposes the account plus a
94
+ * message-signing capability. It does NOT authenticate — SIWE/SIWS login is
95
+ * layered on top separately (see the external-wallet login work).
96
+ */
97
+ type ExternalWalletChain = "ethereum" | "solana";
98
+ interface ExternalWalletInfo {
99
+ /** Stable slug used to connect this wallet, e.g. "metamask", "phantom". */
100
+ id: string;
101
+ /** Human-readable display name. */
102
+ name: string;
103
+ /** Data/URI icon when the underlying adapter provides one. */
104
+ icon?: string;
105
+ chain: ExternalWalletChain;
106
+ /** Whether the wallet was detected as installed/available. */
107
+ installed: boolean;
108
+ /** How a connection is established for this wallet. */
109
+ connectVia: "injected" | "walletconnect" | "adapter";
110
+ }
111
+ interface ConnectedExternalWallet {
112
+ /** Connected account address (hex for EVM, base58 for Solana). */
113
+ address: string;
114
+ chain: ExternalWalletChain;
115
+ /** Backend `wallet_client_type` value, e.g. "metamask", "phantom". */
116
+ walletClientType: string;
117
+ /** CAIP-2 chain id, e.g. "eip155:1" (EVM) or "solana:mainnet". */
118
+ chainId?: string;
119
+ /**
120
+ * Request a signature from the connected wallet.
121
+ * Returns hex (EVM `personal_sign`) or base58 (Solana `signMessage`).
122
+ */
123
+ signMessage: (message: string | Uint8Array) => Promise<string>;
124
+ /** Best-effort disconnect (extensions may not support programmatic disconnect). */
125
+ disconnect: () => Promise<void>;
126
+ /** Underlying provider / adapter / WalletConnect session, for advanced use. */
127
+ raw: unknown;
128
+ }
129
+
130
+ type ExternalWalletStatus = "idle" | "connecting" | "connected" | "error";
131
+ interface UseExternalWalletsOptions {
132
+ /** Which chains to list/connect. Defaults to "all". */
133
+ chain?: ExternalWalletChain | "all";
134
+ /** CAIP-2 network for Solana signatures (default "solana:mainnet"). */
135
+ solanaNetwork?: string;
136
+ /** CAIP-2 or numeric chain id for EVM (default Ethereum mainnet). */
137
+ ethereumChainId?: string;
138
+ }
139
+ interface UseExternalWallets {
140
+ /** Detected external wallets for the requested chain(s). */
141
+ wallets: ExternalWalletInfo[];
142
+ /**
143
+ * Connect a detected wallet by id; resolves with the connected wallet.
144
+ * Pass `chain` to disambiguate multi-chain wallets (e.g. Phantom exists on
145
+ * both Ethereum and Solana).
146
+ */
147
+ connect: (walletId: string, chain?: ExternalWalletChain) => Promise<ConnectedExternalWallet>;
148
+ /** Disconnect the currently connected wallet (best effort). */
149
+ disconnect: () => Promise<void>;
150
+ connected: ConnectedExternalWallet | null;
151
+ status: ExternalWalletStatus;
152
+ error: Error | null;
153
+ /** Re-run wallet detection (e.g. after the user installs an extension). */
154
+ refresh: () => void;
155
+ }
156
+ /**
157
+ * Headless external-wallet connection hook.
158
+ *
159
+ * Connect-only: discovers installed wallets, connects one, and exposes the
160
+ * account + a `signMessage` capability. No SIWE/SIWS, no session — build your
161
+ * own UI, or use the prebuilt modal via `useConnectWallet`.
162
+ *
163
+ * Covers injected EVM wallets (EIP-6963) and Solana Wallet Standard adapters.
164
+ * For WalletConnect (mobile / QR), use the prebuilt modal (`useConnectWallet`)
165
+ * or the standalone `connectWalletConnect()` helper.
166
+ */
167
+ declare function useExternalWallets(options?: UseExternalWalletsOptions): UseExternalWallets;
168
+
169
+ /**
170
+ * The external wallets currently connected in this session (via
171
+ * `useExternalWallets` or the prebuilt modal), shared app-wide. Use this to
172
+ * surface connected wallets in a picker/account switcher and to sign with the
173
+ * selected one (each carries `signMessage`).
174
+ */
175
+ declare function useConnectedExternalWallets(): ConnectedExternalWallet[];
176
+ /** Disconnect a connected external wallet and remove it from the shared store. */
177
+ declare function disconnectExternalWallet(wallet: ConnectedExternalWallet): Promise<void>;
178
+
71
179
  interface DetachOAuthResult {
72
180
  success: boolean;
73
181
  message?: string;
@@ -168,7 +276,7 @@ interface MoonXProviderProps$1 {
168
276
  children: React.ReactNode;
169
277
  onClose?: () => void;
170
278
  }
171
- interface MoonKeyInstance {
279
+ interface MoonXInstance {
172
280
  ready: boolean;
173
281
  isAuthenticated: boolean;
174
282
  user: any | null;
@@ -277,9 +385,9 @@ interface WalletConfig {
277
385
  network: "mainnet" | "testnet" | "devnet";
278
386
  rpcUrl?: string;
279
387
  }
280
- type WalletType = "solana" | "ethereum";
388
+ type WalletType = "solana" | "ethereum" | "tron";
281
389
 
282
- declare const useMoonX: () => MoonKeyInstance;
390
+ declare const useMoonX: () => MoonXInstance;
283
391
 
284
392
  interface UseOAuthCompletionOptions {
285
393
  onSuccess?: (data: any) => void;
@@ -296,10 +404,10 @@ interface MoonXProviderProps {
296
404
  declare const MoonXProvider: React$1.FC<MoonXProviderProps>;
297
405
 
298
406
  /**
299
- * MoonKey Theme - matches CSS variables from styles.css:66-95
407
+ * MoonX Theme - matches CSS variables from styles.css:66-95
300
408
  * Only customizable properties are included (colors, border-radius, font-family)
301
409
  */
302
- interface MoonKeyTheme {
410
+ interface MoonXTheme {
303
411
  colors: {
304
412
  accent: string;
305
413
  accentForeground: string;
@@ -330,13 +438,13 @@ interface MoonKeyTheme {
330
438
  };
331
439
  fontFamily: string;
332
440
  }
333
- declare const lightTheme: MoonKeyTheme;
334
- declare const darkTheme: MoonKeyTheme;
441
+ declare const lightTheme: MoonXTheme;
442
+ declare const darkTheme: MoonXTheme;
335
443
  /**
336
- * Converts MoonKeyTheme to CSS custom properties
444
+ * Converts MoonXTheme to CSS custom properties
337
445
  * Maps ONLY to the 25 variables defined in styles.css:66-95
338
446
  */
339
- declare function themeToCSS(theme: MoonKeyTheme): React.CSSProperties;
447
+ declare function themeToCSS(theme: MoonXTheme): React.CSSProperties;
340
448
 
341
449
  /**
342
450
  * Decide whether a CSS color reads as "dark" from its perceived luminance.
@@ -357,7 +465,7 @@ declare function isColorDark(color: string): boolean | undefined;
357
465
  * - otherwise (omitted, or "auto" with no `matchMedia`) — inferred from the
358
466
  * background color's luminance.
359
467
  */
360
- declare function isDarkMode(theme?: Partial<MoonKeyTheme> | FlexibleTheme, displayMode?: DisplayMode, backgroundColor?: string): boolean;
468
+ declare function isDarkMode(theme?: Partial<MoonXTheme> | FlexibleTheme, displayMode?: DisplayMode, backgroundColor?: string): boolean;
361
469
 
362
470
  declare function isDarkAppearance(appearance: AuthAppearance | undefined): boolean;
363
471
  /** Return a shallow copy of `src` containing only defined, non-empty values. */
@@ -386,7 +494,7 @@ declare function resolveLogo(logo: AuthAppearance["logo"], isDark: boolean): {
386
494
  * Merge priority (lowest → highest): accent/background derivations →
387
495
  * `appearance.colors` + per-mode (`appearance.light` / `dark`).
388
496
  */
389
- declare function appearanceToTheme(appearance: AuthAppearance | undefined, isDark?: boolean): Partial<MoonKeyTheme>;
497
+ declare function appearanceToTheme(appearance: AuthAppearance | undefined, isDark?: boolean): Partial<MoonXTheme>;
390
498
  /**
391
499
  * Derives the newer `--moonx-*` CSS variables (warning/info/link/ring colors,
392
500
  * granular radii, typography scale, card and backdrop tokens) from an
@@ -441,4 +549,61 @@ declare const getReconnectionInfo: (error: any) => {
441
549
  walletAddress?: string;
442
550
  } | null;
443
551
 
444
- export { type AttachOAuthState, type BaseConnectedEthereumWallet, type BaseConnectedSolanaWallet, type ConnectWalletCallbacks, type ConnectWalletParams, type DetachOAuthResult, type DetachOAuthState, type MoonKeyInstance, type MoonKeyTheme, type MoonXConfig, MoonXProvider, type MoonXProviderProps$1 as MoonXProviderProps, type OAuthAttachResult, type OAuthProvider, type OAuthState, type OAuthUser, SessionExpiredError, SessionNotFoundError, type UseAttachOAuth, type UseAttachOAuthCallbacks, type UseConnectWallet, type UseDetachOAuth, type UseDetachOAuthCallbacks, type UseLoginWithOAuth, type UseLoginWithOAuthCallbacks, type WalletConfig, type WalletInstance, type WalletType, appearanceToComponentVars, appearanceToCssVars, appearanceToMoonxVars, appearanceToTheme, darkTheme, definedOnly, getReconnectionInfo, isColorDark, isDarkAppearance, isDarkMode, lightTheme, requiresReconnection, resolveAppearanceTokens, resolveFontUrls, resolveLogo, themeToCSS, useAttachOAuth, useConnectWallet, useDetachOAuth, useLoginWithOAuth, useMoonX, useOAuthCompletion };
552
+ interface ConnectEthereumOptions {
553
+ /** EIP-1193 provider (browser extension) or a WalletConnect client. */
554
+ provider: any;
555
+ /** Backend `wallet_client_type`, e.g. "metamask". */
556
+ walletClientType: string;
557
+ /** WalletConnect session (present for WalletConnect connections). */
558
+ session?: any;
559
+ /** CAIP-2 or numeric chain id; defaults to Ethereum mainnet. */
560
+ chainId?: string;
561
+ }
562
+ /**
563
+ * Connect an EVM wallet and return a chain-agnostic {@link ConnectedExternalWallet}.
564
+ * Pure connection primitive — no SIWE, no iframe, no session.
565
+ */
566
+ declare function connectEthereumProvider({ provider, walletClientType, session, chainId, }: ConnectEthereumOptions): Promise<ConnectedExternalWallet>;
567
+
568
+ interface ConnectSolanaOptions {
569
+ /** A `@solana/wallet-adapter` adapter instance (see `getWalletAdapter`). */
570
+ adapter: any;
571
+ /** CAIP-2 network for the returned `chainId`; defaults to "solana:mainnet". */
572
+ network?: string;
573
+ }
574
+ /**
575
+ * Connect a Solana wallet adapter and return a chain-agnostic
576
+ * {@link ConnectedExternalWallet}. Pure connection primitive — no SIWS,
577
+ * no iframe, no session.
578
+ */
579
+ declare function connectSolanaAdapter({ adapter, network, }: ConnectSolanaOptions): Promise<ConnectedExternalWallet>;
580
+
581
+ interface ConnectWalletConnectOptions {
582
+ /** An initialized WalletConnect v2 SignClient (from MoonXProvider). */
583
+ client: any;
584
+ /** CAIP-2 chains to request. Defaults to Ethereum mainnet. */
585
+ chains?: string[];
586
+ /** Backend `wallet_client_type`. */
587
+ walletClientType?: string;
588
+ }
589
+ /**
590
+ * Begin a WalletConnect v2 connection. Returns the pairing `uri` — render it as
591
+ * a QR code / deep link — plus `approval`, which resolves once the user
592
+ * approves in their wallet, yielding a chain-agnostic
593
+ * {@link ConnectedExternalWallet} (EVM). Connect-only; no SIWE. This is the
594
+ * path that covers mobile / non-injected wallets.
595
+ */
596
+ declare function connectWalletConnect({ client, chains, walletClientType, }: ConnectWalletConnectOptions): Promise<{
597
+ uri: string;
598
+ approval: () => Promise<ConnectedExternalWallet>;
599
+ }>;
600
+
601
+ /** Resolve an injected EVM provider by wallet id. Null when not installed. */
602
+ declare const getEthereumWalletProvider: (id: string) => {
603
+ provider: any;
604
+ walletClientType: string;
605
+ } | null;
606
+ /** List detectable external wallets for the requested chain(s). */
607
+ declare const listExternalWallets: (chain?: ExternalWalletChain | "all") => Promise<ExternalWalletInfo[]>;
608
+
609
+ export { type AttachOAuthState, type BaseConnectedEthereumWallet, type BaseConnectedSolanaWallet, type ConnectEthereumOptions, type ConnectSolanaOptions, type ConnectWalletCallbacks, type ConnectWalletConnectOptions, type ConnectWalletParams, type ConnectedExternalWallet, type DetachOAuthResult, type DetachOAuthState, type ExternalWalletChain, type ExternalWalletInfo, type ExternalWalletStatus, type MoonXConfig, type MoonXInstance, MoonXProvider, type MoonXProviderProps$1 as MoonXProviderProps, type MoonXTheme, type OAuthAttachResult, type OAuthProvider, type OAuthState, type OAuthUser, SessionExpiredError, SessionNotFoundError, type UseAttachOAuth, type UseAttachOAuthCallbacks, type UseConnectWallet, type UseDetachOAuth, type UseDetachOAuthCallbacks, type UseExternalWallets, type UseExternalWalletsOptions, type UseLoginWithOAuth, type UseLoginWithOAuthCallbacks, type WalletConfig, type WalletInstance, type WalletType, appearanceToComponentVars, appearanceToCssVars, appearanceToMoonxVars, appearanceToTheme, connectEthereumProvider, connectSolanaAdapter, connectWalletConnect, darkTheme, definedOnly, disconnectExternalWallet, getEthereumWalletProvider, getReconnectionInfo, isColorDark, isDarkAppearance, isDarkMode, lightTheme, listExternalWallets, requiresReconnection, resolveAppearanceTokens, resolveFontUrls, resolveLogo, themeToCSS, useAttachOAuth, useConnectWallet, useConnectedExternalWallets, useDetachOAuth, useExternalWallets, useLoginWithOAuth, useMoonX, useOAuthCompletion };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  export { LoginWithEmailState, PasskeyStatusEntry, RegisterPasskeyResult, UseAddPasskeyResult, UseEphemeralSignerResult, UseLoginWithEmailCallbacks, UsePasskeyStatusResult, UseRemovePasskeyResult, useAddPasskey, useEphemeralSigner, useLoginWithEmail, usePasskeyStatus, useRegisterPasskey, useRemovePasskey, useUser } from '@moon-x/core/react';
2
- import { WalletListEntry, LogoutResponse, EmailOtpFlowState, AuthAppearance, SendEmailOtpResponse, PrefillConfig, WalletChainType, PasskeyEnrollConfig, SignMessageConfig, ExportKeyConfig, SignTransactionConfig, SendTransactionConfig, ChainConfigItem, Wallet, FlexibleTheme, DisplayMode, AppearanceModeTokens } from '@moon-x/core/types';
2
+ import { WalletListEntry, AuthAppearance, PrefillConfig, WalletChainType, PasskeyEnrollConfig, SignMessageConfig, ExportKeyConfig, SignTransactionConfig, SendTransactionConfig, ChainConfigItem, LogoutResponse, EmailOtpFlowState, SendEmailOtpResponse, Wallet, FlexibleTheme, DisplayMode, AppearanceModeTokens } from '@moon-x/core/types';
3
3
  export { AppearanceBackdrop, AppearanceBorderRadius, AppearanceCard, AppearanceColors, AppearanceComponents, AppearanceLogo, AppearanceModeTokens, AppearanceTypography, AuthAppearance, Chain, ChainConfigItem, ChainEntry, ComponentStyle, DisplayMode, EphemeralSigner, EphemeralSignerChain, EphemeralSignerScheme, EphemeralSignerWallet, EvmChainEntry, Factor, IdpProvider, ListEphemeralSignersResult, Network, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, PublicEthereumWallet, PublicWallet, RevokeEphemeralSignerParams, SolanaChainEntry, WalletConnectConfig, WalletListEntry } from '@moon-x/core/types';
4
4
  import React$1, { ReactNode } from 'react';
5
- export { e as ethereum } from './ethereum-Eg3cJKce.js';
6
- export { s as solana } from './solana-C9rN8lxH.js';
5
+ export { e as ethereum } from './ethereum-B0bChy5v.js';
6
+ export { s as solana } from './solana-D2QJgky5.js';
7
+ export { t as tron } from './tron-KzJqr-zA.js';
7
8
  export { buildChainIndex, estimateEvmGas, estimateEvmGasReserve, getChainById, getEvmGasPrice, getEvmMaxPriorityFeePerGas, getEvmNonce, getRpcUrl, isChainSupported, isEvmEntry, normalizeChainKey, resolveChainEntry, resolveRpcUrl, resolveSolanaChainEntry, resolveWsUrl, validateChainConfig } from '@moon-x/core/lib';
8
9
  export { arbitrum, arbitrumSepolia, avalanche, avalancheFuji, base, baseSepolia, bsc, bscTestnet, goerli, holesky, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, sepolia } from 'viem/chains';
9
- import './base-wallet-CzJLpndu.js';
10
+ import './base-wallet-SjY7osPg.js';
10
11
  import '@moon-x/core';
11
12
 
12
13
  type OAuthProvider$1 = "google" | "apple";
@@ -42,17 +43,34 @@ interface BaseConnectedEthereumWallet {
42
43
  wallet_type: "ethereum";
43
44
  chain_id?: string;
44
45
  connector?: any;
46
+ /** Backend `wallet_client_type`, e.g. "metamask". */
47
+ walletClientType?: string;
48
+ /** Sign a message with the connected wallet (returns a hex signature). */
49
+ signMessage?: (message: string | Uint8Array) => Promise<string>;
50
+ /** Best-effort disconnect. */
51
+ disconnect?: () => Promise<void>;
45
52
  }
46
53
  interface BaseConnectedSolanaWallet {
47
54
  public_address: string;
48
55
  wallet_type: "solana";
49
56
  chain_id?: string;
57
+ /** Backend `wallet_client_type`, e.g. "phantom". */
58
+ walletClientType?: string;
59
+ /** Sign a message with the connected wallet (returns a base58 signature). */
60
+ signMessage?: (message: string | Uint8Array) => Promise<string>;
61
+ /** Best-effort disconnect. */
62
+ disconnect?: () => Promise<void>;
50
63
  }
51
64
  interface ConnectWalletParams {
52
65
  description?: string;
53
66
  walletList?: WalletListEntry[];
54
67
  walletChainType?: "ethereum" | "solana" | "ethereum-and-solana";
55
- mode?: "signIn" | "link";
68
+ /**
69
+ * "connect" (default) connects an external wallet client-side and resolves
70
+ * with it. "signIn"/"link" are SIWE/SIWS authentication intents that aren't
71
+ * implemented yet — they reject rather than silently succeed.
72
+ */
73
+ mode?: "connect" | "signIn" | "link";
56
74
  }
57
75
 
58
76
  interface ConnectWalletCallbacks {
@@ -68,6 +86,96 @@ interface UseConnectWallet {
68
86
  }
69
87
  declare function useConnectWallet(callbacks?: ConnectWalletCallbacks): UseConnectWallet;
70
88
 
89
+ /**
90
+ * Public types for the external-wallet connection layer.
91
+ *
92
+ * This layer is *connect-only*: it discovers installed external wallets
93
+ * (MetaMask/Phantom/etc.), connects one, and exposes the account plus a
94
+ * message-signing capability. It does NOT authenticate — SIWE/SIWS login is
95
+ * layered on top separately (see the external-wallet login work).
96
+ */
97
+ type ExternalWalletChain = "ethereum" | "solana";
98
+ interface ExternalWalletInfo {
99
+ /** Stable slug used to connect this wallet, e.g. "metamask", "phantom". */
100
+ id: string;
101
+ /** Human-readable display name. */
102
+ name: string;
103
+ /** Data/URI icon when the underlying adapter provides one. */
104
+ icon?: string;
105
+ chain: ExternalWalletChain;
106
+ /** Whether the wallet was detected as installed/available. */
107
+ installed: boolean;
108
+ /** How a connection is established for this wallet. */
109
+ connectVia: "injected" | "walletconnect" | "adapter";
110
+ }
111
+ interface ConnectedExternalWallet {
112
+ /** Connected account address (hex for EVM, base58 for Solana). */
113
+ address: string;
114
+ chain: ExternalWalletChain;
115
+ /** Backend `wallet_client_type` value, e.g. "metamask", "phantom". */
116
+ walletClientType: string;
117
+ /** CAIP-2 chain id, e.g. "eip155:1" (EVM) or "solana:mainnet". */
118
+ chainId?: string;
119
+ /**
120
+ * Request a signature from the connected wallet.
121
+ * Returns hex (EVM `personal_sign`) or base58 (Solana `signMessage`).
122
+ */
123
+ signMessage: (message: string | Uint8Array) => Promise<string>;
124
+ /** Best-effort disconnect (extensions may not support programmatic disconnect). */
125
+ disconnect: () => Promise<void>;
126
+ /** Underlying provider / adapter / WalletConnect session, for advanced use. */
127
+ raw: unknown;
128
+ }
129
+
130
+ type ExternalWalletStatus = "idle" | "connecting" | "connected" | "error";
131
+ interface UseExternalWalletsOptions {
132
+ /** Which chains to list/connect. Defaults to "all". */
133
+ chain?: ExternalWalletChain | "all";
134
+ /** CAIP-2 network for Solana signatures (default "solana:mainnet"). */
135
+ solanaNetwork?: string;
136
+ /** CAIP-2 or numeric chain id for EVM (default Ethereum mainnet). */
137
+ ethereumChainId?: string;
138
+ }
139
+ interface UseExternalWallets {
140
+ /** Detected external wallets for the requested chain(s). */
141
+ wallets: ExternalWalletInfo[];
142
+ /**
143
+ * Connect a detected wallet by id; resolves with the connected wallet.
144
+ * Pass `chain` to disambiguate multi-chain wallets (e.g. Phantom exists on
145
+ * both Ethereum and Solana).
146
+ */
147
+ connect: (walletId: string, chain?: ExternalWalletChain) => Promise<ConnectedExternalWallet>;
148
+ /** Disconnect the currently connected wallet (best effort). */
149
+ disconnect: () => Promise<void>;
150
+ connected: ConnectedExternalWallet | null;
151
+ status: ExternalWalletStatus;
152
+ error: Error | null;
153
+ /** Re-run wallet detection (e.g. after the user installs an extension). */
154
+ refresh: () => void;
155
+ }
156
+ /**
157
+ * Headless external-wallet connection hook.
158
+ *
159
+ * Connect-only: discovers installed wallets, connects one, and exposes the
160
+ * account + a `signMessage` capability. No SIWE/SIWS, no session — build your
161
+ * own UI, or use the prebuilt modal via `useConnectWallet`.
162
+ *
163
+ * Covers injected EVM wallets (EIP-6963) and Solana Wallet Standard adapters.
164
+ * For WalletConnect (mobile / QR), use the prebuilt modal (`useConnectWallet`)
165
+ * or the standalone `connectWalletConnect()` helper.
166
+ */
167
+ declare function useExternalWallets(options?: UseExternalWalletsOptions): UseExternalWallets;
168
+
169
+ /**
170
+ * The external wallets currently connected in this session (via
171
+ * `useExternalWallets` or the prebuilt modal), shared app-wide. Use this to
172
+ * surface connected wallets in a picker/account switcher and to sign with the
173
+ * selected one (each carries `signMessage`).
174
+ */
175
+ declare function useConnectedExternalWallets(): ConnectedExternalWallet[];
176
+ /** Disconnect a connected external wallet and remove it from the shared store. */
177
+ declare function disconnectExternalWallet(wallet: ConnectedExternalWallet): Promise<void>;
178
+
71
179
  interface DetachOAuthResult {
72
180
  success: boolean;
73
181
  message?: string;
@@ -168,7 +276,7 @@ interface MoonXProviderProps$1 {
168
276
  children: React.ReactNode;
169
277
  onClose?: () => void;
170
278
  }
171
- interface MoonKeyInstance {
279
+ interface MoonXInstance {
172
280
  ready: boolean;
173
281
  isAuthenticated: boolean;
174
282
  user: any | null;
@@ -277,9 +385,9 @@ interface WalletConfig {
277
385
  network: "mainnet" | "testnet" | "devnet";
278
386
  rpcUrl?: string;
279
387
  }
280
- type WalletType = "solana" | "ethereum";
388
+ type WalletType = "solana" | "ethereum" | "tron";
281
389
 
282
- declare const useMoonX: () => MoonKeyInstance;
390
+ declare const useMoonX: () => MoonXInstance;
283
391
 
284
392
  interface UseOAuthCompletionOptions {
285
393
  onSuccess?: (data: any) => void;
@@ -296,10 +404,10 @@ interface MoonXProviderProps {
296
404
  declare const MoonXProvider: React$1.FC<MoonXProviderProps>;
297
405
 
298
406
  /**
299
- * MoonKey Theme - matches CSS variables from styles.css:66-95
407
+ * MoonX Theme - matches CSS variables from styles.css:66-95
300
408
  * Only customizable properties are included (colors, border-radius, font-family)
301
409
  */
302
- interface MoonKeyTheme {
410
+ interface MoonXTheme {
303
411
  colors: {
304
412
  accent: string;
305
413
  accentForeground: string;
@@ -330,13 +438,13 @@ interface MoonKeyTheme {
330
438
  };
331
439
  fontFamily: string;
332
440
  }
333
- declare const lightTheme: MoonKeyTheme;
334
- declare const darkTheme: MoonKeyTheme;
441
+ declare const lightTheme: MoonXTheme;
442
+ declare const darkTheme: MoonXTheme;
335
443
  /**
336
- * Converts MoonKeyTheme to CSS custom properties
444
+ * Converts MoonXTheme to CSS custom properties
337
445
  * Maps ONLY to the 25 variables defined in styles.css:66-95
338
446
  */
339
- declare function themeToCSS(theme: MoonKeyTheme): React.CSSProperties;
447
+ declare function themeToCSS(theme: MoonXTheme): React.CSSProperties;
340
448
 
341
449
  /**
342
450
  * Decide whether a CSS color reads as "dark" from its perceived luminance.
@@ -357,7 +465,7 @@ declare function isColorDark(color: string): boolean | undefined;
357
465
  * - otherwise (omitted, or "auto" with no `matchMedia`) — inferred from the
358
466
  * background color's luminance.
359
467
  */
360
- declare function isDarkMode(theme?: Partial<MoonKeyTheme> | FlexibleTheme, displayMode?: DisplayMode, backgroundColor?: string): boolean;
468
+ declare function isDarkMode(theme?: Partial<MoonXTheme> | FlexibleTheme, displayMode?: DisplayMode, backgroundColor?: string): boolean;
361
469
 
362
470
  declare function isDarkAppearance(appearance: AuthAppearance | undefined): boolean;
363
471
  /** Return a shallow copy of `src` containing only defined, non-empty values. */
@@ -386,7 +494,7 @@ declare function resolveLogo(logo: AuthAppearance["logo"], isDark: boolean): {
386
494
  * Merge priority (lowest → highest): accent/background derivations →
387
495
  * `appearance.colors` + per-mode (`appearance.light` / `dark`).
388
496
  */
389
- declare function appearanceToTheme(appearance: AuthAppearance | undefined, isDark?: boolean): Partial<MoonKeyTheme>;
497
+ declare function appearanceToTheme(appearance: AuthAppearance | undefined, isDark?: boolean): Partial<MoonXTheme>;
390
498
  /**
391
499
  * Derives the newer `--moonx-*` CSS variables (warning/info/link/ring colors,
392
500
  * granular radii, typography scale, card and backdrop tokens) from an
@@ -441,4 +549,61 @@ declare const getReconnectionInfo: (error: any) => {
441
549
  walletAddress?: string;
442
550
  } | null;
443
551
 
444
- export { type AttachOAuthState, type BaseConnectedEthereumWallet, type BaseConnectedSolanaWallet, type ConnectWalletCallbacks, type ConnectWalletParams, type DetachOAuthResult, type DetachOAuthState, type MoonKeyInstance, type MoonKeyTheme, type MoonXConfig, MoonXProvider, type MoonXProviderProps$1 as MoonXProviderProps, type OAuthAttachResult, type OAuthProvider, type OAuthState, type OAuthUser, SessionExpiredError, SessionNotFoundError, type UseAttachOAuth, type UseAttachOAuthCallbacks, type UseConnectWallet, type UseDetachOAuth, type UseDetachOAuthCallbacks, type UseLoginWithOAuth, type UseLoginWithOAuthCallbacks, type WalletConfig, type WalletInstance, type WalletType, appearanceToComponentVars, appearanceToCssVars, appearanceToMoonxVars, appearanceToTheme, darkTheme, definedOnly, getReconnectionInfo, isColorDark, isDarkAppearance, isDarkMode, lightTheme, requiresReconnection, resolveAppearanceTokens, resolveFontUrls, resolveLogo, themeToCSS, useAttachOAuth, useConnectWallet, useDetachOAuth, useLoginWithOAuth, useMoonX, useOAuthCompletion };
552
+ interface ConnectEthereumOptions {
553
+ /** EIP-1193 provider (browser extension) or a WalletConnect client. */
554
+ provider: any;
555
+ /** Backend `wallet_client_type`, e.g. "metamask". */
556
+ walletClientType: string;
557
+ /** WalletConnect session (present for WalletConnect connections). */
558
+ session?: any;
559
+ /** CAIP-2 or numeric chain id; defaults to Ethereum mainnet. */
560
+ chainId?: string;
561
+ }
562
+ /**
563
+ * Connect an EVM wallet and return a chain-agnostic {@link ConnectedExternalWallet}.
564
+ * Pure connection primitive — no SIWE, no iframe, no session.
565
+ */
566
+ declare function connectEthereumProvider({ provider, walletClientType, session, chainId, }: ConnectEthereumOptions): Promise<ConnectedExternalWallet>;
567
+
568
+ interface ConnectSolanaOptions {
569
+ /** A `@solana/wallet-adapter` adapter instance (see `getWalletAdapter`). */
570
+ adapter: any;
571
+ /** CAIP-2 network for the returned `chainId`; defaults to "solana:mainnet". */
572
+ network?: string;
573
+ }
574
+ /**
575
+ * Connect a Solana wallet adapter and return a chain-agnostic
576
+ * {@link ConnectedExternalWallet}. Pure connection primitive — no SIWS,
577
+ * no iframe, no session.
578
+ */
579
+ declare function connectSolanaAdapter({ adapter, network, }: ConnectSolanaOptions): Promise<ConnectedExternalWallet>;
580
+
581
+ interface ConnectWalletConnectOptions {
582
+ /** An initialized WalletConnect v2 SignClient (from MoonXProvider). */
583
+ client: any;
584
+ /** CAIP-2 chains to request. Defaults to Ethereum mainnet. */
585
+ chains?: string[];
586
+ /** Backend `wallet_client_type`. */
587
+ walletClientType?: string;
588
+ }
589
+ /**
590
+ * Begin a WalletConnect v2 connection. Returns the pairing `uri` — render it as
591
+ * a QR code / deep link — plus `approval`, which resolves once the user
592
+ * approves in their wallet, yielding a chain-agnostic
593
+ * {@link ConnectedExternalWallet} (EVM). Connect-only; no SIWE. This is the
594
+ * path that covers mobile / non-injected wallets.
595
+ */
596
+ declare function connectWalletConnect({ client, chains, walletClientType, }: ConnectWalletConnectOptions): Promise<{
597
+ uri: string;
598
+ approval: () => Promise<ConnectedExternalWallet>;
599
+ }>;
600
+
601
+ /** Resolve an injected EVM provider by wallet id. Null when not installed. */
602
+ declare const getEthereumWalletProvider: (id: string) => {
603
+ provider: any;
604
+ walletClientType: string;
605
+ } | null;
606
+ /** List detectable external wallets for the requested chain(s). */
607
+ declare const listExternalWallets: (chain?: ExternalWalletChain | "all") => Promise<ExternalWalletInfo[]>;
608
+
609
+ export { type AttachOAuthState, type BaseConnectedEthereumWallet, type BaseConnectedSolanaWallet, type ConnectEthereumOptions, type ConnectSolanaOptions, type ConnectWalletCallbacks, type ConnectWalletConnectOptions, type ConnectWalletParams, type ConnectedExternalWallet, type DetachOAuthResult, type DetachOAuthState, type ExternalWalletChain, type ExternalWalletInfo, type ExternalWalletStatus, type MoonXConfig, type MoonXInstance, MoonXProvider, type MoonXProviderProps$1 as MoonXProviderProps, type MoonXTheme, type OAuthAttachResult, type OAuthProvider, type OAuthState, type OAuthUser, SessionExpiredError, SessionNotFoundError, type UseAttachOAuth, type UseAttachOAuthCallbacks, type UseConnectWallet, type UseDetachOAuth, type UseDetachOAuthCallbacks, type UseExternalWallets, type UseExternalWalletsOptions, type UseLoginWithOAuth, type UseLoginWithOAuthCallbacks, type WalletConfig, type WalletInstance, type WalletType, appearanceToComponentVars, appearanceToCssVars, appearanceToMoonxVars, appearanceToTheme, connectEthereumProvider, connectSolanaAdapter, connectWalletConnect, darkTheme, definedOnly, disconnectExternalWallet, getEthereumWalletProvider, getReconnectionInfo, isColorDark, isDarkAppearance, isDarkMode, lightTheme, listExternalWallets, requiresReconnection, resolveAppearanceTokens, resolveFontUrls, resolveLogo, themeToCSS, useAttachOAuth, useConnectWallet, useConnectedExternalWallets, useDetachOAuth, useExternalWallets, useLoginWithOAuth, useMoonX, useOAuthCompletion };