@kheopskit/core 5.0.1 → 5.1.1

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 (73) hide show
  1. package/dist/errors-Caq2csKx.mjs +181 -0
  2. package/dist/errors-Caq2csKx.mjs.map +1 -0
  3. package/dist/errors-DPw6pc2H.js +222 -0
  4. package/dist/errors-DPw6pc2H.js.map +1 -0
  5. package/dist/ethereum.d.mts +39 -38
  6. package/dist/ethereum.d.ts +39 -38
  7. package/dist/ethereum.js +216 -343
  8. package/dist/ethereum.js.map +1 -1
  9. package/dist/ethereum.mjs +213 -344
  10. package/dist/ethereum.mjs.map +1 -1
  11. package/dist/{getCachedObservable-C4E8dfMp.d.ts → getCachedObservable-LUq9IfEx.d.mts} +5 -2
  12. package/dist/{getCachedObservable-C4E8dfMp.d.mts → getCachedObservable-LUq9IfEx.d.ts} +5 -2
  13. package/dist/iconCache-BSa42Sui.mjs +343 -0
  14. package/dist/iconCache-BSa42Sui.mjs.map +1 -0
  15. package/dist/iconCache-DS4zNiP1.js +396 -0
  16. package/dist/iconCache-DS4zNiP1.js.map +1 -0
  17. package/dist/index.d.mts +98 -36
  18. package/dist/index.d.ts +98 -36
  19. package/dist/index.js +897 -630
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +881 -631
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/injectedWallets-B1MCxAE9.js +148 -0
  24. package/dist/injectedWallets-B1MCxAE9.js.map +1 -0
  25. package/dist/injectedWallets-B3Vysfvr.mjs +119 -0
  26. package/dist/injectedWallets-B3Vysfvr.mjs.map +1 -0
  27. package/dist/internal.d.mts +18 -53
  28. package/dist/internal.d.ts +18 -53
  29. package/dist/internal.js +9 -32
  30. package/dist/internal.mjs +3 -32
  31. package/dist/polkadot.d.mts +37 -36
  32. package/dist/polkadot.d.ts +37 -36
  33. package/dist/polkadot.js +179 -294
  34. package/dist/polkadot.js.map +1 -1
  35. package/dist/polkadot.mjs +176 -295
  36. package/dist/polkadot.mjs.map +1 -1
  37. package/dist/polkadotExtensions-BoVKhNU_.mjs +23 -0
  38. package/dist/polkadotExtensions-BoVKhNU_.mjs.map +1 -0
  39. package/dist/polkadotExtensions-y4J9UzYl.js +28 -0
  40. package/dist/polkadotExtensions-y4J9UzYl.js.map +1 -0
  41. package/dist/solana.d.mts +50 -48
  42. package/dist/solana.d.ts +50 -48
  43. package/dist/solana.js +323 -449
  44. package/dist/solana.js.map +1 -1
  45. package/dist/solana.mjs +316 -449
  46. package/dist/solana.mjs.map +1 -1
  47. package/dist/types-Cb-vuEru.d.mts +330 -0
  48. package/dist/types-Cb-vuEru.d.ts +330 -0
  49. package/dist/types-DKU-SNio.js +169 -0
  50. package/dist/types-DKU-SNio.js.map +1 -0
  51. package/dist/types-jnifAAA0.mjs +104 -0
  52. package/dist/types-jnifAAA0.mjs.map +1 -0
  53. package/package.json +12 -12
  54. package/dist/chunk-4ENHC7G4.js +0 -210
  55. package/dist/chunk-4ENHC7G4.js.map +0 -1
  56. package/dist/chunk-6XAZANB5.mjs +0 -450
  57. package/dist/chunk-6XAZANB5.mjs.map +0 -1
  58. package/dist/chunk-7QSGAJ4A.mjs +0 -210
  59. package/dist/chunk-7QSGAJ4A.mjs.map +0 -1
  60. package/dist/chunk-B4L6GAYD.js +0 -179
  61. package/dist/chunk-B4L6GAYD.js.map +0 -1
  62. package/dist/chunk-BWUUHUDK.mjs +0 -24
  63. package/dist/chunk-BWUUHUDK.mjs.map +0 -1
  64. package/dist/chunk-D3EQMFZ2.js +0 -24
  65. package/dist/chunk-D3EQMFZ2.js.map +0 -1
  66. package/dist/chunk-XQWJM3KC.js +0 -450
  67. package/dist/chunk-XQWJM3KC.js.map +0 -1
  68. package/dist/chunk-YDLCHYHH.mjs +0 -179
  69. package/dist/chunk-YDLCHYHH.mjs.map +0 -1
  70. package/dist/internal.js.map +0 -1
  71. package/dist/internal.mjs.map +0 -1
  72. package/dist/types-C7V7DGlg.d.mts +0 -349
  73. package/dist/types-C7V7DGlg.d.ts +0 -349
