@kheopskit/core 5.1.0 → 5.1.2
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/errors-Caq2csKx.mjs +181 -0
- package/dist/errors-Caq2csKx.mjs.map +1 -0
- package/dist/errors-DPw6pc2H.js +222 -0
- package/dist/errors-DPw6pc2H.js.map +1 -0
- package/dist/ethereum.d.mts +39 -38
- package/dist/ethereum.d.ts +39 -38
- package/dist/ethereum.js +214 -281
- package/dist/ethereum.js.map +1 -1
- package/dist/ethereum.mjs +211 -282
- package/dist/ethereum.mjs.map +1 -1
- package/dist/{getCachedObservable-C4E8dfMp.d.ts → getCachedObservable-LUq9IfEx.d.mts} +5 -2
- package/dist/{getCachedObservable-C4E8dfMp.d.mts → getCachedObservable-LUq9IfEx.d.ts} +5 -2
- package/dist/iconCache-BSa42Sui.mjs +343 -0
- package/dist/iconCache-BSa42Sui.mjs.map +1 -0
- package/dist/iconCache-DS4zNiP1.js +396 -0
- package/dist/iconCache-DS4zNiP1.js.map +1 -0
- package/dist/index.d.mts +65 -59
- package/dist/index.d.ts +65 -59
- package/dist/index.js +901 -1015
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +885 -1016
- package/dist/index.mjs.map +1 -1
- package/dist/injectedWallets-B1MCxAE9.js +148 -0
- package/dist/injectedWallets-B1MCxAE9.js.map +1 -0
- package/dist/injectedWallets-B3Vysfvr.mjs +119 -0
- package/dist/injectedWallets-B3Vysfvr.mjs.map +1 -0
- package/dist/internal.d.mts +18 -16
- package/dist/internal.d.ts +18 -16
- package/dist/internal.js +9 -20
- package/dist/internal.mjs +3 -20
- package/dist/polkadot.d.mts +37 -36
- package/dist/polkadot.d.ts +37 -36
- package/dist/polkadot.js +178 -220
- package/dist/polkadot.js.map +1 -1
- package/dist/polkadot.mjs +175 -221
- package/dist/polkadot.mjs.map +1 -1
- package/dist/polkadotExtensions-BoVKhNU_.mjs +23 -0
- package/dist/polkadotExtensions-BoVKhNU_.mjs.map +1 -0
- package/dist/polkadotExtensions-y4J9UzYl.js +28 -0
- package/dist/polkadotExtensions-y4J9UzYl.js.map +1 -0
- package/dist/solana.d.mts +50 -48
- package/dist/solana.d.ts +50 -48
- package/dist/solana.js +320 -378
- package/dist/solana.js.map +1 -1
- package/dist/solana.mjs +314 -379
- package/dist/solana.mjs.map +1 -1
- package/dist/types-Cb-vuEru.d.mts +330 -0
- package/dist/types-Cb-vuEru.d.ts +330 -0
- package/dist/types-DKU-SNio.js +169 -0
- package/dist/{chunk-P7BPHHVV.js.map → types-DKU-SNio.js.map} +1 -1
- package/dist/types-jnifAAA0.mjs +104 -0
- package/dist/types-jnifAAA0.mjs.map +1 -0
- package/package.json +12 -12
- package/dist/chunk-3Y5N4N3Q.mjs +0 -267
- package/dist/chunk-3Y5N4N3Q.mjs.map +0 -1
- package/dist/chunk-BWUUHUDK.mjs +0 -24
- package/dist/chunk-BWUUHUDK.mjs.map +0 -1
- package/dist/chunk-D3EQMFZ2.js +0 -24
- package/dist/chunk-D3EQMFZ2.js.map +0 -1
- package/dist/chunk-DF7EKK4G.mjs +0 -106
- package/dist/chunk-DF7EKK4G.mjs.map +0 -1
- package/dist/chunk-EH73P476.js +0 -106
- package/dist/chunk-EH73P476.js.map +0 -1
- package/dist/chunk-JVSCMJY5.mjs +0 -147
- package/dist/chunk-JVSCMJY5.mjs.map +0 -1
- package/dist/chunk-P7BPHHVV.js +0 -76
- package/dist/chunk-SO64R7Z6.js +0 -267
- package/dist/chunk-SO64R7Z6.js.map +0 -1
- package/dist/chunk-WOPCW2OX.mjs +0 -76
- package/dist/chunk-WOPCW2OX.mjs.map +0 -1
- package/dist/chunk-XOGQMEV2.js +0 -147
- package/dist/chunk-XOGQMEV2.js.map +0 -1
- package/dist/internal.js.map +0 -1
- package/dist/internal.mjs.map +0 -1
- package/dist/types-0iDBydsK.d.mts +0 -327
- package/dist/types-0iDBydsK.d.ts +0 -327
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { d as getCachedObservable$, n as isWalletConnectWallet } from "./types-jnifAAA0.mjs";
|
|
2
|
+
import { t as KheopskitError } from "./errors-Caq2csKx.mjs";
|
|
3
|
+
import { BehaviorSubject, Observable, combineLatest, distinctUntilChanged, map, of, shareReplay, switchMap } from "rxjs";
|
|
4
|
+
//#region src/api/platformAccounts.ts
|
|
5
|
+
/** Shared engine behind every platform's `getAccounts$`. */
|
|
6
|
+
const createPlatformAccounts$ = ({ wallets$, getInjectedAccounts$, getWalletConnectAccounts$, mapAccounts, accountChangeKey = (account) => account.id }) => {
|
|
7
|
+
const accountsListEqual = (a, b) => a.length === b.length && a.every((account, i) => {
|
|
8
|
+
const other = b[i];
|
|
9
|
+
return !!other && accountChangeKey(account) === accountChangeKey(other);
|
|
10
|
+
});
|
|
11
|
+
return new Observable((subscriber) => {
|
|
12
|
+
const sub = wallets$.pipe(map((wallets) => wallets.filter((w) => w.isConnected)), switchMap((wallets) => wallets.length ? combineLatest([...wallets.filter((w) => !isWalletConnectWallet(w)).map(getInjectedAccounts$), ...wallets.filter(isWalletConnectWallet).map(getWalletConnectAccounts$)]) : of([])), map((accounts) => {
|
|
13
|
+
const flat = accounts.flat();
|
|
14
|
+
return mapAccounts ? mapAccounts(flat) : flat;
|
|
15
|
+
}), distinctUntilChanged(accountsListEqual)).subscribe(subscriber);
|
|
16
|
+
return () => {
|
|
17
|
+
sub.unsubscribe();
|
|
18
|
+
};
|
|
19
|
+
}).pipe(shareReplay({
|
|
20
|
+
refCount: true,
|
|
21
|
+
bufferSize: 1
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* CAIP-10 account strings ("<namespace>:<chainRef>:<address>") the live
|
|
26
|
+
* WalletConnect session carries for a namespace.
|
|
27
|
+
*/
|
|
28
|
+
const getSessionCaip10s = (session, namespace) => Object.values(session.namespaces).flatMap((ns) => ns.accounts ?? []).filter((account) => account.startsWith(`${namespace}:`));
|
|
29
|
+
/**
|
|
30
|
+
* Unique addresses from CAIP-10 account strings (one entry per chain, so the
|
|
31
|
+
* same address repeats — dedupe).
|
|
32
|
+
*/
|
|
33
|
+
const getCaip10Addresses = (caip10s) => [...new Set(caip10s.map((account) => account.split(":")[2]).filter((address) => !!address))];
|
|
34
|
+
/**
|
|
35
|
+
* Shared shape of the Polkadot/Solana WalletConnect account streams: no-op
|
|
36
|
+
* unless the session carries the platform's namespace, then a cached
|
|
37
|
+
* observable that rebuilds the account list from the session on
|
|
38
|
+
* `session_update` / `accountsChanged`.
|
|
39
|
+
*
|
|
40
|
+
* AppKit's `getAccount(namespace).allAccounts` is always empty for namespaces
|
|
41
|
+
* without a native AppKit adapter — the WalletConnect session is the source of
|
|
42
|
+
* truth, hence the session-driven rebuild.
|
|
43
|
+
*/
|
|
44
|
+
const getWalletConnectSessionAccounts$ = (options) => {
|
|
45
|
+
const { wallet, platform, namespace, cacheKey, buildAccounts } = options;
|
|
46
|
+
const provider = wallet.appKit.getProvider(namespace);
|
|
47
|
+
if (!wallet.platforms.includes(platform) || !provider?.session) return of([]);
|
|
48
|
+
return getCachedObservable$(cacheKey, () => new Observable((subscriber) => {
|
|
49
|
+
subscriber.next(buildAccounts(provider));
|
|
50
|
+
const reemit = () => subscriber.next(buildAccounts(provider));
|
|
51
|
+
provider.on("session_update", reemit);
|
|
52
|
+
provider.on("accountsChanged", reemit);
|
|
53
|
+
return () => {
|
|
54
|
+
provider.off("session_update", reemit);
|
|
55
|
+
provider.off("accountsChanged", reemit);
|
|
56
|
+
};
|
|
57
|
+
}).pipe(shareReplay({
|
|
58
|
+
refCount: true,
|
|
59
|
+
bufferSize: 1
|
|
60
|
+
})));
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/api/injectedWallets.ts
|
|
64
|
+
/**
|
|
65
|
+
* Compare two wallet arrays by their relevant properties (not functions).
|
|
66
|
+
* Shared by every platform's injected-wallets stream.
|
|
67
|
+
*/
|
|
68
|
+
const walletsEqual = (a, b) => {
|
|
69
|
+
if (a.length !== b.length) return false;
|
|
70
|
+
return a.every((w, i) => w.id === b[i]?.id && w.isConnected === b[i]?.isConnected && w.name === b[i]?.name);
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The shared engine behind every platform's injected-wallets stream: tracks
|
|
74
|
+
* connected wallets (and their live handles), guards double
|
|
75
|
+
* connect/disconnect, persists connected ids to the store for auto-reconnect,
|
|
76
|
+
* and re-emits the wallet list whenever the registry or connection state
|
|
77
|
+
* changes.
|
|
78
|
+
*/
|
|
79
|
+
const createInjectedWallets$ = (store, adapter) => new Observable((subscriber) => {
|
|
80
|
+
const handles$ = new BehaviorSubject(/* @__PURE__ */ new Map());
|
|
81
|
+
const connect = async (source, walletId) => {
|
|
82
|
+
if (handles$.value.has(walletId)) throw new KheopskitError("WALLET_ALREADY_CONNECTED", `wallet ${walletId} is already connected`, { walletId });
|
|
83
|
+
const handle = await adapter.connect(source, walletId);
|
|
84
|
+
const next = new Map(handles$.value);
|
|
85
|
+
next.set(walletId, handle);
|
|
86
|
+
handles$.next(next);
|
|
87
|
+
store.addEnabledWalletId(walletId);
|
|
88
|
+
};
|
|
89
|
+
const disconnect = async (source, walletId) => {
|
|
90
|
+
if (!handles$.value.has(walletId)) throw new KheopskitError("WALLET_NOT_CONNECTED", `wallet ${walletId} is not connected`, { walletId });
|
|
91
|
+
await adapter.disconnect?.(source, walletId);
|
|
92
|
+
const next = new Map(handles$.value);
|
|
93
|
+
next.delete(walletId);
|
|
94
|
+
handles$.next(next);
|
|
95
|
+
store.removeEnabledWalletId(walletId);
|
|
96
|
+
adapter.onDisconnected?.(walletId);
|
|
97
|
+
};
|
|
98
|
+
const sub = combineLatest([adapter.sources$, handles$]).pipe(map(([sources, handles]) => sources.map((source) => {
|
|
99
|
+
const walletId = adapter.getWalletId(source);
|
|
100
|
+
return adapter.buildWallet({
|
|
101
|
+
source,
|
|
102
|
+
walletId,
|
|
103
|
+
handle: handles.get(walletId),
|
|
104
|
+
isConnected: handles.has(walletId),
|
|
105
|
+
connect: () => connect(source, walletId),
|
|
106
|
+
disconnect: () => disconnect(source, walletId)
|
|
107
|
+
});
|
|
108
|
+
})), distinctUntilChanged(walletsEqual)).subscribe(subscriber);
|
|
109
|
+
return () => {
|
|
110
|
+
sub.unsubscribe();
|
|
111
|
+
};
|
|
112
|
+
}).pipe(shareReplay({
|
|
113
|
+
refCount: true,
|
|
114
|
+
bufferSize: 1
|
|
115
|
+
}));
|
|
116
|
+
//#endregion
|
|
117
|
+
export { getWalletConnectSessionAccounts$ as a, getSessionCaip10s as i, createPlatformAccounts$ as n, getCaip10Addresses as r, createInjectedWallets$ as t };
|
|
118
|
+
|
|
119
|
+
//# sourceMappingURL=injectedWallets-B3Vysfvr.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectedWallets-B3Vysfvr.mjs","names":[],"sources":["../src/api/platformAccounts.ts","../src/api/injectedWallets.ts"],"sourcesContent":["import {\n\tcombineLatest,\n\tdistinctUntilChanged,\n\tmap,\n\tObservable,\n\tof,\n\tshareReplay,\n\tswitchMap,\n} from \"rxjs\";\nimport { getCachedObservable$ } from \"../utils/getCachedObservable\";\nimport type {\n\tBaseWallet,\n\tBaseWalletAccount,\n\tWalletConnectProvider,\n\tWalletConnectWallet,\n\tWalletPlatform,\n} from \"./types\";\nimport { isWalletConnectWallet } from \"./types\";\n\n/**\n * The platform-specific surface of an accounts stream. The shared pipeline —\n * filter connected wallets, fan out per-wallet account streams, flatten,\n * change-detect, share — is owned by {@link createPlatformAccounts$}.\n */\nexport type PlatformAccountsOptions<\n\tTWallet extends BaseWallet,\n\tTAccount extends BaseWalletAccount,\n> = {\n\t/** This platform's wallets plus the shared WalletConnect connector. */\n\twallets$: Observable<(TWallet | WalletConnectWallet)[]>;\n\t/** Account stream for one connected injected wallet. */\n\tgetInjectedAccounts$: (wallet: TWallet) => Observable<TAccount[]>;\n\t/** Account stream for the WalletConnect connector. */\n\tgetWalletConnectAccounts$: (\n\t\twallet: WalletConnectWallet,\n\t) => Observable<TAccount[]>;\n\t/** Optional post-flatten transform (e.g. Polkadot's `accountTypes` filter). */\n\tmapAccounts?: (accounts: TAccount[]) => TAccount[];\n\t/**\n\t * Signature of the account fields that should trigger a re-emission.\n\t * Defaults to the account id; platforms add mutable fields (Ethereum\n\t * `chainId`, Solana `chains`).\n\t */\n\taccountChangeKey?: (account: TAccount) => string;\n};\n\n/** Shared engine behind every platform's `getAccounts$`. */\nexport const createPlatformAccounts$ = <\n\tTWallet extends BaseWallet,\n\tTAccount extends BaseWalletAccount,\n>({\n\twallets$,\n\tgetInjectedAccounts$,\n\tgetWalletConnectAccounts$,\n\tmapAccounts,\n\taccountChangeKey = (account) => account.id,\n}: PlatformAccountsOptions<TWallet, TAccount>): Observable<TAccount[]> => {\n\tconst accountsListEqual = (a: TAccount[], b: TAccount[]) =>\n\t\ta.length === b.length &&\n\t\ta.every((account, i) => {\n\t\t\tconst other = b[i];\n\t\t\treturn !!other && accountChangeKey(account) === accountChangeKey(other);\n\t\t});\n\n\treturn new Observable<TAccount[]>((subscriber) => {\n\t\tconst sub = wallets$\n\t\t\t.pipe(\n\t\t\t\tmap((wallets) => wallets.filter((w) => w.isConnected)),\n\t\t\t\tswitchMap((wallets) =>\n\t\t\t\t\twallets.length\n\t\t\t\t\t\t? combineLatest([\n\t\t\t\t\t\t\t\t...wallets\n\t\t\t\t\t\t\t\t\t.filter((w): w is TWallet => !isWalletConnectWallet(w))\n\t\t\t\t\t\t\t\t\t.map(getInjectedAccounts$),\n\t\t\t\t\t\t\t\t...wallets\n\t\t\t\t\t\t\t\t\t.filter(isWalletConnectWallet)\n\t\t\t\t\t\t\t\t\t.map(getWalletConnectAccounts$),\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t: of([]),\n\t\t\t\t),\n\t\t\t\tmap((accounts) => {\n\t\t\t\t\tconst flat = accounts.flat();\n\t\t\t\t\treturn mapAccounts ? mapAccounts(flat) : flat;\n\t\t\t\t}),\n\t\t\t\tdistinctUntilChanged(accountsListEqual),\n\t\t\t)\n\t\t\t.subscribe(subscriber);\n\n\t\treturn () => {\n\t\t\tsub.unsubscribe();\n\t\t};\n\t}).pipe(shareReplay({ refCount: true, bufferSize: 1 }));\n};\n\n/**\n * CAIP-10 account strings (\"<namespace>:<chainRef>:<address>\") the live\n * WalletConnect session carries for a namespace.\n */\nexport const getSessionCaip10s = (\n\tsession: NonNullable<WalletConnectProvider[\"session\"]>,\n\tnamespace: string,\n): string[] =>\n\tObject.values(session.namespaces)\n\t\t.flatMap((ns) => ns.accounts ?? [])\n\t\t.filter((account) => account.startsWith(`${namespace}:`));\n\n/**\n * Unique addresses from CAIP-10 account strings (one entry per chain, so the\n * same address repeats — dedupe).\n */\nexport const getCaip10Addresses = (caip10s: string[]): string[] => [\n\t...new Set(\n\t\tcaip10s\n\t\t\t.map((account) => account.split(\":\")[2])\n\t\t\t.filter((address): address is string => !!address),\n\t),\n];\n\n/**\n * Shared shape of the Polkadot/Solana WalletConnect account streams: no-op\n * unless the session carries the platform's namespace, then a cached\n * observable that rebuilds the account list from the session on\n * `session_update` / `accountsChanged`.\n *\n * AppKit's `getAccount(namespace).allAccounts` is always empty for namespaces\n * without a native AppKit adapter — the WalletConnect session is the source of\n * truth, hence the session-driven rebuild.\n */\nexport const getWalletConnectSessionAccounts$ = <\n\tTAccount extends BaseWalletAccount,\n>(options: {\n\twallet: WalletConnectWallet;\n\tplatform: WalletPlatform;\n\t/** WalletConnect namespace, e.g. \"polkadot\" | \"solana\" | \"eip155\". */\n\tnamespace: string;\n\t/** Cache key for {@link getCachedObservable$} — must be reconnect-safe. */\n\tcacheKey: string;\n\t/** Build the account list from the live session. */\n\tbuildAccounts: (provider: WalletConnectProvider) => TAccount[];\n}): Observable<TAccount[]> => {\n\tconst { wallet, platform, namespace, cacheKey, buildAccounts } = options;\n\tconst provider = wallet.appKit.getProvider(namespace);\n\n\tif (!wallet.platforms.includes(platform) || !provider?.session) return of([]);\n\n\treturn getCachedObservable$(cacheKey, () =>\n\t\tnew Observable<TAccount[]>((subscriber) => {\n\t\t\tsubscriber.next(buildAccounts(provider));\n\n\t\t\t// Re-derive when the WalletConnect session's accounts change, mirroring\n\t\t\t// the injected paths' change subscriptions.\n\t\t\tconst reemit = () => subscriber.next(buildAccounts(provider));\n\t\t\tprovider.on(\"session_update\", reemit);\n\t\t\tprovider.on(\"accountsChanged\", reemit);\n\n\t\t\treturn () => {\n\t\t\t\tprovider.off(\"session_update\", reemit);\n\t\t\t\tprovider.off(\"accountsChanged\", reemit);\n\t\t\t};\n\t\t}).pipe(shareReplay({ refCount: true, bufferSize: 1 })),\n\t);\n};\n","import {\n\tBehaviorSubject,\n\tcombineLatest,\n\tdistinctUntilChanged,\n\tmap,\n\tObservable,\n\tshareReplay,\n} from \"rxjs\";\nimport type { WalletId } from \"../utils/WalletId\";\nimport { KheopskitError } from \"./errors\";\nimport type { KheopskitStore } from \"./store\";\nimport type { BaseWallet } from \"./types\";\n\n/**\n * Compare two wallet arrays by their relevant properties (not functions).\n * Shared by every platform's injected-wallets stream.\n */\nconst walletsEqual = <\n\tW extends Pick<BaseWallet, \"id\" | \"isConnected\" | \"name\">,\n>(\n\ta: W[],\n\tb: W[],\n): boolean => {\n\tif (a.length !== b.length) return false;\n\treturn a.every(\n\t\t(w, i) =>\n\t\t\tw.id === b[i]?.id &&\n\t\t\tw.isConnected === b[i]?.isConnected &&\n\t\t\tw.name === b[i]?.name,\n\t);\n};\n\n/**\n * The platform-specific surface of an injected-wallets stream. Everything else\n * — the connect/disconnect state machine, the connected-ids bookkeeping, the\n * store persistence, change detection and sharing — is owned by\n * {@link createInjectedWallets$}.\n *\n * @typeParam TSource - a wallet as the platform's registry reports it\n * @typeParam TWallet - the platform's wallet type\n * @typeParam THandle - live connection handle retained while connected\n * (Polkadot keeps the `InjectedExtension`; platforms with no handle use void)\n */\nexport type InjectedWalletsAdapter<\n\tTSource,\n\tTWallet extends BaseWallet,\n\tTHandle = void,\n> = {\n\t/** Live registry of the platform's injected wallets (emits `[]` during SSR). */\n\tsources$: Observable<readonly TSource[]>;\n\t/** Stable wallet id for a registry entry. */\n\tgetWalletId: (source: TSource) => WalletId;\n\t/**\n\t * Platform connect call (e.g. `connectInjectedExtension`,\n\t * `eth_requestAccounts`, `standard:connect`). The resolved value is retained\n\t * as the wallet's live handle until disconnect.\n\t */\n\tconnect: (source: TSource, walletId: WalletId) => Promise<THandle>;\n\t/**\n\t * Optional platform disconnect call, awaited before local state clears so a\n\t * failed disconnect rejects without desyncing the connected list.\n\t */\n\tdisconnect?: (source: TSource, walletId: WalletId) => Promise<void>;\n\t/**\n\t * Runs after a disconnect fully applied — the place to drop cached account\n\t * observables so a later reconnect rebuilds them against a fresh handle.\n\t */\n\tonDisconnected?: (walletId: WalletId) => void;\n\t/** Build the platform wallet object for one registry entry. */\n\tbuildWallet: (args: {\n\t\tsource: TSource;\n\t\twalletId: WalletId;\n\t\t/** Live connection handle; `undefined` while disconnected. */\n\t\thandle: THandle | undefined;\n\t\tisConnected: boolean;\n\t\tconnect: () => Promise<void>;\n\t\tdisconnect: () => Promise<void>;\n\t}) => TWallet;\n};\n\n/**\n * The shared engine behind every platform's injected-wallets stream: tracks\n * connected wallets (and their live handles), guards double\n * connect/disconnect, persists connected ids to the store for auto-reconnect,\n * and re-emits the wallet list whenever the registry or connection state\n * changes.\n */\nexport const createInjectedWallets$ = <\n\tTSource,\n\tTWallet extends BaseWallet,\n\tTHandle = void,\n>(\n\tstore: KheopskitStore,\n\tadapter: InjectedWalletsAdapter<TSource, TWallet, THandle>,\n): Observable<TWallet[]> =>\n\tnew Observable<TWallet[]>((subscriber) => {\n\t\tconst handles$ = new BehaviorSubject<Map<WalletId, THandle>>(new Map());\n\n\t\tconst connect = async (source: TSource, walletId: WalletId) => {\n\t\t\tif (handles$.value.has(walletId))\n\t\t\t\tthrow new KheopskitError(\n\t\t\t\t\t\"WALLET_ALREADY_CONNECTED\",\n\t\t\t\t\t`wallet ${walletId} is already connected`,\n\t\t\t\t\t{ walletId },\n\t\t\t\t);\n\n\t\t\tconst handle = await adapter.connect(source, walletId);\n\n\t\t\tconst next = new Map(handles$.value);\n\t\t\tnext.set(walletId, handle);\n\t\t\thandles$.next(next);\n\n\t\t\tstore.addEnabledWalletId(walletId);\n\t\t};\n\n\t\tconst disconnect = async (source: TSource, walletId: WalletId) => {\n\t\t\tif (!handles$.value.has(walletId))\n\t\t\t\tthrow new KheopskitError(\n\t\t\t\t\t\"WALLET_NOT_CONNECTED\",\n\t\t\t\t\t`wallet ${walletId} is not connected`,\n\t\t\t\t\t{ walletId },\n\t\t\t\t);\n\n\t\t\tawait adapter.disconnect?.(source, walletId);\n\n\t\t\tconst next = new Map(handles$.value);\n\t\t\tnext.delete(walletId);\n\t\t\thandles$.next(next);\n\n\t\t\tstore.removeEnabledWalletId(walletId);\n\n\t\t\tadapter.onDisconnected?.(walletId);\n\t\t};\n\n\t\tconst sub = combineLatest([adapter.sources$, handles$])\n\t\t\t.pipe(\n\t\t\t\tmap(([sources, handles]) =>\n\t\t\t\t\tsources.map((source): TWallet => {\n\t\t\t\t\t\tconst walletId = adapter.getWalletId(source);\n\t\t\t\t\t\treturn adapter.buildWallet({\n\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\twalletId,\n\t\t\t\t\t\t\thandle: handles.get(walletId),\n\t\t\t\t\t\t\tisConnected: handles.has(walletId),\n\t\t\t\t\t\t\tconnect: () => connect(source, walletId),\n\t\t\t\t\t\t\tdisconnect: () => disconnect(source, walletId),\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t\tdistinctUntilChanged(walletsEqual),\n\t\t\t)\n\t\t\t.subscribe(subscriber);\n\n\t\treturn () => {\n\t\t\tsub.unsubscribe();\n\t\t};\n\t}).pipe(shareReplay({ refCount: true, bufferSize: 1 }));\n"],"mappings":"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"}
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { _ as WalletConnectWallet, a as CachedAccount, i as BaseWalletAccount, o as CachedWallet, r as BaseWallet } from "./types-Cb-vuEru.mjs";
|
|
2
|
+
import { n as clearCachedObservable, r as clearCachedObservablesByPrefix } from "./getCachedObservable-LUq9IfEx.mjs";
|
|
3
|
+
//#region src/utils/storage.d.ts
|
|
5
4
|
type Storage = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
getItem: (key: string) => string | null;
|
|
6
|
+
setItem: (key: string, value: string) => void;
|
|
7
|
+
removeItem: (key: string) => void;
|
|
9
8
|
};
|
|
10
9
|
/**
|
|
11
10
|
* Extended storage interface with cross-tab sync support.
|
|
12
11
|
*/
|
|
13
12
|
type SyncableStorage = Storage & {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Subscribe to storage changes from other tabs.
|
|
15
|
+
* Returns an unsubscribe function.
|
|
16
|
+
*/
|
|
17
|
+
subscribe?: (key: string, callback: (value: string | null) => void) => () => void;
|
|
19
18
|
};
|
|
20
19
|
/**
|
|
21
20
|
* A safe localStorage wrapper that falls back to noopStorage
|
|
@@ -25,7 +24,8 @@ type SyncableStorage = Storage & {
|
|
|
25
24
|
* Lazily initialized on first access to be SSR-safe.
|
|
26
25
|
*/
|
|
27
26
|
declare const getSafeLocalStorage: () => SyncableStorage;
|
|
28
|
-
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/utils/hydrateState.d.ts
|
|
29
29
|
/**
|
|
30
30
|
* Converts a wallet to a CachedWallet for storage.
|
|
31
31
|
* Only extracts the serializable properties needed for hydration.
|
|
@@ -38,12 +38,14 @@ declare const serializeWallet: (wallet: BaseWallet | WalletConnectWallet) => Cac
|
|
|
38
38
|
* stays SDK-free.
|
|
39
39
|
*/
|
|
40
40
|
declare const serializeAccount: (account: BaseWalletAccount) => CachedAccount;
|
|
41
|
-
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/utils/iconCache.d.ts
|
|
42
43
|
/**
|
|
43
44
|
* Sets multiple cached icons at once.
|
|
44
45
|
* More efficient than calling setCachedIcon multiple times.
|
|
45
46
|
* @param icons - Map of wallet ID to icon
|
|
46
47
|
*/
|
|
47
48
|
declare const setCachedIcons: (icons: Record<string, string>) => void;
|
|
48
|
-
|
|
49
|
-
export { getSafeLocalStorage, serializeAccount, serializeWallet, setCachedIcons };
|
|
49
|
+
//#endregion
|
|
50
|
+
export { clearCachedObservable, clearCachedObservablesByPrefix, getSafeLocalStorage, serializeAccount, serializeWallet, setCachedIcons };
|
|
51
|
+
//# sourceMappingURL=internal.d.mts.map
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { _ as WalletConnectWallet, a as CachedAccount, i as BaseWalletAccount, o as CachedWallet, r as BaseWallet } from "./types-Cb-vuEru.js";
|
|
2
|
+
import { n as clearCachedObservable, r as clearCachedObservablesByPrefix } from "./getCachedObservable-LUq9IfEx.js";
|
|
3
|
+
//#region src/utils/storage.d.ts
|
|
5
4
|
type Storage = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
getItem: (key: string) => string | null;
|
|
6
|
+
setItem: (key: string, value: string) => void;
|
|
7
|
+
removeItem: (key: string) => void;
|
|
9
8
|
};
|
|
10
9
|
/**
|
|
11
10
|
* Extended storage interface with cross-tab sync support.
|
|
12
11
|
*/
|
|
13
12
|
type SyncableStorage = Storage & {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Subscribe to storage changes from other tabs.
|
|
15
|
+
* Returns an unsubscribe function.
|
|
16
|
+
*/
|
|
17
|
+
subscribe?: (key: string, callback: (value: string | null) => void) => () => void;
|
|
19
18
|
};
|
|
20
19
|
/**
|
|
21
20
|
* A safe localStorage wrapper that falls back to noopStorage
|
|
@@ -25,7 +24,8 @@ type SyncableStorage = Storage & {
|
|
|
25
24
|
* Lazily initialized on first access to be SSR-safe.
|
|
26
25
|
*/
|
|
27
26
|
declare const getSafeLocalStorage: () => SyncableStorage;
|
|
28
|
-
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/utils/hydrateState.d.ts
|
|
29
29
|
/**
|
|
30
30
|
* Converts a wallet to a CachedWallet for storage.
|
|
31
31
|
* Only extracts the serializable properties needed for hydration.
|
|
@@ -38,12 +38,14 @@ declare const serializeWallet: (wallet: BaseWallet | WalletConnectWallet) => Cac
|
|
|
38
38
|
* stays SDK-free.
|
|
39
39
|
*/
|
|
40
40
|
declare const serializeAccount: (account: BaseWalletAccount) => CachedAccount;
|
|
41
|
-
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/utils/iconCache.d.ts
|
|
42
43
|
/**
|
|
43
44
|
* Sets multiple cached icons at once.
|
|
44
45
|
* More efficient than calling setCachedIcon multiple times.
|
|
45
46
|
* @param icons - Map of wallet ID to icon
|
|
46
47
|
*/
|
|
47
48
|
declare const setCachedIcons: (icons: Record<string, string>) => void;
|
|
48
|
-
|
|
49
|
-
export { getSafeLocalStorage, serializeAccount, serializeWallet, setCachedIcons };
|
|
49
|
+
//#endregion
|
|
50
|
+
export { clearCachedObservable, clearCachedObservablesByPrefix, getSafeLocalStorage, serializeAccount, serializeWallet, setCachedIcons };
|
|
51
|
+
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var _chunkP7BPHHVVjs = require('./chunk-P7BPHHVV.js');
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
exports.clearCachedObservable = _chunkP7BPHHVVjs.clearCachedObservable; exports.clearCachedObservablesByPrefix = _chunkP7BPHHVVjs.clearCachedObservablesByPrefix; exports.getSafeLocalStorage = _chunkSO64R7Z6js.getSafeLocalStorage; exports.serializeAccount = _chunkSO64R7Z6js.serializeAccount; exports.serializeWallet = _chunkSO64R7Z6js.serializeWallet; exports.setCachedIcons = _chunkSO64R7Z6js.setCachedIcons;
|
|
20
|
-
//# sourceMappingURL=internal.js.map
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_types = require("./types-DKU-SNio.js");
|
|
3
|
+
const require_iconCache = require("./iconCache-DS4zNiP1.js");
|
|
4
|
+
exports.clearCachedObservable = require_types.clearCachedObservable;
|
|
5
|
+
exports.clearCachedObservablesByPrefix = require_types.clearCachedObservablesByPrefix;
|
|
6
|
+
exports.getSafeLocalStorage = require_iconCache.getSafeLocalStorage;
|
|
7
|
+
exports.serializeAccount = require_iconCache.serializeAccount;
|
|
8
|
+
exports.serializeWallet = require_iconCache.serializeWallet;
|
|
9
|
+
exports.setCachedIcons = require_iconCache.setCachedIcons;
|
package/dist/internal.mjs
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
serializeWallet,
|
|
5
|
-
setCachedIcons
|
|
6
|
-
} from "./chunk-3Y5N4N3Q.mjs";
|
|
7
|
-
import "./chunk-BWUUHUDK.mjs";
|
|
8
|
-
import {
|
|
9
|
-
clearCachedObservable,
|
|
10
|
-
clearCachedObservablesByPrefix
|
|
11
|
-
} from "./chunk-WOPCW2OX.mjs";
|
|
12
|
-
export {
|
|
13
|
-
clearCachedObservable,
|
|
14
|
-
clearCachedObservablesByPrefix,
|
|
15
|
-
getSafeLocalStorage,
|
|
16
|
-
serializeAccount,
|
|
17
|
-
serializeWallet,
|
|
18
|
-
setCachedIcons
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=internal.mjs.map
|
|
1
|
+
import { l as clearCachedObservable, u as clearCachedObservablesByPrefix } from "./types-jnifAAA0.mjs";
|
|
2
|
+
import { c as serializeAccount, i as getSafeLocalStorage, l as serializeWallet, n as setCachedIcons } from "./iconCache-BSa42Sui.mjs";
|
|
3
|
+
export { clearCachedObservable, clearCachedObservablesByPrefix, getSafeLocalStorage, serializeAccount, serializeWallet, setCachedIcons };
|
package/dist/polkadot.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import 'rxjs';
|
|
5
|
-
|
|
1
|
+
import { C as WalletId, D as WalletAccountId, S as isWalletConnectWallet, _ as WalletConnectWallet, c as KheopskitPlatform, p as PolkadotAccountType, x as isInjectedWallet } from "./types-Cb-vuEru.mjs";
|
|
2
|
+
import { InjectedExtension, InjectedPolkadotAccount } from "polkadot-api/pjs-signer";
|
|
3
|
+
//#region src/utils/isSs58Address.d.ts
|
|
6
4
|
/**
|
|
7
5
|
* Returns true if `address` is a valid SS58-encoded 32-byte account id (the
|
|
8
6
|
* only form Substrate wallets inject), verifying the blake2b-512 checksum.
|
|
@@ -11,23 +9,24 @@ import 'rxjs';
|
|
|
11
9
|
* stays decoupled from polkadot-api.
|
|
12
10
|
*/
|
|
13
11
|
declare const isSs58Address: (address: string) => boolean;
|
|
14
|
-
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/api/polkadot/types.d.ts
|
|
15
14
|
type PolkadotInjectedWallet = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
id: WalletId;
|
|
16
|
+
platform: "polkadot";
|
|
17
|
+
type: "injected";
|
|
18
|
+
/**
|
|
19
|
+
* Stable identifier of the underlying wallet source. For Polkadot this is the
|
|
20
|
+
* injected extension identifier. Named consistently across platforms
|
|
21
|
+
* (Ethereum: EIP-6963 rdns; Solana: Wallet Standard name).
|
|
22
|
+
*/
|
|
23
|
+
sourceId: string;
|
|
24
|
+
extension: InjectedExtension | undefined;
|
|
25
|
+
name: string;
|
|
26
|
+
icon: string;
|
|
27
|
+
isConnected: boolean;
|
|
28
|
+
connect: () => Promise<void>;
|
|
29
|
+
disconnect: () => Promise<void>;
|
|
31
30
|
};
|
|
32
31
|
type PolkadotWallet = PolkadotInjectedWallet;
|
|
33
32
|
/**
|
|
@@ -40,21 +39,22 @@ type PolkadotWallet = PolkadotInjectedWallet;
|
|
|
40
39
|
* `state.isHydrating` is `true`.
|
|
41
40
|
*/
|
|
42
41
|
type PolkadotAccount = Omit<InjectedPolkadotAccount, "type"> & {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
type: PolkadotAccountType;
|
|
43
|
+
id: WalletAccountId;
|
|
44
|
+
platform: "polkadot";
|
|
45
|
+
walletName: string;
|
|
46
|
+
walletId: WalletId;
|
|
48
47
|
};
|
|
49
|
-
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/api/polkadot/plugin.d.ts
|
|
50
50
|
type PolkadotPluginOptions = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Allowed Polkadot account key types. Accounts with other key types are
|
|
53
|
+
* filtered out from kheopskit state.
|
|
54
|
+
*
|
|
55
|
+
* @default ["sr25519", "ed25519", "ecdsa"]
|
|
56
|
+
*/
|
|
57
|
+
accountTypes?: PolkadotAccountType[];
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
60
60
|
* Polkadot platform plugin. Pass to `getKheopskit$({ platforms: [polkadot()] })`.
|
|
@@ -66,5 +66,6 @@ type PolkadotPluginOptions = {
|
|
|
66
66
|
* ```
|
|
67
67
|
*/
|
|
68
68
|
declare const polkadot: (options?: PolkadotPluginOptions) => KheopskitPlatform<"polkadot", PolkadotWallet, PolkadotAccount>;
|
|
69
|
-
|
|
70
|
-
export { type PolkadotAccount, PolkadotAccountType, type PolkadotInjectedWallet, type PolkadotPluginOptions, type PolkadotWallet, isSs58Address, polkadot };
|
|
69
|
+
//#endregion
|
|
70
|
+
export { type PolkadotAccount, type PolkadotAccountType, type PolkadotInjectedWallet, type PolkadotPluginOptions, type PolkadotWallet, type WalletConnectWallet, isInjectedWallet, isSs58Address, isWalletConnectWallet, polkadot };
|
|
71
|
+
//# sourceMappingURL=polkadot.d.mts.map
|
package/dist/polkadot.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import 'rxjs';
|
|
5
|
-
|
|
1
|
+
import { C as WalletId, D as WalletAccountId, S as isWalletConnectWallet, _ as WalletConnectWallet, c as KheopskitPlatform, p as PolkadotAccountType, x as isInjectedWallet } from "./types-Cb-vuEru.js";
|
|
2
|
+
import { InjectedExtension, InjectedPolkadotAccount } from "polkadot-api/pjs-signer";
|
|
3
|
+
//#region src/utils/isSs58Address.d.ts
|
|
6
4
|
/**
|
|
7
5
|
* Returns true if `address` is a valid SS58-encoded 32-byte account id (the
|
|
8
6
|
* only form Substrate wallets inject), verifying the blake2b-512 checksum.
|
|
@@ -11,23 +9,24 @@ import 'rxjs';
|
|
|
11
9
|
* stays decoupled from polkadot-api.
|
|
12
10
|
*/
|
|
13
11
|
declare const isSs58Address: (address: string) => boolean;
|
|
14
|
-
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/api/polkadot/types.d.ts
|
|
15
14
|
type PolkadotInjectedWallet = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
id: WalletId;
|
|
16
|
+
platform: "polkadot";
|
|
17
|
+
type: "injected";
|
|
18
|
+
/**
|
|
19
|
+
* Stable identifier of the underlying wallet source. For Polkadot this is the
|
|
20
|
+
* injected extension identifier. Named consistently across platforms
|
|
21
|
+
* (Ethereum: EIP-6963 rdns; Solana: Wallet Standard name).
|
|
22
|
+
*/
|
|
23
|
+
sourceId: string;
|
|
24
|
+
extension: InjectedExtension | undefined;
|
|
25
|
+
name: string;
|
|
26
|
+
icon: string;
|
|
27
|
+
isConnected: boolean;
|
|
28
|
+
connect: () => Promise<void>;
|
|
29
|
+
disconnect: () => Promise<void>;
|
|
31
30
|
};
|
|
32
31
|
type PolkadotWallet = PolkadotInjectedWallet;
|
|
33
32
|
/**
|
|
@@ -40,21 +39,22 @@ type PolkadotWallet = PolkadotInjectedWallet;
|
|
|
40
39
|
* `state.isHydrating` is `true`.
|
|
41
40
|
*/
|
|
42
41
|
type PolkadotAccount = Omit<InjectedPolkadotAccount, "type"> & {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
type: PolkadotAccountType;
|
|
43
|
+
id: WalletAccountId;
|
|
44
|
+
platform: "polkadot";
|
|
45
|
+
walletName: string;
|
|
46
|
+
walletId: WalletId;
|
|
48
47
|
};
|
|
49
|
-
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/api/polkadot/plugin.d.ts
|
|
50
50
|
type PolkadotPluginOptions = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Allowed Polkadot account key types. Accounts with other key types are
|
|
53
|
+
* filtered out from kheopskit state.
|
|
54
|
+
*
|
|
55
|
+
* @default ["sr25519", "ed25519", "ecdsa"]
|
|
56
|
+
*/
|
|
57
|
+
accountTypes?: PolkadotAccountType[];
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
60
60
|
* Polkadot platform plugin. Pass to `getKheopskit$({ platforms: [polkadot()] })`.
|
|
@@ -66,5 +66,6 @@ type PolkadotPluginOptions = {
|
|
|
66
66
|
* ```
|
|
67
67
|
*/
|
|
68
68
|
declare const polkadot: (options?: PolkadotPluginOptions) => KheopskitPlatform<"polkadot", PolkadotWallet, PolkadotAccount>;
|
|
69
|
-
|
|
70
|
-
export { type PolkadotAccount, PolkadotAccountType, type PolkadotInjectedWallet, type PolkadotPluginOptions, type PolkadotWallet, isSs58Address, polkadot };
|
|
69
|
+
//#endregion
|
|
70
|
+
export { type PolkadotAccount, type PolkadotAccountType, type PolkadotInjectedWallet, type PolkadotPluginOptions, type PolkadotWallet, type WalletConnectWallet, isInjectedWallet, isSs58Address, isWalletConnectWallet, polkadot };
|
|
71
|
+
//# sourceMappingURL=polkadot.d.ts.map
|