@moon-x/core 0.10.1 → 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.
@@ -35,15 +35,37 @@ type RpcConfig = {
35
35
  };
36
36
  rpcTimeout?: number;
37
37
  };
38
- interface EthereumChainConfig {
39
- defaultChain?: any;
40
- supportedChains?: any[];
41
- rpcs?: {
42
- 'ethereum:mainnet': {
43
- rpc: string;
44
- };
45
- };
46
- }
38
+ /**
39
+ * Unified RPC / chain configuration.
40
+ *
41
+ * A single `chains` list covers both EVM and Solana. Each element is one of:
42
+ * - a bare viem `Chain` — use the chain's own built-in RPC URL;
43
+ * - an `EvmChainEntry` — a viem `Chain` plus an `rpcUrl` / `wsUrl` override;
44
+ * - a `SolanaChainEntry` — an explicit `id` (e.g. "solana:mainnet") + endpoints.
45
+ *
46
+ * EVM entries self-identify from `chain.id` (canonical key `eip155:<id>`), so
47
+ * there is no separate key to mistype. Solana entries carry an explicit `id`.
48
+ */
49
+ type EvmChainEntry = {
50
+ /** viem `Chain` object (carries id, name, nativeCurrency, rpcUrls, …). */
51
+ chain: Chain;
52
+ /** Override the chain's default HTTP RPC URL. */
53
+ rpcUrl?: string;
54
+ /** Override the chain's default WebSocket URL. */
55
+ wsUrl?: string;
56
+ };
57
+ type SolanaChainEntry = {
58
+ /** CAIP-2-style cluster id, e.g. "solana:mainnet" | "solana:devnet". */
59
+ id: string;
60
+ /** HTTP RPC endpoint. */
61
+ rpcUrl: string;
62
+ /** Optional WebSocket (rpcSubscriptions) endpoint. */
63
+ wsUrl?: string;
64
+ };
65
+ /** Normalized internal entry form (bare `Chain`s are coerced to `EvmChainEntry`). */
66
+ type ChainEntry = EvmChainEntry | SolanaChainEntry;
67
+ /** A single element of the public `chains` config array. */
68
+ type ChainConfigItem = Chain | EvmChainEntry | SolanaChainEntry;
47
69
 
