@kheopskit/core 5.3.0 → 6.0.0-rc.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/CHANGELOG.md +432 -0
- package/MIGRATING_TO_V6.md +840 -0
- package/README.md +629 -12
- package/dist/ethereum.d.mts +12 -6
- package/dist/ethereum.d.ts +12 -6
- package/dist/ethereum.js +13 -10
- package/dist/ethereum.js.map +1 -1
- package/dist/ethereum.mjs +7 -4
- package/dist/ethereum.mjs.map +1 -1
- package/dist/{iconCache-pP2ES4pJ.mjs → iconCache-C-U3IEbP.mjs} +21 -40
- package/dist/iconCache-C-U3IEbP.mjs.map +1 -0
- package/dist/{iconCache-DUtkJlaX.js → iconCache-FR4iy6go.js} +21 -40
- package/dist/iconCache-FR4iy6go.js.map +1 -0
- package/dist/index.d.mts +17 -63
- package/dist/index.d.ts +17 -63
- package/dist/index.js +387 -373
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +384 -369
- package/dist/index.mjs.map +1 -1
- package/dist/injectedWallets-48L-AL1I.mjs +173 -0
- package/dist/injectedWallets-48L-AL1I.mjs.map +1 -0
- package/dist/injectedWallets-Dy8YGKL-.js +178 -0
- package/dist/injectedWallets-Dy8YGKL-.js.map +1 -0
- package/dist/internal.d.mts +3 -27
- package/dist/internal.d.ts +3 -27
- package/dist/internal.js +2 -2
- package/dist/internal.mjs +2 -2
- package/dist/pageLoad-BZ7o8p5R.mjs +24 -0
- package/dist/pageLoad-BZ7o8p5R.mjs.map +1 -0
- package/dist/pageLoad-D1wLeuFG.js +28 -0
- package/dist/pageLoad-D1wLeuFG.js.map +1 -0
- package/dist/platformAccounts-BjIeRcFN.js +321 -0
- package/dist/platformAccounts-BjIeRcFN.js.map +1 -0
- package/dist/platformAccounts-yyRUrnel.mjs +256 -0
- package/dist/platformAccounts-yyRUrnel.mjs.map +1 -0
- package/dist/polkadot.d.mts +127 -11
- package/dist/polkadot.d.ts +127 -11
- package/dist/polkadot.js +187 -106
- package/dist/polkadot.js.map +1 -1
- package/dist/polkadot.mjs +180 -99
- package/dist/polkadot.mjs.map +1 -1
- package/dist/solana.d.mts +11 -5
- package/dist/solana.d.ts +11 -5
- package/dist/solana.js +18 -15
- package/dist/solana.js.map +1 -1
- package/dist/solana.mjs +7 -4
- package/dist/solana.mjs.map +1 -1
- package/dist/storage-D3AwNgqc.d.mts +27 -0
- package/dist/storage-D3AwNgqc.d.ts +27 -0
- package/dist/testing.d.mts +71 -0
- package/dist/testing.d.ts +71 -0
- package/dist/testing.js +136 -0
- package/dist/testing.js.map +1 -0
- package/dist/testing.mjs +131 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/{types-DKU-SNio.js → types-BWHvNFlN.js} +149 -2
- package/dist/types-BWHvNFlN.js.map +1 -0
- package/dist/types-Yor672md.mjs +215 -0
- package/dist/types-Yor672md.mjs.map +1 -0
- package/dist/types-lkMXVJNG.d.mts +685 -0
- package/dist/types-lkMXVJNG.d.ts +685 -0
- package/dist/walletconnect.d.mts +41 -0
- package/dist/walletconnect.d.ts +41 -0
- package/dist/walletconnect.js +219 -0
- package/dist/walletconnect.js.map +1 -0
- package/dist/walletconnect.mjs +216 -0
- package/dist/walletconnect.mjs.map +1 -0
- package/package.json +30 -6
- package/dist/errors-BLFP1dQI.mjs +0 -181
- package/dist/errors-BLFP1dQI.mjs.map +0 -1
- package/dist/errors-DYWVPHrR.js +0 -222
- package/dist/errors-DYWVPHrR.js.map +0 -1
- package/dist/iconCache-DUtkJlaX.js.map +0 -1
- package/dist/iconCache-pP2ES4pJ.mjs.map +0 -1
- package/dist/injectedWallets-BqR-_aAy.js +0 -148
- package/dist/injectedWallets-BqR-_aAy.js.map +0 -1
- package/dist/injectedWallets-Uz4hPuoW.mjs +0 -119
- package/dist/injectedWallets-Uz4hPuoW.mjs.map +0 -1
- package/dist/types-AxUDtkR-.d.mts +0 -338
- package/dist/types-AxUDtkR-.d.ts +0 -338
- package/dist/types-DKU-SNio.js.map +0 -1
- package/dist/types-jnifAAA0.mjs +0 -104
- package/dist/types-jnifAAA0.mjs.map +0 -1
package/dist/types-AxUDtkR-.d.ts
DELETED
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
import { Observable } from "rxjs";
|
|
2
|
-
//#region src/utils/WalletAccountId.d.ts
|
|
3
|
-
type WalletAccountId = string;
|
|
4
|
-
declare const getWalletAccountId: (walletId: string, address: string) => WalletAccountId;
|
|
5
|
-
declare const parseWalletAccountId: (accountId: string) => {
|
|
6
|
-
walletId: string;
|
|
7
|
-
address: string;
|
|
8
|
-
};
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/utils/WalletId.d.ts
|
|
11
|
-
type WalletId = string;
|
|
12
|
-
declare const getWalletId: (platform: WalletPlatform, identifier: string) => WalletId;
|
|
13
|
-
declare const parseWalletId: (walletId: string) => {
|
|
14
|
-
platform: WalletPlatform;
|
|
15
|
-
identifier: string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Non-throwing variant of {@link parseWalletId}. Use when validating untrusted
|
|
19
|
-
* input (e.g. cached state persisted by an older version) before parsing.
|
|
20
|
-
*/
|
|
21
|
-
declare const isValidWalletId: (walletId: unknown) => walletId is WalletId;
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/api/types.d.ts
|
|
24
|
-
type WalletPlatform = "polkadot" | "ethereum" | "solana";
|
|
25
|
-
/**
|
|
26
|
-
* Minimal structural view of a WalletConnect `UniversalProvider` — the subset
|
|
27
|
-
* kheopskit reads. Declared locally so core never depends on
|
|
28
|
-
* `@walletconnect/universal-provider`. The concrete instance comes from
|
|
29
|
-
* `@reown/appkit` at runtime.
|
|
30
|
-
*/
|
|
31
|
-
type WalletConnectProvider = {
|
|
32
|
-
session?: {
|
|
33
|
-
topic: string;
|
|
34
|
-
namespaces: Record<string, {
|
|
35
|
-
accounts?: string[];
|
|
36
|
-
}>;
|
|
37
|
-
};
|
|
38
|
-
client: {
|
|
39
|
-
request<T = unknown>(args: {
|
|
40
|
-
topic: string;
|
|
41
|
-
chainId: string;
|
|
42
|
-
request: {
|
|
43
|
-
method: string;
|
|
44
|
-
params: unknown;
|
|
45
|
-
};
|
|
46
|
-
}): Promise<T>;
|
|
47
|
-
};
|
|
48
|
-
request(args: {
|
|
49
|
-
method: string;
|
|
50
|
-
params?: unknown;
|
|
51
|
-
}): Promise<unknown>;
|
|
52
|
-
on(event: string, listener: (...args: unknown[]) => void): void;
|
|
53
|
-
off(event: string, listener: (...args: unknown[]) => void): void;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Minimal structural view of the Reown AppKit instance — the subset kheopskit's
|
|
57
|
-
* account factories use. Exposed as the `appKit` escape hatch on AppKit wallets;
|
|
58
|
-
* cast it to `@reown/appkit`'s `AppKit` type for the full API. Declared locally
|
|
59
|
-
* so core never depends on `@reown/appkit`'s types (it's an optional peer).
|
|
60
|
-
*/
|
|
61
|
-
type AppKitInstance = {
|
|
62
|
-
getProvider<T = WalletConnectProvider>(namespace: string): T | undefined;
|
|
63
|
-
getAccount(namespace: string): {
|
|
64
|
-
allAccounts: {
|
|
65
|
-
address: string;
|
|
66
|
-
}[];
|
|
67
|
-
} | undefined;
|
|
68
|
-
getCaipNetworks(namespace: string): {
|
|
69
|
-
caipNetworkId?: string;
|
|
70
|
-
}[];
|
|
71
|
-
};
|
|
72
|
-
type WalletType = "injected" | "walletconnect";
|
|
73
|
-
type PolkadotAccountType = "sr25519" | "ed25519" | "ecdsa" | "ethereum";
|
|
74
|
-
/**
|
|
75
|
-
* SDK-free fields common to every wallet, regardless of platform. Platform
|
|
76
|
-
* packages (`@kheopskit/core/<platform>`) extend this with SDK-typed fields
|
|
77
|
-
* (the injected provider/extension/standard-wallet handle).
|
|
78
|
-
*/
|
|
79
|
-
type BaseWallet = {
|
|
80
|
-
id: WalletId;
|
|
81
|
-
platform: WalletPlatform;
|
|
82
|
-
type: WalletType;
|
|
83
|
-
name: string;
|
|
84
|
-
icon: string;
|
|
85
|
-
isConnected: boolean;
|
|
86
|
-
connect: () => Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* Disconnect the wallet. Resolves once the underlying provider/extension
|
|
89
|
-
* disconnect completes; rejects if it fails so callers can surface or retry.
|
|
90
|
-
*/
|
|
91
|
-
disconnect: () => Promise<void>;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* SDK-free fields common to every account, regardless of platform. Platform
|
|
95
|
-
* packages extend this with their SDK-typed signer/client.
|
|
96
|
-
*/
|
|
97
|
-
type BaseWalletAccount = {
|
|
98
|
-
id: WalletAccountId;
|
|
99
|
-
platform: WalletPlatform;
|
|
100
|
-
/** Base58 (Solana), SS58 (Polkadot) or 0x-hex (Ethereum) address. */
|
|
101
|
-
address: string;
|
|
102
|
-
/** Friendly account name, when the wallet exposes one (e.g. Polkadot). */
|
|
103
|
-
name?: string;
|
|
104
|
-
walletName: string;
|
|
105
|
-
walletId: WalletId;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* The single WalletConnect connector, shared across every platform.
|
|
109
|
-
*
|
|
110
|
-
* Unlike injected wallets, it is **not tied to a platform**: one WalletConnect
|
|
111
|
-
* session spans whichever namespaces the remote wallet approves in a single
|
|
112
|
-
* pairing (a namespace can't be added to a live session afterwards). So there is
|
|
113
|
-
* exactly one of these in `wallets`, discriminated by `type: "walletconnect"`.
|
|
114
|
-
* Its accounts appear in `accounts`, each carrying its own `platform`.
|
|
115
|
-
*/
|
|
116
|
-
type WalletConnectWallet = {
|
|
117
|
-
id: WalletId;
|
|
118
|
-
type: "walletconnect";
|
|
119
|
-
/**
|
|
120
|
-
* Platforms (namespaces) the live session currently carries. Empty until
|
|
121
|
-
* connected; populated with whatever the wallet approved (e.g. just
|
|
122
|
-
* `["ethereum"]`, or `["polkadot", "ethereum"]`).
|
|
123
|
-
*/
|
|
124
|
-
platforms: WalletPlatform[];
|
|
125
|
-
/**
|
|
126
|
-
* Raw Reown AppKit instance, exposed as an escape hatch for advanced use
|
|
127
|
-
* (custom modal control, reading providers directly). Most consumers should
|
|
128
|
-
* use `connect`/`disconnect` and the derived accounts instead.
|
|
129
|
-
*/
|
|
130
|
-
appKit: AppKitInstance;
|
|
131
|
-
name: string;
|
|
132
|
-
icon: string;
|
|
133
|
-
isConnected: boolean;
|
|
134
|
-
connect: () => Promise<void>;
|
|
135
|
-
disconnect: () => Promise<void>;
|
|
136
|
-
};
|
|
137
|
-
/** Narrows a wallet to the platform-less {@link WalletConnectWallet}. */
|
|
138
|
-
declare const isWalletConnectWallet: (wallet: BaseWallet | WalletConnectWallet) => wallet is WalletConnectWallet;
|
|
139
|
-
/**
|
|
140
|
-
* Narrows a wallet to an injected (browser-extension / Wallet Standard) wallet —
|
|
141
|
-
* the complement of {@link isWalletConnectWallet}. `state.wallets` is
|
|
142
|
-
* `(InjectedWallet | WalletConnectWallet)[]`, so use this to recover the
|
|
143
|
-
* injected-only fields when iterating: `platform`, `sourceId`, and the SDK
|
|
144
|
-
* handle (`provider` on Ethereum, `extension` on Polkadot, `wallet` on Solana).
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* ```ts
|
|
148
|
-
* for (const wallet of wallets.filter(isInjectedWallet)) {
|
|
149
|
-
* console.log(wallet.platform, wallet.sourceId); // typed, no WC widening
|
|
150
|
-
* }
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
declare const isInjectedWallet: <W extends BaseWallet | WalletConnectWallet>(wallet: W) => wallet is Exclude<W, WalletConnectWallet>;
|
|
154
|
-
/**
|
|
155
|
-
* Dapp metadata shown in the WalletConnect modal. Mirrors WalletConnect's
|
|
156
|
-
* `Metadata`, declared locally so core doesn't depend on
|
|
157
|
-
* `@walletconnect/universal-provider`.
|
|
158
|
-
*/
|
|
159
|
-
type WalletConnectMetadata = {
|
|
160
|
-
name: string;
|
|
161
|
-
description: string;
|
|
162
|
-
url: string;
|
|
163
|
-
icons: string[];
|
|
164
|
-
};
|
|
165
|
-
type WalletConnectConfig = {
|
|
166
|
-
projectId: string;
|
|
167
|
-
metadata: WalletConnectMetadata;
|
|
168
|
-
/** Defaults to wss://relay.walletconnect.com */
|
|
169
|
-
relayUrl?: string;
|
|
170
|
-
/**
|
|
171
|
-
* Networks AppKit should enable. Pass `AppKitNetwork[]` from
|
|
172
|
-
* `@reown/appkit/networks` (see
|
|
173
|
-
* https://docs.reown.com/advanced/multichain/polkadot/dapp-integration-guide#walletconnect-code%2Fcomponent-setup).
|
|
174
|
-
* Loosely typed (`unknown`) so core doesn't depend on `@reown/appkit`'s
|
|
175
|
-
* types — the value is forwarded to AppKit as-is.
|
|
176
|
-
*/
|
|
177
|
-
networks: [unknown, ...unknown[]];
|
|
178
|
-
themeMode?: "light" | "dark";
|
|
179
|
-
themeVariables?: Record<string, string | number>;
|
|
180
|
-
};
|
|
181
|
-
/**
|
|
182
|
-
* Context passed to a platform plugin's `getWallets$`. Carries the shared store
|
|
183
|
-
* and the resolved core config (for WalletConnect / debug).
|
|
184
|
-
*/
|
|
185
|
-
type PlatformContext = {
|
|
186
|
-
store: KheopskitStore;
|
|
187
|
-
config: KheopskitConfig;
|
|
188
|
-
};
|
|
189
|
-
/**
|
|
190
|
-
* A platform plugin. Created by the per-platform factories exported from
|
|
191
|
-
* `@kheopskit/core/polkadot`, `/ethereum`, `/solana`. Core iterates plugins
|
|
192
|
-
* generically and never imports a platform SDK itself.
|
|
193
|
-
*
|
|
194
|
-
* @typeParam TPlatform - the platform discriminant
|
|
195
|
-
* @typeParam TWallet - the platform's wallet type (extends {@link BaseWallet})
|
|
196
|
-
* @typeParam TAccount - the platform's account type (extends {@link BaseWalletAccount})
|
|
197
|
-
*/
|
|
198
|
-
type KheopskitPlatform<TPlatform extends WalletPlatform = WalletPlatform, TWallet extends BaseWallet = BaseWallet, TAccount extends BaseWalletAccount = BaseWalletAccount> = {
|
|
199
|
-
readonly platform: TPlatform;
|
|
200
|
-
getWallets$(ctx: PlatformContext): Observable<TWallet[]>;
|
|
201
|
-
getAccounts$(wallets$: Observable<(TWallet | WalletConnectWallet)[]>): Observable<TAccount[]>;
|
|
202
|
-
/**
|
|
203
|
-
* Optional hydration filter. Cached accounts for which this returns false are
|
|
204
|
-
* dropped during SSR hydration (Polkadot uses it to honour `accountTypes`).
|
|
205
|
-
*/
|
|
206
|
-
acceptsCachedAccount?(cached: CachedAccount): boolean;
|
|
207
|
-
};
|
|
208
|
-
type ElementOf<T> = T extends readonly (infer E)[] ? E : never;
|
|
209
|
-
/** The account type produced by a plugin (inferred from its `getAccounts$`). */
|
|
210
|
-
type AccountOf<T> = T extends {
|
|
211
|
-
getAccounts$: (wallets$: never) => Observable<infer R>;
|
|
212
|
-
} ? ElementOf<R> : never;
|
|
213
|
-
/** The wallet type produced by a plugin (inferred from its `getWallets$`). */
|
|
214
|
-
type WalletOf<T> = T extends {
|
|
215
|
-
getWallets$: (ctx: never) => Observable<infer R>;
|
|
216
|
-
} ? ElementOf<R> : never;
|
|
217
|
-
type KheopskitConfig<P extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[]> = {
|
|
218
|
-
autoReconnect: boolean;
|
|
219
|
-
/**
|
|
220
|
-
* Platform plugins to enable, e.g. `[polkadot(), solana({ chain })]`.
|
|
221
|
-
* Import factories from `@kheopskit/core/<platform>`.
|
|
222
|
-
*/
|
|
223
|
-
platforms: P;
|
|
224
|
-
walletConnect?: WalletConnectConfig;
|
|
225
|
-
/**
|
|
226
|
-
* Dapp name sent to Polkadot injected extensions on connect. Some
|
|
227
|
-
* extensions (e.g. polkadot.js) warn about a suspicious origin when it's
|
|
228
|
-
* empty.
|
|
229
|
-
*
|
|
230
|
-
* @default walletConnect.metadata.name, then window.location.hostname
|
|
231
|
-
*/
|
|
232
|
-
appName?: string;
|
|
233
|
-
debug: boolean;
|
|
234
|
-
/**
|
|
235
|
-
* Custom storage key for persisting wallet connection state.
|
|
236
|
-
* Useful when running multiple kheopskit instances on the same domain
|
|
237
|
-
* to prevent state conflicts between different dapps.
|
|
238
|
-
*
|
|
239
|
-
* @default "kheopskit"
|
|
240
|
-
*/
|
|
241
|
-
storageKey: string;
|
|
242
|
-
/**
|
|
243
|
-
* Grace period in milliseconds to wait for wallets to inject before
|
|
244
|
-
* syncing to actual state. During this period, cached wallet/account
|
|
245
|
-
* state from storage is preserved to prevent UI flashing.
|
|
246
|
-
*
|
|
247
|
-
* Set to 0 to disable hydration buffering.
|
|
248
|
-
*
|
|
249
|
-
* @default 500
|
|
250
|
-
*/
|
|
251
|
-
hydrationGracePeriod: number;
|
|
252
|
-
};
|
|
253
|
-
/**
|
|
254
|
-
* The current kheopskit state.
|
|
255
|
-
*
|
|
256
|
-
* @remarks
|
|
257
|
-
* While {@link KheopskitState.isHydrating} is `true`, `wallets` and `accounts`
|
|
258
|
-
* may contain cached placeholders restored from storage. The **SDK handles** the
|
|
259
|
-
* platform types advertise (e.g. `account.signer` / `getSigner` on Solana,
|
|
260
|
-
* `account.client` on Ethereum, `wallet.provider` / `extension`) are **absent at
|
|
261
|
-
* runtime even though the types claim them**, and placeholder wallets throw if
|
|
262
|
-
* `connect`/`disconnect` is called. Guard all access to those behind
|
|
263
|
-
* `!isHydrating`.
|
|
264
|
-
*
|
|
265
|
-
* The plain, serializable platform data that is persisted in the cache IS
|
|
266
|
-
* restored on the placeholders (Ethereum `chainId`, Polkadot key `type`), so it
|
|
267
|
-
* renders immediately on reload without flashing. Solana `chains` is not cached,
|
|
268
|
-
* so it remains absent until the live account loads.
|
|
269
|
-
*/
|
|
270
|
-
type KheopskitState<P extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[]> = {
|
|
271
|
-
wallets: (WalletOf<P[number]> | WalletConnectWallet)[];
|
|
272
|
-
accounts: AccountOf<P[number]>[];
|
|
273
|
-
config: KheopskitConfig<P>;
|
|
274
|
-
/**
|
|
275
|
-
* Whether the state is still being hydrated from cache.
|
|
276
|
-
*
|
|
277
|
-
* During hydration, cached wallets/accounts may be displayed before the
|
|
278
|
-
* actual wallet extensions have injected. See the type-level remarks: while
|
|
279
|
-
* this is `true`, SDK-typed fields (signer/client/provider/extension) are not
|
|
280
|
-
* present at runtime — guard all access behind `!isHydrating`.
|
|
281
|
-
*/
|
|
282
|
-
isHydrating: boolean;
|
|
283
|
-
};
|
|
284
|
-
/** Shape of the persisted store data (localStorage, or cookies in compact form). */
|
|
285
|
-
type KheopskitStoreData = {
|
|
286
|
-
autoReconnect?: WalletId[];
|
|
287
|
-
/** Cached wallet state for SSR hydration to prevent UI flash */
|
|
288
|
-
cachedWallets?: CachedWallet[];
|
|
289
|
-
/** Cached account state for SSR hydration to prevent UI flash */
|
|
290
|
-
cachedAccounts?: CachedAccount[];
|
|
291
|
-
};
|
|
292
|
-
/**
|
|
293
|
-
* The persisted settings store shared between core and framework bindings.
|
|
294
|
-
* Declared structurally here (implemented by `createKheopskitStore`) so modules
|
|
295
|
-
* can depend on the interface without importing the implementation.
|
|
296
|
-
*/
|
|
297
|
-
type KheopskitStore = {
|
|
298
|
-
observable: Observable<KheopskitStoreData>;
|
|
299
|
-
addEnabledWalletId: (walletId: WalletId) => void;
|
|
300
|
-
removeEnabledWalletId: (walletId: WalletId) => void;
|
|
301
|
-
getCachedState: () => {
|
|
302
|
-
wallets: CachedWallet[];
|
|
303
|
-
accounts: CachedAccount[];
|
|
304
|
-
};
|
|
305
|
-
setCachedState: (wallets: CachedWallet[], accounts: CachedAccount[]) => void;
|
|
306
|
-
};
|
|
307
|
-
/**
|
|
308
|
-
* Serializable wallet data for SSR hydration cache.
|
|
309
|
-
* Contains only the data needed to render wallet UI without flash.
|
|
310
|
-
* Note: icon is NOT stored to save cookie space - it's looked up at hydration time.
|
|
311
|
-
*/
|
|
312
|
-
type CachedWallet = {
|
|
313
|
-
id: WalletId;
|
|
314
|
-
/** Absent for the platform-less WalletConnect connector. */
|
|
315
|
-
platform?: WalletPlatform;
|
|
316
|
-
type: WalletType;
|
|
317
|
-
name: string;
|
|
318
|
-
isConnected: boolean;
|
|
319
|
-
};
|
|
320
|
-
/**
|
|
321
|
-
* Serializable account data for SSR hydration cache.
|
|
322
|
-
* Contains only the data needed to render account UI without flash.
|
|
323
|
-
*/
|
|
324
|
-
type CachedAccount = {
|
|
325
|
-
id: string;
|
|
326
|
-
platform: WalletPlatform;
|
|
327
|
-
address: string;
|
|
328
|
-
name?: string;
|
|
329
|
-
/** Cached chain ID for Ethereum accounts. */
|
|
330
|
-
chainId?: number;
|
|
331
|
-
/** Cached key type for Polkadot accounts. */
|
|
332
|
-
polkadotAccountType?: PolkadotAccountType;
|
|
333
|
-
walletId: WalletId;
|
|
334
|
-
walletName: string;
|
|
335
|
-
};
|
|
336
|
-
//#endregion
|
|
337
|
-
export { WalletId as C, WalletAccountId as D, parseWalletId as E, getWalletAccountId as O, isWalletConnectWallet as S, isValidWalletId as T, WalletConnectWallet as _, CachedAccount as a, WalletType as b, KheopskitPlatform as c, KheopskitStoreData as d, PlatformContext as f, WalletConnectProvider as g, WalletConnectMetadata as h, BaseWalletAccount as i, parseWalletAccountId as k, KheopskitState as l, WalletConnectConfig as m, AppKitInstance as n, CachedWallet as o, PolkadotAccountType as p, BaseWallet as r, KheopskitConfig as s, AccountOf as t, KheopskitStore as u, WalletOf as v, getWalletId as w, isInjectedWallet as x, WalletPlatform as y };
|
|
338
|
-
//# sourceMappingURL=types-AxUDtkR-.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-DKU-SNio.js","names":[],"sources":["../src/utils/getCachedObservable.ts","../src/utils/isWalletPlatform.ts","../src/utils/WalletId.ts","../src/api/types.ts"],"sourcesContent":["import type { Observable } from \"rxjs\";\n\n// Anchored on globalThis so the cache stays a single instance even if the\n// module is duplicated across bundle chunks (e.g. CJS subpath entries).\nconst CACHE_SYMBOL = Symbol.for(\"kheopskit.observableCache\");\n\nconst getCache = (): Map<string, Observable<unknown>> => {\n\tconst g = globalThis as unknown as Record<\n\t\tsymbol,\n\t\tMap<string, Observable<unknown>> | undefined\n\t>;\n\tlet cache = g[CACHE_SYMBOL];\n\tif (!cache) {\n\t\tcache = new Map();\n\t\tg[CACHE_SYMBOL] = cache;\n\t}\n\treturn cache;\n};\n\nexport const getCachedObservable$ = <T, Obs = Observable<T>>(\n\tkey: string,\n\tcreate: () => Obs,\n): Obs => {\n\tconst cache = getCache();\n\tif (!cache.has(key)) cache.set(key, create() as Observable<unknown>);\n\n\treturn cache.get(key) as Obs;\n};\n\n/**\n * Clears an observable from the cache.\n * Use when a wallet disconnects or configuration changes.\n */\nexport const clearCachedObservable = (key: string): void => {\n\tgetCache().delete(key);\n};\n\n/**\n * Clears all cached observables whose key starts with `prefix`.\n *\n * Used to drop a wallet's account observables when it disconnects, so a later\n * reconnect rebuilds them against the current wallet handle instead of a stale\n * closure — and to keep the cache from growing unbounded across connect cycles.\n */\nexport const clearCachedObservablesByPrefix = (prefix: string): void => {\n\tconst cache = getCache();\n\tfor (const key of cache.keys()) {\n\t\tif (key.startsWith(prefix)) cache.delete(key);\n\t}\n};\n\n/**\n * Clears all cached observables.\n * Use when resetting the entire kheopskit state.\n */\nexport const clearAllCachedObservables = (): void => {\n\tgetCache().clear();\n};\n","import type { WalletPlatform } from \"../api/types\";\n\nexport const isWalletPlatform = (\n\tplatform: unknown,\n): platform is WalletPlatform =>\n\ttypeof platform === \"string\" &&\n\t[\"polkadot\", \"ethereum\", \"solana\"].includes(platform as WalletPlatform);\n","import type { WalletPlatform } from \"../api/types\";\nimport { isWalletPlatform } from \"./isWalletPlatform\";\n\nexport type WalletId = string;\n\n/**\n * Stable id of the single WalletConnect connector. It is platform-less: one WC\n * session spans whichever namespaces the wallet approves, so it isn't tied to a\n * platform (unlike injected wallet ids, which are `<platform>:<identifier>`).\n */\nexport const WALLET_CONNECT_WALLET_ID: WalletId = \"walletconnect\";\n\nexport const getWalletId = (\n\tplatform: WalletPlatform,\n\tidentifier: string,\n): WalletId => {\n\tif (!isWalletPlatform(platform)) throw new Error(\"Invalid platform\");\n\tif (!identifier) throw new Error(\"Invalid name\");\n\treturn `${platform}:${identifier}`;\n};\n\nexport const parseWalletId = (walletId: string) => {\n\tif (!walletId) throw new Error(\"Invalid walletId\");\n\tconst [platform, identifier] = walletId.split(\":\");\n\tif (!isWalletPlatform(platform)) throw new Error(\"Invalid platform\");\n\tif (!identifier) throw new Error(\"Invalid address\");\n\treturn { platform, identifier };\n};\n\n/**\n * Non-throwing variant of {@link parseWalletId}. Use when validating untrusted\n * input (e.g. cached state persisted by an older version) before parsing.\n */\nexport const isValidWalletId = (walletId: unknown): walletId is WalletId => {\n\tif (typeof walletId !== \"string\" || !walletId) return false;\n\tif (walletId === WALLET_CONNECT_WALLET_ID) return true;\n\tconst [platform, identifier] = walletId.split(\":\");\n\treturn isWalletPlatform(platform) && !!identifier;\n};\n","import type { Observable } from \"rxjs\";\nimport type { WalletAccountId } from \"../utils\";\nimport type { WalletId } from \"../utils/WalletId\";\n\nexport type WalletPlatform = \"polkadot\" | \"ethereum\" | \"solana\";\n\n/**\n * Minimal structural view of a WalletConnect `UniversalProvider` — the subset\n * kheopskit reads. Declared locally so core never depends on\n * `@walletconnect/universal-provider`. The concrete instance comes from\n * `@reown/appkit` at runtime.\n */\nexport type WalletConnectProvider = {\n\tsession?: {\n\t\ttopic: string;\n\t\tnamespaces: Record<string, { accounts?: string[] }>;\n\t};\n\tclient: {\n\t\trequest<T = unknown>(args: {\n\t\t\ttopic: string;\n\t\t\tchainId: string;\n\t\t\trequest: { method: string; params: unknown };\n\t\t}): Promise<T>;\n\t};\n\trequest(args: { method: string; params?: unknown }): Promise<unknown>;\n\ton(event: string, listener: (...args: unknown[]) => void): void;\n\toff(event: string, listener: (...args: unknown[]) => void): void;\n};\n\n/**\n * Minimal structural view of the Reown AppKit instance — the subset kheopskit's\n * account factories use. Exposed as the `appKit` escape hatch on AppKit wallets;\n * cast it to `@reown/appkit`'s `AppKit` type for the full API. Declared locally\n * so core never depends on `@reown/appkit`'s types (it's an optional peer).\n */\nexport type AppKitInstance = {\n\tgetProvider<T = WalletConnectProvider>(namespace: string): T | undefined;\n\tgetAccount(\n\t\tnamespace: string,\n\t): { allAccounts: { address: string }[] } | undefined;\n\tgetCaipNetworks(namespace: string): { caipNetworkId?: string }[];\n};\n\nexport type WalletType = \"injected\" | \"walletconnect\";\n\nexport type PolkadotAccountType = \"sr25519\" | \"ed25519\" | \"ecdsa\" | \"ethereum\";\n\n/**\n * SDK-free fields common to every wallet, regardless of platform. Platform\n * packages (`@kheopskit/core/<platform>`) extend this with SDK-typed fields\n * (the injected provider/extension/standard-wallet handle).\n */\nexport type BaseWallet = {\n\tid: WalletId;\n\tplatform: WalletPlatform;\n\ttype: WalletType;\n\tname: string;\n\ticon: string;\n\tisConnected: boolean;\n\tconnect: () => Promise<void>;\n\t/**\n\t * Disconnect the wallet. Resolves once the underlying provider/extension\n\t * disconnect completes; rejects if it fails so callers can surface or retry.\n\t */\n\tdisconnect: () => Promise<void>;\n};\n\n/**\n * SDK-free fields common to every account, regardless of platform. Platform\n * packages extend this with their SDK-typed signer/client.\n */\nexport type BaseWalletAccount = {\n\tid: WalletAccountId;\n\tplatform: WalletPlatform;\n\t/** Base58 (Solana), SS58 (Polkadot) or 0x-hex (Ethereum) address. */\n\taddress: string;\n\t/** Friendly account name, when the wallet exposes one (e.g. Polkadot). */\n\tname?: string;\n\twalletName: string;\n\twalletId: WalletId;\n};\n\n/**\n * The single WalletConnect connector, shared across every platform.\n *\n * Unlike injected wallets, it is **not tied to a platform**: one WalletConnect\n * session spans whichever namespaces the remote wallet approves in a single\n * pairing (a namespace can't be added to a live session afterwards). So there is\n * exactly one of these in `wallets`, discriminated by `type: \"walletconnect\"`.\n * Its accounts appear in `accounts`, each carrying its own `platform`.\n */\nexport type WalletConnectWallet = {\n\tid: WalletId;\n\ttype: \"walletconnect\";\n\t/**\n\t * Platforms (namespaces) the live session currently carries. Empty until\n\t * connected; populated with whatever the wallet approved (e.g. just\n\t * `[\"ethereum\"]`, or `[\"polkadot\", \"ethereum\"]`).\n\t */\n\tplatforms: WalletPlatform[];\n\t/**\n\t * Raw Reown AppKit instance, exposed as an escape hatch for advanced use\n\t * (custom modal control, reading providers directly). Most consumers should\n\t * use `connect`/`disconnect` and the derived accounts instead.\n\t */\n\tappKit: AppKitInstance;\n\tname: string;\n\ticon: string;\n\tisConnected: boolean;\n\tconnect: () => Promise<void>;\n\tdisconnect: () => Promise<void>;\n};\n\n/** Narrows a wallet to the platform-less {@link WalletConnectWallet}. */\nexport const isWalletConnectWallet = (\n\twallet: BaseWallet | WalletConnectWallet,\n): wallet is WalletConnectWallet => wallet.type === \"walletconnect\";\n\n/**\n * Narrows a wallet to an injected (browser-extension / Wallet Standard) wallet —\n * the complement of {@link isWalletConnectWallet}. `state.wallets` is\n * `(InjectedWallet | WalletConnectWallet)[]`, so use this to recover the\n * injected-only fields when iterating: `platform`, `sourceId`, and the SDK\n * handle (`provider` on Ethereum, `extension` on Polkadot, `wallet` on Solana).\n *\n * @example\n * ```ts\n * for (const wallet of wallets.filter(isInjectedWallet)) {\n * console.log(wallet.platform, wallet.sourceId); // typed, no WC widening\n * }\n * ```\n */\nexport const isInjectedWallet = <W extends BaseWallet | WalletConnectWallet>(\n\twallet: W,\n): wallet is Exclude<W, WalletConnectWallet> => wallet.type === \"injected\";\n\n/**\n * Dapp metadata shown in the WalletConnect modal. Mirrors WalletConnect's\n * `Metadata`, declared locally so core doesn't depend on\n * `@walletconnect/universal-provider`.\n */\nexport type WalletConnectMetadata = {\n\tname: string;\n\tdescription: string;\n\turl: string;\n\ticons: string[];\n};\n\nexport type WalletConnectConfig = {\n\tprojectId: string;\n\tmetadata: WalletConnectMetadata;\n\t/** Defaults to wss://relay.walletconnect.com */\n\trelayUrl?: string;\n\t/**\n\t * Networks AppKit should enable. Pass `AppKitNetwork[]` from\n\t * `@reown/appkit/networks` (see\n\t * https://docs.reown.com/advanced/multichain/polkadot/dapp-integration-guide#walletconnect-code%2Fcomponent-setup).\n\t * Loosely typed (`unknown`) so core doesn't depend on `@reown/appkit`'s\n\t * types — the value is forwarded to AppKit as-is.\n\t */\n\tnetworks: [unknown, ...unknown[]];\n\tthemeMode?: \"light\" | \"dark\";\n\tthemeVariables?: Record<string, string | number>;\n};\n\n/**\n * Context passed to a platform plugin's `getWallets$`. Carries the shared store\n * and the resolved core config (for WalletConnect / debug).\n */\nexport type PlatformContext = {\n\tstore: KheopskitStore;\n\tconfig: KheopskitConfig;\n};\n\n/**\n * A platform plugin. Created by the per-platform factories exported from\n * `@kheopskit/core/polkadot`, `/ethereum`, `/solana`. Core iterates plugins\n * generically and never imports a platform SDK itself.\n *\n * @typeParam TPlatform - the platform discriminant\n * @typeParam TWallet - the platform's wallet type (extends {@link BaseWallet})\n * @typeParam TAccount - the platform's account type (extends {@link BaseWalletAccount})\n */\nexport type KheopskitPlatform<\n\tTPlatform extends WalletPlatform = WalletPlatform,\n\tTWallet extends BaseWallet = BaseWallet,\n\tTAccount extends BaseWalletAccount = BaseWalletAccount,\n> = {\n\treadonly platform: TPlatform;\n\t// Declared as methods (not arrow properties) so parameters are checked\n\t// bivariantly — this lets a specific `KheopskitPlatform<\"polkadot\", …>` be\n\t// assigned to the base `KheopskitPlatform` despite the contravariant\n\t// `wallets$` parameter.\n\tgetWallets$(ctx: PlatformContext): Observable<TWallet[]>;\n\t// Receives this platform's (injected) wallets plus the shared, platform-less\n\t// WalletConnect connector — the plugin derives its injected accounts and, if\n\t// the WC session carries its namespace, its WalletConnect accounts.\n\tgetAccounts$(\n\t\twallets$: Observable<(TWallet | WalletConnectWallet)[]>,\n\t): Observable<TAccount[]>;\n\t/**\n\t * Optional hydration filter. Cached accounts for which this returns false are\n\t * dropped during SSR hydration (Polkadot uses it to honour `accountTypes`).\n\t */\n\tacceptsCachedAccount?(cached: CachedAccount): boolean;\n};\n\ntype ElementOf<T> = T extends readonly (infer E)[] ? E : never;\n\n/** The account type produced by a plugin (inferred from its `getAccounts$`). */\nexport type AccountOf<T> = T extends {\n\tgetAccounts$: (wallets$: never) => Observable<infer R>;\n}\n\t? ElementOf<R>\n\t: never;\n\n/** The wallet type produced by a plugin (inferred from its `getWallets$`). */\nexport type WalletOf<T> = T extends {\n\tgetWallets$: (ctx: never) => Observable<infer R>;\n}\n\t? ElementOf<R>\n\t: never;\n\nexport type KheopskitConfig<\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n> = {\n\tautoReconnect: boolean;\n\t/**\n\t * Platform plugins to enable, e.g. `[polkadot(), solana({ chain })]`.\n\t * Import factories from `@kheopskit/core/<platform>`.\n\t */\n\tplatforms: P;\n\twalletConnect?: WalletConnectConfig;\n\t/**\n\t * Dapp name sent to Polkadot injected extensions on connect. Some\n\t * extensions (e.g. polkadot.js) warn about a suspicious origin when it's\n\t * empty.\n\t *\n\t * @default walletConnect.metadata.name, then window.location.hostname\n\t */\n\tappName?: string;\n\tdebug: boolean;\n\t/**\n\t * Custom storage key for persisting wallet connection state.\n\t * Useful when running multiple kheopskit instances on the same domain\n\t * to prevent state conflicts between different dapps.\n\t *\n\t * @default \"kheopskit\"\n\t */\n\tstorageKey: string;\n\t/**\n\t * Grace period in milliseconds to wait for wallets to inject before\n\t * syncing to actual state. During this period, cached wallet/account\n\t * state from storage is preserved to prevent UI flashing.\n\t *\n\t * Set to 0 to disable hydration buffering.\n\t *\n\t * @default 500\n\t */\n\thydrationGracePeriod: number;\n};\n\n/**\n * The current kheopskit state.\n *\n * @remarks\n * While {@link KheopskitState.isHydrating} is `true`, `wallets` and `accounts`\n * may contain cached placeholders restored from storage. The **SDK handles** the\n * platform types advertise (e.g. `account.signer` / `getSigner` on Solana,\n * `account.client` on Ethereum, `wallet.provider` / `extension`) are **absent at\n * runtime even though the types claim them**, and placeholder wallets throw if\n * `connect`/`disconnect` is called. Guard all access to those behind\n * `!isHydrating`.\n *\n * The plain, serializable platform data that is persisted in the cache IS\n * restored on the placeholders (Ethereum `chainId`, Polkadot key `type`), so it\n * renders immediately on reload without flashing. Solana `chains` is not cached,\n * so it remains absent until the live account loads.\n */\nexport type KheopskitState<\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n> = {\n\twallets: (WalletOf<P[number]> | WalletConnectWallet)[];\n\taccounts: AccountOf<P[number]>[];\n\tconfig: KheopskitConfig<P>;\n\t/**\n\t * Whether the state is still being hydrated from cache.\n\t *\n\t * During hydration, cached wallets/accounts may be displayed before the\n\t * actual wallet extensions have injected. See the type-level remarks: while\n\t * this is `true`, SDK-typed fields (signer/client/provider/extension) are not\n\t * present at runtime — guard all access behind `!isHydrating`.\n\t */\n\tisHydrating: boolean;\n};\n\n/** Shape of the persisted store data (localStorage, or cookies in compact form). */\nexport type KheopskitStoreData = {\n\tautoReconnect?: WalletId[];\n\t/** Cached wallet state for SSR hydration to prevent UI flash */\n\tcachedWallets?: CachedWallet[];\n\t/** Cached account state for SSR hydration to prevent UI flash */\n\tcachedAccounts?: CachedAccount[];\n};\n\n/**\n * The persisted settings store shared between core and framework bindings.\n * Declared structurally here (implemented by `createKheopskitStore`) so modules\n * can depend on the interface without importing the implementation.\n */\nexport type KheopskitStore = {\n\tobservable: Observable<KheopskitStoreData>;\n\taddEnabledWalletId: (walletId: WalletId) => void;\n\tremoveEnabledWalletId: (walletId: WalletId) => void;\n\tgetCachedState: () => { wallets: CachedWallet[]; accounts: CachedAccount[] };\n\tsetCachedState: (wallets: CachedWallet[], accounts: CachedAccount[]) => void;\n};\n\n/**\n * Serializable wallet data for SSR hydration cache.\n * Contains only the data needed to render wallet UI without flash.\n * Note: icon is NOT stored to save cookie space - it's looked up at hydration time.\n */\nexport type CachedWallet = {\n\tid: WalletId;\n\t/** Absent for the platform-less WalletConnect connector. */\n\tplatform?: WalletPlatform;\n\ttype: WalletType;\n\tname: string;\n\tisConnected: boolean;\n};\n\n/**\n * Serializable account data for SSR hydration cache.\n * Contains only the data needed to render account UI without flash.\n */\nexport type CachedAccount = {\n\tid: string;\n\tplatform: WalletPlatform;\n\taddress: string;\n\tname?: string;\n\t/** Cached chain ID for Ethereum accounts. */\n\tchainId?: number;\n\t/** Cached key type for Polkadot accounts. */\n\tpolkadotAccountType?: PolkadotAccountType;\n\twalletId: WalletId;\n\twalletName: string;\n};\n"],"mappings":";AAIA,MAAM,eAAe,OAAO,IAAI,2BAA2B;AAE3D,MAAM,iBAAmD;CACxD,MAAM,IAAI;CAIV,IAAI,QAAQ,EAAE;CACd,IAAI,CAAC,OAAO;EACX,wBAAQ,IAAI,IAAI;EAChB,EAAE,gBAAgB;CACnB;CACA,OAAO;AACR;AAEA,MAAa,wBACZ,KACA,WACS;CACT,MAAM,QAAQ,SAAS;CACvB,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,KAAK,OAAO,CAAwB;CAEnE,OAAO,MAAM,IAAI,GAAG;AACrB;;;;;AAMA,MAAa,yBAAyB,QAAsB;CAC3D,SAAS,CAAC,CAAC,OAAO,GAAG;AACtB;;;;;;;;AASA,MAAa,kCAAkC,WAAyB;CACvE,MAAM,QAAQ,SAAS;CACvB,KAAK,MAAM,OAAO,MAAM,KAAK,GAC5B,IAAI,IAAI,WAAW,MAAM,GAAG,MAAM,OAAO,GAAG;AAE9C;;;;;AAMA,MAAa,kCAAwC;CACpD,SAAS,CAAC,CAAC,MAAM;AAClB;;;ACvDA,MAAa,oBACZ,aAEA,OAAO,aAAa,YACpB;CAAC;CAAY;CAAY;AAAQ,CAAC,CAAC,SAAS,QAA0B;;;;;;;;ACIvE,MAAa,2BAAqC;AAElD,MAAa,eACZ,UACA,eACc;CACd,IAAI,CAAC,iBAAiB,QAAQ,GAAG,MAAM,IAAI,MAAM,kBAAkB;CACnE,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,cAAc;CAC/C,OAAO,GAAG,SAAS,GAAG;AACvB;AAEA,MAAa,iBAAiB,aAAqB;CAClD,IAAI,CAAC,UAAU,MAAM,IAAI,MAAM,kBAAkB;CACjD,MAAM,CAAC,UAAU,cAAc,SAAS,MAAM,GAAG;CACjD,IAAI,CAAC,iBAAiB,QAAQ,GAAG,MAAM,IAAI,MAAM,kBAAkB;CACnE,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,iBAAiB;CAClD,OAAO;EAAE;EAAU;CAAW;AAC/B;;;;;AAMA,MAAa,mBAAmB,aAA4C;CAC3E,IAAI,OAAO,aAAa,YAAY,CAAC,UAAU,OAAO;CACtD,IAAI,aAAA,iBAAuC,OAAO;CAClD,MAAM,CAAC,UAAU,cAAc,SAAS,MAAM,GAAG;CACjD,OAAO,iBAAiB,QAAQ,KAAK,CAAC,CAAC;AACxC;;;;AC4EA,MAAa,yBACZ,WACmC,OAAO,SAAS;;;;;;;;;;;;;;;AAgBpD,MAAa,oBACZ,WAC+C,OAAO,SAAS"}
|
package/dist/types-jnifAAA0.mjs
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
//#region src/utils/getCachedObservable.ts
|
|
2
|
-
const CACHE_SYMBOL = Symbol.for("kheopskit.observableCache");
|
|
3
|
-
const getCache = () => {
|
|
4
|
-
const g = globalThis;
|
|
5
|
-
let cache = g[CACHE_SYMBOL];
|
|
6
|
-
if (!cache) {
|
|
7
|
-
cache = /* @__PURE__ */ new Map();
|
|
8
|
-
g[CACHE_SYMBOL] = cache;
|
|
9
|
-
}
|
|
10
|
-
return cache;
|
|
11
|
-
};
|
|
12
|
-
const getCachedObservable$ = (key, create) => {
|
|
13
|
-
const cache = getCache();
|
|
14
|
-
if (!cache.has(key)) cache.set(key, create());
|
|
15
|
-
return cache.get(key);
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Clears an observable from the cache.
|
|
19
|
-
* Use when a wallet disconnects or configuration changes.
|
|
20
|
-
*/
|
|
21
|
-
const clearCachedObservable = (key) => {
|
|
22
|
-
getCache().delete(key);
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Clears all cached observables whose key starts with `prefix`.
|
|
26
|
-
*
|
|
27
|
-
* Used to drop a wallet's account observables when it disconnects, so a later
|
|
28
|
-
* reconnect rebuilds them against the current wallet handle instead of a stale
|
|
29
|
-
* closure — and to keep the cache from growing unbounded across connect cycles.
|
|
30
|
-
*/
|
|
31
|
-
const clearCachedObservablesByPrefix = (prefix) => {
|
|
32
|
-
const cache = getCache();
|
|
33
|
-
for (const key of cache.keys()) if (key.startsWith(prefix)) cache.delete(key);
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Clears all cached observables.
|
|
37
|
-
* Use when resetting the entire kheopskit state.
|
|
38
|
-
*/
|
|
39
|
-
const clearAllCachedObservables = () => {
|
|
40
|
-
getCache().clear();
|
|
41
|
-
};
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/utils/isWalletPlatform.ts
|
|
44
|
-
const isWalletPlatform = (platform) => typeof platform === "string" && [
|
|
45
|
-
"polkadot",
|
|
46
|
-
"ethereum",
|
|
47
|
-
"solana"
|
|
48
|
-
].includes(platform);
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/utils/WalletId.ts
|
|
51
|
-
/**
|
|
52
|
-
* Stable id of the single WalletConnect connector. It is platform-less: one WC
|
|
53
|
-
* session spans whichever namespaces the wallet approves, so it isn't tied to a
|
|
54
|
-
* platform (unlike injected wallet ids, which are `<platform>:<identifier>`).
|
|
55
|
-
*/
|
|
56
|
-
const WALLET_CONNECT_WALLET_ID = "walletconnect";
|
|
57
|
-
const getWalletId = (platform, identifier) => {
|
|
58
|
-
if (!isWalletPlatform(platform)) throw new Error("Invalid platform");
|
|
59
|
-
if (!identifier) throw new Error("Invalid name");
|
|
60
|
-
return `${platform}:${identifier}`;
|
|
61
|
-
};
|
|
62
|
-
const parseWalletId = (walletId) => {
|
|
63
|
-
if (!walletId) throw new Error("Invalid walletId");
|
|
64
|
-
const [platform, identifier] = walletId.split(":");
|
|
65
|
-
if (!isWalletPlatform(platform)) throw new Error("Invalid platform");
|
|
66
|
-
if (!identifier) throw new Error("Invalid address");
|
|
67
|
-
return {
|
|
68
|
-
platform,
|
|
69
|
-
identifier
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Non-throwing variant of {@link parseWalletId}. Use when validating untrusted
|
|
74
|
-
* input (e.g. cached state persisted by an older version) before parsing.
|
|
75
|
-
*/
|
|
76
|
-
const isValidWalletId = (walletId) => {
|
|
77
|
-
if (typeof walletId !== "string" || !walletId) return false;
|
|
78
|
-
if (walletId === "walletconnect") return true;
|
|
79
|
-
const [platform, identifier] = walletId.split(":");
|
|
80
|
-
return isWalletPlatform(platform) && !!identifier;
|
|
81
|
-
};
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/api/types.ts
|
|
84
|
-
/** Narrows a wallet to the platform-less {@link WalletConnectWallet}. */
|
|
85
|
-
const isWalletConnectWallet = (wallet) => wallet.type === "walletconnect";
|
|
86
|
-
/**
|
|
87
|
-
* Narrows a wallet to an injected (browser-extension / Wallet Standard) wallet —
|
|
88
|
-
* the complement of {@link isWalletConnectWallet}. `state.wallets` is
|
|
89
|
-
* `(InjectedWallet | WalletConnectWallet)[]`, so use this to recover the
|
|
90
|
-
* injected-only fields when iterating: `platform`, `sourceId`, and the SDK
|
|
91
|
-
* handle (`provider` on Ethereum, `extension` on Polkadot, `wallet` on Solana).
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* ```ts
|
|
95
|
-
* for (const wallet of wallets.filter(isInjectedWallet)) {
|
|
96
|
-
* console.log(wallet.platform, wallet.sourceId); // typed, no WC widening
|
|
97
|
-
* }
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
const isInjectedWallet = (wallet) => wallet.type === "injected";
|
|
101
|
-
//#endregion
|
|
102
|
-
export { isValidWalletId as a, clearAllCachedObservables as c, getCachedObservable$ as d, getWalletId as i, clearCachedObservable as l, isWalletConnectWallet as n, parseWalletId as o, WALLET_CONNECT_WALLET_ID as r, isWalletPlatform as s, isInjectedWallet as t, clearCachedObservablesByPrefix as u };
|
|
103
|
-
|
|
104
|
-
//# sourceMappingURL=types-jnifAAA0.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-jnifAAA0.mjs","names":[],"sources":["../src/utils/getCachedObservable.ts","../src/utils/isWalletPlatform.ts","../src/utils/WalletId.ts","../src/api/types.ts"],"sourcesContent":["import type { Observable } from \"rxjs\";\n\n// Anchored on globalThis so the cache stays a single instance even if the\n// module is duplicated across bundle chunks (e.g. CJS subpath entries).\nconst CACHE_SYMBOL = Symbol.for(\"kheopskit.observableCache\");\n\nconst getCache = (): Map<string, Observable<unknown>> => {\n\tconst g = globalThis as unknown as Record<\n\t\tsymbol,\n\t\tMap<string, Observable<unknown>> | undefined\n\t>;\n\tlet cache = g[CACHE_SYMBOL];\n\tif (!cache) {\n\t\tcache = new Map();\n\t\tg[CACHE_SYMBOL] = cache;\n\t}\n\treturn cache;\n};\n\nexport const getCachedObservable$ = <T, Obs = Observable<T>>(\n\tkey: string,\n\tcreate: () => Obs,\n): Obs => {\n\tconst cache = getCache();\n\tif (!cache.has(key)) cache.set(key, create() as Observable<unknown>);\n\n\treturn cache.get(key) as Obs;\n};\n\n/**\n * Clears an observable from the cache.\n * Use when a wallet disconnects or configuration changes.\n */\nexport const clearCachedObservable = (key: string): void => {\n\tgetCache().delete(key);\n};\n\n/**\n * Clears all cached observables whose key starts with `prefix`.\n *\n * Used to drop a wallet's account observables when it disconnects, so a later\n * reconnect rebuilds them against the current wallet handle instead of a stale\n * closure — and to keep the cache from growing unbounded across connect cycles.\n */\nexport const clearCachedObservablesByPrefix = (prefix: string): void => {\n\tconst cache = getCache();\n\tfor (const key of cache.keys()) {\n\t\tif (key.startsWith(prefix)) cache.delete(key);\n\t}\n};\n\n/**\n * Clears all cached observables.\n * Use when resetting the entire kheopskit state.\n */\nexport const clearAllCachedObservables = (): void => {\n\tgetCache().clear();\n};\n","import type { WalletPlatform } from \"../api/types\";\n\nexport const isWalletPlatform = (\n\tplatform: unknown,\n): platform is WalletPlatform =>\n\ttypeof platform === \"string\" &&\n\t[\"polkadot\", \"ethereum\", \"solana\"].includes(platform as WalletPlatform);\n","import type { WalletPlatform } from \"../api/types\";\nimport { isWalletPlatform } from \"./isWalletPlatform\";\n\nexport type WalletId = string;\n\n/**\n * Stable id of the single WalletConnect connector. It is platform-less: one WC\n * session spans whichever namespaces the wallet approves, so it isn't tied to a\n * platform (unlike injected wallet ids, which are `<platform>:<identifier>`).\n */\nexport const WALLET_CONNECT_WALLET_ID: WalletId = \"walletconnect\";\n\nexport const getWalletId = (\n\tplatform: WalletPlatform,\n\tidentifier: string,\n): WalletId => {\n\tif (!isWalletPlatform(platform)) throw new Error(\"Invalid platform\");\n\tif (!identifier) throw new Error(\"Invalid name\");\n\treturn `${platform}:${identifier}`;\n};\n\nexport const parseWalletId = (walletId: string) => {\n\tif (!walletId) throw new Error(\"Invalid walletId\");\n\tconst [platform, identifier] = walletId.split(\":\");\n\tif (!isWalletPlatform(platform)) throw new Error(\"Invalid platform\");\n\tif (!identifier) throw new Error(\"Invalid address\");\n\treturn { platform, identifier };\n};\n\n/**\n * Non-throwing variant of {@link parseWalletId}. Use when validating untrusted\n * input (e.g. cached state persisted by an older version) before parsing.\n */\nexport const isValidWalletId = (walletId: unknown): walletId is WalletId => {\n\tif (typeof walletId !== \"string\" || !walletId) return false;\n\tif (walletId === WALLET_CONNECT_WALLET_ID) return true;\n\tconst [platform, identifier] = walletId.split(\":\");\n\treturn isWalletPlatform(platform) && !!identifier;\n};\n","import type { Observable } from \"rxjs\";\nimport type { WalletAccountId } from \"../utils\";\nimport type { WalletId } from \"../utils/WalletId\";\n\nexport type WalletPlatform = \"polkadot\" | \"ethereum\" | \"solana\";\n\n/**\n * Minimal structural view of a WalletConnect `UniversalProvider` — the subset\n * kheopskit reads. Declared locally so core never depends on\n * `@walletconnect/universal-provider`. The concrete instance comes from\n * `@reown/appkit` at runtime.\n */\nexport type WalletConnectProvider = {\n\tsession?: {\n\t\ttopic: string;\n\t\tnamespaces: Record<string, { accounts?: string[] }>;\n\t};\n\tclient: {\n\t\trequest<T = unknown>(args: {\n\t\t\ttopic: string;\n\t\t\tchainId: string;\n\t\t\trequest: { method: string; params: unknown };\n\t\t}): Promise<T>;\n\t};\n\trequest(args: { method: string; params?: unknown }): Promise<unknown>;\n\ton(event: string, listener: (...args: unknown[]) => void): void;\n\toff(event: string, listener: (...args: unknown[]) => void): void;\n};\n\n/**\n * Minimal structural view of the Reown AppKit instance — the subset kheopskit's\n * account factories use. Exposed as the `appKit` escape hatch on AppKit wallets;\n * cast it to `@reown/appkit`'s `AppKit` type for the full API. Declared locally\n * so core never depends on `@reown/appkit`'s types (it's an optional peer).\n */\nexport type AppKitInstance = {\n\tgetProvider<T = WalletConnectProvider>(namespace: string): T | undefined;\n\tgetAccount(\n\t\tnamespace: string,\n\t): { allAccounts: { address: string }[] } | undefined;\n\tgetCaipNetworks(namespace: string): { caipNetworkId?: string }[];\n};\n\nexport type WalletType = \"injected\" | \"walletconnect\";\n\nexport type PolkadotAccountType = \"sr25519\" | \"ed25519\" | \"ecdsa\" | \"ethereum\";\n\n/**\n * SDK-free fields common to every wallet, regardless of platform. Platform\n * packages (`@kheopskit/core/<platform>`) extend this with SDK-typed fields\n * (the injected provider/extension/standard-wallet handle).\n */\nexport type BaseWallet = {\n\tid: WalletId;\n\tplatform: WalletPlatform;\n\ttype: WalletType;\n\tname: string;\n\ticon: string;\n\tisConnected: boolean;\n\tconnect: () => Promise<void>;\n\t/**\n\t * Disconnect the wallet. Resolves once the underlying provider/extension\n\t * disconnect completes; rejects if it fails so callers can surface or retry.\n\t */\n\tdisconnect: () => Promise<void>;\n};\n\n/**\n * SDK-free fields common to every account, regardless of platform. Platform\n * packages extend this with their SDK-typed signer/client.\n */\nexport type BaseWalletAccount = {\n\tid: WalletAccountId;\n\tplatform: WalletPlatform;\n\t/** Base58 (Solana), SS58 (Polkadot) or 0x-hex (Ethereum) address. */\n\taddress: string;\n\t/** Friendly account name, when the wallet exposes one (e.g. Polkadot). */\n\tname?: string;\n\twalletName: string;\n\twalletId: WalletId;\n};\n\n/**\n * The single WalletConnect connector, shared across every platform.\n *\n * Unlike injected wallets, it is **not tied to a platform**: one WalletConnect\n * session spans whichever namespaces the remote wallet approves in a single\n * pairing (a namespace can't be added to a live session afterwards). So there is\n * exactly one of these in `wallets`, discriminated by `type: \"walletconnect\"`.\n * Its accounts appear in `accounts`, each carrying its own `platform`.\n */\nexport type WalletConnectWallet = {\n\tid: WalletId;\n\ttype: \"walletconnect\";\n\t/**\n\t * Platforms (namespaces) the live session currently carries. Empty until\n\t * connected; populated with whatever the wallet approved (e.g. just\n\t * `[\"ethereum\"]`, or `[\"polkadot\", \"ethereum\"]`).\n\t */\n\tplatforms: WalletPlatform[];\n\t/**\n\t * Raw Reown AppKit instance, exposed as an escape hatch for advanced use\n\t * (custom modal control, reading providers directly). Most consumers should\n\t * use `connect`/`disconnect` and the derived accounts instead.\n\t */\n\tappKit: AppKitInstance;\n\tname: string;\n\ticon: string;\n\tisConnected: boolean;\n\tconnect: () => Promise<void>;\n\tdisconnect: () => Promise<void>;\n};\n\n/** Narrows a wallet to the platform-less {@link WalletConnectWallet}. */\nexport const isWalletConnectWallet = (\n\twallet: BaseWallet | WalletConnectWallet,\n): wallet is WalletConnectWallet => wallet.type === \"walletconnect\";\n\n/**\n * Narrows a wallet to an injected (browser-extension / Wallet Standard) wallet —\n * the complement of {@link isWalletConnectWallet}. `state.wallets` is\n * `(InjectedWallet | WalletConnectWallet)[]`, so use this to recover the\n * injected-only fields when iterating: `platform`, `sourceId`, and the SDK\n * handle (`provider` on Ethereum, `extension` on Polkadot, `wallet` on Solana).\n *\n * @example\n * ```ts\n * for (const wallet of wallets.filter(isInjectedWallet)) {\n * console.log(wallet.platform, wallet.sourceId); // typed, no WC widening\n * }\n * ```\n */\nexport const isInjectedWallet = <W extends BaseWallet | WalletConnectWallet>(\n\twallet: W,\n): wallet is Exclude<W, WalletConnectWallet> => wallet.type === \"injected\";\n\n/**\n * Dapp metadata shown in the WalletConnect modal. Mirrors WalletConnect's\n * `Metadata`, declared locally so core doesn't depend on\n * `@walletconnect/universal-provider`.\n */\nexport type WalletConnectMetadata = {\n\tname: string;\n\tdescription: string;\n\turl: string;\n\ticons: string[];\n};\n\nexport type WalletConnectConfig = {\n\tprojectId: string;\n\tmetadata: WalletConnectMetadata;\n\t/** Defaults to wss://relay.walletconnect.com */\n\trelayUrl?: string;\n\t/**\n\t * Networks AppKit should enable. Pass `AppKitNetwork[]` from\n\t * `@reown/appkit/networks` (see\n\t * https://docs.reown.com/advanced/multichain/polkadot/dapp-integration-guide#walletconnect-code%2Fcomponent-setup).\n\t * Loosely typed (`unknown`) so core doesn't depend on `@reown/appkit`'s\n\t * types — the value is forwarded to AppKit as-is.\n\t */\n\tnetworks: [unknown, ...unknown[]];\n\tthemeMode?: \"light\" | \"dark\";\n\tthemeVariables?: Record<string, string | number>;\n};\n\n/**\n * Context passed to a platform plugin's `getWallets$`. Carries the shared store\n * and the resolved core config (for WalletConnect / debug).\n */\nexport type PlatformContext = {\n\tstore: KheopskitStore;\n\tconfig: KheopskitConfig;\n};\n\n/**\n * A platform plugin. Created by the per-platform factories exported from\n * `@kheopskit/core/polkadot`, `/ethereum`, `/solana`. Core iterates plugins\n * generically and never imports a platform SDK itself.\n *\n * @typeParam TPlatform - the platform discriminant\n * @typeParam TWallet - the platform's wallet type (extends {@link BaseWallet})\n * @typeParam TAccount - the platform's account type (extends {@link BaseWalletAccount})\n */\nexport type KheopskitPlatform<\n\tTPlatform extends WalletPlatform = WalletPlatform,\n\tTWallet extends BaseWallet = BaseWallet,\n\tTAccount extends BaseWalletAccount = BaseWalletAccount,\n> = {\n\treadonly platform: TPlatform;\n\t// Declared as methods (not arrow properties) so parameters are checked\n\t// bivariantly — this lets a specific `KheopskitPlatform<\"polkadot\", …>` be\n\t// assigned to the base `KheopskitPlatform` despite the contravariant\n\t// `wallets$` parameter.\n\tgetWallets$(ctx: PlatformContext): Observable<TWallet[]>;\n\t// Receives this platform's (injected) wallets plus the shared, platform-less\n\t// WalletConnect connector — the plugin derives its injected accounts and, if\n\t// the WC session carries its namespace, its WalletConnect accounts.\n\tgetAccounts$(\n\t\twallets$: Observable<(TWallet | WalletConnectWallet)[]>,\n\t): Observable<TAccount[]>;\n\t/**\n\t * Optional hydration filter. Cached accounts for which this returns false are\n\t * dropped during SSR hydration (Polkadot uses it to honour `accountTypes`).\n\t */\n\tacceptsCachedAccount?(cached: CachedAccount): boolean;\n};\n\ntype ElementOf<T> = T extends readonly (infer E)[] ? E : never;\n\n/** The account type produced by a plugin (inferred from its `getAccounts$`). */\nexport type AccountOf<T> = T extends {\n\tgetAccounts$: (wallets$: never) => Observable<infer R>;\n}\n\t? ElementOf<R>\n\t: never;\n\n/** The wallet type produced by a plugin (inferred from its `getWallets$`). */\nexport type WalletOf<T> = T extends {\n\tgetWallets$: (ctx: never) => Observable<infer R>;\n}\n\t? ElementOf<R>\n\t: never;\n\nexport type KheopskitConfig<\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n> = {\n\tautoReconnect: boolean;\n\t/**\n\t * Platform plugins to enable, e.g. `[polkadot(), solana({ chain })]`.\n\t * Import factories from `@kheopskit/core/<platform>`.\n\t */\n\tplatforms: P;\n\twalletConnect?: WalletConnectConfig;\n\t/**\n\t * Dapp name sent to Polkadot injected extensions on connect. Some\n\t * extensions (e.g. polkadot.js) warn about a suspicious origin when it's\n\t * empty.\n\t *\n\t * @default walletConnect.metadata.name, then window.location.hostname\n\t */\n\tappName?: string;\n\tdebug: boolean;\n\t/**\n\t * Custom storage key for persisting wallet connection state.\n\t * Useful when running multiple kheopskit instances on the same domain\n\t * to prevent state conflicts between different dapps.\n\t *\n\t * @default \"kheopskit\"\n\t */\n\tstorageKey: string;\n\t/**\n\t * Grace period in milliseconds to wait for wallets to inject before\n\t * syncing to actual state. During this period, cached wallet/account\n\t * state from storage is preserved to prevent UI flashing.\n\t *\n\t * Set to 0 to disable hydration buffering.\n\t *\n\t * @default 500\n\t */\n\thydrationGracePeriod: number;\n};\n\n/**\n * The current kheopskit state.\n *\n * @remarks\n * While {@link KheopskitState.isHydrating} is `true`, `wallets` and `accounts`\n * may contain cached placeholders restored from storage. The **SDK handles** the\n * platform types advertise (e.g. `account.signer` / `getSigner` on Solana,\n * `account.client` on Ethereum, `wallet.provider` / `extension`) are **absent at\n * runtime even though the types claim them**, and placeholder wallets throw if\n * `connect`/`disconnect` is called. Guard all access to those behind\n * `!isHydrating`.\n *\n * The plain, serializable platform data that is persisted in the cache IS\n * restored on the placeholders (Ethereum `chainId`, Polkadot key `type`), so it\n * renders immediately on reload without flashing. Solana `chains` is not cached,\n * so it remains absent until the live account loads.\n */\nexport type KheopskitState<\n\tP extends readonly KheopskitPlatform[] = readonly KheopskitPlatform[],\n> = {\n\twallets: (WalletOf<P[number]> | WalletConnectWallet)[];\n\taccounts: AccountOf<P[number]>[];\n\tconfig: KheopskitConfig<P>;\n\t/**\n\t * Whether the state is still being hydrated from cache.\n\t *\n\t * During hydration, cached wallets/accounts may be displayed before the\n\t * actual wallet extensions have injected. See the type-level remarks: while\n\t * this is `true`, SDK-typed fields (signer/client/provider/extension) are not\n\t * present at runtime — guard all access behind `!isHydrating`.\n\t */\n\tisHydrating: boolean;\n};\n\n/** Shape of the persisted store data (localStorage, or cookies in compact form). */\nexport type KheopskitStoreData = {\n\tautoReconnect?: WalletId[];\n\t/** Cached wallet state for SSR hydration to prevent UI flash */\n\tcachedWallets?: CachedWallet[];\n\t/** Cached account state for SSR hydration to prevent UI flash */\n\tcachedAccounts?: CachedAccount[];\n};\n\n/**\n * The persisted settings store shared between core and framework bindings.\n * Declared structurally here (implemented by `createKheopskitStore`) so modules\n * can depend on the interface without importing the implementation.\n */\nexport type KheopskitStore = {\n\tobservable: Observable<KheopskitStoreData>;\n\taddEnabledWalletId: (walletId: WalletId) => void;\n\tremoveEnabledWalletId: (walletId: WalletId) => void;\n\tgetCachedState: () => { wallets: CachedWallet[]; accounts: CachedAccount[] };\n\tsetCachedState: (wallets: CachedWallet[], accounts: CachedAccount[]) => void;\n};\n\n/**\n * Serializable wallet data for SSR hydration cache.\n * Contains only the data needed to render wallet UI without flash.\n * Note: icon is NOT stored to save cookie space - it's looked up at hydration time.\n */\nexport type CachedWallet = {\n\tid: WalletId;\n\t/** Absent for the platform-less WalletConnect connector. */\n\tplatform?: WalletPlatform;\n\ttype: WalletType;\n\tname: string;\n\tisConnected: boolean;\n};\n\n/**\n * Serializable account data for SSR hydration cache.\n * Contains only the data needed to render account UI without flash.\n */\nexport type CachedAccount = {\n\tid: string;\n\tplatform: WalletPlatform;\n\taddress: string;\n\tname?: string;\n\t/** Cached chain ID for Ethereum accounts. */\n\tchainId?: number;\n\t/** Cached key type for Polkadot accounts. */\n\tpolkadotAccountType?: PolkadotAccountType;\n\twalletId: WalletId;\n\twalletName: string;\n};\n"],"mappings":";AAIA,MAAM,eAAe,OAAO,IAAI,2BAA2B;AAE3D,MAAM,iBAAmD;CACxD,MAAM,IAAI;CAIV,IAAI,QAAQ,EAAE;CACd,IAAI,CAAC,OAAO;EACX,wBAAQ,IAAI,IAAI;EAChB,EAAE,gBAAgB;CACnB;CACA,OAAO;AACR;AAEA,MAAa,wBACZ,KACA,WACS;CACT,MAAM,QAAQ,SAAS;CACvB,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,KAAK,OAAO,CAAwB;CAEnE,OAAO,MAAM,IAAI,GAAG;AACrB;;;;;AAMA,MAAa,yBAAyB,QAAsB;CAC3D,SAAS,CAAC,CAAC,OAAO,GAAG;AACtB;;;;;;;;AASA,MAAa,kCAAkC,WAAyB;CACvE,MAAM,QAAQ,SAAS;CACvB,KAAK,MAAM,OAAO,MAAM,KAAK,GAC5B,IAAI,IAAI,WAAW,MAAM,GAAG,MAAM,OAAO,GAAG;AAE9C;;;;;AAMA,MAAa,kCAAwC;CACpD,SAAS,CAAC,CAAC,MAAM;AAClB;;;ACvDA,MAAa,oBACZ,aAEA,OAAO,aAAa,YACpB;CAAC;CAAY;CAAY;AAAQ,CAAC,CAAC,SAAS,QAA0B;;;;;;;;ACIvE,MAAa,2BAAqC;AAElD,MAAa,eACZ,UACA,eACc;CACd,IAAI,CAAC,iBAAiB,QAAQ,GAAG,MAAM,IAAI,MAAM,kBAAkB;CACnE,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,cAAc;CAC/C,OAAO,GAAG,SAAS,GAAG;AACvB;AAEA,MAAa,iBAAiB,aAAqB;CAClD,IAAI,CAAC,UAAU,MAAM,IAAI,MAAM,kBAAkB;CACjD,MAAM,CAAC,UAAU,cAAc,SAAS,MAAM,GAAG;CACjD,IAAI,CAAC,iBAAiB,QAAQ,GAAG,MAAM,IAAI,MAAM,kBAAkB;CACnE,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,iBAAiB;CAClD,OAAO;EAAE;EAAU;CAAW;AAC/B;;;;;AAMA,MAAa,mBAAmB,aAA4C;CAC3E,IAAI,OAAO,aAAa,YAAY,CAAC,UAAU,OAAO;CACtD,IAAI,aAAA,iBAAuC,OAAO;CAClD,MAAM,CAAC,UAAU,cAAc,SAAS,MAAM,GAAG;CACjD,OAAO,iBAAiB,QAAQ,KAAK,CAAC,CAAC;AACxC;;;;AC4EA,MAAa,yBACZ,WACmC,OAAO,SAAS;;;;;;;;;;;;;;;AAgBpD,MAAa,oBACZ,WAC+C,OAAO,SAAS"}
|