@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.
Files changed (76) hide show
  1. package/dist/errors-Caq2csKx.mjs +181 -0
  2. package/dist/errors-Caq2csKx.mjs.map +1 -0
  3. package/dist/errors-DPw6pc2H.js +222 -0
  4. package/dist/errors-DPw6pc2H.js.map +1 -0
  5. package/dist/ethereum.d.mts +39 -38
  6. package/dist/ethereum.d.ts +39 -38
  7. package/dist/ethereum.js +214 -281
  8. package/dist/ethereum.js.map +1 -1
  9. package/dist/ethereum.mjs +211 -282
  10. package/dist/ethereum.mjs.map +1 -1
  11. package/dist/{getCachedObservable-C4E8dfMp.d.ts → getCachedObservable-LUq9IfEx.d.mts} +5 -2
  12. package/dist/{getCachedObservable-C4E8dfMp.d.mts → getCachedObservable-LUq9IfEx.d.ts} +5 -2
  13. package/dist/iconCache-BSa42Sui.mjs +343 -0
  14. package/dist/iconCache-BSa42Sui.mjs.map +1 -0
  15. package/dist/iconCache-DS4zNiP1.js +396 -0
  16. package/dist/iconCache-DS4zNiP1.js.map +1 -0
  17. package/dist/index.d.mts +65 -59
  18. package/dist/index.d.ts +65 -59
  19. package/dist/index.js +901 -1015
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +885 -1016
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/injectedWallets-B1MCxAE9.js +148 -0
  24. package/dist/injectedWallets-B1MCxAE9.js.map +1 -0
  25. package/dist/injectedWallets-B3Vysfvr.mjs +119 -0
  26. package/dist/injectedWallets-B3Vysfvr.mjs.map +1 -0
  27. package/dist/internal.d.mts +18 -16
  28. package/dist/internal.d.ts +18 -16
  29. package/dist/internal.js +9 -20
  30. package/dist/internal.mjs +3 -20
  31. package/dist/polkadot.d.mts +37 -36
  32. package/dist/polkadot.d.ts +37 -36
  33. package/dist/polkadot.js +178 -220
  34. package/dist/polkadot.js.map +1 -1
  35. package/dist/polkadot.mjs +175 -221
  36. package/dist/polkadot.mjs.map +1 -1
  37. package/dist/polkadotExtensions-BoVKhNU_.mjs +23 -0
  38. package/dist/polkadotExtensions-BoVKhNU_.mjs.map +1 -0
  39. package/dist/polkadotExtensions-y4J9UzYl.js +28 -0
  40. package/dist/polkadotExtensions-y4J9UzYl.js.map +1 -0
  41. package/dist/solana.d.mts +50 -48
  42. package/dist/solana.d.ts +50 -48
  43. package/dist/solana.js +320 -378
  44. package/dist/solana.js.map +1 -1
  45. package/dist/solana.mjs +314 -379
  46. package/dist/solana.mjs.map +1 -1
  47. package/dist/types-Cb-vuEru.d.mts +330 -0
  48. package/dist/types-Cb-vuEru.d.ts +330 -0
  49. package/dist/types-DKU-SNio.js +169 -0
  50. package/dist/{chunk-P7BPHHVV.js.map → types-DKU-SNio.js.map} +1 -1
  51. package/dist/types-jnifAAA0.mjs +104 -0
  52. package/dist/types-jnifAAA0.mjs.map +1 -0
  53. package/package.json +12 -12
  54. package/dist/chunk-3Y5N4N3Q.mjs +0 -267
  55. package/dist/chunk-3Y5N4N3Q.mjs.map +0 -1
  56. package/dist/chunk-BWUUHUDK.mjs +0 -24
  57. package/dist/chunk-BWUUHUDK.mjs.map +0 -1
  58. package/dist/chunk-D3EQMFZ2.js +0 -24
  59. package/dist/chunk-D3EQMFZ2.js.map +0 -1
  60. package/dist/chunk-DF7EKK4G.mjs +0 -106
  61. package/dist/chunk-DF7EKK4G.mjs.map +0 -1
  62. package/dist/chunk-EH73P476.js +0 -106
  63. package/dist/chunk-EH73P476.js.map +0 -1
  64. package/dist/chunk-JVSCMJY5.mjs +0 -147
  65. package/dist/chunk-JVSCMJY5.mjs.map +0 -1
  66. package/dist/chunk-P7BPHHVV.js +0 -76
  67. package/dist/chunk-SO64R7Z6.js +0 -267
  68. package/dist/chunk-SO64R7Z6.js.map +0 -1
  69. package/dist/chunk-WOPCW2OX.mjs +0 -76
  70. package/dist/chunk-WOPCW2OX.mjs.map +0 -1
  71. package/dist/chunk-XOGQMEV2.js +0 -147
  72. package/dist/chunk-XOGQMEV2.js.map +0 -1
  73. package/dist/internal.js.map +0 -1
  74. package/dist/internal.mjs.map +0 -1
  75. package/dist/types-0iDBydsK.d.mts +0 -327
  76. package/dist/types-0iDBydsK.d.ts +0 -327