48
70
  interface PublicWallet {
49
71
  id: string;
@@ -771,67 +793,166 @@ type EmailOtpFlowState = {
771
793
  * Display mode type for theme switching
772
794
  */
773
795
  type DisplayMode = "light" | "dark" | "auto";
796
+ interface AppearanceLogo {
797
+ /** Logo image URL shown in the auth header. */
798
+ src: string;
799
+ /** Optional alternate logo URL used when the resolved display mode is dark. */
800
+ srcDark?: string;
801
+ /** Rendered logo height in pixels. */
802
+ height?: number;
803
+ /** Horizontal alignment of the logo within the header. */
804
+ align?: "left" | "center";
805
+ }
806
+ /**
807
+ * Full color palette. The original tokens emit `--moonx-color-*` CSS
808
+ * variables; the newer ones (warning/info/link/ring) emit `--moonx-color-*`.
809
+ * Only explicitly-set tokens are emitted; unset tokens fall through to the
810
+ * accent/background-derived defaults.
811
+ */
812
+ interface AppearanceColors {
813
+ accent?: string;
814
+ accentForeground?: string;
815
+ accentDark?: string;
816
+ accentDarkest?: string;
817
+ accentLight?: string;
818
+ accentLightest?: string;
819
+ background?: string;
820
+ background2?: string;
821
+ background3?: string;
822
+ foreground?: string;
823
+ foreground2?: string;
824
+ foreground3?: string;
825
+ foreground4?: string;
826
+ foregroundAccent?: string;
827
+ success?: string;
828
+ successForeground?: string;
829
+ error?: string;
830
+ errorForeground?: string;
831
+ errorLight?: string;
832
+ border?: string;
833
+ warning?: string;
834
+ info?: string;
835
+ link?: string;
836
+ /** Focus ring color. */
837
+ ring?: string;
838
+ }
839
+ /**
840
+ * Border-radius scale. `sm`/`md`/`lg`/`full` emit `--moonx-border-radius-*`;
841
+ * the granular `button`/`card`/`input` emit `--moonx-radius-*`.
842
+ */
843
+ interface AppearanceBorderRadius {
844
+ sm?: string;
845
+ md?: string;
846
+ lg?: string;
847
+ full?: string;
848
+ button?: string;
849
+ card?: string;
850
+ input?: string;
851
+ }
852
+ /** Typography controls — heading/title tokens + a small type scale (`--moonx-*`). */
853
+ interface AppearanceTypography {
854
+ fontFamilyHeading?: string;
855
+ /** Heading/title font size. */
856
+ fontSizeHeading?: string;
857
+ /** Heading/title font weight. */
858
+ fontWeightHeading?: string | number;
859
+ /** Heading/title text color. */
860
+ colorHeading?: string;
861
+ /** Heading/title letter spacing. */
862
+ letterSpacingHeading?: string;
863
+ /** URL(s) injected as <link rel="stylesheet"> so custom fonts load. */
864
+ fontUrl?: string | string[];
865
+ fontSize?: {
866
+ sm?: string;
867
+ lg?: string;
868
+ xl?: string;
869
+ };
870
+ fontWeight?: {
871
+ medium?: string | number;
872
+ bold?: string | number;
873
+ };
874
+ letterSpacing?: string;
875
+ }
876
+ /** Card / modal surface controls (`--moonx-card-*`). */
877
+ interface AppearanceCard {
878
+ padding?: string;
879
+ shadow?: string;
880
+ borderWidth?: string;
881
+ maxWidth?: string;
882
+ }
883
+ /** Backdrop / overlay controls (`--moonx-backdrop-*`). */
884
+ interface AppearanceBackdrop {
885
+ color?: string;
886
+ blur?: string;
887
+ }
888
+ /**
889
+ * Per-component style override — themes an individual SDK surface (card,
890
+ * button, input) independently of the global tokens. Each field maps to a
891
+ * `--moonx-<component>-*` CSS variable applied on top of the global tokens, so
892
+ * anything left unset falls through to the token / `--moonx-*` defaults.
893
+ */
894
+ interface ComponentStyle {
895
+ background?: string;
896
+ text?: string;
897
+ /** Border color. */
898
+ border?: string;
899
+ borderWidth?: string;
900
+ radius?: string;
901
+ }
902
+ /** Per-component style overrides keyed by SDK surface. */
903
+ interface AppearanceComponents {
904
+ /**
905
+ * Card surface. Its background is always the global `backgroundColor` (the
906
+ * card is the surface), so only border / radius / text are overridable here.
907
+ */
908
+ card?: Omit<ComponentStyle, "background">;
909
+ button?: ComponentStyle;
910
+ input?: ComponentStyle;
911
+ }
912
+ /**
913
+ * The design-token groups themeable per resolved display mode — used for
914
+ * `appearance.light` / `appearance.dark`, which override the base tokens set
915
+ * directly on {@link AuthAppearance}.
916
+ */
917
+ interface AppearanceModeTokens {
918
+ colors?: AppearanceColors;
919
+ /** Granular radius overrides (no preset string at the per-mode level). */
920
+ borderRadius?: AppearanceBorderRadius;
921
+ fontFamily?: string;
922
+ typography?: AppearanceTypography;
923
+ card?: AppearanceCard;
924
+ backdrop?: AppearanceBackdrop;
925
+ }
926
+ /**
927
+ * The single theming surface. High-level branding (`accentColor`,
928
+ * `backgroundColor`, `displayMode`, `logo`, headers, `fontFamily`) plus the
929
+ * full design-token set inline — `colors`, `borderRadius`, `typography`,
930
+ * `card`, `backdrop` — with per-mode `light` / `dark` overrides and
931
+ * per-component `components` styles.
932
+ */
774
933
  interface AuthAppearance {
775
934
  hideClose?: boolean;
776
935
  loginHeaderTitle?: string;
777
936
  loginHeaderDescription?: string;
778
- logo?: string;
937
+ /** Logo URL, or a logo object for sizing / alignment / dark-mode variant. */
938
+ logo?: string | AppearanceLogo;
779
939
  backgroundColor?: string;
780
940
  accentColor?: string;
781
941
  displayMode?: DisplayMode;
782
- /** Border radius preset or explicit per-size overrides */
783
- borderRadius?: 'none' | 'sm' | 'md' | 'lg' | {
784
- sm?: string;
785
- md?: string;
786
- lg?: string;
787
- };
788
- fontFamily?: string;
789
- /** Fine-grained color overrides — applied after accent/background derivations */
790
- colors?: {
791
- accentForeground?: string;
792
- foreground?: string;
793
- foreground2?: string;
794
- foreground3?: string;
795
- foreground4?: string;
796
- foregroundAccent?: string;
797
- border?: string;
798
- error?: string;
799
- errorForeground?: string;
800
- errorLight?: string;
801
- success?: string;
802
- successForeground?: string;
803
- };
804
- }
805
- interface MoonKeyThemeConfig {
806
- colors?: {
807
- accent?: string;
808
- accentForeground?: string;
809
- accentDark?: string;
810
- accentDarkest?: string;
811
- accentLight?: string;
812
- accentLightest?: string;
813
- background?: string;
814
- background2?: string;
815
- background3?: string;
816
- foreground?: string;
817
- foreground2?: string;
818
- foreground3?: string;
819
- foreground4?: string;
820
- foregroundAccent?: string;
821
- success?: string;
822
- successForeground?: string;
823
- error?: string;
824
- errorForeground?: string;
825
- errorLight?: string;
826
- border?: string;
827
- };
828
- borderRadius?: {
829
- sm?: string;
830
- md?: string;
831
- lg?: string;
832
- full?: string;
833
- };
834
942
  fontFamily?: string;
943
+ /** Full color palette (overrides the accent/background-derived defaults). */
944
+ colors?: AppearanceColors;
945
+ /** Border-radius preset, or explicit per-size + granular overrides. */
946
+ borderRadius?: "none" | "sm" | "md" | "lg" | AppearanceBorderRadius;
947
+ typography?: AppearanceTypography;
948
+ card?: AppearanceCard;
949
+ backdrop?: AppearanceBackdrop;
950
+ /** Per-component style overrides (card / button / input). */
951
+ components?: AppearanceComponents;
952
+ /** Tokens applied only when the resolved display mode is light. */
953
+ light?: AppearanceModeTokens;
954
+ /** Tokens applied only when the resolved display mode is dark. */
955
+ dark?: AppearanceModeTokens;
835
956
  }
836
957
  /**
837
958
  * Flexible theme type that accepts both strict MoonKeyTheme and loose config theme objects.
@@ -1014,25 +1135,32 @@ interface AuthProviderConfig {
1014
1135
  prefill?: PrefillConfig;
1015
1136
  walletChainType?: WalletChainType;
1016
1137
  isDark?: boolean;
1017
- theme?: MoonKeyThemeConfig;
1138
+ /**
1139
+ * Internal: the SDK's *resolved* `--moonx-*` theme (palette + radius +
1140
+ * font), populated by AuthProvider from `appearance` and consumed by the
1141
+ * flows / ScopedContainer. Not a host input — theming is set via
1142
+ * `appearance`. Typed loosely since it also carries pre-resolved
1143
+ * `--moonx-*` vars + font URLs.
1144
+ */
1145
+ theme?: FlexibleTheme;
1018
1146
  emailConfig?: EmailOtpConfig;
1019
1147
  passkeyEnrollConfig?: PasskeyEnrollConfig;
1020
1148
  signMessageConfig?: SignMessageConfig;
1021
1149
  exportKeyConfig?: ExportKeyConfig;
1022
1150
  signTransactionConfig?: SignTransactionConfig;
1023
1151
  sendTransactionConfig?: SendTransactionConfig;
1024
- solana?: {
1025
- rpcs: {
1026
- [key: string]: {
1027
- rpc: string;
1028
- rpcSubscriptions?: string;
1029
- };
1030
- };
1031
- };
1032
- ethereum?: {
1033
- defaultChain?: Chain;
1034
- supportedChains?: Chain[];
1035
- };
1152
+ /**
1153
+ * Unified RPC / chain config — one list for EVM + Solana. See
1154
+ * `ChainConfigItem`: a bare viem `Chain`, an `{ chain, rpcUrl?, wsUrl? }`
1155
+ * EVM entry, or a `{ id, rpcUrl, wsUrl? }` Solana entry.
1156
+ */
1157
+ chains?: ChainConfigItem[];
1158
+ /**
1159
+ * Which configured chain to use by default. References an entry by alias,
1160
+ * CAIP-2 id, or numeric chainId (e.g. "eth:base" | "eip155:8453" | 8453 |
1161
+ * "solana:mainnet"). Defaults to the first configured chain when omitted.
1162
+ */
1163
+ defaultChain?: string | number;
1036
1164
  };
1037
1165
  }