package/dist/index.d.ts CHANGED
@@ -1,17 +1,18 @@
1
- export { c as clearAllCachedObservables } from './getCachedObservable-C4E8dfMp.js';
2
- import { K as KheopskitPlatform, d as KheopskitConfig, a as WalletId, e as createKheopskitStore, f as KheopskitState } from './types-C7V7DGlg.js';
3
- export { A as AccountOf, g as AppKitInstance, B as BaseWallet, h as BaseWalletAccount, C as CachedAccount, j as CachedWallet, P as PlatformContext, k as PolkadotAccountType, W as WalletAccountId, l as WalletConnectConfig, m as WalletConnectMetadata, n as WalletConnectProvider, b as WalletConnectWallet, o as WalletOf, p as WalletPlatform, q as WalletType, r as getDefaultStore, s as getWalletAccountId, t as getWalletId, i as isInjectedWallet, u as isValidWalletId, c as isWalletConnectWallet, v as parseWalletAccountId, w as parseWalletId } from './types-C7V7DGlg.js';
4
- import { Observable } from 'rxjs';
5
-
1
+ import { C as WalletId, D as WalletAccountId, E as parseWalletId, O as getWalletAccountId, S as isWalletConnectWallet, T as isValidWalletId, _ as WalletConnectWallet, a as CachedAccount, b as WalletType, c as KheopskitPlatform, d as KheopskitStoreData, f as PlatformContext, g as WalletConnectProvider, h as WalletConnectMetadata, i as BaseWalletAccount, k as parseWalletAccountId, l as KheopskitState, m as WalletConnectConfig, n as AppKitInstance, o as CachedWallet, p as PolkadotAccountType, r as BaseWallet, s as KheopskitConfig, t as AccountOf, u as KheopskitStore, v as WalletOf, w as getWalletId, x as isInjectedWallet, y as WalletPlatform } from "./types-Cb-vuEru.js";
2
+ import { t as clearAllCachedObservables } from "./getCachedObservable-LUq9IfEx.js";
3
+ import { Observable } from "rxjs";
4
+ //#region src/utils/isValidAddress.d.ts
6
5
  declare const isValidAddress: (address: string) => boolean;
7
-
6
+ //#endregion
7
+ //#region src/api/appKit.d.ts
8
8
  /**
9
9
  * Clears the cached AppKit observable.
10
10
  * Use when configuration changes or for testing purposes.
11
11
  * Note: This does NOT destroy the appKit instance created by Reown.
12
12
  */
13
13
  declare const resetAppKitCache: () => void;
14
-
14
+ //#endregion
15
+ //#region src/api/config.d.ts
15
16
  /**
16
17
  * Default storage key for persisting wallet connection state.
17
18
  * Can be overridden via config.storageKey to avoid conflicts
@@ -19,24 +20,25 @@ declare const resetAppKitCache: () => void;
19
20
  */
20
21
  declare const DEFAULT_STORAGE_KEY = "kheopskit";
21
22
  declare const resolveConfig: <const P extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[]>(config?: Partial<KheopskitConfig<P>>) => KheopskitConfig<P>;
