@kheopskit/core 1.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/MIGRATING_TO_V4.md +259 -0
  2. package/README.md +67 -0
  3. package/dist/chunk-4RBYRNY3.mjs +164 -0
  4. package/dist/chunk-4RBYRNY3.mjs.map +1 -0
  5. package/dist/chunk-BWUUHUDK.mjs +24 -0
  6. package/dist/chunk-BWUUHUDK.mjs.map +1 -0
  7. package/dist/chunk-D3EQMFZ2.js +24 -0
  8. package/dist/chunk-D3EQMFZ2.js.map +1 -0
  9. package/dist/chunk-FIAL4HTE.js +1 -0
  10. package/dist/chunk-FIAL4HTE.js.map +1 -0
  11. package/dist/chunk-KWFQDD7E.mjs +578 -0
  12. package/dist/chunk-KWFQDD7E.mjs.map +1 -0
  13. package/dist/chunk-NU46D4MZ.js +578 -0
  14. package/dist/chunk-NU46D4MZ.js.map +1 -0
  15. package/dist/chunk-PNPPI5CH.mjs +201 -0
  16. package/dist/chunk-PNPPI5CH.mjs.map +1 -0
  17. package/dist/chunk-SIUWQBT4.js +201 -0
  18. package/dist/chunk-SIUWQBT4.js.map +1 -0
  19. package/dist/chunk-TMAPQWW2.js +164 -0
  20. package/dist/chunk-TMAPQWW2.js.map +1 -0
  21. package/dist/chunk-YFD3IKK5.mjs +1 -0
  22. package/dist/chunk-YFD3IKK5.mjs.map +1 -0
  23. package/dist/ethereum.d.mts +60 -0
  24. package/dist/ethereum.d.ts +60 -0
  25. package/dist/ethereum.js +332 -0
  26. package/dist/ethereum.js.map +1 -0
  27. package/dist/ethereum.mjs +332 -0
  28. package/dist/ethereum.mjs.map +1 -0
  29. package/dist/getCachedObservable-C4E8dfMp.d.mts +20 -0
  30. package/dist/getCachedObservable-C4E8dfMp.d.ts +20 -0
  31. package/dist/index.d.mts +44 -270
  32. package/dist/index.d.ts +44 -270
  33. package/dist/index.js +160 -1394
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +119 -1387
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/internal.d.mts +86 -0
  38. package/dist/internal.d.ts +86 -0
  39. package/dist/internal.js +32 -0
  40. package/dist/internal.js.map +1 -0
  41. package/dist/internal.mjs +32 -0
  42. package/dist/internal.mjs.map +1 -0
  43. package/dist/polkadot.d.mts +69 -0
  44. package/dist/polkadot.d.ts +69 -0
  45. package/dist/polkadot.js +314 -0
  46. package/dist/polkadot.js.map +1 -0
  47. package/dist/polkadot.mjs +314 -0
  48. package/dist/polkadot.mjs.map +1 -0
  49. package/dist/solana.d.mts +97 -0
  50. package/dist/solana.d.ts +97 -0
  51. package/dist/solana.js +466 -0
  52. package/dist/solana.js.map +1 -0
  53. package/dist/solana.mjs +466 -0
  54. package/dist/solana.mjs.map +1 -0
  55. package/dist/types-BNzRUNw-.d.mts +319 -0
  56. package/dist/types-BNzRUNw-.d.ts +319 -0
  57. package/package.json +76 -16
package/dist/index.js CHANGED
@@ -1,530 +1,82 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from2, except, desc) => {
13
- if (from2 && typeof from2 === "object" || typeof from2 === "function") {
14
- for (let key of __getOwnPropNames(from2))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- DEFAULT_STORAGE_KEY: () => DEFAULT_STORAGE_KEY,
34
- clearAllCachedObservables: () => clearAllCachedObservables,
35
- clearCachedObservable: () => clearCachedObservable,
36
- createKheopskitStore: () => createKheopskitStore,
37
- getCachedIcon: () => getCachedIcon,
38
- getDefaultStore: () => getDefaultStore,
39
- getKheopskit$: () => getKheopskit$,
40
- getSafeLocalStorage: () => getSafeLocalStorage,
41
- hydrateAccount: () => hydrateAccount,
42
- hydrateWallet: () => hydrateWallet,
43
- resetAppKitCache: () => resetAppKitCache,
44
- resolveConfig: () => resolveConfig
45
- });
46
- module.exports = __toCommonJS(index_exports);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
47
2
 
48
- // src/utils/getCachedObservable.ts
49
- var CACHE = /* @__PURE__ */ new Map();
50
- var getCachedObservable$ = (key, create) => {
51
- if (!CACHE.has(key)) CACHE.set(key, create());
52
- return CACHE.get(key);
53
- };
54
- var clearCachedObservable = (key) => {
55
- CACHE.delete(key);
56
- };
57
- var clearAllCachedObservables = () => {
58
- CACHE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E1NyA0OC4wOTU0SDQwLjE0NzlDMzYuNjA1NyA0OC4wOTU0IDMzLjczNDEgNDUuMjIzOCAzMy43MzQxIDQxLjY4MTZWMzkuOTU2MUMzMy43MzQxIDM2LjQxMzggMzYuNjA1NyAzMy41NDIzIDQwLjE0NzkgMzMuNTQyM1oiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8yODdfMjM1OSkiLz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl8yODdfMjM1OSIgeDE9IjE5LjM2MDIiIHkxPSIxNCIgeDI9IjU2Ljc2OTYiIHkyPSI2OS44MDA1IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CjxzdG9wIHN0b3AtY29sb3I9IiNDNTQ5RkYiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjNjU0QkZGIi8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+Cg=="
78
- }
79
- };
80
4
 
81
- // src/utils/isWalletPlatform.ts
82
- var isWalletPlatform = (platform) => typeof platform === "string" && ["polkadot", "ethereum"].includes(platform);
83
5
 
84
- // src/utils/WalletId.ts
85
- var getWalletId = (platform, identifier) => {
86
- if (!isWalletPlatform(platform)) throw new Error("Invalid platform");
87
- if (!identifier) throw new Error("Invalid name");
88
- return `${platform}:${identifier}`;
89
- };
90
- var parseWalletId = (walletId) => {
91
- if (!walletId) throw new Error("Invalid walletId");
92
- const [platform, identifier] = walletId.split(":");
93
- if (!isWalletPlatform(platform)) throw new Error("Invalid platform");
94
- if (!identifier) throw new Error("Invalid address");
95
- return { platform, identifier };
96
- };
97
6
 
98
- // src/utils/hydrateState.ts
99
- var lookupWalletIcon = (platform, identifier) => {
100
- if (platform === "polkadot") {
101
- return POLKADOT_EXTENSIONS[identifier]?.icon ?? "";
102
- }
103
- return "";
104
- };
105
- var PendingWalletError = class extends Error {
106
- constructor(walletId) {
107
- super(
108
- `Wallet ${walletId} is still loading. Wait for isHydrating to be false before calling connect/disconnect.`
109
- );
110
- this.name = "PendingWalletError";
111
- }
112
- };
113
- var hydrateWallet = (cached) => {
114
- const { platform, identifier } = parseWalletId(cached.id);
115
- const throwPending = () => {
116
- throw new PendingWalletError(cached.id);
117
- };
118
- const icon = lookupWalletIcon(platform, identifier);
119
- if (platform === "polkadot") {
120
- return {
121
- id: cached.id,
122
- platform: "polkadot",
123
- type: "injected",
124
- extensionId: identifier,
125
- extension: void 0,
126
- name: cached.name,
127
- icon,
128
- isConnected: cached.isConnected,
129
- connect: throwPending,
130
- disconnect: throwPending
131
- };
132
- }
133
- if (platform === "ethereum") {
134
- return {
135
- id: cached.id,
136
- platform: "ethereum",
137
- type: "injected",
138
- providerId: identifier,
139
- provider: {},
140
- // Placeholder - will be replaced by real wallet
141
- name: cached.name,
142
- icon,
143
- isConnected: cached.isConnected,
144
- connect: throwPending,
145
- disconnect: throwPending
146
- };
147
- }
148
- throw new Error(`Unknown platform: ${platform}`);
149
- };
150
- var hydrateAccount = (cached) => {
151
- if (cached.platform === "polkadot") {
152
- return {
153
- id: cached.id,
154
- platform: "polkadot",
155
- type: cached.polkadotAccountType ?? "sr25519",
156
- address: cached.address,
157
- name: cached.name,
158
- walletId: cached.walletId,
159
- walletName: cached.walletName,
160
- // PolkadotSigner is required but we can't provide a real one
161
- // This is a placeholder that will be replaced by the real account
162
- polkadotSigner: {}
163
- };
164
- }
165
- if (cached.platform === "ethereum") {
166
- return {
167
- id: cached.id,
168
- platform: "ethereum",
169
- address: cached.address,
170
- chainId: cached.chainId,
171
- walletId: cached.walletId,
172
- walletName: cached.walletName,
173
- isWalletDefault: false,
174
- client: {}
175
- // Placeholder
176
- };
177
- }
178
- throw new Error(`Unknown platform: ${cached.platform}`);
179
- };
180
- var serializeWallet = (wallet) => ({
181
- id: wallet.id,
182
- platform: wallet.platform,
183
- type: wallet.type,
184
- name: wallet.name,
185
- // Note: icon is NOT stored to save cookie space
186
- isConnected: wallet.isConnected
187
- });
188
- var serializeAccount = (account) => ({
189
- id: account.id,
190
- platform: account.platform,
191
- address: account.address,
192
- name: "name" in account ? account.name : void 0,
193
- chainId: account.platform === "ethereum" ? account.chainId : void 0,
194
- polkadotAccountType: account.platform === "polkadot" ? account.type : void 0,
195
- walletId: account.walletId,
196
- walletName: account.walletName
197
- });
198
7
 