1038
1166
  interface SendEmailOtpRequest {
@@ -1328,4 +1456,4 @@ interface WalletVerifyRequest {
1328
1456
  sessionExpiresIn: number;
1329
1457
  }
1330
1458
 
1331
- export { type AccessTokenClaims, type AppConfigRequest, type AppConfigResponse, type AttachOAuthTokenRequest, type AttachOAuthTokenResponse, type AuthAppearance, type AuthFlow, type AuthFlowComponent, type AuthLoginMethod, type AuthProviderConfig, type BaseGetBalanceParams, type BaseGetBalanceResult, type BaseGetTokenAccountsParams, type BaseSendTransactionParams, type BaseSendTransactionResult, type BaseSignMessageParams, type BaseSignMessageResult, type BaseSignTransactionParams, type BaseSignTransactionResult, type BaseTokenClaims, type BaseUIOptions, type BaseWalletHooks, type BlockExplorer, type Chain, type ChainLikeWithId, type ContractUIOptions, type CreateWalletResponse, type DefaultFundingMethod, type DeleteSessionRequest, type DeleteSessionResponse, type DetachOAuthTokenRequest, type DeviceFingerprint, type DisplayMode, type EmailOtpConfig, type EmailOtpFlowState, type EphemeralSigner, type EphemeralSignerChain, type EphemeralSignerScheme, type EphemeralSignerWallet, type EthereumChainConfig, type EthereumFundingConfig, type EthereumGetBalanceParams, type EthereumGetBalanceResult, type EthereumGetTokenAccountsByOwnerParams, type EthereumGetTokenAccountsByOwnerResult, type EthereumSendTransactionParams, type EthereumSendTransactionRequest, type EthereumSendTransactionResult, type EthereumSign7702AuthorizationParams, type EthereumSign7702AuthorizationResult, type EthereumSignHashParams, type EthereumSignHashResult, type EthereumSignMessageParams, type EthereumSignMessageResult, type EthereumSignTransactionParams, type EthereumSignTransactionResult, type EthereumSignTypedDataParams, type EthereumSignTypedDataResult, type EthereumSwitchChainParams, type ExportKeyConfig, type Factor, type FlexibleTheme, type FundWalletConfig, type FundingEvents, type FundingMethod, type FundingUIConfig, type GetCurrentSessionRequest, type GetCurrentSessionResponse, type Hex, type IdentityTokenClaims, type IdpProvider, type IsAuthenticatedRequest, type IsAuthenticatedResponse, type ListEphemeralSignersResult, type LoginTokenBundle, type LogoutRequest, type LogoutResponse, type MessageTypeProperty, type MessageTypes, type MoonKeyThemeConfig, type MoonPaySignRequest, type MoonPaySignResponse, type MpcKeyShares, type NativeCurrency, Network, type OAuthRequest, type OAuthResponse, type OnrampFundingSettings, type PasskeyEnrollConfig, type PasskeySettings, type PreferredCardProvider, type PrefillConfig, type PresenceTokenClaims, type ProvisionEphemeralSignerParams, type ProvisionEphemeralSignerResult, type PublicEthereumWallet, type PublicSessionData, type PublicWallet, type RefreshSessionRequest, type RefreshSessionResponse, type RetrieveWalletKeyRequest, type RetrieveWalletKeyResponse, type RevokeEphemeralSignerParams, type RpcConfig, type RpcUrls, type SdkSettings, type SendEmailOtpRequest, type SendEmailOtpResponse, type SendTransactionConfig, type SendTransactionRequest, type SessionData, type SessionWallet, type SharesDeviceRequest, type SharesDeviceResponse, type Sign7702AuthorizationError, type Sign7702AuthorizationParams, type Sign7702AuthorizationResponse, type Sign7702AuthorizationResult, type SignMessageConfig, type SignTransactionConfig, type SignTypedDataError, type SignTypedDataParams, type SignTypedDataResponse, type SignTypedDataResult, type SmsSettings, type SolanaChain, type SolanaFundingConfig, type SolanaGetBalanceParams, type SolanaGetBalanceResult, type SolanaGetTokenAccountsByOwnerParams, type SolanaGetTokenAccountsByOwnerResult, type SolanaSendTransactionParams, type SolanaSendTransactionResult, type SolanaSignMessageParams, type SolanaSignMessageResult, type SolanaSignTransactionParams, type SolanaSignTransactionResult, type TransactionCommitment, type TransactionEncoding, type TransactionUIOptions, type TypedMessage, type UseFundWalletInterface, type UsersMePublicResponse, type UsersMeRequest, type UsersMeResponse, type VerifiedSession, type VerifyEmailOtpRequest, type VerifyEmailOtpResponse, type VerifyEmailOtpUser, type VerifyOAuthTokenRequest, type VerifyOAuthTokenResponse, type VerifySiweWalletRegistrationRequest, WALLET_ERROR_CODES, type Wallet, type WalletChain, type WalletChainType, type WalletConnectConfig, WalletCreationError, type WalletError, type WalletErrorCode, type WalletKeyRequest, type WalletListEntry, type WalletRegistrationNonceRequest, type WalletRegistrationNonceResponse, type WalletType, type WalletVerifyRequest };
1459
+ export { type AccessTokenClaims, type AppConfigRequest, type AppConfigResponse, type AppearanceBackdrop, type AppearanceBorderRadius, type AppearanceCard, type AppearanceColors, type AppearanceComponents, type AppearanceLogo, type AppearanceModeTokens, type AppearanceTypography, type AttachOAuthTokenRequest, type AttachOAuthTokenResponse, type AuthAppearance, type AuthFlow, type AuthFlowComponent, type AuthLoginMethod, type AuthProviderConfig, type BaseGetBalanceParams, type BaseGetBalanceResult, type BaseGetTokenAccountsParams, type BaseSendTransactionParams, type BaseSendTransactionResult, type BaseSignMessageParams, type BaseSignMessageResult, type BaseSignTransactionParams, type BaseSignTransactionResult, type BaseTokenClaims, type BaseUIOptions, type BaseWalletHooks, type BlockExplorer, type Chain, type ChainConfigItem, type ChainEntry, type ChainLikeWithId, type ComponentStyle, type ContractUIOptions, type CreateWalletResponse, type DefaultFundingMethod, type DeleteSessionRequest, type DeleteSessionResponse, type DetachOAuthTokenRequest, type DeviceFingerprint, type DisplayMode, type EmailOtpConfig, type EmailOtpFlowState, type EphemeralSigner, type EphemeralSignerChain, type EphemeralSignerScheme, type EphemeralSignerWallet, type EthereumFundingConfig, type EthereumGetBalanceParams, type EthereumGetBalanceResult, type EthereumGetTokenAccountsByOwnerParams, type EthereumGetTokenAccountsByOwnerResult, type EthereumSendTransactionParams, type EthereumSendTransactionRequest, type EthereumSendTransactionResult, type EthereumSign7702AuthorizationParams, type EthereumSign7702AuthorizationResult, type EthereumSignHashParams, type EthereumSignHashResult, type EthereumSignMessageParams, type EthereumSignMessageResult, type EthereumSignTransactionParams, type EthereumSignTransactionResult, type EthereumSignTypedDataParams, type EthereumSignTypedDataResult, type EthereumSwitchChainParams, type EvmChainEntry, type ExportKeyConfig, type Factor, type FlexibleTheme, type FundWalletConfig, type FundingEvents, type FundingMethod, type FundingUIConfig, type GetCurrentSessionRequest, type GetCurrentSessionResponse, type Hex, type IdentityTokenClaims, type IdpProvider, type IsAuthenticatedRequest, type IsAuthenticatedResponse, type ListEphemeralSignersResult, type LoginTokenBundle, type LogoutRequest, type LogoutResponse, type MessageTypeProperty, type MessageTypes, type MoonPaySignRequest, type MoonPaySignResponse, type MpcKeyShares, type NativeCurrency, Network, type OAuthRequest, type OAuthResponse, type OnrampFundingSettings, type PasskeyEnrollConfig, type PasskeySettings, type PreferredCardProvider, type PrefillConfig, type PresenceTokenClaims, type ProvisionEphemeralSignerParams, type ProvisionEphemeralSignerResult, type PublicEthereumWallet, type PublicSessionData, type PublicWallet, type RefreshSessionRequest, type RefreshSessionResponse, type RetrieveWalletKeyRequest, type RetrieveWalletKeyResponse, type RevokeEphemeralSignerParams, type RpcConfig, type RpcUrls, type SdkSettings, type SendEmailOtpRequest, type SendEmailOtpResponse, type SendTransactionConfig, type SendTransactionRequest, type SessionData, type SessionWallet, type SharesDeviceRequest, type SharesDeviceResponse, type Sign7702AuthorizationError, type Sign7702AuthorizationParams, type Sign7702AuthorizationResponse, type Sign7702AuthorizationResult, type SignMessageConfig, type SignTransactionConfig, type SignTypedDataError, type SignTypedDataParams, type SignTypedDataResponse, type SignTypedDataResult, type SmsSettings, type SolanaChain, type SolanaChainEntry, type SolanaFundingConfig, type SolanaGetBalanceParams, type SolanaGetBalanceResult, type SolanaGetTokenAccountsByOwnerParams, type SolanaGetTokenAccountsByOwnerResult, type SolanaSendTransactionParams, type SolanaSendTransactionResult, type SolanaSignMessageParams, type SolanaSignMessageResult, type SolanaSignTransactionParams, type SolanaSignTransactionResult, type TransactionCommitment, type TransactionEncoding, type TransactionUIOptions, type TypedMessage, type UseFundWalletInterface, type UsersMePublicResponse, type UsersMeRequest, type UsersMeResponse, type VerifiedSession, type VerifyEmailOtpRequest, type VerifyEmailOtpResponse, type VerifyEmailOtpUser, type VerifyOAuthTokenRequest, type VerifyOAuthTokenResponse, type VerifySiweWalletRegistrationRequest, WALLET_ERROR_CODES, type Wallet, type WalletChain, type WalletChainType, type WalletConnectConfig, WalletCreationError, type WalletError, type WalletErrorCode, type WalletKeyRequest, type WalletListEntry, type WalletRegistrationNonceRequest, type WalletRegistrationNonceResponse, type WalletType, type WalletVerifyRequest };
@@ -35,15 +35,37 @@ type RpcConfig = {
35
35
  };
36
36
  rpcTimeout?: number;
37
37
  };
