@moon-x/react-sdk 0.8.1 → 0.9.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.
@@ -38,22 +38,30 @@ interface EthereumSignTransactionParams extends BaseSignTransactionParams {
38
38
  uiOptions?: BaseUIOptions;
39
39
  };
40
40
  }
41
- interface EthereumSendTransactionParams extends BaseSendTransactionParams {
41
+ interface EthereumSendTransactionParams extends Omit<BaseSendTransactionParams, "rpcUrl"> {
42
42
  wallet: PublicWallet;
43
+ /** Per-call chain selector: alias | CAIP-2 id | numeric chainId. */
44
+ chain?: string | number;
45
+ /** Inline RPC override for this call; falls back to provider config. */
46
+ rpcUrl?: string;
43
47
  options?: {
44
48
  uiOptions?: BaseUIOptions;
45
49
  network?: string;
46
50
  };
47
51
  }
48
52
  interface EthereumGetBalanceParams extends BaseGetBalanceParams {
49
- chain?: string;
53
+ /** Per-call chain selector: alias | CAIP-2 id | numeric chainId. */
54
+ chain?: string | number;
55
+ /** Inline RPC override for this call; falls back to provider config. */
56
+ rpcUrl?: string;
50
57
  options?: {
51
58
  commitment?: TransactionCommitment;
52
59
  minContextSlot?: number;
53
60
  };
54
61
  }
55
62
  interface EthereumGetTokenAccountsParams extends BaseGetTokenAccountsParams {
56
- chain?: string;
63
+ chain?: string | number;
64
+ rpcUrl?: string;
57
65
  mint?: string;
58
66
  programId?: string;
59
67
  options?: {
@@ -165,9 +173,10 @@ declare const useSignMessage: () => {
165
173
  error: undefined;
166
174
  };
167
175
  declare const useSignTransaction: () => {
168
- signTransaction: ({ transaction, wallet, options, }: {
176
+ signTransaction: ({ transaction, wallet, chain, options, }: {
169
177
  transaction: string | object;
170
178
  wallet: PublicWallet;
179
+ chain?: string | number;
171
180
  options?: {
172
181
  uiOptions?: SignTransactionUIOptions;
173
182
  };
@@ -209,11 +218,12 @@ declare const useSignTypedData: () => {
209
218
  error: undefined;
210
219
  };
211
220
  declare const useSign7702Authorization: () => {
212
- signAuthorization: ({ contractAddress, nonce, executor, wallet, options, }: {
221
+ signAuthorization: ({ contractAddress, nonce, executor, wallet, chain, options, }: {
213
222
  contractAddress: `0x${string}`;
214
223
  nonce?: number;
215
224
  executor?: "self" | `0x${string}`;
216
225
  wallet: PublicWallet | PublicEthereumWallet;
226
+ chain?: string | number;
217
227
  options?: {
218
228
  uiOptions?: any;
219
229
  };
@@ -230,7 +240,7 @@ declare const useSign7702Authorization: () => {
230
240
  error: undefined;
231
241
  };
232
242
  declare const useSendTransaction: () => {
233
- sendTransaction: ({ transaction, wallet, options, }: {
243
+ sendTransaction: ({ transaction, wallet, chain, rpcUrl: rpcUrlOverride, options, }: {
234
244
  transaction: {
235
245
  to?: string;
236
246
  value?: string | number | bigint;
@@ -244,6 +254,10 @@ declare const useSendTransaction: () => {
244
254
  maxFeePerGas?: string | number | bigint;
245
255
  };
246
256
  wallet: PublicWallet | PublicEthereumWallet;
257
+ /** Per-call chain selector: alias | CAIP-2 id | numeric chainId. */
258
+ chain?: string | number;
259
+ /** Inline RPC override; falls back to provider config when omitted. */
260
+ rpcUrl?: string;
247
261
  options?: {
248
262
  uiOptions?: any;
249
263
  };
@@ -38,22 +38,30 @@ interface EthereumSignTransactionParams extends BaseSignTransactionParams {
38
38
  uiOptions?: BaseUIOptions;
39
39
  };
40
40
  }
41
- interface EthereumSendTransactionParams extends BaseSendTransactionParams {
41
+ interface EthereumSendTransactionParams extends Omit<BaseSendTransactionParams, "rpcUrl"> {
42
42
  wallet: PublicWallet;
43
+ /** Per-call chain selector: alias | CAIP-2 id | numeric chainId. */
44
+ chain?: string | number;
45
+ /** Inline RPC override for this call; falls back to provider config. */
46
+ rpcUrl?: string;
43
47
  options?: {
44
48
  uiOptions?: BaseUIOptions;
45
49
  network?: string;
46
50
  };
47
51
  }
48
52
  interface EthereumGetBalanceParams extends BaseGetBalanceParams {
49
- chain?: string;
53
+ /** Per-call chain selector: alias | CAIP-2 id | numeric chainId. */
54
+ chain?: string | number;
55
+ /** Inline RPC override for this call; falls back to provider config. */
56
+ rpcUrl?: string;
50
57
  options?: {
51
58
  commitment?: TransactionCommitment;
52
59
  minContextSlot?: number;
53
60
  };
54
61
  }
55
62
  interface EthereumGetTokenAccountsParams extends BaseGetTokenAccountsParams {
56
- chain?: string;
63
+ chain?: string | number;
64
+ rpcUrl?: string;
57
65
  mint?: string;
58
66
  programId?: string;
59
67
  options?: {
@@ -165,9 +173,10 @@ declare const useSignMessage: () => {
165
173
  error: undefined;
166
174
  };
167
175
  declare const useSignTransaction: () => {
168
- signTransaction: ({ transaction, wallet, options, }: {
176
+ signTransaction: ({ transaction, wallet, chain, options, }: {
169
177
  transaction: string | object;
170
178
  wallet: PublicWallet;
179
+ chain?: string | number;
171
180
  options?: {
172
181
  uiOptions?: SignTransactionUIOptions;
173
182
  };
@@ -209,11 +218,12 @@ declare const useSignTypedData: () => {
209
218
  error: undefined;
210
219
  };
211
220
  declare const useSign7702Authorization: () => {
212
- signAuthorization: ({ contractAddress, nonce, executor, wallet, options, }: {
221
+ signAuthorization: ({ contractAddress, nonce, executor, wallet, chain, options, }: {
213
222
  contractAddress: `0x${string}`;
214
223
  nonce?: number;
215
224
  executor?: "self" | `0x${string}`;
216
225
  wallet: PublicWallet | PublicEthereumWallet;
226
+ chain?: string | number;
217
227
  options?: {
218
228
  uiOptions?: any;
219
229
  };
@@ -230,7 +240,7 @@ declare const useSign7702Authorization: () => {
230
240
  error: undefined;
231
241
  };
232
242
  declare const useSendTransaction: () => {
233
- sendTransaction: ({ transaction, wallet, options, }: {
243
+ sendTransaction: ({ transaction, wallet, chain, rpcUrl: rpcUrlOverride, options, }: {
234
244
  transaction: {
235
245
  to?: string;
236
246
  value?: string | number | bigint;
@@ -244,6 +254,10 @@ declare const useSendTransaction: () => {
244
254
  maxFeePerGas?: string | number | bigint;
245
255
  };
246
256
  wallet: PublicWallet | PublicEthereumWallet;
257
+ /** Per-call chain selector: alias | CAIP-2 id | numeric chainId. */
258
+ chain?: string | number;
259
+ /** Inline RPC override; falls back to provider config when omitted. */
260
+ rpcUrl?: string;
247
261
  options?: {
248
262
  uiOptions?: any;
249
263
  };
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
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, AuthAppearance, PrefillConfig, WalletChainType, MoonKeyThemeConfig, PasskeyEnrollConfig, SignMessageConfig, ExportKeyConfig, SignTransactionConfig, SendTransactionConfig, Chain, LogoutResponse, EmailOtpFlowState, SendEmailOtpResponse, Wallet } from '@moon-x/core/types';
3
- export { Chain, EphemeralSigner, EphemeralSignerChain, EphemeralSignerScheme, EphemeralSignerWallet, Factor, IdpProvider, ListEphemeralSignersResult, Network, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, PublicEthereumWallet, PublicWallet, RevokeEphemeralSignerParams, WalletConnectConfig, WalletListEntry } 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
+ 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-CGSlkQOw.mjs';
6
- export { s as solana } from './solana-Cr7r3wi8.mjs';
7
- export { estimateEvmGas, estimateEvmGasReserve, getChainById, getDefaultChain, getEvmGasPrice, getEvmMaxPriorityFeePerGas, getEvmNonce, getRpcUrl, isChainSupported, setChainRpcUrl, validateChainConfig } from '@moon-x/core/lib';
5
+ export { e as ethereum } from './ethereum-lovLlqC2.mjs';
6
+ export { s as solana } from './solana-BVrNImZ1.mjs';
7
+ export { buildChainIndex, estimateEvmGas, estimateEvmGasReserve, getChainById, getEvmGasPrice, getEvmMaxPriorityFeePerGas, getEvmNonce, getRpcUrl, isChainSupported, isEvmEntry, normalizeChainKey, resolveChainEntry, resolveRpcUrl, resolveSolanaChainEntry, resolveWsUrl, validateChainConfig } from '@moon-x/core/lib';
8
8
  export { arbitrum, arbitrumSepolia, avalanche, avalancheFuji, base, baseSepolia, bsc, bscTestnet, goerli, holesky, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, sepolia } from 'viem/chains';
9
9
  import './base-wallet-CzJLpndu.mjs';
10
10
  import '@moon-x/core';
@@ -131,7 +131,6 @@ interface MoonKeyConfig {
131
131
  prefill?: PrefillConfig;
132
132
  walletChainType?: WalletChainType;
133
133
  isDark?: boolean;
134
- theme?: MoonKeyThemeConfig;
135
134
  emailConfig?: {
136
135
  skipVerifiedSuccess?: boolean;
137
136
  verifiedDisplayTime?: number;
@@ -150,16 +149,18 @@ interface MoonKeyConfig {
150
149
  walletConnect?: {
151
150
  projectId: string;
152
151
  };
153
- defaultChain?: Chain;
154
- supportedChains?: Chain[];
155
- solana?: {
156
- rpcs: {
157
- [key: string]: {
158
- rpc: string;
159
- rpcSubscriptions?: string;
160
- };
161
- };
162
- };
152
+ /**
153
+ * Unified RPC / chain config — one list covering EVM + Solana. Each element
154
+ * is a bare viem `Chain` (use its built-in RPC), an `{ chain, rpcUrl?, wsUrl? }`
155
+ * EVM entry (to override the RPC), or a `{ id, rpcUrl, wsUrl? }` Solana entry.
156
+ */
157
+ chains?: ChainConfigItem[];
158
+ /**
159
+ * Which configured chain to use by default. Referenced by alias, CAIP-2 id,
160
+ * or numeric chainId — e.g. "eth:base" | "eip155:8453" | 8453 |
161
+ * "solana:mainnet". Defaults to the first configured chain when omitted.
162
+ */
163
+ defaultChain?: string | number;
163
164
  }
164
165
  interface MoonKeyProviderProps$1 {
165
166
  publishableKey: string;
@@ -294,6 +295,134 @@ interface MoonKeyProviderProps {
294
295
  }
295
296
  declare const MoonKeyProvider: React$1.FC<MoonKeyProviderProps>;
296
297
 
298
+ /**
299
+ * MoonKey Theme - matches CSS variables from styles.css:66-95
300
+ * Only customizable properties are included (colors, border-radius, font-family)
301
+ */
302
+ interface MoonKeyTheme {
303
+ colors: {
304
+ accent: string;
305
+ accentForeground: string;
306
+ accentDark: string;
307
+ accentDarkest: string;
308
+ accentLight: string;
309
+ accentLightest: string;
310
+ background: string;
311
+ background2: string;
312
+ background3: string;
313
+ foreground: string;
314
+ foreground2: string;
315
+ foreground3: string;
316
+ foreground4: string;
317
+ foregroundAccent: string;
318
+ success: string;
319
+ successForeground: string;
320
+ error: string;
321
+ errorForeground: string;
322
+ errorLight: string;
323
+ border: string;
324
+ };
325
+ borderRadius: {
326
+ sm: string;
327
+ md: string;
328
+ lg: string;
329
+ full: string;
330
+ };
331
+ fontFamily: string;
332
+ }
333
+ declare const lightTheme: MoonKeyTheme;
334
+ declare const darkTheme: MoonKeyTheme;
335
+ /**
336
+ * Converts MoonKeyTheme to CSS custom properties
337
+ * Maps ONLY to the 25 variables defined in styles.css:66-95
338
+ */
339
+ declare function themeToCSS(theme: MoonKeyTheme): React.CSSProperties;
340
+
341
+ /**
342
+ * Decide whether a CSS color reads as "dark" from its perceived luminance.
343
+ *
344
+ * Handles hex (`#RGB`, `#RGBA`, `#RRGGBB`, `#RRGGBBAA` — the alpha byte is
345
+ * ignored) and `rgb()` / `rgba()` (comma- or space-separated, with `%` or 0–255
346
+ * channels). Returns `undefined` for any other syntax (`hsl()`, named colors,
347
+ * CSS vars) so callers can fall back to the resolved display mode instead of
348
+ * silently assuming "light".
349
+ */
350
+ declare function isColorDark(color: string): boolean | undefined;
351
+ /**
352
+ * Determines if dark mode should be used based on theme configuration.
353
+ *
354
+ * Resolution order:
355
+ * - `displayMode: "dark"` / `"light"` — explicit override, always wins.
356
+ * - `displayMode: "auto"` — follows the OS `prefers-color-scheme` (when available).
357
+ * - otherwise (omitted, or "auto" with no `matchMedia`) — inferred from the
358
+ * background color's luminance.
359
+ */
360
+ declare function isDarkMode(theme?: Partial<MoonKeyTheme> | FlexibleTheme, displayMode?: DisplayMode, backgroundColor?: string): boolean;
361
+
362
+ declare function isDarkAppearance(appearance: AuthAppearance | undefined): boolean;
363
+ /** Return a shallow copy of `src` containing only defined, non-empty values. */
364
+ declare function definedOnly<T extends object>(src: T | undefined): Partial<T>;
365
+ /**
366
+ * Resolve the deep design tokens set inline on an {@link AuthAppearance} into a
367
+ * single flat {@link AppearanceModeTokens}. Priority (low → high): the base
368
+ * token groups on `appearance` → per-mode (`appearance.light` when light /
369
+ * `appearance.dark` when dark). `appearance.borderRadius` is only folded here
370
+ * when given as an object (the preset string is expanded in appearanceToTheme).
371
+ */
372
+ declare function resolveAppearanceTokens(appearance: AuthAppearance | undefined, isDark: boolean): AppearanceModeTokens;
373
+ /**
374
+ * Resolve `appearance.logo` (string or object) into a concrete src plus
375
+ * optional sizing/alignment, picking the dark-mode variant when applicable.
376
+ */
377
+ declare function resolveLogo(logo: AuthAppearance["logo"], isDark: boolean): {
378
+ src: string;
379
+ height?: number;
380
+ align?: "left" | "center";
381
+ } | undefined;
382
+ /**
383
+ * Derives the `--moonkey-*` palette (colors / radius / font) from an
384
+ * AuthAppearance. Used by ScopedContainer so the SDK owns its own derivation.
385
+ *
386
+ * Merge priority (lowest → highest): accent/background derivations →
387
+ * `appearance.colors` + per-mode (`appearance.light` / `dark`).
388
+ */
389
+ declare function appearanceToTheme(appearance: AuthAppearance | undefined, isDark?: boolean): Partial<MoonKeyTheme>;
390
+ /**
391
+ * Derives the newer `--moonx-*` CSS variables (warning/info/link/ring colors,
392
+ * granular radii, typography scale, card and backdrop tokens) from an
393
+ * {@link AuthAppearance}. Only explicitly-set tokens are emitted, so components
394
+ * fall back to their `--moonkey-*` defaults via CSS `var(..., fallback)` when
395
+ * unset.
396
+ */
397
+ declare function appearanceToMoonxVars(appearance: AuthAppearance | undefined, isDark: boolean): Record<string, string>;
398
+ /**
399
+ * Derives per-component override CSS variables (`--moonx-<component>-*`) from
400
+ * `appearance.components`. Lets a host style the card / button / input
401
+ * independently; unset fields fall through to the global tokens.
402
+ */
403
+ declare function appearanceToComponentVars(appearance: AuthAppearance | undefined): Record<string, string>;
404
+ /**
405
+ * Collect the font URLs referenced by an appearance's typography tokens (base +
406
+ * per-mode) so the SDK can inject the corresponding <link rel="stylesheet">
407
+ * elements.
408
+ */
409
+ declare function resolveFontUrls(appearance: AuthAppearance | undefined): string[];
410
+ /**
411
+ * Resolve an {@link AuthAppearance} into the full flat CSS-variable map for
412
+ * surfaces that paint the appearance onto their own root (e.g. the demo applying
413
+ * it to `<html>`): the base light/dark `--moonkey-*` palette merged with the
414
+ * appearance derivations, plus the granular `--moonx-*` tokens and per-component
415
+ * overrides.
416
+ *
417
+ * Shares {@link appearanceToTheme} / {@link appearanceToMoonxVars} /
418
+ * {@link appearanceToComponentVars} with the SDK's {@link ScopedContainer} so
419
+ * the derivations stay aligned. Note this does NOT apply the resolved
420
+ * `customTheme` layer that ScopedContainer folds on top, so a host using
421
+ * AuthProvider's resolved theme is the source of truth for the embedded UI;
422
+ * this helper covers appearance-only surfaces.
423
+ */
424
+ declare function appearanceToCssVars(appearance: AuthAppearance | undefined, isDark: boolean): Record<string, string>;
425
+
297
426
  declare class SessionExpiredError extends Error {
298
427
  walletType: string;
299
428
  walletAddress?: string;
@@ -312,4 +441,4 @@ declare const getReconnectionInfo: (error: any) => {
312
441
  walletAddress?: string;
313
442
  } | null;
314
443
 
315
- export { type AttachOAuthState, type BaseConnectedEthereumWallet, type BaseConnectedSolanaWallet, type ConnectWalletCallbacks, type ConnectWalletParams, type DetachOAuthResult, type DetachOAuthState, type MoonKeyConfig, type MoonKeyInstance, MoonKeyProvider, type MoonKeyProviderProps$1 as MoonKeyProviderProps, 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, getReconnectionInfo, requiresReconnection, useAttachOAuth, useConnectWallet, useDetachOAuth, useLoginWithOAuth, useMoonKey, useOAuthCompletion };
444
+ export { type AttachOAuthState, type BaseConnectedEthereumWallet, type BaseConnectedSolanaWallet, type ConnectWalletCallbacks, type ConnectWalletParams, type DetachOAuthResult, type DetachOAuthState, type MoonKeyConfig, type MoonKeyInstance, MoonKeyProvider, type MoonKeyProviderProps$1 as MoonKeyProviderProps, type MoonKeyTheme, 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, useMoonKey, useOAuthCompletion };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
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, AuthAppearance, PrefillConfig, WalletChainType, MoonKeyThemeConfig, PasskeyEnrollConfig, SignMessageConfig, ExportKeyConfig, SignTransactionConfig, SendTransactionConfig, Chain, LogoutResponse, EmailOtpFlowState, SendEmailOtpResponse, Wallet } from '@moon-x/core/types';
3
- export { Chain, EphemeralSigner, EphemeralSignerChain, EphemeralSignerScheme, EphemeralSignerWallet, Factor, IdpProvider, ListEphemeralSignersResult, Network, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, PublicEthereumWallet, PublicWallet, RevokeEphemeralSignerParams, WalletConnectConfig, WalletListEntry } 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
+ 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-CWhbeptv.js';
6
- export { s as solana } from './solana-nUvZo4Zp.js';
7
- export { estimateEvmGas, estimateEvmGasReserve, getChainById, getDefaultChain, getEvmGasPrice, getEvmMaxPriorityFeePerGas, getEvmNonce, getRpcUrl, isChainSupported, setChainRpcUrl, validateChainConfig } from '@moon-x/core/lib';
5
+ export { e as ethereum } from './ethereum-Eg3cJKce.js';
6
+ export { s as solana } from './solana-C9rN8lxH.js';
7
+ export { buildChainIndex, estimateEvmGas, estimateEvmGasReserve, getChainById, getEvmGasPrice, getEvmMaxPriorityFeePerGas, getEvmNonce, getRpcUrl, isChainSupported, isEvmEntry, normalizeChainKey, resolveChainEntry, resolveRpcUrl, resolveSolanaChainEntry, resolveWsUrl, validateChainConfig } from '@moon-x/core/lib';
8
8
  export { arbitrum, arbitrumSepolia, avalanche, avalancheFuji, base, baseSepolia, bsc, bscTestnet, goerli, holesky, mainnet, optimism, optimismSepolia, polygon, polygonAmoy, sepolia } from 'viem/chains';
9
9
  import './base-wallet-CzJLpndu.js';
10
10
  import '@moon-x/core';
@@ -131,7 +131,6 @@ interface MoonKeyConfig {
131
131
  prefill?: PrefillConfig;
132
132
  walletChainType?: WalletChainType;
133
133
  isDark?: boolean;
134
- theme?: MoonKeyThemeConfig;
135
134
  emailConfig?: {
136
135
  skipVerifiedSuccess?: boolean;
137
136
  verifiedDisplayTime?: number;
@@ -150,16 +149,18 @@ interface MoonKeyConfig {
150
149
  walletConnect?: {
151
150
  projectId: string;
152
151
  };
153
- defaultChain?: Chain;
154
- supportedChains?: Chain[];
155
- solana?: {
156
- rpcs: {
157
- [key: string]: {
158
- rpc: string;
159
- rpcSubscriptions?: string;
160
- };
161
- };
162
- };
152
+ /**
153
+ * Unified RPC / chain config — one list covering EVM + Solana. Each element
154
+ * is a bare viem `Chain` (use its built-in RPC), an `{ chain, rpcUrl?, wsUrl? }`
155
+ * EVM entry (to override the RPC), or a `{ id, rpcUrl, wsUrl? }` Solana entry.
156
+ */
157
+ chains?: ChainConfigItem[];
158
+ /**
159
+ * Which configured chain to use by default. Referenced by alias, CAIP-2 id,
160
+ * or numeric chainId — e.g. "eth:base" | "eip155:8453" | 8453 |
161
+ * "solana:mainnet". Defaults to the first configured chain when omitted.
162
+ */
163
+ defaultChain?: string | number;
163
164
  }
164
165
  interface MoonKeyProviderProps$1 {
165
166
  publishableKey: string;
@@ -294,6 +295,134 @@ interface MoonKeyProviderProps {
294
295
  }
295
296
  declare const MoonKeyProvider: React$1.FC<MoonKeyProviderProps>;
296
297
 
298
+ /**
299
+ * MoonKey Theme - matches CSS variables from styles.css:66-95
300
+ * Only customizable properties are included (colors, border-radius, font-family)
301
+ */
302
+ interface MoonKeyTheme {
303
+ colors: {
304
+ accent: string;
305
+ accentForeground: string;
306
+ accentDark: string;
307
+ accentDarkest: string;
308
+ accentLight: string;
309
+ accentLightest: string;
310
+ background: string;
311
+ background2: string;
312
+ background3: string;
313
+ foreground: string;
314
+ foreground2: string;
315
+ foreground3: string;
316
+ foreground4: string;
317
+ foregroundAccent: string;
318
+ success: string;
319
+ successForeground: string;
320
+ error: string;
321
+ errorForeground: string;
322
+ errorLight: string;
323
+ border: string;
324
+ };
325
+ borderRadius: {
326
+ sm: string;
327
+ md: string;
328
+ lg: string;
329
+ full: string;
330
+ };
331
+ fontFamily: string;
332
+ }
333
+ declare const lightTheme: MoonKeyTheme;
334
+ declare const darkTheme: MoonKeyTheme;
335
+ /**
336
+ * Converts MoonKeyTheme to CSS custom properties
337
+ * Maps ONLY to the 25 variables defined in styles.css:66-95
338
+ */
339
+ declare function themeToCSS(theme: MoonKeyTheme): React.CSSProperties;
340
+
341
+ /**
342
+ * Decide whether a CSS color reads as "dark" from its perceived luminance.
343
+ *
344
+ * Handles hex (`#RGB`, `#RGBA`, `#RRGGBB`, `#RRGGBBAA` — the alpha byte is
345
+ * ignored) and `rgb()` / `rgba()` (comma- or space-separated, with `%` or 0–255
346
+ * channels). Returns `undefined` for any other syntax (`hsl()`, named colors,
347
+ * CSS vars) so callers can fall back to the resolved display mode instead of
348
+ * silently assuming "light".
349
+ */
350
+ declare function isColorDark(color: string): boolean | undefined;
351
+ /**
352
+ * Determines if dark mode should be used based on theme configuration.
353
+ *
354
+ * Resolution order:
355
+ * - `displayMode: "dark"` / `"light"` — explicit override, always wins.
356
+ * - `displayMode: "auto"` — follows the OS `prefers-color-scheme` (when available).
357
+ * - otherwise (omitted, or "auto" with no `matchMedia`) — inferred from the
358
+ * background color's luminance.
359
+ */
360
+ declare function isDarkMode(theme?: Partial<MoonKeyTheme> | FlexibleTheme, displayMode?: DisplayMode, backgroundColor?: string): boolean;
361
+
362
+ declare function isDarkAppearance(appearance: AuthAppearance | undefined): boolean;
363
+ /** Return a shallow copy of `src` containing only defined, non-empty values. */
364
+ declare function definedOnly<T extends object>(src: T | undefined): Partial<T>;
365
+ /**
366
+ * Resolve the deep design tokens set inline on an {@link AuthAppearance} into a
367
+ * single flat {@link AppearanceModeTokens}. Priority (low → high): the base
368
+ * token groups on `appearance` → per-mode (`appearance.light` when light /
369
+ * `appearance.dark` when dark). `appearance.borderRadius` is only folded here
370
+ * when given as an object (the preset string is expanded in appearanceToTheme).
371
+ */
372
+ declare function resolveAppearanceTokens(appearance: AuthAppearance | undefined, isDark: boolean): AppearanceModeTokens;
373
+ /**
374
+ * Resolve `appearance.logo` (string or object) into a concrete src plus
375
+ * optional sizing/alignment, picking the dark-mode variant when applicable.
376
+ */
377
+ declare function resolveLogo(logo: AuthAppearance["logo"], isDark: boolean): {
378
+ src: string;
379
+ height?: number;
380
+ align?: "left" | "center";
381
+ } | undefined;
382
+ /**
383
+ * Derives the `--moonkey-*` palette (colors / radius / font) from an
384
+ * AuthAppearance. Used by ScopedContainer so the SDK owns its own derivation.
385
+ *
386
+ * Merge priority (lowest → highest): accent/background derivations →
387
+ * `appearance.colors` + per-mode (`appearance.light` / `dark`).
388
+ */
389
+ declare function appearanceToTheme(appearance: AuthAppearance | undefined, isDark?: boolean): Partial<MoonKeyTheme>;
390
+ /**
391
+ * Derives the newer `--moonx-*` CSS variables (warning/info/link/ring colors,
392
+ * granular radii, typography scale, card and backdrop tokens) from an
393
+ * {@link AuthAppearance}. Only explicitly-set tokens are emitted, so components
394
+ * fall back to their `--moonkey-*` defaults via CSS `var(..., fallback)` when
395
+ * unset.
396
+ */
397
+ declare function appearanceToMoonxVars(appearance: AuthAppearance | undefined, isDark: boolean): Record<string, string>;
398
+ /**
399
+ * Derives per-component override CSS variables (`--moonx-<component>-*`) from
400
+ * `appearance.components`. Lets a host style the card / button / input
401
+ * independently; unset fields fall through to the global tokens.
402
+ */
403
+ declare function appearanceToComponentVars(appearance: AuthAppearance | undefined): Record<string, string>;
404
+ /**
405
+ * Collect the font URLs referenced by an appearance's typography tokens (base +
406
+ * per-mode) so the SDK can inject the corresponding <link rel="stylesheet">
407
+ * elements.
408
+ */
409
+ declare function resolveFontUrls(appearance: AuthAppearance | undefined): string[];
410
+ /**
411
+ * Resolve an {@link AuthAppearance} into the full flat CSS-variable map for
412
+ * surfaces that paint the appearance onto their own root (e.g. the demo applying
413
+ * it to `<html>`): the base light/dark `--moonkey-*` palette merged with the
414
+ * appearance derivations, plus the granular `--moonx-*` tokens and per-component
415
+ * overrides.
416
+ *
417
+ * Shares {@link appearanceToTheme} / {@link appearanceToMoonxVars} /
418
+ * {@link appearanceToComponentVars} with the SDK's {@link ScopedContainer} so
419
+ * the derivations stay aligned. Note this does NOT apply the resolved
420
+ * `customTheme` layer that ScopedContainer folds on top, so a host using
421
+ * AuthProvider's resolved theme is the source of truth for the embedded UI;
422
+ * this helper covers appearance-only surfaces.
423
+ */
424
+ declare function appearanceToCssVars(appearance: AuthAppearance | undefined, isDark: boolean): Record<string, string>;
425
+
297
426
  declare class SessionExpiredError extends Error {
298
427
  walletType: string;
299
428
  walletAddress?: string;
@@ -312,4 +441,4 @@ declare const getReconnectionInfo: (error: any) => {
312
441
  walletAddress?: string;
313
442
  } | null;
314
443
 
315
- export { type AttachOAuthState, type BaseConnectedEthereumWallet, type BaseConnectedSolanaWallet, type ConnectWalletCallbacks, type ConnectWalletParams, type DetachOAuthResult, type DetachOAuthState, type MoonKeyConfig, type MoonKeyInstance, MoonKeyProvider, type MoonKeyProviderProps$1 as MoonKeyProviderProps, 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, getReconnectionInfo, requiresReconnection, useAttachOAuth, useConnectWallet, useDetachOAuth, useLoginWithOAuth, useMoonKey, useOAuthCompletion };
444
+ export { type AttachOAuthState, type BaseConnectedEthereumWallet, type BaseConnectedSolanaWallet, type ConnectWalletCallbacks, type ConnectWalletParams, type DetachOAuthResult, type DetachOAuthState, type MoonKeyConfig, type MoonKeyInstance, MoonKeyProvider, type MoonKeyProviderProps$1 as MoonKeyProviderProps, type MoonKeyTheme, 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, useMoonKey, useOAuthCompletion };