@kheopskit/react 0.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # @kheopskit/react
2
+
3
+ ## 0.0.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3216d3b`](https://github.com/0xKheops/kheopskit-alpha/commit/3216d3b4ca1f2fadbebe9a4275e7b864ac89d222) Thanks [@0xKheops](https://github.com/0xKheops)! - initial alpha release
8
+
9
+ - Updated dependencies [[`3216d3b`](https://github.com/0xKheops/kheopskit-alpha/commit/3216d3b4ca1f2fadbebe9a4275e7b864ac89d222)]:
10
+ - @kheopskit/core@0.0.1-alpha.0
@@ -0,0 +1,21 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import * as _kheopskit_core from '@kheopskit/core';
3
+ import { KheopskitConfig } from '@kheopskit/core';
4
+
5
+ declare const SuspenseMonitorInner: FC<{
6
+ label: string;
7
+ }>;
8
+ declare const SuspenseMonitor: FC<{
9
+ label: string;
10
+ }>;
11
+
12
+ declare const useWallets: () => {
13
+ wallets: _kheopskit_core.Wallet[];
14
+ accounts: _kheopskit_core.WalletAccount[];
15
+ };
16
+
17
+ declare const KheopskitProvider: FC<PropsWithChildren & {
18
+ config: KheopskitConfig;
19
+ }>;
20
+
21
+ export { KheopskitProvider, SuspenseMonitor, SuspenseMonitorInner, useWallets };
@@ -0,0 +1,21 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import * as _kheopskit_core from '@kheopskit/core';
3
+ import { KheopskitConfig } from '@kheopskit/core';
4
+
5
+ declare const SuspenseMonitorInner: FC<{
6
+ label: string;
7
+ }>;
8
+ declare const SuspenseMonitor: FC<{
9
+ label: string;
10
+ }>;
11
+
12
+ declare const useWallets: () => {
13
+ wallets: _kheopskit_core.Wallet[];
14
+ accounts: _kheopskit_core.WalletAccount[];
15
+ };
16
+
17
+ declare const KheopskitProvider: FC<PropsWithChildren & {
18
+ config: KheopskitConfig;
19
+ }>;
20
+
21
+ export { KheopskitProvider, SuspenseMonitor, SuspenseMonitorInner, useWallets };
package/dist/index.js ADDED
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ KheopskitProvider: () => KheopskitProvider,
24
+ SuspenseMonitor: () => SuspenseMonitor,
25
+ SuspenseMonitorInner: () => SuspenseMonitorInner,
26
+ useWallets: () => useWallets
27
+ });
28
+ module.exports = __toCommonJS(index_exports);
29
+
30
+ // src/SuspenseMonitor.tsx
31
+ var import_react = require("react");
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ var SHOULD_LOG = true;
34
+ var SuspenseMonitorInner = ({ label }) => {
35
+ const refStart = (0, import_react.useRef)(performance.now());
36
+ (0, import_react.useEffect)(() => {
37
+ const timeout = setTimeout(() => {
38
+ console.warn(`[Suspense] ${label} is hanging`);
39
+ }, 500);
40
+ return () => {
41
+ console.debug(
42
+ "[Suspense] %s : %s ms",
43
+ label,
44
+ (performance.now() - refStart.current).toFixed(2)
45
+ );
46
+ clearTimeout(timeout);
47
+ };
48
+ }, [label]);
49
+ return null;
50
+ };
51
+ var SuspenseMonitor = ({ label }) => SHOULD_LOG ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SuspenseMonitorInner, { label }) : null;
52
+
53
+ // src/useKheopskit.ts
54
+ var import_core = require("@kheopskit/core");
55
+ var import_core2 = require("@react-rxjs/core");
56
+ var import_react3 = require("react");
57
+
58
+ // src/context.ts
59
+ var import_react2 = require("react");
60
+ var KheopskitContext = (0, import_react2.createContext)(null);
61
+
62
+ // src/useKheopskit.ts
63
+ var DEFAULT_VALUE = {
64
+ wallets: [],
65
+ accounts: []
66
+ };
67
+ var [useKheopskit] = (0, import_core2.bind)(
68
+ (config) => (0, import_core.getKheopskit$)(config),
69
+ DEFAULT_VALUE
70
+ );
71
+ var useWallets = () => {
72
+ const ctx = (0, import_react3.useContext)(KheopskitContext);
73
+ if (!ctx)
74
+ throw new Error("useWallets must be used within a KheopskitProvider");
75
+ const kheopskit = useKheopskit(ctx.config);
76
+ return {
77
+ wallets: kheopskit.wallets,
78
+ accounts: kheopskit.accounts
79
+ };
80
+ };
81
+
82
+ // src/KheopskitProvider.tsx
83
+ var import_core3 = require("@react-rxjs/core");
84
+ var import_jsx_runtime2 = require("react/jsx-runtime");
85
+ var KheopskitProvider = ({ children, config }) => {
86
+ return (
87
+ // TODO set source
88
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(KheopskitContext.Provider, { value: { config }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core3.Subscribe, { fallback: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SuspenseMonitor, { label: "KheopskitProvider" }), children }) })
89
+ );
90
+ };
91
+ // Annotate the CommonJS export names for ESM import in node:
92
+ 0 && (module.exports = {
93
+ KheopskitProvider,
94
+ SuspenseMonitor,
95
+ SuspenseMonitorInner,
96
+ useWallets
97
+ });
98
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/SuspenseMonitor.tsx","../src/useKheopskit.ts","../src/context.ts","../src/KheopskitProvider.tsx"],"sourcesContent":["export * from \"./SuspenseMonitor\";\nexport * from \"./useKheopskit\";\nexport * from \"./KheopskitProvider\";\n","import { type FC, useEffect, useRef } from \"react\";\n\nconst SHOULD_LOG = true; // TODO only DEV\n\nexport const SuspenseMonitorInner: FC<{ label: string }> = ({ label }) => {\n const refStart = useRef(performance.now());\n\n useEffect(() => {\n const timeout = setTimeout(() => {\n console.warn(`[Suspense] ${label} is hanging`);\n }, 500);\n\n return () => {\n console.debug(\n \"[Suspense] %s : %s ms\",\n label,\n (performance.now() - refStart.current).toFixed(2)\n );\n clearTimeout(timeout);\n };\n }, [label]);\n\n return null;\n};\n\nexport const SuspenseMonitor: FC<{ label: string }> = ({ label }) =>\n SHOULD_LOG ? <SuspenseMonitorInner label={label} /> : null;\n","import { getKheopskit$, type KheopskitConfig } from \"@kheopskit/core\";\nimport { bind } from \"@react-rxjs/core\";\nimport { useContext } from \"react\";\nimport { KheopskitContext } from \"./context\";\n\nconst DEFAULT_VALUE = {\n wallets: [],\n accounts: [],\n};\n\nconst [useKheopskit] = bind(\n (config: KheopskitConfig) => getKheopskit$(config),\n DEFAULT_VALUE\n);\n\nexport const useWallets = () => {\n const ctx = useContext(KheopskitContext);\n if (!ctx)\n throw new Error(\"useWallets must be used within a KheopskitProvider\");\n\n const kheopskit = useKheopskit(ctx.config);\n\n return {\n wallets: kheopskit.wallets,\n accounts: kheopskit.accounts,\n };\n};\n","import type { KheopskitConfig } from \"@kheopskit/core\";\nimport { createContext } from \"react\";\n\nexport const KheopskitContext = createContext<{\n config: KheopskitConfig;\n} | null>(null);\n","import type { KheopskitConfig } from \"@kheopskit/core\";\nimport { Subscribe } from \"@react-rxjs/core\";\nimport type { FC, PropsWithChildren } from \"react\";\nimport { KheopskitContext } from \"./context\";\nimport { SuspenseMonitor } from \"./SuspenseMonitor\";\n\nexport const KheopskitProvider: FC<\n PropsWithChildren & { config: KheopskitConfig }\n> = ({ children, config }) => {\n return (\n // TODO set source\n <KheopskitContext.Provider value={{ config }}>\n <Subscribe fallback={<SuspenseMonitor label=\"KheopskitProvider\" />}>\n {children}\n </Subscribe>\n </KheopskitContext.Provider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA2C;AA0B5B;AAxBf,IAAM,aAAa;AAEZ,IAAM,uBAA8C,CAAC,EAAE,MAAM,MAAM;AACxE,QAAM,eAAW,qBAAO,YAAY,IAAI,CAAC;AAEzC,8BAAU,MAAM;AACd,UAAM,UAAU,WAAW,MAAM;AAC/B,cAAQ,KAAK,cAAc,KAAK,aAAa;AAAA,IAC/C,GAAG,GAAG;AAEN,WAAO,MAAM;AACX,cAAQ;AAAA,QACN;AAAA,QACA;AAAA,SACC,YAAY,IAAI,IAAI,SAAS,SAAS,QAAQ,CAAC;AAAA,MAClD;AACA,mBAAa,OAAO;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AACT;AAEO,IAAM,kBAAyC,CAAC,EAAE,MAAM,MAC7D,aAAa,4CAAC,wBAAqB,OAAc,IAAK;;;AC1BxD,kBAAoD;AACpD,IAAAA,eAAqB;AACrB,IAAAC,gBAA2B;;;ACD3B,IAAAC,gBAA8B;AAEvB,IAAM,uBAAmB,6BAEtB,IAAI;;;ADAd,IAAM,gBAAgB;AAAA,EACpB,SAAS,CAAC;AAAA,EACV,UAAU,CAAC;AACb;AAEA,IAAM,CAAC,YAAY,QAAI;AAAA,EACrB,CAAC,eAA4B,2BAAc,MAAM;AAAA,EACjD;AACF;AAEO,IAAM,aAAa,MAAM;AAC9B,QAAM,UAAM,0BAAW,gBAAgB;AACvC,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,oDAAoD;AAEtE,QAAM,YAAY,aAAa,IAAI,MAAM;AAEzC,SAAO;AAAA,IACL,SAAS,UAAU;AAAA,IACnB,UAAU,UAAU;AAAA,EACtB;AACF;;;AEzBA,IAAAC,eAA0B;AAWC,IAAAC,sBAAA;AANpB,IAAM,oBAET,CAAC,EAAE,UAAU,OAAO,MAAM;AAC5B;AAAA;AAAA,IAEE,6CAAC,iBAAiB,UAAjB,EAA0B,OAAO,EAAE,OAAO,GACzC,uDAAC,0BAAU,UAAU,6CAAC,mBAAgB,OAAM,qBAAoB,GAC7D,UACH,GACF;AAAA;AAEJ;","names":["import_core","import_react","import_react","import_core","import_jsx_runtime"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,68 @@
1
+ // src/SuspenseMonitor.tsx
2
+ import { useEffect, useRef } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var SHOULD_LOG = true;
5
+ var SuspenseMonitorInner = ({ label }) => {
6
+ const refStart = useRef(performance.now());
7
+ useEffect(() => {
8
+ const timeout = setTimeout(() => {
9
+ console.warn(`[Suspense] ${label} is hanging`);
10
+ }, 500);
11
+ return () => {
12
+ console.debug(
13
+ "[Suspense] %s : %s ms",
14
+ label,
15
+ (performance.now() - refStart.current).toFixed(2)
16
+ );
17
+ clearTimeout(timeout);
18
+ };
19
+ }, [label]);
20
+ return null;
21
+ };
22
+ var SuspenseMonitor = ({ label }) => SHOULD_LOG ? /* @__PURE__ */ jsx(SuspenseMonitorInner, { label }) : null;
23
+
24
+ // src/useKheopskit.ts
25
+ import { getKheopskit$ } from "@kheopskit/core";
26
+ import { bind } from "@react-rxjs/core";
27
+ import { useContext } from "react";
28
+
29
+ // src/context.ts
30
+ import { createContext } from "react";
31
+ var KheopskitContext = createContext(null);
32
+
33
+ // src/useKheopskit.ts
34
+ var DEFAULT_VALUE = {
35
+ wallets: [],
36
+ accounts: []
37
+ };
38
+ var [useKheopskit] = bind(
39
+ (config) => getKheopskit$(config),
40
+ DEFAULT_VALUE
41
+ );
42
+ var useWallets = () => {
43
+ const ctx = useContext(KheopskitContext);
44
+ if (!ctx)
45
+ throw new Error("useWallets must be used within a KheopskitProvider");
46
+ const kheopskit = useKheopskit(ctx.config);
47
+ return {
48
+ wallets: kheopskit.wallets,
49
+ accounts: kheopskit.accounts
50
+ };
51
+ };
52
+
53
+ // src/KheopskitProvider.tsx
54
+ import { Subscribe } from "@react-rxjs/core";
55
+ import { jsx as jsx2 } from "react/jsx-runtime";
56
+ var KheopskitProvider = ({ children, config }) => {
57
+ return (
58
+ // TODO set source
59
+ /* @__PURE__ */ jsx2(KheopskitContext.Provider, { value: { config }, children: /* @__PURE__ */ jsx2(Subscribe, { fallback: /* @__PURE__ */ jsx2(SuspenseMonitor, { label: "KheopskitProvider" }), children }) })
60
+ );
61
+ };
62
+ export {
63
+ KheopskitProvider,
64
+ SuspenseMonitor,
65
+ SuspenseMonitorInner,
66
+ useWallets
67
+ };
68
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SuspenseMonitor.tsx","../src/useKheopskit.ts","../src/context.ts","../src/KheopskitProvider.tsx"],"sourcesContent":["import { type FC, useEffect, useRef } from \"react\";\n\nconst SHOULD_LOG = true; // TODO only DEV\n\nexport const SuspenseMonitorInner: FC<{ label: string }> = ({ label }) => {\n const refStart = useRef(performance.now());\n\n useEffect(() => {\n const timeout = setTimeout(() => {\n console.warn(`[Suspense] ${label} is hanging`);\n }, 500);\n\n return () => {\n console.debug(\n \"[Suspense] %s : %s ms\",\n label,\n (performance.now() - refStart.current).toFixed(2)\n );\n clearTimeout(timeout);\n };\n }, [label]);\n\n return null;\n};\n\nexport const SuspenseMonitor: FC<{ label: string }> = ({ label }) =>\n SHOULD_LOG ? <SuspenseMonitorInner label={label} /> : null;\n","import { getKheopskit$, type KheopskitConfig } from \"@kheopskit/core\";\nimport { bind } from \"@react-rxjs/core\";\nimport { useContext } from \"react\";\nimport { KheopskitContext } from \"./context\";\n\nconst DEFAULT_VALUE = {\n wallets: [],\n accounts: [],\n};\n\nconst [useKheopskit] = bind(\n (config: KheopskitConfig) => getKheopskit$(config),\n DEFAULT_VALUE\n);\n\nexport const useWallets = () => {\n const ctx = useContext(KheopskitContext);\n if (!ctx)\n throw new Error(\"useWallets must be used within a KheopskitProvider\");\n\n const kheopskit = useKheopskit(ctx.config);\n\n return {\n wallets: kheopskit.wallets,\n accounts: kheopskit.accounts,\n };\n};\n","import type { KheopskitConfig } from \"@kheopskit/core\";\nimport { createContext } from \"react\";\n\nexport const KheopskitContext = createContext<{\n config: KheopskitConfig;\n} | null>(null);\n","import type { KheopskitConfig } from \"@kheopskit/core\";\nimport { Subscribe } from \"@react-rxjs/core\";\nimport type { FC, PropsWithChildren } from \"react\";\nimport { KheopskitContext } from \"./context\";\nimport { SuspenseMonitor } from \"./SuspenseMonitor\";\n\nexport const KheopskitProvider: FC<\n PropsWithChildren & { config: KheopskitConfig }\n> = ({ children, config }) => {\n return (\n // TODO set source\n <KheopskitContext.Provider value={{ config }}>\n <Subscribe fallback={<SuspenseMonitor label=\"KheopskitProvider\" />}>\n {children}\n </Subscribe>\n </KheopskitContext.Provider>\n );\n};\n"],"mappings":";AAAA,SAAkB,WAAW,cAAc;AA0B5B;AAxBf,IAAM,aAAa;AAEZ,IAAM,uBAA8C,CAAC,EAAE,MAAM,MAAM;AACxE,QAAM,WAAW,OAAO,YAAY,IAAI,CAAC;AAEzC,YAAU,MAAM;AACd,UAAM,UAAU,WAAW,MAAM;AAC/B,cAAQ,KAAK,cAAc,KAAK,aAAa;AAAA,IAC/C,GAAG,GAAG;AAEN,WAAO,MAAM;AACX,cAAQ;AAAA,QACN;AAAA,QACA;AAAA,SACC,YAAY,IAAI,IAAI,SAAS,SAAS,QAAQ,CAAC;AAAA,MAClD;AACA,mBAAa,OAAO;AAAA,IACtB;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AACT;AAEO,IAAM,kBAAyC,CAAC,EAAE,MAAM,MAC7D,aAAa,oBAAC,wBAAqB,OAAc,IAAK;;;AC1BxD,SAAS,qBAA2C;AACpD,SAAS,YAAY;AACrB,SAAS,kBAAkB;;;ACD3B,SAAS,qBAAqB;AAEvB,IAAM,mBAAmB,cAEtB,IAAI;;;ADAd,IAAM,gBAAgB;AAAA,EACpB,SAAS,CAAC;AAAA,EACV,UAAU,CAAC;AACb;AAEA,IAAM,CAAC,YAAY,IAAI;AAAA,EACrB,CAAC,WAA4B,cAAc,MAAM;AAAA,EACjD;AACF;AAEO,IAAM,aAAa,MAAM;AAC9B,QAAM,MAAM,WAAW,gBAAgB;AACvC,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,oDAAoD;AAEtE,QAAM,YAAY,aAAa,IAAI,MAAM;AAEzC,SAAO;AAAA,IACL,SAAS,UAAU;AAAA,IACnB,UAAU,UAAU;AAAA,EACtB;AACF;;;AEzBA,SAAS,iBAAiB;AAWC,gBAAAA,YAAA;AANpB,IAAM,oBAET,CAAC,EAAE,UAAU,OAAO,MAAM;AAC5B;AAAA;AAAA,IAEE,gBAAAA,KAAC,iBAAiB,UAAjB,EAA0B,OAAO,EAAE,OAAO,GACzC,0BAAAA,KAAC,aAAU,UAAU,gBAAAA,KAAC,mBAAgB,OAAM,qBAAoB,GAC7D,UACH,GACF;AAAA;AAEJ;","names":["jsx"]}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@kheopskit/react",
3
+ "version": "0.0.1-alpha.0",
4
+ "description": "",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "main": "dist/index.cjs",
9
+ "module": "dist/index.mjs",
10
+ "types": "dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.mjs",
15
+ "require": "./dist/index.cjs"
16
+ }
17
+ },
18
+ "keywords": [],
19
+ "author": "",
20
+ "license": "ISC",
21
+ "peerDependencies": {
22
+ "rxjs": ">=7.8.0",
23
+ "react": "^19.0.0",
24
+ "react-dom": "^19.0.0",
25
+ "polkadot-api": ">=1.10.0"
26
+ },
27
+ "dependencies": {
28
+ "@react-rxjs/core": "^0.10.8",
29
+ "@kheopskit/core": "0.0.1-alpha.0"
30
+ },
31
+ "devDependencies": {
32
+ "react": "^19.0.0",
33
+ "react-dom": "^19.0.0",
34
+ "@types/react": "^19.0.10",
35
+ "@types/react-dom": "^19.0.4",
36
+ "polkadot-api": "^1.10.0"
37
+ },
38
+ "tsup": {
39
+ "entry": [
40
+ "src/index.ts"
41
+ ],
42
+ "splitting": false,
43
+ "sourcemap": true,
44
+ "clean": true,
45
+ "dts": true,
46
+ "format": [
47
+ "esm",
48
+ "cjs"
49
+ ],
50
+ "target": "es2020"
51
+ },
52
+ "scripts": {
53
+ "test": "echo \"Error: no test specified\" && exit 1",
54
+ "dev": "tsup --watch",
55
+ "build": "tsup",
56
+ "clean": "rm -rf dist"
57
+ }
58
+ }
@@ -0,0 +1,18 @@
1
+ import type { KheopskitConfig } from "@kheopskit/core";
2
+ import { Subscribe } from "@react-rxjs/core";
3
+ import type { FC, PropsWithChildren } from "react";
4
+ import { KheopskitContext } from "./context";
5
+ import { SuspenseMonitor } from "./SuspenseMonitor";
6
+
7
+ export const KheopskitProvider: FC<
8
+ PropsWithChildren & { config: KheopskitConfig }
9
+ > = ({ children, config }) => {
10
+ return (
11
+ // TODO set source
12
+ <KheopskitContext.Provider value={{ config }}>
13
+ <Subscribe fallback={<SuspenseMonitor label="KheopskitProvider" />}>
14
+ {children}
15
+ </Subscribe>
16
+ </KheopskitContext.Provider>
17
+ );
18
+ };
@@ -0,0 +1,27 @@
1
+ import { type FC, useEffect, useRef } from "react";
2
+
3
+ const SHOULD_LOG = true; // TODO only DEV
4
+
5
+ export const SuspenseMonitorInner: FC<{ label: string }> = ({ label }) => {
6
+ const refStart = useRef(performance.now());
7
+
8
+ useEffect(() => {
9
+ const timeout = setTimeout(() => {
10
+ console.warn(`[Suspense] ${label} is hanging`);
11
+ }, 500);
12
+
13
+ return () => {
14
+ console.debug(
15
+ "[Suspense] %s : %s ms",
16
+ label,
17
+ (performance.now() - refStart.current).toFixed(2)
18
+ );
19
+ clearTimeout(timeout);
20
+ };
21
+ }, [label]);
22
+
23
+ return null;
24
+ };
25
+
26
+ export const SuspenseMonitor: FC<{ label: string }> = ({ label }) =>
27
+ SHOULD_LOG ? <SuspenseMonitorInner label={label} /> : null;
package/src/context.ts ADDED
@@ -0,0 +1,6 @@
1
+ import type { KheopskitConfig } from "@kheopskit/core";
2
+ import { createContext } from "react";
3
+
4
+ export const KheopskitContext = createContext<{
5
+ config: KheopskitConfig;
6
+ } | null>(null);
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./SuspenseMonitor";
2
+ export * from "./useKheopskit";
3
+ export * from "./KheopskitProvider";
@@ -0,0 +1,27 @@
1
+ import { getKheopskit$, type KheopskitConfig } from "@kheopskit/core";
2
+ import { bind } from "@react-rxjs/core";
3
+ import { useContext } from "react";
4
+ import { KheopskitContext } from "./context";
5
+
6
+ const DEFAULT_VALUE = {
7
+ wallets: [],
8
+ accounts: [],
9
+ };
10
+
11
+ const [useKheopskit] = bind(
12
+ (config: KheopskitConfig) => getKheopskit$(config),
13
+ DEFAULT_VALUE
14
+ );
15
+
16
+ export const useWallets = () => {
17
+ const ctx = useContext(KheopskitContext);
18
+ if (!ctx)
19
+ throw new Error("useWallets must be used within a KheopskitProvider");
20
+
21
+ const kheopskit = useKheopskit(ctx.config);
22
+
23
+ return {
24
+ wallets: kheopskit.wallets,
25
+ accounts: kheopskit.accounts,
26
+ };
27
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../tsconfig.base",
3
+ "include": ["src", "tests"],
4
+ "compilerOptions": {
5
+ "jsx": "react-jsx",
6
+ "baseUrl": "src",
7
+ "paths": {
8
+ "@/*": ["*"]
9
+ }
10
+ }
11
+ }