38
- interface EthereumChainConfig {
39
- defaultChain?: any;
40
- supportedChains?: any[];
41
- rpcs?: {
42
- 'ethereum:mainnet': {
43
- rpc: string;
44
- };
45
- };
46
- }
38
+ /**
39
+ * Unified RPC / chain configuration.
40
+ *
41
+ * A single `chains` list covers both EVM and Solana. Each element is one of:
42
+ * - a bare viem `Chain` — use the chain's own built-in RPC URL;
43
+ * - an `EvmChainEntry` — a viem `Chain` plus an `rpcUrl` / `wsUrl` override;
44
+ * - a `SolanaChainEntry` — an explicit `id` (e.g. "solana:mainnet") + endpoints.
45
+ *
46
+ * EVM entries self-identify from `chain.id` (canonical key `eip155:<id>`), so
47
+ * there is no separate key to mistype. Solana entries carry an explicit `id`.
48
+ */
49
+ type EvmChainEntry = {
50
+ /** viem `Chain` object (carries id, name, nativeCurrency, rpcUrls, …). */
51
+ chain: Chain;
52
+ /** Override the chain's default HTTP RPC URL. */
53
+ rpcUrl?: string;
54
+ /** Override the chain's default WebSocket URL. */
55
+ wsUrl?: string;
56
+ };
57
+ type SolanaChainEntry = {
58
+ /** CAIP-2-style cluster id, e.g. "solana:mainnet" | "solana:devnet". */
59
+ id: string;
60
+ /** HTTP RPC endpoint. */
61
+ rpcUrl: string;
62
+ /** Optional WebSocket (rpcSubscriptions) endpoint. */
63
+ wsUrl?: string;
64
+ };
65
+ /** Normalized internal entry form (bare `Chain`s are coerced to `EvmChainEntry`). */
66
+ type ChainEntry = EvmChainEntry | SolanaChainEntry;
67
+ /** A single element of the public `chains` config array. */
68
+ type ChainConfigItem = Chain | EvmChainEntry | SolanaChainEntry;
47
69
 