199
- // src/utils/storage.ts
200
- var noopStorage = {
201
- getItem: () => null,
202
- setItem: () => {
203
- },
204
- removeItem: () => {
205
- }
206
- };
207
- var _safeLocalStorage = null;
208
- var createSafeLocalStorage = () => {
209
- if (typeof window === "undefined") return noopStorage;
210
- try {
211
- const testKey = "__kheopskit_test__";
212
- window.localStorage.setItem(testKey, testKey);
213
- window.localStorage.removeItem(testKey);
214
- return {
215
- getItem: (key) => window.localStorage.getItem(key),
216
- setItem: (key, value) => window.localStorage.setItem(key, value),
217
- removeItem: (key) => window.localStorage.removeItem(key),
218
- subscribe: (key, callback) => {
219
- const handler = (event) => {
220
- if (event.key === key) {
221
- callback(event.newValue);
222
- }
223
- };
224
- window.addEventListener("storage", handler);
225
- return () => window.removeEventListener("storage", handler);
226
- }
227
- };
228
- } catch {
229
- return noopStorage;
230
- }
231
- };
232
- var getSafeLocalStorage = () => {
233
- if (_safeLocalStorage === null) {
234
- _safeLocalStorage = createSafeLocalStorage();
235
- }
236
- return _safeLocalStorage;
237
- };
238
- var safeLocalStorage = {
239
- getItem: (key) => getSafeLocalStorage().getItem(key),
240
- setItem: (key, value) => getSafeLocalStorage().setItem(key, value),
241
- removeItem: (key) => getSafeLocalStorage().removeItem(key),
242
- subscribe: (key, callback) => {
243
- const storage = getSafeLocalStorage();
244
- return storage.subscribe?.(key, callback) ?? (() => {
245
- });
246
- }
247
- };
248
- var parseCookie = (cookieString, key) => {
249
- if (!cookieString) return null;
250
- for (const cookie of cookieString.split(";")) {
251
- const [k, ...v] = cookie.split("=");
252
- const cookieKey = k?.trim();
253
- if (cookieKey === key) {
254
- try {
255
- return decodeURIComponent(v.join("=").trim());
256
- } catch {
257
- return null;
258
- }
259
- }
260
- }
261
- return null;
262
- };
263
- var COOKIE_MAX_SIZE = 3 * 1024;
264
- var BROADCAST_CHANNEL_NAME = "kheopskit-storage-sync";
265
- var sharedBroadcastChannel = null;
266
- var getBroadcastChannel = () => {
267
- if (sharedBroadcastChannel) return sharedBroadcastChannel;
268
- if (typeof BroadcastChannel === "undefined") return null;
269
- try {
270
- sharedBroadcastChannel = new BroadcastChannel(BROADCAST_CHANNEL_NAME);
271
- } catch {
272
- }
273
- return sharedBroadcastChannel;
274
- };
275
- var isSecureConnection = () => typeof window !== "undefined" && window.location.protocol === "https:";
276
- var cookieStorage = (initialCookies) => {
277
- return {
278
- getItem: (key) => {
279
- const cookieString = typeof document !== "undefined" ? document.cookie : initialCookies;
280
- return parseCookie(cookieString, key);
281
- },
282
- setItem: (key, value) => {
283
- if (typeof document === "undefined") return;
284
- const encodedValue = encodeURIComponent(value);
285
- if (encodedValue.length > COOKIE_MAX_SIZE) {
286
- console.warn(
287
- `[kheopskit] Cookie value for "${key}" exceeds recommended size limit (${encodedValue.length} > ${COOKIE_MAX_SIZE} bytes). This may cause issues with cookie storage. Consider reducing the number of connected wallets.`
288
- );
289
- }
290
- const expires = /* @__PURE__ */ new Date();
291
- expires.setFullYear(expires.getFullYear() + 1);
292
- let cookieStr = `${key}=${encodedValue};expires=${expires.toUTCString()};path=/;SameSite=Lax`;
293
- if (isSecureConnection()) {
294
- cookieStr += ";Secure";
295
- }
296
- document.cookie = cookieStr;
297
- getBroadcastChannel()?.postMessage({ type: "set", key, value });
298
- },
299
- removeItem: (key) => {
300
- if (typeof document === "undefined") return;
301
- let cookieStr = `${key}=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;SameSite=Lax`;
302
- if (isSecureConnection()) {
303
- cookieStr += ";Secure";
304
- }
305
- document.cookie = cookieStr;
306
- getBroadcastChannel()?.postMessage({ type: "remove", key });
307
- },
308
- subscribe: (key, callback) => {
309
- const channel = getBroadcastChannel();
310
- if (!channel) return () => {
311
- };
312
- const handler = (event) => {
313
- const data = event.data;
314
- if (data.key === key) {
315
- if (data.type === "set") {
316
- callback(data.value ?? null);
317
- } else if (data.type === "remove") {
318
- callback(null);
319
- }
320
- }
321
- };
322
- channel.addEventListener("message", handler);
323
- return () => {
324
- channel.removeEventListener("message", handler);
325
- };
326
- }
327
- };
328
- };
329
8
 
330
- // src/utils/iconCache.ts
331
- var ICON_CACHE_KEY = "kheopskit-icons";
332
- var memoryCache = null;
333
- var loadCache = () => {
334
- if (memoryCache !== null) return memoryCache;
335
- try {
336
- const stored = safeLocalStorage.getItem(ICON_CACHE_KEY);
337
- memoryCache = stored ? JSON.parse(stored) : {};
338
- } catch {
339
- memoryCache = {};
340
- }
341
- return memoryCache;
342
- };
343
- var saveCache = (cache) => {
344
- try {
345
- safeLocalStorage.setItem(ICON_CACHE_KEY, JSON.stringify(cache));
346
- memoryCache = cache;
347
- } catch {
348
- }
349
- };
350
- var getCachedIcon = (walletId) => {
351
- const cache = loadCache();
352
- return cache[walletId] || void 0;
353
- };
354
- var setCachedIcons = (icons) => {
355
- const cache = loadCache();
356
- let changed = false;
357
- for (const [walletId, icon] of Object.entries(icons)) {
358
- if (icon && cache[walletId] !== icon) {
359
- cache[walletId] = icon;
360
- changed = true;
361
- }
362
- }
363
- if (changed) {
364
- saveCache(cache);
365
- }
366
- };
367
9
 
368
- // src/api/appKit.ts
369
- var import_rxjs = require("rxjs");
370
- var loadAppKit = async () => {
371
- const { createAppKit } = await import("@reown/appkit/core");
372
- return createAppKit;
373
- };
374
- var WALLET_CONNECT_ICON = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjQwMCIgdmlld0JveD0iMCAwIDQwMCA0MDAiIHdpZHRoPSI0MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkve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jkzNyAwbDUwLjE3Ny00OC45MzJjMi4xMzktMi4wODcgNS42MDgtMi4wODcgNy43NDggMGw1MC4xNzkgNDguOTMyYy41MzUuNTIyIDEuNDAyLjUyMiAxLjkzNyAwbDUwLjE3OS00OC45MzFjMi4xMzktMi4wODcgNS42MDgtMi4wODcgNy43NDggMHoiIGZpbGw9IiNmZmYiLz48L2c+PC9zdmc+";
375
- var cachedAppKit = null;
376
- var resetAppKitCache = () => {
377
- cachedAppKit = null;
378
- };
379
- var getAppKitWallets$ = (config) => {
380
- if (!config.walletConnect) return (0, import_rxjs.of)({});
381
- if (typeof window === "undefined") return (0, import_rxjs.of)({});
382
- const walletConnect = config.walletConnect;
383
- if (!cachedAppKit) {
384
- cachedAppKit = (0, import_rxjs.from)(loadAppKit()).pipe(
385
- (0, import_rxjs.switchMap)((createAppKit) => {
386
- return new import_rxjs.Observable((subscriber) => {
387
- const appKit = createAppKit({
388
- projectId: walletConnect.projectId,
389
- metadata: walletConnect.metadata,
390
- networks: walletConnect.networks,
391
- themeMode: walletConnect.themeMode,
392
- themeVariables: walletConnect.themeVariables,
393
- universalProviderConfigOverride: {
394
- methods: {
395
- polkadot: ["polkadot_signTransaction", "polkadot_signMessage"]
396
- }
397
- },
398
- allWallets: "HIDE",
399
- debug: config.debug,
400
- allowUnsupportedChain: true
401
- });
402
- const status$ = new import_rxjs.BehaviorSubject({
403
- isPolkadotConnected: false,
404
- isEthereumConnected: false
405
- });
406
- const unsubProviders = appKit.subscribeProviders((providers) => {
407
- status$.next({
408
- isPolkadotConnected: !!providers.polkadot,
409
- isEthereumConnected: !!providers.eip155
410
- });
411
- });
412
- const polkadotWallet$ = appKit.chainNamespaces.includes("polkadot") ? status$.pipe(
413
- (0, import_rxjs.map)((s) => s.isPolkadotConnected),
414
- (0, import_rxjs.distinctUntilChanged)(),
415
- (0, import_rxjs.map)((isConnected) => {
416
- const walletInfo = appKit.getWalletInfo();
417
- return {
418
- id: getWalletId("polkadot", "walletconnect"),
419
- platform: "polkadot",
420
- type: "appKit",
421
- appKit,
422
- // todo maybe we dont want to expose the appKit instance
423
- name: walletInfo?.name ?? "WalletConnect",
424
- icon: walletInfo?.icon ?? WALLET_CONNECT_ICON,
425
- connect: async () => {
426
- if (!isConnected) await appKit.open();
427
- },
428
- disconnect: () => {
429
- if (isConnected) appKit.disconnect();
430
- },
431
- isConnected
432
- };
433
- })
434
- ) : (0, import_rxjs.of)(void 0);
435
- const ethereumWallet$ = appKit.chainNamespaces.includes("eip155") ? status$.pipe(
436
- (0, import_rxjs.map)((s) => s.isEthereumConnected),
437
- (0, import_rxjs.distinctUntilChanged)(),
438
- (0, import_rxjs.map)((isConnected) => {
439
- const walletInfo = appKit.getWalletInfo();
440
- return {
441
- id: getWalletId("ethereum", "walletconnect"),
442
- platform: "ethereum",
443
- type: "appKit",
444
- appKit,
445
- name: walletInfo?.name ?? "WalletConnect",
446
- icon: walletInfo?.icon ?? WALLET_CONNECT_ICON,
447
- connect: () => appKit.open(),
448
- disconnect: () => appKit.disconnect(),
449
- isConnected
450
- };
451
- })
452
- ) : (0, import_rxjs.of)(void 0);
453
- const sub = (0, import_rxjs.combineLatest)({
454
- polkadot: polkadotWallet$,
455
- ethereum: ethereumWallet$
456
- }).subscribe(subscriber);
457
- return () => {
458
- sub.unsubscribe();
459
- unsubProviders();
460
- };
461
- });
462
- }),
463
- (0, import_rxjs.shareReplay)({ refCount: true, bufferSize: 1 })
464
- );
465
- }
466
- return cachedAppKit;
467
- };
468
10
 
