@kheopskit/core 6.0.0-rc.3 → 6.0.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/MIGRATING_TO_V6.md +78 -17
  3. package/README.md +138 -34
  4. package/dist/ethereum.d.mts +2 -2
  5. package/dist/ethereum.d.ts +2 -2
  6. package/dist/ethereum.js +4 -4
  7. package/dist/ethereum.js.map +1 -1
  8. package/dist/ethereum.mjs +4 -4
  9. package/dist/ethereum.mjs.map +1 -1
  10. package/dist/index.d.mts +12 -27
  11. package/dist/index.d.ts +12 -27
  12. package/dist/index.js +9 -921
  13. package/dist/index.mjs +4 -916
  14. package/dist/{injectedWallets-BQBgS-f0.js → injectedWallets-D7wzBr_f.js} +2 -2
  15. package/dist/{injectedWallets-BQBgS-f0.js.map → injectedWallets-D7wzBr_f.js.map} +1 -1
  16. package/dist/{injectedWallets-5GL1Jder.mjs → injectedWallets-DHf2lYVb.mjs} +2 -2
  17. package/dist/{injectedWallets-5GL1Jder.mjs.map → injectedWallets-DHf2lYVb.mjs.map} +1 -1
  18. package/dist/instance-1BgEld17.d.ts +109 -0
  19. package/dist/instance-BPAvq0v7.mjs +1457 -0
  20. package/dist/instance-BPAvq0v7.mjs.map +1 -0
  21. package/dist/instance-CCP7uJV3.js +1528 -0
  22. package/dist/instance-CCP7uJV3.js.map +1 -0
  23. package/dist/instance-DDvZiq1L.d.mts +109 -0
  24. package/dist/internal.d.mts +3 -3
  25. package/dist/internal.d.ts +3 -3
  26. package/dist/internal.js +8 -6
  27. package/dist/internal.mjs +3 -3
  28. package/dist/{platformAccounts-yyRUrnel.mjs → platformAccounts-BeMDbmUT.mjs} +2 -2
  29. package/dist/{platformAccounts-yyRUrnel.mjs.map → platformAccounts-BeMDbmUT.mjs.map} +1 -1
  30. package/dist/{platformAccounts-BjIeRcFN.js → platformAccounts-FE7oA3-Y.js} +2 -2
  31. package/dist/{platformAccounts-BjIeRcFN.js.map → platformAccounts-FE7oA3-Y.js.map} +1 -1
  32. package/dist/polkadot.d.mts +2 -2
  33. package/dist/polkadot.d.ts +2 -2
  34. package/dist/polkadot.js +6 -7
  35. package/dist/polkadot.js.map +1 -1
  36. package/dist/polkadot.mjs +5 -6
  37. package/dist/polkadot.mjs.map +1 -1
  38. package/dist/{polkadotExtensions-BoVKhNU_.mjs → registryReads-30CCkmHe.js} +43 -2
  39. package/dist/registryReads-30CCkmHe.js.map +1 -0
  40. package/dist/{polkadotExtensions-y4J9UzYl.js → registryReads-HvSaXRWX.mjs} +30 -5
  41. package/dist/registryReads-HvSaXRWX.mjs.map +1 -0
  42. package/dist/solana.d.mts +2 -2
  43. package/dist/solana.d.ts +2 -2
  44. package/dist/solana.js +4 -4
  45. package/dist/solana.js.map +1 -1
  46. package/dist/solana.mjs +4 -4
  47. package/dist/solana.mjs.map +1 -1
  48. package/dist/testing.d.mts +1 -1
  49. package/dist/testing.d.ts +1 -1
  50. package/dist/{types-C3I3w0jb.d.ts → types-BGeGUtxz.d.mts} +14 -4
  51. package/dist/{types-C3I3w0jb.d.mts → types-BGeGUtxz.d.ts} +14 -4
  52. package/dist/{types-BWHvNFlN.js → types-BrMtrjs9.js} +8 -1
  53. package/dist/types-BrMtrjs9.js.map +1 -0
  54. package/dist/{types-Yor672md.mjs → types-D7OWi0Td.mjs} +3 -2
  55. package/dist/types-D7OWi0Td.mjs.map +1 -0
  56. package/dist/walletconnect.d.mts +13 -2
  57. package/dist/walletconnect.d.ts +13 -2
  58. package/dist/walletconnect.js +19 -13
  59. package/dist/walletconnect.js.map +1 -1
  60. package/dist/walletconnect.mjs +19 -13
  61. package/dist/walletconnect.mjs.map +1 -1
  62. package/package.json +1 -1
  63. package/dist/getCachedObservable-LUq9IfEx.d.mts +0 -23
  64. package/dist/getCachedObservable-LUq9IfEx.d.ts +0 -23
  65. package/dist/iconCache-C-U3IEbP.mjs +0 -324
  66. package/dist/iconCache-C-U3IEbP.mjs.map +0 -1
  67. package/dist/iconCache-FR4iy6go.js +0 -377
  68. package/dist/iconCache-FR4iy6go.js.map +0 -1
  69. package/dist/index.js.map +0 -1
  70. package/dist/index.mjs.map +0 -1
  71. package/dist/polkadotExtensions-BoVKhNU_.mjs.map +0 -1
  72. package/dist/polkadotExtensions-y4J9UzYl.js.map +0 -1
  73. package/dist/registryReads-BpHsWLd7.js +0 -38
  74. package/dist/registryReads-BpHsWLd7.js.map +0 -1
  75. package/dist/registryReads-BvtznSo3.mjs +0 -33
  76. package/dist/registryReads-BvtznSo3.mjs.map +0 -1
  77. package/dist/types-BWHvNFlN.js.map +0 -1
  78. package/dist/types-Yor672md.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":["PLATFORM_ORDER"],"sources":["../src/api/config.ts","../src/utils/sortAccounts.ts","../src/utils/sortWallets.ts","../src/api/platform.ts","../src/api/reconnectPolicy.ts","../src/api/hydration.ts","../src/utils/createHydrationBuffer.ts","../src/utils/logObservable.ts","../src/api/accounts.ts","../src/utils/createStore.ts","../src/api/compactStore.ts","../src/api/store.ts","../src/api/wallets.ts","../src/api/kheopskit.ts"],"sourcesContent":["import { KheopskitError } from \"./errors\";\nimport type { KheopskitConfig, KheopskitPlatform } from \"./types\";\n\n/**\n * Default storage key for persisting wallet connection state.\n * Can be overridden via config.storageKey to avoid conflicts\n * when running multiple dapps on the same domain.\n */\nexport const DEFAULT_STORAGE_KEY = \"kheopskit\";\n\nconst DEFAULTS = {\n\tautoReconnect: true,\n\tdebug: false,\n\tstorageKey: DEFAULT_STORAGE_KEY,\n\thydrationGracePeriod: 500,\n\thydrationTimeout: 3000,\n} satisfies Omit<KheopskitConfig, \"platforms\" | \"walletConnect\">;\n\nexport const resolveConfig = <\n\tconst P extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n>(\n\tconfig?: Partial<KheopskitConfig<P>>,\n): KheopskitConfig<P> => {\n\tconst platforms = (config?.platforms ?? []) as P;\n\n\t// Guard the v4 breaking change: platforms are plugin instances, not strings.\n\t// Catches JS callers (no tsc) and gives agents a fix that names the doc.\n\tconst invalidPlatforms = (platforms as readonly unknown[]).filter(\n\t\t(p) =>\n\t\t\ttypeof p !== \"object\" ||\n\t\t\tp === null ||\n\t\t\ttypeof (p as { getWallets$?: unknown }).getWallets$ !== \"function\",\n\t);\n\tif (invalidPlatforms.length > 0) {\n\t\tthrow new Error(\n\t\t\t\"[kheopskit] config.platforms must contain plugin instances created by the \" +\n\t\t\t\t\"per-platform factories (e.g. platforms: [polkadot(), ethereum(), solana()] \" +\n\t\t\t\t'imported from \"@kheopskit/core/<platform>\"). ' +\n\t\t\t\t`Invalid entries: ${JSON.stringify(invalidPlatforms)}. ` +\n\t\t\t\t'String platform names like \"polkadot\" were removed in v4 — see MIGRATING_TO_V4.md.',\n\t\t);\n\t}\n\n\tif (\n\t\tconfig?.walletConnect !== undefined &&\n\t\ttypeof (config.walletConnect as { getWallet$?: unknown } | null)\n\t\t\t?.getWallet$ !== \"function\"\n\t) {\n\t\tthrow new KheopskitError(\n\t\t\t\"INVALID_CONFIG\",\n\t\t\t\"config.walletConnect must be created by walletConnect() imported from \" +\n\t\t\t\t'\"@kheopskit/core/walletconnect\", e.g. walletConnect: walletConnect({ projectId, metadata, networks }). ' +\n\t\t\t\t\"Raw WalletConnect options were removed in v6, see MIGRATING_TO_V6.md.\",\n\t\t);\n\t}\n\n\tif (platforms.length === 0) {\n\t\tconsole.warn(\n\t\t\t\"[kheopskit] No platforms configured; wallets and accounts will be empty. \" +\n\t\t\t\t'Pass e.g. platforms: [polkadot()] from \"@kheopskit/core/polkadot\".',\n\t\t);\n\t}\n\n\treturn Object.assign({}, DEFAULTS, config, { platforms });\n};\n","import type { BaseWalletAccount, WalletPlatform } from \"../api/types\";\n\nconst PLATFORM_ORDER: Record<WalletPlatform, number> = {\n\tpolkadot: 0,\n\tethereum: 1,\n\tsolana: 2,\n};\n\nconst byPlatform = (a1: BaseWalletAccount, a2: BaseWalletAccount) =>\n\tPLATFORM_ORDER[a1.platform] - PLATFORM_ORDER[a2.platform];\n\n// Group accounts by wallet, surfacing Talisman first (case-insensitive).\nconst byWalletName = (a1: BaseWalletAccount, a2: BaseWalletAccount) => {\n\tif (a1.walletName === a2.walletName) return 0;\n\tif (a1.walletName.toLowerCase() === \"talisman\") return -1;\n\tif (a2.walletName.toLowerCase() === \"talisman\") return 1;\n\treturn a1.walletName.localeCompare(a2.walletName);\n};\n\nexport const sortAccounts = (a1: BaseWalletAccount, a2: BaseWalletAccount) =>\n\tbyPlatform(a1, a2) || byWalletName(a1, a2);\n","import {\n\ttype BaseWallet,\n\tisWalletConnectWallet,\n\ttype WalletConnectWallet,\n\ttype WalletPlatform,\n} from \"../api/types\";\n\nconst PLATFORM_ORDER: Record<WalletPlatform, number> = {\n\tpolkadot: 0,\n\tethereum: 1,\n\tsolana: 2,\n};\n\n// The platform-less WalletConnect connector sorts after all platform wallets.\nconst orderOf = (wallet: BaseWallet | WalletConnectWallet) =>\n\tisWalletConnectWallet(wallet) ? 3 : PLATFORM_ORDER[wallet.platform];\n\nexport const sortWallets = (\n\tw1: BaseWallet | WalletConnectWallet,\n\tw2: BaseWallet | WalletConnectWallet,\n) => {\n\t// Sort by platform first: polkadot, then ethereum, then solana, then WC\n\tconst o1 = orderOf(w1);\n\tconst o2 = orderOf(w2);\n\tif (o1 !== o2) return o1 - o2;\n\n\t// Sort by name, but Talisman first\n\tif (w1.name.toLowerCase() === \"talisman\") return -1;\n\tif (w2.name.toLowerCase() === \"talisman\") return 1;\n\n\treturn w1.name.localeCompare(w2.name);\n};\n","import type { CachedAccount, KheopskitPlatform } from \"./types\";\n\n/**\n * Whether a cached account should survive SSR hydration, per its platform\n * plugin's `acceptsCachedAccount` hook. Plugins without the hook (and platforms\n * with no enabled plugin) accept all — matching the pre-plugin behavior where\n * only Polkadot accounts were filtered (by key type).\n */\nexport const acceptsCachedAccount = (\n\tcached: CachedAccount,\n\tplatforms: readonly KheopskitPlatform[],\n): boolean => {\n\tconst plugin = platforms.find((p) => p.platform === cached.platform);\n\treturn plugin?.acceptsCachedAccount?.(cached) ?? true;\n};\n","import { isEqual } from \"lodash-es\";\nimport {\n\tdistinctUntilChanged,\n\tmap,\n\ttype Observable,\n\tscan,\n\tswitchMap,\n\ttake,\n} from \"rxjs\";\nimport type { WalletId } from \"../utils/WalletId\";\nimport type { KheopskitStore } from \"./store\";\nimport type { BaseWallet, KheopskitConfig } from \"./types\";\n\n// `maxAttempts` caps retries: wallets$ re-emits on every discovery change, so a\n// connect that always rejects would otherwise be re-attempted on each one.\nexport type ReconnectPolicyOptions = {\n\t/** @default 3 */\n\tmaxAttempts?: number;\n};\n\ntype ReconnectAttemptState =\n\t| { kind: \"pending\" }\n\t| { kind: \"reconnected\" }\n\t| { kind: \"settled\" }\n\t| { kind: \"failed\"; attempts: number };\n\nexport const createReconnectPolicy = ({\n\tmaxAttempts = 3,\n}: ReconnectPolicyOptions = {}) => {\n\tconst states = new Map<string, ReconnectAttemptState>();\n\n\tconst shouldAttempt = (walletId: string): boolean => {\n\t\tconst state = states.get(walletId);\n\t\tif (!state) return true;\n\t\treturn state.kind === \"failed\" && state.attempts < maxAttempts;\n\t};\n\n\tconst attempt = async (\n\t\twalletId: string,\n\t\tconnect: () => Promise<unknown>,\n\t): Promise<boolean> => {\n\t\tif (!shouldAttempt(walletId)) return false;\n\n\t\tconst before = states.get(walletId);\n\t\tstates.set(walletId, { kind: \"pending\" });\n\t\tconst recordOutcome = (outcome: ReconnectAttemptState) => {\n\t\t\tif (states.get(walletId)?.kind !== \"settled\")\n\t\t\t\tstates.set(walletId, outcome);\n\t\t};\n\t\ttry {\n\t\t\tawait connect();\n\t\t\trecordOutcome({ kind: \"reconnected\" });\n\t\t\treturn true;\n\t\t} catch (err) {\n\t\t\tconst attempts = before?.kind === \"failed\" ? before.attempts + 1 : 1;\n\t\t\trecordOutcome({ kind: \"failed\", attempts });\n\t\t\tthrow err;\n\t\t}\n\t};\n\n\tconst settle = (walletId: string) => {\n\t\tstates.set(walletId, { kind: \"settled\" });\n\t};\n\n\treturn { shouldAttempt, attempt, settle };\n};\n\n// Shared by the first-frame snapshot and the live attempt: both must evaluate\n// `autoReconnect` identically or the server and client markup diverge.\nexport const reconnectAccepts = (\n\tautoReconnect: KheopskitConfig[\"autoReconnect\"],\n\twallet: BaseWallet,\n): boolean =>\n\ttypeof autoReconnect === \"function\" ? autoReconnect(wallet) : autoReconnect;\n\n// Wallets remembered at subscribe and never forgotten since: a connect during\n// the session never adds a reconnect, and a forget cancels one for good.\nexport const reconnectCandidates$ = (\n\tstore: KheopskitStore,\n): Observable<WalletId[]> => {\n\tconst remembered$ = store.observable.pipe(map((s) => s.remembered ?? []));\n\treturn remembered$.pipe(\n\t\ttake(1),\n\t\tswitchMap((initial) =>\n\t\t\tremembered$.pipe(\n\t\t\t\tscan(\n\t\t\t\t\t(remaining, current) =>\n\t\t\t\t\t\tremaining.filter((id) => current.includes(id)),\n\t\t\t\t\tinitial,\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t\tdistinctUntilChanged<WalletId[]>(isEqual),\n\t);\n};\n","import { hydrateAccount, hydrateWallet } from \"../utils/hydrateState\";\nimport { getCachedIcon } from \"../utils/iconCache\";\nimport { sortAccounts } from \"../utils/sortAccounts\";\nimport { sortWallets } from \"../utils/sortWallets\";\nimport { acceptsCachedAccount } from \"./platform\";\nimport { reconnectAccepts } from \"./reconnectPolicy\";\nimport type { KheopskitStore } from \"./store\";\nimport type {\n\tBaseWallet,\n\tBaseWalletAccount,\n\tKheopskitConfig,\n\tWalletConnectWallet,\n} from \"./types\";\nimport { isInjectedWallet } from \"./types\";\n\n/** Result of {@link getHydratedSnapshot}: placeholder wallets and accounts built from the cache. */\nexport type HydratedSnapshot = {\n\twallets: (BaseWallet | WalletConnectWallet)[];\n\taccounts: BaseWalletAccount[];\n};\n\nexport type GetHydratedSnapshotOptions = {\n\t/**\n\t * Enrich wallets that have no icon from the localStorage icon cache.\n\t *\n\t * Must stay `false` for any snapshot that has to match server-rendered markup\n\t * (React's `getServerSnapshot` runs on the client during hydration, where the\n\t * icon cache is populated — enriching there would diverge from the server,\n\t * which always sees an empty cache).\n\t */\n\ticons?: boolean;\n};\n\n/**\n * Builds the cached-state snapshot every consumer must agree on: read the\n * store's cached state, hydrate wallets/accounts into placeholders, apply the\n * `autoReconnect` rule (a cached connected wallet it rejects becomes\n * `disconnected` and loses its cached accounts), filter accounts through each\n * platform plugin's `acceptsCachedAccount` hook, and sort with the same\n * comparators the live pipeline uses.\n *\n * This is the single implementation behind the observable's initial seed and\n * both React snapshot sources (`serverValue`/`initialValue`). They must produce\n * the same shape in the same order or the UI flickers/reorders on reload — by\n * sharing this helper, that agreement holds by construction.\n */\nexport const getHydratedSnapshot = (\n\tstore: KheopskitStore,\n\tconfig: Pick<KheopskitConfig, \"platforms\" | \"autoReconnect\">,\n\toptions: GetHydratedSnapshotOptions = {},\n): HydratedSnapshot => {\n\tconst cached = store.getCachedState();\n\n\tconst wallets = cached.wallets\n\t\t.map(hydrateWallet)\n\t\t.map((wallet) =>\n\t\t\twallet.status === \"connecting\" &&\n\t\t\tisInjectedWallet(wallet) &&\n\t\t\t!reconnectAccepts(config.autoReconnect, wallet)\n\t\t\t\t? { ...wallet, status: \"disconnected\" as const }\n\t\t\t\t: wallet,\n\t\t)\n\t\t.map((wallet) => {\n\t\t\t// Some wallets (e.g. Ethereum) have no SSR-safe icon; optionally fill it\n\t\t\t// from the localStorage cache.\n\t\t\tif (!options.icons || wallet.icon) return wallet;\n\t\t\tconst icon = getCachedIcon(wallet.id);\n\t\t\treturn icon ? { ...wallet, icon } : wallet;\n\t\t})\n\t\t.sort(sortWallets);\n\n\tconst disconnected = new Set(\n\t\twallets.filter((w) => w.status === \"disconnected\").map((w) => w.id),\n\t);\n\n\tconst accounts = cached.accounts\n\t\t.filter((account) => !disconnected.has(account.walletId))\n\t\t.filter((account) => acceptsCachedAccount(account, config.platforms))\n\t\t.map(hydrateAccount)\n\t\t.sort(sortAccounts);\n\n\treturn { wallets, accounts };\n};\n","import {\n\tBehaviorSubject,\n\tcombineLatest,\n\tfilter,\n\tmap,\n\tObservable,\n\tSubscription,\n\tstartWith,\n\ttake,\n\ttimer,\n} from \"rxjs\";\n\ntype HydrationBufferResult<T> = {\n\titems: T[];\n\tisHydrating: boolean;\n};\n\nconst createBufferCore = <L, C>(\n\tcachedItems: C[],\n\tliveItems$: Observable<L[]>,\n\tgracePeriodMs: number,\n\ttimeoutMs: number,\n\tmergeFn: (liveItems: L[], cachedItems: C[]) => (L | C)[],\n\tsettled$?: Observable<boolean>,\n): Observable<HydrationBufferResult<L | C>> => {\n\tif (gracePeriodMs <= 0 || cachedItems.length === 0) {\n\t\treturn liveItems$.pipe(map((items) => ({ items, isHydrating: false })));\n\t}\n\n\treturn new Observable<HydrationBufferResult<L | C>>((subscriber) => {\n\t\tconst subscriptions = new Subscription();\n\t\tconst isHydrating$ = new BehaviorSubject(true);\n\t\tconst endHydration = () => {\n\t\t\tif (isHydrating$.value) isHydrating$.next(false);\n\t\t};\n\n\t\tconst graceElapsed$ = timer(gracePeriodMs).pipe(\n\t\t\tmap(() => true),\n\t\t\tstartWith(false),\n\t\t);\n\t\tconst ended$: Observable<unknown> = settled$\n\t\t\t? combineLatest([graceElapsed$, settled$]).pipe(\n\t\t\t\t\tfilter(([graceElapsed, settled]) => graceElapsed && settled),\n\t\t\t\t\ttake(1),\n\t\t\t\t)\n\t\t\t: timer(gracePeriodMs);\n\t\tsubscriptions.add(ended$.subscribe(endHydration));\n\t\tsubscriptions.add(timer(timeoutMs).subscribe(endHydration));\n\n\t\tsubscriptions.add(\n\t\t\tcombineLatest([liveItems$.pipe(startWith([] as L[])), isHydrating$])\n\t\t\t\t.pipe(\n\t\t\t\t\tmap(([liveItems, isHydrating]) =>\n\t\t\t\t\t\tisHydrating\n\t\t\t\t\t\t\t? { items: mergeFn(liveItems, cachedItems), isHydrating }\n\t\t\t\t\t\t\t: { items: liveItems, isHydrating },\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\t.subscribe(subscriber),\n\t\t);\n\n\t\treturn () => {\n\t\t\tsubscriptions.unsubscribe();\n\t\t\tisHydrating$.complete();\n\t\t};\n\t});\n};\n\n/**\n * Creates a hydration buffer that merges cached items with live items.\n *\n * During hydration, cached items take precedence over live items with the same key.\n * This preserves the cached connected state (e.g., isConnected: true) while\n * auto-reconnect is still in progress. New live items not in the cache are added.\n *\n * @param cachedItems - Initial cached items from storage\n * @param liveItems$ - Observable of live items as they become available\n * @param gracePeriodMs - Minimum time in ms the cached items are shown\n * @param timeoutMs - Upper bound in ms on hydration\n * @param getKey - Function to extract a unique key from an item\n * @param settled$ - Whether the live state has caught up with the cache\n * @param mergeItem - Optional function to merge a live item with its cached counterpart\n * @param transformCachedOnly - Optional function to transform cached items not yet in the live stream\n */\nexport const createHydrationBuffer = <L, C>(\n\tcachedItems: C[],\n\tliveItems$: Observable<L[]>,\n\tgracePeriodMs: number,\n\ttimeoutMs: number,\n\tgetKey: (item: L | C) => string,\n\tsettled$?: Observable<boolean>,\n\tmergeItem?: (liveItem: L, cachedItem: C) => L | C,\n\ttransformCachedOnly?: (cachedItem: C) => C,\n): Observable<HydrationBufferResult<L | C>> => {\n\treturn createBufferCore(\n\t\tcachedItems,\n\t\tliveItems$,\n\t\tgracePeriodMs,\n\t\ttimeoutMs,\n\t\t(liveItems, cached) => {\n\t\t\tconst cachedByKey = new Map(cached.map((item) => [getKey(item), item]));\n\t\t\tconst liveKeys = new Set(liveItems.map(getKey));\n\n\t\t\t// For items in both live and cached, prefer cached (preserves connected state)\n\t\t\t// but allow mergeItem to customize how they're combined\n\t\t\t// For items only in live (newly discovered), use the live version\n\t\t\tconst mergedItems: (L | C)[] = liveItems.map((liveItem) => {\n\t\t\t\tconst key = getKey(liveItem);\n\t\t\t\tconst cachedItem = cachedByKey.get(key);\n\t\t\t\tif (!cachedItem) return liveItem;\n\t\t\t\treturn mergeItem ? mergeItem(liveItem, cachedItem) : cachedItem;\n\t\t\t});\n\n\t\t\t// Add cached items not yet in the live stream (e.g., extensions not yet detected)\n\t\t\tfor (const cachedItem of cached) {\n\t\t\t\tif (!liveKeys.has(getKey(cachedItem))) {\n\t\t\t\t\tconst transformed = transformCachedOnly\n\t\t\t\t\t\t? transformCachedOnly(cachedItem)\n\t\t\t\t\t\t: cachedItem;\n\t\t\t\t\tmergedItems.push(transformed);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mergedItems;\n\t\t},\n\t\tsettled$,\n\t);\n};\n\n/**\n * Creates a hydration buffer specifically for accounts, which need special handling.\n *\n * Accounts are grouped by wallet - when a wallet provides its account list,\n * we replace all cached accounts for that wallet with the live ones.\n * Cached accounts for wallets that haven't provided accounts yet are preserved.\n *\n * @param cachedAccounts - Initial cached accounts from storage\n * @param liveAccounts$ - Observable of live accounts as they become available\n * @param gracePeriodMs - Minimum time in ms the cached accounts are shown\n * @param timeoutMs - Upper bound in ms on hydration\n * @param getWalletId - Function to extract the wallet ID from an account\n * @param settled$ - Whether the live state has caught up with the cache\n */\nexport const createAccountHydrationBuffer = <T>(\n\tcachedAccounts: T[],\n\tliveAccounts$: Observable<T[]>,\n\tgracePeriodMs: number,\n\ttimeoutMs: number,\n\tgetWalletId: (account: T) => string,\n\tsettled$?: Observable<boolean>,\n): Observable<HydrationBufferResult<T>> => {\n\treturn createBufferCore(\n\t\tcachedAccounts,\n\t\tliveAccounts$,\n\t\tgracePeriodMs,\n\t\ttimeoutMs,\n\t\t(liveAccounts, cached) => {\n\t\t\tconst walletsWithLiveAccounts = new Set(liveAccounts.map(getWalletId));\n\t\t\tconst mergedAccounts: T[] = [...liveAccounts];\n\n\t\t\tfor (const cachedAccount of cached) {\n\t\t\t\tif (!walletsWithLiveAccounts.has(getWalletId(cachedAccount))) {\n\t\t\t\t\tmergedAccounts.push(cachedAccount);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mergedAccounts;\n\t\t},\n\t\tsettled$,\n\t);\n};\n","import { type MonoTypeOperatorFunction, tap } from \"rxjs\";\n\ntype Opts = {\n\tprintValue?: boolean;\n\tenabled?: boolean;\n};\n\nexport const logObservable = <T>(\n\tlabel: string,\n\topts?: Opts,\n): MonoTypeOperatorFunction<T> =>\n\ttap((value) => {\n\t\tconst { printValue = false, enabled = true } = opts || {};\n\n\t\tif (!label || !enabled) return;\n\n\t\tconst text = `[kheopskit] observable ${label} emit`;\n\n\t\tif (printValue) console.debug(text, value);\n\t\telse console.debug(text);\n\t});\n","import { combineLatest, map, Observable, of, shareReplay } from \"rxjs\";\nimport { sortAccounts } from \"../utils/sortAccounts\";\nimport { framesOf, type PlatformAccountsFrame } from \"./platformAccounts\";\nimport type {\n\tBaseWallet,\n\tBaseWalletAccount,\n\tKheopskitConfig,\n\tWalletConnectWallet,\n} from \"./types\";\nimport { isWalletConnectWallet } from \"./types\";\n\nexport type AccountsFrame = PlatformAccountsFrame<BaseWalletAccount>;\n\nexport const getAccounts$ = (\n\tconfig: KheopskitConfig,\n\twallets: Observable<(BaseWallet | WalletConnectWallet)[]>,\n) => {\n\treturn new Observable<AccountsFrame>((subscriber) => {\n\t\t// Each plugin gets its own platform's (injected) wallets plus the shared\n\t\t// WalletConnect connector; it derives WC accounts only for the namespaces\n\t\t// the session carries.\n\t\tconst sources = config.platforms.map((plugin) =>\n\t\t\tframesOf(\n\t\t\t\tplugin.getAccounts$(\n\t\t\t\t\twallets.pipe(\n\t\t\t\t\t\tmap((ws) =>\n\t\t\t\t\t\t\tws.filter(\n\t\t\t\t\t\t\t\t(w) =>\n\t\t\t\t\t\t\t\t\tisWalletConnectWallet(w) || w.platform === plugin.platform,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\tconst frames$ = sources.length\n\t\t\t? combineLatest(sources).pipe(\n\t\t\t\t\tmap((frames) => ({\n\t\t\t\t\t\taccounts: frames\n\t\t\t\t\t\t\t.flatMap((frame) => frame.accounts)\n\t\t\t\t\t\t\t.sort(sortAccounts),\n\t\t\t\t\t\tanswered: frames.flatMap((frame) => frame.answered),\n\t\t\t\t\t})),\n\t\t\t\t)\n\t\t\t: of<AccountsFrame>({ accounts: [], answered: [] });\n\n\t\tconst sub = frames$.subscribe(subscriber);\n\n\t\treturn () => {\n\t\t\tsub.unsubscribe();\n\t\t};\n\t}).pipe(shareReplay({ refCount: true, bufferSize: 1 }));\n};\n","import { BehaviorSubject, Observable } from \"rxjs\";\nimport { type SyncableStorage, safeLocalStorage } from \"./storage\";\n\nexport const createStore = <T>(\n\tkey: string,\n\tdefaultValue: T,\n\tstorage: SyncableStorage = safeLocalStorage,\n\tnormalize: (value: T) => T = (value) => value,\n) => {\n\tconst read = (str: string | null) => normalize(parseData(str, defaultValue));\n\tconst syncsAcrossTabs =\n\t\ttypeof window !== \"undefined\" && storage.subscribe !== undefined;\n\tconst subject = new BehaviorSubject<T>(read(storage.getItem(key)));\n\tlet observers = 0;\n\tlet stopSync: (() => void) | undefined;\n\n\tconst latestValue = () => {\n\t\tif (syncsAcrossTabs && observers === 0)\n\t\t\tsubject.next(read(storage.getItem(key)));\n\t\treturn subject.getValue();\n\t};\n\n\tconst observable = new Observable<T>((subscriber) => {\n\t\tif (observers === 0 && syncsAcrossTabs) {\n\t\t\tlatestValue();\n\t\t\tstopSync = storage.subscribe?.(key, (newValue) => {\n\t\t\t\tsubject.next(read(newValue));\n\t\t\t});\n\t\t}\n\t\tobservers++;\n\t\tconst subscription = subject.subscribe(subscriber);\n\t\treturn () => {\n\t\t\tsubscription.unsubscribe();\n\t\t\tobservers--;\n\t\t\tif (observers === 0) stopSync?.();\n\t\t};\n\t});\n\n\tconst update = (val: T) => {\n\t\tpersistBestEffort(key, val, storage);\n\t\tsubject.next(val);\n\t};\n\n\treturn {\n\t\tobservable,\n\t\tset: (val: T) => update(val),\n\t\tmutate: (transform: (prev: T) => T) => update(transform(latestValue())),\n\t\tget: () => structuredClone(latestValue()),\n\t\tdestroy: () => subject.complete(),\n\t};\n};\n\nconst parseData = <T>(str: string | null, defaultValue: T): T => {\n\ttry {\n\t\tif (str) return JSON.parse(str);\n\t} catch {\n\t\t// invalid data\n\t}\n\treturn defaultValue;\n};\n\nconst persistBestEffort = <T>(\n\tkey: string,\n\tval: T,\n\tstorage: SyncableStorage,\n) => {\n\tconst str = JSON.stringify(val);\n\ttry {\n\t\tstorage.setItem(key, str);\n\t} catch {}\n};\n","import { isWalletPlatform } from \"../utils/isWalletPlatform\";\nimport { cookieStorage } from \"../utils/storage\";\nimport { getWalletAccountId } from \"../utils/WalletAccountId\";\nimport {\n\tisValidWalletId,\n\tparseWalletId,\n\tWALLET_CONNECT_WALLET_ID,\n\ttype WalletId,\n} from \"../utils/WalletId\";\nimport type {\n\tCachedAccount,\n\tCachedWallet,\n\tKheopskitStoreData,\n\tWalletPlatform,\n} from \"./types\";\n\n/**\n * Compact wire format for the cookie-persisted store (`CompactStoreV1`).\n *\n * Cookies are size-constrained (~4KB per cookie, sent on every request), so the\n * persisted {@link KheopskitStoreData} is encoded as terse tuples with\n * single-letter keys instead of raw JSON. This module owns that format: the\n * encoder, the defensive decoder, and the lazy migration from the legacy\n * verbose-JSON cookies written by older versions.\n *\n * Any change here is a compatibility question — new fields must be optional and\n * decoding must keep accepting everything older versions wrote (or degrade to\n * \"start fresh\", never throw).\n */\n\n// wallet type: 0=injected, 1=walletconnect\ntype CompactWalletEntry = [WalletId, string, 0 | 1, 0 | 1];\ntype CompactPolkadotAccountType = 0 | 1 | 2 | 3;\n// platform: 0=polkadot, 1=ethereum, 2=solana\ntype CompactPlatformCode = 0 | 1 | 2;\ntype CompactAccountEntry = [\n\tWalletId,\n\tstring,\n\tstring | null,\n\tnumber | null,\n\tCompactPolkadotAccountType | null,\n\t// Platform code. Newly written entries always include it (the WalletConnect\n\t// connector's walletId is platform-less, so platform can't be derived from\n\t// it); absent in entries written by older versions, where it's derived from\n\t// the walletId instead.\n\t(CompactPlatformCode | null)?,\n];\n\ntype CompactStoreV1 = {\n\tv: 1;\n\t// remembered\n\tr?: WalletId[];\n\t// wallets: [id, name, isConnected(0|1), type(0=injected,1=walletconnect)?]\n\tw?: CompactWalletEntry[];\n\t// accounts: [walletId, address, name?, chainId?, polkadotType?, platform?]\n\ta?: CompactAccountEntry[];\n};\n\nconst EMPTY_STORE_DATA: KheopskitStoreData = {};\n\ntype PreV6StoreData = KheopskitStoreData & { autoReconnect?: unknown };\n\nexport const migratePreV6StoreData = (\n\tdata: PreV6StoreData,\n): KheopskitStoreData => {\n\tif (data?.autoReconnect === undefined) return data;\n\tconst { autoReconnect, ...rest } = data;\n\treturn rest.remembered === undefined && Array.isArray(autoReconnect)\n\t\t? { ...rest, remembered: autoReconnect }\n\t\t: rest;\n};\n\nconst toCompactPolkadotAccountType = (\n\ttype: CachedAccount[\"polkadotAccountType\"],\n): CompactPolkadotAccountType | null => {\n\tswitch (type) {\n\t\tcase \"sr25519\":\n\t\t\treturn 0;\n\t\tcase \"ed25519\":\n\t\t\treturn 1;\n\t\tcase \"ecdsa\":\n\t\t\treturn 2;\n\t\tcase \"ethereum\":\n\t\t\treturn 3;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\nconst fromCompactPolkadotAccountType = (\n\ttype: CompactPolkadotAccountType | null | undefined,\n): CachedAccount[\"polkadotAccountType\"] => {\n\tswitch (type) {\n\t\tcase 0:\n\t\t\treturn \"sr25519\";\n\t\tcase 1:\n\t\t\treturn \"ed25519\";\n\t\tcase 2:\n\t\t\treturn \"ecdsa\";\n\t\tcase 3:\n\t\t\treturn \"ethereum\";\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n};\n\nconst toCompactPlatform = (platform: WalletPlatform): CompactPlatformCode => {\n\tswitch (platform) {\n\t\tcase \"polkadot\":\n\t\t\treturn 0;\n\t\tcase \"ethereum\":\n\t\t\treturn 1;\n\t\tcase \"solana\":\n\t\t\treturn 2;\n\t}\n};\n\nconst fromCompactPlatform = (\n\tcode: CompactPlatformCode | null | undefined,\n): WalletPlatform | undefined => {\n\tswitch (code) {\n\t\tcase 0:\n\t\t\treturn \"polkadot\";\n\t\tcase 1:\n\t\t\treturn \"ethereum\";\n\t\tcase 2:\n\t\t\treturn \"solana\";\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n};\n\nconst isCompactStore = (value: unknown): value is CompactStoreV1 => {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n\tif (\"cachedWallets\" in value || \"cachedAccounts\" in value) return false;\n\treturn \"v\" in value || \"w\" in value || \"a\" in value || \"r\" in value;\n};\n\nconst toCompactStore = (data: KheopskitStoreData): CompactStoreV1 => {\n\tconst wallets = data.cachedWallets?.map(\n\t\t(wallet): CompactWalletEntry => [\n\t\t\twallet.id,\n\t\t\twallet.name,\n\t\t\twallet.isConnected ? 1 : 0,\n\t\t\twallet.type === \"walletconnect\" ? 1 : 0,\n\t\t],\n\t);\n\n\tconst accounts = data.cachedAccounts?.map(\n\t\t(account): CompactAccountEntry => [\n\t\t\taccount.walletId,\n\t\t\taccount.address,\n\t\t\taccount.name ?? null,\n\t\t\taccount.chainId ?? null,\n\t\t\ttoCompactPolkadotAccountType(account.polkadotAccountType),\n\t\t\ttoCompactPlatform(account.platform),\n\t\t],\n\t);\n\n\treturn {\n\t\tv: 1,\n\t\tr: data.remembered,\n\t\tw: wallets?.length ? wallets : undefined,\n\t\ta: accounts?.length ? accounts : undefined,\n\t};\n};\n\nconst fromCompactStore = (data: CompactStoreV1): KheopskitStoreData => {\n\tconst walletNameMap = new Map<WalletId, string>();\n\n\t// Decode defensively: a compact payload may be malformed (older/corrupt\n\t// cookie, hand-edited). Skip entries with an unparseable wallet id rather\n\t// than throwing, which would crash store initialisation.\n\tconst wallets: CachedWallet[] = [];\n\tfor (const item of Array.isArray(data.w) ? data.w : []) {\n\t\tif (!Array.isArray(item)) continue;\n\t\tconst [id, name, isConnected, type] = item;\n\t\tif (!isValidWalletId(id)) continue;\n\t\tconst isWalletConnect = id === WALLET_CONNECT_WALLET_ID;\n\t\tconst walletType = type === 1 ? \"walletconnect\" : \"injected\";\n\t\t// Keep id/type consistent: the platform-less connector uses the fixed WC\n\t\t// id; everything else is a platform-prefixed injected wallet. Drop stale\n\t\t// mismatches (e.g. per-platform WC ids from older versions).\n\t\tif (isWalletConnect !== (walletType === \"walletconnect\")) continue;\n\t\twalletNameMap.set(id, name);\n\t\twallets.push({\n\t\t\tid,\n\t\t\tplatform: isWalletConnect ? undefined : parseWalletId(id).platform,\n\t\t\ttype: walletType,\n\t\t\tname,\n\t\t\tisConnected: isConnected === 1,\n\t\t});\n\t}\n\n\tconst accounts: CachedAccount[] = [];\n\tfor (const item of Array.isArray(data.a) ? data.a : []) {\n\t\tif (!Array.isArray(item)) continue;\n\t\tconst [\n\t\t\twalletId,\n\t\t\taddress,\n\t\t\tname,\n\t\t\tchainId,\n\t\t\tpolkadotAccountType,\n\t\t\tplatformCode,\n\t\t] = item;\n\t\tif (!isValidWalletId(walletId) || typeof address !== \"string\" || !address)\n\t\t\tcontinue;\n\t\t// Prefer the explicit platform code; fall back to deriving it from the\n\t\t// walletId for entries written before the code existed (never WC ones).\n\t\tconst platform =\n\t\t\tplatformCode != null\n\t\t\t\t? fromCompactPlatform(platformCode)\n\t\t\t\t: walletId === WALLET_CONNECT_WALLET_ID\n\t\t\t\t\t? undefined\n\t\t\t\t\t: parseWalletId(walletId).platform;\n\t\tif (!isWalletPlatform(platform)) continue;\n\t\taccounts.push({\n\t\t\tid: getWalletAccountId(walletId, address),\n\t\t\tplatform,\n\t\t\taddress,\n\t\t\tname: name ?? undefined,\n\t\t\tchainId: chainId ?? undefined,\n\t\t\tpolkadotAccountType:\n\t\t\t\tplatform === \"polkadot\"\n\t\t\t\t\t? fromCompactPolkadotAccountType(polkadotAccountType)\n\t\t\t\t\t: undefined,\n\t\t\twalletId,\n\t\t\twalletName: walletNameMap.get(walletId) ?? walletId,\n\t\t});\n\t}\n\n\treturn {\n\t\tremembered: data.r,\n\t\tcachedWallets: wallets,\n\t\tcachedAccounts: accounts,\n\t};\n};\n\nconst decodeStore = (raw: string, fallback: KheopskitStoreData) => {\n\ttry {\n\t\tconst parsed = JSON.parse(raw) as unknown;\n\t\tif (isCompactStore(parsed)) return fromCompactStore(parsed);\n\t\treturn migratePreV6StoreData(parsed as PreV6StoreData);\n\t} catch {\n\t\treturn fallback;\n\t}\n};\n\nconst encodeStore = (data: KheopskitStoreData): string =>\n\tJSON.stringify(toCompactStore(data));\n\n/**\n * Cookie storage that transparently encodes/decodes {@link CompactStoreV1},\n * migrating legacy verbose-JSON cookies to the compact format on first read.\n */\nexport const createCompactCookieStorage = (initialCookies?: string) => {\n\tconst base = cookieStorage(initialCookies);\n\n\treturn {\n\t\tgetItem: (key: string) => {\n\t\t\tconst raw = base.getItem(key);\n\t\t\tif (!raw) return null;\n\t\t\tconst expanded = decodeStore(raw, EMPTY_STORE_DATA);\n\t\t\tif (typeof document !== \"undefined\") {\n\t\t\t\ttry {\n\t\t\t\t\tconst parsed = JSON.parse(raw) as unknown;\n\t\t\t\t\tif (!isCompactStore(parsed)) {\n\t\t\t\t\t\tbase.setItem(key, encodeStore(expanded));\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Ignore malformed cookie during migration\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn JSON.stringify(expanded);\n\t\t},\n\t\tsetItem: (key: string, value: string) => {\n\t\t\tconst expanded = decodeStore(value, EMPTY_STORE_DATA);\n\t\t\tbase.setItem(key, encodeStore(expanded));\n\t\t},\n\t\tremoveItem: base.removeItem,\n\t\tsubscribe: (key: string, callback: (value: string | null) => void) => {\n\t\t\tconst unsubscribe = base.subscribe?.(key, (value) => {\n\t\t\t\tif (!value) {\n\t\t\t\t\tcallback(null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst expanded = decodeStore(value, EMPTY_STORE_DATA);\n\t\t\t\tcallback(JSON.stringify(expanded));\n\t\t\t});\n\t\t\treturn () => {\n\t\t\t\tunsubscribe?.();\n\t\t\t};\n\t\t},\n\t};\n};\n","import { uniq } from \"lodash-es\";\nimport { createStore } from \"../utils/createStore\";\nimport { isWalletPlatform } from \"../utils/isWalletPlatform\";\nimport { type SyncableStorage, safeLocalStorage } from \"../utils/storage\";\nimport {\n\tisValidWalletId,\n\tparseWalletId,\n\tWALLET_CONNECT_WALLET_ID,\n\ttype WalletId,\n} from \"../utils/WalletId\";\nimport {\n\tcreateCompactCookieStorage,\n\tmigratePreV6StoreData,\n} from \"./compactStore\";\nimport { DEFAULT_STORAGE_KEY } from \"./config\";\nimport type {\n\tCachedAccount,\n\tCachedWallet,\n\tKheopskitStore,\n\tKheopskitStoreData,\n} from \"./types\";\n\nexport type { KheopskitStore } from \"./types\";\n\nconst DEFAULT_SETTINGS: KheopskitStoreData = {};\n\n/**\n * Validates a cached wallet read from persisted storage. Cached state may have\n * been written by an older (or corrupted) version with a different shape, so we\n * drop anything that wouldn't survive hydration/sort rather than letting it\n * throw at render time. Only the fields downstream code relies on are checked.\n */\nconst isValidCachedWallet = (value: unknown): value is CachedWallet => {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst w = value as Record<string, unknown>;\n\tif (!isValidWalletId(w.id)) return false;\n\tif (typeof w.name !== \"string\" || typeof w.isConnected !== \"boolean\")\n\t\treturn false;\n\t// The WalletConnect connector is platform-less with a fixed id; drop stale\n\t// per-platform WC entries written by older versions.\n\tif (w.type === \"walletconnect\")\n\t\treturn w.id === WALLET_CONNECT_WALLET_ID && w.platform === undefined;\n\treturn w.type === \"injected\" && isWalletPlatform(w.platform);\n};\n\n/** Validates a cached account read from persisted storage. See {@link isValidCachedWallet}. */\nconst isValidCachedAccount = (value: unknown): value is CachedAccount => {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst a = value as Record<string, unknown>;\n\treturn (\n\t\ttypeof a.id === \"string\" &&\n\t\t!!a.id &&\n\t\tisWalletPlatform(a.platform) &&\n\t\ttypeof a.address === \"string\" &&\n\t\t!!a.address &&\n\t\tisValidWalletId(a.walletId) &&\n\t\ttypeof a.walletName === \"string\"\n\t);\n};\n\ntype CreateKheopskitStoreOptions = {\n\t/**\n\t * Storage backend to persist into. When provided, it takes precedence over\n\t * `ssrCookies` and localStorage.\n\t */\n\tstorage?: SyncableStorage;\n\t/**\n\t * Cookie string for SSR hydration.\n\t * When provided, uses cookieStorage instead of localStorage.\n\t */\n\tssrCookies?: string;\n\t/**\n\t * Custom storage key to namespace the stored data.\n\t * @default \"kheopskit\"\n\t */\n\tstorageKey?: string;\n};\n\n/**\n * Creates a kheopskit store with the appropriate storage backend.\n * Uses the given `storage` when provided, else cookieStorage when ssrCookies is\n * provided (for SSR hydration), otherwise safeLocalStorage.\n *\n * @param options - Configuration options for the store\n */\nexport const createKheopskitStore = (\n\toptions: CreateKheopskitStoreOptions = {},\n): KheopskitStore => {\n\tconst { ssrCookies, storageKey = DEFAULT_STORAGE_KEY } = options;\n\tconst storage =\n\t\toptions.storage ??\n\t\t(ssrCookies !== undefined\n\t\t\t? createCompactCookieStorage(ssrCookies)\n\t\t\t: safeLocalStorage);\n\tconst store = createStore(\n\t\tstorageKey,\n\t\tDEFAULT_SETTINGS,\n\t\tstorage,\n\t\tmigratePreV6StoreData,\n\t);\n\n\tconst rememberWallet = (walletId: WalletId) => {\n\t\tparseWalletId(walletId); // validate walletId\n\t\tstore.mutate((prev) => ({\n\t\t\t...prev,\n\t\t\tremembered: uniq((prev.remembered ?? []).concat(walletId)),\n\t\t}));\n\t};\n\n\tconst forgetWallet = (walletId: WalletId) => {\n\t\tstore.mutate((prev) => ({\n\t\t\t...prev,\n\t\t\tremembered: uniq((prev.remembered ?? []).filter((id) => id !== walletId)),\n\t\t}));\n\t};\n\n\tconst getCachedState = () => {\n\t\t// `store.get()` returns whatever JSON was persisted — it may be from an\n\t\t// older version, a different shape, or outright corrupt. Read defensively:\n\t\t// coerce non-objects/arrays to empty and drop any entry that fails\n\t\t// validation, so stale cache degrades to \"start fresh\" instead of throwing\n\t\t// during hydration (which renders eagerly, so a throw blanks the dapp).\n\t\tconst data = store.get() as Partial<KheopskitStoreData> | null | undefined;\n\t\tconst cachedWallets = Array.isArray(data?.cachedWallets)\n\t\t\t? data.cachedWallets\n\t\t\t: [];\n\t\tconst cachedAccounts = Array.isArray(data?.cachedAccounts)\n\t\t\t? data.cachedAccounts\n\t\t\t: [];\n\t\treturn {\n\t\t\twallets: cachedWallets.filter(isValidCachedWallet),\n\t\t\taccounts: cachedAccounts.filter(isValidCachedAccount),\n\t\t};\n\t};\n\n\tconst setCachedState = (\n\t\twallets: CachedWallet[],\n\t\taccounts: CachedAccount[],\n\t) => {\n\t\tstore.mutate((prev) => ({\n\t\t\t...prev,\n\t\t\tcachedWallets: wallets,\n\t\t\tcachedAccounts: accounts,\n\t\t}));\n\t};\n\n\treturn {\n\t\tobservable: store.observable,\n\t\trememberWallet,\n\t\tforgetWallet,\n\t\tgetCachedState,\n\t\tsetCachedState,\n\t\tdestroy: store.destroy,\n\t};\n};\n\n/**\n * Cached default store instance, anchored on globalThis so it stays a single\n * instance even if this module is duplicated across bundle chunks (e.g. CJS\n * subpath entries). Lazily initialized on first access to be SSR-safe.\n */\nconst DEFAULT_STORE_SYMBOL = Symbol.for(\"kheopskit.defaultStore\");\n\n/**\n * Gets the default store, creating it on first access.\n * Uses localStorage on client, noop on server.\n * Lazily initialized to avoid SSR issues with module-level code.\n */\nexport const getDefaultStore = (): KheopskitStore => {\n\tconst g = globalThis as unknown as Record<symbol, KheopskitStore | undefined>;\n\tif (!g[DEFAULT_STORE_SYMBOL]) {\n\t\tg[DEFAULT_STORE_SYMBOL] = createKheopskitStore();\n\t}\n\treturn g[DEFAULT_STORE_SYMBOL];\n};\n","import {\n\tcombineLatest,\n\tfilter,\n\tmap,\n\tmergeMap,\n\tObservable,\n\tof,\n\tshareReplay,\n\ttap,\n\twithLatestFrom,\n} from \"rxjs\";\nimport { sortWallets } from \"../utils/sortWallets\";\nimport { KheopskitError } from \"./errors\";\nimport {\n\tcreateReconnectPolicy,\n\treconnectAccepts,\n\treconnectCandidates$,\n} from \"./reconnectPolicy\";\nimport type { KheopskitStore } from \"./store\";\nimport type {\n\tBaseWallet,\n\tConnectOptions,\n\tKheopskitConfig,\n\tPlatformContext,\n\tWalletConnectWallet,\n} from \"./types\";\nimport { isInjectedWallet } from \"./types\";\n\nexport const getWallets$ = (\n\tconfig: KheopskitConfig,\n\tstore: KheopskitStore,\n\tregistryReads$?: Observable<void>,\n) => {\n\treturn new Observable<(BaseWallet | WalletConnectWallet)[]>((subscriber) => {\n\t\tconst ctx: PlatformContext = { config, store, registryReads$ };\n\t\tconst observables = config.platforms.map((plugin) =>\n\t\t\tplugin.getWallets$(ctx),\n\t\t);\n\n\t\tconst reconnectPolicy = createReconnectPolicy();\n\n\t\tconst settleOnUserCall = <W extends BaseWallet>(wallet: W): W => ({\n\t\t\t...wallet,\n\t\t\tconnect: (options?: ConnectOptions) => {\n\t\t\t\treconnectPolicy.settle(wallet.id);\n\t\t\t\treturn wallet.connect(options);\n\t\t\t},\n\t\t\tdisconnect: () => {\n\t\t\t\treconnectPolicy.settle(wallet.id);\n\t\t\t\treturn wallet.disconnect();\n\t\t\t},\n\t\t});\n\n\t\tconst platformWallets$ = observables.length\n\t\t\t? combineLatest(observables).pipe(map((wallets) => wallets.flat()))\n\t\t\t: of<BaseWallet[]>([]);\n\n\t\t// The single, platform-less WalletConnect connector is appended here (not\n\t\t// emitted per platform). It sorts last (see sortWallets).\n\t\tconst walletConnect$ = config.walletConnect?.getWallet$(ctx);\n\t\tconst unsortedWallets$: Observable<(BaseWallet | WalletConnectWallet)[]> =\n\t\t\twalletConnect$\n\t\t\t\t? combineLatest([platformWallets$, walletConnect$]).pipe(\n\t\t\t\t\t\tmap(([platformWallets, walletConnect]) =>\n\t\t\t\t\t\t\twalletConnect\n\t\t\t\t\t\t\t\t? [...platformWallets, walletConnect]\n\t\t\t\t\t\t\t\t: platformWallets,\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t: platformWallets$;\n\t\tconst rawWallets$ = unsortedWallets$.pipe(\n\t\t\tmap((all) => all.sort(sortWallets)),\n\t\t);\n\n\t\tconst wallets$ = rawWallets$.pipe(\n\t\t\tmap((wallets) =>\n\t\t\t\twallets.map((wallet) =>\n\t\t\t\t\tisInjectedWallet(wallet) ? settleOnUserCall(wallet) : wallet,\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\tconst reconnect = async (wallet: BaseWallet) => {\n\t\t\ttry {\n\t\t\t\tawait reconnectPolicy.attempt(wallet.id, () => wallet.connect());\n\t\t\t} catch (err) {\n\t\t\t\tif (subscriber.closed) return;\n\t\t\t\tif (err instanceof KheopskitError) {\n\t\t\t\t\tif (err.code === \"USER_REJECTED\") store.forgetWallet(wallet.id);\n\t\t\t\t\tif (err.code === \"USER_REJECTED\" || err.code === \"ABORTED\")\n\t\t\t\t\t\treconnectPolicy.settle(wallet.id);\n\t\t\t\t}\n\t\t\t\tif (config.debug)\n\t\t\t\t\tconsole.debug(\"[kheopskit] reconnect of %s failed\", wallet.id, err);\n\t\t\t}\n\t\t};\n\n\t\tconst subWallets = wallets$.subscribe(subscriber);\n\t\tif (subscriber.closed) return subWallets;\n\n\t\tconst subAutoReconnect = rawWallets$\n\t\t\t.pipe(\n\t\t\t\twithLatestFrom(reconnectCandidates$(store)),\n\t\t\t\tfilter(\n\t\t\t\t\t([, walletIds]) =>\n\t\t\t\t\t\tconfig.autoReconnect !== false && walletIds.length > 0,\n\t\t\t\t),\n\t\t\t\tmergeMap(([wallets, walletIds]) =>\n\t\t\t\t\twallets\n\t\t\t\t\t\t.filter(isInjectedWallet)\n\t\t\t\t\t\t.filter((wallet) => walletIds.includes(wallet.id)),\n\t\t\t\t),\n\t\t\t\ttap((wallet) => {\n\t\t\t\t\tif (wallet.status === \"connected\") reconnectPolicy.settle(wallet.id);\n\t\t\t\t}),\n\t\t\t\tfilter(\n\t\t\t\t\t(wallet) =>\n\t\t\t\t\t\twallet.status === \"disconnected\" &&\n\t\t\t\t\t\treconnectAccepts(config.autoReconnect, wallet),\n\t\t\t\t),\n\t\t\t)\n\t\t\t.subscribe(reconnect);\n\n\t\treturn () => {\n\t\t\tsubAutoReconnect.unsubscribe();\n\t\t\tsubWallets.unsubscribe();\n\t\t};\n\t}).pipe(shareReplay({ refCount: true, bufferSize: 1 }));\n};\n","import {\n\tasapScheduler,\n\tcombineLatest,\n\tconcat,\n\tdebounceTime,\n\tdistinctUntilChanged,\n\tfilter,\n\tignoreElements,\n\tmap,\n\tObservable,\n\tof,\n\tshareReplay,\n\tstartWith,\n\ttake,\n\ttap,\n} from \"rxjs\";\nimport {\n\tcreateAccountHydrationBuffer,\n\tcreateHydrationBuffer,\n} from \"../utils/createHydrationBuffer\";\nimport { serializeAccount, serializeWallet } from \"../utils/hydrateState\";\nimport { getCachedIcon, setCachedIcons } from \"../utils/iconCache\";\nimport { logObservable } from \"../utils/logObservable\";\nimport { createRegistryReads$ } from \"../utils/registryReads\";\nimport { sortAccounts } from \"../utils/sortAccounts\";\nimport { sortWallets } from \"../utils/sortWallets\";\nimport type { WalletId } from \"../utils/WalletId\";\nimport { type AccountsFrame, getAccounts$ } from \"./accounts\";\nimport { resolveConfig } from \"./config\";\nimport { abortedError, walletPendingError } from \"./errors\";\nimport { getHydratedSnapshot } from \"./hydration\";\nimport { reconnectCandidates$ } from \"./reconnectPolicy\";\nimport { createKheopskitStore } from \"./store\";\nimport type {\n\tBaseWallet,\n\tBaseWalletAccount,\n\tCachedAccount,\n\tCachedWallet,\n\tKheopskitConfig,\n\tKheopskitPlatform,\n\tKheopskitState,\n\tWalletConnectWallet,\n} from \"./types\";\nimport { isInjectedWallet, isWalletConnectWallet } from \"./types\";\nimport { getWallets$ } from \"./wallets\";\n\nexport type { KheopskitConfig, KheopskitState } from \"./types\";\n\n/** Options for {@link getKheopskit$}. */\nexport type GetKheopskitOptions = {\n\t/**\n\t * Cookie string for SSR hydration. When provided, state is read from cookies\n\t * instead of localStorage so the server can hydrate without a flash. Pass the\n\t * request's `cookie` header.\n\t */\n\tssrCookies?: string;\n\t/**\n\t * An existing store to reuse instead of creating one.\n\t */\n\tstore?: ReturnType<typeof createKheopskitStore>;\n};\n\nexport const getKheopskit$ = <\n\tconst P extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n>(\n\tconfig?: Partial<KheopskitConfig<P>>,\n\toptions: GetKheopskitOptions = {},\n): Observable<KheopskitState<P>> => {\n\tconst { ssrCookies, store: existingStore } = options;\n\tconst kc = resolveConfig(config);\n\tconst store =\n\t\texistingStore ??\n\t\tcreateKheopskitStore({ ssrCookies, storageKey: kc.storageKey });\n\n\tif (kc.debug) console.debug(\"[kheopskit] config\", kc);\n\n\t// Warn about SSR environment without cookies\n\tif (kc.debug && typeof window === \"undefined\" && ssrCookies === undefined) {\n\t\tconsole.warn(\n\t\t\t\"[kheopskit] Running on server without `ssrCookies`. \" +\n\t\t\t\t\"Wallet state will not be hydrated. Pass cookies for SSR support.\",\n\t\t);\n\t}\n\n\t// Get cached state for hydration (same snapshot the React provider builds)\n\tconst { wallets: cachedWallets, accounts: cachedAccounts } =\n\t\tgetHydratedSnapshot(store, kc, { icons: true });\n\n\tif (kc.debug && cachedWallets.length > 0) {\n\t\tconsole.debug(\"[kheopskit] hydrating from cache:\", {\n\t\t\twallets: cachedWallets.length,\n\t\t\taccounts: cachedAccounts.length,\n\t\t});\n\t}\n\n\treturn new Observable<KheopskitState>((subscriber) => {\n\t\tlet latest: KheopskitState | undefined;\n\t\tlet closed = false;\n\t\tconst waiters = new Set<StateWaiter>();\n\t\tconst liveWaiters = new Set<(state: KheopskitState | undefined) => void>();\n\t\tconst wrapped = new WeakMap<\n\t\t\tBaseWallet | WalletConnectWallet,\n\t\t\tBaseWallet | WalletConnectWallet\n\t\t>();\n\n\t\tconst abandon = (waiter: StateWaiter) => {\n\t\t\twaiters.delete(waiter);\n\t\t\tif (waiter.isConnected)\n\t\t\t\twaiter.reject(abortedError(waiter.walletId, \"connect\"));\n\t\t\telse waiter.resolve();\n\t\t};\n\n\t\tconst settleIn = (waiter: StateWaiter, state: KheopskitState) => {\n\t\t\tconst wallet = state.wallets.find((w) => w.id === waiter.walletId);\n\t\t\tif (!wallet || wallet.isConnected === waiter.isConnected) {\n\t\t\t\twaiters.delete(waiter);\n\t\t\t\twaiter.resolve();\n\t\t\t}\n\t\t};\n\n\t\tconst supersede = (walletId: WalletId, isConnected: boolean) => {\n\t\t\tfor (const waiter of waiters)\n\t\t\t\tif (waiter.walletId === walletId && waiter.isConnected !== isConnected)\n\t\t\t\t\tabandon(waiter);\n\t\t};\n\n\t\tconst whenState = (walletId: WalletId, isConnected: boolean) =>\n\t\t\tnew Promise<void>((resolve, reject) => {\n\t\t\t\tconst waiter = { walletId, isConnected, resolve, reject };\n\t\t\t\twaiters.add(waiter);\n\t\t\t\tif (latest) settleIn(waiter, latest);\n\t\t\t\tif (closed && waiters.has(waiter)) abandon(waiter);\n\t\t\t});\n\n\t\tconst whenLive = (walletId: WalletId, signal: AbortSignal | undefined) =>\n\t\t\tnew Promise<BaseWallet | WalletConnectWallet>((resolve, reject) => {\n\t\t\t\tconst settle = (finish: () => void) => {\n\t\t\t\t\tliveWaiters.delete(check);\n\t\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\tfinish();\n\t\t\t\t};\n\t\t\t\tconst onAbort = () =>\n\t\t\t\t\tsettle(() => reject(abortedError(walletId, \"connect\")));\n\t\t\t\tconst check = (state: KheopskitState | undefined) => {\n\t\t\t\t\tif (!state) return onAbort();\n\t\t\t\t\tconst live = state.wallets.find(\n\t\t\t\t\t\t(w) => w.id === walletId && !w.isPlaceholder,\n\t\t\t\t\t);\n\t\t\t\t\tif (live) settle(() => resolve(live));\n\t\t\t\t\telse if (!state.isHydrating)\n\t\t\t\t\t\tsettle(() => reject(walletPendingError(walletId)));\n\t\t\t\t};\n\t\t\t\tif (closed || signal?.aborted) return onAbort();\n\t\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\tliveWaiters.add(check);\n\t\t\t\tif (latest) check(latest);\n\t\t\t});\n\n\t\tconst deferToLive = (\n\t\t\tplaceholder: BaseWallet | WalletConnectWallet,\n\t\t): BaseWallet | WalletConnectWallet => ({\n\t\t\t...placeholder,\n\t\t\tconnect: async (options) => {\n\t\t\t\tconst live = await whenLive(placeholder.id, options?.signal);\n\t\t\t\tif (closed) throw abortedError(placeholder.id, \"connect\");\n\t\t\t\tawait live.connect(options);\n\t\t\t},\n\t\t\tdisconnect: async () => {\n\t\t\t\tif (closed) return;\n\t\t\t\tconst live = latest?.wallets.find(\n\t\t\t\t\t(w) => w.id === placeholder.id && !w.isPlaceholder,\n\t\t\t\t);\n\t\t\t\tif (live) return live.disconnect();\n\t\t\t\tstore.forgetWallet(placeholder.id);\n\t\t\t},\n\t\t});\n\n\t\tconst settleWithState = (\n\t\t\twallet: BaseWallet | WalletConnectWallet,\n\t\t): BaseWallet | WalletConnectWallet => {\n\t\t\tconst existing = wrapped.get(wallet);\n\t\t\tif (existing) return existing;\n\t\t\tif (wallet.isPlaceholder) {\n\t\t\t\tconst deferred = deferToLive(wallet);\n\t\t\t\twrapped.set(wallet, deferred);\n\t\t\t\treturn deferred;\n\t\t\t}\n\t\t\tif (!isInjectedWallet(wallet)) return wallet;\n\t\t\tconst settled: BaseWallet = {\n\t\t\t\t...wallet,\n\t\t\t\tconnect: async (options) => {\n\t\t\t\t\tif (closed) throw abortedError(wallet.id, \"connect\");\n\t\t\t\t\tawait wallet.connect(options);\n\t\t\t\t\tsupersede(wallet.id, true);\n\t\t\t\t\tawait whenState(wallet.id, true);\n\t\t\t\t},\n\t\t\t\tdisconnect: async () => {\n\t\t\t\t\tif (closed) throw abortedError(wallet.id, \"disconnect\");\n\t\t\t\t\tawait wallet.disconnect();\n\t\t\t\t\tsupersede(wallet.id, false);\n\t\t\t\t\tawait whenState(wallet.id, false);\n\t\t\t\t},\n\t\t\t};\n\t\t\twrapped.set(wallet, settled);\n\t\t\treturn settled;\n\t\t};\n\n\t\tconst registryReads$ = createRegistryReads$().pipe(\n\t\t\tshareReplay({ bufferSize: 1, refCount: true }),\n\t\t);\n\t\tconst liveWallets$ = getWallets$(kc, store, registryReads$);\n\t\tconst accountFrames$ = getAccounts$(kc, liveWallets$);\n\t\tconst liveAccounts$ = accountFrames$.pipe(\n\t\t\tmap(({ accounts }) => accounts.map(asLive)),\n\t\t);\n\n\t\tconst isDiscovering$ = concat(\n\t\t\tof(true),\n\t\t\tregistryReads$.pipe(ignoreElements()),\n\t\t\tliveWallets$.pipe(\n\t\t\t\ttake(1),\n\t\t\t\tmap(() => false),\n\t\t\t),\n\t\t).pipe(shareReplay({ bufferSize: 1, refCount: true }));\n\n\t\tconst hydrationSettled$ = combineLatest([\n\t\t\tliveWallets$,\n\t\t\taccountFrames$.pipe(startWith(noAnswerYet)),\n\t\t\tisDiscovering$,\n\t\t\treconnectCandidates$(store),\n\t\t]).pipe(\n\t\t\tmap(([wallets, { accounts, answered }, isDiscovering, remembered]) =>\n\t\t\t\tcachedWallets.every((cached) => {\n\t\t\t\t\tconst wallet = wallets.find((w) => w.id === cached.id);\n\t\t\t\t\tif (!wallet) return !isDiscovering;\n\t\t\t\t\treturn (\n\t\t\t\t\t\tcached.status !== \"connecting\" ||\n\t\t\t\t\t\treconnectSettled(cached, wallet, {\n\t\t\t\t\t\t\taccounts,\n\t\t\t\t\t\t\tanswered,\n\t\t\t\t\t\t\tcachedAccounts,\n\t\t\t\t\t\t\tremembered,\n\t\t\t\t\t\t})\n\t\t\t\t\t);\n\t\t\t\t}),\n\t\t\t),\n\t\t\tdebounceTime(0, asapScheduler),\n\t\t\tdistinctUntilChanged(),\n\t\t);\n\n\t\t// Apply hydration buffer to wallets\n\t\tconst bufferedWallets$ = createHydrationBuffer(\n\t\t\tcachedWallets,\n\t\t\tliveWallets$.pipe(map((wallets) => wallets.map(asLive))),\n\t\t\tkc.hydrationGracePeriod,\n\t\t\tkc.hydrationTimeout,\n\t\t\t(w) => w.id,\n\t\t\thydrationSettled$,\n\t\t\t(live, cached) => {\n\t\t\t\tconst status = sessionRestoring(live, cached)\n\t\t\t\t\t? \"connecting\"\n\t\t\t\t\t: live.status;\n\t\t\t\treturn {\n\t\t\t\t\t...live,\n\t\t\t\t\tstatus,\n\t\t\t\t\tisConnected: status === \"connected\",\n\t\t\t\t\ticon: cached.icon || getCachedIcon(cached.id) || live.icon,\n\t\t\t\t};\n\t\t\t},\n\t\t\t// Transform cached-only items: add icon from localStorage cache\n\t\t\t(cached) => ({\n\t\t\t\t...cached,\n\t\t\t\ticon: cached.icon || getCachedIcon(cached.id) || \"\",\n\t\t\t}),\n\t\t);\n\n\t\t// Apply hydration buffer to accounts\n\t\tconst bufferedAccounts$ = createAccountHydrationBuffer(\n\t\t\tcachedAccounts,\n\t\t\tliveAccounts$,\n\t\t\tkc.hydrationGracePeriod,\n\t\t\tkc.hydrationTimeout,\n\t\t\t(a) => a.walletId,\n\t\t\thydrationSettled$,\n\t\t);\n\n\t\t// Share the buffered streams so the main and persistence subscriptions\n\t\t// below reuse a single hydration pipeline (timers, isHydrating state)\n\t\t// instead of running the buffering twice.\n\t\tconst sharedWallets$ = bufferedWallets$.pipe(\n\t\t\tshareReplay({ bufferSize: 1, refCount: true }),\n\t\t);\n\t\tconst sharedAccounts$ = bufferedAccounts$.pipe(\n\t\t\tshareReplay({ bufferSize: 1, refCount: true }),\n\t\t);\n\n\t\t// Combine buffered wallets and accounts\n\t\tconst subscription = combineLatest({\n\t\t\twallets: sharedWallets$,\n\t\t\taccounts: sharedAccounts$,\n\t\t\tisDiscovering: isDiscovering$,\n\t\t})\n\t\t\t.pipe(\n\t\t\t\tmap(({ wallets, accounts, isDiscovering }) => {\n\t\t\t\t\tif (kc.debug) {\n\t\t\t\t\t\tconsole.debug(\"[kheopskit] hydration state\", {\n\t\t\t\t\t\t\twalletsHydrating: wallets.isHydrating,\n\t\t\t\t\t\t\taccountsHydrating: accounts.isHydrating,\n\t\t\t\t\t\t\tisDiscovering,\n\t\t\t\t\t\t\twalletsConnected: wallets.items.filter((w) => w.isConnected)\n\t\t\t\t\t\t\t\t.length,\n\t\t\t\t\t\t\twalletsTotal: wallets.items.length,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\t// Sort on every emission with the same comparators used for the\n\t\t\t\t\t// cached initial snapshot. The hydration buffers append cached-only\n\t\t\t\t\t// items after live ones (and reconnects land out of order), so\n\t\t\t\t\t// without this the list visibly reorders as wallets come back.\n\t\t\t\t\treturn {\n\t\t\t\t\t\tconfig: kc,\n\t\t\t\t\t\twallets: [...wallets.items].sort(sortWallets).map(settleWithState),\n\t\t\t\t\t\taccounts: [...accounts.items].sort(sortAccounts),\n\t\t\t\t\t\tisHydrating: wallets.isHydrating || accounts.isHydrating,\n\t\t\t\t\t\tisDiscovering,\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t\t\tdebounceTime(0, asapScheduler),\n\t\t\t\tdistinctUntilChanged(statesEqual),\n\t\t\t\ttap((state) => {\n\t\t\t\t\tlatest = state;\n\t\t\t\t\tfor (const check of liveWaiters) check(state);\n\t\t\t\t\tfor (const waiter of waiters) settleIn(waiter, state);\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe(subscriber);\n\n\t\t// Persist state snapshot when hydration completes and state stabilizes\n\t\tconst persistSub = combineLatest({\n\t\t\twallets: sharedWallets$,\n\t\t\taccounts: sharedAccounts$,\n\t\t})\n\t\t\t.pipe(\n\t\t\t\t// Wait for hydration to complete\n\t\t\t\tfilter(\n\t\t\t\t\t({ wallets, accounts }) =>\n\t\t\t\t\t\t!wallets.isHydrating && !accounts.isHydrating,\n\t\t\t\t),\n\t\t\t\t// Debounce to avoid excessive writes\n\t\t\t\tdebounceTime(1000),\n\t\t\t\t// Only persist if the serialized snapshot would actually change.\n\t\t\t\t// Compare the persisted fields (not just ids): an Ethereum chain switch\n\t\t\t\t// keeps the same account id but changes the cached chainId, so an\n\t\t\t\t// id-only comparator would skip persisting it.\n\t\t\t\tdistinctUntilChanged((prev, curr) => {\n\t\t\t\t\tconst prevWalletKeys = prev.wallets.items.map(persistedWalletKey);\n\t\t\t\t\tconst currWalletKeys = curr.wallets.items.map(persistedWalletKey);\n\t\t\t\t\tconst prevAccountKeys = prev.accounts.items.map(accountChangeKey);\n\t\t\t\t\tconst currAccountKeys = curr.accounts.items.map(accountChangeKey);\n\t\t\t\t\treturn (\n\t\t\t\t\t\tarraysEqual(prevWalletKeys, currWalletKeys) &&\n\t\t\t\t\t\tarraysEqual(prevAccountKeys, currAccountKeys)\n\t\t\t\t\t);\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe(({ wallets, accounts }) => {\n\t\t\t\tconst snapshot = persistedSnapshot(\n\t\t\t\t\twallets.items,\n\t\t\t\t\taccounts.items,\n\t\t\t\t\tstore.getCachedState(),\n\t\t\t\t);\n\n\t\t\t\tif (kc.debug) {\n\t\t\t\t\tconsole.debug(\"[kheopskit] persisting state snapshot:\", {\n\t\t\t\t\t\twallets: snapshot.wallets.length,\n\t\t\t\t\t\taccounts: snapshot.accounts.length,\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tstore.setCachedState(snapshot.wallets, snapshot.accounts);\n\n\t\t\t\t// Cache wallet icons in localStorage (separate from cookies for size)\n\t\t\t\tconst icons: Record<string, string> = {};\n\t\t\t\tfor (const wallet of wallets.items) {\n\t\t\t\t\tif (wallet.icon) {\n\t\t\t\t\t\ticons[wallet.id] = wallet.icon;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsetCachedIcons(icons);\n\t\t\t});\n\n\t\treturn () => {\n\t\t\tsubscription.unsubscribe();\n\t\t\tpersistSub.unsubscribe();\n\t\t\tclosed = true;\n\t\t\tfor (const waiter of waiters) abandon(waiter);\n\t\t\tfor (const check of liveWaiters) check(undefined);\n\t\t};\n\t}).pipe(\n\t\tlogObservable(\"kheopskit$\", { enabled: kc.debug, printValue: true }),\n\t\tshareReplay({ bufferSize: 1, refCount: true }),\n\t\t// The runtime objects are the concrete per-plugin wallet/account types;\n\t\t// recover the precise KheopskitState<P> the caller's plugins imply.\n\t) as unknown as Observable<KheopskitState<P>>;\n};\n\ntype StateWaiter = {\n\twalletId: WalletId;\n\tisConnected: boolean;\n\tresolve: () => void;\n\treject: (error: unknown) => void;\n};\n\n// AppKit restores a cached WalletConnect session on its own and reports nothing\n// until it has; an injected wallet reports its attempt from its first emission.\nconst sessionRestoring = (\n\tlive: BaseWallet | WalletConnectWallet,\n\tcached: BaseWallet | WalletConnectWallet,\n): boolean =>\n\tisWalletConnectWallet(live) &&\n\tlive.status === \"disconnected\" &&\n\tcached.status === \"connecting\";\n\nconst flagged = new WeakMap<object, object>();\n\nconst asLive = <T extends object>(item: T): T & { isPlaceholder: false } => {\n\tconst existing = flagged.get(item);\n\tif (existing) return existing as T & { isPlaceholder: false };\n\tconst live = { ...item, isPlaceholder: false as const };\n\tflagged.set(item, live);\n\treturn live;\n};\n\nconst noAnswerYet: AccountsFrame = { accounts: [], answered: [] };\n\n/**\n * A remembered wallet that reads disconnected without an error is still\n * waiting for its reconnect: getWallets$ emits the wallet list before its\n * connect() flips the status to connecting.\n */\nconst reconnectSettled = (\n\tcached: BaseWallet | WalletConnectWallet,\n\twallet: BaseWallet | WalletConnectWallet,\n\tlive: AccountsFrame & {\n\t\tcachedAccounts: BaseWalletAccount[];\n\t\tremembered: WalletId[];\n\t},\n): boolean => {\n\tconst status = sessionRestoring(wallet, cached)\n\t\t? \"connecting\"\n\t\t: wallet.status;\n\tif (status === \"connecting\") return false;\n\tif (status === \"disconnected\")\n\t\treturn wallet.error !== undefined || !live.remembered.includes(cached.id);\n\treturn (\n\t\tlive.answered.includes(cached.id) ||\n\t\t!live.cachedAccounts.some((a) => a.walletId === cached.id) ||\n\t\tlive.accounts.some((a) => a.walletId === cached.id)\n\t);\n};\n\n/**\n * A wallet still connecting keeps its previous cache entry and accounts:\n * written live it would read isConnected: false with no accounts, and the\n * next load would hydrate it as disconnected without placeholders while its\n * reconnect runs.\n */\nconst persistedSnapshot = (\n\twallets: (BaseWallet | WalletConnectWallet)[],\n\taccounts: BaseWalletAccount[],\n\tprevious: { wallets: CachedWallet[]; accounts: CachedAccount[] },\n): { wallets: CachedWallet[]; accounts: CachedAccount[] } => {\n\tconst connecting = new Set(\n\t\twallets.filter((w) => w.status === \"connecting\").map((w) => w.id),\n\t);\n\tconst connected = new Set(\n\t\twallets.filter((w) => w.isConnected).map((w) => w.id),\n\t);\n\tconst previousWallets = new Map(previous.wallets.map((w) => [w.id, w]));\n\treturn {\n\t\twallets: wallets.map(\n\t\t\t(w) =>\n\t\t\t\t(connecting.has(w.id) && previousWallets.get(w.id)) ||\n\t\t\t\tserializeWallet(w),\n\t\t),\n\t\taccounts: [\n\t\t\t...accounts\n\t\t\t\t.filter((a) => connected.has(a.walletId))\n\t\t\t\t.map(serializeAccount),\n\t\t\t...previous.accounts.filter((a) => connecting.has(a.walletId)),\n\t\t],\n\t};\n};\n\nconst arraysEqual = (a: string[], b: string[]) =>\n\ta.length === b.length && a.every((v, i) => v === b[i]);\n\n// Mutable per-platform account fields that can change without the account id\n// changing. Declared locally (not imported from the platform packages) so this\n// core entry stays free of platform SDK types — see check:isolation.\ntype EthereumAccountFields = { chainId?: number };\ntype PolkadotAccountFields = { type?: string };\ntype SolanaAccountFields = { chains?: string[] };\n\n/**\n * A signature of an account covering its id, its name, plus the\n * platform-specific fields that can change without the id changing (Ethereum\n * chainId, Polkadot key type, Solana clusters). Used to detect both UI-relevant\n * changes and changes worth re-persisting, so the two comparators can't drift\n * apart.\n */\nconst accountChangeKey = (account: BaseWalletAccount): string =>\n\t`${account.name ?? \"\"}|${accountPlatformKey(account)}`;\n\nconst accountPlatformKey = (account: BaseWalletAccount): string => {\n\tswitch (account.platform) {\n\t\tcase \"ethereum\":\n\t\t\treturn `${account.id}|${(account as EthereumAccountFields).chainId ?? \"\"}`;\n\t\tcase \"polkadot\":\n\t\t\treturn `${account.id}|${(account as PolkadotAccountFields).type ?? \"\"}`;\n\t\tcase \"solana\":\n\t\t\treturn `${account.id}|${((account as SolanaAccountFields).chains ?? []).join(\",\")}`;\n\t\tdefault:\n\t\t\treturn account.id;\n\t}\n};\n\n/** Platforms a wallet's live session carries (only the WalletConnect connector). */\nconst walletPlatforms = (wallet: BaseWallet | WalletConnectWallet): string =>\n\tisWalletConnectWallet(wallet) ? wallet.platforms.join(\",\") : \"\";\n\n/** Fields persisted to the cache for a wallet (icon is stored separately). */\nconst walletPersistKey = (wallet: BaseWallet | WalletConnectWallet): string =>\n\t`${wallet.id}|${wallet.isConnected ? 1 : 0}|${wallet.name}`;\n\n/**\n * What decides a cache write: the persisted fields plus `status`, because a\n * wallet whose kept entry was written while connecting must be rewritten live\n * once its reconnect fails, and `isConnected` reads false on both sides.\n */\nconst persistedWalletKey = (wallet: BaseWallet | WalletConnectWallet): string =>\n\t`${walletPersistKey(wallet)}|${wallet.status}`;\n\n/**\n * UI-significant signature of a wallet: the persisted fields plus icon and the\n * WalletConnect connector's `platforms` array, which drive what the UI shows but\n * aren't part of the id (icon and platforms can arrive asynchronously after\n * connect without isConnected flipping).\n */\nconst walletUiKey = (wallet: BaseWallet | WalletConnectWallet): string =>\n\t`${walletPersistKey(wallet)}|${wallet.status}|${wallet.error?.code ?? \"\"}|${wallet.icon}|${walletPlatforms(wallet)}`;\n\n/**\n * Equality check for KheopskitState to prevent unnecessary emissions. Compares\n * the UI-significant signature of every wallet and account, in order.\n */\nconst statesEqual = (a: KheopskitState, b: KheopskitState): boolean =>\n\ta.isHydrating === b.isHydrating &&\n\ta.isDiscovering === b.isDiscovering &&\n\ta.wallets.length === b.wallets.length &&\n\ta.accounts.length === b.accounts.length &&\n\ta.wallets.every((w, i) => {\n\t\tconst other = b.wallets[i];\n\t\treturn (\n\t\t\t!!other &&\n\t\t\tw.isPlaceholder === other.isPlaceholder &&\n\t\t\twalletUiKey(w) === walletUiKey(other)\n\t\t);\n\t}) &&\n\ta.accounts.every((acc, i) => {\n\t\tconst other = b.accounts[i];\n\t\treturn (\n\t\t\t!!other &&\n\t\t\tacc.isPlaceholder === other.isPlaceholder &&\n\t\t\taccountChangeKey(acc) === accountChangeKey(other)\n\t\t);\n\t});\n"],"mappings":";;;;;;;;;;;;AAQA,MAAa,sBAAsB;AAEnC,MAAM,WAAW;CAChB,eAAe;CACf,OAAO;CACP,YAAY;CACZ,sBAAsB;CACtB,kBAAkB;AACnB;AAEA,MAAa,iBAGZ,WACwB;CACxB,MAAM,YAAa,QAAQ,aAAa,CAAC;CAIzC,MAAM,mBAAoB,UAAiC,QACzD,MACA,OAAO,MAAM,YACb,MAAM,QACN,OAAQ,EAAgC,gBAAgB,UAC1D;CACA,IAAI,iBAAiB,SAAS,GAC7B,MAAM,IAAI,MACT,sNAGqB,KAAK,UAAU,gBAAgB,EAAE,qFAEvD;CAGD,IACC,QAAQ,kBAAkB,KAAA,KAC1B,OAAQ,OAAO,eACZ,eAAe,YAElB,MAAM,IAAI,eACT,kBACA,sPAGD;CAGD,IAAI,UAAU,WAAW,GACxB,QAAQ,KACP,+IAED;CAGD,OAAO,OAAO,OAAO,CAAC,GAAG,UAAU,QAAQ,EAAE,UAAU,CAAC;AACzD;;;AC9DA,MAAMA,mBAAiD;CACtD,UAAU;CACV,UAAU;CACV,QAAQ;AACT;AAEA,MAAM,cAAc,IAAuB,OAC1CA,iBAAe,GAAG,YAAYA,iBAAe,GAAG;AAGjD,MAAM,gBAAgB,IAAuB,OAA0B;CACtE,IAAI,GAAG,eAAe,GAAG,YAAY,OAAO;CAC5C,IAAI,GAAG,WAAW,YAAY,MAAM,YAAY,OAAO;CACvD,IAAI,GAAG,WAAW,YAAY,MAAM,YAAY,OAAO;CACvD,OAAO,GAAG,WAAW,cAAc,GAAG,UAAU;AACjD;AAEA,MAAa,gBAAgB,IAAuB,OACnD,WAAW,IAAI,EAAE,KAAK,aAAa,IAAI,EAAE;;;ACb1C,MAAM,iBAAiD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I,kBAAkB,MAAM,iBAC5B,iBAAiB,GAAG,MAAM,iBAAiB,KAAK;AAElD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"polkadotExtensions-BoVKhNU_.mjs","names":[],"sources":["../src/utils/polkadotExtensions.ts"],"sourcesContent":["export const POLKADOT_EXTENSIONS: Record<\n\tstring,\n\t{ name: string; icon: string }\n> = {\n\ttalisman: {\n\t\tname: \"Talisman\",\n\t\ticon: \"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8cGF0aCBmaWxsPSIjZGRmZTc2IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0wIDcwLjI1YzAgMjEuMjU1IDAgMzEuODgzIDQuNDYzIDM5Ljg1MmEzNSAzNSAwIDAgMCAxMy40MzUgMTMuNDM1QzI1Ljg2NyAxMjggMzYuNDk1IDEyOCA1Ny43NSAxMjhoMTIuNWMyMS4yNTUgMCAzMS44ODMgMCAzOS44NTItNC40NjNhMzUgMzUgMCAwIDAgMTMuNDM1LTEzLjQzNUMxMjggMTAyLjEzMyAxMjggOTEuNTA1IDEyOCA3MC4yNXYtMTIuNWMwLTIxLjI1NSAwLTMxLjg4My00LjQ2My0zOS44NTJhMzUgMzUgMCAwIDAtMTMuNDM1LTEzLjQzNUMxMDIuMTMzIDAgOTEuNTA1IDAgNzAuMjUgMGgtMTIuNUMzNi40OTUgMCAyNS44NjcgMCAxNy44OTggNC40NjNBMzUgMzUgMCAwIDAgNC40NjMgMTcuODk4QzAgMjUuODY3IDAgMzYuNDk1IDAgNTcuNzVaIi8+CiAgICA8cGF0aCBmaWxsPSIjZWE1NzUwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Im0zMy44NzkgMzUuMTE3LS41IDE5LjE2NWM4LjEwNyA0LjE2OC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4wMDU3IDE3LjAwNjJaTTQwLjE0NzkgMzMuNTQyM0g2MC45MTU3QzY0LjQ1OCAzMy41NDIzIDY3LjMyOTUgMzYuNDEzOCA2Ny4zMjk1IDM5Ljk1NjFWNDEuNjgxNkM2Ny4zMjk1IDQ1LjIyMzggNjQuNDU4IDQ4LjA5NTQgNjAuOTE1NyA0OC4wOTU0SDQwLjE0NzlDMzYuNjA1NyA0OC4wOTU0IDMzLjczNDEgNDUuMjIzOCAzMy43MzQxIDQxLjY4MTZWMzkuOTU2MUMzMy43MzQxIDM2LjQxMzggMzYuNjA1NyAzMy41NDIzIDQwLjE0NzkgMzMuNTQyM1oiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8yODdfMjM1OSkiLz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl8yODdfMjM1OSIgeDE9IjE5LjM2MDIiIHkxPSIxNCIgeDI9IjU2Ljc2OTYiIHkyPSI2OS44MDA1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CjxzdG9wIHN0b3AtY29sb3I9IiNDNTQ5RkYiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjNjU0QkZGIi8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+Cg==\",\n\t},\n};\n"],"mappings":";AAAA,MAAa,sBAGT;CACH,UAAU;EACT,MAAM;EACN,MAAM;CACP;CACA,eAAe;EACd,MAAM;EACN,MAAM;CACP;CACA,gBAAgB;EACf,MAAM;EACN,MAAM;CACP;CACA,SAAS;EACR,MAAM;EACN,MAAM;CACP;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"polkadotExtensions-y4J9UzYl.js","names":[],"sources":["../src/utils/polkadotExtensions.ts"],"sourcesContent":["export const POLKADOT_EXTENSIONS: Record<\n\tstring,\n\t{ name: string; icon: string }\n> = {\n\ttalisman: {\n\t\tname: \"Talisman\",\n\t\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NDEgNDUuMjIzOCAzMy43MzQxIDQxLjY4MTZWMzkuOTU2MUMzMy43MzQxIDM2LjQxMzggMzYuNjA1NyAzMy41NDIzIDQwLjE0NzkgMzMuNTQyM1oiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8yODdfMjM1OSkiLz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl8yODdfMjM1OSIgeDE9IjE5LjM2MDIiIHkxPSIxNCIgeDI9IjU2Ljc2OTYiIHkyPSI2OS44MDA1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CjxzdG9wIHN0b3AtY29sb3I9IiNDNTQ5RkYiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjNjU0QkZGIi8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+Cg==\",\n\t},\n};\n"],"mappings":";AAAA,MAAa,sBAGT;CACH,UAAU;EACT,MAAM;EACN,MAAM;CACP;CACA,eAAe;EACd,MAAM;EACN,MAAM;CACP;CACA,gBAAgB;EACf,MAAM;EACN,MAAM;CACP;CACA,SAAS;EACR,MAAM;EACN,MAAM;CACP;AACD"}
@@ -1,38 +0,0 @@
1
- let rxjs = require("rxjs");
2
- //#region src/utils/pageLoad.ts
3
- const pageLoaded$ = new rxjs.Observable((subscriber) => {
4
- if (typeof document === "undefined") {
5
- subscriber.next(false);
6
- return;
7
- }
8
- if (document.readyState === "complete") {
9
- subscriber.next(true);
10
- subscriber.complete();
11
- return;
12
- }
13
- subscriber.next(false);
14
- const onLoad = () => {
15
- subscriber.next(true);
16
- subscriber.complete();
17
- };
18
- window.addEventListener("load", onLoad, { once: true });
19
- return () => window.removeEventListener("load", onLoad);
20
- });
21
- //#endregion
22
- //#region src/utils/registryReads.ts
23
- const tail$ = (0, rxjs.merge)((0, rxjs.of)(void 0), ...[
24
- 100,
25
- 300,
26
- 600,
27
- 1100
28
- ].map((ms) => (0, rxjs.timer)(ms))).pipe((0, rxjs.map)(() => void 0));
29
- const createRegistryReads$ = () => typeof window === "undefined" ? (0, rxjs.concat)((0, rxjs.of)(void 0), rxjs.NEVER) : pageLoaded$.pipe((0, rxjs.switchMap)(() => tail$));
30
- //#endregion
31
- Object.defineProperty(exports, "createRegistryReads$", {
32
- enumerable: true,
33
- get: function() {
34
- return createRegistryReads$;
35
- }
36
- });
37
-
38
- //# sourceMappingURL=registryReads-BpHsWLd7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registryReads-BpHsWLd7.js","names":["Observable","merge","of","timer","map","concat","NEVER","switchMap"],"sources":["../src/utils/pageLoad.ts","../src/utils/registryReads.ts"],"sourcesContent":["import { Observable } from \"rxjs\";\n\nexport const pageLoaded$ = new Observable<boolean>((subscriber) => {\n\tif (typeof document === \"undefined\") {\n\t\tsubscriber.next(false);\n\t\treturn;\n\t}\n\n\tif (document.readyState === \"complete\") {\n\t\tsubscriber.next(true);\n\t\tsubscriber.complete();\n\t\treturn;\n\t}\n\n\tsubscriber.next(false);\n\n\tconst onLoad = () => {\n\t\tsubscriber.next(true);\n\t\tsubscriber.complete();\n\t};\n\twindow.addEventListener(\"load\", onLoad, { once: true });\n\n\treturn () => window.removeEventListener(\"load\", onLoad);\n});\n","import {\n\tconcat,\n\tmap,\n\tmerge,\n\tNEVER,\n\ttype Observable,\n\tof,\n\tswitchMap,\n\ttimer,\n} from \"rxjs\";\nimport { pageLoaded$ } from \"./pageLoad\";\n\nconst READ_TAIL_MS = [100, 300, 600, 1100];\n\nconst tail$: Observable<void> = merge(\n\tof(undefined),\n\t...READ_TAIL_MS.map((ms) => timer(ms)),\n).pipe(map(() => undefined));\n\nexport const createRegistryReads$ = (): Observable<void> =>\n\ttypeof window === \"undefined\"\n\t\t? concat(of(undefined), NEVER)\n\t\t: pageLoaded$.pipe(switchMap(() => tail$));\n"],"mappings":";;AAEA,MAAa,cAAc,IAAIA,KAAAA,YAAqB,eAAe;CAClE,IAAI,OAAO,aAAa,aAAa;EACpC,WAAW,KAAK,KAAK;EACrB;CACD;CAEA,IAAI,SAAS,eAAe,YAAY;EACvC,WAAW,KAAK,IAAI;EACpB,WAAW,SAAS;EACpB;CACD;CAEA,WAAW,KAAK,KAAK;CAErB,MAAM,eAAe;EACpB,WAAW,KAAK,IAAI;EACpB,WAAW,SAAS;CACrB;CACA,OAAO,iBAAiB,QAAQ,QAAQ,EAAE,MAAM,KAAK,CAAC;CAEtD,aAAa,OAAO,oBAAoB,QAAQ,MAAM;AACvD,CAAC;;;ACTD,MAAM,SAAA,GAA0BC,KAAAA,MAAAA,EAAAA,GAC/BC,KAAAA,GAAAA,CAAG,KAAA,CAAS,GACZ,GAAG;CAJkB;CAAK;CAAK;CAAK;AAItB,CAAC,CAAC,KAAK,QAAA,GAAOC,KAAAA,MAAAA,CAAM,EAAE,CAAC,CACtC,CAAC,CAAC,MAAA,GAAKC,KAAAA,IAAAA,OAAU,KAAA,CAAS,CAAC;AAE3B,MAAa,6BACZ,OAAO,WAAW,eAAA,GACfC,KAAAA,OAAAA,EAAAA,GAAOH,KAAAA,GAAAA,CAAG,KAAA,CAAS,GAAGI,KAAAA,KAAK,IAC3B,YAAY,MAAA,GAAKC,KAAAA,UAAAA,OAAgB,KAAK,CAAC"}
@@ -1,33 +0,0 @@
1
- import { NEVER, Observable, concat, map, merge, of, switchMap, timer } from "rxjs";
2
- //#region src/utils/pageLoad.ts
3
- const pageLoaded$ = new Observable((subscriber) => {
4
- if (typeof document === "undefined") {
5
- subscriber.next(false);
6
- return;
7
- }
8
- if (document.readyState === "complete") {
9
- subscriber.next(true);
10
- subscriber.complete();
11
- return;
12
- }
13
- subscriber.next(false);
14
- const onLoad = () => {
15
- subscriber.next(true);
16
- subscriber.complete();
17
- };
18
- window.addEventListener("load", onLoad, { once: true });
19
- return () => window.removeEventListener("load", onLoad);
20
- });
21
- //#endregion
22
- //#region src/utils/registryReads.ts
23
- const tail$ = merge(of(void 0), ...[
24
- 100,
25
- 300,
26
- 600,
27
- 1100
28
- ].map((ms) => timer(ms))).pipe(map(() => void 0));
29
- const createRegistryReads$ = () => typeof window === "undefined" ? concat(of(void 0), NEVER) : pageLoaded$.pipe(switchMap(() => tail$));
30
- //#endregion
31
- export { createRegistryReads$ as t };
32
-
33
- //# sourceMappingURL=registryReads-BvtznSo3.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registryReads-BvtznSo3.mjs","names":[],"sources":["../src/utils/pageLoad.ts","../src/utils/registryReads.ts"],"sourcesContent":["import { Observable } from \"rxjs\";\n\nexport const pageLoaded$ = new Observable<boolean>((subscriber) => {\n\tif (typeof document === \"undefined\") {\n\t\tsubscriber.next(false);\n\t\treturn;\n\t}\n\n\tif (document.readyState === \"complete\") {\n\t\tsubscriber.next(true);\n\t\tsubscriber.complete();\n\t\treturn;\n\t}\n\n\tsubscriber.next(false);\n\n\tconst onLoad = () => {\n\t\tsubscriber.next(true);\n\t\tsubscriber.complete();\n\t};\n\twindow.addEventListener(\"load\", onLoad, { once: true });\n\n\treturn () => window.removeEventListener(\"load\", onLoad);\n});\n","import {\n\tconcat,\n\tmap,\n\tmerge,\n\tNEVER,\n\ttype Observable,\n\tof,\n\tswitchMap,\n\ttimer,\n} from \"rxjs\";\nimport { pageLoaded$ } from \"./pageLoad\";\n\nconst READ_TAIL_MS = [100, 300, 600, 1100];\n\nconst tail$: Observable<void> = merge(\n\tof(undefined),\n\t...READ_TAIL_MS.map((ms) => timer(ms)),\n).pipe(map(() => undefined));\n\nexport const createRegistryReads$ = (): Observable<void> =>\n\ttypeof window === \"undefined\"\n\t\t? concat(of(undefined), NEVER)\n\t\t: pageLoaded$.pipe(switchMap(() => tail$));\n"],"mappings":";;AAEA,MAAa,cAAc,IAAI,YAAqB,eAAe;CAClE,IAAI,OAAO,aAAa,aAAa;EACpC,WAAW,KAAK,KAAK;EACrB;CACD;CAEA,IAAI,SAAS,eAAe,YAAY;EACvC,WAAW,KAAK,IAAI;EACpB,WAAW,SAAS;EACpB;CACD;CAEA,WAAW,KAAK,KAAK;CAErB,MAAM,eAAe;EACpB,WAAW,KAAK,IAAI;EACpB,WAAW,SAAS;CACrB;CACA,OAAO,iBAAiB,QAAQ,QAAQ,EAAE,MAAM,KAAK,CAAC;CAEtD,aAAa,OAAO,oBAAoB,QAAQ,MAAM;AACvD,CAAC;;;ACTD,MAAM,QAA0B,MAC/B,GAAG,KAAA,CAAS,GACZ,GAAG;CAJkB;CAAK;CAAK;CAAK;AAItB,CAAC,CAAC,KAAK,OAAO,MAAM,EAAE,CAAC,CACtC,CAAC,CAAC,KAAK,UAAU,KAAA,CAAS,CAAC;AAE3B,MAAa,6BACZ,OAAO,WAAW,cACf,OAAO,GAAG,KAAA,CAAS,GAAG,KAAK,IAC3B,YAAY,KAAK,gBAAgB,KAAK,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-BWHvNFlN.js","names":[],"sources":["../src/utils/getCachedObservable.ts","../src/utils/isWalletPlatform.ts","../src/utils/WalletId.ts","../src/api/errors.ts","../src/api/types.ts"],"sourcesContent":["import type { Observable } from \"rxjs\";\n\n// Anchored on globalThis so the cache stays a single instance even if the\n// module is duplicated across bundle chunks (e.g. CJS subpath entries).\nconst CACHE_SYMBOL = Symbol.for(\"kheopskit.observableCache\");\n\nconst getCache = (): Map<string, Observable<unknown>> => {\n\tconst g = globalThis as unknown as Record<\n\t\tsymbol,\n\t\tMap<string, Observable<unknown>> | undefined\n\t>;\n\tlet cache = g[CACHE_SYMBOL];\n\tif (!cache) {\n\t\tcache = new Map();\n\t\tg[CACHE_SYMBOL] = cache;\n\t}\n\treturn cache;\n};\n\nexport const getCachedObservable$ = <T, Obs = Observable<T>>(\n\tkey: string,\n\tcreate: () => Obs,\n): Obs => {\n\tconst cache = getCache();\n\tif (!cache.has(key)) cache.set(key, create() as Observable<unknown>);\n\n\treturn cache.get(key) as Obs;\n};\n\n/**\n * Clears an observable from the cache.\n * Use when a wallet disconnects or configuration changes.\n */\nexport const clearCachedObservable = (key: string): void => {\n\tgetCache().delete(key);\n};\n\n/**\n * Clears all cached observables whose key starts with `prefix`.\n *\n * Used to drop a wallet's account observables when it disconnects, so a later\n * reconnect rebuilds them against the current wallet handle instead of a stale\n * closure — and to keep the cache from growing unbounded across connect cycles.\n */\nexport const clearCachedObservablesByPrefix = (prefix: string): void => {\n\tconst cache = getCache();\n\tfor (const key of cache.keys()) {\n\t\tif (key.startsWith(prefix)) cache.delete(key);\n\t}\n};\n\n/**\n * Clears all cached observables.\n * Use when resetting the entire kheopskit state.\n */\nexport const clearAllCachedObservables = (): void => {\n\tgetCache().clear();\n};\n","import type { WalletPlatform } from \"../api/types\";\n\nexport const isWalletPlatform = (\n\tplatform: unknown,\n): platform is WalletPlatform =>\n\ttypeof platform === \"string\" &&\n\t[\"polkadot\", \"ethereum\", \"solana\"].includes(platform as WalletPlatform);\n","import type { WalletPlatform } from \"../api/types\";\nimport { isWalletPlatform } from \"./isWalletPlatform\";\n\nexport type WalletId = string;\n\n/**\n * Stable id of the single WalletConnect connector. It is platform-less: one WC\n * session spans whichever namespaces the wallet approves, so it isn't tied to a\n * platform (unlike injected wallet ids, which are `<platform>:<identifier>`).\n */\nexport const WALLET_CONNECT_WALLET_ID: WalletId = \"walletconnect\";\n\nexport const getWalletId = (\n\tplatform: WalletPlatform,\n\tidentifier: string,\n): WalletId => {\n\tif (!isWalletPlatform(platform)) throw new Error(\"Invalid platform\");\n\tif (!identifier) throw new Error(\"Invalid name\");\n\treturn `${platform}:${identifier}`;\n};\n\nexport const parseWalletId = (walletId: string) => {\n\tif (!walletId) throw new Error(\"Invalid walletId\");\n\tconst [platform, identifier] = walletId.split(\":\");\n\tif (!isWalletPlatform(platform)) throw new Error(\"Invalid platform\");\n\tif (!identifier) throw new Error(\"Invalid address\");\n\treturn { platform, identifier };\n};\n\n/**\n * Non-throwing variant of {@link parseWalletId}. Use when validating untrusted\n * input (e.g. cached state persisted by an older version) before parsing.\n */\nexport const isValidWalletId = (walletId: unknown): walletId is WalletId => {\n\tif (typeof walletId !== \"string\" || !walletId) return false;\n\tif (walletId === WALLET_CONNECT_WALLET_ID) return true;\n\tconst [platform, identifier] = walletId.split(\":\");\n\treturn isWalletPlatform(platform) && !!identifier;\n};\n","import type { WalletId } from \"../utils/WalletId\";\n\n/**\n * Stable error codes thrown by kheopskit. Catch a {@link KheopskitError} and\n * branch on `error.code` instead of matching message strings.\n */\nexport type KheopskitErrorCode =\n\t/**\n\t * This `connect()` or `disconnect()` call was abandoned. For `connect()`:\n\t * its `signal` fired before the platform answered, `disconnect()` was\n\t * called while it pended, its wallet disappeared, or the last `kheopskit$`\n\t * subscriber unsubscribed.\n\t * For either call on an injected wallet: the wallet object came from a\n\t * subscription that had already ended, in which case the call rejects\n\t * without asking the platform and without changing the remembered list. A\n\t * placeholder's `connect()` rejects the same way, its `disconnect()`\n\t * resolves, and the WalletConnect connector still calls AppKit.\n\t */\n\t| \"ABORTED\"\n\t/** The user refused the wallet's connect prompt. `cause` holds the platform error. */\n\t| \"USER_REJECTED\"\n\t/** The wallet's connect call failed for another reason. `cause` holds the platform error. */\n\t| \"CONNECT_FAILED\"\n\t/**\n\t * `connect()` was called on a placeholder wallet restored from the cache:\n\t * on `kheopskit$`, hydration ended without kheopskit discovering that\n\t * wallet; on `getHydratedSnapshot` and the React provider's initial\n\t * snapshot, always.\n\t */\n\t| \"WALLET_PENDING\"\n\t/** The wallet does not advertise a capability kheopskit needs to proceed. */\n\t| \"FEATURE_NOT_SUPPORTED\"\n\t/** No active WalletConnect session for the requested operation. */\n\t| \"NO_SESSION\"\n\t/** No provider available for the requested namespace. */\n\t| \"NO_PROVIDER\"\n\t/** The installed polkadot-api version exposes neither `getTxCreatorFromPjs` (v3) nor `getPolkadotSignerFromPjs` (v2). */\n\t| \"UNSUPPORTED_VERSION\"\n\t/** The requested chain cannot be used for this operation (e.g. a Solana cluster with no CAIP-2 id over WalletConnect). */\n\t| \"UNSUPPORTED_CHAIN\"\n\t/** `getKheopskit$` received a config value it cannot use. The message names the fix. */\n\t| \"INVALID_CONFIG\";\n\n/**\n * Error thrown by kheopskit wallet/account operations. Carries a stable\n * {@link KheopskitErrorCode} and, when relevant, the offending wallet id.\n *\n * @example\n * ```ts\n * try {\n * await wallet.connect();\n * } catch (error) {\n * if (error instanceof KheopskitError && error.code === \"USER_REJECTED\") {\n * // the user closed or refused the wallet prompt\n * } else throw error;\n * }\n * ```\n */\nexport class KheopskitError extends Error {\n\treadonly code: KheopskitErrorCode;\n\t/** The wallet id this error relates to, when applicable. */\n\treadonly walletId?: WalletId;\n\n\tconstructor(\n\t\tcode: KheopskitErrorCode,\n\t\tmessage: string,\n\t\toptions?: { walletId?: WalletId; cause?: unknown },\n\t) {\n\t\tsuper(`[kheopskit] ${message}`, { cause: options?.cause });\n\t\tthis.name = \"KheopskitError\";\n\t\tthis.code = code;\n\t\tthis.walletId = options?.walletId;\n\t}\n}\n\nexport const abortedError = (\n\twalletId: WalletId,\n\toperation: \"connect\" | \"disconnect\",\n): KheopskitError =>\n\tnew KheopskitError(\n\t\t\"ABORTED\",\n\t\t`${operation} of wallet ${walletId} was aborted`,\n\t\t{ walletId },\n\t);\n\nexport const walletPendingError = (walletId: WalletId): KheopskitError =>\n\tnew KheopskitError(\n\t\t\"WALLET_PENDING\",\n\t\t`wallet ${walletId} was not discovered before hydration ended`,\n\t\t{ walletId },\n\t);\n\nexport const toConnectError = (\n\terror: unknown,\n\twalletId: WalletId,\n\tisUserRejection: (error: unknown) => boolean,\n): KheopskitError => {\n\tif (error instanceof KheopskitError) return error;\n\treturn isUserRejection(error)\n\t\t? new KheopskitError(\n\t\t\t\t\"USER_REJECTED\",\n\t\t\t\t`the user rejected the connect request of wallet ${walletId}`,\n\t\t\t\t{ walletId, cause: error },\n\t\t\t)\n\t\t: new KheopskitError(\n\t\t\t\t\"CONNECT_FAILED\",\n\t\t\t\t`wallet ${walletId} failed to connect`,\n\t\t\t\t{ walletId, cause: error },\n\t\t\t);\n};\n\nconst EIP1193_USER_REJECTED_REQUEST = 4001;\n\nexport const isEip1193UserRejection = (error: unknown): boolean =>\n\ttypeof error === \"object\" &&\n\terror !== null &&\n\t(error as { code?: unknown }).code === EIP1193_USER_REJECTED_REQUEST;\n\ntype RefusalMessage = {\n\tpattern: RegExp;\n\twallet: string;\n\tevidence: \"live\" | \"inferred\";\n};\n\n/**\n * How Polkadot extensions and Wallet Standard wallets reject a refused connect\n * prompt. They send a plain `Error`, so the message is the only signal.\n * `evidence` records whether the row was observed live or inferred from the\n * wallet's source or documentation.\n */\nconst REFUSAL_MESSAGES: readonly RefusalMessage[] = [\n\t{\n\t\tpattern: /^Site .+ has not been authorised for Talisman yet$/,\n\t\twallet: \"Talisman 3.11.0, Reject button or prompt window closed\",\n\t\tevidence: \"live\",\n\t},\n\t{\n\t\tpattern: /^Connection request was (rejected|cancelled) by the user\\.$/,\n\t\twallet: \"polkadot-js extension (extension-base 0.64 State.ts)\",\n\t\tevidence: \"inferred\",\n\t},\n\t{\n\t\tpattern: /^(Rejected|Cancelled)$/,\n\t\twallet: \"SubWallet (Extension.ts)\",\n\t\tevidence: \"inferred\",\n\t},\n\t{\n\t\tpattern: /^User rejected the request\\.$/,\n\t\twallet: \"Phantom (Wallet Standard)\",\n\t\tevidence: \"inferred\",\n\t},\n];\n\nexport const isRefusalMessage = (error: unknown): boolean => {\n\tconst message = (error as { message?: unknown } | null | undefined)?.message;\n\treturn (\n\t\ttypeof message === \"string\" &&\n\t\tREFUSAL_MESSAGES.some((row) => row.pattern.test(message))\n\t);\n};\n","import type { Observable } from \"rxjs\";\nimport type { WalletAccountId } from \"../utils\";\nimport type { WalletId } from \"../utils/WalletId\";\nimport type { KheopskitError } from \"./errors\";\n\nexport type WalletPlatform = \"polkadot\" | \"ethereum\" | \"solana\";\n\n/**\n * Minimal structural view of a WalletConnect `UniversalProvider`, the subset\n * kheopskit reads. Declared locally so core never depends on\n * `@walletconnect/universal-provider`. The concrete instance comes from\n * `@reown/appkit` at runtime.\n */\nexport type WalletConnectProvider = {\n\tsession?: {\n\t\ttopic: string;\n\t\tnamespaces: Record<string, { accounts?: string[] }>;\n\t};\n\tclient: {\n\t\trequest<T = unknown>(args: {\n\t\t\ttopic: string;\n\t\t\tchainId: string;\n\t\t\trequest: { method: string; params: unknown };\n\t\t}): Promise<T>;\n\t};\n\trequest(args: { method: string; params?: unknown }): Promise<unknown>;\n\ton(event: string, listener: (...args: unknown[]) => void): void;\n\toff(event: string, listener: (...args: unknown[]) => void): void;\n};\n\n/**\n * Minimal structural view of the Reown AppKit instance, the subset kheopskit's\n * account factories use. Exposed as the `appKit` escape hatch on AppKit wallets;\n * cast it to `@reown/appkit`'s `AppKit` type for the full API. Declared locally\n * so core never depends on `@reown/appkit`'s types (it's an optional peer).\n */\nexport type AppKitInstance = {\n\tgetProvider<T = WalletConnectProvider>(namespace: string): T | undefined;\n\tgetAccount(\n\t\tnamespace: string,\n\t): { allAccounts: { address: string }[] } | undefined;\n\tgetCaipNetworks(namespace: string): { caipNetworkId?: string }[];\n};\n\nexport type WalletType = \"injected\" | \"walletconnect\";\n\n/**\n * Where a wallet stands with the dapp. `connecting` covers a `connect()` call\n * in flight and an auto-reconnect in flight alike.\n */\nexport type WalletStatus = \"disconnected\" | \"connecting\" | \"connected\";\n\nexport type PolkadotAccountType = \"sr25519\" | \"ed25519\" | \"ecdsa\" | \"ethereum\";\n\n/** Options accepted by {@link BaseWallet.connect}. */\nexport type ConnectOptions = {\n\t/**\n\t * Ends this caller's wait for the platform's answer: its promise rejects\n\t * with a `KheopskitError` of code `ABORTED`. An abort after the platform\n\t * has granted the connect changes nothing, and a Polkadot extension counts\n\t * as granted only once its account list has been read. Other callers\n\t * sharing the attempt keep waiting. The extension's own prompt may stay\n\t * open: nothing can withdraw it from the page. A Polkadot `connect()`\n\t * started while that prompt is open waits for it instead of asking again,\n\t * and connects with the handle it answers. Once no caller waits any more\n\t * and no later `connect()` joined that prompt, kheopskit drops a handle\n\t * the platform hands back afterwards without revoking the platform's\n\t * grant, and the wallet is neither connected nor remembered. Kheopskit\n\t * sets no timeout of its own, because an extension prompt\n\t * pends only while the user has not answered it; pass\n\t * `AbortSignal.timeout(ms)` to cap the wait.\n\t */\n\tsignal?: AbortSignal;\n};\n\n/**\n * SDK-free fields common to every wallet, regardless of platform. Platform\n * packages (`@kheopskit/core/<platform>`) extend this with SDK-typed fields\n * (the injected provider/extension/standard-wallet handle).\n */\nexport type BaseWallet = {\n\t/** `<platform>:<identifier>`, e.g. `polkadot:talisman`. Stable across reloads. */\n\tid: WalletId;\n\t/** The platform whose registry listed the wallet. */\n\tplatform: WalletPlatform;\n\t/**\n\t * `\"injected\"`, for a browser extension or Wallet Standard wallet. The\n\t * WalletConnect connector is the separate {@link WalletConnectWallet}.\n\t */\n\ttype: WalletType;\n\t/** Display name, e.g. `Talisman`. */\n\tname: string;\n\t/** Icon URL or data URI. `\"\"` when the wallet exposes none. */\n\ticon: string;\n\t/**\n\t * `true` for a wallet restored from the cache that kheopskit has not\n\t * discovered yet: its SDK handle and `sourceId` are absent and it is never\n\t * connected. On `kheopskit$` its `connect()` waits for the live wallet and\n\t * connects that one, rejecting with `WALLET_PENDING` if hydration ends first\n\t * and `ABORTED` if its `signal` fires or the subscription ends. On\n\t * `getHydratedSnapshot` it rejects with `WALLET_PENDING`. Its `disconnect()`\n\t * resolves at once, and on `kheopskit$` forgets the wallet first so it is\n\t * not reconnected when it injects, or calls the live wallet's\n\t * `disconnect()` once that one is discovered. Set on every wallet of\n\t * `kheopskit$` and of the hydrated snapshot; plugins leave it unset.\n\t */\n\tisPlaceholder?: boolean;\n\t/**\n\t * `connecting` while a `connect()` call or an auto-reconnect waits for the\n\t * platform, `connected` once the platform granted it, `disconnected`\n\t * otherwise. On a reload, a remembered wallet kheopskit will reconnect is\n\t * `connecting` from the first frame when the cache recorded it connected,\n\t * which the cache does 1 s after the state settles.\n\t */\n\tstatus: WalletStatus;\n\t/**\n\t * The last `connect()` or auto-reconnect that the platform refused or\n\t * failed (`USER_REJECTED` or `CONNECT_FAILED`, or `FEATURE_NOT_SUPPORTED`\n\t * for a Wallet Standard wallet without `standard:connect`). Cleared when\n\t * the next attempt starts. An aborted attempt sets nothing.\n\t */\n\terror?: KheopskitError;\n\t/** `status === \"connected\"`. */\n\tisConnected: boolean;\n\t/**\n\t * Connects the wallet.\n\t *\n\t * - **Shared in flight.** Concurrent calls on one wallet share a single\n\t * platform attempt and the platform is asked once. Each call gets its own\n\t * promise: aborting a caller's `signal` rejects only that caller with code\n\t * `ABORTED`. The attempt itself is abandoned only when every caller that\n\t * passed a signal has aborted and no caller without one joined, when\n\t * `disconnect()` is called, or when the last `kheopskit$` subscriber\n\t * unsubscribes; those reject every remaining caller with `ABORTED`.\n\t * - **Idempotent.** On a connected wallet it resolves at once without\n\t * touching the platform, unless a `disconnect()` still waits for the\n\t * platform. It then waits for that disconnect to settle and connects\n\t * again if the wallet ended up disconnected.\n\t * - **Abortable.** See {@link ConnectOptions.signal}. There is no default\n\t * timeout.\n\t * - **Settles with the state.** It resolves only after `kheopskit$` has\n\t * emitted a state in which this wallet has `isConnected: true`, so the\n\t * consumer-visible state already reflects the connect. On platforms that\n\t * list accounts asynchronously (Ethereum `eth_accounts`), the accounts may\n\t * arrive in a later emission. No emission shows a disconnected wallet\n\t * still listing live accounts, or a connected wallet listing the accounts\n\t * of a previous connection. During hydration a wallet's cached\n\t * placeholder accounts stay listed whatever its status. Another wallet's\n\t * pending `eth_accounts` request never delays them. A `disconnect()` that\n\t * completes while it waits for that state rejects it with `ABORTED`. If\n\t * the platform's disconnect is still pending or refuses, it resolves once\n\t * the state shows the wallet connected (today only Solana has a platform\n\t * disconnect). A `connect()`\n\t * whose wallet disappears before the platform grants it (an extension\n\t * removed, a Wallet Standard wallet unregistered) rejects `ABORTED`;\n\t * granted first, it resolves and the wallet stays remembered. Once the last `kheopskit$`\n\t * subscriber has unsubscribed, a call on a wallet object from that\n\t * subscription rejects with `ABORTED` without asking the platform,\n\t * placeholders included.\n\t * - **Typed rejections.** A platform rejection is wrapped in a\n\t * `KheopskitError` carrying the original error as `cause` and the\n\t * `walletId`: `USER_REJECTED` when the user refused the prompt,\n\t * `CONNECT_FAILED` otherwise. A Wallet Standard wallet without\n\t * `standard:connect` rejects with `FEATURE_NOT_SUPPORTED`.\n\t */\n\tconnect: (options?: ConnectOptions) => Promise<void>;\n\t/**\n\t * Disconnects the wallet.\n\t *\n\t * It forgets the wallet at once, whatever its status, so the next load does\n\t * not reconnect it. On a disconnected wallet it then resolves. While a `connect()` waits\n\t * for the platform to grant it, it aborts that connect (its promise rejects\n\t * with `ABORTED`) and never waits for the extension prompt. Otherwise it\n\t * first waits for the platform's disconnect and rejects if that fails, so\n\t * callers can surface or retry. It then resolves once `kheopskit$` has\n\t * emitted a state in which this wallet has `isConnected: false`, or once a\n\t * later `connect()`, the wallet leaving the list or the end of the\n\t * subscription makes that emission impossible. Once the last `kheopskit$`\n\t * subscriber has unsubscribed, a call on a wallet object from that\n\t * subscription rejects with `ABORTED` without asking the platform and\n\t * without changing the remembered list, except on a placeholder, whose\n\t * `disconnect()` resolves. A `disconnect()` started before that point\n\t * settles once the platform has answered: the wallet was\n\t * forgotten when it was called, and nothing else is written once the\n\t * subscription has ended.\n\t */\n\tdisconnect: () => Promise<void>;\n};\n\n/**\n * SDK-free fields common to every account, regardless of platform. Platform\n * packages extend this with their SDK-typed signer/client.\n */\nexport type BaseWalletAccount = {\n\t/** `<walletId>::<address>`, e.g. `polkadot:talisman::5Grw…`. */\n\tid: WalletAccountId;\n\t/**\n\t * `true` for an account restored from the cache that the live wallet has\n\t * not listed yet: its signing surface is absent. Set on every account of\n\t * `kheopskit$` and of the hydrated snapshot; plugins leave it unset.\n\t */\n\tisPlaceholder?: boolean;\n\t/** The platform of the wallet that lists the account. */\n\tplatform: WalletPlatform;\n\t/** Base58 (Solana), SS58 (Polkadot) or 0x-hex (Ethereum) address. */\n\taddress: string;\n\t/**\n\t * Friendly account name, when the wallet exposes one: the extension's\n\t * account name on Polkadot, the Wallet Standard `label` on Solana. Always\n\t * `undefined` on Ethereum.\n\t */\n\tname?: string;\n\t/** `name` of the wallet that lists the account. */\n\twalletName: string;\n\t/** `id` of the wallet that lists the account. */\n\twalletId: WalletId;\n};\n\ntype LiveWalletConnectWallet = {\n\t/** See {@link BaseWallet.isPlaceholder}. */\n\tisPlaceholder?: false;\n\t/** `\"walletconnect\"`, the one connector shared by every platform. */\n\tid: WalletId;\n\t/** Narrow with {@link isWalletConnectWallet}. */\n\ttype: \"walletconnect\";\n\t/**\n\t * Platforms (namespaces) the live session currently carries. Empty until\n\t * connected; populated with whatever the wallet approved (e.g. just\n\t * `[\"ethereum\"]`, or `[\"polkadot\", \"ethereum\"]`).\n\t */\n\tplatforms: WalletPlatform[];\n\t/**\n\t * Raw Reown AppKit instance, exposed as an escape hatch for advanced use\n\t * (custom modal control, reading providers directly). Most consumers should\n\t * use `connect`/`disconnect` and the derived accounts instead.\n\t */\n\tappKit: AppKitInstance;\n\t/** The name AppKit reports for the paired wallet, `\"WalletConnect\"` when it reports none. */\n\tname: string;\n\t/** The icon AppKit reports for the paired wallet, the WalletConnect logo when it reports none. */\n\ticon: string;\n\t/**\n\t * `connecting` while `connect()` opens the modal, `connected` while a\n\t * session is live, `disconnected` otherwise. On a reload with a cached\n\t * session it is `connecting` until AppKit restores the session or hydration\n\t * ends.\n\t */\n\tstatus: WalletStatus;\n\t/** The last `connect()` whose modal failed to open. Cleared by the next call. */\n\terror?: KheopskitError;\n\t/** `status === \"connected\"`. */\n\tisConnected: boolean;\n\t/**\n\t * Opens the WalletConnect modal and resolves once it is open; `isConnected`\n\t * follows when the user approves a session. Unlike injected wallets, this\n\t * promise does not wait for the state to show the connector connected, and\n\t * `signal` is accepted for signature compatibility only.\n\t */\n\tconnect: (options?: ConnectOptions) => Promise<void>;\n\t/** Ends the live session when there is one; resolves at once otherwise. */\n\tdisconnect: () => Promise<void>;\n};\n\n/**\n * The single WalletConnect connector, shared across every platform.\n *\n * Unlike injected wallets, it is **not tied to a platform**: one WalletConnect\n * session spans whichever namespaces the remote wallet approves in a single\n * pairing (a namespace can't be added to a live session afterwards). So there is\n * exactly one of these in `wallets`, discriminated by `type: \"walletconnect\"`.\n * Its accounts appear in `accounts`, each carrying its own `platform`.\n *\n * A placeholder (see {@link BaseWallet.isPlaceholder}) has no `appKit`.\n */\nexport type WalletConnectWallet =\n\t| LiveWalletConnectWallet\n\t| PlaceholderWallet<LiveWalletConnectWallet, \"appKit\">;\n\n/**\n * The cached stand-in for a live item `T`: `isPlaceholder: true`, and the\n * fields `K`, which only the live item carries, absent. Platform account and\n * wallet types are `T | Placeholder<T, K>`, so narrow on `isPlaceholder`\n * before reading a field of `K`.\n */\nexport type Placeholder<T, K extends keyof T> = Omit<T, K | \"isPlaceholder\"> & {\n\t/** Restored from the cache and not yet replaced by the live item. */\n\tisPlaceholder: true;\n} & { [P in K]?: undefined };\n\n/** A {@link Placeholder} wallet, which is never connected. */\nexport type PlaceholderWallet<\n\tT extends { isConnected: boolean },\n\tK extends keyof T,\n> = Omit<Placeholder<T, K>, \"isConnected\"> & { isConnected: false };\n\n/** Narrows a wallet to the platform-less {@link WalletConnectWallet}. */\nexport const isWalletConnectWallet = (\n\twallet: BaseWallet | WalletConnectWallet,\n): wallet is WalletConnectWallet => wallet.type === \"walletconnect\";\n\n/**\n * Narrows a wallet to an injected (browser-extension / Wallet Standard) wallet,\n * the complement of {@link isWalletConnectWallet}. `state.wallets` is\n * `(InjectedWallet | WalletConnectWallet)[]`, so use this to recover the\n * injected-only fields when iterating: `platform`, `sourceId`, and the SDK\n * handle (`provider` on Ethereum, `extension` on Polkadot, `wallet` on Solana).\n *\n * @example\n * ```ts\n * for (const wallet of wallets.filter(isInjectedWallet)) {\n * console.log(wallet.platform, wallet.sourceId); // typed, no WC widening\n * }\n * ```\n */\nexport const isInjectedWallet = <W extends BaseWallet | WalletConnectWallet>(\n\twallet: W,\n): wallet is Exclude<W, WalletConnectWallet> => wallet.type === \"injected\";\n\n/**\n * Dapp metadata shown in the WalletConnect modal. Mirrors WalletConnect's\n * `Metadata`, declared locally so core doesn't depend on\n * `@walletconnect/universal-provider`.\n */\nexport type WalletConnectMetadata = {\n\tname: string;\n\tdescription: string;\n\turl: string;\n\ticons: string[];\n};\n\n/**\n * The WalletConnect connector for `config.walletConnect`. Create it with\n * `walletConnect()` from `@kheopskit/core/walletconnect`; that entry is the only\n * one that loads Reown AppKit.\n */\nexport type WalletConnectPlugin = {\n\treadonly type: \"walletconnect\";\n\treadonly metadata: WalletConnectMetadata;\n\tgetWallet$(ctx: PlatformContext): Observable<WalletConnectWallet | null>;\n};\n\n/**\n * Context passed to a platform plugin's `getWallets$`. Carries the shared store\n * and the resolved core config (for WalletConnect / debug).\n */\nexport type PlatformContext = {\n\tstore: KheopskitStore;\n\tconfig: KheopskitConfig;\n\t/**\n\t * Moments to re-read a registry that has no announce event. Emits at\n\t * subscribe and on a tail restarted at window `load`, and completes after\n\t * the last read. {@link KheopskitState.isDiscovering} turns `false` on the\n\t * first wallet list after that, which waits for a WalletConnect connector\n\t * still loading.\n\t */\n\tregistryReads$?: Observable<void>;\n};\n\n/**\n * A platform plugin. Created by the per-platform factories exported from\n * `@kheopskit/core/polkadot`, `/ethereum`, `/solana`. Core iterates plugins\n * generically and never imports a platform SDK itself.\n *\n * @typeParam TPlatform - the platform discriminant\n * @typeParam TWallet - the platform's wallet type (extends {@link BaseWallet})\n * @typeParam TAccount - the platform's account type (extends {@link BaseWalletAccount})\n */\nexport type KheopskitPlatform<\n\tTPlatform extends WalletPlatform = WalletPlatform,\n\tTWallet extends BaseWallet = BaseWallet,\n\tTAccount extends BaseWalletAccount = BaseWalletAccount,\n> = {\n\treadonly platform: TPlatform;\n\t// Declared as methods (not arrow properties) so parameters are checked\n\t// bivariantly — this lets a specific `KheopskitPlatform<\"polkadot\", …>` be\n\t// assigned to the base `KheopskitPlatform` despite the contravariant\n\t// `wallets$` parameter.\n\tgetWallets$(ctx: PlatformContext): Observable<TWallet[]>;\n\t// Receives this platform's (injected) wallets plus the shared, platform-less\n\t// WalletConnect connector — the plugin derives its injected accounts and, if\n\t// the WC session carries its namespace, its WalletConnect accounts.\n\tgetAccounts$(\n\t\twallets$: Observable<(TWallet | WalletConnectWallet)[]>,\n\t): Observable<TAccount[]>;\n\t/**\n\t * Optional hydration filter. Cached accounts for which this returns false are\n\t * dropped during SSR hydration (Polkadot uses it to honour `accountTypes`).\n\t */\n\tacceptsCachedAccount?(cached: CachedAccount): boolean;\n};\n\ntype ElementOf<T> = T extends readonly (infer E)[] ? E : never;\n\n/** The account type produced by a plugin (inferred from its `getAccounts$`). */\nexport type AccountOf<T> = T extends {\n\tgetAccounts$: (wallets$: never) => Observable<infer R>;\n}\n\t? ElementOf<R>\n\t: never;\n\n/** The wallet type produced by a plugin (inferred from its `getWallets$`). */\nexport type WalletOf<T> = T extends {\n\tgetWallets$: (ctx: never) => Observable<infer R>;\n}\n\t? ElementOf<R>\n\t: never;\n\nexport type KheopskitConfig<\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n> = {\n\t/**\n\t * Which remembered injected wallets kheopskit reconnects after a reload.\n\t *\n\t * A wallet is remembered on every successful `connect()` and forgotten on\n\t * `disconnect()`, whatever this option says; the list is the store's\n\t * `remembered`. `true` reconnects every remembered injected wallet, `false`\n\t * none, and a function is asked for each cached connected injected wallet\n\t * on the first frame, then for each remembered one with its live object\n\t * before the attempt. The function must be synchronous and pure. It runs on\n\t * the server and on the client for the same input and both must agree, or\n\t * the markup diverges. It receives the {@link BaseWallet} fields only, so\n\t * key on `id`.\n\t *\n\t * The WalletConnect row is not governed by this option: AppKit restores its\n\t * own session on load, and the row hydrates `connecting` while it does.\n\t *\n\t * A reconnect opens no connect prompt while the site stays authorised in\n\t * the extension. When the authorisation was revoked the extension prompts\n\t * once; a refusal forgets the wallet, so the next load stays silent. A manual\n\t * `connect()` or `disconnect()` on a remembered wallet ends its automatic\n\t * reconnect for the session. A `disconnect()` forgets the wallet whatever\n\t * its status, so one made while the automatic reconnect still waits for the\n\t * extension aborts it, and the next load does not reconnect it.\n\t * Automatic reconnect also ends when the wallet disappears mid-attempt; the\n\t * wallet stays remembered for the next load.\n\t *\n\t * A cached connected wallet this accepts shows `status: \"connecting\"` from\n\t * the first frame until its attempt settles. A wallet this rejects shows\n\t * `disconnected` from the first frame, without its cached accounts, so\n\t * nothing flashes from connected to disconnected.\n\t *\n\t * @default true\n\t */\n\tautoReconnect: boolean | ((wallet: BaseWallet) => boolean);\n\t/**\n\t * Platform plugins to enable, e.g. `[polkadot(), solana({ chain })]`.\n\t * Import factories from `@kheopskit/core/<platform>`.\n\t */\n\tplatforms: P;\n\t/** Create with `walletConnect()` from `@kheopskit/core/walletconnect`. */\n\twalletConnect?: WalletConnectPlugin;\n\t/**\n\t * Dapp name sent to Polkadot injected extensions on connect. Some\n\t * extensions (e.g. polkadot.js) warn about a suspicious origin when it's\n\t * empty.\n\t *\n\t * @default walletConnect.metadata.name, then window.location.hostname\n\t */\n\tappName?: string;\n\t/**\n\t * Logs the resolved config, every state emission and the hydration and\n\t * persistence steps with `console.debug`.\n\t *\n\t * @default false\n\t */\n\tdebug: boolean;\n\t/**\n\t * Custom storage key for persisting wallet connection state.\n\t * Useful when running multiple kheopskit instances on the same domain\n\t * to prevent state conflicts between different dapps.\n\t *\n\t * @default \"kheopskit\"\n\t */\n\tstorageKey: string;\n\t/**\n\t * Minimum time in milliseconds the cached placeholders are shown after a\n\t * reload, so the wallet list does not flash while extensions inject and\n\t * remembered wallets reconnect. Hydration goes on past it until the rule\n\t * documented on {@link KheopskitConfig.hydrationTimeout} ends it, and that\n\t * timeout wins over a longer grace period. The old cap of six times this\n\t * value is gone, so an app that raises it sets `hydrationTimeout` as well.\n\t *\n\t * `0` disables placeholders: `isHydrating` is `false` from the first\n\t * emission.\n\t *\n\t * @default 500\n\t */\n\thydrationGracePeriod: number;\n\t/**\n\t * Upper bound in milliseconds on {@link KheopskitState.isHydrating}.\n\t *\n\t * `isHydrating` turns `false` once `hydrationGracePeriod` has elapsed and\n\t * every cached wallet has settled. A cached wallet missing from the\n\t * discovered wallets settles when discovery ends\n\t * ({@link KheopskitState.isDiscovering} is `false`). A discovered one\n\t * settles at once unless it hydrated as `connecting`. Then it settles when\n\t * connected once its account list has been read (an empty list counts) or\n\t * connected with no cached accounts, disconnected with `error` set, or\n\t * disconnected and not remembered (a wallet remembered after hydration\n\t * began does not count). At\n\t * `hydrationTimeout` hydration ends whatever is pending, and a wallet whose\n\t * reconnect is still pending stays `connecting`.\n\t *\n\t * - When every cached wallet is discovered and settled, hydration ends at\n\t * the grace period, without waiting for `load`. A cached wallet that has\n\t * not appeared holds hydration until discovery ends (1100 ms after `load`\n\t * or after subscribe, whichever is later, or later while a WalletConnect\n\t * connector loads), or until `hydrationTimeout`.\n\t * - A wallet that reconnects without sharing any account with the site\n\t * settles as soon as it answers; its cached accounts leave the list when\n\t * hydration ends.\n\t * - A failed reconnect ends that wallet's wait, even when the reconnect\n\t * policy still permits a retry. A retry runs only when the wallet list next\n\t * changes (a wallet discovered or removed, or any wallet's status, error\n\t * or name changing), which may never happen, so waiting for it would\n\t * hold most failed reconnects until `hydrationTimeout`. A retry that\n\t * does run shows on the live wallet's `status`, not as a placeholder.\n\t * - A prompt the extension opens for a revoked site holds hydration until\n\t * the user answers or `hydrationTimeout` elapses.\n\t *\n\t * @default 3000\n\t */\n\thydrationTimeout: number;\n};\n\n/**\n * The current kheopskit state.\n *\n * @remarks\n * While {@link KheopskitState.isHydrating} is `true`, `wallets` and `accounts`\n * may contain placeholders restored from the cache, flagged\n * `isPlaceholder: true`. Each platform type is a union on that flag: a\n * placeholder lacks the SDK handles (`account.txCreator` or `polkadotSigner`\n * on Polkadot, `account.client` on Ethereum, `account.signer` / `getSigner` on\n * Solana, `wallet.extension` / `provider` / `wallet` and `sourceId`). Reading\n * one without narrowing yields a possibly-`undefined` value, so the compiler\n * rejects using it as present until you narrow:\n *\n * ```ts\n * if (account.isPlaceholder) return;\n * account.txCreator; // TxCreator\n * ```\n *\n * A placeholder wallet's `connect()` waits for the live wallet and connects\n * it, rejecting with `WALLET_PENDING` if hydration ends first. No item is a\n * placeholder once `isHydrating` is `false`.\n *\n * The plain, serializable platform data that is persisted in the cache IS\n * restored on the placeholders (Ethereum `chainId`, Polkadot key `type`), so it\n * renders immediately on reload without flashing. Solana `chains` is not\n * cached: a placeholder account's is empty.\n */\nexport type KheopskitState<\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n> = {\n\t/**\n\t * Every discovered wallet, connected or not, then the WalletConnect\n\t * connector once AppKit has loaded, when `config.walletConnect` is set.\n\t * While `isHydrating` is `true`, also the cached placeholders. Sorted by\n\t * platform (Polkadot, Ethereum, Solana, WalletConnect), then Talisman\n\t * first, then by name.\n\t */\n\twallets: (WalletOf<P[number]> | WalletConnectWallet)[];\n\t/**\n\t * The accounts of every connected wallet. While `isHydrating` is `true`,\n\t * also the cached placeholders of every wallet that has no live account\n\t * yet. Grouped by platform, then by wallet (Talisman first, then by wallet\n\t * name); inside a wallet, in the order the wallet lists them.\n\t */\n\taccounts: AccountOf<P[number]>[];\n\t/** The resolved config, with every default filled in. */\n\tconfig: KheopskitConfig<P>;\n\t/**\n\t * Whether the state is still being hydrated from cache.\n\t *\n\t * During hydration, cached wallets/accounts may be displayed before the\n\t * actual wallet extensions have injected. See the type-level remarks: those\n\t * are flagged `isPlaceholder: true` and carry no SDK handle.\n\t */\n\tisHydrating: boolean;\n\t/**\n\t * Whether wallet discovery may still be incomplete.\n\t *\n\t * `true` until the Polkadot registry (`window.injectedWeb3`) read window\n\t * ends, 1100 ms after `load` or after subscribe, whichever is later. With\n\t * `config.walletConnect`, it also waits for the connector to load. The\n\t * emission that turns it `false` lists every Polkadot extension injected\n\t * before the last read. A wallet that injects later is not listed until\n\t * the next subscription. Always `true` on the server.\n\t *\n\t * Ethereum (EIP-6963) and Solana (Wallet Standard) registries are\n\t * event-driven and need no re-read.\n\t */\n\tisDiscovering: boolean;\n};\n\n/** Shape of the persisted store data (localStorage, or cookies in compact form). */\nexport type KheopskitStoreData = {\n\t/** Wallets the user connected and has not disconnected */\n\tremembered?: WalletId[];\n\t/** Cached wallet state for SSR hydration to prevent UI flash */\n\tcachedWallets?: CachedWallet[];\n\t/** Cached account state for SSR hydration to prevent UI flash */\n\tcachedAccounts?: CachedAccount[];\n};\n\n/**\n * The persisted settings store shared between core and framework bindings.\n * Declared structurally here (implemented by `createKheopskitStore`) so modules\n * can depend on the interface without importing the implementation.\n */\nexport type KheopskitStore = {\n\tobservable: Observable<KheopskitStoreData>;\n\trememberWallet: (walletId: WalletId) => void;\n\tforgetWallet: (walletId: WalletId) => void;\n\tgetCachedState: () => { wallets: CachedWallet[]; accounts: CachedAccount[] };\n\tsetCachedState: (wallets: CachedWallet[], accounts: CachedAccount[]) => void;\n\t/** Stops cross-tab storage sync and completes `observable`. */\n\tdestroy: () => void;\n};\n\n/**\n * Serializable wallet data for SSR hydration cache.\n * Contains only the data needed to render wallet UI without flash.\n * Note: icon is NOT stored to save cookie space - it's looked up at hydration time.\n */\nexport type CachedWallet = {\n\tid: WalletId;\n\t/** Absent for the platform-less WalletConnect connector. */\n\tplatform?: WalletPlatform;\n\ttype: WalletType;\n\tname: string;\n\tisConnected: boolean;\n};\n\n/**\n * Serializable account data for SSR hydration cache.\n * Contains only the data needed to render account UI without flash.\n */\nexport type CachedAccount = {\n\tid: string;\n\tplatform: WalletPlatform;\n\taddress: string;\n\tname?: string;\n\t/** Cached chain ID for Ethereum accounts. */\n\tchainId?: number;\n\t/** Cached key type for Polkadot accounts. */\n\tpolkadotAccountType?: PolkadotAccountType;\n\twalletId: WalletId;\n\twalletName: string;\n};\n"],"mappings":";AAIA,MAAM,eAAe,OAAO,IAAI,2BAA2B;AAE3D,MAAM,iBAAmD;CACxD,MAAM,IAAI;CAIV,IAAI,QAAQ,EAAE;CACd,IAAI,CAAC,OAAO;EACX,wBAAQ,IAAI,IAAI;EAChB,EAAE,gBAA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AAE1D;;;;ACyIA,MAAa,yBACZ,WACmC,OAAO,SAAS;;;;;;;;;;;;;;;AAgBpD,MAAa,oBACZ,WAC+C,OAAO,SAAS"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-Yor672md.mjs","names":[],"sources":["../src/utils/getCachedObservable.ts","../src/utils/isWalletPlatform.ts","../src/utils/WalletId.ts","../src/api/errors.ts","../src/api/types.ts"],"sourcesContent":["import type { Observable } from \"rxjs\";\n\n// Anchored on globalThis so the cache stays a single instance even if the\n// module is duplicated across bundle chunks (e.g. CJS subpath entries).\nconst CACHE_SYMBOL = Symbol.for(\"kheopskit.observableCache\");\n\nconst getCache = (): Map<string, Observable<unknown>> => {\n\tconst g = globalThis as unknown as Record<\n\t\tsymbol,\n\t\tMap<string, Observable<unknown>> | undefined\n\t>;\n\tlet cache = g[CACHE_SYMBOL];\n\tif (!cache) {\n\t\tcache = new Map();\n\t\tg[CACHE_SYMBOL] = cache;\n\t}\n\treturn cache;\n};\n\nexport const getCachedObservable$ = <T, Obs = Observable<T>>(\n\tkey: string,\n\tcreate: () => Obs,\n): Obs => {\n\tconst cache = getCache();\n\tif (!cache.has(key)) cache.set(key, create() as Observable<unknown>);\n\n\treturn cache.get(key) as Obs;\n};\n\n/**\n * Clears an observable from the cache.\n * Use when a wallet disconnects or configuration changes.\n */\nexport const clearCachedObservable = (key: string): void => {\n\tgetCache().delete(key);\n};\n\n/**\n * Clears all cached observables whose key starts with `prefix`.\n *\n * Used to drop a wallet's account observables when it disconnects, so a later\n * reconnect rebuilds them against the current wallet handle instead of a stale\n * closure — and to keep the cache from growing unbounded across connect cycles.\n */\nexport const clearCachedObservablesByPrefix = (prefix: string): void => {\n\tconst cache = getCache();\n\tfor (const key of cache.keys()) {\n\t\tif (key.startsWith(prefix)) cache.delete(key);\n\t}\n};\n\n/**\n * Clears all cached observables.\n * Use when resetting the entire kheopskit state.\n */\nexport const clearAllCachedObservables = (): void => {\n\tgetCache().clear();\n};\n","import type { WalletPlatform } from \"../api/types\";\n\nexport const isWalletPlatform = (\n\tplatform: unknown,\n): platform is WalletPlatform =>\n\ttypeof platform === \"string\" &&\n\t[\"polkadot\", \"ethereum\", \"solana\"].includes(platform as WalletPlatform);\n","import type { WalletPlatform } from \"../api/types\";\nimport { isWalletPlatform } from \"./isWalletPlatform\";\n\nexport type WalletId = string;\n\n/**\n * Stable id of the single WalletConnect connector. It is platform-less: one WC\n * session spans whichever namespaces the wallet approves, so it isn't tied to a\n * platform (unlike injected wallet ids, which are `<platform>:<identifier>`).\n */\nexport const WALLET_CONNECT_WALLET_ID: WalletId = \"walletconnect\";\n\nexport const getWalletId = (\n\tplatform: WalletPlatform,\n\tidentifier: string,\n): WalletId => {\n\tif (!isWalletPlatform(platform)) throw new Error(\"Invalid platform\");\n\tif (!identifier) throw new Error(\"Invalid name\");\n\treturn `${platform}:${identifier}`;\n};\n\nexport const parseWalletId = (walletId: string) => {\n\tif (!walletId) throw new Error(\"Invalid walletId\");\n\tconst [platform, identifier] = walletId.split(\":\");\n\tif (!isWalletPlatform(platform)) throw new Error(\"Invalid platform\");\n\tif (!identifier) throw new Error(\"Invalid address\");\n\treturn { platform, identifier };\n};\n\n/**\n * Non-throwing variant of {@link parseWalletId}. Use when validating untrusted\n * input (e.g. cached state persisted by an older version) before parsing.\n */\nexport const isValidWalletId = (walletId: unknown): walletId is WalletId => {\n\tif (typeof walletId !== \"string\" || !walletId) return false;\n\tif (walletId === WALLET_CONNECT_WALLET_ID) return true;\n\tconst [platform, identifier] = walletId.split(\":\");\n\treturn isWalletPlatform(platform) && !!identifier;\n};\n","import type { WalletId } from \"../utils/WalletId\";\n\n/**\n * Stable error codes thrown by kheopskit. Catch a {@link KheopskitError} and\n * branch on `error.code` instead of matching message strings.\n */\nexport type KheopskitErrorCode =\n\t/**\n\t * This `connect()` or `disconnect()` call was abandoned. For `connect()`:\n\t * its `signal` fired before the platform answered, `disconnect()` was\n\t * called while it pended, its wallet disappeared, or the last `kheopskit$`\n\t * subscriber unsubscribed.\n\t * For either call on an injected wallet: the wallet object came from a\n\t * subscription that had already ended, in which case the call rejects\n\t * without asking the platform and without changing the remembered list. A\n\t * placeholder's `connect()` rejects the same way, its `disconnect()`\n\t * resolves, and the WalletConnect connector still calls AppKit.\n\t */\n\t| \"ABORTED\"\n\t/** The user refused the wallet's connect prompt. `cause` holds the platform error. */\n\t| \"USER_REJECTED\"\n\t/** The wallet's connect call failed for another reason. `cause` holds the platform error. */\n\t| \"CONNECT_FAILED\"\n\t/**\n\t * `connect()` was called on a placeholder wallet restored from the cache:\n\t * on `kheopskit$`, hydration ended without kheopskit discovering that\n\t * wallet; on `getHydratedSnapshot` and the React provider's initial\n\t * snapshot, always.\n\t */\n\t| \"WALLET_PENDING\"\n\t/** The wallet does not advertise a capability kheopskit needs to proceed. */\n\t| \"FEATURE_NOT_SUPPORTED\"\n\t/** No active WalletConnect session for the requested operation. */\n\t| \"NO_SESSION\"\n\t/** No provider available for the requested namespace. */\n\t| \"NO_PROVIDER\"\n\t/** The installed polkadot-api version exposes neither `getTxCreatorFromPjs` (v3) nor `getPolkadotSignerFromPjs` (v2). */\n\t| \"UNSUPPORTED_VERSION\"\n\t/** The requested chain cannot be used for this operation (e.g. a Solana cluster with no CAIP-2 id over WalletConnect). */\n\t| \"UNSUPPORTED_CHAIN\"\n\t/** `getKheopskit$` received a config value it cannot use. The message names the fix. */\n\t| \"INVALID_CONFIG\";\n\n/**\n * Error thrown by kheopskit wallet/account operations. Carries a stable\n * {@link KheopskitErrorCode} and, when relevant, the offending wallet id.\n *\n * @example\n * ```ts\n * try {\n * await wallet.connect();\n * } catch (error) {\n * if (error instanceof KheopskitError && error.code === \"USER_REJECTED\") {\n * // the user closed or refused the wallet prompt\n * } else throw error;\n * }\n * ```\n */\nexport class KheopskitError extends Error {\n\treadonly code: KheopskitErrorCode;\n\t/** The wallet id this error relates to, when applicable. */\n\treadonly walletId?: WalletId;\n\n\tconstructor(\n\t\tcode: KheopskitErrorCode,\n\t\tmessage: string,\n\t\toptions?: { walletId?: WalletId; cause?: unknown },\n\t) {\n\t\tsuper(`[kheopskit] ${message}`, { cause: options?.cause });\n\t\tthis.name = \"KheopskitError\";\n\t\tthis.code = code;\n\t\tthis.walletId = options?.walletId;\n\t}\n}\n\nexport const abortedError = (\n\twalletId: WalletId,\n\toperation: \"connect\" | \"disconnect\",\n): KheopskitError =>\n\tnew KheopskitError(\n\t\t\"ABORTED\",\n\t\t`${operation} of wallet ${walletId} was aborted`,\n\t\t{ walletId },\n\t);\n\nexport const walletPendingError = (walletId: WalletId): KheopskitError =>\n\tnew KheopskitError(\n\t\t\"WALLET_PENDING\",\n\t\t`wallet ${walletId} was not discovered before hydration ended`,\n\t\t{ walletId },\n\t);\n\nexport const toConnectError = (\n\terror: unknown,\n\twalletId: WalletId,\n\tisUserRejection: (error: unknown) => boolean,\n): KheopskitError => {\n\tif (error instanceof KheopskitError) return error;\n\treturn isUserRejection(error)\n\t\t? new KheopskitError(\n\t\t\t\t\"USER_REJECTED\",\n\t\t\t\t`the user rejected the connect request of wallet ${walletId}`,\n\t\t\t\t{ walletId, cause: error },\n\t\t\t)\n\t\t: new KheopskitError(\n\t\t\t\t\"CONNECT_FAILED\",\n\t\t\t\t`wallet ${walletId} failed to connect`,\n\t\t\t\t{ walletId, cause: error },\n\t\t\t);\n};\n\nconst EIP1193_USER_REJECTED_REQUEST = 4001;\n\nexport const isEip1193UserRejection = (error: unknown): boolean =>\n\ttypeof error === \"object\" &&\n\terror !== null &&\n\t(error as { code?: unknown }).code === EIP1193_USER_REJECTED_REQUEST;\n\ntype RefusalMessage = {\n\tpattern: RegExp;\n\twallet: string;\n\tevidence: \"live\" | \"inferred\";\n};\n\n/**\n * How Polkadot extensions and Wallet Standard wallets reject a refused connect\n * prompt. They send a plain `Error`, so the message is the only signal.\n * `evidence` records whether the row was observed live or inferred from the\n * wallet's source or documentation.\n */\nconst REFUSAL_MESSAGES: readonly RefusalMessage[] = [\n\t{\n\t\tpattern: /^Site .+ has not been authorised for Talisman yet$/,\n\t\twallet: \"Talisman 3.11.0, Reject button or prompt window closed\",\n\t\tevidence: \"live\",\n\t},\n\t{\n\t\tpattern: /^Connection request was (rejected|cancelled) by the user\\.$/,\n\t\twallet: \"polkadot-js extension (extension-base 0.64 State.ts)\",\n\t\tevidence: \"inferred\",\n\t},\n\t{\n\t\tpattern: /^(Rejected|Cancelled)$/,\n\t\twallet: \"SubWallet (Extension.ts)\",\n\t\tevidence: \"inferred\",\n\t},\n\t{\n\t\tpattern: /^User rejected the request\\.$/,\n\t\twallet: \"Phantom (Wallet Standard)\",\n\t\tevidence: \"inferred\",\n\t},\n];\n\nexport const isRefusalMessage = (error: unknown): boolean => {\n\tconst message = (error as { message?: unknown } | null | undefined)?.message;\n\treturn (\n\t\ttypeof message === \"string\" &&\n\t\tREFUSAL_MESSAGES.some((row) => row.pattern.test(message))\n\t);\n};\n","import type { Observable } from \"rxjs\";\nimport type { WalletAccountId } from \"../utils\";\nimport type { WalletId } from \"../utils/WalletId\";\nimport type { KheopskitError } from \"./errors\";\n\nexport type WalletPlatform = \"polkadot\" | \"ethereum\" | \"solana\";\n\n/**\n * Minimal structural view of a WalletConnect `UniversalProvider`, the subset\n * kheopskit reads. Declared locally so core never depends on\n * `@walletconnect/universal-provider`. The concrete instance comes from\n * `@reown/appkit` at runtime.\n */\nexport type WalletConnectProvider = {\n\tsession?: {\n\t\ttopic: string;\n\t\tnamespaces: Record<string, { accounts?: string[] }>;\n\t};\n\tclient: {\n\t\trequest<T = unknown>(args: {\n\t\t\ttopic: string;\n\t\t\tchainId: string;\n\t\t\trequest: { method: string; params: unknown };\n\t\t}): Promise<T>;\n\t};\n\trequest(args: { method: string; params?: unknown }): Promise<unknown>;\n\ton(event: string, listener: (...args: unknown[]) => void): void;\n\toff(event: string, listener: (...args: unknown[]) => void): void;\n};\n\n/**\n * Minimal structural view of the Reown AppKit instance, the subset kheopskit's\n * account factories use. Exposed as the `appKit` escape hatch on AppKit wallets;\n * cast it to `@reown/appkit`'s `AppKit` type for the full API. Declared locally\n * so core never depends on `@reown/appkit`'s types (it's an optional peer).\n */\nexport type AppKitInstance = {\n\tgetProvider<T = WalletConnectProvider>(namespace: string): T | undefined;\n\tgetAccount(\n\t\tnamespace: string,\n\t): { allAccounts: { address: string }[] } | undefined;\n\tgetCaipNetworks(namespace: string): { caipNetworkId?: string }[];\n};\n\nexport type WalletType = \"injected\" | \"walletconnect\";\n\n/**\n * Where a wallet stands with the dapp. `connecting` covers a `connect()` call\n * in flight and an auto-reconnect in flight alike.\n */\nexport type WalletStatus = \"disconnected\" | \"connecting\" | \"connected\";\n\nexport type PolkadotAccountType = \"sr25519\" | \"ed25519\" | \"ecdsa\" | \"ethereum\";\n\n/** Options accepted by {@link BaseWallet.connect}. */\nexport type ConnectOptions = {\n\t/**\n\t * Ends this caller's wait for the platform's answer: its promise rejects\n\t * with a `KheopskitError` of code `ABORTED`. An abort after the platform\n\t * has granted the connect changes nothing, and a Polkadot extension counts\n\t * as granted only once its account list has been read. Other callers\n\t * sharing the attempt keep waiting. The extension's own prompt may stay\n\t * open: nothing can withdraw it from the page. A Polkadot `connect()`\n\t * started while that prompt is open waits for it instead of asking again,\n\t * and connects with the handle it answers. Once no caller waits any more\n\t * and no later `connect()` joined that prompt, kheopskit drops a handle\n\t * the platform hands back afterwards without revoking the platform's\n\t * grant, and the wallet is neither connected nor remembered. Kheopskit\n\t * sets no timeout of its own, because an extension prompt\n\t * pends only while the user has not answered it; pass\n\t * `AbortSignal.timeout(ms)` to cap the wait.\n\t */\n\tsignal?: AbortSignal;\n};\n\n/**\n * SDK-free fields common to every wallet, regardless of platform. Platform\n * packages (`@kheopskit/core/<platform>`) extend this with SDK-typed fields\n * (the injected provider/extension/standard-wallet handle).\n */\nexport type BaseWallet = {\n\t/** `<platform>:<identifier>`, e.g. `polkadot:talisman`. Stable across reloads. */\n\tid: WalletId;\n\t/** The platform whose registry listed the wallet. */\n\tplatform: WalletPlatform;\n\t/**\n\t * `\"injected\"`, for a browser extension or Wallet Standard wallet. The\n\t * WalletConnect connector is the separate {@link WalletConnectWallet}.\n\t */\n\ttype: WalletType;\n\t/** Display name, e.g. `Talisman`. */\n\tname: string;\n\t/** Icon URL or data URI. `\"\"` when the wallet exposes none. */\n\ticon: string;\n\t/**\n\t * `true` for a wallet restored from the cache that kheopskit has not\n\t * discovered yet: its SDK handle and `sourceId` are absent and it is never\n\t * connected. On `kheopskit$` its `connect()` waits for the live wallet and\n\t * connects that one, rejecting with `WALLET_PENDING` if hydration ends first\n\t * and `ABORTED` if its `signal` fires or the subscription ends. On\n\t * `getHydratedSnapshot` it rejects with `WALLET_PENDING`. Its `disconnect()`\n\t * resolves at once, and on `kheopskit$` forgets the wallet first so it is\n\t * not reconnected when it injects, or calls the live wallet's\n\t * `disconnect()` once that one is discovered. Set on every wallet of\n\t * `kheopskit$` and of the hydrated snapshot; plugins leave it unset.\n\t */\n\tisPlaceholder?: boolean;\n\t/**\n\t * `connecting` while a `connect()` call or an auto-reconnect waits for the\n\t * platform, `connected` once the platform granted it, `disconnected`\n\t * otherwise. On a reload, a remembered wallet kheopskit will reconnect is\n\t * `connecting` from the first frame when the cache recorded it connected,\n\t * which the cache does 1 s after the state settles.\n\t */\n\tstatus: WalletStatus;\n\t/**\n\t * The last `connect()` or auto-reconnect that the platform refused or\n\t * failed (`USER_REJECTED` or `CONNECT_FAILED`, or `FEATURE_NOT_SUPPORTED`\n\t * for a Wallet Standard wallet without `standard:connect`). Cleared when\n\t * the next attempt starts. An aborted attempt sets nothing.\n\t */\n\terror?: KheopskitError;\n\t/** `status === \"connected\"`. */\n\tisConnected: boolean;\n\t/**\n\t * Connects the wallet.\n\t *\n\t * - **Shared in flight.** Concurrent calls on one wallet share a single\n\t * platform attempt and the platform is asked once. Each call gets its own\n\t * promise: aborting a caller's `signal` rejects only that caller with code\n\t * `ABORTED`. The attempt itself is abandoned only when every caller that\n\t * passed a signal has aborted and no caller without one joined, when\n\t * `disconnect()` is called, or when the last `kheopskit$` subscriber\n\t * unsubscribes; those reject every remaining caller with `ABORTED`.\n\t * - **Idempotent.** On a connected wallet it resolves at once without\n\t * touching the platform, unless a `disconnect()` still waits for the\n\t * platform. It then waits for that disconnect to settle and connects\n\t * again if the wallet ended up disconnected.\n\t * - **Abortable.** See {@link ConnectOptions.signal}. There is no default\n\t * timeout.\n\t * - **Settles with the state.** It resolves only after `kheopskit$` has\n\t * emitted a state in which this wallet has `isConnected: true`, so the\n\t * consumer-visible state already reflects the connect. On platforms that\n\t * list accounts asynchronously (Ethereum `eth_accounts`), the accounts may\n\t * arrive in a later emission. No emission shows a disconnected wallet\n\t * still listing live accounts, or a connected wallet listing the accounts\n\t * of a previous connection. During hydration a wallet's cached\n\t * placeholder accounts stay listed whatever its status. Another wallet's\n\t * pending `eth_accounts` request never delays them. A `disconnect()` that\n\t * completes while it waits for that state rejects it with `ABORTED`. If\n\t * the platform's disconnect is still pending or refuses, it resolves once\n\t * the state shows the wallet connected (today only Solana has a platform\n\t * disconnect). A `connect()`\n\t * whose wallet disappears before the platform grants it (an extension\n\t * removed, a Wallet Standard wallet unregistered) rejects `ABORTED`;\n\t * granted first, it resolves and the wallet stays remembered. Once the last `kheopskit$`\n\t * subscriber has unsubscribed, a call on a wallet object from that\n\t * subscription rejects with `ABORTED` without asking the platform,\n\t * placeholders included.\n\t * - **Typed rejections.** A platform rejection is wrapped in a\n\t * `KheopskitError` carrying the original error as `cause` and the\n\t * `walletId`: `USER_REJECTED` when the user refused the prompt,\n\t * `CONNECT_FAILED` otherwise. A Wallet Standard wallet without\n\t * `standard:connect` rejects with `FEATURE_NOT_SUPPORTED`.\n\t */\n\tconnect: (options?: ConnectOptions) => Promise<void>;\n\t/**\n\t * Disconnects the wallet.\n\t *\n\t * It forgets the wallet at once, whatever its status, so the next load does\n\t * not reconnect it. On a disconnected wallet it then resolves. While a `connect()` waits\n\t * for the platform to grant it, it aborts that connect (its promise rejects\n\t * with `ABORTED`) and never waits for the extension prompt. Otherwise it\n\t * first waits for the platform's disconnect and rejects if that fails, so\n\t * callers can surface or retry. It then resolves once `kheopskit$` has\n\t * emitted a state in which this wallet has `isConnected: false`, or once a\n\t * later `connect()`, the wallet leaving the list or the end of the\n\t * subscription makes that emission impossible. Once the last `kheopskit$`\n\t * subscriber has unsubscribed, a call on a wallet object from that\n\t * subscription rejects with `ABORTED` without asking the platform and\n\t * without changing the remembered list, except on a placeholder, whose\n\t * `disconnect()` resolves. A `disconnect()` started before that point\n\t * settles once the platform has answered: the wallet was\n\t * forgotten when it was called, and nothing else is written once the\n\t * subscription has ended.\n\t */\n\tdisconnect: () => Promise<void>;\n};\n\n/**\n * SDK-free fields common to every account, regardless of platform. Platform\n * packages extend this with their SDK-typed signer/client.\n */\nexport type BaseWalletAccount = {\n\t/** `<walletId>::<address>`, e.g. `polkadot:talisman::5Grw…`. */\n\tid: WalletAccountId;\n\t/**\n\t * `true` for an account restored from the cache that the live wallet has\n\t * not listed yet: its signing surface is absent. Set on every account of\n\t * `kheopskit$` and of the hydrated snapshot; plugins leave it unset.\n\t */\n\tisPlaceholder?: boolean;\n\t/** The platform of the wallet that lists the account. */\n\tplatform: WalletPlatform;\n\t/** Base58 (Solana), SS58 (Polkadot) or 0x-hex (Ethereum) address. */\n\taddress: string;\n\t/**\n\t * Friendly account name, when the wallet exposes one: the extension's\n\t * account name on Polkadot, the Wallet Standard `label` on Solana. Always\n\t * `undefined` on Ethereum.\n\t */\n\tname?: string;\n\t/** `name` of the wallet that lists the account. */\n\twalletName: string;\n\t/** `id` of the wallet that lists the account. */\n\twalletId: WalletId;\n};\n\ntype LiveWalletConnectWallet = {\n\t/** See {@link BaseWallet.isPlaceholder}. */\n\tisPlaceholder?: false;\n\t/** `\"walletconnect\"`, the one connector shared by every platform. */\n\tid: WalletId;\n\t/** Narrow with {@link isWalletConnectWallet}. */\n\ttype: \"walletconnect\";\n\t/**\n\t * Platforms (namespaces) the live session currently carries. Empty until\n\t * connected; populated with whatever the wallet approved (e.g. just\n\t * `[\"ethereum\"]`, or `[\"polkadot\", \"ethereum\"]`).\n\t */\n\tplatforms: WalletPlatform[];\n\t/**\n\t * Raw Reown AppKit instance, exposed as an escape hatch for advanced use\n\t * (custom modal control, reading providers directly). Most consumers should\n\t * use `connect`/`disconnect` and the derived accounts instead.\n\t */\n\tappKit: AppKitInstance;\n\t/** The name AppKit reports for the paired wallet, `\"WalletConnect\"` when it reports none. */\n\tname: string;\n\t/** The icon AppKit reports for the paired wallet, the WalletConnect logo when it reports none. */\n\ticon: string;\n\t/**\n\t * `connecting` while `connect()` opens the modal, `connected` while a\n\t * session is live, `disconnected` otherwise. On a reload with a cached\n\t * session it is `connecting` until AppKit restores the session or hydration\n\t * ends.\n\t */\n\tstatus: WalletStatus;\n\t/** The last `connect()` whose modal failed to open. Cleared by the next call. */\n\terror?: KheopskitError;\n\t/** `status === \"connected\"`. */\n\tisConnected: boolean;\n\t/**\n\t * Opens the WalletConnect modal and resolves once it is open; `isConnected`\n\t * follows when the user approves a session. Unlike injected wallets, this\n\t * promise does not wait for the state to show the connector connected, and\n\t * `signal` is accepted for signature compatibility only.\n\t */\n\tconnect: (options?: ConnectOptions) => Promise<void>;\n\t/** Ends the live session when there is one; resolves at once otherwise. */\n\tdisconnect: () => Promise<void>;\n};\n\n/**\n * The single WalletConnect connector, shared across every platform.\n *\n * Unlike injected wallets, it is **not tied to a platform**: one WalletConnect\n * session spans whichever namespaces the remote wallet approves in a single\n * pairing (a namespace can't be added to a live session afterwards). So there is\n * exactly one of these in `wallets`, discriminated by `type: \"walletconnect\"`.\n * Its accounts appear in `accounts`, each carrying its own `platform`.\n *\n * A placeholder (see {@link BaseWallet.isPlaceholder}) has no `appKit`.\n */\nexport type WalletConnectWallet =\n\t| LiveWalletConnectWallet\n\t| PlaceholderWallet<LiveWalletConnectWallet, \"appKit\">;\n\n/**\n * The cached stand-in for a live item `T`: `isPlaceholder: true`, and the\n * fields `K`, which only the live item carries, absent. Platform account and\n * wallet types are `T | Placeholder<T, K>`, so narrow on `isPlaceholder`\n * before reading a field of `K`.\n */\nexport type Placeholder<T, K extends keyof T> = Omit<T, K | \"isPlaceholder\"> & {\n\t/** Restored from the cache and not yet replaced by the live item. */\n\tisPlaceholder: true;\n} & { [P in K]?: undefined };\n\n/** A {@link Placeholder} wallet, which is never connected. */\nexport type PlaceholderWallet<\n\tT extends { isConnected: boolean },\n\tK extends keyof T,\n> = Omit<Placeholder<T, K>, \"isConnected\"> & { isConnected: false };\n\n/** Narrows a wallet to the platform-less {@link WalletConnectWallet}. */\nexport const isWalletConnectWallet = (\n\twallet: BaseWallet | WalletConnectWallet,\n): wallet is WalletConnectWallet => wallet.type === \"walletconnect\";\n\n/**\n * Narrows a wallet to an injected (browser-extension / Wallet Standard) wallet,\n * the complement of {@link isWalletConnectWallet}. `state.wallets` is\n * `(InjectedWallet | WalletConnectWallet)[]`, so use this to recover the\n * injected-only fields when iterating: `platform`, `sourceId`, and the SDK\n * handle (`provider` on Ethereum, `extension` on Polkadot, `wallet` on Solana).\n *\n * @example\n * ```ts\n * for (const wallet of wallets.filter(isInjectedWallet)) {\n * console.log(wallet.platform, wallet.sourceId); // typed, no WC widening\n * }\n * ```\n */\nexport const isInjectedWallet = <W extends BaseWallet | WalletConnectWallet>(\n\twallet: W,\n): wallet is Exclude<W, WalletConnectWallet> => wallet.type === \"injected\";\n\n/**\n * Dapp metadata shown in the WalletConnect modal. Mirrors WalletConnect's\n * `Metadata`, declared locally so core doesn't depend on\n * `@walletconnect/universal-provider`.\n */\nexport type WalletConnectMetadata = {\n\tname: string;\n\tdescription: string;\n\turl: string;\n\ticons: string[];\n};\n\n/**\n * The WalletConnect connector for `config.walletConnect`. Create it with\n * `walletConnect()` from `@kheopskit/core/walletconnect`; that entry is the only\n * one that loads Reown AppKit.\n */\nexport type WalletConnectPlugin = {\n\treadonly type: \"walletconnect\";\n\treadonly metadata: WalletConnectMetadata;\n\tgetWallet$(ctx: PlatformContext): Observable<WalletConnectWallet | null>;\n};\n\n/**\n * Context passed to a platform plugin's `getWallets$`. Carries the shared store\n * and the resolved core config (for WalletConnect / debug).\n */\nexport type PlatformContext = {\n\tstore: KheopskitStore;\n\tconfig: KheopskitConfig;\n\t/**\n\t * Moments to re-read a registry that has no announce event. Emits at\n\t * subscribe and on a tail restarted at window `load`, and completes after\n\t * the last read. {@link KheopskitState.isDiscovering} turns `false` on the\n\t * first wallet list after that, which waits for a WalletConnect connector\n\t * still loading.\n\t */\n\tregistryReads$?: Observable<void>;\n};\n\n/**\n * A platform plugin. Created by the per-platform factories exported from\n * `@kheopskit/core/polkadot`, `/ethereum`, `/solana`. Core iterates plugins\n * generically and never imports a platform SDK itself.\n *\n * @typeParam TPlatform - the platform discriminant\n * @typeParam TWallet - the platform's wallet type (extends {@link BaseWallet})\n * @typeParam TAccount - the platform's account type (extends {@link BaseWalletAccount})\n */\nexport type KheopskitPlatform<\n\tTPlatform extends WalletPlatform = WalletPlatform,\n\tTWallet extends BaseWallet = BaseWallet,\n\tTAccount extends BaseWalletAccount = BaseWalletAccount,\n> = {\n\treadonly platform: TPlatform;\n\t// Declared as methods (not arrow properties) so parameters are checked\n\t// bivariantly — this lets a specific `KheopskitPlatform<\"polkadot\", …>` be\n\t// assigned to the base `KheopskitPlatform` despite the contravariant\n\t// `wallets$` parameter.\n\tgetWallets$(ctx: PlatformContext): Observable<TWallet[]>;\n\t// Receives this platform's (injected) wallets plus the shared, platform-less\n\t// WalletConnect connector — the plugin derives its injected accounts and, if\n\t// the WC session carries its namespace, its WalletConnect accounts.\n\tgetAccounts$(\n\t\twallets$: Observable<(TWallet | WalletConnectWallet)[]>,\n\t): Observable<TAccount[]>;\n\t/**\n\t * Optional hydration filter. Cached accounts for which this returns false are\n\t * dropped during SSR hydration (Polkadot uses it to honour `accountTypes`).\n\t */\n\tacceptsCachedAccount?(cached: CachedAccount): boolean;\n};\n\ntype ElementOf<T> = T extends readonly (infer E)[] ? E : never;\n\n/** The account type produced by a plugin (inferred from its `getAccounts$`). */\nexport type AccountOf<T> = T extends {\n\tgetAccounts$: (wallets$: never) => Observable<infer R>;\n}\n\t? ElementOf<R>\n\t: never;\n\n/** The wallet type produced by a plugin (inferred from its `getWallets$`). */\nexport type WalletOf<T> = T extends {\n\tgetWallets$: (ctx: never) => Observable<infer R>;\n}\n\t? ElementOf<R>\n\t: never;\n\nexport type KheopskitConfig<\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n> = {\n\t/**\n\t * Which remembered injected wallets kheopskit reconnects after a reload.\n\t *\n\t * A wallet is remembered on every successful `connect()` and forgotten on\n\t * `disconnect()`, whatever this option says; the list is the store's\n\t * `remembered`. `true` reconnects every remembered injected wallet, `false`\n\t * none, and a function is asked for each cached connected injected wallet\n\t * on the first frame, then for each remembered one with its live object\n\t * before the attempt. The function must be synchronous and pure. It runs on\n\t * the server and on the client for the same input and both must agree, or\n\t * the markup diverges. It receives the {@link BaseWallet} fields only, so\n\t * key on `id`.\n\t *\n\t * The WalletConnect row is not governed by this option: AppKit restores its\n\t * own session on load, and the row hydrates `connecting` while it does.\n\t *\n\t * A reconnect opens no connect prompt while the site stays authorised in\n\t * the extension. When the authorisation was revoked the extension prompts\n\t * once; a refusal forgets the wallet, so the next load stays silent. A manual\n\t * `connect()` or `disconnect()` on a remembered wallet ends its automatic\n\t * reconnect for the session. A `disconnect()` forgets the wallet whatever\n\t * its status, so one made while the automatic reconnect still waits for the\n\t * extension aborts it, and the next load does not reconnect it.\n\t * Automatic reconnect also ends when the wallet disappears mid-attempt; the\n\t * wallet stays remembered for the next load.\n\t *\n\t * A cached connected wallet this accepts shows `status: \"connecting\"` from\n\t * the first frame until its attempt settles. A wallet this rejects shows\n\t * `disconnected` from the first frame, without its cached accounts, so\n\t * nothing flashes from connected to disconnected.\n\t *\n\t * @default true\n\t */\n\tautoReconnect: boolean | ((wallet: BaseWallet) => boolean);\n\t/**\n\t * Platform plugins to enable, e.g. `[polkadot(), solana({ chain })]`.\n\t * Import factories from `@kheopskit/core/<platform>`.\n\t */\n\tplatforms: P;\n\t/** Create with `walletConnect()` from `@kheopskit/core/walletconnect`. */\n\twalletConnect?: WalletConnectPlugin;\n\t/**\n\t * Dapp name sent to Polkadot injected extensions on connect. Some\n\t * extensions (e.g. polkadot.js) warn about a suspicious origin when it's\n\t * empty.\n\t *\n\t * @default walletConnect.metadata.name, then window.location.hostname\n\t */\n\tappName?: string;\n\t/**\n\t * Logs the resolved config, every state emission and the hydration and\n\t * persistence steps with `console.debug`.\n\t *\n\t * @default false\n\t */\n\tdebug: boolean;\n\t/**\n\t * Custom storage key for persisting wallet connection state.\n\t * Useful when running multiple kheopskit instances on the same domain\n\t * to prevent state conflicts between different dapps.\n\t *\n\t * @default \"kheopskit\"\n\t */\n\tstorageKey: string;\n\t/**\n\t * Minimum time in milliseconds the cached placeholders are shown after a\n\t * reload, so the wallet list does not flash while extensions inject and\n\t * remembered wallets reconnect. Hydration goes on past it until the rule\n\t * documented on {@link KheopskitConfig.hydrationTimeout} ends it, and that\n\t * timeout wins over a longer grace period. The old cap of six times this\n\t * value is gone, so an app that raises it sets `hydrationTimeout` as well.\n\t *\n\t * `0` disables placeholders: `isHydrating` is `false` from the first\n\t * emission.\n\t *\n\t * @default 500\n\t */\n\thydrationGracePeriod: number;\n\t/**\n\t * Upper bound in milliseconds on {@link KheopskitState.isHydrating}.\n\t *\n\t * `isHydrating` turns `false` once `hydrationGracePeriod` has elapsed and\n\t * every cached wallet has settled. A cached wallet missing from the\n\t * discovered wallets settles when discovery ends\n\t * ({@link KheopskitState.isDiscovering} is `false`). A discovered one\n\t * settles at once unless it hydrated as `connecting`. Then it settles when\n\t * connected once its account list has been read (an empty list counts) or\n\t * connected with no cached accounts, disconnected with `error` set, or\n\t * disconnected and not remembered (a wallet remembered after hydration\n\t * began does not count). At\n\t * `hydrationTimeout` hydration ends whatever is pending, and a wallet whose\n\t * reconnect is still pending stays `connecting`.\n\t *\n\t * - When every cached wallet is discovered and settled, hydration ends at\n\t * the grace period, without waiting for `load`. A cached wallet that has\n\t * not appeared holds hydration until discovery ends (1100 ms after `load`\n\t * or after subscribe, whichever is later, or later while a WalletConnect\n\t * connector loads), or until `hydrationTimeout`.\n\t * - A wallet that reconnects without sharing any account with the site\n\t * settles as soon as it answers; its cached accounts leave the list when\n\t * hydration ends.\n\t * - A failed reconnect ends that wallet's wait, even when the reconnect\n\t * policy still permits a retry. A retry runs only when the wallet list next\n\t * changes (a wallet discovered or removed, or any wallet's status, error\n\t * or name changing), which may never happen, so waiting for it would\n\t * hold most failed reconnects until `hydrationTimeout`. A retry that\n\t * does run shows on the live wallet's `status`, not as a placeholder.\n\t * - A prompt the extension opens for a revoked site holds hydration until\n\t * the user answers or `hydrationTimeout` elapses.\n\t *\n\t * @default 3000\n\t */\n\thydrationTimeout: number;\n};\n\n/**\n * The current kheopskit state.\n *\n * @remarks\n * While {@link KheopskitState.isHydrating} is `true`, `wallets` and `accounts`\n * may contain placeholders restored from the cache, flagged\n * `isPlaceholder: true`. Each platform type is a union on that flag: a\n * placeholder lacks the SDK handles (`account.txCreator` or `polkadotSigner`\n * on Polkadot, `account.client` on Ethereum, `account.signer` / `getSigner` on\n * Solana, `wallet.extension` / `provider` / `wallet` and `sourceId`). Reading\n * one without narrowing yields a possibly-`undefined` value, so the compiler\n * rejects using it as present until you narrow:\n *\n * ```ts\n * if (account.isPlaceholder) return;\n * account.txCreator; // TxCreator\n * ```\n *\n * A placeholder wallet's `connect()` waits for the live wallet and connects\n * it, rejecting with `WALLET_PENDING` if hydration ends first. No item is a\n * placeholder once `isHydrating` is `false`.\n *\n * The plain, serializable platform data that is persisted in the cache IS\n * restored on the placeholders (Ethereum `chainId`, Polkadot key `type`), so it\n * renders immediately on reload without flashing. Solana `chains` is not\n * cached: a placeholder account's is empty.\n */\nexport type KheopskitState<\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n> = {\n\t/**\n\t * Every discovered wallet, connected or not, then the WalletConnect\n\t * connector once AppKit has loaded, when `config.walletConnect` is set.\n\t * While `isHydrating` is `true`, also the cached placeholders. Sorted by\n\t * platform (Polkadot, Ethereum, Solana, WalletConnect), then Talisman\n\t * first, then by name.\n\t */\n\twallets: (WalletOf<P[number]> | WalletConnectWallet)[];\n\t/**\n\t * The accounts of every connected wallet. While `isHydrating` is `true`,\n\t * also the cached placeholders of every wallet that has no live account\n\t * yet. Grouped by platform, then by wallet (Talisman first, then by wallet\n\t * name); inside a wallet, in the order the wallet lists them.\n\t */\n\taccounts: AccountOf<P[number]>[];\n\t/** The resolved config, with every default filled in. */\n\tconfig: KheopskitConfig<P>;\n\t/**\n\t * Whether the state is still being hydrated from cache.\n\t *\n\t * During hydration, cached wallets/accounts may be displayed before the\n\t * actual wallet extensions have injected. See the type-level remarks: those\n\t * are flagged `isPlaceholder: true` and carry no SDK handle.\n\t */\n\tisHydrating: boolean;\n\t/**\n\t * Whether wallet discovery may still be incomplete.\n\t *\n\t * `true` until the Polkadot registry (`window.injectedWeb3`) read window\n\t * ends, 1100 ms after `load` or after subscribe, whichever is later. With\n\t * `config.walletConnect`, it also waits for the connector to load. The\n\t * emission that turns it `false` lists every Polkadot extension injected\n\t * before the last read. A wallet that injects later is not listed until\n\t * the next subscription. Always `true` on the server.\n\t *\n\t * Ethereum (EIP-6963) and Solana (Wallet Standard) registries are\n\t * event-driven and need no re-read.\n\t */\n\tisDiscovering: boolean;\n};\n\n/** Shape of the persisted store data (localStorage, or cookies in compact form). */\nexport type KheopskitStoreData = {\n\t/** Wallets the user connected and has not disconnected */\n\tremembered?: WalletId[];\n\t/** Cached wallet state for SSR hydration to prevent UI flash */\n\tcachedWallets?: CachedWallet[];\n\t/** Cached account state for SSR hydration to prevent UI flash */\n\tcachedAccounts?: CachedAccount[];\n};\n\n/**\n * The persisted settings store shared between core and framework bindings.\n * Declared structurally here (implemented by `createKheopskitStore`) so modules\n * can depend on the interface without importing the implementation.\n */\nexport type KheopskitStore = {\n\tobservable: Observable<KheopskitStoreData>;\n\trememberWallet: (walletId: WalletId) => void;\n\tforgetWallet: (walletId: WalletId) => void;\n\tgetCachedState: () => { wallets: CachedWallet[]; accounts: CachedAccount[] };\n\tsetCachedState: (wallets: CachedWallet[], accounts: CachedAccount[]) => void;\n\t/** Stops cross-tab storage sync and completes `observable`. */\n\tdestroy: () => void;\n};\n\n/**\n * Serializable wallet data for SSR hydration cache.\n * Contains only the data needed to render wallet UI without flash.\n * Note: icon is NOT stored to save cookie space - it's looked up at hydration time.\n */\nexport type CachedWallet = {\n\tid: WalletId;\n\t/** Absent for the platform-less WalletConnect connector. */\n\tplatform?: WalletPlatform;\n\ttype: WalletType;\n\tname: string;\n\tisConnected: boolean;\n};\n\n/**\n * Serializable account data for SSR hydration cache.\n * Contains only the data needed to render account UI without flash.\n */\nexport type CachedAccount = {\n\tid: string;\n\tplatform: WalletPlatform;\n\taddress: string;\n\tname?: string;\n\t/** Cached chain ID for Ethereum accounts. */\n\tchainId?: number;\n\t/** Cached key type for Polkadot accounts. */\n\tpolkadotAccountType?: PolkadotAccountType;\n\twalletId: WalletId;\n\twalletName: string;\n};\n"],"mappings":";AAIA,MAAM,eAAe,OAAO,IAAI,2BAA2B;AAE3D,MAAM,iBAAmD;CACxD,MAAM,IAAI;CAIV,IAAI,QAAQ,EAAE;CACd,IAAI,CAAC,OAAO;EACX,wBAAQ,IAAI,IAAI;EAChB,EAAE,gBAAgB;CACnB;CACA,OAAO;AACR;AAEA,MAAa,wBACZ,KACA,WACS;CACT,MAAM,QAAQ,SAAS;CACvB,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,KAAK,OAAO,CAAwB;CAEnE,OAAO,MAAM,IAAI,GAAG;AACrB;;;;;AAMA,MAAa,yBAAyB,QAAsB;CAC3D,SAAS,CAAC,CAAC,OAAO,GAAG;AACtB;;;;;;;;AASA,MAAa,kCAAkC,WAAyB;CACvE,MAAM,QAAQ,SAAS;CACvB,KAAK,MAAM,OAAO,MAAM,KAAK,GAC5B,IAAI,IAAI,WAAW,MAAM,GAAG,MAAM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