48
70
  interface PublicWallet {
49
71
  id: string;
@@ -771,67 +793,166 @@ type EmailOtpFlowState = {
771
793
  * Display mode type for theme switching
772
794
  */
773
795
  type DisplayMode = "light" | "dark" | "auto";
796
+ interface AppearanceLogo {
797
+ /** Logo image URL shown in the auth header. */
798
+ src: string;
799
+ /** Optional alternate logo URL used when the resolved display mode is dark. */
800
+ srcDark?: string;
801
+ /** Rendered logo height in pixels. */
802
+ height?: number;
803
+ /** Horizontal alignment of the logo within the header. */
804
+ align?: "left" | "center";
805
+ }
806
+ /**
807
+ * Full color palette. The original tokens emit `--moonx-color-*` CSS
808
+ * variables; the newer ones (warning/info/link/ring) emit `--moonx-color-*`.
809
+ * Only explicitly-set tokens are emitted; unset tokens fall through to the
810
+ * accent/background-derived defaults.
811
+ */
812
+ interface AppearanceColors {
813
+ accent?: string;
814
+ accentForeground?: string;
815
+ accentDark?: string;
816
+ accentDarkest?: string;
817
+ accentLight?: string;
818
+ accentLightest?: string;
819
+ background?: string;
820
+ background2?: string;
821
+ background3?: string;
822
+ foreground?: string;
823
+ foreground2?: string;
824
+ foreground3?: string;
825
+ foreground4?: string;
826
+ foregroundAccent?: string;
827
+ success?: string;
828
+ successForeground?: string;
829
+ error?: string;
830
+ errorForeground?: string;
831
+ errorLight?: string;
832
+ border?: string;
833
+ warning?: string;
834
+ info?: string;
835
+ link?: string;
836
+ /** Focus ring color. */
837
+ ring?: string;
838
+ }
839
+ /**
840
+ * Border-radius scale. `sm`/`md`/`lg`/`full` emit `--moonx-border-radius-*`;
841
+ * the granular `button`/`card`/`input` emit `--moonx-radius-*`.
842
+ */
843
+ interface AppearanceBorderRadius {
844
+ sm?: string;
845
+ md?: string;
846
+ lg?: string;
847
+ full?: string;
848
+ button?: string;
849
+ card?: string;
850
+ input?: string;
851
+ }
852
+ /** Typography controls — heading/title tokens + a small type scale (`--moonx-*`). */
853
+ interface AppearanceTypography {
854
+ fontFamilyHeading?: string;
855
+ /** Heading/title font size. */
856
+ fontSizeHeading?: string;
857
+ /** Heading/title font weight. */
858
+ fontWeightHeading?: string | number;
859
+ /** Heading/title text color. */
860
+ colorHeading?: string;
861
+ /** Heading/title letter spacing. */
862
+ letterSpacingHeading?: string;
863
+ /** URL(s) injected as <link rel="stylesheet"> so custom fonts load. */
864
+ fontUrl?: string | string[];
865
+ fontSize?: {
866
+ sm?: string;
867
+ lg?: string;
868
+ xl?: string;
869
+ };
870
+ fontWeight?: {
871
+ medium?: string | number;
872
+ bold?: string | number;
873
+ };
874
+ letterSpacing?: string;
875
+ }
876
+ /** Card / modal surface controls (`--moonx-card-*`). */
877
+ interface AppearanceCard {
878
+ padding?: string;
879
+ shadow?: string;
880
+ borderWidth?: string;
881
+ maxWidth?: string;
882
+ }
883
+ /** Backdrop / overlay controls (`--moonx-backdrop-*`). */
884
+ interface AppearanceBackdrop {
885
+ color?: string;
886
+ blur?: string;
887
+ }
888
+ /**
889
+ * Per-component style override — themes an individual SDK surface (card,
890
+ * button, input) independently of the global tokens. Each field maps to a
891
+ * `--moonx-<component>-*` CSS variable applied on top of the global tokens, so
892
+ * anything left unset falls through to the token / `--moonx-*` defaults.
893
+ */
894
+ interface ComponentStyle {
895
+ background?: string;
896
+ text?: string;
897
+ /** Border color. */
898
+ border?: string;
899
+ borderWidth?: string;
900
+ radius?: string;
901
+ }
902
+ /** Per-component style overrides keyed by SDK surface. */
903
+ interface AppearanceComponents {
904
+ /**
905
+ * Card surface. Its background is always the global `backgroundColor` (the
906
+ * card is the surface), so only border / radius / text are overridable here.
907
+ */
908
+ card?: Omit<ComponentStyle, "background">;
909
+ button?: ComponentStyle;
910
+ input?: ComponentStyle;
911
+ }
912
+ /**
913
+ * The design-token groups themeable per resolved display mode — used for
914
+ * `appearance.light` / `appearance.dark`, which override the base tokens set
915
+ * directly on {@link AuthAppearance}.
916
+ */
917
+ interface AppearanceModeTokens {
918
+ colors?: AppearanceColors;
919
+ /** Granular radius overrides (no preset string at the per-mode level). */
920
+ borderRadius?: AppearanceBorderRadius;
921
+ fontFamily?: string;
922
+ typography?: AppearanceTypography;
923
+ card?: AppearanceCard;
924
+ backdrop?: AppearanceBackdrop;
925
+ }
926
+ /**
927
+ * The single theming surface. High-level branding (`accentColor`,
928
+ * `backgroundColor`, `displayMode`, `logo`, headers, `fontFamily`) plus the
929
+ * full design-token set inline — `colors`, `borderRadius`, `typography`,
930
+ * `card`, `backdrop` — with per-mode `light` / `dark` overrides and
931
+ * per-component `components` styles.
932
+ */
774
933
  interface AuthAppearance {
775
934
  hideClose?: boolean;
776
935
  loginHeaderTitle?: string;
777
936
  loginHeaderDescription?: string;
778
- logo?: string;
937
+ /** Logo URL, or a logo object for sizing / alignment / dark-mode variant. */
938
+ logo?: string | AppearanceLogo;
779
939
  backgroundColor?: string;
780
940
  accentColor?: string;
781
941
  displayMode?: DisplayMode;
782
- /** Border radius preset or explicit per-size overrides */
783
- borderRadius?: 'none' | 'sm' | 'md' | 'lg' | {
784
- sm?: string;
785
- md?: string;
786
- lg?: string;
787
- };
788
- fontFamily?: string;
789
- /** Fine-grained color overrides — applied after accent/background derivations */
790
- colors?: {
791
- accentForeground?: string;
792
- foreground?: string;
793
- foreground2?: string;
794
- foreground3?: string;
795
- foreground4?: string;
796
- foregroundAccent?: string;
797
- border?: string;
798
- error?: string;
799
- errorForeground?: string;
800
- errorLight?: string;
801
- success?: string;
802
- successForeground?: string;
803
- };
804
- }
805
- interface MoonKeyThemeConfig {
806
- colors?: {
807
- accent?: string;
808
- accentForeground?: string;
809
- accentDark?: string;
810
- accentDarkest?: string;
811
- accentLight?: string;
812
- accentLightest?: string;
813
- background?: string;
814
- background2?: string;
815
- background3?: string;
816
- foreground?: string;
817
- foreground2?: string;
818
- foreground3?: string;
819
- foreground4?: string;
820
- foregroundAccent?: string;
821
- success?: string;
822
- successForeground?: string;
823
- error?: string;
824
- errorForeground?: string;
825
- errorLight?: string;
826
- border?: string;
827
- };
828
- borderRadius?: {
829
- sm?: string;
830
- md?: string;
831
- lg?: string;
832
- full?: string;
833
- };
834
942
  fontFamily?: string;
943
+ /** Full color palette (overrides the accent/background-derived defaults). */
944
+ colors?: AppearanceColors;
945
+ /** Border-radius preset, or explicit per-size + granular overrides. */
946
+ borderRadius?: "none" | "sm" | "md" | "lg" | AppearanceBorderRadius;
947
+ typography?: AppearanceTypography;
948
+ card?: AppearanceCard;
949
+ backdrop?: AppearanceBackdrop;
950
+ /** Per-component style overrides (card / button / input). */
951
+ components?: AppearanceComponents;
952
+ /** Tokens applied only when the resolved display mode is light. */
953
+ light?: AppearanceModeTokens;
954
+ /** Tokens applied only when the resolved display mode is dark. */
955
+ dark?: AppearanceModeTokens;
835
956
  }
836
957
  /**
837
958
  * Flexible theme type that accepts both strict MoonKeyTheme and loose config theme objects.
@@ -1014,25 +1135,32 @@ interface AuthProviderConfig {
1014
1135
  prefill?: PrefillConfig;
1015
1136
  walletChainType?: WalletChainType;
1016
1137
  isDark?: boolean;
1017
- theme?: MoonKeyThemeConfig;
1138
+ /**
1139
+ * Internal: the SDK's *resolved* `--moonx-*` theme (palette + radius +
1140
+ * font), populated by AuthProvider from `appearance` and consumed by the
1141
+ * flows / ScopedContainer. Not a host input — theming is set via
1142
+ * `appearance`. Typed loosely since it also carries pre-resolved
1143
+ * `--moonx-*` vars + font URLs.
1144
+ */
1145
+ theme?: FlexibleTheme;
1018
1146
  emailConfig?: EmailOtpConfig;
1019
1147
  passkeyEnrollConfig?: PasskeyEnrollConfig;
1020
1148
  signMessageConfig?: SignMessageConfig;
1021
1149
  exportKeyConfig?: ExportKeyConfig;
1022
1150
  signTransactionConfig?: SignTransactionConfig;
1023
1151
  sendTransactionConfig?: SendTransactionConfig;
1024
- solana?: {
1025
- rpcs: {
1026
- [key: string]: {
1027
- rpc: string;
1028
- rpcSubscriptions?: string;
1029
- };
1030
- };
1031
- };
1032
- ethereum?: {
1033
- defaultChain?: Chain;
1034
- supportedChains?: Chain[];
1035
- };
1152
+ /**
1153
+ * Unified RPC / chain config — one list for EVM + Solana. See
1154
+ * `ChainConfigItem`: a bare viem `Chain`, an `{ chain, rpcUrl?, wsUrl? }`
1155
+ * EVM entry, or a `{ id, rpcUrl, wsUrl? }` Solana entry.
1156
+ */
1157
+ chains?: ChainConfigItem[];
1158
+ /**
1159
+ * Which configured chain to use by default. References an entry by alias,
1160
+ * CAIP-2 id, or numeric chainId (e.g. "eth:base" | "eip155:8453" | 8453 |
1161
+ * "solana:mainnet"). Defaults to the first configured chain when omitted.
1162
+ */
1163
+ defaultChain?: string | number;
1036
1164
  };
1037
1165
  }