469
- // src/api/config.ts
470
- var DEFAULT_STORAGE_KEY = "kheopskit";
471
- var DEFAULT_CONFIG = {
472
- autoReconnect: true,
473
- platforms: ["polkadot"],
474
- polkadotAccountTypes: ["sr25519", "ed25519", "ecdsa"],
475
- debug: false,
476
- storageKey: DEFAULT_STORAGE_KEY,
477
- hydrationGracePeriod: 500
478
- };
479
- var VALID_POLKADOT_ACCOUNT_TYPES = /* @__PURE__ */ new Set([
480
- "sr25519",
481
- "ed25519",
482
- "ecdsa",
483
- "ethereum"
484
- ]);
485
- var resolveConfig = (config) => {
486
- const resolved = Object.assign({}, DEFAULT_CONFIG, config);
487
- const invalid = resolved.polkadotAccountTypes.filter(
488
- (t) => !VALID_POLKADOT_ACCOUNT_TYPES.has(t)
489
- );
490
- if (invalid.length > 0) {
491
- console.warn(
492
- `[kheopskit] Unknown polkadotAccountTypes: ${JSON.stringify(invalid)}. Valid values: "sr25519", "ed25519", "ecdsa", "ethereum".`
493
- );
494
- }
495
- return resolved;
496
- };
11
+ var _chunkTMAPQWW2js = require('./chunk-TMAPQWW2.js');
12
+ require('./chunk-D3EQMFZ2.js');
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+ var _chunkNU46D4MZjs = require('./chunk-NU46D4MZ.js');
24
+
25
+
26
+
27
+
28
+ var _chunkSIUWQBT4js = require('./chunk-SIUWQBT4.js');
497
29
 
498
30
  // src/api/kheopskit.ts
499
- var import_rxjs11 = require("rxjs");
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+ var _rxjs = require('rxjs');
500
41
 
501
42
  // src/utils/createHydrationBuffer.ts
