@kheopskit/core 0.1.0 → 0.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.
- package/dist/index.d.mts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +137 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +128 -83
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -17,6 +17,30 @@ declare const clearCachedObservable: (key: string) => void;
|
|
|
17
17
|
*/
|
|
18
18
|
declare const clearAllCachedObservables: () => void;
|
|
19
19
|
|
|
20
|
+
type Storage = {
|
|
21
|
+
getItem: (key: string) => string | null;
|
|
22
|
+
setItem: (key: string, value: string) => void;
|
|
23
|
+
removeItem: (key: string) => void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Extended storage interface with cross-tab sync support.
|
|
27
|
+
*/
|
|
28
|
+
type SyncableStorage = Storage & {
|
|
29
|
+
/**
|
|
30
|
+
* Subscribe to storage changes from other tabs.
|
|
31
|
+
* Returns an unsubscribe function.
|
|
32
|
+
*/
|
|
33
|
+
subscribe?: (key: string, callback: (value: string | null) => void) => () => void;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A safe localStorage wrapper that falls back to noopStorage
|
|
37
|
+
* when localStorage is not available (e.g., during SSR).
|
|
38
|
+
* Includes cross-tab sync via the native 'storage' event.
|
|
39
|
+
*
|
|
40
|
+
* Lazily initialized on first access to be SSR-safe.
|
|
41
|
+
*/
|
|
42
|
+
declare const getSafeLocalStorage: () => SyncableStorage;
|
|
43
|
+
|
|
20
44
|
type WalletAccountId = string;
|
|
21
45
|
|
|
22
46
|
type WalletId = string;
|
|
@@ -228,6 +252,13 @@ declare const createKheopskitStore: (options?: CreateKheopskitStoreOptions) => {
|
|
|
228
252
|
};
|
|
229
253
|
setCachedState: (wallets: CachedWallet[], accounts: CachedAccount[]) => void;
|
|
230
254
|
};
|
|
255
|
+
type KheopskitStore = ReturnType<typeof createKheopskitStore>;
|
|
256
|
+
/**
|
|
257
|
+
* Gets the default store, creating it on first access.
|
|
258
|
+
* Uses localStorage on client, noop on server.
|
|
259
|
+
* Lazily initialized to avoid SSR issues with module-level code.
|
|
260
|
+
*/
|
|
261
|
+
declare const getDefaultStore: () => KheopskitStore;
|
|
231
262
|
|
|
232
263
|
type KheopskitState = {
|
|
233
264
|
wallets: Wallet[];
|
|
@@ -244,4 +275,4 @@ type KheopskitState = {
|
|
|
244
275
|
};
|
|
245
276
|
declare const getKheopskit$: (config?: Partial<KheopskitConfig>, ssrCookies?: string, existingStore?: ReturnType<typeof createKheopskitStore>) => Observable<KheopskitState>;
|
|
246
277
|
|
|
247
|
-
export { type CachedAccount, type CachedWallet, DEFAULT_STORAGE_KEY, type EthereumAccount, type EthereumAppKitWallet, type EthereumInjectedWallet, type EthereumWallet, type KheopskitConfig, type KheopskitState, type PolkadotAccount, type PolkadotAppKitWallet, type PolkadotInjectedWallet, type PolkadotWallet, type Wallet, type WalletAccount, type WalletPlatform, clearAllCachedObservables, clearCachedObservable, createKheopskitStore, getCachedIcon, getKheopskit$, hydrateAccount, hydrateWallet, resetAppKitCache, resolveConfig };
|
|
278
|
+
export { type CachedAccount, type CachedWallet, DEFAULT_STORAGE_KEY, type EthereumAccount, type EthereumAppKitWallet, type EthereumInjectedWallet, type EthereumWallet, type KheopskitConfig, type KheopskitState, type PolkadotAccount, type PolkadotAppKitWallet, type PolkadotInjectedWallet, type PolkadotWallet, type Wallet, type WalletAccount, type WalletPlatform, clearAllCachedObservables, clearCachedObservable, createKheopskitStore, getCachedIcon, getDefaultStore, getKheopskit$, getSafeLocalStorage, hydrateAccount, hydrateWallet, resetAppKitCache, resolveConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,30 @@ declare const clearCachedObservable: (key: string) => void;
|
|
|
17
17
|
*/
|
|
18
18
|
declare const clearAllCachedObservables: () => void;
|
|
19
19
|
|
|
20
|
+
type Storage = {
|
|
21
|
+
getItem: (key: string) => string | null;
|
|
22
|
+
setItem: (key: string, value: string) => void;
|
|
23
|
+
removeItem: (key: string) => void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Extended storage interface with cross-tab sync support.
|
|
27
|
+
*/
|
|
28
|
+
type SyncableStorage = Storage & {
|
|
29
|
+
/**
|
|
30
|
+
* Subscribe to storage changes from other tabs.
|
|
31
|
+
* Returns an unsubscribe function.
|
|
32
|
+
*/
|
|
33
|
+
subscribe?: (key: string, callback: (value: string | null) => void) => () => void;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A safe localStorage wrapper that falls back to noopStorage
|
|
37
|
+
* when localStorage is not available (e.g., during SSR).
|
|
38
|
+
* Includes cross-tab sync via the native 'storage' event.
|
|
39
|
+
*
|
|
40
|
+
* Lazily initialized on first access to be SSR-safe.
|
|
41
|
+
*/
|
|
42
|
+
declare const getSafeLocalStorage: () => SyncableStorage;
|
|
43
|
+
|
|
20
44
|
type WalletAccountId = string;
|
|
21
45
|
|
|
22
46
|
type WalletId = string;
|
|
@@ -228,6 +252,13 @@ declare const createKheopskitStore: (options?: CreateKheopskitStoreOptions) => {
|
|
|
228
252
|
};
|
|
229
253
|
setCachedState: (wallets: CachedWallet[], accounts: CachedAccount[]) => void;
|
|
230
254
|
};
|
|
255
|
+
type KheopskitStore = ReturnType<typeof createKheopskitStore>;
|
|
256
|
+
/**
|
|
257
|
+
* Gets the default store, creating it on first access.
|
|
258
|
+
* Uses localStorage on client, noop on server.
|
|
259
|
+
* Lazily initialized to avoid SSR issues with module-level code.
|
|
260
|
+
*/
|
|
261
|
+
declare const getDefaultStore: () => KheopskitStore;
|
|
231
262
|
|
|
232
263
|
type KheopskitState = {
|
|
233
264
|
wallets: Wallet[];
|
|
@@ -244,4 +275,4 @@ type KheopskitState = {
|
|
|
244
275
|
};
|
|
245
276
|
declare const getKheopskit$: (config?: Partial<KheopskitConfig>, ssrCookies?: string, existingStore?: ReturnType<typeof createKheopskitStore>) => Observable<KheopskitState>;
|
|
246
277
|
|
|
247
|
-
export { type CachedAccount, type CachedWallet, DEFAULT_STORAGE_KEY, type EthereumAccount, type EthereumAppKitWallet, type EthereumInjectedWallet, type EthereumWallet, type KheopskitConfig, type KheopskitState, type PolkadotAccount, type PolkadotAppKitWallet, type PolkadotInjectedWallet, type PolkadotWallet, type Wallet, type WalletAccount, type WalletPlatform, clearAllCachedObservables, clearCachedObservable, createKheopskitStore, getCachedIcon, getKheopskit$, hydrateAccount, hydrateWallet, resetAppKitCache, resolveConfig };
|
|
278
|
+
export { type CachedAccount, type CachedWallet, DEFAULT_STORAGE_KEY, type EthereumAccount, type EthereumAppKitWallet, type EthereumInjectedWallet, type EthereumWallet, type KheopskitConfig, type KheopskitState, type PolkadotAccount, type PolkadotAppKitWallet, type PolkadotInjectedWallet, type PolkadotWallet, type Wallet, type WalletAccount, type WalletPlatform, clearAllCachedObservables, clearCachedObservable, createKheopskitStore, getCachedIcon, getDefaultStore, getKheopskit$, getSafeLocalStorage, hydrateAccount, hydrateWallet, resetAppKitCache, resolveConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
8
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
11
|
};
|
|
10
|
-
var __copyProps = (to,
|
|
11
|
-
if (
|
|
12
|
-
for (let key of __getOwnPropNames(
|
|
12
|
+
var __copyProps = (to, from2, except, desc) => {
|
|
13
|
+
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from2))
|
|
13
15
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () =>
|
|
16
|
+
__defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -25,7 +35,9 @@ __export(index_exports, {
|
|
|
25
35
|
clearCachedObservable: () => clearCachedObservable,
|
|
26
36
|
createKheopskitStore: () => createKheopskitStore,
|
|
27
37
|
getCachedIcon: () => getCachedIcon,
|
|
38
|
+
getDefaultStore: () => getDefaultStore,
|
|
28
39
|
getKheopskit$: () => getKheopskit$,
|
|
40
|
+
getSafeLocalStorage: () => getSafeLocalStorage,
|
|
29
41
|
hydrateAccount: () => hydrateAccount,
|
|
30
42
|
hydrateWallet: () => hydrateWallet,
|
|
31
43
|
resetAppKitCache: () => resetAppKitCache,
|
|
@@ -188,7 +200,8 @@ var noopStorage = {
|
|
|
188
200
|
removeItem: () => {
|
|
189
201
|
}
|
|
190
202
|
};
|
|
191
|
-
var
|
|
203
|
+
var _safeLocalStorage = null;
|
|
204
|
+
var createSafeLocalStorage = () => {
|
|
192
205
|
if (typeof window === "undefined") return noopStorage;
|
|
193
206
|
try {
|
|
194
207
|
const testKey = "__kheopskit_test__";
|
|
@@ -211,7 +224,23 @@ var safeLocalStorage = (() => {
|
|
|
211
224
|
} catch {
|
|
212
225
|
return noopStorage;
|
|
213
226
|
}
|
|
214
|
-
}
|
|
227
|
+
};
|
|
228
|
+
var getSafeLocalStorage = () => {
|
|
229
|
+
if (_safeLocalStorage === null) {
|
|
230
|
+
_safeLocalStorage = createSafeLocalStorage();
|
|
231
|
+
}
|
|
232
|
+
return _safeLocalStorage;
|
|
233
|
+
};
|
|
234
|
+
var safeLocalStorage = {
|
|
235
|
+
getItem: (key) => getSafeLocalStorage().getItem(key),
|
|
236
|
+
setItem: (key, value) => getSafeLocalStorage().setItem(key, value),
|
|
237
|
+
removeItem: (key) => getSafeLocalStorage().removeItem(key),
|
|
238
|
+
subscribe: (key, callback) => {
|
|
239
|
+
const storage = getSafeLocalStorage();
|
|
240
|
+
return storage.subscribe?.(key, callback) ?? (() => {
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
};
|
|
215
244
|
var parseCookie = (cookieString, key) => {
|
|
216
245
|
if (!cookieString) return null;
|
|
217
246
|
for (const cookie of cookieString.split(";")) {
|
|
@@ -333,8 +362,11 @@ var setCachedIcons = (icons) => {
|
|
|
333
362
|
};
|
|
334
363
|
|
|
335
364
|
// src/api/appKit.ts
|
|
336
|
-
var import_core = require("@reown/appkit/core");
|
|
337
365
|
var import_rxjs = require("rxjs");
|
|
366
|
+
var loadAppKit = async () => {
|
|
367
|
+
const { createAppKit } = await import("@reown/appkit/core");
|
|
368
|
+
return createAppKit;
|
|
369
|
+
};
|
|
338
370
|
var WALLET_CONNECT_ICON = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjQwMCIgdmlld0JveD0iMCAwIDQwMCA0MDAiIHdpZHRoPSI0MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxjbGlwUGF0aCBpZD0iYSI+PHBhdGggZD0ibTAgMGg0MDB2NDAwaC00MDB6Ii8+PC9jbGlwUGF0aD48ZyBjbGlwLXBhdGg9InVybCgjYSkiPjxjaXJjbGUgY3g9IjIwMCIgY3k9IjIwMCIgZmlsbD0iIzMzOTZmZiIgcj0iMTk5LjUiIHN0cm9rZT0iIzY2YjFmZiIvPjxwYXRoIGQ9Im0xMjIuNTE5IDE0OC45NjVjNDIuNzkxLTQxLjcyOSAxMTIuMTcxLTQxLjcyOSAxNTQuOTYyIDBsNS4xNSA1LjAyMmMyLjE0IDIuMDg2IDIuMTQgNS40NjkgMCA3LjU1NWwtMTcuNjE3IDE3LjE4Yy0xLjA3IDEuMDQzLTIuODA0IDEuMDQzLTMuODc0IDBsLTcuMDg3LTYuOTExYy0yOS44NTMtMjkuMTExLTc4LjI1My0yOS4xMTEtMTA4LjEwNiAwbC03LjU5IDcuNDAxYy0xLjA3IDEuMDQzLTIuODA0IDEuMDQzLTMuODc0IDBsLTE3LjYxNy0xNy4xOGMtMi4xNC0yLjA4Ni0yLjE0LTUuNDY5IDAtNy41NTV6bTE5MS4zOTcgMzUuNTI5IDE1LjY3OSAxNS4yOWMyLjE0IDIuMDg2IDIuMTQgNS40NjkgMCA3LjU1NWwtNzAuNyA2OC45NDRjLTIuMTM5IDIuMDg3LTUuNjA4IDIuMDg3LTcuNzQ4IDBsLTUwLjE3OC00OC45MzFjLS41MzUtLjUyMi0xLjQwMi0uNTIyLTEuOTM3IDBsLTUwLjE3OCA0OC45MzFjLTIuMTM5IDIuMDg3LTUuNjA4IDIuMDg3LTcuNzQ4IDBsLTcwLjcwMTUtNjguOTQ1Yy0yLjEzOTYtMi4wODYtMi4xMzk2LTUuNDY5IDAtNy41NTVsMTUuNjc5NS0xNS4yOWMyLjEzOTYtMi4wODYgNS42MDg1LTIuMDg2IDcuNzQ4MSAwbDUwLjE3ODkgNDguOTMyYy41MzUuNTIyIDEuNDAyLjUyMiAxLjkzNyAwbDUwLjE3Ny00OC45MzJjMi4xMzktMi4wODcgNS42MDgtMi4wODcgNy43NDggMGw1MC4xNzkgNDguOTMyYy41MzUuNTIyIDEuNDAyLjUyMiAxLjkzNyAwbDUwLjE3OS00OC45MzFjMi4xMzktMi4wODcgNS42MDgtMi4wODcgNy43NDggMHoiIGZpbGw9IiNmZmYiLz48L2c+PC9zdmc+";
|
|
339
371
|
var cachedAppKit = null;
|
|
340
372
|
var resetAppKitCache = () => {
|
|
@@ -342,84 +374,90 @@ var resetAppKitCache = () => {
|
|
|
342
374
|
};
|
|
343
375
|
var getAppKitWallets$ = (config) => {
|
|
344
376
|
if (!config.walletConnect) return (0, import_rxjs.of)({});
|
|
377
|
+
if (typeof window === "undefined") return (0, import_rxjs.of)({});
|
|
345
378
|
const walletConnect = config.walletConnect;
|
|
346
379
|
if (!cachedAppKit) {
|
|
347
|
-
cachedAppKit =
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
debug: config.debug,
|
|
361
|
-
allowUnsupportedChain: true
|
|
362
|
-
});
|
|
363
|
-
const status$ = new import_rxjs.BehaviorSubject({
|
|
364
|
-
isPolkadotConnected: false,
|
|
365
|
-
isEthereumConnected: false
|
|
366
|
-
});
|
|
367
|
-
const unsubProviders = appKit.subscribeProviders((providers) => {
|
|
368
|
-
status$.next({
|
|
369
|
-
isPolkadotConnected: !!providers.polkadot,
|
|
370
|
-
isEthereumConnected: !!providers.eip155
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
const polkadotWallet$ = appKit.chainNamespaces.includes("polkadot") ? status$.pipe(
|
|
374
|
-
(0, import_rxjs.map)((s) => s.isPolkadotConnected),
|
|
375
|
-
(0, import_rxjs.distinctUntilChanged)(),
|
|
376
|
-
(0, import_rxjs.map)((isConnected) => {
|
|
377
|
-
const walletInfo = appKit.getWalletInfo();
|
|
378
|
-
return {
|
|
379
|
-
id: getWalletId("polkadot", "walletconnect"),
|
|
380
|
-
platform: "polkadot",
|
|
381
|
-
type: "appKit",
|
|
382
|
-
appKit,
|
|
383
|
-
// todo maybe we dont want to expose the appKit instance
|
|
384
|
-
name: walletInfo?.name ?? "WalletConnect",
|
|
385
|
-
icon: walletInfo?.icon ?? WALLET_CONNECT_ICON,
|
|
386
|
-
connect: async () => {
|
|
387
|
-
if (!isConnected) await appKit.open();
|
|
388
|
-
},
|
|
389
|
-
disconnect: () => {
|
|
390
|
-
if (isConnected) appKit.disconnect();
|
|
380
|
+
cachedAppKit = (0, import_rxjs.from)(loadAppKit()).pipe(
|
|
381
|
+
(0, import_rxjs.switchMap)((createAppKit) => {
|
|
382
|
+
return new import_rxjs.Observable((subscriber) => {
|
|
383
|
+
const appKit = createAppKit({
|
|
384
|
+
projectId: walletConnect.projectId,
|
|
385
|
+
metadata: walletConnect.metadata,
|
|
386
|
+
networks: walletConnect.networks,
|
|
387
|
+
themeMode: walletConnect.themeMode,
|
|
388
|
+
themeVariables: walletConnect.themeVariables,
|
|
389
|
+
universalProviderConfigOverride: {
|
|
390
|
+
methods: {
|
|
391
|
+
polkadot: ["polkadot_signTransaction", "polkadot_signMessage"]
|
|
392
|
+
}
|
|
391
393
|
},
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
394
|
+
allWallets: "HIDE",
|
|
395
|
+
debug: config.debug,
|
|
396
|
+
allowUnsupportedChain: true
|
|
397
|
+
});
|
|
398
|
+
const status$ = new import_rxjs.BehaviorSubject({
|
|
399
|
+
isPolkadotConnected: false,
|
|
400
|
+
isEthereumConnected: false
|
|
401
|
+
});
|
|
402
|
+
const unsubProviders = appKit.subscribeProviders((providers) => {
|
|
403
|
+
status$.next({
|
|
404
|
+
isPolkadotConnected: !!providers.polkadot,
|
|
405
|
+
isEthereumConnected: !!providers.eip155
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
const polkadotWallet$ = appKit.chainNamespaces.includes("polkadot") ? status$.pipe(
|
|
409
|
+
(0, import_rxjs.map)((s) => s.isPolkadotConnected),
|
|
410
|
+
(0, import_rxjs.distinctUntilChanged)(),
|
|
411
|
+
(0, import_rxjs.map)((isConnected) => {
|
|
412
|
+
const walletInfo = appKit.getWalletInfo();
|
|
413
|
+
return {
|
|
414
|
+
id: getWalletId("polkadot", "walletconnect"),
|
|
415
|
+
platform: "polkadot",
|
|
416
|
+
type: "appKit",
|
|
417
|
+
appKit,
|
|
418
|
+
// todo maybe we dont want to expose the appKit instance
|
|
419
|
+
name: walletInfo?.name ?? "WalletConnect",
|
|
420
|
+
icon: walletInfo?.icon ?? WALLET_CONNECT_ICON,
|
|
421
|
+
connect: async () => {
|
|
422
|
+
if (!isConnected) await appKit.open();
|
|
423
|
+
},
|
|
424
|
+
disconnect: () => {
|
|
425
|
+
if (isConnected) appKit.disconnect();
|
|
426
|
+
},
|
|
427
|
+
isConnected
|
|
428
|
+
};
|
|
429
|
+
})
|
|
430
|
+
) : (0, import_rxjs.of)(void 0);
|
|
431
|
+
const ethereumWallet$ = appKit.chainNamespaces.includes("eip155") ? status$.pipe(
|
|
432
|
+
(0, import_rxjs.map)((s) => s.isEthereumConnected),
|
|
433
|
+
(0, import_rxjs.distinctUntilChanged)(),
|
|
434
|
+
(0, import_rxjs.map)((isConnected) => {
|
|
435
|
+
const walletInfo = appKit.getWalletInfo();
|
|
436
|
+
return {
|
|
437
|
+
id: getWalletId("ethereum", "walletconnect"),
|
|
438
|
+
platform: "ethereum",
|
|
439
|
+
type: "appKit",
|
|
440
|
+
appKit,
|
|
441
|
+
name: walletInfo?.name ?? "WalletConnect",
|
|
442
|
+
icon: walletInfo?.icon ?? WALLET_CONNECT_ICON,
|
|
443
|
+
connect: () => appKit.open(),
|
|
444
|
+
disconnect: () => appKit.disconnect(),
|
|
445
|
+
isConnected
|
|
446
|
+
};
|
|
447
|
+
})
|
|
448
|
+
) : (0, import_rxjs.of)(void 0);
|
|
449
|
+
const sub = (0, import_rxjs.combineLatest)({
|
|
450
|
+
polkadot: polkadotWallet$,
|
|
451
|
+
ethereum: ethereumWallet$
|
|
452
|
+
}).subscribe(subscriber);
|
|
453
|
+
return () => {
|
|
454
|
+
sub.unsubscribe();
|
|
455
|
+
unsubProviders();
|
|
411
456
|
};
|
|
412
|
-
})
|
|
413
|
-
)
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
ethereum: ethereumWallet$
|
|
417
|
-
}).subscribe(subscriber);
|
|
418
|
-
return () => {
|
|
419
|
-
sub.unsubscribe();
|
|
420
|
-
unsubProviders();
|
|
421
|
-
};
|
|
422
|
-
}).pipe((0, import_rxjs.shareReplay)({ refCount: true, bufferSize: 1 }));
|
|
457
|
+
});
|
|
458
|
+
}),
|
|
459
|
+
(0, import_rxjs.shareReplay)({ refCount: true, bufferSize: 1 })
|
|
460
|
+
);
|
|
423
461
|
}
|
|
424
462
|
return cachedAppKit;
|
|
425
463
|
};
|
|
@@ -967,7 +1005,22 @@ var createKheopskitStore = (options = {}) => {
|
|
|
967
1005
|
setCachedState
|
|
968
1006
|
};
|
|
969
1007
|
};
|
|
970
|
-
var
|
|
1008
|
+
var _defaultStore = null;
|
|
1009
|
+
var getDefaultStore = () => {
|
|
1010
|
+
if (_defaultStore === null) {
|
|
1011
|
+
_defaultStore = createKheopskitStore();
|
|
1012
|
+
}
|
|
1013
|
+
return _defaultStore;
|
|
1014
|
+
};
|
|
1015
|
+
var store = {
|
|
1016
|
+
get observable() {
|
|
1017
|
+
return getDefaultStore().observable;
|
|
1018
|
+
},
|
|
1019
|
+
addEnabledWalletId: (walletId) => getDefaultStore().addEnabledWalletId(walletId),
|
|
1020
|
+
removeEnabledWalletId: (walletId) => getDefaultStore().removeEnabledWalletId(walletId),
|
|
1021
|
+
getCachedState: () => getDefaultStore().getCachedState(),
|
|
1022
|
+
setCachedState: (wallets, accounts) => getDefaultStore().setCachedState(wallets, accounts)
|
|
1023
|
+
};
|
|
971
1024
|
var isCompactStore = (value) => {
|
|
972
1025
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
973
1026
|
if ("cachedWallets" in value || "cachedAccounts" in value) return false;
|
|
@@ -1487,7 +1540,9 @@ var statesEqual = (a, b) => a.isHydrating === b.isHydrating && a.wallets.length
|
|
|
1487
1540
|
clearCachedObservable,
|
|
1488
1541
|
createKheopskitStore,
|
|
1489
1542
|
getCachedIcon,
|
|
1543
|
+
getDefaultStore,
|
|
1490
1544
|
getKheopskit$,
|
|
1545
|
+
getSafeLocalStorage,
|
|
1491
1546
|
hydrateAccount,
|
|
1492
1547
|
hydrateWallet,
|
|
1493
1548
|
resetAppKitCache,
|