@kheopskit/react 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.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { KheopskitError, createKheopskitStore, getHydratedSnapshot, getKheopskit$, resolveConfig } from "@kheopskit/core";
3
- import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useSyncExternalStore } from "react";
4
- import { Observable, defer, shareReplay } from "rxjs";
2
+ import { KheopskitError, createKheopskit as createKheopskit$1, createKheopskitStore, getHydratedSnapshot, resolveConfig } from "@kheopskit/core";
3
+ import { kheopskitInternals } from "@kheopskit/core/internal";
4
+ import { createContext, useContext, useEffect, useLayoutEffect, useMemo, useRef, useSyncExternalStore } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/context.ts
7
7
  const KheopskitContext = createContext(null);
@@ -12,17 +12,15 @@ const useKheopskitExternalStore = (hookName) => {
12
12
  };
13
13
  //#endregion
14
14
  //#region src/createExternalStore.ts
15
- const afterThisCommitsLayoutEffects$1 = () => Promise.resolve();
16
- const createExternalStore = (resolveClientSource, serverValue) => {
17
- let source;
15
+ const createExternalStore = (source$, getInitialValue, serverValue) => {
16
+ let initialValue;
18
17
  let latestValue;
19
18
  let subscription;
20
19
  const listeners = /* @__PURE__ */ new Set();
21
- const getSource = () => {
22
- source ?? (source = resolveClientSource());
23
- return source;
20
+ const getSnapshot = () => {
21
+ initialValue ?? (initialValue = getInitialValue());
22
+ return latestValue ?? initialValue;
24
23
  };
25
- const getSnapshot = () => latestValue ?? getSource().initialValue;
26
24
  const getServerSnapshot = () => serverValue;
27
25
  const releaseWhenUnobserved = () => {
28
26
  if (listeners.size) return;
@@ -30,7 +28,7 @@ const createExternalStore = (resolveClientSource, serverValue) => {
30
28
  subscription = void 0;
31
29
  };
32
30
  const subscribe = (listener) => {
33
- if (!subscription || subscription.closed) subscription = getSource().pipeline.observable$.subscribe((value) => {
31
+ if (!subscription || subscription.closed) subscription = source$.subscribe((value) => {
34
32
  latestValue = value;
35
33
  for (const notify of listeners) notify(value);
36
34
  });
@@ -41,65 +39,10 @@ const createExternalStore = (resolveClientSource, serverValue) => {
41
39
  queueMicrotask(releaseWhenUnobserved);
42
40
  };
43
41
  };
44
- /** The shared pipeline's liveness once this commit's layout effects ran. */
45
- const whenLive = async (signal) => {
46
- await afterThisCommitsLayoutEffects$1();
47
- return getSource().pipeline.whenLive(signal);
48
- };
49
42
  return {
50
43
  getSnapshot,
51
44
  getServerSnapshot,
52
- subscribe,
53
- whenLive
54
- };
55
- };
56
- //#endregion
57
- //#region src/liveActions.ts
58
- const didNotRun = {
59
- aborted: "was aborted",
60
- unheld: "was called while nothing holds the pipeline (no KheopskitProvider of this instance is mounted and visible, and nothing subscribes its kheopskit$)",
61
- errored: "did not run because the pipeline stopped with an error",
62
- completed: "did not run because the pipeline completed"
63
- };
64
- const abortedError = (walletId, operation, end) => new KheopskitError("ABORTED", `${operation} of wallet ${walletId} ${didNotRun[end]}`, { walletId });
65
- /**
66
- * `connect` and `disconnect` for one wallet id that act on the instance's
67
- * pipeline at call time: they wait for the restarted pipeline's first emission
68
- * after an `<Activity>` reveal and reject `ABORTED` while nothing holds it.
69
- */
70
- const walletActions = (store, walletId) => {
71
- const liveWallet = async (operation, signal) => {
72
- const liveness = await store.whenLive(signal);
73
- if (liveness.end) throw abortedError(walletId, operation, liveness.end);
74
- const wallet = liveness.state.wallets.find((candidate) => candidate.id === walletId);
75
- if (!wallet) throw new Error(`[kheopskit] no wallet ${walletId}`);
76
- return wallet;
77
- };
78
- return {
79
- connect: async (options) => (await liveWallet("connect", options?.signal)).connect(options),
80
- disconnect: async () => (await liveWallet("disconnect")).disconnect()
81
- };
82
- };
83
- const withLiveActions = (store) => {
84
- const presented = /* @__PURE__ */ new WeakMap();
85
- const present = (state) => {
86
- let live = presented.get(state);
87
- if (!live) {
88
- live = {
89
- ...state,
90
- wallets: state.wallets.map((wallet) => ({
91
- ...wallet,
92
- ...walletActions(store, wallet.id)
93
- }))
94
- };
95
- presented.set(state, live);
96
- }
97
- return live;
98
- };
99
- return {
100
- ...store,
101
- getSnapshot: () => present(store.getSnapshot()),
102
- getServerSnapshot: () => present(store.getServerSnapshot())
45
+ subscribe
103
46
  };
104
47
  };
105
48
  //#endregion
@@ -119,18 +62,18 @@ const serverSnapshot = (config, ssrCookies) => hydrating(config, ssrCookies ===
119
62
  ssrCookies,
120
63
  storageKey: config.storageKey
121
64
  }), config, { icons: false }));
122
- const KheopskitSourceProvider = ({ children, config, ssrCookies, resolveClientSource }) => {
65
+ const KheopskitSourceProvider = ({ children, kit, config, ssrCookies }) => {
123
66
  const resolvedConfig = useMemo(() => resolveConfig(config), [config]);
124
- const externalStore = useMemo(() => withLiveActions(createExternalStore(() => {
125
- const { store, pipeline } = resolveClientSource(resolvedConfig);
67
+ const externalStore = useMemo(() => {
68
+ const { present, walletActions } = kheopskitInternals(kit);
126
69
  return {
127
- pipeline,
128
- initialValue: hydrating(resolvedConfig, getHydratedSnapshot(store, resolvedConfig, { icons: true }))
70
+ ...createExternalStore(kit.kheopskit$, () => present(hydrating(resolvedConfig, getHydratedSnapshot(kit.store, resolvedConfig, { icons: true }))), present(serverSnapshot(resolvedConfig, ssrCookies))),
71
+ walletActions
129
72
  };
130
- }, serverSnapshot(resolvedConfig, ssrCookies))), [
73
+ }, [
74
+ kit,
131
75
  resolvedConfig,
132
- ssrCookies,
133
- resolveClientSource
76
+ ssrCookies
134
77
  ]);
135
78
  useIsomorphicLayoutEffect$1(() => externalStore.subscribe(keepPipelineRunning), [externalStore]);
136
79
  return /* @__PURE__ */ jsx(KheopskitContext.Provider, {
@@ -139,66 +82,6 @@ const KheopskitSourceProvider = ({ children, config, ssrCookies, resolveClientSo
139
82
  });
140
83
  };
141
84
  //#endregion
142
- //#region src/livePipeline.ts
143
- const createLivePipeline = (source$) => {
144
- let holders = 0;
145
- let run = 0;
146
- let emittedRun = 0;
147
- let latestValue;
148
- let ended;
149
- const firstEmissionWaiters = /* @__PURE__ */ new Set();
150
- const settleFirstEmission = (liveness) => {
151
- for (const waiter of firstEmissionWaiters) waiter(liveness);
152
- };
153
- const observable$ = new Observable((subscriber) => {
154
- if (holders++ === 0) {
155
- run++;
156
- ended = void 0;
157
- }
158
- const thisRun = run;
159
- const subscription = source$.subscribe({
160
- next: (value) => {
161
- latestValue = value;
162
- emittedRun = thisRun;
163
- settleFirstEmission({ state: value });
164
- subscriber.next(value);
165
- },
166
- error: (error) => {
167
- ended = "errored";
168
- subscriber.error(error);
169
- },
170
- complete: () => {
171
- ended = "completed";
172
- subscriber.complete();
173
- }
174
- });
175
- return () => {
176
- subscription.unsubscribe();
177
- if (--holders === 0) settleFirstEmission({ end: ended ?? "unheld" });
178
- };
179
- });
180
- const whenLive = async (signal) => {
181
- if (signal?.aborted) return { end: "aborted" };
182
- if (ended) return { end: ended };
183
- if (holders === 0) return { end: "unheld" };
184
- if (emittedRun === run) return { state: latestValue };
185
- return new Promise((resolve) => {
186
- const settle = (liveness) => {
187
- firstEmissionWaiters.delete(settle);
188
- signal?.removeEventListener("abort", onAbort);
189
- resolve(liveness);
190
- };
191
- const onAbort = () => settle({ end: "aborted" });
192
- signal?.addEventListener("abort", onAbort, { once: true });
193
- firstEmissionWaiters.add(settle);
194
- });
195
- };
196
- return {
197
- observable$,
198
- whenLive
199
- };
200
- };
201
- //#endregion
202
85
  //#region src/useStateItem.ts
203
86
  const isSameItemIgnoringClosures = (a, b) => {
204
87
  const previous = a;
@@ -272,24 +155,19 @@ const useWallets = () => {
272
155
  };
273
156
  //#endregion
274
157
  //#region src/createKheopskit.tsx
275
- const deferredStore = (claim) => ({
276
- observable: defer(() => claim().observable),
277
- rememberWallet: (walletId) => claim().rememberWallet(walletId),
278
- forgetWallet: (walletId) => claim().forgetWallet(walletId),
279
- getCachedState: () => claim().getCachedState(),
280
- setCachedState: (wallets, accounts) => claim().setCachedState(wallets, accounts),
281
- destroy: () => claim().destroy()
282
- });
283
158
  /**
284
159
  * Binds a platform tuple once and returns one kheopskit instance: a
285
160
  * `KheopskitProvider`, hooks already typed to those platforms, and the
286
- * `kheopskit$` stream and `store` the provider uses, for code outside React.
287
- * Subscribing `kheopskit$` while the provider is mounted runs no second
288
- * pipeline, and holds the one pipeline for every hook action of the instance.
161
+ * `kheopskit$` stream and `store` the provider uses, and `waitForAccount`, for
162
+ * code outside React.
163
+ * It is `@kheopskit/core`'s `createKheopskit` instance: subscribing
164
+ * `kheopskit$` while the provider is mounted runs no second pipeline, and
165
+ * holds the one pipeline for every hook action of the instance.
289
166
  *
290
- * Without `options.store`, the store is created on first use in the browser:
291
- * backed by cookies when the provider renders first with `ssrCookies`, by
292
- * localStorage otherwise. The caller owns `store.destroy()`.
167
+ * Without `options.store`, the store is created on first use, backed by
168
+ * cookies with `{ ssr: true }` and by localStorage otherwise. Only an
169
+ * instance created with `{ ssr: true }` accepts the provider's `ssrCookies`.
170
+ * The caller owns `store.destroy()`.
293
171
  *
294
172
  * @example
295
173
  * ```tsx
@@ -301,41 +179,23 @@ const deferredStore = (claim) => ({
301
179
  * const { accounts } = useWallets(); // accounts are platform-precise, no generic
302
180
  * ```
303
181
  */
304
- const createKheopskit = (config, options = {}) => {
305
- let claimed;
306
- const claimStore = (ssrCookies) => {
307
- claimed ?? (claimed = options.store ?? createKheopskitStore({
308
- ssrCookies,
309
- storageKey: resolveConfig(config).storageKey
310
- }));
311
- return claimed;
312
- };
313
- const shared$ = defer(() => getKheopskit$(config, { store: claimStore() })).pipe(shareReplay({
314
- refCount: true,
315
- bufferSize: 1
316
- }));
317
- const pipeline = createLivePipeline(shared$);
318
- const kheopskit$ = pipeline.observable$;
319
- const Provider = ({ children, ssrCookies }) => {
320
- if (typeof window !== "undefined") claimStore(ssrCookies);
321
- const resolveClientSource = useCallback(() => ({
322
- store: claimStore(ssrCookies),
323
- pipeline
324
- }), [ssrCookies]);
325
- return /* @__PURE__ */ jsx(KheopskitSourceProvider, {
326
- config,
327
- ssrCookies,
328
- resolveClientSource,
329
- children
330
- });
331
- };
182
+ const createKheopskit = (config, options) => {
183
+ const kit = createKheopskit$1(config, options);
184
+ const Provider = ({ children, ssrCookies }) => /* @__PURE__ */ jsx(KheopskitSourceProvider, {
185
+ kit,
186
+ config,
187
+ ssrCookies,
188
+ children
189
+ });
332
190
  Provider.displayName = "KheopskitProvider";
333
191
  return {
334
192
  KheopskitProvider: Provider,
335
193
  /** The state stream the provider subscribes to, shared with code outside React. */
336
- kheopskit$,
194
+ kheopskit$: kit.kheopskit$,
337
195
  /** The store `kheopskit$` reads the cache from and persists into. */
338
- store: options.store ?? deferredStore(claimStore),
196
+ store: kit.store,
197
+ /** Resolves with the live account once the running instance lists it. */
198
+ waitForAccount: kit.waitForAccount,
339
199
  /** Current state, typed to the bound platform tuple. */
340
200
  useWallets: () => useWallets(),
341
201
  /** Current accounts, typed to the bound platform tuple. */
@@ -356,23 +216,19 @@ const KheopskitProvider = ({ children, config, ssrCookies, store }) => {
356
216
  hasMountedRef.current = true;
357
217
  lastConfigRef.current = config;
358
218
  }, [config]);
359
- const resolveClientSource = useCallback((resolvedConfig) => {
360
- const sourceStore = store ?? createKheopskitStore({
361
- ssrCookies,
362
- storageKey: resolvedConfig.storageKey
363
- });
364
- return {
365
- store: sourceStore,
366
- pipeline: createLivePipeline(getKheopskit$(resolvedConfig, {
367
- ssrCookies,
368
- store: sourceStore
369
- }))
370
- };
371
- }, [ssrCookies, store]);
219
+ const ssr = ssrCookies !== void 0;
220
+ const kit = useMemo(() => createKheopskit$1({
221
+ ...config,
222
+ platforms: config?.platforms ?? []
223
+ }, store ? { store } : { ssr }), [
224
+ config,
225
+ store,
226
+ ssr
227
+ ]);
372
228
  return /* @__PURE__ */ jsx(KheopskitSourceProvider, {
229
+ kit,
373
230
  config,
374
231
  ssrCookies,
375
- resolveClientSource,
376
232
  children
377
233
  });
378
234
  };
@@ -391,7 +247,7 @@ const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : us
391
247
  const afterThisCommitsLayoutEffects = () => Promise.resolve();
392
248
  const createWalletActions = (store, walletId) => {
393
249
  let scope = new AbortController();
394
- const wallet = walletActions(store, walletId);
250
+ const wallet = store.walletActions(walletId);
395
251
  return {
396
252
  connect: async () => {
397
253
  if (scope.signal.aborted) await afterThisCommitsLayoutEffects();
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["afterThisCommitsLayoutEffects","useIsomorphicLayoutEffect"],"sources":["../src/context.ts","../src/createExternalStore.ts","../src/liveActions.ts","../src/KheopskitSourceProvider.tsx","../src/livePipeline.ts","../src/useStateItem.ts","../src/useAccount.ts","../src/useWallet.ts","../src/useWallets.ts","../src/createKheopskit.tsx","../src/KheopskitProvider.tsx","../src/useAccounts.ts","../src/useConnect.ts"],"sourcesContent":["import type { KheopskitState } from \"@kheopskit/core\";\nimport { createContext, useContext } from \"react\";\nimport type { Liveness } from \"./livePipeline\";\n\nexport type KheopskitExternalStore = {\n\tsubscribe: (onChange: () => void) => () => void;\n\tgetSnapshot: () => KheopskitState;\n\tgetServerSnapshot: () => KheopskitState;\n\twhenLive: (signal?: AbortSignal) => Promise<Liveness<KheopskitState>>;\n};\n\nexport const KheopskitContext = createContext<KheopskitExternalStore | null>(\n\tnull,\n);\n\nexport const useKheopskitExternalStore = (hookName: string) => {\n\tconst store = useContext(KheopskitContext);\n\tif (!store)\n\t\tthrow new Error(`${hookName} can't be used without a KheopskitProvider`);\n\treturn store;\n};\n","import type { Subscription } from \"rxjs\";\nimport type { Liveness, LivePipeline } from \"./livePipeline\";\n\nexport type ExternalStoreSource<T> = {\n\tpipeline: LivePipeline<T>;\n\tinitialValue: T;\n};\n\n// React runs every layout setup of a commit synchronously, so once this\n// microtask runs a mounted provider has taken its hold on the pipeline, and a\n// release queued by a hide in this task has landed.\nconst afterThisCommitsLayoutEffects = () => Promise.resolve();\n\nexport const createExternalStore = <T>(\n\tresolveClientSource: () => ExternalStoreSource<T>,\n\tserverValue: T,\n) => {\n\tlet source: ExternalStoreSource<T> | undefined;\n\tlet latestValue: T | undefined;\n\tlet subscription: Subscription | undefined;\n\tconst listeners = new Set<(value: T) => void>();\n\n\tconst getSource = () => {\n\t\tsource ??= resolveClientSource();\n\t\treturn source;\n\t};\n\n\tconst getSnapshot = () => latestValue ?? getSource().initialValue;\n\n\tconst getServerSnapshot = () => serverValue;\n\n\tconst releaseWhenUnobserved = () => {\n\t\tif (listeners.size) return;\n\t\tsubscription?.unsubscribe();\n\t\tsubscription = undefined;\n\t};\n\n\tconst subscribe = (listener: (value: T) => void) => {\n\t\tif (!subscription || subscription.closed) {\n\t\t\tsubscription = getSource().pipeline.observable$.subscribe((value) => {\n\t\t\t\tlatestValue = value;\n\t\t\t\tfor (const notify of listeners) notify(value);\n\t\t\t});\n\t\t}\n\t\tlisteners.add(listener);\n\t\tlistener(getSnapshot());\n\n\t\treturn () => {\n\t\t\tlisteners.delete(listener);\n\t\t\t// StrictMode and a changed `subscribe` unsubscribe and resubscribe in\n\t\t\t// the same task; releasing at once would restart the pipeline between.\n\t\t\tqueueMicrotask(releaseWhenUnobserved);\n\t\t};\n\t};\n\n\t/** The shared pipeline's liveness once this commit's layout effects ran. */\n\tconst whenLive = async (signal?: AbortSignal): Promise<Liveness<T>> => {\n\t\tawait afterThisCommitsLayoutEffects();\n\t\treturn getSource().pipeline.whenLive(signal);\n\t};\n\n\treturn { getSnapshot, getServerSnapshot, subscribe, whenLive };\n};\n","import {\n\ttype ConnectOptions,\n\tKheopskitError,\n\ttype KheopskitState,\n\ttype WalletId,\n} from \"@kheopskit/core\";\nimport type { KheopskitExternalStore } from \"./context\";\nimport type { PipelineEnd } from \"./livePipeline\";\n\ntype Wallet = KheopskitState[\"wallets\"][number];\n\nconst didNotRun: Record<PipelineEnd, string> = {\n\taborted: \"was aborted\",\n\tunheld:\n\t\t\"was called while nothing holds the pipeline (no KheopskitProvider of this instance is mounted and visible, and nothing subscribes its kheopskit$)\",\n\terrored: \"did not run because the pipeline stopped with an error\",\n\tcompleted: \"did not run because the pipeline completed\",\n};\n\nconst abortedError = (\n\twalletId: WalletId,\n\toperation: \"connect\" | \"disconnect\",\n\tend: PipelineEnd,\n) =>\n\tnew KheopskitError(\n\t\t\"ABORTED\",\n\t\t`${operation} of wallet ${walletId} ${didNotRun[end]}`,\n\t\t{ walletId },\n\t);\n\n/**\n * `connect` and `disconnect` for one wallet id that act on the instance's\n * pipeline at call time: they wait for the restarted pipeline's first emission\n * after an `<Activity>` reveal and reject `ABORTED` while nothing holds it.\n */\nexport const walletActions = (\n\tstore: Pick<KheopskitExternalStore, \"whenLive\">,\n\twalletId: WalletId,\n) => {\n\tconst liveWallet = async (\n\t\toperation: \"connect\" | \"disconnect\",\n\t\tsignal?: AbortSignal,\n\t) => {\n\t\tconst liveness = await store.whenLive(signal);\n\t\tif (liveness.end) throw abortedError(walletId, operation, liveness.end);\n\t\tconst wallet = liveness.state.wallets.find(\n\t\t\t(candidate) => candidate.id === walletId,\n\t\t);\n\t\tif (!wallet) throw new Error(`[kheopskit] no wallet ${walletId}`);\n\t\treturn wallet;\n\t};\n\treturn {\n\t\tconnect: async (options?: ConnectOptions) =>\n\t\t\t(await liveWallet(\"connect\", options?.signal)).connect(options),\n\t\tdisconnect: async () => (await liveWallet(\"disconnect\")).disconnect(),\n\t};\n};\n\nexport const withLiveActions = (\n\tstore: KheopskitExternalStore,\n): KheopskitExternalStore => {\n\tconst presented = new WeakMap<KheopskitState, KheopskitState>();\n\tconst present = (state: KheopskitState) => {\n\t\tlet live = presented.get(state);\n\t\tif (!live) {\n\t\t\tlive = {\n\t\t\t\t...state,\n\t\t\t\twallets: state.wallets.map(\n\t\t\t\t\t(wallet): Wallet => ({\n\t\t\t\t\t\t...wallet,\n\t\t\t\t\t\t...walletActions(store, wallet.id),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t};\n\t\t\tpresented.set(state, live);\n\t\t}\n\t\treturn live;\n\t};\n\treturn {\n\t\t...store,\n\t\tgetSnapshot: () => present(store.getSnapshot()),\n\t\tgetServerSnapshot: () => present(store.getServerSnapshot()),\n\t};\n};\n","import {\n\tcreateKheopskitStore,\n\tgetHydratedSnapshot,\n\ttype HydratedSnapshot,\n\ttype KheopskitConfig,\n\ttype KheopskitState,\n\ttype KheopskitStore,\n\tresolveConfig,\n} from \"@kheopskit/core\";\nimport {\n\ttype FC,\n\ttype PropsWithChildren,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseMemo,\n} from \"react\";\nimport { KheopskitContext } from \"./context\";\nimport { createExternalStore } from \"./createExternalStore\";\nimport { withLiveActions } from \"./liveActions\";\nimport type { LivePipeline } from \"./livePipeline\";\n\ntype KheopskitSource = {\n\tstore: KheopskitStore;\n\tpipeline: LivePipeline<KheopskitState>;\n};\n\ntype KheopskitSourceProviderProps = PropsWithChildren<{\n\tconfig: Partial<KheopskitConfig> | undefined;\n\tssrCookies: string | undefined;\n\tresolveClientSource: (config: KheopskitConfig) => KheopskitSource;\n}>;\n\nconst keepPipelineRunning = () => {};\n\n// A layout effect, so that a child's layout effect calling an action on reveal\n// finds the pipeline held again one microtask later (see createExternalStore).\nconst useIsomorphicLayoutEffect =\n\ttypeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\nconst hydrating = (\n\tconfig: KheopskitConfig,\n\tsnapshot: HydratedSnapshot,\n): KheopskitState => ({\n\t...snapshot,\n\tconfig,\n\tisHydrating: true,\n\tisDiscovering: true,\n});\n\nconst serverSnapshot = (\n\tconfig: KheopskitConfig,\n\tssrCookies: string | undefined,\n): KheopskitState =>\n\thydrating(\n\t\tconfig,\n\t\tssrCookies === undefined\n\t\t\t? { wallets: [], accounts: [] }\n\t\t\t: getHydratedSnapshot(\n\t\t\t\t\tcreateKheopskitStore({ ssrCookies, storageKey: config.storageKey }),\n\t\t\t\t\tconfig,\n\t\t\t\t\t{ icons: false },\n\t\t\t\t),\n\t);\n\nexport const KheopskitSourceProvider: FC<KheopskitSourceProviderProps> = ({\n\tchildren,\n\tconfig,\n\tssrCookies,\n\tresolveClientSource,\n}) => {\n\tconst resolvedConfig = useMemo(() => resolveConfig(config), [config]);\n\n\tconst externalStore = useMemo(\n\t\t() =>\n\t\t\twithLiveActions(\n\t\t\t\tcreateExternalStore(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tconst { store, pipeline } = resolveClientSource(resolvedConfig);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tpipeline,\n\t\t\t\t\t\t\tinitialValue: hydrating(\n\t\t\t\t\t\t\t\tresolvedConfig,\n\t\t\t\t\t\t\t\tgetHydratedSnapshot(store, resolvedConfig, { icons: true }),\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\tserverSnapshot(resolvedConfig, ssrCookies),\n\t\t\t\t),\n\t\t\t),\n\t\t[resolvedConfig, ssrCookies, resolveClientSource],\n\t);\n\n\tuseIsomorphicLayoutEffect(\n\t\t() => externalStore.subscribe(keepPipelineRunning),\n\t\t[externalStore],\n\t);\n\n\treturn (\n\t\t<KheopskitContext.Provider value={externalStore}>\n\t\t\t{children}\n\t\t</KheopskitContext.Provider>\n\t);\n};\n","import { Observable } from \"rxjs\";\n\nexport type PipelineEnd = \"aborted\" | \"unheld\" | \"errored\" | \"completed\";\n\n/** The running pipeline's state, or why it cannot serve an action. */\nexport type Liveness<T> = { state: T; end?: undefined } | { end: PipelineEnd };\n\nexport type LivePipeline<T> = {\n\t/** Subscribing holds the pipeline; it runs while at least one holder stays. */\n\tobservable$: Observable<T>;\n\t/**\n\t * The current run's state: its latest value, or its first emission once it\n\t * arrives. Ends `unheld` while nothing holds the pipeline, without starting\n\t * it, `errored` or `completed` once the run ended that way, and `aborted`\n\t * when `signal` fires first.\n\t */\n\twhenLive: (signal?: AbortSignal) => Promise<Liveness<T>>;\n};\n\nexport const createLivePipeline = <T>(\n\tsource$: Observable<T>,\n): LivePipeline<T> => {\n\tlet holders = 0;\n\tlet run = 0;\n\tlet emittedRun = 0;\n\tlet latestValue: T | undefined;\n\tlet ended: PipelineEnd | undefined;\n\tconst firstEmissionWaiters = new Set<(liveness: Liveness<T>) => void>();\n\n\tconst settleFirstEmission = (liveness: Liveness<T>) => {\n\t\tfor (const waiter of firstEmissionWaiters) waiter(liveness);\n\t};\n\n\tconst observable$ = new Observable<T>((subscriber) => {\n\t\tif (holders++ === 0) {\n\t\t\trun++;\n\t\t\tended = undefined;\n\t\t}\n\t\tconst thisRun = run;\n\t\tconst subscription = source$.subscribe({\n\t\t\tnext: (value) => {\n\t\t\t\tlatestValue = value;\n\t\t\t\temittedRun = thisRun;\n\t\t\t\tsettleFirstEmission({ state: value });\n\t\t\t\tsubscriber.next(value);\n\t\t\t},\n\t\t\terror: (error) => {\n\t\t\t\tended = \"errored\";\n\t\t\t\tsubscriber.error(error);\n\t\t\t},\n\t\t\tcomplete: () => {\n\t\t\t\tended = \"completed\";\n\t\t\t\tsubscriber.complete();\n\t\t\t},\n\t\t});\n\t\treturn () => {\n\t\t\tsubscription.unsubscribe();\n\t\t\tif (--holders === 0) settleFirstEmission({ end: ended ?? \"unheld\" });\n\t\t};\n\t});\n\n\tconst whenLive = async (signal?: AbortSignal): Promise<Liveness<T>> => {\n\t\tif (signal?.aborted) return { end: \"aborted\" };\n\t\tif (ended) return { end: ended };\n\t\tif (holders === 0) return { end: \"unheld\" };\n\t\tif (emittedRun === run) return { state: latestValue as T };\n\t\treturn new Promise((resolve) => {\n\t\t\tconst settle = (liveness: Liveness<T>) => {\n\t\t\t\tfirstEmissionWaiters.delete(settle);\n\t\t\t\tsignal?.removeEventListener(\"abort\", onAbort);\n\t\t\t\tresolve(liveness);\n\t\t\t};\n\t\t\tconst onAbort = () => settle({ end: \"aborted\" });\n\t\t\tsignal?.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\tfirstEmissionWaiters.add(settle);\n\t\t});\n\t};\n\n\treturn { observable$, whenLive };\n};\n","import type { KheopskitState } from \"@kheopskit/core\";\nimport { useMemo, useSyncExternalStore } from \"react\";\nimport { useKheopskitExternalStore } from \"./context\";\n\nconst isSameItemIgnoringClosures = (a: object, b: object) => {\n\tconst previous = a as Record<string, unknown>;\n\tconst next = b as Record<string, unknown>;\n\tconst keys = Object.keys(previous);\n\treturn (\n\t\tkeys.length === Object.keys(next).length &&\n\t\tkeys.every(\n\t\t\t(key) =>\n\t\t\t\tObject.hasOwn(next, key) &&\n\t\t\t\t(Object.is(previous[key], next[key]) ||\n\t\t\t\t\t(typeof previous[key] === \"function\" &&\n\t\t\t\t\t\ttypeof next[key] === \"function\")),\n\t\t)\n\t);\n};\n\nexport const useStateItem = <K, T extends object>(\n\thookName: string,\n\tkey: K,\n\tselect: (state: KheopskitState, key: K) => T | undefined,\n): T | undefined => {\n\tconst store = useKheopskitExternalStore(hookName);\n\tconst snapshots = useMemo(() => {\n\t\tlet cached: T | undefined;\n\t\treturn {\n\t\t\tgetSnapshot: () => {\n\t\t\t\tconst item = select(store.getSnapshot(), key);\n\t\t\t\tconst reusable =\n\t\t\t\t\tcached !== undefined &&\n\t\t\t\t\titem !== undefined &&\n\t\t\t\t\tisSameItemIgnoringClosures(cached, item);\n\t\t\t\tif (!reusable) cached = item;\n\t\t\t\treturn cached;\n\t\t\t},\n\t\t\tgetServerSnapshot: () => select(store.getServerSnapshot(), key),\n\t\t};\n\t}, [store, key, select]);\n\treturn useSyncExternalStore(\n\t\tstore.subscribe,\n\t\tsnapshots.getSnapshot,\n\t\tsnapshots.getServerSnapshot,\n\t);\n};\n","import type {\n\tKheopskitPlatform,\n\tKheopskitState,\n\tWalletAccountId,\n} from \"@kheopskit/core\";\nimport { useStateItem } from \"./useStateItem\";\n\nconst selectAccount = (state: KheopskitState, accountId: WalletAccountId) =>\n\tstate.accounts.find((account) => account.id === accountId);\n\n/**\n * Returns the account with this id, or `undefined` while the state lists none.\n * Re-renders only when that account changes: its name, its placeholder flag,\n * a platform field such as an Ethereum `chainId`, or an SDK handle.\n *\n * Pass the platform tuple as a type argument for the SDK-precise account type,\n * or use the pre-typed hook from {@link createKheopskit}.\n */\nexport const useAccount = <\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n>(\n\taccountId: WalletAccountId,\n) =>\n\tuseStateItem(\"useAccount\", accountId, selectAccount) as\n\t\t| KheopskitState<P>[\"accounts\"][number]\n\t\t| undefined;\n","import type {\n\tKheopskitPlatform,\n\tKheopskitState,\n\tWalletId,\n} from \"@kheopskit/core\";\nimport { useStateItem } from \"./useStateItem\";\n\nconst selectWallet = (state: KheopskitState, walletId: WalletId) =>\n\tstate.wallets.find((wallet) => wallet.id === walletId);\n\n/**\n * Returns the wallet with this id, or `undefined` while the state lists none.\n * Re-renders only when that wallet changes: its status, connection, error,\n * name or any other field. Its `connect` and `disconnect` act on the instance's\n * pipeline when they are called, also right after an `<Activity>` reveal\n * restarts it and while another provider or a `kheopskit$` subscriber holds\n * it, and reject `ABORTED` while nothing holds it.\n *\n * Pass the platform tuple as a type argument for the SDK-precise wallet type,\n * or use the pre-typed hook from {@link createKheopskit}.\n */\nexport const useWallet = <\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n>(\n\twalletId: WalletId,\n) =>\n\tuseStateItem(\"useWallet\", walletId, selectWallet) as\n\t\t| KheopskitState<P>[\"wallets\"][number]\n\t\t| undefined;\n","import type { KheopskitPlatform, KheopskitState } from \"@kheopskit/core\";\nimport { useSyncExternalStore } from \"react\";\nimport { useKheopskitExternalStore } from \"./context\";\n\n/**\n * Returns the current kheopskit state (wallets, accounts, config, isHydrating)\n * and re-renders on every change. To follow one wallet or account, prefer\n * {@link useWallet} or {@link useAccount}. Each wallet's `connect` and\n * `disconnect` act on the instance's pipeline when they are called, while\n * anything holds it.\n *\n * Pass the platform tuple as a type argument to recover SDK-precise account and\n * wallet types — `useWallets<typeof platforms>()`. React contexts can't be\n * generic, so without the argument the state is typed with the base\n * (SDK-free) wallet/account shapes.\n */\nexport const useWallets = <\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n>(): KheopskitState<P> => {\n\tconst store = useKheopskitExternalStore(\"useWallets\");\n\treturn useSyncExternalStore(\n\t\tstore.subscribe,\n\t\tstore.getSnapshot,\n\t\tstore.getServerSnapshot,\n\t) as unknown as KheopskitState<P>;\n};\n","import {\n\tcreateKheopskitStore,\n\tgetKheopskit$,\n\ttype KheopskitConfig,\n\ttype KheopskitPlatform,\n\ttype KheopskitState,\n\ttype KheopskitStore,\n\tresolveConfig,\n\ttype WalletAccountId,\n\ttype WalletId,\n} from \"@kheopskit/core\";\nimport { type FC, type PropsWithChildren, useCallback } from \"react\";\nimport { defer, type Observable, shareReplay } from \"rxjs\";\nimport { KheopskitSourceProvider } from \"./KheopskitSourceProvider\";\nimport { createLivePipeline, type LivePipeline } from \"./livePipeline\";\nimport { useAccount } from \"./useAccount\";\nimport { useWallet } from \"./useWallet\";\nimport { useWallets } from \"./useWallets\";\n\nexport type CreateKheopskitConfig<P extends readonly KheopskitPlatform[]> =\n\tOmit<Partial<KheopskitConfig<P>>, \"platforms\"> & {\n\t\t/** Platform plugins, e.g. `[polkadot(), solana()]`. Required. */\n\t\tplatforms: P;\n\t};\n\nexport type CreateKheopskitOptions = {\n\t/**\n\t * Store the shared instance reads the cache from and persists into. Pass one\n\t * when code outside React reads `store` or subscribes `kheopskit$` before\n\t * the provider renders in an SSR app, and in tests.\n\t */\n\tstore?: KheopskitStore;\n};\n\nconst deferredStore = (claim: () => KheopskitStore): KheopskitStore => ({\n\tobservable: defer(() => claim().observable),\n\trememberWallet: (walletId) => claim().rememberWallet(walletId),\n\tforgetWallet: (walletId) => claim().forgetWallet(walletId),\n\tgetCachedState: () => claim().getCachedState(),\n\tsetCachedState: (wallets, accounts) =>\n\t\tclaim().setCachedState(wallets, accounts),\n\tdestroy: () => claim().destroy(),\n});\n\n/**\n * Binds a platform tuple once and returns one kheopskit instance: a\n * `KheopskitProvider`, hooks already typed to those platforms, and the\n * `kheopskit$` stream and `store` the provider uses, for code outside React.\n * Subscribing `kheopskit$` while the provider is mounted runs no second\n * pipeline, and holds the one pipeline for every hook action of the instance.\n *\n * Without `options.store`, the store is created on first use in the browser:\n * backed by cookies when the provider renders first with `ssrCookies`, by\n * localStorage otherwise. The caller owns `store.destroy()`.\n *\n * @example\n * ```tsx\n * // kheopskit.ts\n * export const { KheopskitProvider, useWallets, useWallet, kheopskit$ } =\n * createKheopskit({ platforms: [polkadot(), ethereum(), solana()] });\n *\n * // anywhere\n * const { accounts } = useWallets(); // accounts are platform-precise, no generic\n * ```\n */\nexport const createKheopskit = <\n\tconst P extends readonly [KheopskitPlatform, ...KheopskitPlatform[]],\n>(\n\tconfig: CreateKheopskitConfig<P>,\n\toptions: CreateKheopskitOptions = {},\n) => {\n\tlet claimed: KheopskitStore | undefined;\n\tconst claimStore = (ssrCookies?: string) => {\n\t\tclaimed ??=\n\t\t\toptions.store ??\n\t\t\tcreateKheopskitStore({\n\t\t\t\tssrCookies,\n\t\t\t\tstorageKey: resolveConfig(config).storageKey,\n\t\t\t});\n\t\treturn claimed;\n\t};\n\n\tconst shared$: Observable<KheopskitState<P>> = defer(() =>\n\t\tgetKheopskit$(config, { store: claimStore() }),\n\t).pipe(shareReplay({ refCount: true, bufferSize: 1 }));\n\tconst pipeline = createLivePipeline(shared$);\n\tconst kheopskit$ = pipeline.observable$;\n\n\tconst Provider: FC<PropsWithChildren<{ ssrCookies?: string }>> = ({\n\t\tchildren,\n\t\tssrCookies,\n\t}) => {\n\t\tif (typeof window !== \"undefined\") claimStore(ssrCookies);\n\t\tconst resolveClientSource = useCallback(\n\t\t\t() => ({\n\t\t\t\tstore: claimStore(ssrCookies),\n\t\t\t\tpipeline: pipeline as unknown as LivePipeline<KheopskitState>,\n\t\t\t}),\n\t\t\t[ssrCookies],\n\t\t);\n\t\treturn (\n\t\t\t<KheopskitSourceProvider\n\t\t\t\tconfig={config}\n\t\t\t\tssrCookies={ssrCookies}\n\t\t\t\tresolveClientSource={resolveClientSource}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</KheopskitSourceProvider>\n\t\t);\n\t};\n\tProvider.displayName = \"KheopskitProvider\";\n\n\treturn {\n\t\tKheopskitProvider: Provider,\n\t\t/** The state stream the provider subscribes to, shared with code outside React. */\n\t\tkheopskit$,\n\t\t/** The store `kheopskit$` reads the cache from and persists into. */\n\t\tstore: options.store ?? deferredStore(claimStore),\n\t\t/** Current state, typed to the bound platform tuple. */\n\t\tuseWallets: () => useWallets<P>(),\n\t\t/** Current accounts, typed to the bound platform tuple. */\n\t\tuseAccounts: () => useWallets<P>().accounts,\n\t\t/** The wallet with this id, typed to the bound platform tuple. */\n\t\tuseWallet: (walletId: WalletId) => useWallet<P>(walletId),\n\t\t/** The account with this id, typed to the bound platform tuple. */\n\t\tuseAccount: (accountId: WalletAccountId) => useAccount<P>(accountId),\n\t};\n};\n","import {\n\tcreateKheopskitStore,\n\tgetKheopskit$,\n\ttype KheopskitConfig,\n\ttype KheopskitStore,\n} from \"@kheopskit/core\";\nimport {\n\ttype FC,\n\ttype PropsWithChildren,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n} from \"react\";\nimport { KheopskitSourceProvider } from \"./KheopskitSourceProvider\";\nimport { createLivePipeline } from \"./livePipeline\";\n\nexport type KheopskitProviderProps = PropsWithChildren & {\n\t/**\n\t * Kheopskit configuration.\n\t *\n\t * @remarks\n\t * Must be a **referentially stable** value — define it once (module scope, a\n\t * `useMemo`, or via {@link createKheopskit}) and pass the same reference. A\n\t * new object literal on every render (`config={{ platforms: [...] }}` inline)\n\t * recreates the underlying store and re-subscribes each render.\n\t */\n\tconfig?: Partial<KheopskitConfig>;\n\t/**\n\t * Cookie string for SSR hydration.\n\t * Pass the request cookie header (e.g., from Next.js headers or TanStack Start)\n\t * to hydrate wallet state on the server.\n\t *\n\t * @remarks\n\t * This value should be stable per render to avoid unnecessary store recreation.\n\t * Compute it once in your server component or layout and pass it down.\n\t *\n\t * @example\n\t * ```tsx\n\t * // Next.js App Router\n\t * const cookieStore = await cookies();\n\t * const ssrCookies = cookieStore.getAll().map(c => `${c.name}=${c.value}`).join('; ');\n\t * return <Providers ssrCookies={ssrCookies}>{children}</Providers>\n\t * ```\n\t */\n\tssrCookies?: string;\n\t/**\n\t * Store the provider reads the cache from and persists into, on the client.\n\t * Defaults to a store per mount, backed by cookies when `ssrCookies` is set\n\t * and by localStorage otherwise. The server snapshot always comes from\n\t * `ssrCookies`.\n\t *\n\t * @example\n\t * ```tsx\n\t * // tests\n\t * const store = createKheopskitStore({ storage: createMemoryStorage() });\n\t * render(<KheopskitProvider config={config} store={store}>…</KheopskitProvider>);\n\t * ```\n\t */\n\tstore?: KheopskitStore;\n};\n\nexport const KheopskitProvider: FC<KheopskitProviderProps> = ({\n\tchildren,\n\tconfig,\n\tssrCookies,\n\tstore,\n}) => {\n\t// Dev-only: warn if the `config` prop reference changes between renders. A new\n\t// object each render recreates the store and re-subscribes the whole pipeline\n\t// (re-hydrating, dropping live connection state) on every render. `config` must\n\t// be referentially stable — define it at module scope, memoize it, or use\n\t// createKheopskit() (which passes a stable reference for you).\n\tconst lastConfigRef = useRef(config);\n\tconst hasMountedRef = useRef(false);\n\tuseEffect(() => {\n\t\tif (\n\t\t\thasMountedRef.current &&\n\t\t\tlastConfigRef.current !== config &&\n\t\t\t(typeof process === \"undefined\" || process.env?.NODE_ENV !== \"production\")\n\t\t) {\n\t\t\tconsole.warn(\n\t\t\t\t\"[kheopskit] KheopskitProvider received a new `config` reference; this \" +\n\t\t\t\t\t\"recreates the store and re-subscribes on every render. Pass a \" +\n\t\t\t\t\t\"referentially stable config (module scope, useMemo, or createKheopskit()).\",\n\t\t\t);\n\t\t}\n\t\thasMountedRef.current = true;\n\t\tlastConfigRef.current = config;\n\t}, [config]);\n\n\tconst resolveClientSource = useCallback(\n\t\t(resolvedConfig: KheopskitConfig) => {\n\t\t\tconst sourceStore =\n\t\t\t\tstore ??\n\t\t\t\tcreateKheopskitStore({\n\t\t\t\t\tssrCookies,\n\t\t\t\t\tstorageKey: resolvedConfig.storageKey,\n\t\t\t\t});\n\t\t\treturn {\n\t\t\t\tstore: sourceStore,\n\t\t\t\tpipeline: createLivePipeline(\n\t\t\t\t\tgetKheopskit$(resolvedConfig, { ssrCookies, store: sourceStore }),\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ssrCookies, store],\n\t);\n\n\treturn (\n\t\t<KheopskitSourceProvider\n\t\t\tconfig={config}\n\t\t\tssrCookies={ssrCookies}\n\t\t\tresolveClientSource={resolveClientSource}\n\t\t>\n\t\t\t{children}\n\t\t</KheopskitSourceProvider>\n\t);\n};\n","import type { KheopskitPlatform } from \"@kheopskit/core\";\nimport { useWallets } from \"./useWallets\";\n\n/**\n * Convenience hook returning just the accounts from kheopskit state. Pass the\n * platform tuple as a type argument to recover SDK-precise account types —\n * `useAccounts<typeof platforms>()` — or use the pre-typed hook from\n * {@link createKheopskit}.\n */\nexport const useAccounts = <\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n>() => useWallets<P>().accounts;\n","import {\n\tKheopskitError,\n\ttype WalletId,\n\ttype WalletStatus,\n} from \"@kheopskit/core\";\nimport { useEffect, useLayoutEffect, useMemo } from \"react\";\nimport {\n\ttype KheopskitExternalStore,\n\tuseKheopskitExternalStore,\n} from \"./context\";\nimport { walletActions } from \"./liveActions\";\nimport { useWallet } from \"./useWallet\";\n\nexport type UseConnectResult = {\n\t/**\n\t * Connects the wallet through the pipeline that runs when it is called, and\n\t * waits for that pipeline's first emission when an `<Activity>` reveal has\n\t * just restarted it. Resolves once the state shows the wallet connected.\n\t * Unmounting the component or changing `walletId` aborts a pending connect,\n\t * which then resolves without connecting. A connect that starts after\n\t * unmount, or through a `connect` captured before `walletId` changed,\n\t * rejects `ABORTED` without asking the wallet. Rejects with the wallet's\n\t * `KheopskitError` otherwise, such as `USER_REJECTED`, and with an `Error`\n\t * when the state lists no wallet with this id.\n\t */\n\tconnect: () => Promise<void>;\n\t/**\n\t * Disconnects the wallet through the instance's pipeline, like a `useWallet`\n\t * wallet's `disconnect`, also after this component unmounted. Resolves once\n\t * the state shows it disconnected.\n\t */\n\tdisconnect: () => Promise<void>;\n\t/** `undefined` while the state lists no wallet with this id. */\n\tstatus: WalletStatus | undefined;\n\t/** The last connect the platform refused or failed. */\n\terror: KheopskitError | undefined;\n};\n\nconst useIsomorphicLayoutEffect =\n\ttypeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\n// React runs every layout setup of a commit synchronously, so once this\n// microtask runs a mounted owner has renewed its scope.\nconst afterThisCommitsLayoutEffects = () => Promise.resolve();\n\nconst createWalletActions = (\n\tstore: KheopskitExternalStore,\n\twalletId: WalletId,\n) => {\n\tlet scope = new AbortController();\n\tconst wallet = walletActions(store, walletId);\n\n\treturn {\n\t\tconnect: async () => {\n\t\t\tif (scope.signal.aborted) await afterThisCommitsLayoutEffects();\n\t\t\tconst { signal } = scope;\n\t\t\tif (signal.aborted)\n\t\t\t\tthrow new KheopskitError(\n\t\t\t\t\t\"ABORTED\",\n\t\t\t\t\t`connect of wallet ${walletId} started after useConnect unmounted or switched wallet`,\n\t\t\t\t\t{ walletId },\n\t\t\t\t);\n\t\t\ttry {\n\t\t\t\tawait wallet.connect({ signal });\n\t\t\t} catch (error) {\n\t\t\t\tconst abortedByCleanup =\n\t\t\t\t\tsignal.aborted &&\n\t\t\t\t\terror instanceof KheopskitError &&\n\t\t\t\t\terror.code === \"ABORTED\";\n\t\t\t\tif (!abortedByCleanup) throw error;\n\t\t\t}\n\t\t},\n\t\tdisconnect: wallet.disconnect,\n\t\trenew: () => {\n\t\t\tif (scope.signal.aborted) scope = new AbortController();\n\t\t},\n\t\tabort: () => scope.abort(),\n\t};\n};\n\n/**\n * Connect and disconnect actions for one wallet, with its status and error.\n * `connect` and `disconnect` keep their identity while `walletId` is the same,\n * so `useEffect(() => { connect() }, [connect])` connects on mount and after\n * every `<Activity>` reveal.\n *\n * @example\n * ```tsx\n * const ConnectButton = ({ walletId }: { walletId: WalletId }) => {\n * const { connect, disconnect, status } = useConnect(walletId);\n * if (status === \"connected\") return <button onClick={disconnect}>Disconnect</button>;\n * return <button disabled={status === \"connecting\"} onClick={connect}>Connect</button>;\n * };\n * ```\n */\nexport const useConnect = (walletId: WalletId): UseConnectResult => {\n\tconst store = useKheopskitExternalStore(\"useConnect\");\n\tconst wallet = useWallet(walletId);\n\tconst actions = useMemo(\n\t\t() => createWalletActions(store, walletId),\n\t\t[store, walletId],\n\t);\n\n\tuseIsomorphicLayoutEffect(() => actions.renew(), [actions]);\n\tuseEffect(() => () => actions.abort(), [actions]);\n\n\treturn {\n\t\tconnect: actions.connect,\n\t\tdisconnect: actions.disconnect,\n\t\tstatus: wallet?.status,\n\t\terror: wallet?.error,\n\t};\n};\n"],"mappings":";;;;;;AAWA,MAAa,mBAAmB,cAC/B,IACD;AAEA,MAAa,6BAA6B,aAAqB;CAC9D,MAAM,QAAQ,WAAW,gBAAgB;CACzC,IAAI,CAAC,OACJ,MAAM,IAAI,MAAM,GAAG,SAAS,2CAA2C;CACxE,OAAO;AACR;;;ACTA,MAAMA,wCAAsC,QAAQ,QAAQ;AAE5D,MAAa,uBACZ,qBACA,gBACI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM,4BAAY,IAAI,IAAwB;CAE9C,MAAM,kBAAkB;EACvB,WAAA,SAAW,oBAAoB;EAC/B,OAAO;CACR;CAEA,MAAM,oBAAoB,eAAe,UAAU,CAAC,CAAC;CAErD,MAAM,0BAA0B;CAEhC,MAAM,8BAA8B;EACnC,IAAI,UAAU,MAAM;EACpB,cAAc,YAAY;EAC1B,eAAe,KAAA;CAChB;CAEA,MAAM,aAAa,aAAiC;EACnD,IAAI,CAAC,gBAAgB,aAAa,QACjC,eAAe,UAAU,CAAC,CAAC,SAAS,YAAY,WAAW,UAAU;GACpE,cAAc;GACd,KAAK,MAAM,UAAU,WAAW,OAAO,KAAK;EAC7C,CAAC;EAEF,UAAU,IAAI,QAAQ;EACtB,SA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,QAAQ;EACpB,QAAQ,QAAQ;EAChB,OAAO,QAAQ;CAChB;AACD"}
1
+ {"version":3,"file":"index.mjs","names":["useIsomorphicLayoutEffect","createCoreKheopskit","createKheopskit"],"sources":["../src/context.ts","../src/createExternalStore.ts","../src/KheopskitSourceProvider.tsx","../src/useStateItem.ts","../src/useAccount.ts","../src/useWallet.ts","../src/useWallets.ts","../src/createKheopskit.tsx","../src/KheopskitProvider.tsx","../src/useAccounts.ts","../src/useConnect.ts"],"sourcesContent":["import type { KheopskitState, WalletId } from \"@kheopskit/core\";\nimport type { WalletActions } from \"@kheopskit/core/internal\";\nimport { createContext, useContext } from \"react\";\n\nexport type KheopskitExternalStore = {\n\tsubscribe: (onChange: () => void) => () => void;\n\tgetSnapshot: () => KheopskitState;\n\tgetServerSnapshot: () => KheopskitState;\n\twalletActions: (walletId: WalletId) => WalletActions;\n};\n\nexport const KheopskitContext = createContext<KheopskitExternalStore | null>(\n\tnull,\n);\n\nexport const useKheopskitExternalStore = (hookName: string) => {\n\tconst store = useContext(KheopskitContext);\n\tif (!store)\n\t\tthrow new Error(`${hookName} can't be used without a KheopskitProvider`);\n\treturn store;\n};\n","import type { Observable, Subscription } from \"rxjs\";\n\nexport const createExternalStore = <T>(\n\tsource$: Observable<T>,\n\tgetInitialValue: () => T,\n\tserverValue: T,\n) => {\n\tlet initialValue: T | undefined;\n\tlet latestValue: T | undefined;\n\tlet subscription: Subscription | undefined;\n\tconst listeners = new Set<(value: T) => void>();\n\n\tconst getSnapshot = () => {\n\t\tinitialValue ??= getInitialValue();\n\t\treturn latestValue ?? initialValue;\n\t};\n\n\tconst getServerSnapshot = () => serverValue;\n\n\tconst releaseWhenUnobserved = () => {\n\t\tif (listeners.size) return;\n\t\tsubscription?.unsubscribe();\n\t\tsubscription = undefined;\n\t};\n\n\tconst subscribe = (listener: (value: T) => void) => {\n\t\tif (!subscription || subscription.closed) {\n\t\t\tsubscription = source$.subscribe((value) => {\n\t\t\t\tlatestValue = value;\n\t\t\t\tfor (const notify of listeners) notify(value);\n\t\t\t});\n\t\t}\n\t\tlisteners.add(listener);\n\t\tlistener(getSnapshot());\n\n\t\treturn () => {\n\t\t\tlisteners.delete(listener);\n\t\t\t// StrictMode and a changed `subscribe` unsubscribe and resubscribe in\n\t\t\t// the same task; releasing at once would restart the pipeline between.\n\t\t\tqueueMicrotask(releaseWhenUnobserved);\n\t\t};\n\t};\n\n\treturn { getSnapshot, getServerSnapshot, subscribe };\n};\n","import {\n\tcreateKheopskitStore,\n\tgetHydratedSnapshot,\n\ttype HydratedSnapshot,\n\ttype Kheopskit,\n\ttype KheopskitConfig,\n\ttype KheopskitPlatform,\n\ttype KheopskitState,\n\tresolveConfig,\n} from \"@kheopskit/core\";\nimport { kheopskitInternals } from \"@kheopskit/core/internal\";\nimport {\n\ttype FC,\n\ttype PropsWithChildren,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseMemo,\n} from \"react\";\nimport { KheopskitContext, type KheopskitExternalStore } from \"./context\";\nimport { createExternalStore } from \"./createExternalStore\";\n\ntype KheopskitSourceProviderProps = PropsWithChildren<{\n\tkit: Kheopskit<readonly KheopskitPlatform[]>;\n\tconfig: Partial<KheopskitConfig> | undefined;\n\tssrCookies: string | undefined;\n}>;\n\nconst keepPipelineRunning = () => {};\n\n// A layout effect, so that a child's layout effect calling an action on reveal\n// finds the pipeline held again one microtask later (see createExternalStore).\nconst useIsomorphicLayoutEffect =\n\ttypeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\nconst hydrating = (\n\tconfig: KheopskitConfig,\n\tsnapshot: HydratedSnapshot,\n): KheopskitState => ({\n\t...snapshot,\n\tconfig,\n\tisHydrating: true,\n\tisDiscovering: true,\n});\n\nconst serverSnapshot = (\n\tconfig: KheopskitConfig,\n\tssrCookies: string | undefined,\n): KheopskitState =>\n\thydrating(\n\t\tconfig,\n\t\tssrCookies === undefined\n\t\t\t? { wallets: [], accounts: [] }\n\t\t\t: getHydratedSnapshot(\n\t\t\t\t\tcreateKheopskitStore({ ssrCookies, storageKey: config.storageKey }),\n\t\t\t\t\tconfig,\n\t\t\t\t\t{ icons: false },\n\t\t\t\t),\n\t);\n\nexport const KheopskitSourceProvider: FC<KheopskitSourceProviderProps> = ({\n\tchildren,\n\tkit,\n\tconfig,\n\tssrCookies,\n}) => {\n\tconst resolvedConfig = useMemo(() => resolveConfig(config), [config]);\n\n\tconst externalStore = useMemo((): KheopskitExternalStore => {\n\t\tconst { present, walletActions } = kheopskitInternals(kit);\n\t\treturn {\n\t\t\t...createExternalStore(\n\t\t\t\tkit.kheopskit$,\n\t\t\t\t() =>\n\t\t\t\t\tpresent(\n\t\t\t\t\t\thydrating(\n\t\t\t\t\t\t\tresolvedConfig,\n\t\t\t\t\t\t\tgetHydratedSnapshot(kit.store, resolvedConfig, { icons: true }),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\tpresent(serverSnapshot(resolvedConfig, ssrCookies)),\n\t\t\t),\n\t\t\twalletActions,\n\t\t};\n\t}, [kit, resolvedConfig, ssrCookies]);\n\n\tuseIsomorphicLayoutEffect(\n\t\t() => externalStore.subscribe(keepPipelineRunning),\n\t\t[externalStore],\n\t);\n\n\treturn (\n\t\t<KheopskitContext.Provider value={externalStore}>\n\t\t\t{children}\n\t\t</KheopskitContext.Provider>\n\t);\n};\n","import type { KheopskitState } from \"@kheopskit/core\";\nimport { useMemo, useSyncExternalStore } from \"react\";\nimport { useKheopskitExternalStore } from \"./context\";\n\nconst isSameItemIgnoringClosures = (a: object, b: object) => {\n\tconst previous = a as Record<string, unknown>;\n\tconst next = b as Record<string, unknown>;\n\tconst keys = Object.keys(previous);\n\treturn (\n\t\tkeys.length === Object.keys(next).length &&\n\t\tkeys.every(\n\t\t\t(key) =>\n\t\t\t\tObject.hasOwn(next, key) &&\n\t\t\t\t(Object.is(previous[key], next[key]) ||\n\t\t\t\t\t(typeof previous[key] === \"function\" &&\n\t\t\t\t\t\ttypeof next[key] === \"function\")),\n\t\t)\n\t);\n};\n\nexport const useStateItem = <K, T extends object>(\n\thookName: string,\n\tkey: K,\n\tselect: (state: KheopskitState, key: K) => T | undefined,\n): T | undefined => {\n\tconst store = useKheopskitExternalStore(hookName);\n\tconst snapshots = useMemo(() => {\n\t\tlet cached: T | undefined;\n\t\treturn {\n\t\t\tgetSnapshot: () => {\n\t\t\t\tconst item = select(store.getSnapshot(), key);\n\t\t\t\tconst reusable =\n\t\t\t\t\tcached !== undefined &&\n\t\t\t\t\titem !== undefined &&\n\t\t\t\t\tisSameItemIgnoringClosures(cached, item);\n\t\t\t\tif (!reusable) cached = item;\n\t\t\t\treturn cached;\n\t\t\t},\n\t\t\tgetServerSnapshot: () => select(store.getServerSnapshot(), key),\n\t\t};\n\t}, [store, key, select]);\n\treturn useSyncExternalStore(\n\t\tstore.subscribe,\n\t\tsnapshots.getSnapshot,\n\t\tsnapshots.getServerSnapshot,\n\t);\n};\n","import type {\n\tKheopskitPlatform,\n\tKheopskitState,\n\tWalletAccountId,\n} from \"@kheopskit/core\";\nimport { useStateItem } from \"./useStateItem\";\n\nconst selectAccount = (state: KheopskitState, accountId: WalletAccountId) =>\n\tstate.accounts.find((account) => account.id === accountId);\n\n/**\n * Returns the account with this id, or `undefined` while the state lists none.\n * Re-renders only when that account changes: its name, its placeholder flag,\n * a platform field such as an Ethereum `chainId`, or an SDK handle.\n *\n * Pass the platform tuple as a type argument for the SDK-precise account type,\n * or use the pre-typed hook from {@link createKheopskit}.\n */\nexport const useAccount = <\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n>(\n\taccountId: WalletAccountId,\n) =>\n\tuseStateItem(\"useAccount\", accountId, selectAccount) as\n\t\t| KheopskitState<P>[\"accounts\"][number]\n\t\t| undefined;\n","import type {\n\tKheopskitPlatform,\n\tKheopskitState,\n\tWalletId,\n} from \"@kheopskit/core\";\nimport { useStateItem } from \"./useStateItem\";\n\nconst selectWallet = (state: KheopskitState, walletId: WalletId) =>\n\tstate.wallets.find((wallet) => wallet.id === walletId);\n\n/**\n * Returns the wallet with this id, or `undefined` while the state lists none.\n * Re-renders only when that wallet changes: its status, connection, error,\n * name or any other field. Its `connect` and `disconnect` act on the instance's\n * pipeline when they are called, also right after an `<Activity>` reveal\n * restarts it and while another provider or a `kheopskit$` subscriber holds\n * it, and reject `ABORTED` while nothing holds it.\n *\n * Pass the platform tuple as a type argument for the SDK-precise wallet type,\n * or use the pre-typed hook from {@link createKheopskit}.\n */\nexport const useWallet = <\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n>(\n\twalletId: WalletId,\n) =>\n\tuseStateItem(\"useWallet\", walletId, selectWallet) as\n\t\t| KheopskitState<P>[\"wallets\"][number]\n\t\t| undefined;\n","import type { KheopskitPlatform, KheopskitState } from \"@kheopskit/core\";\nimport { useSyncExternalStore } from \"react\";\nimport { useKheopskitExternalStore } from \"./context\";\n\n/**\n * Returns the current kheopskit state (wallets, accounts, config, isHydrating)\n * and re-renders on every change. To follow one wallet or account, prefer\n * {@link useWallet} or {@link useAccount}. Each wallet's `connect` and\n * `disconnect` act on the instance's pipeline when they are called, while\n * anything holds it.\n *\n * Pass the platform tuple as a type argument to recover SDK-precise account and\n * wallet types — `useWallets<typeof platforms>()`. React contexts can't be\n * generic, so without the argument the state is typed with the base\n * (SDK-free) wallet/account shapes.\n */\nexport const useWallets = <\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n>(): KheopskitState<P> => {\n\tconst store = useKheopskitExternalStore(\"useWallets\");\n\treturn useSyncExternalStore(\n\t\tstore.subscribe,\n\t\tstore.getSnapshot,\n\t\tstore.getServerSnapshot,\n\t) as unknown as KheopskitState<P>;\n};\n","import {\n\ttype CreateKheopskitConfig,\n\ttype CreateKheopskitOptions,\n\tcreateKheopskit as createCoreKheopskit,\n\ttype KheopskitPlatform,\n\ttype WalletAccountId,\n\ttype WalletId,\n} from \"@kheopskit/core\";\nimport type { FC, PropsWithChildren } from \"react\";\nimport { KheopskitSourceProvider } from \"./KheopskitSourceProvider\";\nimport { useAccount } from \"./useAccount\";\nimport { useWallet } from \"./useWallet\";\nimport { useWallets } from \"./useWallets\";\n\nexport type {\n\tCreateKheopskitConfig,\n\tCreateKheopskitOptions,\n} from \"@kheopskit/core\";\n\ntype ProviderProps<O> = O extends { ssr: true }\n\t? { ssrCookies?: string }\n\t: { ssrCookies?: never };\n\n/**\n * Binds a platform tuple once and returns one kheopskit instance: a\n * `KheopskitProvider`, hooks already typed to those platforms, and the\n * `kheopskit$` stream and `store` the provider uses, and `waitForAccount`, for\n * code outside React.\n * It is `@kheopskit/core`'s `createKheopskit` instance: subscribing\n * `kheopskit$` while the provider is mounted runs no second pipeline, and\n * holds the one pipeline for every hook action of the instance.\n *\n * Without `options.store`, the store is created on first use, backed by\n * cookies with `{ ssr: true }` and by localStorage otherwise. Only an\n * instance created with `{ ssr: true }` accepts the provider's `ssrCookies`.\n * The caller owns `store.destroy()`.\n *\n * @example\n * ```tsx\n * // kheopskit.ts\n * export const { KheopskitProvider, useWallets, useWallet, kheopskit$ } =\n * createKheopskit({ platforms: [polkadot(), ethereum(), solana()] });\n *\n * // anywhere\n * const { accounts } = useWallets(); // accounts are platform-precise, no generic\n * ```\n */\nexport const createKheopskit = <\n\tconst P extends readonly [KheopskitPlatform, ...KheopskitPlatform[]],\n\tconst O extends CreateKheopskitOptions = CreateKheopskitOptions,\n>(\n\tconfig: CreateKheopskitConfig<P>,\n\toptions?: O,\n) => {\n\tconst kit = createCoreKheopskit(config, options);\n\n\tconst Provider: FC<PropsWithChildren<{ ssrCookies?: string }>> = ({\n\t\tchildren,\n\t\tssrCookies,\n\t}) => (\n\t\t<KheopskitSourceProvider kit={kit} config={config} ssrCookies={ssrCookies}>\n\t\t\t{children}\n\t\t</KheopskitSourceProvider>\n\t);\n\tProvider.displayName = \"KheopskitProvider\";\n\n\treturn {\n\t\tKheopskitProvider: Provider as FC<PropsWithChildren<ProviderProps<O>>>,\n\t\t/** The state stream the provider subscribes to, shared with code outside React. */\n\t\tkheopskit$: kit.kheopskit$,\n\t\t/** The store `kheopskit$` reads the cache from and persists into. */\n\t\tstore: kit.store,\n\t\t/** Resolves with the live account once the running instance lists it. */\n\t\twaitForAccount: kit.waitForAccount,\n\t\t/** Current state, typed to the bound platform tuple. */\n\t\tuseWallets: () => useWallets<P>(),\n\t\t/** Current accounts, typed to the bound platform tuple. */\n\t\tuseAccounts: () => useWallets<P>().accounts,\n\t\t/** The wallet with this id, typed to the bound platform tuple. */\n\t\tuseWallet: (walletId: WalletId) => useWallet<P>(walletId),\n\t\t/** The account with this id, typed to the bound platform tuple. */\n\t\tuseAccount: (accountId: WalletAccountId) => useAccount<P>(accountId),\n\t};\n};\n","import {\n\tcreateKheopskit,\n\ttype KheopskitConfig,\n\ttype KheopskitPlatform,\n\ttype KheopskitStore,\n} from \"@kheopskit/core\";\nimport {\n\ttype FC,\n\ttype PropsWithChildren,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n} from \"react\";\nimport { KheopskitSourceProvider } from \"./KheopskitSourceProvider\";\n\nexport type KheopskitProviderProps = PropsWithChildren & {\n\t/**\n\t * Kheopskit configuration.\n\t *\n\t * @remarks\n\t * Must be a **referentially stable** value — define it once (module scope, a\n\t * `useMemo`, or via {@link createKheopskit}) and pass the same reference. A\n\t * new object literal on every render (`config={{ platforms: [...] }}` inline)\n\t * recreates the underlying store and re-subscribes each render.\n\t */\n\tconfig?: Partial<KheopskitConfig>;\n\t/**\n\t * The kheopskit cookie, for SSR hydration. Pass only the cookie named after\n\t * `storageKey` (default `kheopskit`), or `\"\"` when it is absent. Never pass\n\t * the whole cookie header: props of a client component are serialized into\n\t * the HTML, httpOnly session cookies included.\n\t *\n\t * @remarks\n\t * This value should be stable per render to avoid unnecessary store recreation.\n\t * Compute it once in your server component or layout and pass it down.\n\t *\n\t * @example\n\t * ```tsx\n\t * // Next.js App Router\n\t * const kheopskitCookie = (await cookies()).get(\"kheopskit\");\n\t * const ssrCookies = kheopskitCookie\n\t * ? `kheopskit=${encodeURIComponent(kheopskitCookie.value)}`\n\t * : \"\";\n\t * return <Providers ssrCookies={ssrCookies}>{children}</Providers>\n\t * ```\n\t */\n\tssrCookies?: string;\n\t/**\n\t * Store the provider reads the cache from and persists into, on the client.\n\t * Defaults to a store per mount, backed by cookies when `ssrCookies` is set\n\t * and by localStorage otherwise. The server snapshot always comes from\n\t * `ssrCookies`.\n\t *\n\t * @example\n\t * ```tsx\n\t * // tests\n\t * const store = createKheopskitStore({ storage: createMemoryStorage() });\n\t * render(<KheopskitProvider config={config} store={store}>…</KheopskitProvider>);\n\t * ```\n\t */\n\tstore?: KheopskitStore;\n};\n\nexport const KheopskitProvider: FC<KheopskitProviderProps> = ({\n\tchildren,\n\tconfig,\n\tssrCookies,\n\tstore,\n}) => {\n\t// Dev-only: warn if the `config` prop reference changes between renders. A new\n\t// object each render recreates the store and re-subscribes the whole pipeline\n\t// (re-hydrating, dropping live connection state) on every render. `config` must\n\t// be referentially stable — define it at module scope, memoize it, or use\n\t// createKheopskit() (which passes a stable reference for you).\n\tconst lastConfigRef = useRef(config);\n\tconst hasMountedRef = useRef(false);\n\tuseEffect(() => {\n\t\tif (\n\t\t\thasMountedRef.current &&\n\t\t\tlastConfigRef.current !== config &&\n\t\t\t(typeof process === \"undefined\" || process.env?.NODE_ENV !== \"production\")\n\t\t) {\n\t\t\tconsole.warn(\n\t\t\t\t\"[kheopskit] KheopskitProvider received a new `config` reference; this \" +\n\t\t\t\t\t\"recreates the store and re-subscribes on every render. Pass a \" +\n\t\t\t\t\t\"referentially stable config (module scope, useMemo, or createKheopskit()).\",\n\t\t\t);\n\t\t}\n\t\thasMountedRef.current = true;\n\t\tlastConfigRef.current = config;\n\t}, [config]);\n\n\tconst ssr = ssrCookies !== undefined;\n\tconst kit = useMemo(\n\t\t() =>\n\t\t\tcreateKheopskit(\n\t\t\t\t{\n\t\t\t\t\t...config,\n\t\t\t\t\tplatforms: (config?.platforms ?? []) as readonly [KheopskitPlatform],\n\t\t\t\t},\n\t\t\t\tstore ? { store } : { ssr },\n\t\t\t),\n\t\t[config, store, ssr],\n\t);\n\n\treturn (\n\t\t<KheopskitSourceProvider kit={kit} config={config} ssrCookies={ssrCookies}>\n\t\t\t{children}\n\t\t</KheopskitSourceProvider>\n\t);\n};\n","import type { KheopskitPlatform } from \"@kheopskit/core\";\nimport { useWallets } from \"./useWallets\";\n\n/**\n * Convenience hook returning just the accounts from kheopskit state. Pass the\n * platform tuple as a type argument to recover SDK-precise account types —\n * `useAccounts<typeof platforms>()` — or use the pre-typed hook from\n * {@link createKheopskit}.\n */\nexport const useAccounts = <\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n>() => useWallets<P>().accounts;\n","import {\n\tKheopskitError,\n\ttype WalletId,\n\ttype WalletStatus,\n} from \"@kheopskit/core\";\nimport { useEffect, useLayoutEffect, useMemo } from \"react\";\nimport {\n\ttype KheopskitExternalStore,\n\tuseKheopskitExternalStore,\n} from \"./context\";\nimport { useWallet } from \"./useWallet\";\n\nexport type UseConnectResult = {\n\t/**\n\t * Connects the wallet through the pipeline that runs when it is called, and\n\t * waits for that pipeline's first emission when an `<Activity>` reveal has\n\t * just restarted it. Resolves once the state shows the wallet connected.\n\t * Unmounting the component or changing `walletId` aborts a pending connect,\n\t * which then resolves without connecting. A connect that starts after\n\t * unmount, or through a `connect` captured before `walletId` changed,\n\t * rejects `ABORTED` without asking the wallet. Rejects with the wallet's\n\t * `KheopskitError` otherwise, such as `USER_REJECTED`, and with an `Error`\n\t * when the state lists no wallet with this id.\n\t */\n\tconnect: () => Promise<void>;\n\t/**\n\t * Disconnects the wallet through the instance's pipeline, like a `useWallet`\n\t * wallet's `disconnect`, also after this component unmounted. Resolves once\n\t * the state shows it disconnected.\n\t */\n\tdisconnect: () => Promise<void>;\n\t/** `undefined` while the state lists no wallet with this id. */\n\tstatus: WalletStatus | undefined;\n\t/** The last connect the platform refused or failed. */\n\terror: KheopskitError | undefined;\n};\n\nconst useIsomorphicLayoutEffect =\n\ttypeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\n// React runs every layout setup of a commit synchronously, so once this\n// microtask runs a mounted owner has renewed its scope.\nconst afterThisCommitsLayoutEffects = () => Promise.resolve();\n\nconst createWalletActions = (\n\tstore: KheopskitExternalStore,\n\twalletId: WalletId,\n) => {\n\tlet scope = new AbortController();\n\tconst wallet = store.walletActions(walletId);\n\n\treturn {\n\t\tconnect: async () => {\n\t\t\tif (scope.signal.aborted) await afterThisCommitsLayoutEffects();\n\t\t\tconst { signal } = scope;\n\t\t\tif (signal.aborted)\n\t\t\t\tthrow new KheopskitError(\n\t\t\t\t\t\"ABORTED\",\n\t\t\t\t\t`connect of wallet ${walletId} started after useConnect unmounted or switched wallet`,\n\t\t\t\t\t{ walletId },\n\t\t\t\t);\n\t\t\ttry {\n\t\t\t\tawait wallet.connect({ signal });\n\t\t\t} catch (error) {\n\t\t\t\tconst abortedByCleanup =\n\t\t\t\t\tsignal.aborted &&\n\t\t\t\t\terror instanceof KheopskitError &&\n\t\t\t\t\terror.code === \"ABORTED\";\n\t\t\t\tif (!abortedByCleanup) throw error;\n\t\t\t}\n\t\t},\n\t\tdisconnect: wallet.disconnect,\n\t\trenew: () => {\n\t\t\tif (scope.signal.aborted) scope = new AbortController();\n\t\t},\n\t\tabort: () => scope.abort(),\n\t};\n};\n\n/**\n * Connect and disconnect actions for one wallet, with its status and error.\n * `connect` and `disconnect` keep their identity while `walletId` is the same,\n * so `useEffect(() => { connect() }, [connect])` connects on mount and after\n * every `<Activity>` reveal.\n *\n * @example\n * ```tsx\n * const ConnectButton = ({ walletId }: { walletId: WalletId }) => {\n * const { connect, disconnect, status } = useConnect(walletId);\n * if (status === \"connected\") return <button onClick={disconnect}>Disconnect</button>;\n * return <button disabled={status === \"connecting\"} onClick={connect}>Connect</button>;\n * };\n * ```\n */\nexport const useConnect = (walletId: WalletId): UseConnectResult => {\n\tconst store = useKheopskitExternalStore(\"useConnect\");\n\tconst wallet = useWallet(walletId);\n\tconst actions = useMemo(\n\t\t() => createWalletActions(store, walletId),\n\t\t[store, walletId],\n\t);\n\n\tuseIsomorphicLayoutEffect(() => actions.renew(), [actions]);\n\tuseEffect(() => () => actions.abort(), [actions]);\n\n\treturn {\n\t\tconnect: actions.connect,\n\t\tdisconnect: actions.disconnect,\n\t\tstatus: wallet?.status,\n\t\terror: wallet?.error,\n\t};\n};\n"],"mappings":";;;;;;AAWA,MAAa,mBAAmB,cAC/B,IACD;AAEA,MAAa,6BAA6B,aAAqB;CAC9D,MAAM,QAAQ,WAAW,gBAAgB;CACzC,IAAI,CAAC,OACJ,MAAM,IAAI,MAAM,GAAG,SAAS,2CAA2C;CACxE,OAAO;AACR;;;AClBA,MAAa,uBACZ,SACA,iBACA,gBACI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM,4BAAY,IAAI,IAAwB;CAE9C,MAAM,oBAAoB;EACzB,iBAAA,eAAiB,gBAAgB;EACjC,OAAO,eAAe;CACvB;CAEA,MAAM,0BAA0B;CAEhC,MAAM,8BAA8B;EACnC,IAAI,UAAU,MAAM;EACpB,cAAc,YAAY;EAC1B,eAAe,KAAA;CAChB;CAEA,MAAM,aAAa,aAAiC;EACnD,IAAI,CAAC,gBAAgB,aAAa,QACjC,eAAe,QAAQ,WAAW,UAAU;GAC3C,cAAc;GACd,KAAK,MAAM,UAAU,WAAW,OAAO,KAAK;EAC7C,CAAC;EAEF,UAAU,IAAI,QAAQ;EACtB,SAAS,YAAY,CAAC;EAEtB,aAAa;GACZ,UAAU,OAAO,QAAQ;GAGzB,eAAe,qBAAqB;EACrC;CACD;CAEA,OAAO;EAAE;EAAa;EAAmB;CAAU;AACpD;;;ACjBA,MAAM,4BAA4B,CAAC;AAInC,MAAMA,8BACL,OAAO,WAAW,cAAc,YAAY;AAE7C,MAAM,aACL,QACA,cACqB;CACrB,GAAG;CACH;CACA,aAAa;CACb,eAAe;AAChB;AAEA,MAAM,kBACL,QACA,eAEA,UACC,QACA,eAAe,K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AC,OAAO,QAAQ,CACjB;CAEA,gCAAgC,QAAQ,MAAM,GAAG,CAAC,OAAO,CAAC;CAC1D,sBAAsB,QAAQ,MAAM,GAAG,CAAC,OAAO,CAAC;CAEhD,OAAO;EACN,SAAS,QAAQ;EACjB,YAAY,QAAQ;EACpB,QAAQ,QAAQ;EAChB,OAAO,QAAQ;CAChB;AACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kheopskit/react",
3
- "version": "6.0.0-rc.3",
3
+ "version": "6.0.0-rc.5",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "license": "ISC",
38
38
  "peerDependencies": {
39
- "@kheopskit/core": "^6.0.0-rc.3",
39
+ "@kheopskit/core": "^6.0.0-rc.5",
40
40
  "react": ">=18.0.0",
41
41
  "react-dom": ">=18.0.0",
42
42
  "rxjs": ">=7.0.0"
@@ -47,7 +47,7 @@
47
47
  "react": "^19.3.0",
48
48
  "react-dom": "^19.3.0",
49
49
  "rxjs": "^7.8.2",
50
- "@kheopskit/core": "6.0.0-rc.3"
50
+ "@kheopskit/core": "6.0.0-rc.5"
51
51
  },
52
52
  "tsdown": {
53
53
  "entry": [