502
- var import_rxjs2 = require("rxjs");
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
503
55
  var createBufferCore = (cachedItems, liveItems$, gracePeriodMs, mergeFn, isConverged) => {
504
56
  if (gracePeriodMs <= 0 || cachedItems.length === 0) {
505
- return liveItems$.pipe((0, import_rxjs2.map)((items) => ({ items, isHydrating: false })));
57
+ return liveItems$.pipe(_rxjs.map.call(void 0, (items) => ({ items, isHydrating: false })));
506
58
  }
507
- return new import_rxjs2.Observable((subscriber) => {
508
- const subscriptions = new import_rxjs2.Subscription();
509
- const isHydrating$ = new import_rxjs2.BehaviorSubject(true);
510
- const liveWithInitial$ = liveItems$.pipe((0, import_rxjs2.startWith)([]));
59
+ return new (0, _rxjs.Observable)((subscriber) => {
60
+ const subscriptions = new (0, _rxjs.Subscription)();
61
+ const isHydrating$ = new (0, _rxjs.BehaviorSubject)(true);
62
+ const liveWithInitial$ = liveItems$.pipe(_rxjs.startWith.call(void 0, []));
511
63
  if (isConverged) {
512
- const timerFired$ = (0, import_rxjs2.timer)(gracePeriodMs).pipe(
513
- (0, import_rxjs2.map)(() => true),
514
- (0, import_rxjs2.startWith)(false),
515
- (0, import_rxjs2.shareReplay)({ bufferSize: 1, refCount: true })
64
+ const timerFired$ = _rxjs.timer.call(void 0, gracePeriodMs).pipe(
65
+ _rxjs.map.call(void 0, () => true),
66
+ _rxjs.startWith.call(void 0, false),
67
+ _rxjs.shareReplay.call(void 0, { bufferSize: 1, refCount: true })
516
68
  );
517
69
  subscriptions.add(
518
- (0, import_rxjs2.combineLatest)([liveWithInitial$, timerFired$]).pipe(
519
- (0, import_rxjs2.filter)(([, timerFired]) => timerFired),
520
- (0, import_rxjs2.filter)(([liveItems]) => isConverged(liveItems, cachedItems)),
521
- (0, import_rxjs2.take)(1)
70
+ _rxjs.combineLatest.call(void 0, [liveWithInitial$, timerFired$]).pipe(
71
+ _rxjs.filter.call(void 0, ([, timerFired]) => timerFired),
72
+ _rxjs.filter.call(void 0, ([liveItems]) => isConverged(liveItems, cachedItems)),
73
+ _rxjs.take.call(void 0, 1)
522
74
  ).subscribe(() => {
523
75
  isHydrating$.next(false);
524
76
  })
525
77
  );
526
78
  subscriptions.add(
527
- (0, import_rxjs2.timer)(gracePeriodMs * 6).subscribe(() => {
79
+ _rxjs.timer.call(void 0, gracePeriodMs * 6).subscribe(() => {
528
80
  if (isHydrating$.value) {
529
81
  isHydrating$.next(false);
530
82
  }
@@ -532,14 +84,14 @@ var createBufferCore = (cachedItems, liveItems$, gracePeriodMs, mergeFn, isConve
532
84
  );
533
85
  } else {
534
86
  subscriptions.add(
535
- (0, import_rxjs2.timer)(gracePeriodMs).subscribe(() => {
87
+ _rxjs.timer.call(void 0, gracePeriodMs).subscribe(() => {
536
88
  isHydrating$.next(false);
537
89
  })
538
90
  );
539
91
  }
540
92
  subscriptions.add(
541
- (0, import_rxjs2.combineLatest)([liveWithInitial$, isHydrating$]).pipe(
542
- (0, import_rxjs2.map)(([liveItems, isHydrating]) => {
93
+ _rxjs.combineLatest.call(void 0, [liveWithInitial$, isHydrating$]).pipe(
94
+ _rxjs.map.call(void 0, ([liveItems, isHydrating]) => {
543
95
  if (!isHydrating) {
544
96
  return { items: liveItems, isHydrating: false };
545
97
  }
@@ -601,8 +153,8 @@ var createAccountHydrationBuffer = (cachedAccounts, liveAccounts$, gracePeriodMs
601
153
  };
602
154
 
603
155
  // src/utils/logObservable.ts
604
- var import_rxjs3 = require("rxjs");
605
- var logObservable = (label, opts) => (0, import_rxjs3.tap)((value) => {
156
+
157
+ var logObservable = (label, opts) => _rxjs.tap.call(void 0, (value) => {
606
158
  const { printValue = false, enabled = true } = opts || {};
607
159
  if (!label || !enabled) return;
608
160
  const text = `[kheopskit] observable ${label} emit`;
@@ -611,872 +163,67 @@ var logObservable = (label, opts) => (0, import_rxjs3.tap)((value) => {
611
163
  });
612
164
 
613
165
  // src/api/accounts.ts
614
- var import_rxjs7 = require("rxjs");
615
-
616
- // src/utils/sortAccounts.ts
617
- var sortAccounts = (a1, a2) => {
618
- if (a1.platform === "polkadot") {
619
- if (a2.platform === "polkadot") {
620
- if (a1.walletName !== a2.walletName) {
621
- if (a1.walletName === "talisman") return -1;
622
- if (a2.walletName === "talisman") return 1;
623
- return a1.walletName.localeCompare(a2.walletName);
624
- }
625
- return a1.name !== a2.name ? (a1.name ?? "").localeCompare(a2.name ?? "") : a1.address.localeCompare(a2.address);
626
- }
627
- return -1;
628
- }
629
- if (a2.platform === "ethereum") {
630
- if (a1.walletName !== a2.walletName) {
631
- if (a1.walletName === "Talisman") return -1;
632
- if (a2.walletName === "Talisman") return 1;
633
- return a1.walletName.localeCompare(a2.walletName);
634
- }
635
- return a1.id.localeCompare(a2.id);
636
- }
637
- return 0;
638
- };
639
-
640
- // src/api/ethereum/accounts.ts
641
- var import_rxjs5 = require("rxjs");
642
- var import_viem2 = require("viem");
643
-
644
- // src/utils/createStore.ts
645
- var import_rxjs4 = require("rxjs");
646
- var createStore = (key, defaultValue, storage = safeLocalStorage) => {
647
- const subject = new import_rxjs4.BehaviorSubject(
648
- getStoredData(key, defaultValue, storage)
649
- );
650
- let unsubscribeStorage;
651
- if (typeof window !== "undefined" && storage.subscribe) {
652
- unsubscribeStorage = storage.subscribe(key, (newValue) => {
653
- subject.next(parseData(newValue, defaultValue));
654
- });
655
- }
656
- const update = (val) => {
657
- setStoredData(key, val, storage);
658
- subject.next(val);
659
- };
660
- return {
661
- observable: subject.asObservable(),
662
- set: (val) => update(val),
663
- mutate: (transform) => update(transform(subject.getValue())),
664
- get: () => structuredClone(subject.getValue()),
665
- /**
666
- * Cleanup subscriptions. Call this when the store is no longer needed.
667
- */
668
- destroy: () => {
669
- unsubscribeStorage?.();
670
- subject.complete();
671
- }
672
- };
673
- };
674
- var parseData = (str, defaultValue) => {
675
- try {
676
- if (str) return JSON.parse(str);
677
- } catch {
678
- }
679
- return defaultValue;
680
- };
681
- var getStoredData = (key, defaultValue, storage) => {
682
- const str = storage.getItem(key);
683
- return parseData(str, defaultValue);
684
- };
685
- var setStoredData = (key, val, storage) => {
686
- const str = JSON.stringify(val);
687
- storage.setItem(key, str);
688
- };
689
-
690
- // src/utils/isEthereumAddress.ts
691
- var import_viem = require("viem");
692
- var isEthereumAddress = (address) => (0, import_viem.isAddress)(address);
693
-
694
- // src/utils/isSs58Address.ts
695
- var import_polkadot_api = require("polkadot-api");
696
- var accountIdEncoder = (0, import_polkadot_api.AccountId)().enc;
697
- var isSs58Address = (address) => {
698
- try {
699
- if (!address) return false;
700
- accountIdEncoder(address);
701
- return true;
702
- } catch {
703
- return false;
704
- }
705
- };
706
-
707
- // src/utils/isValidAddress.ts
708
- var isValidAddress = (address) => {
709
- return address.startsWith("0x") ? isEthereumAddress(address) : isSs58Address(address);
710
- };
711
-
712
- // src/utils/WalletAccountId.ts
713
- var getWalletAccountId = (walletId, address) => {
714
- if (!walletId) throw new Error("Missing walletId");
715
- if (!isValidAddress(address)) throw new Error("Invalid address");
716
- return `${walletId}::${address}`;
717
- };
718
-
719
- // src/api/ethereum/accounts.ts
720
- var normalizeEvmChainId = (value) => {
721
- let raw = value;
722
- if (typeof raw === "string" && raw.startsWith("eip155:")) {
723
- raw = raw.slice("eip155:".length);
724
- }
725
- if (typeof raw === "bigint") {
726
- return raw >= 0n ? Number(raw) : void 0;
727
- }
728
- if (typeof raw === "number") {
729
- return Number.isInteger(raw) && raw >= 0 ? raw : void 0;
730
- }
731
- if (typeof raw === "string") {
732
- const normalized = raw.trim().toLowerCase();
733
- if (!normalized) return void 0;
734
- const parsed = normalized.startsWith("0x") ? Number.parseInt(normalized, 16) : Number.parseInt(normalized, 10);
735
- return Number.isNaN(parsed) ? void 0 : parsed;
736
- }
737
- return void 0;
738
- };
739
- var toCaipNetworkId = (value) => {
740
- const chainId = normalizeEvmChainId(value);
741
- return chainId === void 0 ? void 0 : `eip155:${chainId}`;
742
- };
743
- var getInjectedWalletAccounts$ = (wallet) => {
744
- if (!wallet.isConnected) return (0, import_rxjs5.of)([]);
745
- return getCachedObservable$(
746
- `accounts:${wallet.id}`,
747
- () => new import_rxjs5.Observable((subscriber) => {
748
- const addresses$ = new import_rxjs5.ReplaySubject(1);
749
- const chainId$ = new import_rxjs5.ReplaySubject(1);
750
- const getAccount = (address, i, chainId) => {
751
- const client = (0, import_viem2.createWalletClient)({
752
- account: address,
753
- transport: (0, import_viem2.custom)(wallet.provider)
754
- });
755
- return {
756
- id: getWalletAccountId(wallet.id, address),
757
- platform: "ethereum",
758
- client,
759
- address: (0, import_viem2.getAddress)(address),
760
- chainId,
761
- walletName: wallet.name,
762
- walletId: wallet.id,
763
- isWalletDefault: i === 0
764
- };
765
- };
766
- const handleAccountsChanged = (addrs) => {
767
- addresses$.next(addrs);
768
- };
769
- const handleChainChanged = (chainIdHex) => {
770
- chainId$.next(normalizeEvmChainId(chainIdHex));
771
- };
772
- const handleDisconnect = () => {
773
- chainId$.next(void 0);
774
- };
775
- wallet.provider.on("accountsChanged", handleAccountsChanged);
776
- wallet.provider.on("chainChanged", handleChainChanged);
777
- wallet.provider.on("disconnect", handleDisconnect);
778
- wallet.provider.request({ method: "eth_accounts" }).then((addrs) => addresses$.next(addrs)).catch((err) => {
779
- console.error("Failed to get accounts", err);
780
- addresses$.next([]);
781
- });
782
- wallet.provider.request({ method: "eth_chainId" }).then(handleChainChanged).catch(() => chainId$.next(void 0));
783
- const sub = (0, import_rxjs5.combineLatest)([addresses$, chainId$]).pipe(
784
- (0, import_rxjs5.map)(
785
- ([addresses, chainId]) => addresses.map((addr, i) => getAccount(addr, i, chainId))
786
- )
787
- ).subscribe(subscriber);
788
- return () => {
789
- wallet.provider.removeListener(
790
- "accountsChanged",
791
- handleAccountsChanged
792
- );
793
- wallet.provider.removeListener("chainChanged", handleChainChanged);
794
- wallet.provider.removeListener("disconnect", handleDisconnect);
795
- sub.unsubscribe();
796
- };
797
- }).pipe((0, import_rxjs5.shareReplay)({ refCount: true, bufferSize: 1 }))
798
- );
799
- };
800
- var wrapWalletConnectProvider = (provider, sessionTopic, caipNetworkId) => {
801
- return new Proxy(provider, {
802
- get(target, prop, receiver) {
803
- if (prop !== "request") return Reflect.get(target, prop, receiver);
804
- return (args) => {
805
- if (args && typeof args === "object" && args.method) {
806
- if (!args.topic) args.topic = sessionTopic;
807
- if (!args.chainId) args.chainId = caipNetworkId;
808
- }
809
- return target.request(args);
810
- };
811
- }
812
- });
813
- };
814
- var getAppKitAccounts$ = (wallet) => {
815
- const account = wallet.appKit.getAccount("eip155");
816
- const provider = wallet.appKit.getProvider("eip155");
817
- if (!wallet.isConnected || !wallet.appKit || !account?.allAccounts.length || !provider?.session)
818
- return (0, import_rxjs5.of)([]);
819
- return getCachedObservable$(
820
- "accounts:appKit",
821
- () => new import_rxjs5.Observable((subscriber) => {
822
- const caipNetworkId$ = new import_rxjs5.ReplaySubject(1);
823
- const handleChainChanged = (chainId) => {
824
- const caipNetworkId = toCaipNetworkId(chainId);
825
- if (caipNetworkId) {
826
- caipNetworkId$.next(caipNetworkId);
827
- }
828
- };
829
- provider.on("chainChanged", handleChainChanged);
830
- provider.request({ method: "eth_chainId" }).then(handleChainChanged);
831
- const sub = caipNetworkId$.pipe(
832
- (0, import_rxjs5.distinctUntilChanged)(),
833
- (0, import_rxjs5.map)((caipNetworkId) => {
834
- const chainId = normalizeEvmChainId(caipNetworkId);
835
- const transport = (0, import_viem2.custom)(
836
- wrapWalletConnectProvider(
837
- provider,
838
- // biome-ignore lint/style/noNonNullAssertion: legacy
839
- provider.session.topic,
840
- caipNetworkId
841
- )
842
- );
843
- return { transport, chainId };
844
- }),
845
- (0, import_rxjs5.map)(
846
- ({ transport, chainId }) => account.allAccounts.map((acc, i) => {
847
- const client = (0, import_viem2.createWalletClient)({
848
- account: acc.address,
849
- transport
850
- });
851
- return {
852
- id: getWalletAccountId(wallet.id, acc.address),
853
- platform: "ethereum",
854
- walletName: wallet.name,
855
- walletId: wallet.id,
856
- address: acc.address,
857
- client,
858
- chainId,
859
- isWalletDefault: i === 0
860
- };
861
- })
862
- )
863
- ).subscribe(subscriber);
864
- return () => {
865
- provider.off("chainChanged", handleChainChanged);
866
- sub.unsubscribe();
867
- };
868
- }).pipe((0, import_rxjs5.shareReplay)({ refCount: true, bufferSize: 1 }))
869
- );
870
- };
871
- var getEthereumAccounts$ = (ethereumWallets) => new import_rxjs5.Observable((subscriber) => {
872
- const sub = ethereumWallets.pipe(
873
- (0, import_rxjs5.map)((wallets) => wallets.filter((w) => w.isConnected)),
874
- (0, import_rxjs5.switchMap)((wallets) => {
875
- return wallets.length ? (0, import_rxjs5.combineLatest)([
876
- ...wallets.filter((w) => w.type === "injected").map(getInjectedWalletAccounts$),
877
- ...wallets.filter((w) => w.type === "appKit").map(getAppKitAccounts$)
878
- // todo appkit
879
- ]) : (0, import_rxjs5.of)([]);
880
- }),
881
- (0, import_rxjs5.map)((accounts) => accounts.flat()),
882
- (0, import_rxjs5.distinctUntilChanged)(isSameAccountsList)
883
- ).subscribe(subscriber);
884
- return () => {
885
- sub.unsubscribe();
886
- };
887
- }).pipe(
888
- // logObservable("ethereumAccounts$", true),
889
- (0, import_rxjs5.shareReplay)({ refCount: true, bufferSize: 1 })
890
- );
891
- var isSameAccountsList = (a, b) => {
892
- if (a.length !== b.length) return false;
893
- return a.every(
894
- (account, i) => account.id === b[i]?.id && account.chainId === b[i]?.chainId
895
- );
896
- };
897
-
898
- // src/api/polkadot/accounts.ts
899
- var import_pjs_signer = require("polkadot-api/pjs-signer");
900
- var import_rxjs6 = require("rxjs");
901
- var getInjectedWalletAccounts$2 = (wallet) => {
902
- if (!wallet.isConnected) return (0, import_rxjs6.of)([]);
903
- return new import_rxjs6.Observable((subscriber) => {
904
- const getAccount = (account) => ({
905
- id: getWalletAccountId(wallet.id, account.address),
906
- ...account,
907
- type: account.type ?? "sr25519",
908
- platform: "polkadot",
909
- walletName: wallet.name,
910
- walletId: wallet.id
911
- });
912
- const extension = wallet.extension;
913
- const unsubscribe = extension.subscribe((accounts) => {
914
- subscriber.next(accounts.map(getAccount));
915
- });
916
- subscriber.next(extension.getAccounts().map(getAccount));
917
- return () => {
918
- return unsubscribe();
919
- };
920
- });
921
- };
922
- var getAppKitPolkadotSigner = (appKit, address) => {
923
- const provider = appKit.getProvider("polkadot");
924
- if (!provider) throw new Error("No provider found");
925
- if (!provider.session) throw new Error("No session found");
926
- return (0, import_pjs_signer.getPolkadotSignerFromPjs)(
927
- address,
928
- (transactionPayload) => {
929
- if (!provider.session) throw new Error("No session found");
930
- return provider.client.request({
931
- topic: provider.session.topic,
932
- chainId: `polkadot:${transactionPayload.genesisHash.substring(2, 34)}`,
933
- request: {
934
- method: "polkadot_signTransaction",
935
- params: {
936
- address,
937
- transactionPayload
938
- }
939
- }
940
- });
941
- },
942
- async ({ address: address2, data }) => {
943
- if (!provider.session) throw new Error("No session found");
944
- const networks = appKit.getCaipNetworks("polkadot");
945
- const chainId = networks[0]?.caipNetworkId;
946
- if (!chainId) throw new Error("No chainId found");
947
- return provider.client.request({
948
- topic: provider.session.topic,
949
- chainId,
950
- request: {
951
- method: "polkadot_signMessage",
952
- params: {
953
- address: address2,
954
- message: data
955
- }
956
- }
957
- });
958
- }
959
- );
960
- };
961
- var getAppKitAccounts$2 = (wallet) => {
962
- const account = wallet.appKit.getAccount("polkadot");
963
- const provider = wallet.appKit.getProvider("polkadot");
964
- if (!wallet.isConnected || !wallet.appKit || !account?.allAccounts.length || !provider?.session)
965
- return (0, import_rxjs6.of)([]);
966
- return (0, import_rxjs6.of)(
967
- account.allAccounts.map(
968
- (acc) => ({
969
- id: getWalletAccountId(wallet.id, acc.address),
970
- platform: "polkadot",
971
- walletName: wallet.name,
972
- walletId: wallet.id,
973
- address: acc.address,
974
- polkadotSigner: getAppKitPolkadotSigner(wallet.appKit, acc.address),
975
- genesisHash: null,
976
- name: `${wallet.name} Polkadot`,
977
- // WalletConnect (Reown AppKit) doesn't expose account key type;
978
- // default to sr25519, which is the most common Polkadot key type.
979
- type: "sr25519"
980
- })
981
- )
982
- );
983
- };
984
- var getPolkadotAccounts$ = (polkadotWallets$, polkadotAccountTypes) => new import_rxjs6.Observable((subscriber) => {
985
- if (polkadotAccountTypes.length === 0) {
986
- console.warn(
987
- "[kheopskit] config.polkadotAccountTypes is empty; all Polkadot accounts will be filtered out."
988
- );
989
- }
990
- const sub = polkadotWallets$.pipe(
991
- (0, import_rxjs6.map)((wallets) => wallets.filter((w) => w.isConnected)),
992
- (0, import_rxjs6.switchMap)(
993
- (wallets) => wallets.length ? (0, import_rxjs6.combineLatest)([
994
- ...wallets.filter((w) => w.type === "injected").map(getInjectedWalletAccounts$2),
995
- ...wallets.filter((w) => w.type === "appKit").map(getAppKitAccounts$2)
996
- ]) : (0, import_rxjs6.of)([])
997
- ),
998
- (0, import_rxjs6.map)(
999
- (accounts) => accounts.flat().filter((account) => polkadotAccountTypes.includes(account.type))
1000
- ),
1001
- (0, import_rxjs6.distinctUntilChanged)(isSameAccountsList2)
1002
- ).subscribe(subscriber);
1003
- return () => {
1004
- sub.unsubscribe();
1005
- };
1006
- }).pipe((0, import_rxjs6.shareReplay)({ refCount: true, bufferSize: 1 }));
1007
- var isSameAccountsList2 = (a, b) => {
1008
- if (a.length !== b.length) return false;
1009
- return a.every((account, i) => account.id === b[i]?.id);
1010
- };
1011
166
 
1012
- // src/api/accounts.ts
1013
167
  var getAccounts$ = (config, wallets) => {
1014
- return new import_rxjs7.Observable((subscriber) => {
168
+ return new (0, _rxjs.Observable)((subscriber) => {
1015
169
  const sources = config.platforms.map(
1016
- (platform) => {
1017
- switch (platform) {
1018
- case "polkadot":
1019
- return getPolkadotAccounts$(
1020
- wallets.pipe(
1021
- (0, import_rxjs7.map)((w) => w.filter((w2) => w2.platform === "polkadot"))
1022
- ),
1023
- config.polkadotAccountTypes
1024
- );
1025
- case "ethereum":
1026
- return getEthereumAccounts$(
1027
- wallets.pipe(
1028
- (0, import_rxjs7.map)((w) => w.filter((w2) => w2.platform === "ethereum"))
1029
- )
1030
- );
1031
- }
1032
- }
170
+ (plugin) => plugin.getAccounts$(
171
+ wallets.pipe(
172
+ _rxjs.map.call(void 0, (ws) => ws.filter((w) => w.platform === plugin.platform))
173
+ )
174
+ )
1033
175
  );
1034
- const accounts$ = sources.length ? (0, import_rxjs7.combineLatest)(sources).pipe(
1035
- (0, import_rxjs7.map)((accounts) => accounts.flat().sort(sortAccounts))
1036
- ) : (0, import_rxjs7.of)([]);
176
+ const accounts$ = sources.length ? _rxjs.combineLatest.call(void 0, sources).pipe(
177
+ _rxjs.map.call(void 0, (accounts) => accounts.flat().sort(_chunkTMAPQWW2js.sortAccounts))
178
+ ) : _rxjs.of.call(void 0, []);
1037
179
  const sub = accounts$.subscribe(subscriber);
1038
180
  return () => {
1039
181
  sub.unsubscribe();
1040
182
  };
1041
- }).pipe((0, import_rxjs7.shareReplay)({ refCount: true, bufferSize: 1 }));
1042
- };
1043
-
1044
- // src/api/store.ts
1045
- var import_lodash_es = require("lodash-es");
1046
- var DEFAULT_SETTINGS = {};
1047
- var toCompactPolkadotAccountType = (type) => {
1048
- switch (type) {
1049
- case "sr25519":
1050
- return 0;
1051
- case "ed25519":
1052
- return 1;
1053
- case "ecdsa":
1054
- return 2;
1055
- case "ethereum":
1056
- return 3;
1057
- default:
1058
- return null;
1059
- }
1060
- };
1061
- var fromCompactPolkadotAccountType = (type) => {
1062
- switch (type) {
1063
- case 0:
1064
- return "sr25519";
1065
- case 1:
1066
- return "ed25519";
1067
- case 2:
1068
- return "ecdsa";
1069
- case 3:
1070
- return "ethereum";
1071
- default:
1072
- return void 0;
1073
- }
1074
- };
1075
- var createKheopskitStore = (options = {}) => {
1076
- const { ssrCookies, storageKey = DEFAULT_STORAGE_KEY } = options;
1077
- const storage = ssrCookies !== void 0 ? createCompactCookieStorage(ssrCookies) : safeLocalStorage;
1078
- const store2 = createStore(storageKey, DEFAULT_SETTINGS, storage);
1079
- const addEnabledWalletId = (walletId) => {
1080
- parseWalletId(walletId);
1081
- store2.mutate((prev) => ({
1082
- ...prev,
1083
- autoReconnect: (0, import_lodash_es.uniq)((prev.autoReconnect ?? []).concat(walletId))
1084
- }));
1085
- };
1086
- const removeEnabledWalletId = (walletId) => {
1087
- store2.mutate((prev) => ({
1088
- ...prev,
1089
- autoReconnect: (0, import_lodash_es.uniq)(
1090
- (prev.autoReconnect ?? []).filter((id) => id !== walletId)
1091
- )
1092
- }));
1093
- };
1094
- const getCachedState = () => {
1095
- const data = store2.get();
1096
- return {
1097
- wallets: data.cachedWallets ?? [],
1098
- accounts: data.cachedAccounts ?? []
1099
- };
1100
- };
1101
- const setCachedState = (wallets, accounts) => {
1102
- store2.mutate((prev) => ({
1103
- ...prev,
1104
- cachedWallets: wallets,
1105
- cachedAccounts: accounts
1106
- }));
1107
- };
1108
- return {
1109
- observable: store2.observable,
1110
- addEnabledWalletId,
1111
- removeEnabledWalletId,
1112
- getCachedState,
1113
- setCachedState
1114
- };
1115
- };
1116
- var _defaultStore = null;
1117
- var getDefaultStore = () => {
1118
- if (_defaultStore === null) {
1119
- _defaultStore = createKheopskitStore();
1120
- }
1121
- return _defaultStore;
1122
- };
1123
- var store = {
1124
- get observable() {
1125
- return getDefaultStore().observable;
1126
- },
1127
- addEnabledWalletId: (walletId) => getDefaultStore().addEnabledWalletId(walletId),
1128
- removeEnabledWalletId: (walletId) => getDefaultStore().removeEnabledWalletId(walletId),
1129
- getCachedState: () => getDefaultStore().getCachedState(),
1130
- setCachedState: (wallets, accounts) => getDefaultStore().setCachedState(wallets, accounts)
1131
- };
1132
- var isCompactStore = (value) => {
1133
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
1134
- if ("cachedWallets" in value || "cachedAccounts" in value) return false;
1135
- return "v" in value || "w" in value || "a" in value || "r" in value;
1136
- };
1137
- var toCompactStore = (data) => {
1138
- const wallets = data.cachedWallets?.map(
1139
- (wallet) => [
1140
- wallet.id,
1141
- wallet.name,
1142
- wallet.isConnected ? 1 : 0,
1143
- wallet.type === "appKit" ? 1 : 0
1144
- ]
1145
- );
1146
- const accounts = data.cachedAccounts?.map(
1147
- (account) => [
1148
- account.walletId,
1149
- account.address,
1150
- account.name ?? null,
1151
- account.chainId ?? null,
1152
- toCompactPolkadotAccountType(account.polkadotAccountType)
1153
- ]
1154
- );
1155
- return {
1156
- v: 1,
1157
- r: data.autoReconnect,
1158
- w: wallets?.length ? wallets : void 0,
1159
- a: accounts?.length ? accounts : void 0
1160
- };
1161
- };
1162
- var fromCompactStore = (data) => {
1163
- const walletNameMap = /* @__PURE__ */ new Map();
1164
- const wallets = (data.w ?? []).map((item) => {
1165
- const [id, name, isConnected, type] = item;
1166
- walletNameMap.set(id, name);
1167
- const { platform } = parseWalletId(id);
1168
- return {
1169
- id,
1170
- platform,
1171
- type: type === 1 ? "appKit" : "injected",
1172
- name,
1173
- isConnected: isConnected === 1
1174
- };
1175
- });
1176
- const accounts = (data.a ?? []).map((item) => {
1177
- const [walletId, address, name, chainId, polkadotAccountType] = item;
1178
- const { platform } = parseWalletId(walletId);
1179
- return {
1180
- id: getWalletAccountId(walletId, address),
1181
- platform,
1182
- address,
1183
- name: name ?? void 0,
1184
- chainId: chainId ?? void 0,
1185
- polkadotAccountType: platform === "polkadot" ? fromCompactPolkadotAccountType(polkadotAccountType) : void 0,
1186
- walletId,
1187
- walletName: walletNameMap.get(walletId) ?? walletId
1188
- };
1189
- });
1190
- return {
1191
- autoReconnect: data.r,
1192
- cachedWallets: wallets,
1193
- cachedAccounts: accounts
1194
- };
1195
- };
1196
- var decodeStore = (raw, fallback) => {
1197
- try {
1198
- const parsed = JSON.parse(raw);
1199
- if (isCompactStore(parsed)) return fromCompactStore(parsed);
1200
- return parsed;
1201
- } catch {
1202
- return fallback;
1203
- }
1204
- };
1205
- var encodeStore = (data) => JSON.stringify(toCompactStore(data));
1206
- var createCompactCookieStorage = (initialCookies) => {
1207
- const base = cookieStorage(initialCookies);
1208
- return {
1209
- getItem: (key) => {
1210
- const raw = base.getItem(key);
1211
- if (!raw) return null;
1212
- const expanded = decodeStore(raw, DEFAULT_SETTINGS);
1213
- if (typeof document !== "undefined") {
1214
- try {
1215
- const parsed = JSON.parse(raw);
1216
- if (!isCompactStore(parsed)) {
1217
- base.setItem(key, encodeStore(expanded));
1218
- }
1219
- } catch {
1220
- }
1221
- }
1222
- return JSON.stringify(expanded);
1223
- },
1224
- setItem: (key, value) => {
1225
- const expanded = decodeStore(value, DEFAULT_SETTINGS);
1226
- base.setItem(key, encodeStore(expanded));
1227
- },
1228
- removeItem: base.removeItem,
1229
- subscribe: (key, callback) => {
1230
- const unsubscribe = base.subscribe?.(key, (value) => {
1231
- if (!value) {
1232
- callback(null);
1233
- return;
1234
- }
1235
- const expanded = decodeStore(value, DEFAULT_SETTINGS);
1236
- callback(JSON.stringify(expanded));
1237
- });
1238
- return () => {
1239
- unsubscribe?.();
1240
- };
1241
- }
1242
- };
183
+ }).pipe(_rxjs.shareReplay.call(void 0, { refCount: true, bufferSize: 1 }));
1243
184
  };
1244
185
 
1245
186
  // src/api/wallets.ts
1246
- var import_rxjs10 = require("rxjs");
1247
187
 
1248
- // src/utils/sortWallets.ts
1249
- var sortWallets = (w1, w2) => {
1250
- if (w1.platform !== w2.platform) {
1251
- return w1.platform === "polkadot" ? -1 : 1;
1252
- }
1253
- if (w1.name.toLowerCase() === "talisman") return -1;
1254
- if (w2.name.toLowerCase() === "talisman") return 1;
1255
- return w1.name.localeCompare(w2.name);
1256
- };
1257
188
 
1258
- // src/api/ethereum/wallets.ts
1259
- var import_mipd = require("mipd");
1260
- var import_rxjs8 = require("rxjs");
1261
- var providersDetails$ = new import_rxjs8.Observable(
1262
- (subscriber) => {
1263
- if (typeof window === "undefined") {
1264
- subscriber.next([]);
1265
- return () => {
1266
- };
1267
- }
1268
- const mipdStore = (0, import_mipd.createStore)();
1269
- const unsubscribe = mipdStore.subscribe((providerDetails2) => {
1270
- subscriber.next(providerDetails2);
1271
- });
1272
- const providerDetails = mipdStore.getProviders();
1273
- subscriber.next(providerDetails);
1274
- return () => {
1275
- unsubscribe();
1276
- mipdStore.destroy();
1277
- };
1278
- }
1279
- ).pipe((0, import_rxjs8.shareReplay)({ refCount: true, bufferSize: 1 }));
1280
- var createEthereumInjectedWallets$ = (store2) => new import_rxjs8.Observable((subscriber) => {
1281
- const enabledWalletIds$ = new import_rxjs8.BehaviorSubject(/* @__PURE__ */ new Set());
1282
- const connectWallet = async (walletId, provider) => {
1283
- if (enabledWalletIds$.value.has(walletId))
1284
- throw new Error(`Extension ${walletId} already connected`);
1285
- await provider.request({
1286
- method: "eth_requestAccounts"
1287
- });
1288
- const newSet = new Set(enabledWalletIds$.value);
1289
- newSet.add(walletId);
1290
- enabledWalletIds$.next(newSet);
1291
- store2.addEnabledWalletId(walletId);
1292
- };
1293
- const disconnectWallet = async (walletId) => {
1294
- if (!enabledWalletIds$.value.has(walletId))
1295
- throw new Error(`Extension ${walletId} is not connected`);
1296
- const newSet = new Set(enabledWalletIds$.value);
1297
- newSet.delete(walletId);
1298
- enabledWalletIds$.next(newSet);
1299
- store2.removeEnabledWalletId(walletId);
1300
- };
1301
- const sub = (0, import_rxjs8.combineLatest)([providersDetails$, enabledWalletIds$]).pipe(
1302
- (0, import_rxjs8.map)(([providerDetails, enabledWalletIds]) => {
1303
- return providerDetails.map((pd) => {
1304
- const walletId = getWalletId("ethereum", pd.info.rdns);
1305
- const provider = pd.provider;
1306
- return {
1307
- platform: "ethereum",
1308
- type: "injected",
1309
- id: walletId,
1310
- name: pd.info.name,
1311
- icon: pd.info.icon,
1312
- provider,
1313
- isConnected: enabledWalletIds.has(walletId),
1314
- providerId: pd.info.rdns,
1315
- connect: () => connectWallet(walletId, provider),
1316
- disconnect: () => disconnectWallet(walletId)
1317
- };
1318
- });
1319
- }),
1320
- (0, import_rxjs8.distinctUntilChanged)(walletsEqual)
1321
- ).subscribe(subscriber);
1322
- return () => {
1323
- sub.unsubscribe();
1324
- };
1325
- }).pipe((0, import_rxjs8.shareReplay)({ refCount: true, bufferSize: 1 }));
1326
- var getEthereumWallets$ = (config, store2 = store) => {
1327
- return new import_rxjs8.Observable((subscriber) => {
1328
- const subscription = (0, import_rxjs8.combineLatest)([
1329
- createEthereumInjectedWallets$(store2),
1330
- getAppKitWallets$(config)?.pipe((0, import_rxjs8.map)((w) => w.ethereum))
1331
- ]).pipe(
1332
- (0, import_rxjs8.map)(
1333
- ([injectedWallets, appKitWallet]) => appKitWallet ? [...injectedWallets, appKitWallet] : injectedWallets
1334
- )
1335
- ).subscribe(subscriber);
1336
- return () => {
1337
- subscription.unsubscribe();
1338
- };
1339
- }).pipe((0, import_rxjs8.shareReplay)({ refCount: true, bufferSize: 1 }));
1340
- };
1341
- var walletsEqual = (a, b) => {
1342
- if (a.length !== b.length) return false;
1343
- return a.every(
1344
- (w, i) => w.id === b[i]?.id && w.isConnected === b[i]?.isConnected && w.name === b[i]?.name
1345
- );
1346
- };
1347
189
 
1348
- // src/api/polkadot/wallets.ts
1349
- var import_lodash_es2 = require("lodash-es");
1350
- var import_pjs_signer2 = require("polkadot-api/pjs-signer");
1351
- var import_rxjs9 = require("rxjs");
1352
- var getInjectedWalletsIds = () => typeof window === "undefined" ? [] : (0, import_pjs_signer2.getInjectedExtensions)().map((name) => getWalletId("polkadot", name));
1353
- var createWalletIdsPoller$ = () => {
1354
- return new import_rxjs9.Observable((subscriber) => {
1355
- subscriber.next(getInjectedWalletsIds());
1356
- const intervals = [100, 200, 300, 500];
1357
- let index = 0;
1358
- const poll = () => {
1359
- subscriber.next(getInjectedWalletsIds());
1360
- if (index < intervals.length) {
1361
- const delay = intervals[index++];
1362
- setTimeout(poll, delay);
1363
- }
1364
- };
1365
- if (intervals.length > 0) {
1366
- setTimeout(poll, intervals[index++] ?? 100);
1367
- }
1368
- return () => {
1369
- };
1370
- }).pipe(
1371
- (0, import_rxjs9.distinctUntilChanged)(import_lodash_es2.isEqual),
1372
- (0, import_rxjs9.shareReplay)({ refCount: true, bufferSize: 1 })
1373
- );
1374
- };
1375
- var createPolkadotInjectedWallets$ = (store2) => new import_rxjs9.Observable((subscriber) => {
1376
- const enabledExtensions$ = new import_rxjs9.BehaviorSubject(/* @__PURE__ */ new Map());
1377
- const connect = async (walletId) => {
1378
- if (enabledExtensions$.value.has(walletId))
1379
- throw new Error(`Extension ${walletId} already connected`);
1380
- const { identifier } = parseWalletId(walletId);
1381
- const extension = await (0, import_pjs_signer2.connectInjectedExtension)(identifier);
1382
- const newMap = new Map(enabledExtensions$.value);
1383
- newMap.set(walletId, extension);
1384
- enabledExtensions$.next(newMap);
1385
- store2.addEnabledWalletId(walletId);
1386
- };
1387
- const disconnect = (walletId) => {
1388
- if (!enabledExtensions$.value.has(walletId))
1389
- throw new Error(`Extension ${walletId} is not connected`);
1390
- const newMap = new Map(enabledExtensions$.value);
1391
- newMap.delete(walletId);
1392
- enabledExtensions$.next(newMap);
1393
- store2.removeEnabledWalletId(walletId);
1394
- };
1395
- const walletIds$ = createWalletIdsPoller$();
1396
- const subscription = (0, import_rxjs9.combineLatest)([walletIds$, enabledExtensions$]).pipe(
1397
- (0, import_rxjs9.map)(([walletIds, enabledExtensions]) => {
1398
- return walletIds.map((id) => {
1399
- const { identifier } = parseWalletId(id);
1400
- const extension = enabledExtensions.get(id);
1401
- const extInfo = POLKADOT_EXTENSIONS[identifier];
1402
- return {
1403
- id,
1404
- type: "injected",
1405
- platform: "polkadot",
1406
- name: extInfo?.name ?? identifier,
1407
- icon: extInfo?.icon ?? "",
1408
- extensionId: identifier,
1409
- extension,
1410
- isConnected: !!extension,
1411
- connect: () => connect(id),
1412
- disconnect: () => disconnect(id)
1413
- };
1414
- });
1415
- }),
1416
- (0, import_rxjs9.distinctUntilChanged)(walletsEqual2)
1417
- ).subscribe(subscriber);
1418
- return () => {
1419
- subscription.unsubscribe();
1420
- };
1421
- }).pipe((0, import_rxjs9.shareReplay)({ refCount: true, bufferSize: 1 }));
1422
- var getPolkadotWallets$ = (config, store2 = store) => {
1423
- return new import_rxjs9.Observable((subscriber) => {
1424
- const subscription = (0, import_rxjs9.combineLatest)([
1425
- createPolkadotInjectedWallets$(store2),
1426
- getAppKitWallets$(config)?.pipe((0, import_rxjs9.map)((w) => w.polkadot))
1427
- ]).pipe(
1428
- (0, import_rxjs9.map)(
1429
- ([injectedWallets, appKitWallet]) => appKitWallet ? [...injectedWallets, appKitWallet] : injectedWallets
1430
- )
1431
- ).subscribe(subscriber);
1432
- return () => {
1433
- subscription.unsubscribe();
1434
- };
1435
- }).pipe((0, import_rxjs9.shareReplay)({ refCount: true, bufferSize: 1 }));
1436
- };
1437
- var walletsEqual2 = (a, b) => {
1438
- if (a.length !== b.length) return false;
1439
- return a.every(
1440
- (w, i) => w.id === b[i]?.id && w.isConnected === b[i]?.isConnected && w.name === b[i]?.name
1441
- );
1442
- };
1443
190
 
1444
- // src/api/wallets.ts
1445
- var getWallets$ = (config, store2 = store) => {
191
+
192
+
193
+
194
+
195
+
196
+
197
+ var getWallets$ = (config, store2 = _chunkNU46D4MZjs.store) => {
1446
198
  const autoReconnectWalletIds$ = store2.observable.pipe(
1447
- (0, import_rxjs10.map)((s) => s.autoReconnect ?? []),
1448
- (0, import_rxjs10.take)(1),
1449
- (0, import_rxjs10.shareReplay)({ bufferSize: 1, refCount: true })
199
+ _rxjs.map.call(void 0, (s) => _nullishCoalesce(s.autoReconnect, () => ( []))),
200
+ _rxjs.take.call(void 0, 1),
201
+ _rxjs.shareReplay.call(void 0, { bufferSize: 1, refCount: true })
1450
202
  );
1451
- return new import_rxjs10.Observable((subscriber) => {
203
+ return new (0, _rxjs.Observable)((subscriber) => {
204
+ const ctx = { config, store: store2 };
1452
205
  const observables = config.platforms.map(
1453
- (platform) => {
1454
- switch (platform) {
1455
- case "polkadot":
1456
- return getPolkadotWallets$(config, store2);
1457
- case "ethereum":
1458
- return getEthereumWallets$(config, store2);
1459
- }
1460
- }
206
+ (plugin) => plugin.getWallets$(ctx)
1461
207
  );
1462
- const wallets$ = observables.length ? (0, import_rxjs10.combineLatest)(observables).pipe(
1463
- (0, import_rxjs10.map)((wallets) => wallets.flat().sort(sortWallets))
208
+ const wallets$ = observables.length ? _rxjs.combineLatest.call(void 0, observables).pipe(
209
+ _rxjs.map.call(void 0, (wallets) => wallets.flat().sort(_chunkTMAPQWW2js.sortWallets))
1464
210
  // Note: No startWith([]) here - the hydration buffer handles initial state
1465
- ) : (0, import_rxjs10.of)([]);
211
+ ) : _rxjs.of.call(void 0, []);
1466
212
  const reconnectingWallets = /* @__PURE__ */ new Set();
1467
- const subAutoReconnect = (0, import_rxjs10.combineLatest)([wallets$, autoReconnectWalletIds$]).pipe(
1468
- (0, import_rxjs10.filter)(([, walletIds]) => config.autoReconnect && !!walletIds?.length),
1469
- (0, import_rxjs10.mergeMap)(
1470
- ([wallets, walletIds]) => wallets.filter((wallet) => walletIds?.includes(wallet.id))
1471
- ),
1472
- (0, import_rxjs10.distinct)((w) => w.id)
213
+ const reconnectedWallets = /* @__PURE__ */ new Set();
214
+ const subAutoReconnect = _rxjs.combineLatest.call(void 0, [wallets$, autoReconnectWalletIds$]).pipe(
215
+ _rxjs.filter.call(void 0, ([, walletIds]) => config.autoReconnect && !!_optionalChain([walletIds, 'optionalAccess', _ => _.length])),
216
+ _rxjs.mergeMap.call(void 0,
217
+ ([wallets, walletIds]) => wallets.filter((wallet) => _optionalChain([walletIds, 'optionalAccess', _2 => _2.includes, 'call', _3 => _3(wallet.id)]))
218
+ )
1473
219
  ).subscribe(async (wallet) => {
1474
- if (wallet.isConnected || reconnectingWallets.has(wallet.id)) {
220
+ if (wallet.isConnected || reconnectingWallets.has(wallet.id) || reconnectedWallets.has(wallet.id)) {
1475
221
  return;
1476
222
  }
1477
223
  reconnectingWallets.add(wallet.id);
1478
224
  try {
1479
225
  await wallet.connect();
226
+ reconnectedWallets.add(wallet.id);
1480
227
  } catch (err) {
1481
228
  console.error("Failed to reconnect wallet %s", wallet.id, { err });
1482
229
  } finally {
@@ -1488,13 +235,13 @@ var getWallets$ = (config, store2 = store) => {
1488
235
  subAutoReconnect.unsubscribe();
1489
236
  subWallets.unsubscribe();
1490
237
  };
1491
- }).pipe((0, import_rxjs10.shareReplay)({ refCount: true, bufferSize: 1 }));
238
+ }).pipe(_rxjs.shareReplay.call(void 0, { refCount: true, bufferSize: 1 }));
1492
239
  };
1493
240
 
1494
241
  // src/api/kheopskit.ts
1495
242
  var getKheopskit$ = (config, ssrCookies, existingStore) => {
1496
- const kc = resolveConfig(config);
1497
- const store2 = existingStore ?? createKheopskitStore({ ssrCookies, storageKey: kc.storageKey });
243
+ const kc = _chunkNU46D4MZjs.resolveConfig.call(void 0, config);
244
+ const store2 = _nullishCoalesce(existingStore, () => ( _chunkNU46D4MZjs.createKheopskitStore.call(void 0, { ssrCookies, storageKey: kc.storageKey })));
1498
245
  if (kc.debug) console.debug("[kheopskit] config", kc);
1499
246
  if (kc.debug && typeof window === "undefined" && ssrCookies === void 0) {
1500
247
  console.warn(
@@ -1503,25 +250,23 @@ var getKheopskit$ = (config, ssrCookies, existingStore) => {
1503
250
  }
1504
251
  const cachedState = store2.getCachedState();
1505
252
  const cachedWallets = cachedState.wallets.map((w) => {
1506
- const wallet = hydrateWallet(w);
253
+ const wallet = _chunkTMAPQWW2js.hydrateWallet.call(void 0, w);
1507
254
  if (!wallet.icon) {
1508
- const cachedIcon = getCachedIcon(wallet.id);
255
+ const cachedIcon = _chunkTMAPQWW2js.getCachedIcon.call(void 0, wallet.id);
1509
256
  if (cachedIcon) {
1510
257
  return { ...wallet, icon: cachedIcon };
1511
258
  }
1512
259
  }
1513
260
  return wallet;
1514
261
  });
1515
- const cachedAccounts = cachedState.accounts.map(hydrateAccount).filter(
1516
- (account) => account.platform !== "polkadot" || kc.polkadotAccountTypes.includes(account.type)
1517
- );
262
+ const cachedAccounts = cachedState.accounts.filter((cached) => _chunkTMAPQWW2js.acceptsCachedAccount.call(void 0, cached, kc.platforms)).map(_chunkTMAPQWW2js.hydrateAccount);
1518
263
  if (kc.debug && cachedWallets.length > 0) {
1519
264
  console.debug("[kheopskit] hydrating from cache:", {
1520
265
  wallets: cachedWallets.length,
1521
266
  accounts: cachedAccounts.length
1522
267
  });
1523
268
  }
1524
- return new import_rxjs11.Observable((subscriber) => {
269
+ return new (0, _rxjs.Observable)((subscriber) => {
1525
270
  const liveWallets$ = getWallets$(kc, store2);
1526
271
  const liveAccounts$ = getAccounts$(kc, liveWallets$);
1527
272
  const bufferedWallets$ = createHydrationBuffer(
@@ -1543,7 +288,7 @@ var getKheopskit$ = (config, ssrCookies, existingStore) => {
1543
288
  (live, cached) => ({
1544
289
  ...cached,
1545
290
  // Priority: cached icon > localStorage cache > live icon
1546
- icon: cached.icon || getCachedIcon(cached.id) || live.icon,
291
+ icon: cached.icon || _chunkTMAPQWW2js.getCachedIcon.call(void 0, cached.id) || live.icon,
1547
292
  // Use live wallet's connect/disconnect functions
1548
293
  connect: live.connect,
1549
294
  disconnect: live.disconnect
@@ -1551,7 +296,7 @@ var getKheopskit$ = (config, ssrCookies, existingStore) => {
1551
296
  // Transform cached-only items: add icon from localStorage cache
1552
297
  (cached) => ({
1553
298
  ...cached,
1554
- icon: cached.icon || getCachedIcon(cached.id) || ""
299
+ icon: cached.icon || _chunkTMAPQWW2js.getCachedIcon.call(void 0, cached.id) || ""
1555
300
  })
1556
301
  );
1557
302
  const bufferedAccounts$ = createAccountHydrationBuffer(
@@ -1567,11 +312,17 @@ var getKheopskit$ = (config, ssrCookies, existingStore) => {
1567
312
  return [...cachedWalletIds].every((id) => liveWalletIds.has(id));
1568
313
  }
1569
314
  );
1570
- const subscription = (0, import_rxjs11.combineLatest)({
1571
- wallets: bufferedWallets$,
1572
- accounts: bufferedAccounts$
315
+ const sharedWallets$ = bufferedWallets$.pipe(
316
+ _rxjs.shareReplay.call(void 0, { bufferSize: 1, refCount: true })
317
+ );
318
+ const sharedAccounts$ = bufferedAccounts$.pipe(
319
+ _rxjs.shareReplay.call(void 0, { bufferSize: 1, refCount: true })
320
+ );
321
+ const subscription = _rxjs.combineLatest.call(void 0, {
322
+ wallets: sharedWallets$,
323
+ accounts: sharedAccounts$
1573
324
  }).pipe(
1574
- (0, import_rxjs11.map)(({ wallets, accounts }) => {
325
+ _rxjs.map.call(void 0, ({ wallets, accounts }) => {
1575
326
  if (kc.debug) {
1576
327
  console.debug("[kheopskit] hydration state", {
1577
328
  walletsHydrating: wallets.isHydrating,
@@ -1582,24 +333,24 @@ var getKheopskit$ = (config, ssrCookies, existingStore) => {
1582
333
  }
1583
334
  return {
1584
335
  config: kc,
1585
- wallets: wallets.items,
1586
- accounts: accounts.items,
336
+ wallets: [...wallets.items].sort(_chunkTMAPQWW2js.sortWallets),
337
+ accounts: [...accounts.items].sort(_chunkTMAPQWW2js.sortAccounts),
1587
338
  isHydrating: wallets.isHydrating || accounts.isHydrating
1588
339
  };
1589
340
  })
1590
341
  ).subscribe(subscriber);
1591
- const persistSub = (0, import_rxjs11.combineLatest)({
1592
- wallets: bufferedWallets$,
1593
- accounts: bufferedAccounts$
342
+ const persistSub = _rxjs.combineLatest.call(void 0, {
343
+ wallets: sharedWallets$,
344
+ accounts: sharedAccounts$
1594
345
  }).pipe(
1595
346
  // Wait for hydration to complete
1596
- (0, import_rxjs11.filter)(
347
+ _rxjs.filter.call(void 0,
1597
348
  ({ wallets, accounts }) => !wallets.isHydrating && !accounts.isHydrating
1598
349
  ),
1599
350
  // Debounce to avoid excessive writes
1600
- (0, import_rxjs11.debounceTime)(1e3),
351
+ _rxjs.debounceTime.call(void 0, 1e3),
1601
352
  // Only persist if state actually changed
1602
- (0, import_rxjs11.distinctUntilChanged)((prev, curr) => {
353
+ _rxjs.distinctUntilChanged.call(void 0, (prev, curr) => {
1603
354
  const prevWalletIds = prev.wallets.items.map((w) => w.id);
1604
355
  const currWalletIds = curr.wallets.items.map((w) => w.id);
1605
356
  const prevAccountIds = prev.accounts.items.map((a) => a.id);
@@ -1620,8 +371,8 @@ var getKheopskit$ = (config, ssrCookies, existingStore) => {
1620
371
  });
1621
372
  }
1622
373
  store2.setCachedState(
1623
- wallets.items.map(serializeWallet),
1624
- relevantAccounts.map(serializeAccount)
374
+ wallets.items.map(_chunkTMAPQWW2js.serializeWallet),
375
+ relevantAccounts.map(_chunkTMAPQWW2js.serializeAccount)
1625
376
  );
1626
377
  const icons = {};
1627
378
  for (const wallet of wallets.items) {
@@ -1629,39 +380,54 @@ var getKheopskit$ = (config, ssrCookies, existingStore) => {
1629
380
  icons[wallet.id] = wallet.icon;
1630
381
  }
1631
382
  }
1632
- setCachedIcons(icons);
383
+ _chunkTMAPQWW2js.setCachedIcons.call(void 0, icons);
1633
384
  });
1634
385
  return () => {
1635
386
  subscription.unsubscribe();
1636
387
  persistSub.unsubscribe();
1637
388
  };
1638
389
  }).pipe(
1639
- (0, import_rxjs11.distinctUntilChanged)(statesEqual),
1640
- (0, import_rxjs11.throttleTime)(16, void 0, { leading: true, trailing: true }),
390
+ _rxjs.distinctUntilChanged.call(void 0, statesEqual),
391
+ _rxjs.throttleTime.call(void 0, 16, void 0, { leading: true, trailing: true }),
1641
392
  // ~1 frame at 60fps
1642
393
  logObservable("kheopskit$", { enabled: kc.debug, printValue: true }),
1643
- (0, import_rxjs11.shareReplay)({ bufferSize: 1, refCount: true })
394
+ _rxjs.shareReplay.call(void 0, { bufferSize: 1, refCount: true })
395
+ // The runtime objects are the concrete per-plugin wallet/account types;
396
+ // recover the precise KheopskitState<P> the caller's plugins imply.
1644
397
  );
1645
398
  };
1646
399
  var arraysEqual = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
1647
400
  var statesEqual = (a, b) => a.isHydrating === b.isHydrating && a.wallets.length === b.wallets.length && a.accounts.length === b.accounts.length && a.wallets.every(
1648
- (w, i) => w.id === b.wallets[i]?.id && w.isConnected === b.wallets[i]?.isConnected
1649
- ) && a.accounts.every(
1650
- (acc, i) => acc.id === b.accounts[i]?.id && (acc.platform !== "ethereum" || acc.chainId === b.accounts[i]?.chainId)
1651
- );
1652
- // Annotate the CommonJS export names for ESM import in node:
1653
- 0 && (module.exports = {
1654
- DEFAULT_STORAGE_KEY,
1655
- clearAllCachedObservables,
1656
- clearCachedObservable,
1657
- createKheopskitStore,
1658
- getCachedIcon,
1659
- getDefaultStore,
1660
- getKheopskit$,
1661
- getSafeLocalStorage,
1662
- hydrateAccount,
1663
- hydrateWallet,
1664
- resetAppKitCache,
1665
- resolveConfig
401
+ (w, i) => w.id === _optionalChain([b, 'access', _4 => _4.wallets, 'access', _5 => _5[i], 'optionalAccess', _6 => _6.id]) && w.isConnected === _optionalChain([b, 'access', _7 => _7.wallets, 'access', _8 => _8[i], 'optionalAccess', _9 => _9.isConnected])
402
+ ) && a.accounts.every((acc, i) => {
403
+ const other = b.accounts[i];
404
+ if (acc.id !== _optionalChain([other, 'optionalAccess', _10 => _10.id])) return false;
405
+ switch (acc.platform) {
406
+ case "ethereum":
407
+ return acc.chainId === other.chainId;
408
+ case "polkadot":
409
+ return acc.type === other.type;
410
+ case "solana":
411
+ return arraysEqual(
412
+ _nullishCoalesce(acc.chains, () => ( [])),
413
+ _nullishCoalesce(other.chains, () => ( []))
414
+ );
415
+ default:
416
+ return true;
417
+ }
1666
418
  });
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+
432
+ exports.DEFAULT_STORAGE_KEY = _chunkNU46D4MZjs.DEFAULT_STORAGE_KEY; exports.KheopskitError = _chunkNU46D4MZjs.KheopskitError; exports.clearAllCachedObservables = _chunkSIUWQBT4js.clearAllCachedObservables; exports.createKheopskitStore = _chunkNU46D4MZjs.createKheopskitStore; exports.getDefaultStore = _chunkNU46D4MZjs.getDefaultStore; exports.getKheopskit$ = getKheopskit$; exports.getWalletAccountId = _chunkNU46D4MZjs.getWalletAccountId; exports.getWalletId = _chunkSIUWQBT4js.getWalletId; exports.isValidAddress = _chunkNU46D4MZjs.isValidAddress; exports.parseWalletId = _chunkSIUWQBT4js.parseWalletId; exports.resetAppKitCache = _chunkNU46D4MZjs.resetAppKitCache; exports.resolveConfig = _chunkNU46D4MZjs.resolveConfig;
1667
433
  //# sourceMappingURL=index.js.map