22
-
23
+ //#endregion
24
+ //#region src/api/errors.d.ts
23
25
  /**
24
26
  * Stable error codes thrown by kheopskit. Catch a {@link KheopskitError} and
25
27
  * branch on `error.code` instead of matching message strings.
26
28
  */
27
- type KheopskitErrorCode =
29
+ type KheopskitErrorCode =
28
30
  /** `connect()` called on a wallet that is already connected. */
29
- "WALLET_ALREADY_CONNECTED"
31
+ "WALLET_ALREADY_CONNECTED" |
30
32
  /** `disconnect()` called on a wallet that is not connected. */
31
- | "WALLET_NOT_CONNECTED"
33
+ "WALLET_NOT_CONNECTED" |
32
34
  /** The wallet does not advertise a capability kheopskit needs to proceed. */
33
- | "FEATURE_NOT_SUPPORTED"
35
+ "FEATURE_NOT_SUPPORTED" |
34
36
  /** No active WalletConnect session for the requested operation. */
35
- | "NO_SESSION"
37
+ "NO_SESSION" |
36
38
  /** No provider available for the requested namespace. */
37
- | "NO_PROVIDER"
39
+ "NO_PROVIDER" |
38
40
  /** The requested chain cannot be used for this operation (e.g. a Solana cluster with no CAIP-2 id over WalletConnect). */
39
- | "UNSUPPORTED_CHAIN";
41
+ "UNSUPPORTED_CHAIN";
40
42
  /**
41
43
  * Error thrown by kheopskit wallet/account operations. Carries a stable
42
44
  * {@link KheopskitErrorCode} and, when relevant, the offending wallet id.
@@ -53,29 +55,89 @@ type KheopskitErrorCode =
53
55
  * ```
54
56
  */
55
57
  declare class KheopskitError extends Error {
56
- readonly code: KheopskitErrorCode;
57
- /** The wallet id this error relates to, when applicable. */
58
- readonly walletId?: WalletId;
59
- constructor(code: KheopskitErrorCode, message: string, options?: {
60
- walletId?: WalletId;
61
- cause?: unknown;
62
- });
58
+ readonly code: KheopskitErrorCode;
59
+ /** The wallet id this error relates to, when applicable. */
60
+ readonly walletId?: WalletId;
61
+ constructor(code: KheopskitErrorCode, message: string, options?: {
62
+ walletId?: WalletId;
63
+ cause?: unknown;
64
+ });
63
65
  }
64
-
66
+ //#endregion
67
+ //#region src/api/store.d.ts
68
+ type CreateKheopskitStoreOptions = {
69
+ /**
70
+ * Cookie string for SSR hydration.
71
+ * When provided, uses cookieStorage instead of localStorage.
72
+ */
73
+ ssrCookies?: string;
74
+ /**
75
+ * Custom storage key to namespace the stored data.
76
+ * @default "kheopskit"
77
+ */
78
+ storageKey?: string;
79
+ };
80
+ /**
81
+ * Creates a kheopskit store with the appropriate storage backend.
82
+ * Uses cookieStorage when ssrCookies is provided (for SSR hydration),
83
+ * otherwise falls back to safeLocalStorage.
84
+ *
85
+ * @param options - Configuration options for the store
86
+ */
87
+ declare const createKheopskitStore: (options?: CreateKheopskitStoreOptions) => KheopskitStore;
88
+ /**
89
+ * Gets the default store, creating it on first access.
90
+ * Uses localStorage on client, noop on server.
91
+ * Lazily initialized to avoid SSR issues with module-level code.
92
+ */
93
+ declare const getDefaultStore: () => KheopskitStore;
94
+ //#endregion
95
+ //#region src/api/hydration.d.ts
96
+ /** Result of {@link getHydratedSnapshot}: placeholder wallets and accounts built from the cache. */
97
+ type HydratedSnapshot = {
98
+ wallets: (BaseWallet | WalletConnectWallet)[];
99
+ accounts: BaseWalletAccount[];
100
+ };
101
+ type GetHydratedSnapshotOptions = {
102
+ /**
103
+ * Enrich wallets that have no icon from the localStorage icon cache.
104
+ *
105
+ * Must stay `false` for any snapshot that has to match server-rendered markup
106
+ * (React's `getServerSnapshot` runs on the client during hydration, where the
107
+ * icon cache is populated — enriching there would diverge from the server,
108
+ * which always sees an empty cache).
109
+ */
110
+ icons?: boolean;
111
+ };
112
+ /**
113
+ * Builds the cached-state snapshot every consumer must agree on: read the
114
+ * store's cached state, hydrate wallets/accounts into placeholders, filter
115
+ * accounts through each platform plugin's `acceptsCachedAccount` hook, and sort
116
+ * with the same comparators the live pipeline uses.
117
+ *
118
+ * This is the single implementation behind the observable's initial seed and
119
+ * both React snapshot sources (`serverValue`/`initialValue`). They must produce
120
+ * the same shape in the same order or the UI flickers/reorders on reload — by
121
+ * sharing this helper, that agreement holds by construction.
122
+ */
123
+ declare const getHydratedSnapshot: (store: KheopskitStore, platforms: readonly KheopskitPlatform[], options?: GetHydratedSnapshotOptions) => HydratedSnapshot;
124
+ //#endregion
125
+ //#region src/api/kheopskit.d.ts
65
126
  /** Options for {@link getKheopskit$}. */
