@xyo-network/dapp-template 7.0.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/dapp.stories.d.ts +1 -1
- package/dist/neutral/dapp.stories.d.ts.map +1 -1
- package/dist/neutral/index.mjs +126 -109
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/node/dapp.stories.d.ts +1 -1
- package/dist/node/dapp.stories.d.ts.map +1 -1
- package/dist/node/index.mjs +126 -109
- package/dist/node/index.mjs.map +1 -1
- package/package.json +34 -33
|
@@ -2,7 +2,7 @@ import type { Meta } from '@storybook/react-vite';
|
|
|
2
2
|
import type { DappHostProps } from './components/index.ts';
|
|
3
3
|
import { RoutableDapp } from './components/index.ts';
|
|
4
4
|
declare const StorybookEntry: Meta<typeof RoutableDapp>;
|
|
5
|
-
declare const Default: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DappHostProps>;
|
|
5
|
+
declare const Default: import(".store/storybook-virtual-185e2ed79b/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DappHostProps>;
|
|
6
6
|
export { Default };
|
|
7
7
|
export default StorybookEntry;
|
|
8
8
|
//# sourceMappingURL=dapp.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dapp.stories.d.ts","sourceRoot":"","sources":["../../src/dapp.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAK1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAIpD,QAAA,MAAM,cAAc,EAKf,IAAI,CAAC,OAAO,YAAY,CAAC,CAAA;AAgB9B,QAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"dapp.stories.d.ts","sourceRoot":"","sources":["../../src/dapp.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAK1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAIpD,QAAA,MAAM,cAAc,EAKf,IAAI,CAAC,OAAO,YAAY,CAAC,CAAA;AAgB9B,QAAA,MAAM,OAAO,mJAAoB,CAAA;AAGjC,OAAO,EAAE,OAAO,EAAE,CAAA;AAElB,eAAe,cAAc,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/components/host/DappHost.tsx
|
|
5
2
|
import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
|
|
6
3
|
import { DappRendered } from "@xyo-network/os-react-runtime";
|
|
7
|
-
import React2 from "react";
|
|
8
4
|
|
|
9
5
|
// src/helpers/registration/useInitializeDappAdHoc.tsx
|
|
10
6
|
import { usePromise } from "@xylabs/react-promise";
|
|
11
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
useDappMenu,
|
|
9
|
+
useManageDappInjectableParamsFromRoute,
|
|
10
|
+
useManageDappPathFromRoute,
|
|
11
|
+
useXyOsUiContext
|
|
12
|
+
} from "@xyo-network/os-react-runtime";
|
|
12
13
|
import { DappInitializer } from "@xyo-network/os-runtime";
|
|
13
14
|
var dappState = {
|
|
14
15
|
active: true,
|
|
15
16
|
minimized: false,
|
|
16
17
|
closed: false
|
|
17
18
|
};
|
|
18
|
-
var useInitializeDappAdHoc =
|
|
19
|
+
var useInitializeDappAdHoc = (dapp) => {
|
|
19
20
|
const xyOs = useXyOsUiContext();
|
|
20
21
|
const [installedDapp, nodeCreateError] = usePromise(async () => {
|
|
21
22
|
if (xyOs && dapp) {
|
|
22
23
|
const installer = new DappInitializer({
|
|
23
|
-
allowedNames: [
|
|
24
|
-
dapp.config.name
|
|
25
|
-
],
|
|
24
|
+
allowedNames: [dapp.config.name],
|
|
26
25
|
dapp,
|
|
27
26
|
xnsNetwork: void 0,
|
|
28
27
|
xnsNodeUrl: void 0,
|
|
@@ -30,10 +29,7 @@ var useInitializeDappAdHoc = /* @__PURE__ */ __name((dapp) => {
|
|
|
30
29
|
});
|
|
31
30
|
return await installer.install();
|
|
32
31
|
}
|
|
33
|
-
}, [
|
|
34
|
-
xyOs,
|
|
35
|
-
dapp
|
|
36
|
-
]);
|
|
32
|
+
}, [xyOs, dapp]);
|
|
37
33
|
const { dappWallet, context } = installedDapp ?? {};
|
|
38
34
|
const routingError = useManageDappPathFromRoute(context, dapp.config.name);
|
|
39
35
|
const injectableErrors = useManageDappInjectableParamsFromRoute(context);
|
|
@@ -43,13 +39,9 @@ var useInitializeDappAdHoc = /* @__PURE__ */ __name((dapp) => {
|
|
|
43
39
|
dappMenu,
|
|
44
40
|
dappState,
|
|
45
41
|
dappWallet,
|
|
46
|
-
errors: [
|
|
47
|
-
routingError,
|
|
48
|
-
nodeCreateError,
|
|
49
|
-
...injectableErrors
|
|
50
|
-
].filter(Boolean)
|
|
42
|
+
errors: [routingError, nodeCreateError, ...injectableErrors].filter(Boolean)
|
|
51
43
|
};
|
|
52
|
-
}
|
|
44
|
+
};
|
|
53
45
|
|
|
54
46
|
// src/components/host/XyOsHost.tsx
|
|
55
47
|
import { Typography } from "@mui/material";
|
|
@@ -60,20 +52,19 @@ import { ModuleFactoryLocator } from "@xyo-network/module-factory-locator";
|
|
|
60
52
|
import { XyOsUiContextProvider } from "@xyo-network/os-react-runtime";
|
|
61
53
|
import { EventBus, XyOs } from "@xyo-network/os-runtime";
|
|
62
54
|
import { HDWallet } from "@xyo-network/wallet";
|
|
63
|
-
import
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
]);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
]);
|
|
55
|
+
import { useMemo } from "react";
|
|
56
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
57
|
+
var XyOsHost = ({
|
|
58
|
+
children,
|
|
59
|
+
eventBus,
|
|
60
|
+
kernel,
|
|
61
|
+
locator: locator2,
|
|
62
|
+
wallet
|
|
63
|
+
}) => {
|
|
64
|
+
const [walletToUse] = usePromise2(async () => wallet ?? await HDWallet.random(), [wallet]);
|
|
65
|
+
const eventBusToUse = useMemo(() => eventBus ?? new EventBus(), [kernel]);
|
|
66
|
+
const kernelToUse = useMemo(() => kernel ?? new Kernel(), [kernel]);
|
|
67
|
+
const locatorToUse = useMemo(() => locator2 ?? new ModuleFactoryLocator(), [locator2]);
|
|
77
68
|
const [os, error] = usePromise2(async () => {
|
|
78
69
|
if (walletToUse && kernelToUse && eventBusToUse && locatorToUse) {
|
|
79
70
|
const os2 = new XyOs({
|
|
@@ -84,63 +75,96 @@ var XyOsHost = /* @__PURE__ */ __name(({ children, eventBus, kernel, locator: lo
|
|
|
84
75
|
await os2.boot(walletToUse, locatorToUse);
|
|
85
76
|
return os2;
|
|
86
77
|
}
|
|
87
|
-
}, [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
78
|
+
}, [kernelToUse, walletToUse, locator2, eventBusToUse, locatorToUse]);
|
|
79
|
+
return os ? /* @__PURE__ */ jsx(XyOsUiContextProvider, { value: os, children }) : /* @__PURE__ */ jsxs(FlexCol, { children: [
|
|
80
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
81
|
+
"wallet:",
|
|
82
|
+
walletToUse ? "ready" : "loading"
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
85
|
+
"kernel:",
|
|
86
|
+
kernelToUse ? "ready" : "loading"
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
89
|
+
"os:",
|
|
90
|
+
os ? "ready" : "loading"
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
93
|
+
"os-error:",
|
|
94
|
+
error?.message
|
|
95
|
+
] })
|
|
96
|
+
] });
|
|
97
|
+
};
|
|
98
98
|
|
|
99
99
|
// src/components/host/DappHost.tsx
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
101
|
+
var DappHostInner = ({ dapp }) => {
|
|
102
|
+
const {
|
|
103
103
|
context,
|
|
104
|
-
|
|
105
|
-
dappMenuProperties: dappMenu,
|
|
104
|
+
dappMenu,
|
|
106
105
|
dappState: dappState2,
|
|
107
106
|
dappWallet,
|
|
108
107
|
errors
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
} = useInitializeDappAdHoc(dapp);
|
|
109
|
+
return /* @__PURE__ */ jsx2(FlexCol2, { children: /* @__PURE__ */ jsx2(
|
|
110
|
+
DappRendered,
|
|
111
|
+
{
|
|
112
|
+
context,
|
|
113
|
+
dapp,
|
|
114
|
+
dappMenuProperties: dappMenu,
|
|
115
|
+
dappState: dappState2,
|
|
116
|
+
dappWallet,
|
|
117
|
+
errors
|
|
118
|
+
}
|
|
119
|
+
) });
|
|
120
|
+
};
|
|
121
|
+
var DappHost = ({ dapp }) => /* @__PURE__ */ jsx2(XyOsHost, { children: /* @__PURE__ */ jsx2(DappHostInner, { dapp }) });
|
|
114
122
|
|
|
115
123
|
// src/components/host/Routable.tsx
|
|
116
|
-
import React4 from "react";
|
|
117
124
|
import { BrowserRouter } from "react-router-dom";
|
|
118
125
|
|
|
119
126
|
// src/components/host/Routes.tsx
|
|
120
|
-
import React3 from "react";
|
|
121
127
|
import { Route, Routes } from "react-router-dom";
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
129
|
+
var DappRoutes = (args) => /* @__PURE__ */ jsxs2(Routes, { children: [
|
|
130
|
+
/* @__PURE__ */ jsx3(
|
|
131
|
+
Route,
|
|
132
|
+
{
|
|
133
|
+
path: "/",
|
|
134
|
+
element: /* @__PURE__ */ jsx3(DappHost, { ...args })
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ jsx3(
|
|
138
|
+
Route,
|
|
139
|
+
{
|
|
140
|
+
path: "/:dappName",
|
|
141
|
+
element: /* @__PURE__ */ jsx3(DappHost, { ...args })
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ jsx3(
|
|
145
|
+
Route,
|
|
146
|
+
{
|
|
147
|
+
path: "/:dappName/:path/*",
|
|
148
|
+
element: /* @__PURE__ */ jsx3(DappHost, { ...args })
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
/* @__PURE__ */ jsx3(
|
|
152
|
+
Route,
|
|
153
|
+
{
|
|
154
|
+
path: "*",
|
|
155
|
+
element: /* @__PURE__ */ jsx3(DappHost, { ...args })
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
] });
|
|
135
159
|
|
|
136
160
|
// src/components/host/Routable.tsx
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
dapp
|
|
142
|
-
})
|
|
143
|
-
}
|
|
161
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
162
|
+
var RoutableDapp = ({ dapp }) => {
|
|
163
|
+
return /* @__PURE__ */ jsxs3(BrowserRouter, { children: [
|
|
164
|
+
/* @__PURE__ */ jsx4(DappRoutes, { dapp }),
|
|
165
|
+
/* @__PURE__ */ jsx4(DappHost, { dapp })
|
|
166
|
+
] });
|
|
167
|
+
};
|
|
144
168
|
|
|
145
169
|
// src/dapp.manifest.json
|
|
146
170
|
var dapp_manifest_default = {
|
|
@@ -226,19 +250,21 @@ var CustomDappParams = {
|
|
|
226
250
|
};
|
|
227
251
|
|
|
228
252
|
// src/Payloads.ts
|
|
229
|
-
import {
|
|
253
|
+
import {
|
|
254
|
+
DappConfigSchema,
|
|
255
|
+
DappIconSchema,
|
|
256
|
+
DappMode,
|
|
257
|
+
DappNavItemSchema,
|
|
258
|
+
DappNavMenuConfigSchema
|
|
259
|
+
} from "@xyo-network/os-model";
|
|
230
260
|
var CustomDappName = "Custom Dapp";
|
|
231
261
|
var version = "1.0.0";
|
|
232
262
|
var CustomDappConfig = {
|
|
233
263
|
manifest: dapp_manifest_default,
|
|
234
|
-
modes: [
|
|
235
|
-
DappMode.Window
|
|
236
|
-
],
|
|
264
|
+
modes: [DappMode.Window],
|
|
237
265
|
name: CustomDappName,
|
|
238
266
|
schema: DappConfigSchema,
|
|
239
|
-
sources: [
|
|
240
|
-
"network.xyo.dapp.accounts.source"
|
|
241
|
-
],
|
|
267
|
+
sources: ["network.xyo.dapp.accounts.source"],
|
|
242
268
|
version
|
|
243
269
|
};
|
|
244
270
|
var CustomDappIcon = {
|
|
@@ -249,10 +275,7 @@ var CustomDappIcon = {
|
|
|
249
275
|
type: "system",
|
|
250
276
|
version
|
|
251
277
|
};
|
|
252
|
-
var DappPayloads = [
|
|
253
|
-
CustomDappConfig,
|
|
254
|
-
CustomDappIcon
|
|
255
|
-
];
|
|
278
|
+
var DappPayloads = [CustomDappConfig, CustomDappIcon];
|
|
256
279
|
var CustomDappMenuItems = [
|
|
257
280
|
{
|
|
258
281
|
path: "home",
|
|
@@ -277,46 +300,40 @@ var CustomDappMenuConfig = {
|
|
|
277
300
|
defaultPath: "home",
|
|
278
301
|
schema: DappNavMenuConfigSchema
|
|
279
302
|
};
|
|
280
|
-
var CustomDappMenuPayloads = [
|
|
281
|
-
...CustomDappMenuItems,
|
|
282
|
-
CustomDappMenuConfig
|
|
283
|
-
];
|
|
303
|
+
var CustomDappMenuPayloads = [...CustomDappMenuItems, CustomDappMenuConfig];
|
|
284
304
|
|
|
285
305
|
// src/Dapp.tsx
|
|
286
306
|
import { ErrorRender } from "@xylabs/react-error";
|
|
287
307
|
import { DappPathSwitcher, useAddDappMenuItems } from "@xyo-network/os-react-runtime";
|
|
288
|
-
import React6 from "react";
|
|
289
308
|
|
|
290
309
|
// src/CustomDappPathToComponent.tsx
|
|
291
310
|
import { FlexRow } from "@xylabs/react-flexbox";
|
|
292
|
-
import
|
|
311
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
293
312
|
var CustomDappPathToComponent = [
|
|
294
313
|
{
|
|
295
|
-
component: /* @__PURE__ */
|
|
314
|
+
component: /* @__PURE__ */ jsx5(FlexRow, {}),
|
|
296
315
|
path: "home"
|
|
297
316
|
}
|
|
298
317
|
];
|
|
299
318
|
|
|
300
319
|
// src/Dapp.tsx
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
320
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
321
|
+
var CustomDapp = () => {
|
|
322
|
+
const {
|
|
323
|
+
menuConfig,
|
|
324
|
+
path,
|
|
325
|
+
error
|
|
326
|
+
} = useAddDappMenuItems(CustomDappMenuPayloads);
|
|
327
|
+
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
328
|
+
/* @__PURE__ */ jsx6(ErrorRender, { error, scope: "CustomDapp" }),
|
|
329
|
+
/* @__PURE__ */ jsx6(DappPathSwitcher, { activePath: path?.path ?? menuConfig?.defaultPath, pathToComponent: CustomDappPathToComponent })
|
|
330
|
+
] });
|
|
331
|
+
};
|
|
311
332
|
|
|
312
333
|
// src/UiParams.ts
|
|
313
334
|
var CustomDappUiParams = {
|
|
314
335
|
...CustomDappParams,
|
|
315
|
-
modes: {
|
|
316
|
-
window: {
|
|
317
|
-
component: CustomDapp
|
|
318
|
-
}
|
|
319
|
-
}
|
|
336
|
+
modes: { window: { component: CustomDapp } }
|
|
320
337
|
};
|
|
321
338
|
export {
|
|
322
339
|
CustomDappConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/host/DappHost.tsx","../../src/helpers/registration/useInitializeDappAdHoc.tsx","../../src/components/host/XyOsHost.tsx","../../src/components/host/Routable.tsx","../../src/components/host/Routes.tsx","../../src/dapp.manifest.json","../../src/Params.ts","../../src/icon/Icon.tsx","../../src/Payloads.ts","../../src/Dapp.tsx","../../src/CustomDappPathToComponent.tsx","../../src/UiParams.ts"],"sourcesContent":["import { FlexCol } from '@xylabs/react-flexbox'\nimport type { RegisteredReactDapp } from '@xyo-network/os-react-model'\nimport { DappRendered } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nimport { useInitializeDappAdHoc } from '../../helpers/index.ts'\nimport { XyOsHost } from './XyOsHost.tsx'\n\nexport interface DappHostProps {\n dapp: RegisteredReactDapp\n}\n\nexport const DappHostInner: React.FC<DappHostProps> = ({ dapp }) => {\n const {\n context, dappMenu, dappState, dappWallet, errors,\n } = useInitializeDappAdHoc(dapp)\n\n return (\n <FlexCol>\n <DappRendered\n context={context}\n dapp={dapp}\n dappMenuProperties={dappMenu}\n dappState={dappState}\n dappWallet={dappWallet}\n errors={errors}\n />\n </FlexCol>\n )\n}\n\nexport const DappHost: React.FC<DappHostProps> = ({ dapp }) => (\n <XyOsHost>\n <DappHostInner dapp={dapp} />\n </XyOsHost>\n)\n","import { usePromise } from '@xylabs/react-promise'\nimport type { RegisteredReactDapp } from '@xyo-network/os-react-model'\nimport {\n useDappMenu, useManageDappInjectableParamsFromRoute, useManageDappPathFromRoute, useXyOsUiContext,\n} from '@xyo-network/os-react-runtime'\nimport { DappInitializer } from '@xyo-network/os-runtime'\n\nconst dappState = {\n active: true, minimized: false, closed: false,\n}\n\nexport const useInitializeDappAdHoc = (dapp: RegisteredReactDapp) => {\n const xyOs = useXyOsUiContext()\n\n const [installedDapp, nodeCreateError] = usePromise(async () => {\n if (xyOs && dapp) {\n const installer = new DappInitializer({\n allowedNames: [dapp.config.name],\n dapp,\n xnsNetwork: undefined,\n xnsNodeUrl: undefined,\n xyOs,\n })\n return await installer.install()\n }\n }, [xyOs, dapp])\n\n const { dappWallet, context } = installedDapp ?? {}\n\n // support for routing\n const routingError = useManageDappPathFromRoute(context, dapp.config.name)\n const injectableErrors = useManageDappInjectableParamsFromRoute(context)\n\n const dappMenu = useDappMenu(context, dapp.config.name)\n\n return {\n context,\n dappMenu,\n dappState,\n dappWallet,\n errors: [routingError, nodeCreateError, ...injectableErrors].filter(Boolean),\n }\n}\n","import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Kernel } from '@xyo-network/kernel'\nimport type { KernelExternal } from '@xyo-network/kernel-model'\nimport { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport { XyOsUiContextProvider } from '@xyo-network/os-react-runtime'\nimport { EventBus, XyOs } from '@xyo-network/os-runtime'\nimport { HDWallet } from '@xyo-network/wallet'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport React, { useMemo } from 'react'\n\nexport interface XyOsHostProps {\n children?: React.ReactNode\n eventBus?: EventBus\n kernel?: KernelExternal\n locator?: ModuleFactoryLocator\n wallet?: WalletInstance\n}\n\nexport const XyOsHost: React.FC<XyOsHostProps> = ({\n children, eventBus, kernel, locator, wallet,\n}) => {\n const [walletToUse] = usePromise(async () => wallet ?? await HDWallet.random(), [wallet])\n const eventBusToUse: EventBus = useMemo(() => eventBus ?? new EventBus(), [kernel])\n const kernelToUse: KernelExternal = useMemo(() => kernel ?? new Kernel(), [kernel])\n const locatorToUse = useMemo(() => locator ?? new ModuleFactoryLocator(), [locator])\n\n const [os, error] = usePromise(async () => {\n if (walletToUse && kernelToUse && eventBusToUse && locatorToUse) {\n const os = new XyOs({\n kernel: kernelToUse, eventBus: new EventBus(), locator: locatorToUse,\n })\n await os.boot(walletToUse, locatorToUse)\n return os\n }\n }, [kernelToUse, walletToUse, locator, eventBusToUse, locatorToUse])\n\n return os\n ? <XyOsUiContextProvider value={os}>{children}</XyOsUiContextProvider>\n : (\n <FlexCol>\n <Typography>\n wallet:\n {walletToUse ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n kernel:\n {kernelToUse ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n os:\n {os ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n os-error:\n {error?.message}\n </Typography>\n </FlexCol>\n )\n}\n","import React from 'react'\nimport { BrowserRouter } from 'react-router-dom'\n\nimport type { DappHostProps } from './DappHost.tsx'\nimport { DappHost } from './DappHost.tsx'\nimport { DappRoutes } from './Routes.tsx'\n\nexport const RoutableDapp: React.FC<DappHostProps> = ({ dapp }) => {\n return (\n <BrowserRouter>\n <DappRoutes dapp={dapp} />\n <DappHost dapp={dapp} />\n </BrowserRouter>\n )\n}\n","import React from 'react'\nimport { Route, Routes } from 'react-router-dom'\n\nimport { DappHost, type DappHostProps } from './DappHost.tsx'\n\nexport const DappRoutes: React.FC<DappHostProps> = args => (\n <Routes>\n <Route\n path=\"/\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"/:dappName\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"/:dappName/:path/*\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"*\"\n element={(\n <DappHost {...args} />\n )}\n />\n </Routes>\n)\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/compilations/dapp-package-manifest-schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"0'\",\n \"name\": \"CustomDappNode\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1'\",\n \"name\": \"DappArchivist\",\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest.package.dapp\"\n}","import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport type { UnregisteredDapp } from '@xyo-network/os-model'\n\nimport { CustomDappIconSvg } from './icon/index.ts'\n\nconst locator = new ModuleFactoryLocator()\n\nexport const CustomDappParams: UnregisteredDapp['params'] = {\n iconSvg: CustomDappIconSvg,\n locator,\n}\n\nexport default CustomDappParams\n","/* eslint-disable @stylistic/max-len */\nexport const CustomDappIconSvg = `\n<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 40 40\">\n <path\n fill=\"transparent\"\n d=\"M6.44,27.12c-.78,0-1.44.28-2,.83-.55.55-.83,1.21-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M18.01,27.91c-.55.55-.83,1.22-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83s-1.44.28-2,.83Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M33.56,27.12c-.78,0-1.44.28-2,.83-.55.55-.83,1.21-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M36.55,26.94c-.82-.82-1.82-1.23-3-1.23-.32,0-.63.04-.93.11-.3.07-.59.17-.87.31l-5.87-8.09c-.18.03-.36.05-.56.05h-1.13l6.42,8.83c-.39.4-.7.85-.93,1.36-.23.51-.35,1.06-.35,1.66,0,1.18.41,2.17,1.23,3s1.82,1.23,3,1.23,2.17-.41,3-1.23,1.23-1.82,1.23-3-.41-2.17-1.23-3ZM35.55,31.93c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M19.29,25.73c-1,.16-1.84.64-2.52,1.42-.67.79-1.01,1.7-1.01,2.75,0,1.18.41,2.17,1.23,3,.82.82,1.82,1.23,3,1.23s2.17-.41,3-1.23c.82-.82,1.23-1.82,1.23-3,0-1.05-.34-1.97-1.01-2.74-.67-.78-1.51-1.25-2.52-1.43v-7.65h-1.41v7.65ZM22,27.91c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M14.1,18l-5.89,8.08c-.28-.13-.56-.22-.86-.28-.29-.06-.6-.09-.91-.09-1.18,0-2.17.41-3,1.23-.82.82-1.23,1.82-1.23,3s.41,2.17,1.23,3,1.82,1.23,3,1.23,2.17-.41,3-1.23,1.23-1.82,1.23-3c0-.6-.12-1.15-.36-1.66s-.56-.96-.95-1.36l6.45-8.83h-1c-.25,0-.48-.03-.7-.08ZM8.44,31.93c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M20,12.91c1.26,0,2.46.19,3.61.56,1.15.37,2.23.88,3.23,1.54V4.86c0-.44-.15-.82-.46-1.12s-.68-.46-1.12-.46h-10.52c-.44,0-.82.15-1.12.46s-.46.68-.46,1.12v10.15c1-.66,2.08-1.17,3.23-1.54s2.36-.56,3.61-.56ZM17.7,5.83c.63-.63,1.4-.95,2.3-.95s1.66.32,2.3.95.95,1.4.95,2.3-.32,1.66-.95,2.3-1.4.95-2.3.95-1.66-.32-2.3-.95-.95-1.4-.95-2.3.32-1.66.95-2.3Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M20,10.32c.6,0,1.12-.21,1.55-.64.43-.43.65-.94.65-1.55s-.22-1.12-.65-1.55c-.43-.43-.95-.65-1.55-.65s-1.12.22-1.55.65-.64.95-.64,1.55.21,1.12.64,1.55.94.64,1.55.64Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M20,11.37c.9,0,1.66-.32,2.3-.95s.95-1.4.95-2.3-.32-1.66-.95-2.3-1.4-.95-2.3-.95-1.66.32-2.3.95-.95,1.4-.95,2.3.32,1.66.95,2.3,1.4.95,2.3.95ZM18.45,6.58c.43-.43.95-.65,1.55-.65s1.12.22,1.55.65c.43.43.65.95.65,1.55s-.22,1.12-.65,1.55c-.43.43-.95.64-1.55.64s-1.12-.21-1.55-.64-.64-.95-.64-1.55.21-1.12.64-1.55Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M27.21,2.9c-.5-.5-1.15-.75-1.95-.75h-10.52c-.8,0-1.45.25-1.95.75-.5.5-.75,1.15-.75,1.95v10.52c0,.8.25,1.45.75,1.95.35.35.77.56,1.25.67.22.05.45.08.7.08h10.52c.2,0,.38-.02.56-.05.55-.09,1.01-.33,1.39-.71.5-.5.75-1.15.75-1.95V4.86c0-.8-.25-1.45-.75-1.95ZM25.93,16.74c-.26.14-.55.22-.86.22h-10.15s-.08-.01-.12-.01c-.25-.02-.5-.08-.74-.2-.28-.14-.45-.35-.5-.63.99-.7,2.03-1.22,3.12-1.57s2.19-.52,3.31-.52,2.27.18,3.4.55c1.13.36,2.18.88,3.16,1.54-.15.27-.36.48-.63.63ZM26.84,15.01c-1-.66-2.08-1.17-3.23-1.54-1.15-.37-2.36-.56-3.61-.56s-2.46.19-3.61.56-2.23.88-3.23,1.54V4.86c0-.44.15-.82.46-1.12s.68-.46,1.12-.46h10.52c.44,0,.82.15,1.12.46s.46.68.46,1.12v10.15Z\"\n />\n </svg>\n `\n","/* eslint-disable @stylistic/max-len */\nimport type {\n DappConfig,\n DappIcon,\n DappName,\n DappNavItem,\n DappNavMenuConfig,\n DappPackageManifestPayload,\n DappVersion,\n} from '@xyo-network/os-model'\nimport {\n DappConfigSchema,\n DappIconSchema,\n DappMode,\n DappNavItemSchema,\n DappNavMenuConfigSchema,\n} from '@xyo-network/os-model'\n\nimport dappManifest from './dapp.manifest.json' with { type: 'json' }\n\nexport const CustomDappName: DappName = 'Custom Dapp' as const\n\nconst version: DappVersion = '1.0.0'\n\nexport const CustomDappConfig: DappConfig = {\n manifest: dappManifest as DappPackageManifestPayload,\n modes: [DappMode.Window],\n name: CustomDappName,\n schema: DappConfigSchema,\n sources: ['network.xyo.dapp.accounts.source'],\n version,\n}\n\nexport const CustomDappIcon: DappIcon = {\n active: false,\n installed: 'installed',\n name: CustomDappName,\n schema: DappIconSchema,\n type: 'system',\n version,\n}\n\nexport const DappPayloads = [CustomDappConfig, CustomDappIcon]\n\nexport type CustomDappMenuItemPaths = 'home' | 'settings'\n\nconst CustomDappMenuItems: DappNavItem<CustomDappMenuItemPaths>[] = [\n {\n path: 'home',\n primaryText: 'Home',\n schema: DappNavItemSchema,\n svgIcon: `\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 -960 960 960\" width=\"24\" fill=\"none\"><path fill=\"currentColor\" d=\"M420-360h120l-23-129q20-10 31.5-29t11.5-42q0-33-23.5-56.5T480-640q-33 0-56.5 23.5T400-560q0 23 11.5 42t31.5 29l-23 129Zm60 280q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z\"/></svg>\n `,\n weight: 0,\n },\n {\n path: 'settings',\n primaryText: 'Settings',\n schema: DappNavItemSchema,\n svgIcon: `\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 -960 960 960\" width=\"24\" fill=\"none\"><path fill=\"currentColor\" d=\"M420-360h120l-23-129q20-10 31.5-29t11.5-42q0-33-23.5-56.5T480-640q-33 0-56.5 23.5T400-560q0 23 11.5 42t31.5 29l-23 129Zm60 280q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z\"/></svg>\n `,\n weight: 0,\n },\n]\n\nconst CustomDappMenuConfig: DappNavMenuConfig = {\n defaultPath: 'home',\n schema: DappNavMenuConfigSchema,\n}\n\nexport const CustomDappMenuPayloads = [...CustomDappMenuItems, CustomDappMenuConfig]\n","import { ErrorRender } from '@xylabs/react-error'\nimport { DappPathSwitcher, useAddDappMenuItems } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nimport { CustomDappPathToComponent } from './CustomDappPathToComponent.tsx'\nimport { CustomDappMenuPayloads } from './Payloads.ts'\n\nexport const CustomDapp = () => {\n const {\n menuConfig, path, error,\n } = useAddDappMenuItems(CustomDappMenuPayloads)\n\n return (\n <>\n <ErrorRender error={error} scope=\"CustomDapp\" />\n <DappPathSwitcher activePath={path?.path ?? menuConfig?.defaultPath} pathToComponent={CustomDappPathToComponent} />\n </>\n )\n}\n","import { FlexRow } from '@xylabs/react-flexbox'\nimport type { PathToComponent } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nexport const CustomDappPathToComponent: PathToComponent[] = [\n {\n component: <FlexRow />,\n path: 'home',\n },\n]\n","import type { UnregisteredReactDapp } from '@xyo-network/os-react-model'\n\nimport { CustomDapp } from './Dapp.tsx'\nimport { CustomDappParams } from './Params.ts'\n\nexport const CustomDappUiParams: UnregisteredReactDapp['params'] = {\n ...CustomDappParams,\n modes: { window: { component: CustomDapp } },\n}\n\nexport default CustomDappUiParams\n"],"mappings":";;;;AAAA,SAASA,WAAAA,gBAAe;AAExB,SAASC,oBAAoB;AAC7B,OAAOC,YAAW;;;ACHlB,SAASC,kBAAkB;AAE3B,SACEC,aAAaC,wCAAwCC,4BAA4BC,wBAC5E;AACP,SAASC,uBAAuB;AAEhC,IAAMC,YAAY;EAChBC,QAAQ;EAAMC,WAAW;EAAOC,QAAQ;AAC1C;AAEO,IAAMC,yBAAyB,wBAACC,SAAAA;AACrC,QAAMC,OAAOC,iBAAAA;AAEb,QAAM,CAACC,eAAeC,eAAAA,IAAmBC,WAAW,YAAA;AAClD,QAAIJ,QAAQD,MAAM;AAChB,YAAMM,YAAY,IAAIC,gBAAgB;QACpCC,cAAc;UAACR,KAAKS,OAAOC;;QAC3BV;QACAW,YAAYC;QACZC,YAAYD;QACZX;MACF,CAAA;AACA,aAAO,MAAMK,UAAUQ,QAAO;IAChC;EACF,GAAG;IAACb;IAAMD;GAAK;AAEf,QAAM,EAAEe,YAAYC,QAAO,IAAKb,iBAAiB,CAAC;AAGlD,QAAMc,eAAeC,2BAA2BF,SAAShB,KAAKS,OAAOC,IAAI;AACzE,QAAMS,mBAAmBC,uCAAuCJ,OAAAA;AAEhE,QAAMK,WAAWC,YAAYN,SAAShB,KAAKS,OAAOC,IAAI;AAEtD,SAAO;IACLM;IACAK;IACA1B;IACAoB;IACAQ,QAAQ;MAACN;MAAcb;SAAoBe;MAAkBK,OAAOC,OAAAA;EACtE;AACF,GA/BsC;;;ACXtC,SAASC,kBAAkB;AAC3B,SAASC,eAAe;AACxB,SAASC,cAAAA,mBAAkB;AAC3B,SAASC,cAAc;AAEvB,SAAS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,aAAa,6BAAA;AACxB,QAAM,EACJC,YAAYC,MAAMC,MAAK,IACrBC,oBAAoBC,sBAAAA;AAExB,SACE,gBAAAC,OAAA,cAAAA,OAAA,UAAA,MACE,gBAAAA,OAAA,cAACC,aAAAA;IAAYJ;IAAcK,OAAM;MACjC,gBAAAF,OAAA,cAACG,kBAAAA;IAAiBC,YAAYR,MAAMA,QAAQD,YAAYU;IAAaC,iBAAiBC;;AAG5F,GAX0B;;;AEFnB,IAAMC,qBAAsD;EACjE,GAAGC;EACHC,OAAO;IAAEC,QAAQ;MAAEC,WAAWC;IAAW;EAAE;AAC7C;","names":["FlexCol","DappRendered","React","usePromise","useDappMenu","useManageDappInjectableParamsFromRoute","useManageDappPathFromRoute","useXyOsUiContext","DappInitializer","dappState","active","minimized","closed","useInitializeDappAdHoc","dapp","xyOs","useXyOsUiContext","installedDapp","nodeCreateError","usePromise","installer","DappInitializer","allowedNames","config","name","xnsNetwork","undefined","xnsNodeUrl","install","dappWallet","context","routingError","useManageDappPathFromRoute","injectableErrors","useManageDappInjectableParamsFromRoute","dappMenu","useDappMenu","errors","filter","Boolean","Typography","FlexCol","usePromise","Kernel","ModuleFactoryLocator","XyOsUiContextProvider","EventBus","XyOs","HDWallet","React","useMemo","XyOsHost","children","eventBus","kernel","locator","wallet","walletToUse","usePromise","HDWallet","random","eventBusToUse","useMemo","EventBus","kernelToUse","Kernel","locatorToUse","ModuleFactoryLocator","os","error","XyOs","boot","XyOsUiContextProvider","value","FlexCol","Typography","message","DappHostInner","dapp","context","dappMenu","dappState","dappWallet","errors","useInitializeDappAdHoc","React","FlexCol","DappRendered","dappMenuProperties","DappHost","XyOsHost","React","BrowserRouter","React","Route","Routes","DappRoutes","args","React","Routes","Route","path","element","DappHost","RoutableDapp","dapp","React","BrowserRouter","DappRoutes","DappHost","ModuleFactoryLocator","CustomDappIconSvg","locator","ModuleFactoryLocator","CustomDappParams","iconSvg","CustomDappIconSvg","DappConfigSchema","DappIconSchema","DappMode","DappNavItemSchema","DappNavMenuConfigSchema","CustomDappName","version","CustomDappConfig","manifest","dappManifest","modes","DappMode","Window","name","schema","DappConfigSchema","sources","CustomDappIcon","active","installed","DappIconSchema","type","DappPayloads","CustomDappMenuItems","path","primaryText","DappNavItemSchema","svgIcon","weight","CustomDappMenuConfig","defaultPath","DappNavMenuConfigSchema","CustomDappMenuPayloads","ErrorRender","DappPathSwitcher","useAddDappMenuItems","React","FlexRow","React","CustomDappPathToComponent","component","path","CustomDapp","menuConfig","path","error","useAddDappMenuItems","CustomDappMenuPayloads","React","ErrorRender","scope","DappPathSwitcher","activePath","defaultPath","pathToComponent","CustomDappPathToComponent","CustomDappUiParams","CustomDappParams","modes","window","component","CustomDapp"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/host/DappHost.tsx","../../src/helpers/registration/useInitializeDappAdHoc.tsx","../../src/components/host/XyOsHost.tsx","../../src/components/host/Routable.tsx","../../src/components/host/Routes.tsx","../../src/dapp.manifest.json","../../src/Params.ts","../../src/icon/Icon.tsx","../../src/Payloads.ts","../../src/Dapp.tsx","../../src/CustomDappPathToComponent.tsx","../../src/UiParams.ts"],"sourcesContent":["import { FlexCol } from '@xylabs/react-flexbox'\nimport type { RegisteredReactDapp } from '@xyo-network/os-react-model'\nimport { DappRendered } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nimport { useInitializeDappAdHoc } from '../../helpers/index.ts'\nimport { XyOsHost } from './XyOsHost.tsx'\n\nexport interface DappHostProps {\n dapp: RegisteredReactDapp\n}\n\nexport const DappHostInner: React.FC<DappHostProps> = ({ dapp }) => {\n const {\n context, dappMenu, dappState, dappWallet, errors,\n } = useInitializeDappAdHoc(dapp)\n\n return (\n <FlexCol>\n <DappRendered\n context={context}\n dapp={dapp}\n dappMenuProperties={dappMenu}\n dappState={dappState}\n dappWallet={dappWallet}\n errors={errors}\n />\n </FlexCol>\n )\n}\n\nexport const DappHost: React.FC<DappHostProps> = ({ dapp }) => (\n <XyOsHost>\n <DappHostInner dapp={dapp} />\n </XyOsHost>\n)\n","import { usePromise } from '@xylabs/react-promise'\nimport type { RegisteredReactDapp } from '@xyo-network/os-react-model'\nimport {\n useDappMenu, useManageDappInjectableParamsFromRoute, useManageDappPathFromRoute, useXyOsUiContext,\n} from '@xyo-network/os-react-runtime'\nimport { DappInitializer } from '@xyo-network/os-runtime'\n\nconst dappState = {\n active: true, minimized: false, closed: false,\n}\n\nexport const useInitializeDappAdHoc = (dapp: RegisteredReactDapp) => {\n const xyOs = useXyOsUiContext()\n\n const [installedDapp, nodeCreateError] = usePromise(async () => {\n if (xyOs && dapp) {\n const installer = new DappInitializer({\n allowedNames: [dapp.config.name],\n dapp,\n xnsNetwork: undefined,\n xnsNodeUrl: undefined,\n xyOs,\n })\n return await installer.install()\n }\n }, [xyOs, dapp])\n\n const { dappWallet, context } = installedDapp ?? {}\n\n // support for routing\n const routingError = useManageDappPathFromRoute(context, dapp.config.name)\n const injectableErrors = useManageDappInjectableParamsFromRoute(context)\n\n const dappMenu = useDappMenu(context, dapp.config.name)\n\n return {\n context,\n dappMenu,\n dappState,\n dappWallet,\n errors: [routingError, nodeCreateError, ...injectableErrors].filter(Boolean),\n }\n}\n","import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Kernel } from '@xyo-network/kernel'\nimport type { KernelExternal } from '@xyo-network/kernel-model'\nimport { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport { XyOsUiContextProvider } from '@xyo-network/os-react-runtime'\nimport { EventBus, XyOs } from '@xyo-network/os-runtime'\nimport { HDWallet } from '@xyo-network/wallet'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport React, { useMemo } from 'react'\n\nexport interface XyOsHostProps {\n children?: React.ReactNode\n eventBus?: EventBus\n kernel?: KernelExternal\n locator?: ModuleFactoryLocator\n wallet?: WalletInstance\n}\n\nexport const XyOsHost: React.FC<XyOsHostProps> = ({\n children, eventBus, kernel, locator, wallet,\n}) => {\n const [walletToUse] = usePromise(async () => wallet ?? await HDWallet.random(), [wallet])\n const eventBusToUse: EventBus = useMemo(() => eventBus ?? new EventBus(), [kernel])\n const kernelToUse: KernelExternal = useMemo(() => kernel ?? new Kernel(), [kernel])\n const locatorToUse = useMemo(() => locator ?? new ModuleFactoryLocator(), [locator])\n\n const [os, error] = usePromise(async () => {\n if (walletToUse && kernelToUse && eventBusToUse && locatorToUse) {\n const os = new XyOs({\n kernel: kernelToUse, eventBus: new EventBus(), locator: locatorToUse,\n })\n await os.boot(walletToUse, locatorToUse)\n return os\n }\n }, [kernelToUse, walletToUse, locator, eventBusToUse, locatorToUse])\n\n return os\n ? <XyOsUiContextProvider value={os}>{children}</XyOsUiContextProvider>\n : (\n <FlexCol>\n <Typography>\n wallet:\n {walletToUse ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n kernel:\n {kernelToUse ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n os:\n {os ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n os-error:\n {error?.message}\n </Typography>\n </FlexCol>\n )\n}\n","import React from 'react'\nimport { BrowserRouter } from 'react-router-dom'\n\nimport type { DappHostProps } from './DappHost.tsx'\nimport { DappHost } from './DappHost.tsx'\nimport { DappRoutes } from './Routes.tsx'\n\nexport const RoutableDapp: React.FC<DappHostProps> = ({ dapp }) => {\n return (\n <BrowserRouter>\n <DappRoutes dapp={dapp} />\n <DappHost dapp={dapp} />\n </BrowserRouter>\n )\n}\n","import React from 'react'\nimport { Route, Routes } from 'react-router-dom'\n\nimport { DappHost, type DappHostProps } from './DappHost.tsx'\n\nexport const DappRoutes: React.FC<DappHostProps> = args => (\n <Routes>\n <Route\n path=\"/\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"/:dappName\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"/:dappName/:path/*\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"*\"\n element={(\n <DappHost {...args} />\n )}\n />\n </Routes>\n)\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/compilations/dapp-package-manifest-schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"0'\",\n \"name\": \"CustomDappNode\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1'\",\n \"name\": \"DappArchivist\",\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest.package.dapp\"\n}","import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport type { UnregisteredDapp } from '@xyo-network/os-model'\n\nimport { CustomDappIconSvg } from './icon/index.ts'\n\nconst locator = new ModuleFactoryLocator()\n\nexport const CustomDappParams: UnregisteredDapp['params'] = {\n iconSvg: CustomDappIconSvg,\n locator,\n}\n\nexport default CustomDappParams\n","/* eslint-disable @stylistic/max-len */\nexport const CustomDappIconSvg = `\n<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 40 40\">\n <path\n fill=\"transparent\"\n d=\"M6.44,27.12c-.78,0-1.44.28-2,.83-.55.55-.83,1.21-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M18.01,27.91c-.55.55-.83,1.22-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83s-1.44.28-2,.83Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M33.56,27.12c-.78,0-1.44.28-2,.83-.55.55-.83,1.21-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M36.55,26.94c-.82-.82-1.82-1.23-3-1.23-.32,0-.63.04-.93.11-.3.07-.59.17-.87.31l-5.87-8.09c-.18.03-.36.05-.56.05h-1.13l6.42,8.83c-.39.4-.7.85-.93,1.36-.23.51-.35,1.06-.35,1.66,0,1.18.41,2.17,1.23,3s1.82,1.23,3,1.23,2.17-.41,3-1.23,1.23-1.82,1.23-3-.41-2.17-1.23-3ZM35.55,31.93c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M19.29,25.73c-1,.16-1.84.64-2.52,1.42-.67.79-1.01,1.7-1.01,2.75,0,1.18.41,2.17,1.23,3,.82.82,1.82,1.23,3,1.23s2.17-.41,3-1.23c.82-.82,1.23-1.82,1.23-3,0-1.05-.34-1.97-1.01-2.74-.67-.78-1.51-1.25-2.52-1.43v-7.65h-1.41v7.65ZM22,27.91c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M14.1,18l-5.89,8.08c-.28-.13-.56-.22-.86-.28-.29-.06-.6-.09-.91-.09-1.18,0-2.17.41-3,1.23-.82.82-1.23,1.82-1.23,3s.41,2.17,1.23,3,1.82,1.23,3,1.23,2.17-.41,3-1.23,1.23-1.82,1.23-3c0-.6-.12-1.15-.36-1.66s-.56-.96-.95-1.36l6.45-8.83h-1c-.25,0-.48-.03-.7-.08ZM8.44,31.93c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M20,12.91c1.26,0,2.46.19,3.61.56,1.15.37,2.23.88,3.23,1.54V4.86c0-.44-.15-.82-.46-1.12s-.68-.46-1.12-.46h-10.52c-.44,0-.82.15-1.12.46s-.46.68-.46,1.12v10.15c1-.66,2.08-1.17,3.23-1.54s2.36-.56,3.61-.56ZM17.7,5.83c.63-.63,1.4-.95,2.3-.95s1.66.32,2.3.95.95,1.4.95,2.3-.32,1.66-.95,2.3-1.4.95-2.3.95-1.66-.32-2.3-.95-.95-1.4-.95-2.3.32-1.66.95-2.3Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M20,10.32c.6,0,1.12-.21,1.55-.64.43-.43.65-.94.65-1.55s-.22-1.12-.65-1.55c-.43-.43-.95-.65-1.55-.65s-1.12.22-1.55.65-.64.95-.64,1.55.21,1.12.64,1.55.94.64,1.55.64Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M20,11.37c.9,0,1.66-.32,2.3-.95s.95-1.4.95-2.3-.32-1.66-.95-2.3-1.4-.95-2.3-.95-1.66.32-2.3.95-.95,1.4-.95,2.3.32,1.66.95,2.3,1.4.95,2.3.95ZM18.45,6.58c.43-.43.95-.65,1.55-.65s1.12.22,1.55.65c.43.43.65.95.65,1.55s-.22,1.12-.65,1.55c-.43.43-.95.64-1.55.64s-1.12-.21-1.55-.64-.64-.95-.64-1.55.21-1.12.64-1.55Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M27.21,2.9c-.5-.5-1.15-.75-1.95-.75h-10.52c-.8,0-1.45.25-1.95.75-.5.5-.75,1.15-.75,1.95v10.52c0,.8.25,1.45.75,1.95.35.35.77.56,1.25.67.22.05.45.08.7.08h10.52c.2,0,.38-.02.56-.05.55-.09,1.01-.33,1.39-.71.5-.5.75-1.15.75-1.95V4.86c0-.8-.25-1.45-.75-1.95ZM25.93,16.74c-.26.14-.55.22-.86.22h-10.15s-.08-.01-.12-.01c-.25-.02-.5-.08-.74-.2-.28-.14-.45-.35-.5-.63.99-.7,2.03-1.22,3.12-1.57s2.19-.52,3.31-.52,2.27.18,3.4.55c1.13.36,2.18.88,3.16,1.54-.15.27-.36.48-.63.63ZM26.84,15.01c-1-.66-2.08-1.17-3.23-1.54-1.15-.37-2.36-.56-3.61-.56s-2.46.19-3.61.56-2.23.88-3.23,1.54V4.86c0-.44.15-.82.46-1.12s.68-.46,1.12-.46h10.52c.44,0,.82.15,1.12.46s.46.68.46,1.12v10.15Z\"\n />\n </svg>\n `\n","/* eslint-disable @stylistic/max-len */\nimport type {\n DappConfig,\n DappIcon,\n DappName,\n DappNavItem,\n DappNavMenuConfig,\n DappPackageManifestPayload,\n DappVersion,\n} from '@xyo-network/os-model'\nimport {\n DappConfigSchema,\n DappIconSchema,\n DappMode,\n DappNavItemSchema,\n DappNavMenuConfigSchema,\n} from '@xyo-network/os-model'\n\nimport dappManifest from './dapp.manifest.json' with { type: 'json' }\n\nexport const CustomDappName: DappName = 'Custom Dapp' as const\n\nconst version: DappVersion = '1.0.0'\n\nexport const CustomDappConfig: DappConfig = {\n manifest: dappManifest as DappPackageManifestPayload,\n modes: [DappMode.Window],\n name: CustomDappName,\n schema: DappConfigSchema,\n sources: ['network.xyo.dapp.accounts.source'],\n version,\n}\n\nexport const CustomDappIcon: DappIcon = {\n active: false,\n installed: 'installed',\n name: CustomDappName,\n schema: DappIconSchema,\n type: 'system',\n version,\n}\n\nexport const DappPayloads = [CustomDappConfig, CustomDappIcon]\n\nexport type CustomDappMenuItemPaths = 'home' | 'settings'\n\nconst CustomDappMenuItems: DappNavItem<CustomDappMenuItemPaths>[] = [\n {\n path: 'home',\n primaryText: 'Home',\n schema: DappNavItemSchema,\n svgIcon: `\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 -960 960 960\" width=\"24\" fill=\"none\"><path fill=\"currentColor\" d=\"M420-360h120l-23-129q20-10 31.5-29t11.5-42q0-33-23.5-56.5T480-640q-33 0-56.5 23.5T400-560q0 23 11.5 42t31.5 29l-23 129Zm60 280q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z\"/></svg>\n `,\n weight: 0,\n },\n {\n path: 'settings',\n primaryText: 'Settings',\n schema: DappNavItemSchema,\n svgIcon: `\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 -960 960 960\" width=\"24\" fill=\"none\"><path fill=\"currentColor\" d=\"M420-360h120l-23-129q20-10 31.5-29t11.5-42q0-33-23.5-56.5T480-640q-33 0-56.5 23.5T400-560q0 23 11.5 42t31.5 29l-23 129Zm60 280q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z\"/></svg>\n `,\n weight: 0,\n },\n]\n\nconst CustomDappMenuConfig: DappNavMenuConfig = {\n defaultPath: 'home',\n schema: DappNavMenuConfigSchema,\n}\n\nexport const CustomDappMenuPayloads = [...CustomDappMenuItems, CustomDappMenuConfig]\n","import { ErrorRender } from '@xylabs/react-error'\nimport { DappPathSwitcher, useAddDappMenuItems } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nimport { CustomDappPathToComponent } from './CustomDappPathToComponent.tsx'\nimport { CustomDappMenuPayloads } from './Payloads.ts'\n\nexport const CustomDapp = () => {\n const {\n menuConfig, path, error,\n } = useAddDappMenuItems(CustomDappMenuPayloads)\n\n return (\n <>\n <ErrorRender error={error} scope=\"CustomDapp\" />\n <DappPathSwitcher activePath={path?.path ?? menuConfig?.defaultPath} pathToComponent={CustomDappPathToComponent} />\n </>\n )\n}\n","import { FlexRow } from '@xylabs/react-flexbox'\nimport type { PathToComponent } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nexport const CustomDappPathToComponent: PathToComponent[] = [\n {\n component: <FlexRow />,\n path: 'home',\n },\n]\n","import type { UnregisteredReactDapp } from '@xyo-network/os-react-model'\n\nimport { CustomDapp } from './Dapp.tsx'\nimport { CustomDappParams } from './Params.ts'\n\nexport const CustomDappUiParams: UnregisteredReactDapp['params'] = {\n ...CustomDappParams,\n modes: { window: { component: CustomDapp } },\n}\n\nexport default CustomDappUiParams\n"],"mappings":";AAAA,SAAS,WAAAA,gBAAe;AAExB,SAAS,oBAAoB;;;ACF7B,SAAS,kBAAkB;AAE3B;AAAA,EACE;AAAA,EAAa;AAAA,EAAwC;AAAA,EAA4B;AAAA,OAC5E;AACP,SAAS,uBAAuB;AAEhC,IAAM,YAAY;AAAA,EAChB,QAAQ;AAAA,EAAM,WAAW;AAAA,EAAO,QAAQ;AAC1C;AAEO,IAAM,yBAAyB,CAAC,SAA8B;AACnE,QAAM,OAAO,iBAAiB;AAE9B,QAAM,CAAC,eAAe,eAAe,IAAI,WAAW,YAAY;AAC9D,QAAI,QAAQ,MAAM;AAChB,YAAM,YAAY,IAAI,gBAAgB;AAAA,QACpC,cAAc,CAAC,KAAK,OAAO,IAAI;AAAA,QAC/B;AAAA,QACA,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ;AAAA,MACF,CAAC;AACD,aAAO,MAAM,UAAU,QAAQ;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,MAAM,IAAI,CAAC;AAEf,QAAM,EAAE,YAAY,QAAQ,IAAI,iBAAiB,CAAC;AAGlD,QAAM,eAAe,2BAA2B,SAAS,KAAK,OAAO,IAAI;AACzE,QAAM,mBAAmB,uCAAuC,OAAO;AAEvE,QAAM,WAAW,YAAY,SAAS,KAAK,OAAO,IAAI;AAEtD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ,CAAC,cAAc,iBAA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actoryLocator","ModuleFactoryLocator","jsx","jsx","jsxs"]}
|
|
@@ -2,7 +2,7 @@ import type { Meta } from '@storybook/react-vite';
|
|
|
2
2
|
import type { DappHostProps } from './components/index.ts';
|
|
3
3
|
import { RoutableDapp } from './components/index.ts';
|
|
4
4
|
declare const StorybookEntry: Meta<typeof RoutableDapp>;
|
|
5
|
-
declare const Default: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DappHostProps>;
|
|
5
|
+
declare const Default: import(".store/storybook-virtual-185e2ed79b/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, DappHostProps>;
|
|
6
6
|
export { Default };
|
|
7
7
|
export default StorybookEntry;
|
|
8
8
|
//# sourceMappingURL=dapp.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dapp.stories.d.ts","sourceRoot":"","sources":["../../src/dapp.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAK1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAIpD,QAAA,MAAM,cAAc,EAKf,IAAI,CAAC,OAAO,YAAY,CAAC,CAAA;AAgB9B,QAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"dapp.stories.d.ts","sourceRoot":"","sources":["../../src/dapp.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAK1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAIpD,QAAA,MAAM,cAAc,EAKf,IAAI,CAAC,OAAO,YAAY,CAAC,CAAA;AAgB9B,QAAA,MAAM,OAAO,mJAAoB,CAAA;AAGjC,OAAO,EAAE,OAAO,EAAE,CAAA;AAElB,eAAe,cAAc,CAAA"}
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/components/host/DappHost.tsx
|
|
5
2
|
import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
|
|
6
3
|
import { DappRendered } from "@xyo-network/os-react-runtime";
|
|
7
|
-
import React2 from "react";
|
|
8
4
|
|
|
9
5
|
// src/helpers/registration/useInitializeDappAdHoc.tsx
|
|
10
6
|
import { usePromise } from "@xylabs/react-promise";
|
|
11
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
useDappMenu,
|
|
9
|
+
useManageDappInjectableParamsFromRoute,
|
|
10
|
+
useManageDappPathFromRoute,
|
|
11
|
+
useXyOsUiContext
|
|
12
|
+
} from "@xyo-network/os-react-runtime";
|
|
12
13
|
import { DappInitializer } from "@xyo-network/os-runtime";
|
|
13
14
|
var dappState = {
|
|
14
15
|
active: true,
|
|
15
16
|
minimized: false,
|
|
16
17
|
closed: false
|
|
17
18
|
};
|
|
18
|
-
var useInitializeDappAdHoc =
|
|
19
|
+
var useInitializeDappAdHoc = (dapp) => {
|
|
19
20
|
const xyOs = useXyOsUiContext();
|
|
20
21
|
const [installedDapp, nodeCreateError] = usePromise(async () => {
|
|
21
22
|
if (xyOs && dapp) {
|
|
22
23
|
const installer = new DappInitializer({
|
|
23
|
-
allowedNames: [
|
|
24
|
-
dapp.config.name
|
|
25
|
-
],
|
|
24
|
+
allowedNames: [dapp.config.name],
|
|
26
25
|
dapp,
|
|
27
26
|
xnsNetwork: void 0,
|
|
28
27
|
xnsNodeUrl: void 0,
|
|
@@ -30,10 +29,7 @@ var useInitializeDappAdHoc = /* @__PURE__ */ __name((dapp) => {
|
|
|
30
29
|
});
|
|
31
30
|
return await installer.install();
|
|
32
31
|
}
|
|
33
|
-
}, [
|
|
34
|
-
xyOs,
|
|
35
|
-
dapp
|
|
36
|
-
]);
|
|
32
|
+
}, [xyOs, dapp]);
|
|
37
33
|
const { dappWallet, context } = installedDapp ?? {};
|
|
38
34
|
const routingError = useManageDappPathFromRoute(context, dapp.config.name);
|
|
39
35
|
const injectableErrors = useManageDappInjectableParamsFromRoute(context);
|
|
@@ -43,13 +39,9 @@ var useInitializeDappAdHoc = /* @__PURE__ */ __name((dapp) => {
|
|
|
43
39
|
dappMenu,
|
|
44
40
|
dappState,
|
|
45
41
|
dappWallet,
|
|
46
|
-
errors: [
|
|
47
|
-
routingError,
|
|
48
|
-
nodeCreateError,
|
|
49
|
-
...injectableErrors
|
|
50
|
-
].filter(Boolean)
|
|
42
|
+
errors: [routingError, nodeCreateError, ...injectableErrors].filter(Boolean)
|
|
51
43
|
};
|
|
52
|
-
}
|
|
44
|
+
};
|
|
53
45
|
|
|
54
46
|
// src/components/host/XyOsHost.tsx
|
|
55
47
|
import { Typography } from "@mui/material";
|
|
@@ -60,20 +52,19 @@ import { ModuleFactoryLocator } from "@xyo-network/module-factory-locator";
|
|
|
60
52
|
import { XyOsUiContextProvider } from "@xyo-network/os-react-runtime";
|
|
61
53
|
import { EventBus, XyOs } from "@xyo-network/os-runtime";
|
|
62
54
|
import { HDWallet } from "@xyo-network/wallet";
|
|
63
|
-
import
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
]);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
]);
|
|
55
|
+
import { useMemo } from "react";
|
|
56
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
57
|
+
var XyOsHost = ({
|
|
58
|
+
children,
|
|
59
|
+
eventBus,
|
|
60
|
+
kernel,
|
|
61
|
+
locator: locator2,
|
|
62
|
+
wallet
|
|
63
|
+
}) => {
|
|
64
|
+
const [walletToUse] = usePromise2(async () => wallet ?? await HDWallet.random(), [wallet]);
|
|
65
|
+
const eventBusToUse = useMemo(() => eventBus ?? new EventBus(), [kernel]);
|
|
66
|
+
const kernelToUse = useMemo(() => kernel ?? new Kernel(), [kernel]);
|
|
67
|
+
const locatorToUse = useMemo(() => locator2 ?? new ModuleFactoryLocator(), [locator2]);
|
|
77
68
|
const [os, error] = usePromise2(async () => {
|
|
78
69
|
if (walletToUse && kernelToUse && eventBusToUse && locatorToUse) {
|
|
79
70
|
const os2 = new XyOs({
|
|
@@ -84,63 +75,96 @@ var XyOsHost = /* @__PURE__ */ __name(({ children, eventBus, kernel, locator: lo
|
|
|
84
75
|
await os2.boot(walletToUse, locatorToUse);
|
|
85
76
|
return os2;
|
|
86
77
|
}
|
|
87
|
-
}, [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
78
|
+
}, [kernelToUse, walletToUse, locator2, eventBusToUse, locatorToUse]);
|
|
79
|
+
return os ? /* @__PURE__ */ jsx(XyOsUiContextProvider, { value: os, children }) : /* @__PURE__ */ jsxs(FlexCol, { children: [
|
|
80
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
81
|
+
"wallet:",
|
|
82
|
+
walletToUse ? "ready" : "loading"
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
85
|
+
"kernel:",
|
|
86
|
+
kernelToUse ? "ready" : "loading"
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
89
|
+
"os:",
|
|
90
|
+
os ? "ready" : "loading"
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ jsxs(Typography, { children: [
|
|
93
|
+
"os-error:",
|
|
94
|
+
error?.message
|
|
95
|
+
] })
|
|
96
|
+
] });
|
|
97
|
+
};
|
|
98
98
|
|
|
99
99
|
// src/components/host/DappHost.tsx
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
101
|
+
var DappHostInner = ({ dapp }) => {
|
|
102
|
+
const {
|
|
103
103
|
context,
|
|
104
|
-
|
|
105
|
-
dappMenuProperties: dappMenu,
|
|
104
|
+
dappMenu,
|
|
106
105
|
dappState: dappState2,
|
|
107
106
|
dappWallet,
|
|
108
107
|
errors
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
} = useInitializeDappAdHoc(dapp);
|
|
109
|
+
return /* @__PURE__ */ jsx2(FlexCol2, { children: /* @__PURE__ */ jsx2(
|
|
110
|
+
DappRendered,
|
|
111
|
+
{
|
|
112
|
+
context,
|
|
113
|
+
dapp,
|
|
114
|
+
dappMenuProperties: dappMenu,
|
|
115
|
+
dappState: dappState2,
|
|
116
|
+
dappWallet,
|
|
117
|
+
errors
|
|
118
|
+
}
|
|
119
|
+
) });
|
|
120
|
+
};
|
|
121
|
+
var DappHost = ({ dapp }) => /* @__PURE__ */ jsx2(XyOsHost, { children: /* @__PURE__ */ jsx2(DappHostInner, { dapp }) });
|
|
114
122
|
|
|
115
123
|
// src/components/host/Routable.tsx
|
|
116
|
-
import React4 from "react";
|
|
117
124
|
import { BrowserRouter } from "react-router-dom";
|
|
118
125
|
|
|
119
126
|
// src/components/host/Routes.tsx
|
|
120
|
-
import React3 from "react";
|
|
121
127
|
import { Route, Routes } from "react-router-dom";
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
129
|
+
var DappRoutes = (args) => /* @__PURE__ */ jsxs2(Routes, { children: [
|
|
130
|
+
/* @__PURE__ */ jsx3(
|
|
131
|
+
Route,
|
|
132
|
+
{
|
|
133
|
+
path: "/",
|
|
134
|
+
element: /* @__PURE__ */ jsx3(DappHost, { ...args })
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ jsx3(
|
|
138
|
+
Route,
|
|
139
|
+
{
|
|
140
|
+
path: "/:dappName",
|
|
141
|
+
element: /* @__PURE__ */ jsx3(DappHost, { ...args })
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ jsx3(
|
|
145
|
+
Route,
|
|
146
|
+
{
|
|
147
|
+
path: "/:dappName/:path/*",
|
|
148
|
+
element: /* @__PURE__ */ jsx3(DappHost, { ...args })
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
/* @__PURE__ */ jsx3(
|
|
152
|
+
Route,
|
|
153
|
+
{
|
|
154
|
+
path: "*",
|
|
155
|
+
element: /* @__PURE__ */ jsx3(DappHost, { ...args })
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
] });
|
|
135
159
|
|
|
136
160
|
// src/components/host/Routable.tsx
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
dapp
|
|
142
|
-
})
|
|
143
|
-
}
|
|
161
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
162
|
+
var RoutableDapp = ({ dapp }) => {
|
|
163
|
+
return /* @__PURE__ */ jsxs3(BrowserRouter, { children: [
|
|
164
|
+
/* @__PURE__ */ jsx4(DappRoutes, { dapp }),
|
|
165
|
+
/* @__PURE__ */ jsx4(DappHost, { dapp })
|
|
166
|
+
] });
|
|
167
|
+
};
|
|
144
168
|
|
|
145
169
|
// src/dapp.manifest.json
|
|
146
170
|
var dapp_manifest_default = {
|
|
@@ -226,19 +250,21 @@ var CustomDappParams = {
|
|
|
226
250
|
};
|
|
227
251
|
|
|
228
252
|
// src/Payloads.ts
|
|
229
|
-
import {
|
|
253
|
+
import {
|
|
254
|
+
DappConfigSchema,
|
|
255
|
+
DappIconSchema,
|
|
256
|
+
DappMode,
|
|
257
|
+
DappNavItemSchema,
|
|
258
|
+
DappNavMenuConfigSchema
|
|
259
|
+
} from "@xyo-network/os-model";
|
|
230
260
|
var CustomDappName = "Custom Dapp";
|
|
231
261
|
var version = "1.0.0";
|
|
232
262
|
var CustomDappConfig = {
|
|
233
263
|
manifest: dapp_manifest_default,
|
|
234
|
-
modes: [
|
|
235
|
-
DappMode.Window
|
|
236
|
-
],
|
|
264
|
+
modes: [DappMode.Window],
|
|
237
265
|
name: CustomDappName,
|
|
238
266
|
schema: DappConfigSchema,
|
|
239
|
-
sources: [
|
|
240
|
-
"network.xyo.dapp.accounts.source"
|
|
241
|
-
],
|
|
267
|
+
sources: ["network.xyo.dapp.accounts.source"],
|
|
242
268
|
version
|
|
243
269
|
};
|
|
244
270
|
var CustomDappIcon = {
|
|
@@ -249,10 +275,7 @@ var CustomDappIcon = {
|
|
|
249
275
|
type: "system",
|
|
250
276
|
version
|
|
251
277
|
};
|
|
252
|
-
var DappPayloads = [
|
|
253
|
-
CustomDappConfig,
|
|
254
|
-
CustomDappIcon
|
|
255
|
-
];
|
|
278
|
+
var DappPayloads = [CustomDappConfig, CustomDappIcon];
|
|
256
279
|
var CustomDappMenuItems = [
|
|
257
280
|
{
|
|
258
281
|
path: "home",
|
|
@@ -277,46 +300,40 @@ var CustomDappMenuConfig = {
|
|
|
277
300
|
defaultPath: "home",
|
|
278
301
|
schema: DappNavMenuConfigSchema
|
|
279
302
|
};
|
|
280
|
-
var CustomDappMenuPayloads = [
|
|
281
|
-
...CustomDappMenuItems,
|
|
282
|
-
CustomDappMenuConfig
|
|
283
|
-
];
|
|
303
|
+
var CustomDappMenuPayloads = [...CustomDappMenuItems, CustomDappMenuConfig];
|
|
284
304
|
|
|
285
305
|
// src/Dapp.tsx
|
|
286
306
|
import { ErrorRender } from "@xylabs/react-error";
|
|
287
307
|
import { DappPathSwitcher, useAddDappMenuItems } from "@xyo-network/os-react-runtime";
|
|
288
|
-
import React6 from "react";
|
|
289
308
|
|
|
290
309
|
// src/CustomDappPathToComponent.tsx
|
|
291
310
|
import { FlexRow } from "@xylabs/react-flexbox";
|
|
292
|
-
import
|
|
311
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
293
312
|
var CustomDappPathToComponent = [
|
|
294
313
|
{
|
|
295
|
-
component: /* @__PURE__ */
|
|
314
|
+
component: /* @__PURE__ */ jsx5(FlexRow, {}),
|
|
296
315
|
path: "home"
|
|
297
316
|
}
|
|
298
317
|
];
|
|
299
318
|
|
|
300
319
|
// src/Dapp.tsx
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
320
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
321
|
+
var CustomDapp = () => {
|
|
322
|
+
const {
|
|
323
|
+
menuConfig,
|
|
324
|
+
path,
|
|
325
|
+
error
|
|
326
|
+
} = useAddDappMenuItems(CustomDappMenuPayloads);
|
|
327
|
+
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
328
|
+
/* @__PURE__ */ jsx6(ErrorRender, { error, scope: "CustomDapp" }),
|
|
329
|
+
/* @__PURE__ */ jsx6(DappPathSwitcher, { activePath: path?.path ?? menuConfig?.defaultPath, pathToComponent: CustomDappPathToComponent })
|
|
330
|
+
] });
|
|
331
|
+
};
|
|
311
332
|
|
|
312
333
|
// src/UiParams.ts
|
|
313
334
|
var CustomDappUiParams = {
|
|
314
335
|
...CustomDappParams,
|
|
315
|
-
modes: {
|
|
316
|
-
window: {
|
|
317
|
-
component: CustomDapp
|
|
318
|
-
}
|
|
319
|
-
}
|
|
336
|
+
modes: { window: { component: CustomDapp } }
|
|
320
337
|
};
|
|
321
338
|
export {
|
|
322
339
|
CustomDappConfig,
|
package/dist/node/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/host/DappHost.tsx","../../src/helpers/registration/useInitializeDappAdHoc.tsx","../../src/components/host/XyOsHost.tsx","../../src/components/host/Routable.tsx","../../src/components/host/Routes.tsx","../../src/dapp.manifest.json","../../src/Params.ts","../../src/icon/Icon.tsx","../../src/Payloads.ts","../../src/Dapp.tsx","../../src/CustomDappPathToComponent.tsx","../../src/UiParams.ts"],"sourcesContent":["import { FlexCol } from '@xylabs/react-flexbox'\nimport type { RegisteredReactDapp } from '@xyo-network/os-react-model'\nimport { DappRendered } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nimport { useInitializeDappAdHoc } from '../../helpers/index.ts'\nimport { XyOsHost } from './XyOsHost.tsx'\n\nexport interface DappHostProps {\n dapp: RegisteredReactDapp\n}\n\nexport const DappHostInner: React.FC<DappHostProps> = ({ dapp }) => {\n const {\n context, dappMenu, dappState, dappWallet, errors,\n } = useInitializeDappAdHoc(dapp)\n\n return (\n <FlexCol>\n <DappRendered\n context={context}\n dapp={dapp}\n dappMenuProperties={dappMenu}\n dappState={dappState}\n dappWallet={dappWallet}\n errors={errors}\n />\n </FlexCol>\n )\n}\n\nexport const DappHost: React.FC<DappHostProps> = ({ dapp }) => (\n <XyOsHost>\n <DappHostInner dapp={dapp} />\n </XyOsHost>\n)\n","import { usePromise } from '@xylabs/react-promise'\nimport type { RegisteredReactDapp } from '@xyo-network/os-react-model'\nimport {\n useDappMenu, useManageDappInjectableParamsFromRoute, useManageDappPathFromRoute, useXyOsUiContext,\n} from '@xyo-network/os-react-runtime'\nimport { DappInitializer } from '@xyo-network/os-runtime'\n\nconst dappState = {\n active: true, minimized: false, closed: false,\n}\n\nexport const useInitializeDappAdHoc = (dapp: RegisteredReactDapp) => {\n const xyOs = useXyOsUiContext()\n\n const [installedDapp, nodeCreateError] = usePromise(async () => {\n if (xyOs && dapp) {\n const installer = new DappInitializer({\n allowedNames: [dapp.config.name],\n dapp,\n xnsNetwork: undefined,\n xnsNodeUrl: undefined,\n xyOs,\n })\n return await installer.install()\n }\n }, [xyOs, dapp])\n\n const { dappWallet, context } = installedDapp ?? {}\n\n // support for routing\n const routingError = useManageDappPathFromRoute(context, dapp.config.name)\n const injectableErrors = useManageDappInjectableParamsFromRoute(context)\n\n const dappMenu = useDappMenu(context, dapp.config.name)\n\n return {\n context,\n dappMenu,\n dappState,\n dappWallet,\n errors: [routingError, nodeCreateError, ...injectableErrors].filter(Boolean),\n }\n}\n","import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Kernel } from '@xyo-network/kernel'\nimport type { KernelExternal } from '@xyo-network/kernel-model'\nimport { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport { XyOsUiContextProvider } from '@xyo-network/os-react-runtime'\nimport { EventBus, XyOs } from '@xyo-network/os-runtime'\nimport { HDWallet } from '@xyo-network/wallet'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport React, { useMemo } from 'react'\n\nexport interface XyOsHostProps {\n children?: React.ReactNode\n eventBus?: EventBus\n kernel?: KernelExternal\n locator?: ModuleFactoryLocator\n wallet?: WalletInstance\n}\n\nexport const XyOsHost: React.FC<XyOsHostProps> = ({\n children, eventBus, kernel, locator, wallet,\n}) => {\n const [walletToUse] = usePromise(async () => wallet ?? await HDWallet.random(), [wallet])\n const eventBusToUse: EventBus = useMemo(() => eventBus ?? new EventBus(), [kernel])\n const kernelToUse: KernelExternal = useMemo(() => kernel ?? new Kernel(), [kernel])\n const locatorToUse = useMemo(() => locator ?? new ModuleFactoryLocator(), [locator])\n\n const [os, error] = usePromise(async () => {\n if (walletToUse && kernelToUse && eventBusToUse && locatorToUse) {\n const os = new XyOs({\n kernel: kernelToUse, eventBus: new EventBus(), locator: locatorToUse,\n })\n await os.boot(walletToUse, locatorToUse)\n return os\n }\n }, [kernelToUse, walletToUse, locator, eventBusToUse, locatorToUse])\n\n return os\n ? <XyOsUiContextProvider value={os}>{children}</XyOsUiContextProvider>\n : (\n <FlexCol>\n <Typography>\n wallet:\n {walletToUse ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n kernel:\n {kernelToUse ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n os:\n {os ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n os-error:\n {error?.message}\n </Typography>\n </FlexCol>\n )\n}\n","import React from 'react'\nimport { BrowserRouter } from 'react-router-dom'\n\nimport type { DappHostProps } from './DappHost.tsx'\nimport { DappHost } from './DappHost.tsx'\nimport { DappRoutes } from './Routes.tsx'\n\nexport const RoutableDapp: React.FC<DappHostProps> = ({ dapp }) => {\n return (\n <BrowserRouter>\n <DappRoutes dapp={dapp} />\n <DappHost dapp={dapp} />\n </BrowserRouter>\n )\n}\n","import React from 'react'\nimport { Route, Routes } from 'react-router-dom'\n\nimport { DappHost, type DappHostProps } from './DappHost.tsx'\n\nexport const DappRoutes: React.FC<DappHostProps> = args => (\n <Routes>\n <Route\n path=\"/\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"/:dappName\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"/:dappName/:path/*\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"*\"\n element={(\n <DappHost {...args} />\n )}\n />\n </Routes>\n)\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/compilations/dapp-package-manifest-schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"0'\",\n \"name\": \"CustomDappNode\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1'\",\n \"name\": \"DappArchivist\",\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest.package.dapp\"\n}","import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport type { UnregisteredDapp } from '@xyo-network/os-model'\n\nimport { CustomDappIconSvg } from './icon/index.ts'\n\nconst locator = new ModuleFactoryLocator()\n\nexport const CustomDappParams: UnregisteredDapp['params'] = {\n iconSvg: CustomDappIconSvg,\n locator,\n}\n\nexport default CustomDappParams\n","/* eslint-disable @stylistic/max-len */\nexport const CustomDappIconSvg = `\n<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 40 40\">\n <path\n fill=\"transparent\"\n d=\"M6.44,27.12c-.78,0-1.44.28-2,.83-.55.55-.83,1.21-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M18.01,27.91c-.55.55-.83,1.22-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83s-1.44.28-2,.83Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M33.56,27.12c-.78,0-1.44.28-2,.83-.55.55-.83,1.21-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M36.55,26.94c-.82-.82-1.82-1.23-3-1.23-.32,0-.63.04-.93.11-.3.07-.59.17-.87.31l-5.87-8.09c-.18.03-.36.05-.56.05h-1.13l6.42,8.83c-.39.4-.7.85-.93,1.36-.23.51-.35,1.06-.35,1.66,0,1.18.41,2.17,1.23,3s1.82,1.23,3,1.23,2.17-.41,3-1.23,1.23-1.82,1.23-3-.41-2.17-1.23-3ZM35.55,31.93c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M19.29,25.73c-1,.16-1.84.64-2.52,1.42-.67.79-1.01,1.7-1.01,2.75,0,1.18.41,2.17,1.23,3,.82.82,1.82,1.23,3,1.23s2.17-.41,3-1.23c.82-.82,1.23-1.82,1.23-3,0-1.05-.34-1.97-1.01-2.74-.67-.78-1.51-1.25-2.52-1.43v-7.65h-1.41v7.65ZM22,27.91c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M14.1,18l-5.89,8.08c-.28-.13-.56-.22-.86-.28-.29-.06-.6-.09-.91-.09-1.18,0-2.17.41-3,1.23-.82.82-1.23,1.82-1.23,3s.41,2.17,1.23,3,1.82,1.23,3,1.23,2.17-.41,3-1.23,1.23-1.82,1.23-3c0-.6-.12-1.15-.36-1.66s-.56-.96-.95-1.36l6.45-8.83h-1c-.25,0-.48-.03-.7-.08ZM8.44,31.93c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M20,12.91c1.26,0,2.46.19,3.61.56,1.15.37,2.23.88,3.23,1.54V4.86c0-.44-.15-.82-.46-1.12s-.68-.46-1.12-.46h-10.52c-.44,0-.82.15-1.12.46s-.46.68-.46,1.12v10.15c1-.66,2.08-1.17,3.23-1.54s2.36-.56,3.61-.56ZM17.7,5.83c.63-.63,1.4-.95,2.3-.95s1.66.32,2.3.95.95,1.4.95,2.3-.32,1.66-.95,2.3-1.4.95-2.3.95-1.66-.32-2.3-.95-.95-1.4-.95-2.3.32-1.66.95-2.3Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M20,10.32c.6,0,1.12-.21,1.55-.64.43-.43.65-.94.65-1.55s-.22-1.12-.65-1.55c-.43-.43-.95-.65-1.55-.65s-1.12.22-1.55.65-.64.95-.64,1.55.21,1.12.64,1.55.94.64,1.55.64Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M20,11.37c.9,0,1.66-.32,2.3-.95s.95-1.4.95-2.3-.32-1.66-.95-2.3-1.4-.95-2.3-.95-1.66.32-2.3.95-.95,1.4-.95,2.3.32,1.66.95,2.3,1.4.95,2.3.95ZM18.45,6.58c.43-.43.95-.65,1.55-.65s1.12.22,1.55.65c.43.43.65.95.65,1.55s-.22,1.12-.65,1.55c-.43.43-.95.64-1.55.64s-1.12-.21-1.55-.64-.64-.95-.64-1.55.21-1.12.64-1.55Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M27.21,2.9c-.5-.5-1.15-.75-1.95-.75h-10.52c-.8,0-1.45.25-1.95.75-.5.5-.75,1.15-.75,1.95v10.52c0,.8.25,1.45.75,1.95.35.35.77.56,1.25.67.22.05.45.08.7.08h10.52c.2,0,.38-.02.56-.05.55-.09,1.01-.33,1.39-.71.5-.5.75-1.15.75-1.95V4.86c0-.8-.25-1.45-.75-1.95ZM25.93,16.74c-.26.14-.55.22-.86.22h-10.15s-.08-.01-.12-.01c-.25-.02-.5-.08-.74-.2-.28-.14-.45-.35-.5-.63.99-.7,2.03-1.22,3.12-1.57s2.19-.52,3.31-.52,2.27.18,3.4.55c1.13.36,2.18.88,3.16,1.54-.15.27-.36.48-.63.63ZM26.84,15.01c-1-.66-2.08-1.17-3.23-1.54-1.15-.37-2.36-.56-3.61-.56s-2.46.19-3.61.56-2.23.88-3.23,1.54V4.86c0-.44.15-.82.46-1.12s.68-.46,1.12-.46h10.52c.44,0,.82.15,1.12.46s.46.68.46,1.12v10.15Z\"\n />\n </svg>\n `\n","/* eslint-disable @stylistic/max-len */\nimport type {\n DappConfig,\n DappIcon,\n DappName,\n DappNavItem,\n DappNavMenuConfig,\n DappPackageManifestPayload,\n DappVersion,\n} from '@xyo-network/os-model'\nimport {\n DappConfigSchema,\n DappIconSchema,\n DappMode,\n DappNavItemSchema,\n DappNavMenuConfigSchema,\n} from '@xyo-network/os-model'\n\nimport dappManifest from './dapp.manifest.json' with { type: 'json' }\n\nexport const CustomDappName: DappName = 'Custom Dapp' as const\n\nconst version: DappVersion = '1.0.0'\n\nexport const CustomDappConfig: DappConfig = {\n manifest: dappManifest as DappPackageManifestPayload,\n modes: [DappMode.Window],\n name: CustomDappName,\n schema: DappConfigSchema,\n sources: ['network.xyo.dapp.accounts.source'],\n version,\n}\n\nexport const CustomDappIcon: DappIcon = {\n active: false,\n installed: 'installed',\n name: CustomDappName,\n schema: DappIconSchema,\n type: 'system',\n version,\n}\n\nexport const DappPayloads = [CustomDappConfig, CustomDappIcon]\n\nexport type CustomDappMenuItemPaths = 'home' | 'settings'\n\nconst CustomDappMenuItems: DappNavItem<CustomDappMenuItemPaths>[] = [\n {\n path: 'home',\n primaryText: 'Home',\n schema: DappNavItemSchema,\n svgIcon: `\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 -960 960 960\" width=\"24\" fill=\"none\"><path fill=\"currentColor\" d=\"M420-360h120l-23-129q20-10 31.5-29t11.5-42q0-33-23.5-56.5T480-640q-33 0-56.5 23.5T400-560q0 23 11.5 42t31.5 29l-23 129Zm60 280q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z\"/></svg>\n `,\n weight: 0,\n },\n {\n path: 'settings',\n primaryText: 'Settings',\n schema: DappNavItemSchema,\n svgIcon: `\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 -960 960 960\" width=\"24\" fill=\"none\"><path fill=\"currentColor\" d=\"M420-360h120l-23-129q20-10 31.5-29t11.5-42q0-33-23.5-56.5T480-640q-33 0-56.5 23.5T400-560q0 23 11.5 42t31.5 29l-23 129Zm60 280q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z\"/></svg>\n `,\n weight: 0,\n },\n]\n\nconst CustomDappMenuConfig: DappNavMenuConfig = {\n defaultPath: 'home',\n schema: DappNavMenuConfigSchema,\n}\n\nexport const CustomDappMenuPayloads = [...CustomDappMenuItems, CustomDappMenuConfig]\n","import { ErrorRender } from '@xylabs/react-error'\nimport { DappPathSwitcher, useAddDappMenuItems } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nimport { CustomDappPathToComponent } from './CustomDappPathToComponent.tsx'\nimport { CustomDappMenuPayloads } from './Payloads.ts'\n\nexport const CustomDapp = () => {\n const {\n menuConfig, path, error,\n } = useAddDappMenuItems(CustomDappMenuPayloads)\n\n return (\n <>\n <ErrorRender error={error} scope=\"CustomDapp\" />\n <DappPathSwitcher activePath={path?.path ?? menuConfig?.defaultPath} pathToComponent={CustomDappPathToComponent} />\n </>\n )\n}\n","import { FlexRow } from '@xylabs/react-flexbox'\nimport type { PathToComponent } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nexport const CustomDappPathToComponent: PathToComponent[] = [\n {\n component: <FlexRow />,\n path: 'home',\n },\n]\n","import type { UnregisteredReactDapp } from '@xyo-network/os-react-model'\n\nimport { CustomDapp } from './Dapp.tsx'\nimport { CustomDappParams } from './Params.ts'\n\nexport const CustomDappUiParams: UnregisteredReactDapp['params'] = {\n ...CustomDappParams,\n modes: { window: { component: CustomDapp } },\n}\n\nexport default CustomDappUiParams\n"],"mappings":";;;;AAAA,SAASA,WAAAA,gBAAe;AAExB,SAASC,oBAAoB;AAC7B,O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AMC,qBAAsD;EACjE,GAAGC;EACHC,OAAO;IAAEC,QAAQ;MAAEC,WAAWC;IAAW;EAAE;AAC7C;","names":["FlexCol","DappRendered","React","usePromise","useDappMenu","useManageDappInjectableParamsFromRoute","useManageDappPathFromRoute","useXyOsUiContext","DappInitializer","dappState","active","minimized","closed","useInitializeDappAdHoc","dapp","xyOs","useXyOsUiContext","installedDapp","nodeCreateError","usePromise","installer","DappInitializer","allowedNames","config","name","xnsNetwork","undefined","xnsNodeUrl","install","dappWallet","context","routingError","useManageDappPathFromRoute","injectableErrors","useManageDappInjectableParamsFromRoute","dappMenu","useDappMenu","errors","filter","Boolean","Typography","FlexCol","usePromise","Kernel","ModuleFactoryLocator","XyOsUiContextProvider","EventBus","XyOs","HDWallet","React","useMemo","XyOsHost","children","eventBus","kernel","locator","wallet","walletToUse","usePromise","HDWallet","random","eventBusToUse","useMemo","EventBus","kernelToUse","Kernel","locatorToUse","ModuleFactoryLocator","os","error","XyOs","boot","XyOsUiContextProvider","value","FlexCol","Typography","message","DappHostInner","dapp","context","dappMenu","dappState","dappWallet","errors","useInitializeDappAdHoc","React","FlexCol","DappRendered","dappMenuProperties","DappHost","XyOsHost","React","BrowserRouter","React","Route","Routes","DappRoutes","args","React","Routes","Route","path","element","DappHost","RoutableDapp","dapp","React","BrowserRouter","DappRoutes","DappHost","ModuleFactoryLocator","CustomDappIconSvg","locator","ModuleFactoryLocator","CustomDappParams","iconSvg","CustomDappIconSvg","DappConfigSchema","DappIconSchema","DappMode","DappNavItemSchema","DappNavMenuConfigSchema","CustomDappName","version","CustomDappConfig","manifest","dappManifest","modes","DappMode","Window","name","schema","DappConfigSchema","sources","CustomDappIcon","active","installed","DappIconSchema","type","DappPayloads","CustomDappMenuItems","path","primaryText","DappNavItemSchema","svgIcon","weight","CustomDappMenuConfig","defaultPath","DappNavMenuConfigSchema","CustomDappMenuPayloads","ErrorRender","DappPathSwitcher","useAddDappMenuItems","React","FlexRow","React","CustomDappPathToComponent","component","path","CustomDapp","menuConfig","path","error","useAddDappMenuItems","CustomDappMenuPayloads","React","ErrorRender","scope","DappPathSwitcher","activePath","defaultPath","pathToComponent","CustomDappPathToComponent","CustomDappUiParams","CustomDappParams","modes","window","component","CustomDapp"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/host/DappHost.tsx","../../src/helpers/registration/useInitializeDappAdHoc.tsx","../../src/components/host/XyOsHost.tsx","../../src/components/host/Routable.tsx","../../src/components/host/Routes.tsx","../../src/dapp.manifest.json","../../src/Params.ts","../../src/icon/Icon.tsx","../../src/Payloads.ts","../../src/Dapp.tsx","../../src/CustomDappPathToComponent.tsx","../../src/UiParams.ts"],"sourcesContent":["import { FlexCol } from '@xylabs/react-flexbox'\nimport type { RegisteredReactDapp } from '@xyo-network/os-react-model'\nimport { DappRendered } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nimport { useInitializeDappAdHoc } from '../../helpers/index.ts'\nimport { XyOsHost } from './XyOsHost.tsx'\n\nexport interface DappHostProps {\n dapp: RegisteredReactDapp\n}\n\nexport const DappHostInner: React.FC<DappHostProps> = ({ dapp }) => {\n const {\n context, dappMenu, dappState, dappWallet, errors,\n } = useInitializeDappAdHoc(dapp)\n\n return (\n <FlexCol>\n <DappRendered\n context={context}\n dapp={dapp}\n dappMenuProperties={dappMenu}\n dappState={dappState}\n dappWallet={dappWallet}\n errors={errors}\n />\n </FlexCol>\n )\n}\n\nexport const DappHost: React.FC<DappHostProps> = ({ dapp }) => (\n <XyOsHost>\n <DappHostInner dapp={dapp} />\n </XyOsHost>\n)\n","import { usePromise } from '@xylabs/react-promise'\nimport type { RegisteredReactDapp } from '@xyo-network/os-react-model'\nimport {\n useDappMenu, useManageDappInjectableParamsFromRoute, useManageDappPathFromRoute, useXyOsUiContext,\n} from '@xyo-network/os-react-runtime'\nimport { DappInitializer } from '@xyo-network/os-runtime'\n\nconst dappState = {\n active: true, minimized: false, closed: false,\n}\n\nexport const useInitializeDappAdHoc = (dapp: RegisteredReactDapp) => {\n const xyOs = useXyOsUiContext()\n\n const [installedDapp, nodeCreateError] = usePromise(async () => {\n if (xyOs && dapp) {\n const installer = new DappInitializer({\n allowedNames: [dapp.config.name],\n dapp,\n xnsNetwork: undefined,\n xnsNodeUrl: undefined,\n xyOs,\n })\n return await installer.install()\n }\n }, [xyOs, dapp])\n\n const { dappWallet, context } = installedDapp ?? {}\n\n // support for routing\n const routingError = useManageDappPathFromRoute(context, dapp.config.name)\n const injectableErrors = useManageDappInjectableParamsFromRoute(context)\n\n const dappMenu = useDappMenu(context, dapp.config.name)\n\n return {\n context,\n dappMenu,\n dappState,\n dappWallet,\n errors: [routingError, nodeCreateError, ...injectableErrors].filter(Boolean),\n }\n}\n","import { Typography } from '@mui/material'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { Kernel } from '@xyo-network/kernel'\nimport type { KernelExternal } from '@xyo-network/kernel-model'\nimport { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport { XyOsUiContextProvider } from '@xyo-network/os-react-runtime'\nimport { EventBus, XyOs } from '@xyo-network/os-runtime'\nimport { HDWallet } from '@xyo-network/wallet'\nimport type { WalletInstance } from '@xyo-network/wallet-model'\nimport React, { useMemo } from 'react'\n\nexport interface XyOsHostProps {\n children?: React.ReactNode\n eventBus?: EventBus\n kernel?: KernelExternal\n locator?: ModuleFactoryLocator\n wallet?: WalletInstance\n}\n\nexport const XyOsHost: React.FC<XyOsHostProps> = ({\n children, eventBus, kernel, locator, wallet,\n}) => {\n const [walletToUse] = usePromise(async () => wallet ?? await HDWallet.random(), [wallet])\n const eventBusToUse: EventBus = useMemo(() => eventBus ?? new EventBus(), [kernel])\n const kernelToUse: KernelExternal = useMemo(() => kernel ?? new Kernel(), [kernel])\n const locatorToUse = useMemo(() => locator ?? new ModuleFactoryLocator(), [locator])\n\n const [os, error] = usePromise(async () => {\n if (walletToUse && kernelToUse && eventBusToUse && locatorToUse) {\n const os = new XyOs({\n kernel: kernelToUse, eventBus: new EventBus(), locator: locatorToUse,\n })\n await os.boot(walletToUse, locatorToUse)\n return os\n }\n }, [kernelToUse, walletToUse, locator, eventBusToUse, locatorToUse])\n\n return os\n ? <XyOsUiContextProvider value={os}>{children}</XyOsUiContextProvider>\n : (\n <FlexCol>\n <Typography>\n wallet:\n {walletToUse ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n kernel:\n {kernelToUse ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n os:\n {os ? 'ready' : 'loading'}\n </Typography>\n <Typography>\n os-error:\n {error?.message}\n </Typography>\n </FlexCol>\n )\n}\n","import React from 'react'\nimport { BrowserRouter } from 'react-router-dom'\n\nimport type { DappHostProps } from './DappHost.tsx'\nimport { DappHost } from './DappHost.tsx'\nimport { DappRoutes } from './Routes.tsx'\n\nexport const RoutableDapp: React.FC<DappHostProps> = ({ dapp }) => {\n return (\n <BrowserRouter>\n <DappRoutes dapp={dapp} />\n <DappHost dapp={dapp} />\n </BrowserRouter>\n )\n}\n","import React from 'react'\nimport { Route, Routes } from 'react-router-dom'\n\nimport { DappHost, type DappHostProps } from './DappHost.tsx'\n\nexport const DappRoutes: React.FC<DappHostProps> = args => (\n <Routes>\n <Route\n path=\"/\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"/:dappName\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"/:dappName/:path/*\"\n element={(\n <DappHost {...args} />\n )}\n />\n <Route\n path=\"*\"\n element={(\n <DappHost {...args} />\n )}\n />\n </Routes>\n)\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/compilations/dapp-package-manifest-schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"0'\",\n \"name\": \"CustomDappNode\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1'\",\n \"name\": \"DappArchivist\",\n \"schema\": \"network.xyo.archivist.config\"\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest.package.dapp\"\n}","import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'\nimport type { UnregisteredDapp } from '@xyo-network/os-model'\n\nimport { CustomDappIconSvg } from './icon/index.ts'\n\nconst locator = new ModuleFactoryLocator()\n\nexport const CustomDappParams: UnregisteredDapp['params'] = {\n iconSvg: CustomDappIconSvg,\n locator,\n}\n\nexport default CustomDappParams\n","/* eslint-disable @stylistic/max-len */\nexport const CustomDappIconSvg = `\n<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 40 40\">\n <path\n fill=\"transparent\"\n d=\"M6.44,27.12c-.78,0-1.44.28-2,.83-.55.55-.83,1.21-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M18.01,27.91c-.55.55-.83,1.22-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83s-1.44.28-2,.83Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M33.56,27.12c-.78,0-1.44.28-2,.83-.55.55-.83,1.21-.83,1.99s.28,1.44.83,2c.55.55,1.21.83,1.99.83s1.44-.28,2-.83c.55-.55.83-1.21.83-1.99s-.28-1.44-.83-2c-.55-.55-1.21-.83-1.99-.83Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M36.55,26.94c-.82-.82-1.82-1.23-3-1.23-.32,0-.63.04-.93.11-.3.07-.59.17-.87.31l-5.87-8.09c-.18.03-.36.05-.56.05h-1.13l6.42,8.83c-.39.4-.7.85-.93,1.36-.23.51-.35,1.06-.35,1.66,0,1.18.41,2.17,1.23,3s1.82,1.23,3,1.23,2.17-.41,3-1.23,1.23-1.82,1.23-3-.41-2.17-1.23-3ZM35.55,31.93c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M19.29,25.73c-1,.16-1.84.64-2.52,1.42-.67.79-1.01,1.7-1.01,2.75,0,1.18.41,2.17,1.23,3,.82.82,1.82,1.23,3,1.23s2.17-.41,3-1.23c.82-.82,1.23-1.82,1.23-3,0-1.05-.34-1.97-1.01-2.74-.67-.78-1.51-1.25-2.52-1.43v-7.65h-1.41v7.65ZM22,27.91c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M14.1,18l-5.89,8.08c-.28-.13-.56-.22-.86-.28-.29-.06-.6-.09-.91-.09-1.18,0-2.17.41-3,1.23-.82.82-1.23,1.82-1.23,3s.41,2.17,1.23,3,1.82,1.23,3,1.23,2.17-.41,3-1.23,1.23-1.82,1.23-3c0-.6-.12-1.15-.36-1.66s-.56-.96-.95-1.36l6.45-8.83h-1c-.25,0-.48-.03-.7-.08ZM8.44,31.93c-.55.55-1.22.83-2,.83s-1.44-.28-1.99-.83c-.55-.55-.83-1.22-.83-2s.28-1.44.83-1.99c.55-.55,1.22-.83,2-.83s1.44.28,1.99.83c.55.55.83,1.22.83,2s-.28,1.44-.83,1.99Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M20,12.91c1.26,0,2.46.19,3.61.56,1.15.37,2.23.88,3.23,1.54V4.86c0-.44-.15-.82-.46-1.12s-.68-.46-1.12-.46h-10.52c-.44,0-.82.15-1.12.46s-.46.68-.46,1.12v10.15c1-.66,2.08-1.17,3.23-1.54s2.36-.56,3.61-.56ZM17.7,5.83c.63-.63,1.4-.95,2.3-.95s1.66.32,2.3.95.95,1.4.95,2.3-.32,1.66-.95,2.3-1.4.95-2.3.95-1.66-.32-2.3-.95-.95-1.4-.95-2.3.32-1.66.95-2.3Z\"\n />\n <path\n fill=\"transparent\"\n d=\"M20,10.32c.6,0,1.12-.21,1.55-.64.43-.43.65-.94.65-1.55s-.22-1.12-.65-1.55c-.43-.43-.95-.65-1.55-.65s-1.12.22-1.55.65-.64.95-.64,1.55.21,1.12.64,1.55.94.64,1.55.64Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M20,11.37c.9,0,1.66-.32,2.3-.95s.95-1.4.95-2.3-.32-1.66-.95-2.3-1.4-.95-2.3-.95-1.66.32-2.3.95-.95,1.4-.95,2.3.32,1.66.95,2.3,1.4.95,2.3.95ZM18.45,6.58c.43-.43.95-.65,1.55-.65s1.12.22,1.55.65c.43.43.65.95.65,1.55s-.22,1.12-.65,1.55c-.43.43-.95.64-1.55.64s-1.12-.21-1.55-.64-.64-.95-.64-1.55.21-1.12.64-1.55Z\"\n />\n <path\n fill=\"currentColor\"\n d=\"M27.21,2.9c-.5-.5-1.15-.75-1.95-.75h-10.52c-.8,0-1.45.25-1.95.75-.5.5-.75,1.15-.75,1.95v10.52c0,.8.25,1.45.75,1.95.35.35.77.56,1.25.67.22.05.45.08.7.08h10.52c.2,0,.38-.02.56-.05.55-.09,1.01-.33,1.39-.71.5-.5.75-1.15.75-1.95V4.86c0-.8-.25-1.45-.75-1.95ZM25.93,16.74c-.26.14-.55.22-.86.22h-10.15s-.08-.01-.12-.01c-.25-.02-.5-.08-.74-.2-.28-.14-.45-.35-.5-.63.99-.7,2.03-1.22,3.12-1.57s2.19-.52,3.31-.52,2.27.18,3.4.55c1.13.36,2.18.88,3.16,1.54-.15.27-.36.48-.63.63ZM26.84,15.01c-1-.66-2.08-1.17-3.23-1.54-1.15-.37-2.36-.56-3.61-.56s-2.46.19-3.61.56-2.23.88-3.23,1.54V4.86c0-.44.15-.82.46-1.12s.68-.46,1.12-.46h10.52c.44,0,.82.15,1.12.46s.46.68.46,1.12v10.15Z\"\n />\n </svg>\n `\n","/* eslint-disable @stylistic/max-len */\nimport type {\n DappConfig,\n DappIcon,\n DappName,\n DappNavItem,\n DappNavMenuConfig,\n DappPackageManifestPayload,\n DappVersion,\n} from '@xyo-network/os-model'\nimport {\n DappConfigSchema,\n DappIconSchema,\n DappMode,\n DappNavItemSchema,\n DappNavMenuConfigSchema,\n} from '@xyo-network/os-model'\n\nimport dappManifest from './dapp.manifest.json' with { type: 'json' }\n\nexport const CustomDappName: DappName = 'Custom Dapp' as const\n\nconst version: DappVersion = '1.0.0'\n\nexport const CustomDappConfig: DappConfig = {\n manifest: dappManifest as DappPackageManifestPayload,\n modes: [DappMode.Window],\n name: CustomDappName,\n schema: DappConfigSchema,\n sources: ['network.xyo.dapp.accounts.source'],\n version,\n}\n\nexport const CustomDappIcon: DappIcon = {\n active: false,\n installed: 'installed',\n name: CustomDappName,\n schema: DappIconSchema,\n type: 'system',\n version,\n}\n\nexport const DappPayloads = [CustomDappConfig, CustomDappIcon]\n\nexport type CustomDappMenuItemPaths = 'home' | 'settings'\n\nconst CustomDappMenuItems: DappNavItem<CustomDappMenuItemPaths>[] = [\n {\n path: 'home',\n primaryText: 'Home',\n schema: DappNavItemSchema,\n svgIcon: `\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 -960 960 960\" width=\"24\" fill=\"none\"><path fill=\"currentColor\" d=\"M420-360h120l-23-129q20-10 31.5-29t11.5-42q0-33-23.5-56.5T480-640q-33 0-56.5 23.5T400-560q0 23 11.5 42t31.5 29l-23 129Zm60 280q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z\"/></svg>\n `,\n weight: 0,\n },\n {\n path: 'settings',\n primaryText: 'Settings',\n schema: DappNavItemSchema,\n svgIcon: `\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 -960 960 960\" width=\"24\" fill=\"none\"><path fill=\"currentColor\" d=\"M420-360h120l-23-129q20-10 31.5-29t11.5-42q0-33-23.5-56.5T480-640q-33 0-56.5 23.5T400-560q0 23 11.5 42t31.5 29l-23 129Zm60 280q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z\"/></svg>\n `,\n weight: 0,\n },\n]\n\nconst CustomDappMenuConfig: DappNavMenuConfig = {\n defaultPath: 'home',\n schema: DappNavMenuConfigSchema,\n}\n\nexport const CustomDappMenuPayloads = [...CustomDappMenuItems, CustomDappMenuConfig]\n","import { ErrorRender } from '@xylabs/react-error'\nimport { DappPathSwitcher, useAddDappMenuItems } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nimport { CustomDappPathToComponent } from './CustomDappPathToComponent.tsx'\nimport { CustomDappMenuPayloads } from './Payloads.ts'\n\nexport const CustomDapp = () => {\n const {\n menuConfig, path, error,\n } = useAddDappMenuItems(CustomDappMenuPayloads)\n\n return (\n <>\n <ErrorRender error={error} scope=\"CustomDapp\" />\n <DappPathSwitcher activePath={path?.path ?? menuConfig?.defaultPath} pathToComponent={CustomDappPathToComponent} />\n </>\n )\n}\n","import { FlexRow } from '@xylabs/react-flexbox'\nimport type { PathToComponent } from '@xyo-network/os-react-runtime'\nimport React from 'react'\n\nexport const CustomDappPathToComponent: PathToComponent[] = [\n {\n component: <FlexRow />,\n path: 'home',\n },\n]\n","import type { UnregisteredReactDapp } from '@xyo-network/os-react-model'\n\nimport { CustomDapp } from './Dapp.tsx'\nimport { CustomDappParams } from './Params.ts'\n\nexport const CustomDappUiParams: UnregisteredReactDapp['params'] = {\n ...CustomDappParams,\n modes: { window: { component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;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,SAAS;AAAA;AAAA;AAAA,IAGT,QAAQ;AAAA,EACV;AACF;AAEA,IAAM,uBAA0C;AAAA,EAC9C,aAAa;AAAA,EACb,QAAQ;AACV;AAEO,IAAM,yBAAyB,CAAC,GAAG,qBAAqB,oBAAoB;;;ACxEnF,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB,2BAA2B;;;ACDtD,SAAS,eAAe;AAMT,gBAAAC,YAAA;AAFR,IAAM,4BAA+C;AAAA,EAC1D;AAAA,IACE,WAAW,gBAAAA,KAAC,WAAQ;AAAA,IACpB,MAAM;AAAA,EACR;AACF;;;ADII,mBACE,OAAAC,MADF,QAAAC,aAAA;AANG,IAAM,aAAa,MAAM;AAC9B,QAAM;AAAA,IACJ;AAAA,IAAY;AAAA,IAAM;AAAA,EACpB,IAAI,oBAAoB,sBAAsB;AAE9C,SACE,gBAAAA,MAAA,YACE;AAAA,oBAAAD,KAAC,eAAY,OAAc,OAAM,cAAa;AAAA,IAC9C,gBAAAA,KAAC,oBAAiB,YAAY,MAAM,QAAQ,YAAY,aAAa,iBAAiB,2BAA2B;AAAA,KACnH;AAEJ;;;AEbO,IAAM,qBAAsD;AAAA,EACjE,GAAG;AAAA,EACH,OAAO,EAAE,QAAQ,EAAE,WAAW,WAAW,EAAE;AAC7C;","names":["FlexCol","usePromise","locator","os","jsx","dappState","FlexCol","jsx","jsxs","jsx","jsxs","ModuleFactoryLocator","ModuleFactoryLocator","jsx","jsx","jsxs"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/dapp-template",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -37,44 +37,45 @@
|
|
|
37
37
|
"src"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@xylabs/object": "
|
|
41
|
-
"@xylabs/react-error": "
|
|
42
|
-
"@xylabs/react-flexbox": "
|
|
43
|
-
"@xylabs/react-promise": "
|
|
44
|
-
"@xyo-network/kernel": "
|
|
45
|
-
"@xyo-network/kernel-model": "
|
|
46
|
-
"@xyo-network/module-factory-locator": "
|
|
47
|
-
"@xyo-network/os-model": "
|
|
48
|
-
"@xyo-network/os-react-model": "
|
|
49
|
-
"@xyo-network/os-react-runtime": "
|
|
50
|
-
"@xyo-network/os-runtime": "
|
|
51
|
-
"@xyo-network/payload-model": "
|
|
52
|
-
"@xyo-network/wallet": "
|
|
53
|
-
"@xyo-network/wallet-model": "
|
|
40
|
+
"@xylabs/object": "~5.0.2",
|
|
41
|
+
"@xylabs/react-error": "~7.0.0",
|
|
42
|
+
"@xylabs/react-flexbox": "~7.0.0",
|
|
43
|
+
"@xylabs/react-promise": "~7.0.0",
|
|
44
|
+
"@xyo-network/kernel": "~7.0.1",
|
|
45
|
+
"@xyo-network/kernel-model": "~7.0.1",
|
|
46
|
+
"@xyo-network/module-factory-locator": "~5.0.0",
|
|
47
|
+
"@xyo-network/os-model": "~7.0.1",
|
|
48
|
+
"@xyo-network/os-react-model": "~7.0.1",
|
|
49
|
+
"@xyo-network/os-react-runtime": "~7.0.1",
|
|
50
|
+
"@xyo-network/os-runtime": "~7.0.1",
|
|
51
|
+
"@xyo-network/payload-model": "~5.0.0",
|
|
52
|
+
"@xyo-network/wallet": "~5.0.0",
|
|
53
|
+
"@xyo-network/wallet-model": "~5.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@emotion/react": "
|
|
57
|
-
"@emotion/styled": "
|
|
58
|
-
"@mui/icons-material": "
|
|
59
|
-
"@mui/material": "
|
|
60
|
-
"@storybook/react-vite": "
|
|
61
|
-
"@types/react": "
|
|
62
|
-
"@xylabs/ts-scripts-yarn3": "
|
|
63
|
-
"@xylabs/tsconfig": "
|
|
64
|
-
"@xylabs/tsconfig-dom": "
|
|
65
|
-
"@xylabs/tsconfig-react": "
|
|
66
|
-
"react": "
|
|
67
|
-
"react-dom": "
|
|
68
|
-
"react-router-dom": "
|
|
69
|
-
"storybook": "
|
|
70
|
-
"typescript": "
|
|
56
|
+
"@emotion/react": "~11.14.0",
|
|
57
|
+
"@emotion/styled": "~11.14.1",
|
|
58
|
+
"@mui/icons-material": "~7.3.0",
|
|
59
|
+
"@mui/material": "~7.3.0",
|
|
60
|
+
"@storybook/react-vite": "~9.1.1",
|
|
61
|
+
"@types/react": "~19.1.9",
|
|
62
|
+
"@xylabs/ts-scripts-yarn3": "~7.0.3",
|
|
63
|
+
"@xylabs/tsconfig": "~7.0.3",
|
|
64
|
+
"@xylabs/tsconfig-dom": "~7.0.3",
|
|
65
|
+
"@xylabs/tsconfig-react": "~7.0.3",
|
|
66
|
+
"react": "~19.1.1",
|
|
67
|
+
"react-dom": "~19.1.1",
|
|
68
|
+
"react-router-dom": "~7.7.1",
|
|
69
|
+
"storybook": "~9.1.1",
|
|
70
|
+
"typescript": "~5.9.2",
|
|
71
|
+
"vite": "^7.0.6"
|
|
71
72
|
},
|
|
72
73
|
"peerDependencies": {
|
|
73
74
|
"@mui/icons-material": ">=6 <8",
|
|
74
75
|
"@mui/material": ">=6 <8",
|
|
75
|
-
"react": "
|
|
76
|
-
"react-dom": "
|
|
77
|
-
"react-router-dom": "
|
|
76
|
+
"react": "~19",
|
|
77
|
+
"react-dom": "~19",
|
|
78
|
+
"react-router-dom": "~7"
|
|
78
79
|
},
|
|
79
80
|
"publishConfig": {
|
|
80
81
|
"access": "public"
|