1038
1166
  interface SendEmailOtpRequest {
@@ -1328,4 +1456,4 @@ interface WalletVerifyRequest {
1328
1456
  sessionExpiresIn: number;
1329
1457
  }
1330
1458
 
1331
- export { type AccessTokenClaims, type AppConfigRequest, type AppConfigResponse, type AttachOAuthTokenRequest, type AttachOAuthTokenResponse, type AuthAppearance, type AuthFlow, type AuthFlowComponent, type AuthLoginMethod, type AuthProviderConfig, type BaseGetBalanceParams, type BaseGetBalanceResult, type BaseGetTokenAccountsParams, type BaseSendTransactionParams, type BaseSendTransactionResult, type BaseSignMessageParams, type BaseSignMessageResult, type BaseSignTransactionParams, type BaseSignTransactionResult, type BaseTokenClaims, type BaseUIOptions, type BaseWalletHooks, type BlockExplorer, type Chain, type ChainLikeWithId, type ContractUIOptions, type CreateWalletResponse, type DefaultFundingMethod, type DeleteSessionRequest, type DeleteSessionResponse, type DetachOAuthTokenRequest, type DeviceFingerprint, type DisplayMode, type EmailOtpConfig, type EmailOtpFlowState, type EphemeralSigner, type EphemeralSignerChain, type EphemeralSignerScheme, type EphemeralSignerWallet, type EthereumChainConfig, type EthereumFundingConfig, type EthereumGetBalanceParams, type EthereumGetBalanceResult, type EthereumGetTokenAccountsByOwnerParams, type EthereumGetTokenAccountsByOwnerResult, type EthereumSendTransactionParams, type EthereumSendTransactionRequest, type EthereumSendTransactionResult, type EthereumSign7702AuthorizationParams, type EthereumSign7702AuthorizationResult, type EthereumSignHashParams, type EthereumSignHashResult, type EthereumSignMessageParams, type EthereumSignMessageResult, type EthereumSignTransactionParams, type EthereumSignTransactionResult, type EthereumSignTypedDataParams, type EthereumSignTypedDataResult, type EthereumSwitchChainParams, type ExportKeyConfig, type Factor, type FlexibleTheme, type FundWalletConfig, type FundingEvents, type FundingMethod, type FundingUIConfig, type GetCurrentSessionRequest, type GetCurrentSessionResponse, type Hex, type IdentityTokenClaims, type IdpProvider, type IsAuthenticatedRequest, type IsAuthenticatedResponse, type ListEphemeralSignersResult, type LoginTokenBundle, type LogoutRequest, type LogoutResponse, type MessageTypeProperty, type MessageTypes, type MoonKeyThemeConfig, type MoonPaySignRequest, type MoonPaySignResponse, type MpcKeyShares, type NativeCurrency, Network, type OAuthRequest, type OAuthResponse, type OnrampFundingSettings, type PasskeyEnrollConfig, type PasskeySettings, type PreferredCardProvider, type PrefillConfig, type PresenceTokenClaims, type ProvisionEphemeralSignerParams, type ProvisionEphemeralSignerResult, type PublicEthereumWallet, type PublicSessionData, type PublicWallet, type RefreshSessionRequest, type RefreshSessionResponse, type RetrieveWalletKeyRequest, type RetrieveWalletKeyResponse, type RevokeEphemeralSignerParams, type RpcConfig, type RpcUrls, type SdkSettings, type SendEmailOtpRequest, type SendEmailOtpResponse, type SendTransactionConfig, type SendTransactionRequest, type SessionData, type SessionWallet, type SharesDeviceRequest, type SharesDeviceResponse, type Sign7702AuthorizationError, type Sign7702AuthorizationParams, type Sign7702AuthorizationResponse, type Sign7702AuthorizationResult, type SignMessageConfig, type SignTransactionConfig, type SignTypedDataError, type SignTypedDataParams, type SignTypedDataResponse, type SignTypedDataResult, type SmsSettings, type SolanaChain, type SolanaFundingConfig, type SolanaGetBalanceParams, type SolanaGetBalanceResult, type SolanaGetTokenAccountsByOwnerParams, type SolanaGetTokenAccountsByOwnerResult, type SolanaSendTransactionParams, type SolanaSendTransactionResult, type SolanaSignMessageParams, type SolanaSignMessageResult, type SolanaSignTransactionParams, type SolanaSignTransactionResult, type TransactionCommitment, type TransactionEncoding, type TransactionUIOptions, type TypedMessage, type UseFundWalletInterface, type UsersMePublicResponse, type UsersMeRequest, type UsersMeResponse, type VerifiedSession, type VerifyEmailOtpRequest, type VerifyEmailOtpResponse, type VerifyEmailOtpUser, type VerifyOAuthTokenRequest, type VerifyOAuthTokenResponse, type VerifySiweWalletRegistrationRequest, WALLET_ERROR_CODES, type Wallet, type WalletChain, type WalletChainType, type WalletConnectConfig, WalletCreationError, type WalletError, type WalletErrorCode, type WalletKeyRequest, type WalletListEntry, type WalletRegistrationNonceRequest, type WalletRegistrationNonceResponse, type WalletType, type WalletVerifyRequest };
1459
+ export { type AccessTokenClaims, type AppConfigRequest, type AppConfigResponse, type AppearanceBackdrop, type AppearanceBorderRadius, type AppearanceCard, type AppearanceColors, type AppearanceComponents, type AppearanceLogo, type AppearanceModeTokens, type AppearanceTypography, type AttachOAuthTokenRequest, type AttachOAuthTokenResponse, type AuthAppearance, type AuthFlow, type AuthFlowComponent, type AuthLoginMethod, type AuthProviderConfig, type BaseGetBalanceParams, type BaseGetBalanceResult, type BaseGetTokenAccountsParams, type BaseSendTransactionParams, type BaseSendTransactionResult, type BaseSignMessageParams, type BaseSignMessageResult, type BaseSignTransactionParams, type BaseSignTransactionResult, type BaseTokenClaims, type BaseUIOptions, type BaseWalletHooks, type BlockExplorer, type Chain, type ChainConfigItem, type ChainEntry, type ChainLikeWithId, type ComponentStyle, type ContractUIOptions, type CreateWalletResponse, type DefaultFundingMethod, type DeleteSessionRequest, type DeleteSessionResponse, type DetachOAuthTokenRequest, type DeviceFingerprint, type DisplayMode, type EmailOtpConfig, type EmailOtpFlowState, type EphemeralSigner, type EphemeralSignerChain, type EphemeralSignerScheme, type EphemeralSignerWallet, type EthereumFundingConfig, type EthereumGetBalanceParams, type EthereumGetBalanceResult, type EthereumGetTokenAccountsByOwnerParams, type EthereumGetTokenAccountsByOwnerResult, type EthereumSendTransactionParams, type EthereumSendTransactionRequest, type EthereumSendTransactionResult, type EthereumSign7702AuthorizationParams, type EthereumSign7702AuthorizationResult, type EthereumSignHashParams, type EthereumSignHashResult, type EthereumSignMessageParams, type EthereumSignMessageResult, type EthereumSignTransactionParams, type EthereumSignTransactionResult, type EthereumSignTypedDataParams, type EthereumSignTypedDataResult, type EthereumSwitchChainParams, type EvmChainEntry, type ExportKeyConfig, type Factor, type FlexibleTheme, type FundWalletConfig, type FundingEvents, type FundingMethod, type FundingUIConfig, type GetCurrentSessionRequest, type GetCurrentSessionResponse, type Hex, type IdentityTokenClaims, type IdpProvider, type IsAuthenticatedRequest, type IsAuthenticatedResponse, type ListEphemeralSignersResult, type LoginTokenBundle, type LogoutRequest, type LogoutResponse, type MessageTypeProperty, type MessageTypes, type MoonPaySignRequest, type MoonPaySignResponse, type MpcKeyShares, type NativeCurrency, Network, type OAuthRequest, type OAuthResponse, type OnrampFundingSettings, type PasskeyEnrollConfig, type PasskeySettings, type PreferredCardProvider, type PrefillConfig, type PresenceTokenClaims, type ProvisionEphemeralSignerParams, type ProvisionEphemeralSignerResult, type PublicEthereumWallet, type PublicSessionData, type PublicWallet, type RefreshSessionRequest, type RefreshSessionResponse, type RetrieveWalletKeyRequest, type RetrieveWalletKeyResponse, type RevokeEphemeralSignerParams, type RpcConfig, type RpcUrls, type SdkSettings, type SendEmailOtpRequest, type SendEmailOtpResponse, type SendTransactionConfig, type SendTransactionRequest, type SessionData, type SessionWallet, type SharesDeviceRequest, type SharesDeviceResponse, type Sign7702AuthorizationError, type Sign7702AuthorizationParams, type Sign7702AuthorizationResponse, type Sign7702AuthorizationResult, type SignMessageConfig, type SignTransactionConfig, type SignTypedDataError, type SignTypedDataParams, type SignTypedDataResponse, type SignTypedDataResult, type SmsSettings, type SolanaChain, type SolanaChainEntry, type SolanaFundingConfig, type SolanaGetBalanceParams, type SolanaGetBalanceResult, type SolanaGetTokenAccountsByOwnerParams, type SolanaGetTokenAccountsByOwnerResult, type SolanaSendTransactionParams, type SolanaSendTransactionResult, type SolanaSignMessageParams, type SolanaSignMessageResult, type SolanaSignTransactionParams, type SolanaSignTransactionResult, type TransactionCommitment, type TransactionEncoding, type TransactionUIOptions, type TypedMessage, type UseFundWalletInterface, type UsersMePublicResponse, type UsersMeRequest, type UsersMeResponse, type VerifiedSession, type VerifyEmailOtpRequest, type VerifyEmailOtpResponse, type VerifyEmailOtpUser, type VerifyOAuthTokenRequest, type VerifyOAuthTokenResponse, type VerifySiweWalletRegistrationRequest, WALLET_ERROR_CODES, type Wallet, type WalletChain, type WalletChainType, type WalletConnectConfig, WalletCreationError, type WalletError, type WalletErrorCode, type WalletKeyRequest, type WalletListEntry, type WalletRegistrationNonceRequest, type WalletRegistrationNonceResponse, type WalletType, type WalletVerifyRequest };