@xyo-network/dapp-template 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +165 -0
- package/README.md +13 -0
- package/dist/neutral/DappHost.d.ts +7 -0
- package/dist/neutral/DappHost.d.ts.map +1 -0
- package/dist/neutral/Params.d.ts +4 -0
- package/dist/neutral/Params.d.ts.map +1 -0
- package/dist/neutral/Payloads.d.ts +22 -0
- package/dist/neutral/Payloads.d.ts.map +1 -0
- package/dist/neutral/ReactDapp.d.ts +13 -0
- package/dist/neutral/ReactDapp.d.ts.map +1 -0
- package/dist/neutral/UiParams.d.ts +4 -0
- package/dist/neutral/UiParams.d.ts.map +1 -0
- package/dist/neutral/XyOsHost.d.ts +14 -0
- package/dist/neutral/XyOsHost.d.ts.map +1 -0
- package/dist/neutral/components/Dapp.d.ts +3 -0
- package/dist/neutral/components/Dapp.d.ts.map +1 -0
- package/dist/neutral/components/index.d.ts +2 -0
- package/dist/neutral/components/index.d.ts.map +1 -0
- package/dist/neutral/icon/Icon.d.ts +2 -0
- package/dist/neutral/icon/Icon.d.ts.map +1 -0
- package/dist/neutral/icon/index.d.ts +3 -0
- package/dist/neutral/icon/index.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +5 -0
- package/dist/neutral/index.d.ts.map +1 -0
- package/dist/neutral/index.mjs +187 -0
- package/dist/neutral/index.mjs.map +1 -0
- package/dist/neutral/window/Dapp.d.ts +2 -0
- package/dist/neutral/window/Dapp.d.ts.map +1 -0
- package/dist/neutral/window/index.d.ts +2 -0
- package/dist/neutral/window/index.d.ts.map +1 -0
- package/dist/node/DappHost.d.ts +7 -0
- package/dist/node/DappHost.d.ts.map +1 -0
- package/dist/node/Params.d.ts +4 -0
- package/dist/node/Params.d.ts.map +1 -0
- package/dist/node/Payloads.d.ts +22 -0
- package/dist/node/Payloads.d.ts.map +1 -0
- package/dist/node/ReactDapp.d.ts +13 -0
- package/dist/node/ReactDapp.d.ts.map +1 -0
- package/dist/node/UiParams.d.ts +4 -0
- package/dist/node/UiParams.d.ts.map +1 -0
- package/dist/node/XyOsHost.d.ts +14 -0
- package/dist/node/XyOsHost.d.ts.map +1 -0
- package/dist/node/components/Dapp.d.ts +3 -0
- package/dist/node/components/Dapp.d.ts.map +1 -0
- package/dist/node/components/index.d.ts +2 -0
- package/dist/node/components/index.d.ts.map +1 -0
- package/dist/node/icon/Icon.d.ts +2 -0
- package/dist/node/icon/Icon.d.ts.map +1 -0
- package/dist/node/icon/index.d.ts +3 -0
- package/dist/node/icon/index.d.ts.map +1 -0
- package/dist/node/index.d.ts +5 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.mjs +187 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/node/window/Dapp.d.ts +2 -0
- package/dist/node/window/Dapp.d.ts.map +1 -0
- package/dist/node/window/index.d.ts +2 -0
- package/dist/node/window/index.d.ts.map +1 -0
- package/package.json +83 -0
- package/src/DappHost.tsx +145 -0
- package/src/Params.ts +15 -0
- package/src/Payloads.ts +73 -0
- package/src/ReactDapp.ts +13 -0
- package/src/UiParams.ts +11 -0
- package/src/XyOsHost.tsx +61 -0
- package/src/components/Dapp.tsx +10 -0
- package/src/components/index.ts +1 -0
- package/src/dapp.manifest.json +30 -0
- package/src/dapp.stories.tsx +75 -0
- package/src/icon/Icon.tsx +45 -0
- package/src/icon/index.ts +2 -0
- package/src/index.ts +4 -0
- package/src/window/Dapp.tsx +19 -0
- package/src/window/index.ts +1 -0
- package/typedoc.json +5 -0
- package/xy.config.ts +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UiParams.d.ts","sourceRoot":"","sources":["../../src/UiParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAKxE,eAAO,MAAM,kBAAkB,EAAE,qBAAqB,CAAC,QAAQ,CAG9D,CAAA;AAED,OAAO,EAAE,kBAAkB,IAAI,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type WalletInstance } from '@xyo-network/account';
|
|
2
|
+
import type { KernelExternal } from '@xyo-network/kernel-model';
|
|
3
|
+
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator';
|
|
4
|
+
import { EventBus } from '@xyo-network/os-runtime';
|
|
5
|
+
import type React from 'react';
|
|
6
|
+
export interface XyOsHostProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
eventBus?: EventBus;
|
|
9
|
+
kernel?: KernelExternal;
|
|
10
|
+
locator?: ModuleFactoryLocator;
|
|
11
|
+
wallet?: WalletInstance;
|
|
12
|
+
}
|
|
13
|
+
export declare const XyOsHost: React.FC<XyOsHostProps>;
|
|
14
|
+
//# sourceMappingURL=XyOsHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XyOsHost.d.ts","sourceRoot":"","sources":["../../src/XyOsHost.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAE1E,OAAO,EAAE,QAAQ,EAAQ,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB,OAAO,CAAC,EAAE,oBAAoB,CAAA;IAC9B,MAAM,CAAC,EAAE,cAAc,CAAA;CACxB;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAwC5C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dapp.d.ts","sourceRoot":"","sources":["../../../src/components/Dapp.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAGpE,eAAO,MAAM,yBAAyB,EAAE,eAAe,EAKtD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare 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 ";
|
|
2
|
+
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/icon/Icon.tsx"],"names":[],"mappings":"AACA,eAAO,MAAM,iBAAiB,i4HA2C3B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icon/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AACtE,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// src/dapp.manifest.json
|
|
2
|
+
var dapp_manifest_default = {
|
|
3
|
+
$schema: "https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/compilations/dapp-package-manifest-schema.json",
|
|
4
|
+
nodes: [
|
|
5
|
+
{
|
|
6
|
+
config: {
|
|
7
|
+
accountPath: "0'",
|
|
8
|
+
name: "Node",
|
|
9
|
+
schema: "network.xyo.node.config"
|
|
10
|
+
},
|
|
11
|
+
modules: {
|
|
12
|
+
private: [],
|
|
13
|
+
public: [
|
|
14
|
+
{
|
|
15
|
+
config: {
|
|
16
|
+
accountPath: "1'",
|
|
17
|
+
name: "DappArchivist",
|
|
18
|
+
dbName: "DappArchivist",
|
|
19
|
+
storeName: "payloads",
|
|
20
|
+
schema: "network.xyo.archivist.config",
|
|
21
|
+
labels: {
|
|
22
|
+
"network.xyo.archivist.persistence.scope": "device"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
schema: "network.xyo.manifest.package.dapp"
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// src/Params.ts
|
|
34
|
+
import { IndexedDbArchivist } from "@xyo-network/archivist-indexeddb";
|
|
35
|
+
import { ModuleFactoryLocator } from "@xyo-network/module-factory-locator";
|
|
36
|
+
|
|
37
|
+
// src/icon/Icon.tsx
|
|
38
|
+
var CustomDappIconSvg = `
|
|
39
|
+
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
|
|
40
|
+
<path
|
|
41
|
+
fill="transparent"
|
|
42
|
+
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"
|
|
43
|
+
/>
|
|
44
|
+
<path
|
|
45
|
+
fill="transparent"
|
|
46
|
+
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"
|
|
47
|
+
/>
|
|
48
|
+
<path
|
|
49
|
+
fill="transparent"
|
|
50
|
+
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"
|
|
51
|
+
/>
|
|
52
|
+
<path
|
|
53
|
+
fill="currentColor"
|
|
54
|
+
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"
|
|
55
|
+
/>
|
|
56
|
+
<path
|
|
57
|
+
fill="currentColor"
|
|
58
|
+
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"
|
|
59
|
+
/>
|
|
60
|
+
<path
|
|
61
|
+
fill="currentColor"
|
|
62
|
+
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"
|
|
63
|
+
/>
|
|
64
|
+
<path
|
|
65
|
+
fill="transparent"
|
|
66
|
+
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"
|
|
67
|
+
/>
|
|
68
|
+
<path
|
|
69
|
+
fill="transparent"
|
|
70
|
+
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"
|
|
71
|
+
/>
|
|
72
|
+
<path
|
|
73
|
+
fill="currentColor"
|
|
74
|
+
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"
|
|
75
|
+
/>
|
|
76
|
+
<path
|
|
77
|
+
fill="currentColor"
|
|
78
|
+
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"
|
|
79
|
+
/>
|
|
80
|
+
</svg>
|
|
81
|
+
`;
|
|
82
|
+
|
|
83
|
+
// src/Params.ts
|
|
84
|
+
var locator = new ModuleFactoryLocator();
|
|
85
|
+
locator.register(IndexedDbArchivist);
|
|
86
|
+
var CustomDappParams = {
|
|
87
|
+
iconSvg: CustomDappIconSvg,
|
|
88
|
+
locator
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// src/Payloads.ts
|
|
92
|
+
import {
|
|
93
|
+
DappConfigSchema,
|
|
94
|
+
DappIconSchema,
|
|
95
|
+
DappMode,
|
|
96
|
+
DappNavItemSchema,
|
|
97
|
+
DappNavMenuConfigSchema
|
|
98
|
+
} from "@xyo-network/os-model";
|
|
99
|
+
var CustomDappName = "Custom Dapp";
|
|
100
|
+
var version = "1.0.0";
|
|
101
|
+
var CustomDappConfig = {
|
|
102
|
+
manifest: dapp_manifest_default,
|
|
103
|
+
modes: [DappMode.Window],
|
|
104
|
+
name: CustomDappName,
|
|
105
|
+
schema: DappConfigSchema,
|
|
106
|
+
sources: ["network.xyo.dapp.accounts.source"],
|
|
107
|
+
version
|
|
108
|
+
};
|
|
109
|
+
var CustomDappIcon = {
|
|
110
|
+
active: false,
|
|
111
|
+
installed: "installed",
|
|
112
|
+
name: CustomDappName,
|
|
113
|
+
schema: DappIconSchema,
|
|
114
|
+
type: "system",
|
|
115
|
+
version
|
|
116
|
+
};
|
|
117
|
+
var DappPayloads = [CustomDappConfig, CustomDappIcon];
|
|
118
|
+
var CustomDappMenuItems = [
|
|
119
|
+
{
|
|
120
|
+
path: "home",
|
|
121
|
+
primaryText: "Home",
|
|
122
|
+
schema: DappNavItemSchema,
|
|
123
|
+
svgIcon: `
|
|
124
|
+
<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>
|
|
125
|
+
`,
|
|
126
|
+
weight: 0
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
path: "settings",
|
|
130
|
+
primaryText: "Settings",
|
|
131
|
+
schema: DappNavItemSchema,
|
|
132
|
+
svgIcon: `
|
|
133
|
+
<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>
|
|
134
|
+
`,
|
|
135
|
+
weight: 0
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
var CustomDappMenuConfig = {
|
|
139
|
+
defaultPath: "home",
|
|
140
|
+
schema: DappNavMenuConfigSchema
|
|
141
|
+
};
|
|
142
|
+
var CustomDappMenuPayloads = [...CustomDappMenuItems, CustomDappMenuConfig];
|
|
143
|
+
|
|
144
|
+
// src/window/Dapp.tsx
|
|
145
|
+
import { DappPathSwitcher, useAddDappMenuItems } from "@xyo-network/os-react-runtime";
|
|
146
|
+
import { ErrorRender } from "@xyo-network/react-error";
|
|
147
|
+
|
|
148
|
+
// src/components/Dapp.tsx
|
|
149
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
|
150
|
+
import { jsx } from "react/jsx-runtime";
|
|
151
|
+
var CustomDappPathToComponent = [
|
|
152
|
+
{
|
|
153
|
+
component: /* @__PURE__ */ jsx(FlexRow, {}),
|
|
154
|
+
path: "home"
|
|
155
|
+
}
|
|
156
|
+
];
|
|
157
|
+
|
|
158
|
+
// src/window/Dapp.tsx
|
|
159
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
160
|
+
var CustomDapp = () => {
|
|
161
|
+
const {
|
|
162
|
+
menuConfig,
|
|
163
|
+
path,
|
|
164
|
+
error
|
|
165
|
+
} = useAddDappMenuItems(CustomDappMenuPayloads);
|
|
166
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
167
|
+
/* @__PURE__ */ jsx2(ErrorRender, { error, scope: "CustomDapp" }),
|
|
168
|
+
/* @__PURE__ */ jsx2(DappPathSwitcher, { activePath: path?.path ?? menuConfig?.defaultPath, pathToComponent: CustomDappPathToComponent })
|
|
169
|
+
] });
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// src/UiParams.ts
|
|
173
|
+
var CustomDappUiParams = {
|
|
174
|
+
...CustomDappParams,
|
|
175
|
+
modes: { window: { component: CustomDapp } }
|
|
176
|
+
};
|
|
177
|
+
export {
|
|
178
|
+
CustomDappConfig,
|
|
179
|
+
CustomDappIcon,
|
|
180
|
+
CustomDappMenuPayloads,
|
|
181
|
+
CustomDappName,
|
|
182
|
+
CustomDappParams,
|
|
183
|
+
CustomDappUiParams,
|
|
184
|
+
DappPayloads,
|
|
185
|
+
dapp_manifest_default as accountsDappManifest
|
|
186
|
+
};
|
|
187
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/dapp.manifest.json","../../src/Params.ts","../../src/icon/Icon.tsx","../../src/Payloads.ts","../../src/window/Dapp.tsx","../../src/components/Dapp.tsx","../../src/UiParams.ts"],"sourcesContent":["{\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\": \"Node\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": [\n {\n \"config\": {\n \"accountPath\": \"1'\",\n \"name\": \"DappArchivist\",\n \"dbName\": \"DappArchivist\",\n \"storeName\": \"payloads\",\n \"schema\": \"network.xyo.archivist.config\",\n \"labels\": {\n \"network.xyo.archivist.persistence.scope\": \"device\"\n }\n }\n }\n ]\n }\n }\n ],\n \"schema\": \"network.xyo.manifest.package.dapp\"\n}","import { IndexedDbArchivist } from '@xyo-network/archivist-indexeddb'\nimport { 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()\nlocator.register(IndexedDbArchivist)\n\nexport const CustomDappParams: UnregisteredDapp['params'] = {\n iconSvg: CustomDappIconSvg,\n locator,\n}\n\nexport { CustomDappParams as default }\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'\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 { DappPathSwitcher, useAddDappMenuItems } from '@xyo-network/os-react-runtime'\nimport { ErrorRender } from '@xyo-network/react-error'\nimport React from 'react'\n\nimport { CustomDappPathToComponent } from '../components/index.ts'\nimport { CustomDappMenuPayloads } from '../Payloads.js'\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 { CustomDappParams } from './Params.js'\nimport { CustomDapp } from './window/index.ts'\n\nexport const CustomDappUiParams: UnregisteredReactDapp['params'] = {\n ...CustomDappParams,\n modes: { window: { component: CustomDapp } },\n}\n\nexport { CustomDappUiParams as default }\n"],"mappings":";AAAA;AAAA,EACE,SAAW;AAAA,EACX,OAAS;AAAA,IACP;AAAA,MACE,QAAU;AAAA,QACR,aAAe;AAAA,QACf,MAAQ;AAAA,QACR,QAAU;AAAA,MACZ;AAAA,MACA,SAAW;AAAA,QACT,SAAW,CAAC;AAAA,QACZ,QAAU;AAAA,UACR;AAAA,YACE,QAAU;AAAA,cACR,aAAe;AAAA,cACf,MAAQ;AAAA,cACR,QAAU;AAAA,cACV,WAAa;AAAA,cACb,QAAU;AAAA,cACV,QAAU;AAAA,gBACR,2CAA2C;AAAA,cAC7C;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,QAAU;AACZ;;;AC7BA,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;;;ACA9B,IAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ADKjC,IAAM,UAAU,IAAI,qBAAqB;AACzC,QAAQ,SAAS,kBAAkB;AAE5B,IAAM,mBAA+C;AAAA,EAC1D,SAAS;AAAA,EACT;AACF;;;AEFA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIA,IAAM,iBAA2B;AAExC,IAAM,UAAuB;AAEtB,IAAM,mBAA+B;AAAA,EAC1C,UAAU;AAAA,EACV,OAAO,CAAC,SAAS,MAAM;AAAA,EACvB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS,CAAC,kCAAkC;AAAA,EAC5C;AACF;AAEO,IAAM,iBAA2B;AAAA,EACtC,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN;AACF;AAEO,IAAM,eAAe,CAAC,kBAAkB,cAAc;AAI7D,IAAM,sBAA8D;AAAA,EAClE;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,SAAS;AAAA;AAAA;AAAA,IAGT,QAAQ;AAAA,EACV;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,kBAAkB,2BAA2B;AACtD,SAAS,mBAAmB;;;ACD5B,SAAS,eAAe;AAMT;AAFR,IAAM,4BAA+C;AAAA,EAC1D;AAAA,IACE,WAAW,oBAAC,WAAQ;AAAA,IACpB,MAAM;AAAA,EACR;AACF;;;ADII,mBACE,OAAAA,MADF;AANG,IAAM,aAAa,MAAM;AAC9B,QAAM;AAAA,IACJ;AAAA,IAAY;AAAA,IAAM;AAAA,EACpB,IAAI,oBAAoB,sBAAsB;AAE9C,SACE,iCACE;AAAA,oBAAAA,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":["jsx"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dapp.d.ts","sourceRoot":"","sources":["../../../src/window/Dapp.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,UAAU,+CAWtB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/window/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xyo-network/dapp-template",
|
|
3
|
+
"version": "3.2.0",
|
|
4
|
+
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
|
+
"homepage": "https://xyo.network",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues",
|
|
8
|
+
"email": "support@xyo.network"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
|
|
13
|
+
},
|
|
14
|
+
"license": "LGPL-3.0-only",
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "XYO Development Team",
|
|
17
|
+
"email": "support@xyo.network",
|
|
18
|
+
"url": "https://xyo.network"
|
|
19
|
+
},
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"node": {
|
|
25
|
+
"types": "./dist/node/index.d.ts",
|
|
26
|
+
"default": "./dist/node/index.mjs"
|
|
27
|
+
},
|
|
28
|
+
"types": "./dist/neutral/index.d.ts",
|
|
29
|
+
"default": "./dist/neutral/index.mjs"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"module": "dist/neutral/index.mjs",
|
|
34
|
+
"types": "dist/neutral/index.d.ts",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@xylabs/react-flexbox": "^5.0.1",
|
|
37
|
+
"@xylabs/react-promise": "^5.0.1",
|
|
38
|
+
"@xyo-network/account": "^3.1.14",
|
|
39
|
+
"@xyo-network/archivist-indexeddb": "^3.1.14",
|
|
40
|
+
"@xyo-network/kernel": "^3.2.0",
|
|
41
|
+
"@xyo-network/kernel-model": "^3.2.0",
|
|
42
|
+
"@xyo-network/module-factory-locator": "^3.1.14",
|
|
43
|
+
"@xyo-network/object": "^3.1.14",
|
|
44
|
+
"@xyo-network/os-model": "^3.2.0",
|
|
45
|
+
"@xyo-network/os-react-model": "^2.3.0",
|
|
46
|
+
"@xyo-network/os-react-runtime": "^2.3.0",
|
|
47
|
+
"@xyo-network/os-runtime": "^3.2.0",
|
|
48
|
+
"@xyo-network/payload-model": "^3.1.14",
|
|
49
|
+
"@xyo-network/react-error": "^4.0.1",
|
|
50
|
+
"@xyo-network/react-node": "^4.0.1",
|
|
51
|
+
"@xyo-network/react-sdk": "^4.0.1",
|
|
52
|
+
"react-router-dom": "^6.26.2"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@mui/material": "^6.1.1",
|
|
56
|
+
"@mui/styles": "^6.1.1",
|
|
57
|
+
"@storybook/react": "^8.3.4",
|
|
58
|
+
"@types/react": "^18.3.10",
|
|
59
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.7",
|
|
60
|
+
"@xylabs/tsconfig": "^4.0.7",
|
|
61
|
+
"@xylabs/tsconfig-dom": "^4.0.7",
|
|
62
|
+
"@xylabs/tsconfig-react": "^4.0.7",
|
|
63
|
+
"eslint": "^9.11.1",
|
|
64
|
+
"react": "^18.3.1",
|
|
65
|
+
"react-dom": "^18.3.1",
|
|
66
|
+
"react-helmet": "^6.1.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"@mui/material": "^6.1.0",
|
|
70
|
+
"@mui/styles": "^6.1.1",
|
|
71
|
+
"react": "^18",
|
|
72
|
+
"react-dom": "^18.3.1",
|
|
73
|
+
"react-helmet": "^6.1.0"
|
|
74
|
+
},
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"react": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"publishConfig": {
|
|
81
|
+
"access": "public"
|
|
82
|
+
}
|
|
83
|
+
}
|
package/src/DappHost.tsx
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Typography } from '@mui/material'
|
|
2
|
+
import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
|
|
3
|
+
import { usePromise } from '@xylabs/react-promise'
|
|
4
|
+
import type { RegisteredReactDapp } from '@xyo-network/os-react-model'
|
|
5
|
+
import {
|
|
6
|
+
DappAccessFlexbox,
|
|
7
|
+
DappBar,
|
|
8
|
+
DappBottomNavigation,
|
|
9
|
+
DappChrome,
|
|
10
|
+
DappMenuDrawer,
|
|
11
|
+
useDappContextCreator,
|
|
12
|
+
useDappMenu,
|
|
13
|
+
useManageDappPathFromRoute, useXyOsUiContext,
|
|
14
|
+
XyOsUiContextProvider,
|
|
15
|
+
} from '@xyo-network/os-react-runtime'
|
|
16
|
+
import { DappSeedPhraseRepository, NameTransforms } from '@xyo-network/os-runtime'
|
|
17
|
+
import { NodeProvider } from '@xyo-network/react-node'
|
|
18
|
+
import { ErrorRender, WalletProvider } from '@xyo-network/react-sdk'
|
|
19
|
+
import React, {
|
|
20
|
+
useMemo, useState, version,
|
|
21
|
+
} from 'react'
|
|
22
|
+
|
|
23
|
+
import { XyOsHost } from './XyOsHost.tsx'
|
|
24
|
+
|
|
25
|
+
const allowedNames = ['Accounts']
|
|
26
|
+
|
|
27
|
+
export interface DappHostProps {
|
|
28
|
+
dapp: RegisteredReactDapp
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const DappPageHost: React.FC<DappHostProps> = ({ dapp }) => {
|
|
32
|
+
const xyOs = useXyOsUiContext()
|
|
33
|
+
const [walletId, setWalletId] = useState<string>()
|
|
34
|
+
const [dappWithWalletId, setDappWithWalletId] = useState<RegisteredReactDapp>(dapp)
|
|
35
|
+
|
|
36
|
+
// stub the walletId for the dapp
|
|
37
|
+
usePromise(async () => {
|
|
38
|
+
if (xyOs) {
|
|
39
|
+
const dappSeedPhraseRepository = new DappSeedPhraseRepository(xyOs, allowedNames)
|
|
40
|
+
const walletId = await dappSeedPhraseRepository.findOrCreate(allowedNames[0])
|
|
41
|
+
setWalletId(walletId)
|
|
42
|
+
setDappWithWalletId(dapp => ({
|
|
43
|
+
...dapp,
|
|
44
|
+
config: {
|
|
45
|
+
...dapp.config,
|
|
46
|
+
walletId,
|
|
47
|
+
},
|
|
48
|
+
}))
|
|
49
|
+
}
|
|
50
|
+
}, [xyOs])
|
|
51
|
+
|
|
52
|
+
const name = dapp?.config.name
|
|
53
|
+
const scrollable = true
|
|
54
|
+
|
|
55
|
+
// Create the dapp context
|
|
56
|
+
const {
|
|
57
|
+
dappWallet, context, nodeCreateError,
|
|
58
|
+
} = useDappContextCreator('', '', dappWithWalletId, allowedNames, !!walletId)
|
|
59
|
+
|
|
60
|
+
// support for routing
|
|
61
|
+
useManageDappPathFromRoute(context, dapp.config.name)
|
|
62
|
+
|
|
63
|
+
// Get the dapp component
|
|
64
|
+
const TypedDappComponent = useMemo(() => dapp?.params.modes?.window?.component as React.FC<{
|
|
65
|
+
name?: string
|
|
66
|
+
}>, [])
|
|
67
|
+
|
|
68
|
+
// Get the menu items
|
|
69
|
+
const {
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
71
|
+
activePath, error: menuError, menuConfig, menuItemsVisible, onPathChange,
|
|
72
|
+
} = useDappMenu(context, name)
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<FlexCol>
|
|
76
|
+
<FlexRow>
|
|
77
|
+
<Typography>
|
|
78
|
+
xyOs Booted:
|
|
79
|
+
{xyOs ? 'true' : 'false'}
|
|
80
|
+
</Typography>
|
|
81
|
+
</FlexRow>
|
|
82
|
+
<DappChrome
|
|
83
|
+
appBar={(
|
|
84
|
+
<>
|
|
85
|
+
{/* Keep DappBar outside of the Dapp's Node Provider so it can still see the intentArchivist for close and minimize */}
|
|
86
|
+
<DappBar context={context} name={name} version={version} title={activePath ? new NameTransforms(activePath).deSlug() : ''} />
|
|
87
|
+
</>
|
|
88
|
+
)}
|
|
89
|
+
height="100dvh"
|
|
90
|
+
width="100dvw"
|
|
91
|
+
largeScreenMenu={(
|
|
92
|
+
<DappMenuDrawer
|
|
93
|
+
context={context}
|
|
94
|
+
name={name}
|
|
95
|
+
version={version}
|
|
96
|
+
activePath={activePath}
|
|
97
|
+
onPathChange={onPathChange}
|
|
98
|
+
menuConfig={menuConfig}
|
|
99
|
+
menuItems={menuItemsVisible}
|
|
100
|
+
/>
|
|
101
|
+
)}
|
|
102
|
+
smallScreenMenu={(
|
|
103
|
+
<DappBottomNavigation
|
|
104
|
+
activePath={activePath}
|
|
105
|
+
onPathChange={onPathChange}
|
|
106
|
+
menuConfig={menuConfig}
|
|
107
|
+
menuItems={menuItemsVisible}
|
|
108
|
+
sx={{ display: menuConfig ? 'flex' : 'none' }}
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
111
|
+
>
|
|
112
|
+
<ErrorRender error={nodeCreateError} scope="Accounts Stories" />
|
|
113
|
+
<WalletProvider rootWallet={dappWallet}>
|
|
114
|
+
<XyOsUiContextProvider value={context === null ? undefined : context}>
|
|
115
|
+
{/* Prevent dapps from reaching out to the os node */}
|
|
116
|
+
<NodeProvider node={context?.root}>
|
|
117
|
+
<FlexCol
|
|
118
|
+
alignItems="stretch"
|
|
119
|
+
justifyContent="stretch"
|
|
120
|
+
position="absolute"
|
|
121
|
+
top={0}
|
|
122
|
+
bottom={0}
|
|
123
|
+
left={0}
|
|
124
|
+
right={0}
|
|
125
|
+
sx={{ overflowY: scrollable ? 'auto' : 'hidden' }}
|
|
126
|
+
>
|
|
127
|
+
<TypedDappComponent name="Accounts" />
|
|
128
|
+
</FlexCol>
|
|
129
|
+
<DappAccessFlexbox context={context} />
|
|
130
|
+
|
|
131
|
+
</NodeProvider>
|
|
132
|
+
</XyOsUiContextProvider>
|
|
133
|
+
</WalletProvider>
|
|
134
|
+
</DappChrome>
|
|
135
|
+
</FlexCol>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export const DappHost: React.FC<DappHostProps> = ({ dapp }) => {
|
|
140
|
+
return (
|
|
141
|
+
<XyOsHost>
|
|
142
|
+
<DappPageHost dapp={dapp} />
|
|
143
|
+
</XyOsHost>
|
|
144
|
+
)
|
|
145
|
+
}
|
package/src/Params.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IndexedDbArchivist } from '@xyo-network/archivist-indexeddb'
|
|
2
|
+
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
3
|
+
import type { UnregisteredDapp } from '@xyo-network/os-model'
|
|
4
|
+
|
|
5
|
+
import { CustomDappIconSvg } from './icon/index.ts'
|
|
6
|
+
|
|
7
|
+
const locator = new ModuleFactoryLocator()
|
|
8
|
+
locator.register(IndexedDbArchivist)
|
|
9
|
+
|
|
10
|
+
export const CustomDappParams: UnregisteredDapp['params'] = {
|
|
11
|
+
iconSvg: CustomDappIconSvg,
|
|
12
|
+
locator,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { CustomDappParams as default }
|
package/src/Payloads.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* eslint-disable @stylistic/max-len */
|
|
2
|
+
import type {
|
|
3
|
+
DappConfig,
|
|
4
|
+
DappIcon,
|
|
5
|
+
DappName,
|
|
6
|
+
DappNavItem,
|
|
7
|
+
DappNavMenuConfig,
|
|
8
|
+
DappPackageManifestPayload,
|
|
9
|
+
DappVersion,
|
|
10
|
+
} from '@xyo-network/os-model'
|
|
11
|
+
import {
|
|
12
|
+
DappConfigSchema,
|
|
13
|
+
DappIconSchema,
|
|
14
|
+
DappMode,
|
|
15
|
+
DappNavItemSchema,
|
|
16
|
+
DappNavMenuConfigSchema,
|
|
17
|
+
} from '@xyo-network/os-model'
|
|
18
|
+
|
|
19
|
+
import dappManifest from './dapp.manifest.json'
|
|
20
|
+
|
|
21
|
+
export const CustomDappName: DappName = 'Custom Dapp' as const
|
|
22
|
+
|
|
23
|
+
const version: DappVersion = '1.0.0'
|
|
24
|
+
|
|
25
|
+
export const CustomDappConfig: DappConfig = {
|
|
26
|
+
manifest: dappManifest as DappPackageManifestPayload,
|
|
27
|
+
modes: [DappMode.Window],
|
|
28
|
+
name: CustomDappName,
|
|
29
|
+
schema: DappConfigSchema,
|
|
30
|
+
sources: ['network.xyo.dapp.accounts.source'],
|
|
31
|
+
version,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const CustomDappIcon: DappIcon = {
|
|
35
|
+
active: false,
|
|
36
|
+
installed: 'installed',
|
|
37
|
+
name: CustomDappName,
|
|
38
|
+
schema: DappIconSchema,
|
|
39
|
+
type: 'system',
|
|
40
|
+
version,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const DappPayloads = [CustomDappConfig, CustomDappIcon]
|
|
44
|
+
|
|
45
|
+
export type CustomDappMenuItemPaths = 'home' | 'settings'
|
|
46
|
+
|
|
47
|
+
const CustomDappMenuItems: DappNavItem<CustomDappMenuItemPaths>[] = [
|
|
48
|
+
{
|
|
49
|
+
path: 'home',
|
|
50
|
+
primaryText: 'Home',
|
|
51
|
+
schema: DappNavItemSchema,
|
|
52
|
+
svgIcon: `
|
|
53
|
+
<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>
|
|
54
|
+
`,
|
|
55
|
+
weight: 0,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
path: 'settings',
|
|
59
|
+
primaryText: 'Settings',
|
|
60
|
+
schema: DappNavItemSchema,
|
|
61
|
+
svgIcon: `
|
|
62
|
+
<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>
|
|
63
|
+
`,
|
|
64
|
+
weight: 0,
|
|
65
|
+
},
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
const CustomDappMenuConfig: DappNavMenuConfig = {
|
|
69
|
+
defaultPath: 'home',
|
|
70
|
+
schema: DappNavMenuConfigSchema,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const CustomDappMenuPayloads = [...CustomDappMenuItems, CustomDappMenuConfig]
|
package/src/ReactDapp.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JsonObject } from '@xyo-network/object'
|
|
2
|
+
import type { DappParams } from '@xyo-network/os-model'
|
|
3
|
+
import type { DappReactParams } from '@xyo-network/os-react-model'
|
|
4
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
5
|
+
export * from './UiParams.js'
|
|
6
|
+
|
|
7
|
+
export interface Dapp<TParams extends DappParams> {
|
|
8
|
+
manifest: JsonObject
|
|
9
|
+
params: TParams
|
|
10
|
+
payloads: Payload[]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ReactDapp extends Dapp<DappReactParams> {}
|