import { BitcoinRpcConfig, ChainType, EvmChainKey, SolanaChainKey, SuiChainKey, IconChainKey, NearChainKey, StellarChainKey, StellarRpcConfig, BitcoinChainKey, InjectiveChainKey, InjectiveRpcConfig, StacksChainKey, StacksNetworkName, StacksNetworkLike, ChainKey, baseChainInfo } from '@sodax/types'; import { BitcoinWalletDefaults, EvmWalletDefaults, SolanaWalletDefaults, SuiWalletDefaults, IconWalletDefaults, NearWalletDefaults, StellarWalletDefaults, InjectiveWalletDefaults, StacksWalletDefaults } from '@sodax/wallet-sdk-core'; import { State } from 'wagmi'; import { WalletConnectParameters } from 'wagmi/connectors'; import { I as IXConnector } from './XConnector-12q0OVe5.js'; type SimpleChainEntry = { rpcUrl?: string; defaults?: D; }; type EvmChainEntry = SimpleChainEntry; type SolanaChainEntry = SimpleChainEntry; type SuiChainEntry = SimpleChainEntry; type IconChainEntry = SimpleChainEntry; type NearChainEntry = SimpleChainEntry; type StellarChainEntry = StellarRpcConfig & { defaults?: StellarWalletDefaults; }; type BitcoinChainEntry = BitcoinRpcConfig & { defaults?: BitcoinWalletDefaults; }; type InjectiveChainEntry = InjectiveRpcConfig & { defaults?: InjectiveWalletDefaults; }; type StacksChainEntry = StacksNetworkName | (StacksNetworkLike & { defaults?: StacksWalletDefaults; }); /** Wagmi-config-level settings shared across all configured EVM chains. */ type EvmAdapterFields = { /** Attempt to reconnect previously connected wallets on mount. @default false */ reconnectOnMount?: boolean; /** * wagmi hydration-timing flag (not an "app is SSR" flag). * `true` defers wagmi reconnect into `useEffect`; `false` runs it in render * and triggers React's "setState during render" warning. Keep `true` unless * you know you need otherwise. @default true */ ssr?: boolean; /** * Base key for wagmi's cookie storage (state cookie = `.store`). @default 'sodax'. * SSR server and client must build from the same key, else the server reads the wrong cookie. * The cookie is plaintext and unsigned; `persistKey` only namespaces it — it does not authenticate or encrypt it. */ persistKey?: string; /** Wagmi SSR hydration state — pass `tryCookieToInitialState()` to avoid disconnect flash on first load (Next.js only). */ initialState?: State; /** WalletConnect configuration. Adds a WalletConnect connector when provided. */ walletConnect?: WalletConnectParameters; }; /** `@solana/wallet-adapter-react` provider settings. */ type SolanaAdapterFields = { /** Auto-connect previously connected Solana wallet on mount. @default true */ autoConnect?: boolean; }; /** `@mysten/dapp-kit` provider settings. */ type SuiAdapterFields = { autoConnect?: boolean; /** Default network for the SuiClientProvider. @default 'mainnet' */ network?: 'mainnet' | 'testnet' | 'devnet'; }; /** * Per-chain-type metadata — the only place that needs editing when adding a * new chain type. Keys must match `ChainType`. */ type ChainMeta = { EVM: { keys: EvmChainKey; entry: EvmChainEntry; defaults: EvmWalletDefaults; adapter: EvmAdapterFields; }; SOLANA: { keys: SolanaChainKey; entry: SolanaChainEntry; defaults: SolanaWalletDefaults; adapter: SolanaAdapterFields; }; SUI: { keys: SuiChainKey; entry: SuiChainEntry; defaults: SuiWalletDefaults; adapter: SuiAdapterFields; }; ICON: { keys: IconChainKey; entry: IconChainEntry; defaults: IconWalletDefaults; adapter: {}; }; NEAR: { keys: NearChainKey; entry: NearChainEntry; defaults: NearWalletDefaults; adapter: {}; }; STELLAR: { keys: StellarChainKey; entry: StellarChainEntry; defaults: StellarWalletDefaults; adapter: {}; }; BITCOIN: { keys: BitcoinChainKey; entry: BitcoinChainEntry; defaults: BitcoinWalletDefaults; adapter: {}; }; INJECTIVE: { keys: InjectiveChainKey; entry: InjectiveChainEntry; defaults: InjectiveWalletDefaults; adapter: {}; }; STACKS: { keys: StacksChainKey; entry: StacksChainEntry; defaults: StacksWalletDefaults; adapter: {}; }; }; /** Resolves a `ChainKey` to its `ChainType` via the runtime `baseChainInfo` map. */ type ChainTypeOf = (typeof baseChainInfo)[K]['type']; /** * Flatten `A & B` into a single object type so TypeScript runs excess-property * checks against the merged shape. Intersection types skip EPC, which lets * unknown fields like `rpcUrl` slip into the EVM slot silently — flattening * forces the check to fire on object literals. */ type Merge = { [K in keyof (A & B)]: (A & B)[K]; }; /** Per-chain-type slot shape — adapter fields + nested chain entries map. */ type ChainTypeConfig = Merge>; }>; /** Per-chain-key entry shape — narrows by chain key via `baseChainInfo` lookup. */ type ChainEntry = ChainMeta[ChainTypeOf]['entry']; /** Wallet provider defaults shape for a given chain key. */ type WalletDefaultsByKey = ChainMeta[ChainTypeOf]['defaults']; type EvmTypeConfig = ChainTypeConfig<'EVM'>; type SolanaTypeConfig = ChainTypeConfig<'SOLANA'>; type SuiTypeConfig = ChainTypeConfig<'SUI'>; type BitcoinTypeConfig = ChainTypeConfig<'BITCOIN'>; type StellarTypeConfig = ChainTypeConfig<'STELLAR'>; type InjectiveTypeConfig = ChainTypeConfig<'INJECTIVE'>; type IconTypeConfig = ChainTypeConfig<'ICON'>; type NearTypeConfig = ChainTypeConfig<'NEAR'>; type StacksTypeConfig = ChainTypeConfig<'STACKS'>; /** Top-level config for ``. Omitted chain-type slots are not mounted. */ type SodaxWalletConfig = { [T in ChainType]?: ChainTypeConfig; }; export type { BitcoinChainEntry as B, ChainEntry as C, EvmAdapterFields as E, IconChainEntry as I, NearChainEntry as N, SodaxWalletConfig as S, WalletDefaultsByKey as W, BitcoinTypeConfig as a, ChainMeta as b, ChainTypeConfig as c, ChainTypeOf as d, EvmChainEntry as e, EvmTypeConfig as f, IconTypeConfig as g, InjectiveChainEntry as h, InjectiveTypeConfig as i, NearTypeConfig as j, SolanaAdapterFields as k, SolanaChainEntry as l, SolanaTypeConfig as m, StacksChainEntry as n, StacksTypeConfig as o, StellarChainEntry as p, StellarTypeConfig as q, SuiAdapterFields as r, SuiChainEntry as s, SuiTypeConfig as t };