@@ -1,106 +0,0 @@
1
- import {
2
- __publicField
3
- } from "./chunk-WOPCW2OX.mjs";
4
-
5
- // src/utils/isEthereumAddress.ts
6
- import { keccak_256 } from "@noble/hashes/sha3";
7
- var HEX_ADDRESS = /^0x[0-9a-fA-F]{40}$/;
8
- var encoder = new TextEncoder();
9
- var isChecksumValid = (address) => {
10
- const hex = address.slice(2);
11
- const hash = keccak_256(encoder.encode(hex.toLowerCase()));
12
- for (let i = 0; i < 40; i++) {
13
- const char = hex.charAt(i);
14
- const isLetter = char >= "a" && char <= "f" || char >= "A" && char <= "F";
15
- if (!isLetter) continue;
16
- const byte = hash[i >> 1] ?? 0;
17
- const nibble = i % 2 === 0 ? byte >> 4 : byte & 15;
18
- const isUpper = char <= "F";
19
- if (isUpper !== nibble >= 8) return false;
20
- }
21
- return true;
22
- };
23
- var isEthereumAddress = (address) => {
24
- if (!HEX_ADDRESS.test(address)) return false;
25
- if (address === address.toLowerCase()) return true;
26
- return isChecksumValid(address);
27
- };
28
-
29
- // src/utils/isSolanaAddress.ts
30
- import { base58 } from "@scure/base";
31
- var isSolanaAddress = (address) => {
32
- if (!address) return false;
33
- try {
34
- return base58.decode(address).length === 32;
35
- } catch {
36
- return false;
37
- }
38
- };
39
-
40
- // src/utils/isSs58Address.ts
41
- import { blake2b } from "@noble/hashes/blake2b";
42
- import { base58 as base582 } from "@scure/base";
43
- var SS58PRE = new Uint8Array([83, 83, 53, 56, 80, 82, 69]);
44
- var isSs58Address = (address) => {
45
- if (!address) return false;
46
- let decoded;
47
- try {
48
- decoded = base582.decode(address);
49
- } catch {
50
- return false;
51
- }
52
- const firstByte = decoded[0];
53
- if (firstByte === void 0 || firstByte & 128) return false;
54
- const prefixLength = firstByte & 64 ? 2 : 1;
55
- if (decoded.length !== prefixLength + 32 + 2) return false;
56
- const body = decoded.subarray(0, decoded.length - 2);
57
- const preimage = new Uint8Array(SS58PRE.length + body.length);
58
- preimage.set(SS58PRE);
59
- preimage.set(body, SS58PRE.length);
60
- const hash = blake2b(preimage, { dkLen: 64 });
61
- return decoded[decoded.length - 2] === hash[0] && decoded[decoded.length - 1] === hash[1];
62
- };
63
-
64
- // src/utils/isValidAddress.ts
65
- var isValidAddress = (address) => {
66
- if (address.startsWith("0x")) return isEthereumAddress(address);
67
- return isSs58Address(address) || isSolanaAddress(address);
68
- };
69
-
70
- // src/utils/WalletAccountId.ts
71
- var getWalletAccountId = (walletId, address) => {
72
- if (!walletId) throw new Error("Missing walletId");
73
- if (!isValidAddress(address)) throw new Error("Invalid address");
74
- return `${walletId}::${address}`;
75
- };
76
- var parseWalletAccountId = (accountId) => {
77
- if (!accountId) throw new Error("Invalid walletAccountId");
78
- const [walletId, address] = accountId.split("::");
79
- if (!walletId) throw new Error("Missing walletId");
80
- if (!address || !isValidAddress(address)) throw new Error("Invalid address");
81
- return { walletId, address };
82
- };
83
-
84
- // src/api/errors.ts
85
- var KheopskitError = class extends Error {
86
- constructor(code, message, options) {
87
- super(`[kheopskit] ${message}`, { cause: options?.cause });
88
- __publicField(this, "code");
89
- /** The wallet id this error relates to, when applicable. */
90
- __publicField(this, "walletId");
91
- this.name = "KheopskitError";
92
- this.code = code;
93
- this.walletId = options?.walletId;
94
- }
95
- };
96
-
97
- export {
98
- isEthereumAddress,
99
- isSolanaAddress,
100
- isSs58Address,
101
- isValidAddress,
102
- getWalletAccountId,
103
- parseWalletAccountId,
104
- KheopskitError
105
- };
106
- //# sourceMappingURL=chunk-DF7EKK4G.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/isEthereumAddress.ts","../src/utils/isSolanaAddress.ts","../src/utils/isSs58Address.ts","../src/utils/isValidAddress.ts","../src/utils/WalletAccountId.ts","../src/api/errors.ts"],"sourcesContent":["import { keccak_256 } from \"@noble/hashes/sha3\";\n\nconst HEX_ADDRESS = /^0x[0-9a-fA-F]{40}$/;\nconst encoder = new TextEncoder();\n\n/**\n * Verifies the EIP-55 mixed-case checksum of an Ethereum address.\n * Dependency-free (keccak via @noble/hashes) so core stays decoupled from viem.\n */\nconst isChecksumValid = (address: string): boolean => {\n\tconst hex = address.slice(2);\n\tconst hash = keccak_256(encoder.encode(hex.toLowerCase()));\n\tfor (let i = 0; i < 40; i++) {\n\t\tconst char = hex.charAt(i);\n\t\tconst isLetter =\n\t\t\t(char >= \"a\" && char <= \"f\") || (char >= \"A\" && char <= \"F\");\n\t\tif (!isLetter) continue;\n\t\tconst byte = hash[i >> 1] ?? 0;\n\t\tconst nibble = i % 2 === 0 ? byte >> 4 : byte & 0x0f;\n\t\tconst isUpper = char <= \"F\";\n\t\tif (isUpper !== nibble >= 8) return false;\n\t}\n\treturn true;\n};\n\n/**\n * Returns true if `address` is a valid Ethereum address.\n *\n * Mirrors viem's `isAddress` (strict): the shape must be `0x` + 40 hex, and a\n * mixed-case address must pass the EIP-55 checksum. All-lowercase addresses are\n * accepted as non-checksummed.\n */\nexport const isEthereumAddress = (address: string): boolean => {\n\tif (!HEX_ADDRESS.test(address)) return false;\n\tif (address === address.toLowerCase()) return true;\n\treturn isChecksumValid(address);\n};\n","import { base58 } from \"@scure/base\";\n\n/**\n * Returns true if the value is a valid Solana address: a base58-encoded\n * 32-byte ed25519 public key.\n *\n * Solana addresses carry no checksum, so this is a pure base58 + length check.\n * Dependency-free (base58 via @scure/base) so core stays decoupled from\n * @solana/kit.\n */\nexport const isSolanaAddress = (address: string): boolean => {\n\tif (!address) return false;\n\ttry {\n\t\treturn base58.decode(address).length === 32;\n\t} catch {\n\t\treturn false;\n\t}\n};\n","import { blake2b } from \"@noble/hashes/blake2b\";\nimport { base58 } from \"@scure/base\";\n\n// The \"SS58PRE\" prefix used in the SS58 checksum preimage.\nconst SS58PRE = new Uint8Array([0x53, 0x53, 0x35, 0x38, 0x50, 0x52, 0x45]);\n\n/**\n * Returns true if `address` is a valid SS58-encoded 32-byte account id (the\n * only form Substrate wallets inject), verifying the blake2b-512 checksum.\n *\n * Dependency-free (base58 via @scure/base, blake2b via @noble/hashes) so core\n * stays decoupled from polkadot-api.\n */\nexport const isSs58Address = (address: string): boolean => {\n\tif (!address) return false;\n\n\tlet decoded: Uint8Array;\n\ttry {\n\t\tdecoded = base58.decode(address);\n\t} catch {\n\t\treturn false;\n\t}\n\n\t// First byte encodes the network prefix; the high bit is reserved/invalid.\n\tconst firstByte = decoded[0];\n\tif (firstByte === undefined || firstByte & 0b1000_0000) return false;\n\t// The 0b0100_0000 bit marks a 2-byte prefix.\n\tconst prefixLength = firstByte & 0b0100_0000 ? 2 : 1;\n\n\t// AccountId32 layout: prefix + 32-byte pubkey + 2-byte checksum.\n\tif (decoded.length !== prefixLength + 32 + 2) return false;\n\n\tconst body = decoded.subarray(0, decoded.length - 2);\n\tconst preimage = new Uint8Array(SS58PRE.length + body.length);\n\tpreimage.set(SS58PRE);\n\tpreimage.set(body, SS58PRE.length);\n\tconst hash = blake2b(preimage, { dkLen: 64 });\n\n\treturn (\n\t\tdecoded[decoded.length - 2] === hash[0] &&\n\t\tdecoded[decoded.length - 1] === hash[1]\n\t);\n};\n","import { isEthereumAddress } from \"./isEthereumAddress\";\nimport { isSolanaAddress } from \"./isSolanaAddress\";\nimport { isSs58Address } from \"./isSs58Address\";\n\nexport const isValidAddress = (address: string): boolean => {\n\tif (address.startsWith(\"0x\")) return isEthereumAddress(address);\n\t// SS58 (checksummed) and Solana (base58, no checksum) are disjoint: a\n\t// 32-byte Solana pubkey fails SS58 decoding, and an SS58 address decodes to\n\t// more than 32 bytes so it fails the Solana length check.\n\treturn isSs58Address(address) || isSolanaAddress(address);\n};\n","import { isValidAddress } from \"./isValidAddress\";\n\nexport type WalletAccountId = string;\n\nexport const getWalletAccountId = (\n\twalletId: string,\n\taddress: string,\n): WalletAccountId => {\n\tif (!walletId) throw new Error(\"Missing walletId\");\n\tif (!isValidAddress(address)) throw new Error(\"Invalid address\");\n\treturn `${walletId}::${address}`;\n};\n\nexport const parseWalletAccountId = (accountId: string) => {\n\tif (!accountId) throw new Error(\"Invalid walletAccountId\");\n\tconst [walletId, address] = accountId.split(\"::\");\n\tif (!walletId) throw new Error(\"Missing walletId\");\n\tif (!address || !isValidAddress(address)) throw new Error(\"Invalid address\");\n\treturn { walletId, address };\n};\n","import type { WalletId } from \"../utils/WalletId\";\n\n/**\n * Stable error codes thrown by kheopskit. Catch a {@link KheopskitError} and\n * branch on `error.code` instead of matching message strings.\n */\nexport type KheopskitErrorCode =\n\t/** `connect()` called on a wallet that is already connected. */\n\t| \"WALLET_ALREADY_CONNECTED\"\n\t/** `disconnect()` called on a wallet that is not connected. */\n\t| \"WALLET_NOT_CONNECTED\"\n\t/** The wallet does not advertise a capability kheopskit needs to proceed. */\n\t| \"FEATURE_NOT_SUPPORTED\"\n\t/** No active WalletConnect session for the requested operation. */\n\t| \"NO_SESSION\"\n\t/** No provider available for the requested namespace. */\n\t| \"NO_PROVIDER\"\n\t/** The requested chain cannot be used for this operation (e.g. a Solana cluster with no CAIP-2 id over WalletConnect). */\n\t| \"UNSUPPORTED_CHAIN\";\n\n/**\n * Error thrown by kheopskit wallet/account operations. Carries a stable\n * {@link KheopskitErrorCode} and, when relevant, the offending wallet id.\n *\n * @example\n * ```ts\n * try {\n * await wallet.connect();\n * } catch (error) {\n * if (error instanceof KheopskitError && error.code === \"WALLET_ALREADY_CONNECTED\") {\n * // ignore\n * } else throw error;\n * }\n * ```\n */\nexport class KheopskitError extends Error {\n\treadonly code: KheopskitErrorCode;\n\t/** The wallet id this error relates to, when applicable. */\n\treadonly walletId?: WalletId;\n\n\tconstructor(\n\t\tcode: KheopskitErrorCode,\n\t\tmessage: string,\n\t\toptions?: { walletId?: WalletId; cause?: unknown },\n\t) {\n\t\tsuper(`[kheopskit] ${message}`, { cause: options?.cause });\n\t\tthis.name = \"Khe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;AAAA,EAKzC,YACC,MACA,SACA,SACC;AACD,UAAM,eAAe,OAAO,IAAI,EAAE,OAAO,SAAS,MAAM,CAAC;AAT1D,wBAAS;AAET;AAAA,wBAAS;AAQR,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,WAAW,SAAS;AAAA,EAC1B;AACD;","names":["base58"]}
@@ -1,106 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkP7BPHHVVjs = require('./chunk-P7BPHHVV.js');
4
-
5
- // src/utils/isEthereumAddress.ts
6
- var _sha3 = require('@noble/hashes/sha3');
7
- var HEX_ADDRESS = /^0x[0-9a-fA-F]{40}$/;
8
- var encoder = new TextEncoder();
9
- var isChecksumValid = (address) => {
10
- const hex = address.slice(2);
11
- const hash = _sha3.keccak_256.call(void 0, encoder.encode(hex.toLowerCase()));
12
- for (let i = 0; i < 40; i++) {
13
- const char = hex.charAt(i);
14
- const isLetter = char >= "a" && char <= "f" || char >= "A" && char <= "F";
15
- if (!isLetter) continue;
16
- const byte = _nullishCoalesce(hash[i >> 1], () => ( 0));
17
- const nibble = i % 2 === 0 ? byte >> 4 : byte & 15;
18
- const isUpper = char <= "F";
19
- if (isUpper !== nibble >= 8) return false;
20
- }
21
- return true;
22
- };
23
- var isEthereumAddress = (address) => {
24
- if (!HEX_ADDRESS.test(address)) return false;
25
- if (address === address.toLowerCase()) return true;
26
- return isChecksumValid(address);
27
- };
28
-
29
- // src/utils/isSolanaAddress.ts
30
- var _base = require('@scure/base');
31
- var isSolanaAddress = (address) => {
32
- if (!address) return false;
33
- try {
34
- return _base.base58.decode(address).length === 32;
35
- } catch (e) {
36
- return false;
37
- }
38
- };
39
-
40
- // src/utils/isSs58Address.ts
41
- var _blake2b = require('@noble/hashes/blake2b');
42
-
43
- var SS58PRE = new Uint8Array([83, 83, 53, 56, 80, 82, 69]);
44
- var isSs58Address = (address) => {
45
- if (!address) return false;
46
- let decoded;
47
- try {
48
- decoded = _base.base58.decode(address);
49
- } catch (e2) {
50
- return false;
51
- }
52
- const firstByte = decoded[0];
53
- if (firstByte === void 0 || firstByte & 128) return false;
54
- const prefixLength = firstByte & 64 ? 2 : 1;
55
- if (decoded.length !== prefixLength + 32 + 2) return false;
56
- const body = decoded.subarray(0, decoded.length - 2);
57
- const preimage = new Uint8Array(SS58PRE.length + body.length);
58
- preimage.set(SS58PRE);
59
- preimage.set(body, SS58PRE.length);
60
- const hash = _blake2b.blake2b.call(void 0, preimage, { dkLen: 64 });
61
- return decoded[decoded.length - 2] === hash[0] && decoded[decoded.length - 1] === hash[1];
62
- };
63
-
64
- // src/utils/isValidAddress.ts
65
- var isValidAddress = (address) => {
66
- if (address.startsWith("0x")) return isEthereumAddress(address);
67
- return isSs58Address(address) || isSolanaAddress(address);
68
- };
69
-
70
- // src/utils/WalletAccountId.ts
71
- var getWalletAccountId = (walletId, address) => {
72
- if (!walletId) throw new Error("Missing walletId");
73
- if (!isValidAddress(address)) throw new Error("Invalid address");
74
- return `${walletId}::${address}`;
75
- };
76
- var parseWalletAccountId = (accountId) => {
77
- if (!accountId) throw new Error("Invalid walletAccountId");
78
- const [walletId, address] = accountId.split("::");
79
- if (!walletId) throw new Error("Missing walletId");
80
- if (!address || !isValidAddress(address)) throw new Error("Invalid address");
81
- return { walletId, address };
82
- };
83
-
84
- // src/api/errors.ts
85
- var KheopskitError = class extends Error {
86
- constructor(code, message, options) {
87
- super(`[kheopskit] ${message}`, { cause: _optionalChain([options, 'optionalAccess', _ => _.cause]) });
88
- _chunkP7BPHHVVjs.__publicField.call(void 0, this, "code");
89
- /** The wallet id this error relates to, when applicable. */
90
- _chunkP7BPHHVVjs.__publicField.call(void 0, this, "walletId");
91
- this.name = "KheopskitError";
92
- this.code = code;
93
- this.walletId = _optionalChain([options, 'optionalAccess', _2 => _2.walletId]);
94
- }
95
- };
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
- exports.isEthereumAddress = isEthereumAddress; exports.isSolanaAddress = isSolanaAddress; exports.isSs58Address = isSs58Address; exports.isValidAddress = isValidAddress; exports.getWalletAccountId = getWalletAccountId; exports.parseWalletAccountId = parseWalletAccountId; exports.KheopskitError = KheopskitError;
106
- //# sourceMappingURL=chunk-EH73P476.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/kheopskit/kheopskit/packages/core/dist/chunk-EH73P476.js","../src/utils/isEthereumAddress.ts","../src/utils/isSolanaAddress.ts","../src/utils/isSs58Address.ts","../src/utils/isValidAddress.ts","../src/utils/WalletAccountId.ts","../src/api/errors.ts"],"names":["base58"],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACJA,0CAA2B;AAE3B,IAAM,YAAA,EAAc,qBAAA;AACpB,IAAM,QAAA,EAAU,IAAI,WAAA,CAAY,CAAA;AAMhC,IAAM,gBAAA,EAAkB,CAAC,OAAA,EAAA,GAA6B;AACrD,EAAA,MAAM,IAAA,EAAM,OAAA,CAAQ,KAAA,CAAM,CAAC,CAAA;AAC3B,EAAA,MAAM,KAAA,EAAO,8BAAA,OAAW,CAAQ,MAAA,CAAO,GAAA,CAAI,WAAA,CAAY,CAAC,CAAC,CAAA;AACzD,EAAA,IAAA,CAAA,IAAS,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,EAAA,EAAI,CAAA,EAAA,EAAK;AAC5B,IAAA,MAAM,KAAA,EAAO,GAAA,CAAI,MAAA,CAAO,CAAC,CAAA;AACzB,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,CAAA;AHoBA;AACA;AI3DO,IAAM,eAAA,EAAiB,CAAC,OAAA,EAAA,GAA6B;AAC3D,EAAA,GAAA,CAAI,OAAA,CAAQ,UAAA,CAAW,IAAI,CAAA,EAAG,OAAO,iBAAA,CAAkB,OAAO,CAAA;AAI9D,EAAA,OAAO,aAAA,CAAc,OAAO,EAAA,GAAK,eAAA,CAAgB,OAAO,CAAA;AACzD,CAAA;AJ0DA;AACA;AKjEO,IAAM,mBAAA,EAAqB,CACjC,QAAA,EACA,OAAA,EAAA,GACqB;AACrB,EAAA,GAAA,CAAI,CAAC,QAAA,EAAU,MAAM,IAAI,KAAA,CAAM,kBAAkB,CAAA;AACjD,EAAA,GAAA,CAAI,CAAC,cAAA,CAAe,OAAO,CAAA,EAAG,MAAM,IAAI,KAAA,CAAM,iBAAiB,CAAA;AAC/D,EAAA,OAAO,CAAA,EAAA;AACR;AAEa;AACP,EAAA;AACE,EAAA;AACF,EAAA;AACA,EAAA;AACE,EAAA;AACR;AL+DU;AACA;AMhDG;AAKZ,EAAA;AAKO,IAAA;AATP,IAAA;AAEA;AAAA,IAAA;AAQM,IAAA;AACA,IAAA;AACA,IAAA;AACN,EAAA;AACD;AN6CU;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/kheopskit/kheopskit/packages/core/dist/chunk-EH73P476.js","sourcesContent":[null,"import { keccak_256 } from \"@noble/hashes/sha3\";\n\nconst HEX_ADDRESS = /^0x[0-9a-fA-F]{40}$/;\nconst encoder = new TextEncoder();\n\n/**\n * Verifies the EIP-55 mixed-case checksum of an Ethereum address.\n * Dependency-free (keccak via @noble/hashes) so core stays decoupled from viem.\n */\nconst isChecksumValid = (address: string): boolean => {\n\tconst hex = address.slice(2);\n\tconst hash = keccak_256(encoder.encode(hex.toLowerCase()));\n\tfor (let i = 0; i < 40; i++) {\n\t\tconst char = hex.charAt(i);\n\t\tconst isLetter =\n\t\t\t(char >= \"a\" && char <= \"f\") || (char >= \"A\" && char <= \"F\");\n\t\tif (!isLetter) continue;\n\t\tconst byte = hash[i >> 1] ?? 0;\n\t\tconst nibble = i % 2 === 0 ? byte >> 4 : byte & 0x0f;\n\t\tconst isUpper = char <= \"F\";\n\t\tif (isUpper !== nibble >= 8) return false;\n\t}\n\treturn true;\n};\n\n/**\n * Returns true if `address` is a valid Ethereum address.\n *\n * Mirrors viem's `isAddress` (strict): the shape must be `0x` + 40 hex, and a\n * mixed-case address must pass the EIP-55 checksum. All-lowercase addresses are\n * accepted as non-checksummed.\n */\nexport const isEthereumAddress = (address: string): boolean => {\n\tif (!HEX_ADDRESS.test(address)) return false;\n\tif (address === address.toLowerCase()) return true;\n\treturn isChecksumValid(address);\n};\n","import { base58 } from \"@scure/base\";\n\n/**\n * Returns true if the value is a valid Solana address: a base58-encoded\n * 32-byte ed25519 public key.\n *\n * Solana addresses carry no checksum, so this is a pure base58 + length check.\n * Dependency-free (base58 via @scure/base) so core stays decoupled from\n * @solana/kit.\n */\nexport const isSolanaAddress = (address: string): boolean => {\n\tif (!address) return false;\n\ttry {\n\t\treturn base58.decode(address).length === 32;\n\t} catch {\n\t\treturn false;\n\t}\n};\n","import { blake2b } from \"@noble/hashes/blake2b\";\nimport { base58 } from \"@scure/base\";\n\n// The \"SS58PRE\" prefix used in the SS58 checksum preimage.\nconst SS58PRE = new Uint8Array([0x53, 0x53, 0x35, 0x38, 0x50, 0x52, 0x45]);\n\n/**\n * Returns true if `address` is a valid SS58-encoded 32-byte account id (the\n * only form Substrate wallets inject), verifying the blake2b-512 checksum.\n *\n * Dependency-free (base58 via @scure/base, blake2b via @noble/hashes) so core\n * stays decoupled from polkadot-api.\n */\nexport const isSs58Address = (address: string): boolean => {\n\tif (!address) return false;\n\n\tlet decoded: Uint8Array;\n\ttry {\n\t\tdecoded = base58.decode(address);\n\t} catch {\n\t\treturn false;\n\t}\n\n\t// First byte encodes the network prefix; the high bit is reserved/invalid.\n\tconst firstByte = decoded[0];\n\tif (firstByte === undefined || firstByte & 0b1000_0000) return false;\n\t// The 0b0100_0000 bit marks a 2-byte prefix.\n\tconst prefixLength = firstByte & 0b0100_0000 ? 2 : 1;\n\n\t// AccountId32 layout: prefix + 32-byte pubkey + 2-byte checksum.\n\tif (decoded.length !== prefixLength + 32 + 2) return false;\n\n\tconst body = decoded.subarray(0, decoded.length - 2);\n\tconst preimage = new Uint8Array(SS58PRE.length + body.length);\n\tpreimage.set(SS58PRE);\n\tpreimage.set(body, SS58PRE.length);\n\tconst hash = blake2b(preimage, { dkLen: 64 });\n\n\treturn (\n\t\tdecoded[decoded.length - 2] === hash[0] &&\n\t\tdecoded[decoded.length - 1] === hash[1]\n\t);\n};\n","import { isEthereumAddress } from \"./isEthereumAddress\";\nimport { isSolanaAddress } from \"./isSolanaAddress\";\nimport { isSs58Address } from \"./isSs58Address\";\n\nexport const isValidAddress = (address: string): boolean => {\n\tif (address.startsWith(\"0x\")) return isEthereumAddress(address);\n\t// SS58 (checksummed) and Solana (base58, no checksum) are disjoint: a\n\t// 32-byte Solana pubkey fails SS58 decoding, and an SS58 address decodes to\n\t// more than 32 bytes so it fails the Solana length check.\n\treturn isSs58Address(address) || isSolanaAddress(address);\n};\n","import { isValidAddress } from \"./isValidAddress\";\n\nexport type WalletAccountId = string;\n\nexport const getWalletAccountId = (\n\twalletId: string,\n\taddress: string,\n): WalletAccountId => {\n\tif (!walletId) throw new Error(\"Missing walletId\");\n\tif (!isValidAddress(address)) throw new Error(\"Invalid address\");\n\treturn `${walletId}::${address}`;\n};\n\nexport const parseWalletAccountId = (accountId: string) => {\n\tif (!accountId) throw new Error(\"Invalid walletAccountId\");\n\tconst [walletId, address] = accountId.split(\"::\");\n\tif (!walletId) throw new Error(\"Missing walletId\");\n\tif (!address || !isValidAddress(address)) throw new Error(\"Invalid address\");\n\treturn { walletId, address };\n};\n","import type { WalletId } from \"../utils/WalletId\";\n\n/**\n * Stable error codes thrown by kheopskit. Catch a {@link KheopskitError} and\n * branch on `error.code` instead of matching message strings.\n */\nexport type KheopskitErrorCode =\n\t/** `connect()` called on a wallet that is already connected. */\n\t| \"WALLET_ALREADY_CONNECTED\"\n\t/** `disconnect()` called on a wallet that is not connected. */\n\t| \"WALLET_NOT_CONNECTED\"\n\t/** The wallet does not advertise a capability kheopskit needs to proceed. */\n\t| \"FEATURE_NOT_SUPPORTED\"\n\t/** No active WalletConnect session for the requested operation. */\n\t| \"NO_SESSION\"\n\t/** No provider available for the requested namespace. */\n\t| \"NO_PROVIDER\"\n\t/** The requested chain cannot be used for this operation (e.g. a Solana cluster with no CAIP-2 id over WalletConnect). */\n\t| \"UNSUPPORTED_CHAIN\";\n\n/**\n * Error thrown by kheopskit wallet/account operations. Carries a stable\n * {@link KheopskitErrorCode} and, when relevant, the offending wallet id.\n *\n * @example\n * ```ts\n * try {\n * await wallet.connect();\n * } catch (error) {\n * if (error instanceof KheopskitError && error.code === \"WALLET_ALREADY_CONNECTED\") {\n * // ignore\n * } else throw error;\n * }\n * ```\n */\nexport class KheopskitError extends Error {\n\treadonly code: KheopskitErrorCode;\n\t/** The wallet id this error relates to, when applicable. */\n\treadonly walletId?: WalletId;\n\n\tconstructor(\n\t\tcode: KheopskitErrorCode,\n\t\tmessage: string,\n\t\toptions?: { walletId?: WalletId; cause?: unknown },\n\t) {\n\t\tsuper(`[kheopskit] ${message}`, { cause: options?.cause });\n\t\tthis.name = \"KheopskitError\";\n\t\tthis.code = code;\n\t\tthis.walletId = options?.walletId;\n\t}\n}\n"]}
@@ -1,147 +0,0 @@
1
- import {
2
- KheopskitError
3
- } from "./chunk-DF7EKK4G.mjs";
4
- import {
5
- getCachedObservable$,
6
- isWalletConnectWallet
7
- } from "./chunk-WOPCW2OX.mjs";
8
-
9
- // src/api/platformAccounts.ts
10
- import {
11
- combineLatest,
12
- distinctUntilChanged,
13
- map,
14
- Observable,
15
- of,
16
- shareReplay,
17
- switchMap
18
- } from "rxjs";
19
- var createPlatformAccounts$ = ({
20
- wallets$,
21
- getInjectedAccounts$,
22
- getWalletConnectAccounts$,
23
- mapAccounts,
24
- accountChangeKey = (account) => account.id
25
- }) => {
26
- const accountsListEqual = (a, b) => a.length === b.length && a.every((account, i) => {
27
- const other = b[i];
28
- return !!other && accountChangeKey(account) === accountChangeKey(other);
29
- });
30
- return new Observable((subscriber) => {
31
- const sub = wallets$.pipe(
32
- map((wallets) => wallets.filter((w) => w.isConnected)),
33
- switchMap(
34
- (wallets) => wallets.length ? combineLatest([
35
- ...wallets.filter((w) => !isWalletConnectWallet(w)).map(getInjectedAccounts$),
36
- ...wallets.filter(isWalletConnectWallet).map(getWalletConnectAccounts$)
37
- ]) : of([])
38
- ),
39
- map((accounts) => {
40
- const flat = accounts.flat();
41
- return mapAccounts ? mapAccounts(flat) : flat;
42
- }),
43
- distinctUntilChanged(accountsListEqual)
44
- ).subscribe(subscriber);
45
- return () => {
46
- sub.unsubscribe();
47
- };
48
- }).pipe(shareReplay({ refCount: true, bufferSize: 1 }));
49
- };
50
- var getSessionCaip10s = (session, namespace) => Object.values(session.namespaces).flatMap((ns) => ns.accounts ?? []).filter((account) => account.startsWith(`${namespace}:`));
51
- var getCaip10Addresses = (caip10s) => [
52
- ...new Set(
53
- caip10s.map((account) => account.split(":")[2]).filter((address) => !!address)
54
- )
55
- ];
56
- var getWalletConnectSessionAccounts$ = (options) => {
57
- const { wallet, platform, namespace, cacheKey, buildAccounts } = options;
58
- const provider = wallet.appKit.getProvider(namespace);
59
- if (!wallet.platforms.includes(platform) || !provider?.session) return of([]);
60
- return getCachedObservable$(
61
- cacheKey,
62
- () => new Observable((subscriber) => {
63
- subscriber.next(buildAccounts(provider));
64
- const reemit = () => subscriber.next(buildAccounts(provider));
65
- provider.on("session_update", reemit);
66
- provider.on("accountsChanged", reemit);
67
- return () => {
68
- provider.off("session_update", reemit);
69
- provider.off("accountsChanged", reemit);
70
- };
71
- }).pipe(shareReplay({ refCount: true, bufferSize: 1 }))
72
- );
73
- };
74
-
75
- // src/api/injectedWallets.ts
76
- import {
77
- BehaviorSubject,
78
- combineLatest as combineLatest2,
79
- distinctUntilChanged as distinctUntilChanged2,
80
- map as map2,
81
- Observable as Observable2,
82
- shareReplay as shareReplay2
83
- } from "rxjs";
84
- var walletsEqual = (a, b) => {
85
- if (a.length !== b.length) return false;
86
- return a.every(
87
- (w, i) => w.id === b[i]?.id && w.isConnected === b[i]?.isConnected && w.name === b[i]?.name
88
- );
89
- };
90
- var createInjectedWallets$ = (store, adapter) => new Observable2((subscriber) => {
91
- const handles$ = new BehaviorSubject(/* @__PURE__ */ new Map());
92
- const connect = async (source, walletId) => {
93
- if (handles$.value.has(walletId))
94
- throw new KheopskitError(
95
- "WALLET_ALREADY_CONNECTED",
96
- `wallet ${walletId} is already connected`,
97
- { walletId }
98
- );
99
- const handle = await adapter.connect(source, walletId);
100
- const next = new Map(handles$.value);
101
- next.set(walletId, handle);
102
- handles$.next(next);
103
- store.addEnabledWalletId(walletId);
104
- };
105
- const disconnect = async (source, walletId) => {
106
- if (!handles$.value.has(walletId))
107
- throw new KheopskitError(
108
- "WALLET_NOT_CONNECTED",
109
- `wallet ${walletId} is not connected`,
110
- { walletId }
111
- );
112
- await adapter.disconnect?.(source, walletId);
113
- const next = new Map(handles$.value);
114
- next.delete(walletId);
115
- handles$.next(next);
116
- store.removeEnabledWalletId(walletId);
117
- adapter.onDisconnected?.(walletId);
118
- };
119
- const sub = combineLatest2([adapter.sources$, handles$]).pipe(
120
- map2(
121
- ([sources, handles]) => sources.map((source) => {
122
- const walletId = adapter.getWalletId(source);
123
- return adapter.buildWallet({
124
- source,
125
- walletId,
126
- handle: handles.get(walletId),
127
- isConnected: handles.has(walletId),
128
- connect: () => connect(source, walletId),
129
- disconnect: () => disconnect(source, walletId)
130
- });
131
- })
132
- ),
133
- distinctUntilChanged2(walletsEqual)
134
- ).subscribe(subscriber);
135
- return () => {
136
- sub.unsubscribe();
137
- };
138
- }).pipe(shareReplay2({ refCount: true, bufferSize: 1 }));
139
-
140
- export {
141
- createPlatformAccounts$,
142
- getSessionCaip10s,
143
- getCaip10Addresses,
144
- getWalletConnectSessionAccounts$,
145
- createInjectedWallets$
146
- };
147
- //# sourceMappingURL=chunk-JVSCMJY5.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"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":";;;;;;;;;AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAuCA,IAAM,0BAA0B,CAGrC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,mBAAmB,CAAC,YAAY,QAAQ;AACzC,MAA0E;AACzE,QAAM,oBAAoB,CAAC,GAAe,MACzC,EAAE,WAAW,EAAE,UACf,EAAE,MAAM,CAAC,SAAS,MAAM;AACvB,UAAM,QAAQ,EAAE,CAAC;AACjB,WAAO,CAAC,CAAC,SAAS,iBAAiB,OAAO,MAAM,iBAAiB,KAAK;AAAA,EACvE,CAAC;AAEF,SAAO,IAAI,WAAuB,CAAC,eAAe;AACjD,UAAM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AAM,mBAAmB,QAAQ;AAAA,EAClC;AAEA,QAAM,aAAa,OAAO,QAAiB,aAAuB;AACjE,QAAI,CAAC,SAAS,MAAM,IAAI,QAAQ;AAC/B,YAAM,IAAI;AAAA,QACT;AAAA,QACA,UAAU,QAAQ;AAAA,QAClB,EAAE,SAAS;AAAA,MACZ;AAED,UAAM,QAAQ,aAAa,QAAQ,QAAQ;AAE3C,UAAM,OAAO,IAAI,IAAI,SAAS,KAAK;AACnC,SAAK,OAAO,QAAQ;AACpB,aAAS,KAAK,IAAI;AAElB,UAAM,sBAAsB,QAAQ;AAEpC,YAAQ,iBAAiB,QAAQ;AAAA,EAClC;AAEA,QAAM,MAAMC,eAAc,CAAC,QAAQ,UAAU,QAAQ,CAAC,EACpD;AAAA,IACAC;AAAA,MAAI,CAAC,CAAC,SAAS,OAAO,MACrB,QAAQ,IAAI,CAAC,WAAoB;AAChC,cAAM,WAAW,QAAQ,YAAY,MAAM;AAC3C,eAAO,QAAQ,YAAY;AAAA,UAC1B;AAAA,UACA;AAAA,UACA,QAAQ,QAAQ,IAAI,QAAQ;AAAA,UAC5B,aAAa,QAAQ,IAAI,QAAQ;AAAA,UACjC,SAAS,MAAM,QAAQ,QAAQ,QAAQ;AAAA,UACvC,YAAY,MAAM,WAAW,QAAQ,QAAQ;AAAA,QAC9C,CAAC;AAAA,MACF,CAAC;AAAA,IACF;AAAA,IACAC,sBAAqB,YAAY;AAAA,EAClC,EACC,UAAU,UAAU;AAEtB,SAAO,MAAM;AACZ,QAAI,YAAY;AAAA,EACjB;AACD,CAAC,EAAE,KAAKC,aAAY,EAAE,UAAU,MAAM,YAAY,EAAE,CAAC,CAAC;","names":["combineLatest","distinctUntilChanged","map","Observable","shareReplay","Observable","combineLatest","map","distinctUntilChanged","shareReplay"]}
@@ -1,76 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
-
5
- // src/utils/isWalletPlatform.ts
6
- var isWalletPlatform = (platform) => typeof platform === "string" && ["polkadot", "ethereum", "solana"].includes(platform);
7
-
8
- // src/utils/WalletId.ts
9
- var WALLET_CONNECT_WALLET_ID = "walletconnect";
10
- var getWalletId = (platform, identifier) => {
11
- if (!isWalletPlatform(platform)) throw new Error("Invalid platform");
12
- if (!identifier) throw new Error("Invalid name");
13
- return `${platform}:${identifier}`;
14
- };
15
- var parseWalletId = (walletId) => {
16
- if (!walletId) throw new Error("Invalid walletId");
17
- const [platform, identifier] = walletId.split(":");
18
- if (!isWalletPlatform(platform)) throw new Error("Invalid platform");
19
- if (!identifier) throw new Error("Invalid address");
20
- return { platform, identifier };
21
- };
22
- var isValidWalletId = (walletId) => {
23
- if (typeof walletId !== "string" || !walletId) return false;
24
- if (walletId === WALLET_CONNECT_WALLET_ID) return true;
25
- const [platform, identifier] = walletId.split(":");
26
- return isWalletPlatform(platform) && !!identifier;
27
- };
28
-
29
- // src/utils/getCachedObservable.ts
30
- var CACHE_SYMBOL = /* @__PURE__ */ Symbol.for("kheopskit.observableCache");
31
- var getCache = () => {
32
- const g = globalThis;
33
- let cache = g[CACHE_SYMBOL];
34
- if (!cache) {
35
- cache = /* @__PURE__ */ new Map();
36
- g[CACHE_SYMBOL] = cache;
37
- }
38
- return cache;
39
- };
40
- var getCachedObservable$ = (key, create) => {
41
- const cache = getCache();
42
- if (!cache.has(key)) cache.set(key, create());
43
- return cache.get(key);
44
- };
45
- var clearCachedObservable = (key) => {
46
- getCache().delete(key);
47
- };
48
- var clearCachedObservablesByPrefix = (prefix) => {
49
- const cache = getCache();
50
- for (const key of cache.keys()) {
51
- if (key.startsWith(prefix)) cache.delete(key);
52
- }
53
- };
54
- var clearAllCachedObservables = () => {
55
- getCache().clear();
56
- };
57
-
58
- // src/api/types.ts
59
- var isWalletConnectWallet = (wallet) => wallet.type === "walletconnect";
60
- var isInjectedWallet = (wallet) => wallet.type === "injected";
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
- exports.__publicField = __publicField; exports.isWalletPlatform = isWalletPlatform; exports.WALLET_CONNECT_WALLET_ID = WALLET_CONNECT_WALLET_ID; exports.getWalletId = getWalletId; exports.parseWalletId = parseWalletId; exports.isValidWalletId = isValidWalletId; exports.getCachedObservable$ = getCachedObservable$; exports.clearCachedObservable = clearCachedObservable; exports.clearCachedObservablesByPrefix = clearCachedObservablesByPrefix; exports.clearAllCachedObservables = clearAllCachedObservables; exports.isWalletConnectWallet = isWalletConnectWallet; exports.isInjectedWallet = isInjectedWallet;
76
- //# sourceMappingURL=chunk-P7BPHHVV.js.map