66
127
  type GetKheopskitOptions = {
67
- /**
68
- * Cookie string for SSR hydration. When provided, state is read from cookies
69
- * instead of localStorage so the server can hydrate without a flash. Pass the
70
- * request's `cookie` header.
71
- */
72
- ssrCookies?: string;
73
- /**
74
- * An existing store to reuse instead of creating one. Advanced escape hatch —
75
- * most callers omit it. (`@kheopskit/react` passes its provider-scoped store.)
76
- */
77
- store?: ReturnType<typeof createKheopskitStore>;
128
+ /**
129
+ * Cookie string for SSR hydration. When provided, state is read from cookies
130
+ * instead of localStorage so the server can hydrate without a flash. Pass the
131
+ * request's `cookie` header.
132
+ */
133
+ ssrCookies?: string;
134
+ /**
135
+ * An existing store to reuse instead of creating one. Advanced escape hatch —
136
+ * most callers omit it. (`@kheopskit/react` passes its provider-scoped store.)
137
+ */
138
+ store?: ReturnType<typeof createKheopskitStore>;
78
139
  };
79
140
  declare const getKheopskit$: <const P extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[]>(config?: Partial<KheopskitConfig<P>>, options?: GetKheopskitOptions) => Observable<KheopskitState<P>>;
80
-
81
- export { DEFAULT_STORAGE_KEY, type GetKheopskitOptions, KheopskitConfig, KheopskitError, type KheopskitErrorCode, KheopskitPlatform, KheopskitState, WalletId, createKheopskitStore, getKheopskit$, isValidAddress, resetAppKitCache, resolveConfig };
141
+ //#endregion
142
+ export { AccountOf, AppKitInstance, BaseWallet, BaseWalletAccount, CachedAccount, CachedWallet, DEFAULT_STORAGE_KEY, type GetHydratedSnapshotOptions, GetKheopskitOptions, type HydratedSnapshot, KheopskitConfig, KheopskitError, type KheopskitErrorCode, KheopskitPlatform, KheopskitState, KheopskitStore, KheopskitStoreData, PlatformContext, PolkadotAccountType, type WalletAccountId, WalletConnectConfig, WalletConnectMetadata, WalletConnectProvider, WalletConnectWallet, type WalletId, WalletOf, WalletPlatform, WalletType, clearAllCachedObservables, createKheopskitStore, getDefaultStore, getHydratedSnapshot, getKheopskit$, getWalletAccountId, getWalletId, isInjectedWallet, isValidAddress, isValidWalletId, isWalletConnectWallet, parseWalletAccountId, parseWalletId, resetAppKitCache, resolveConfig };
143
+ //# sourceMappingURL=index.d.ts.map