@xyo-network/react-diviner 7.5.8 → 7.5.11
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/browser/index.mjs +14 -35
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +97 -19
- package/src/hooks/index.ts +0 -1
- package/src/hooks/node/index.ts +0 -4
- package/src/hooks/node/useDivinerFromNode.tsx +0 -19
- package/src/hooks/node/useDivinersFromNode.tsx +0 -28
- package/src/hooks/node/useWeakDivinerFromNode.tsx +0 -11
- package/src/hooks/node/useWeakDivinersFromNode.tsx +0 -27
- package/src/index.ts +0 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -1,36 +1,24 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/hooks/node/useDivinerFromNode.tsx
|
|
5
2
|
import { asDivinerInstance } from "@xyo-network/diviner-model";
|
|
6
3
|
import { useModuleFromNode } from "@xyo-network/react-node";
|
|
7
|
-
var useDivinerFromNode =
|
|
4
|
+
var useDivinerFromNode = (nameOrAddressOrInstance, config) => {
|
|
8
5
|
const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config);
|
|
9
6
|
const instance = asDivinerInstance(mod);
|
|
10
7
|
if (mod && !instance) {
|
|
11
8
|
const error2 = new Error(`Resolved module is not a DivinerInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`);
|
|
12
9
|
console.error(error2.message);
|
|
13
|
-
return [
|
|
14
|
-
void 0,
|
|
15
|
-
error2
|
|
16
|
-
];
|
|
10
|
+
return [void 0, error2];
|
|
17
11
|
}
|
|
18
|
-
return [
|
|
19
|
-
|
|
20
|
-
error
|
|
21
|
-
];
|
|
22
|
-
}, "useDivinerFromNode");
|
|
12
|
+
return [instance, error];
|
|
13
|
+
};
|
|
23
14
|
|
|
24
15
|
// src/hooks/node/useDivinersFromNode.tsx
|
|
25
16
|
import { isDivinerInstance } from "@xyo-network/diviner-model";
|
|
26
17
|
import { useModulesFromNode } from "@xyo-network/react-node";
|
|
27
|
-
var useDivinersFromNode =
|
|
18
|
+
var useDivinersFromNode = (ids, config) => {
|
|
28
19
|
const [modules, error] = useModulesFromNode(ids, config);
|
|
29
20
|
if (error) {
|
|
30
|
-
return [
|
|
31
|
-
null,
|
|
32
|
-
error
|
|
33
|
-
];
|
|
21
|
+
return [null, error];
|
|
34
22
|
}
|
|
35
23
|
return modules ? [
|
|
36
24
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
@@ -41,33 +29,24 @@ var useDivinersFromNode = /* @__PURE__ */ __name((ids, config) => {
|
|
|
41
29
|
return prev;
|
|
42
30
|
}, []),
|
|
43
31
|
void 0
|
|
44
|
-
] : [
|
|
45
|
-
|
|
46
|
-
error
|
|
47
|
-
];
|
|
48
|
-
}, "useDivinersFromNode");
|
|
32
|
+
] : [modules, error];
|
|
33
|
+
};
|
|
49
34
|
|
|
50
35
|
// src/hooks/node/useWeakDivinerFromNode.tsx
|
|
51
36
|
import { isDivinerInstance as isDivinerInstance2 } from "@xyo-network/diviner-model";
|
|
52
37
|
import { useWeakModuleFromNode } from "@xyo-network/react-node";
|
|
53
|
-
var useWeakDivinerFromNode =
|
|
54
|
-
return useWeakModuleFromNode(nameOrAddressOrInstance, {
|
|
55
|
-
|
|
56
|
-
...config
|
|
57
|
-
});
|
|
58
|
-
}, "useWeakDivinerFromNode");
|
|
38
|
+
var useWeakDivinerFromNode = (nameOrAddressOrInstance, config) => {
|
|
39
|
+
return useWeakModuleFromNode(nameOrAddressOrInstance, { identity: isDivinerInstance2, ...config });
|
|
40
|
+
};
|
|
59
41
|
|
|
60
42
|
// src/hooks/node/useWeakDivinersFromNode.tsx
|
|
61
43
|
import { exists } from "@xylabs/sdk-js";
|
|
62
44
|
import { asDivinerInstance as asDivinerInstance2 } from "@xyo-network/diviner-model";
|
|
63
45
|
import { useWeakModulesFromNode } from "@xyo-network/react-node";
|
|
64
|
-
var useWeakDivinersFromNode =
|
|
46
|
+
var useWeakDivinersFromNode = (ids, config) => {
|
|
65
47
|
const [modules, error] = useWeakModulesFromNode(ids, config);
|
|
66
48
|
if (error) {
|
|
67
|
-
return [
|
|
68
|
-
null,
|
|
69
|
-
error
|
|
70
|
-
];
|
|
49
|
+
return [null, error];
|
|
71
50
|
}
|
|
72
51
|
return [
|
|
73
52
|
modules?.map((mod) => {
|
|
@@ -78,7 +57,7 @@ var useWeakDivinersFromNode = /* @__PURE__ */ __name((ids, config) => {
|
|
|
78
57
|
}).filter(exists) ?? [],
|
|
79
58
|
void 0
|
|
80
59
|
];
|
|
81
|
-
}
|
|
60
|
+
};
|
|
82
61
|
export {
|
|
83
62
|
useDivinerFromNode,
|
|
84
63
|
useDivinersFromNode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/node/useDivinerFromNode.tsx","../../src/hooks/node/useDivinersFromNode.tsx","../../src/hooks/node/useWeakDivinerFromNode.tsx","../../src/hooks/node/useWeakDivinersFromNode.tsx"],"sourcesContent":["import type { DivinerInstance } from '@xyo-network/diviner-model'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useModuleFromNode } from '@xyo-network/react-node'\n\n/** @deprecated use useWeakDivinerFromNode */\nexport const useDivinerFromNode = (\n nameOrAddressOrInstance?: string | DivinerInstance,\n config?: ModuleFromNodeConfig,\n): [DivinerInstance | undefined, Error | undefined] => {\n const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asDivinerInstance(mod)\n if (mod && !instance) {\n const error = new Error(`Resolved module is not a DivinerInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import type { DivinerInstance } from '@xyo-network/diviner-model'\nimport { isDivinerInstance } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useModulesFromNode } from '@xyo-network/react-node'\n\n/** @deprecated use useWeakDivinersFromNode */\nexport const useDivinersFromNode = (\n ids?: ModuleIdentifier[],\n config?: ModuleFromNodeConfig,\n): [DivinerInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(ids, config)\n if (error) {\n return [null, error]\n }\n return modules\n ? [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<DivinerInstance[]>((prev, mod) => {\n if (isDivinerInstance(mod)) {\n prev.push(mod)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import type { DivinerInstance } from '@xyo-network/diviner-model'\nimport { isDivinerInstance } from '@xyo-network/diviner-model'\nimport type { WeakModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useWeakModuleFromNode } from '@xyo-network/react-node'\n\nexport const useWeakDivinerFromNode = (\n nameOrAddressOrInstance?: string | DivinerInstance,\n config?: WeakModuleFromNodeConfig,\n): [WeakRef<DivinerInstance> | undefined, Error | undefined] => {\n return useWeakModuleFromNode<DivinerInstance>(nameOrAddressOrInstance, { identity: isDivinerInstance, ...config })\n}\n","import { exists } from '@xylabs/sdk-js'\nimport type { DivinerInstance } from '@xyo-network/diviner-model'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useWeakModulesFromNode } from '@xyo-network/react-node'\n\nexport const useWeakDivinersFromNode = (\n ids?: ModuleIdentifier[],\n config?: ModuleFromNodeConfig,\n): [WeakRef<DivinerInstance>[] | null | undefined, Error | undefined] => {\n const [modules, error] = useWeakModulesFromNode(ids, config)\n if (error) {\n return [null, error]\n }\n return [\n modules\n ?.map((mod) => {\n const instance = asDivinerInstance(mod?.deref())\n if (instance) {\n return new WeakRef(instance)\n }\n })\n .filter(exists) ?? [],\n undefined,\n ]\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/node/useDivinerFromNode.tsx","../../src/hooks/node/useDivinersFromNode.tsx","../../src/hooks/node/useWeakDivinerFromNode.tsx","../../src/hooks/node/useWeakDivinersFromNode.tsx"],"sourcesContent":["import type { DivinerInstance } from '@xyo-network/diviner-model'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useModuleFromNode } from '@xyo-network/react-node'\n\n/** @deprecated use useWeakDivinerFromNode */\nexport const useDivinerFromNode = (\n nameOrAddressOrInstance?: string | DivinerInstance,\n config?: ModuleFromNodeConfig,\n): [DivinerInstance | undefined, Error | undefined] => {\n const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config)\n const instance = asDivinerInstance(mod)\n if (mod && !instance) {\n const error = new Error(`Resolved module is not a DivinerInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`)\n console.error(error.message)\n return [undefined, error]\n }\n return [instance, error]\n}\n","import type { DivinerInstance } from '@xyo-network/diviner-model'\nimport { isDivinerInstance } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useModulesFromNode } from '@xyo-network/react-node'\n\n/** @deprecated use useWeakDivinersFromNode */\nexport const useDivinersFromNode = (\n ids?: ModuleIdentifier[],\n config?: ModuleFromNodeConfig,\n): [DivinerInstance[] | null | undefined, Error | undefined] => {\n const [modules, error] = useModulesFromNode(ids, config)\n if (error) {\n return [null, error]\n }\n return modules\n ? [\n // eslint-disable-next-line unicorn/no-array-reduce\n modules.reduce<DivinerInstance[]>((prev, mod) => {\n if (isDivinerInstance(mod)) {\n prev.push(mod)\n }\n return prev\n }, []),\n undefined,\n ]\n : [modules, error]\n}\n","import type { DivinerInstance } from '@xyo-network/diviner-model'\nimport { isDivinerInstance } from '@xyo-network/diviner-model'\nimport type { WeakModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useWeakModuleFromNode } from '@xyo-network/react-node'\n\nexport const useWeakDivinerFromNode = (\n nameOrAddressOrInstance?: string | DivinerInstance,\n config?: WeakModuleFromNodeConfig,\n): [WeakRef<DivinerInstance> | undefined, Error | undefined] => {\n return useWeakModuleFromNode<DivinerInstance>(nameOrAddressOrInstance, { identity: isDivinerInstance, ...config })\n}\n","import { exists } from '@xylabs/sdk-js'\nimport type { DivinerInstance } from '@xyo-network/diviner-model'\nimport { asDivinerInstance } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport type { ModuleFromNodeConfig } from '@xyo-network/react-node'\nimport { useWeakModulesFromNode } from '@xyo-network/react-node'\n\nexport const useWeakDivinersFromNode = (\n ids?: ModuleIdentifier[],\n config?: ModuleFromNodeConfig,\n): [WeakRef<DivinerInstance>[] | null | undefined, Error | undefined] => {\n const [modules, error] = useWeakModulesFromNode(ids, config)\n if (error) {\n return [null, error]\n }\n return [\n modules\n ?.map((mod) => {\n const instance = asDivinerInstance(mod?.deref())\n if (instance) {\n return new WeakRef(instance)\n }\n })\n .filter(exists) ?? [],\n undefined,\n ]\n}\n"],"mappings":";AACA,SAAS,yBAAyB;AAElC,SAAS,yBAAyB;AAG3B,IAAM,qBAAqB,CAChC,yBACA,WACqD;AACrD,QAAM,CAAC,KAAK,KAAK,IAAI,kBAAkB,yBAAyB,MAAM;AACtE,QAAM,WAAW,kBAAkB,GAAG;AACtC,MAAI,OAAO,CAAC,UAAU;AACpB,UAAMA,SAAQ,IAAI,MAAM,6CAA6C,IAAI,QAAQ,MAAM,IAAI,IAAI,QAAQ,IAAI,IAAI,IAAI,OAAO,GAAG;AAC7H,YAAQ,MAAMA,OAAM,OAAO;AAC3B,WAAO,CAAC,QAAWA,MAAK;AAAA,EAC1B;AACA,SAAO,CAAC,UAAU,KAAK;AACzB;;;ACjBA,SAAS,yBAAyB;AAGlC,SAAS,0BAA0B;AAG5B,IAAM,sBAAsB,CACjC,KACA,WAC8D;AAC9D,QAAM,CAAC,SAAS,KAAK,IAAI,mBAAmB,KAAK,MAAM;AACvD,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO,UACH;AAAA;AAAA,IAEE,QAAQ,OAA0B,CAAC,MAAM,QAAQ;AAC/C,UAAI,kBAAkB,GAAG,GAAG;AAC1B,aAAK,KAAK,GAAG;AAAA,MACf;AACA,aAAO;AAAA,IACT,GAAG,CAAC,CAAC;AAAA,IACL;AAAA,EACF,IACA,CAAC,SAAS,KAAK;AACrB;;;AC1BA,SAAS,qBAAAC,0BAAyB;AAElC,SAAS,6BAA6B;AAE/B,IAAM,yBAAyB,CACpC,yBACA,WAC8D;AAC9D,SAAO,sBAAuC,yBAAyB,EAAE,UAAUA,oBAAmB,GAAG,OAAO,CAAC;AACnH;;;ACVA,SAAS,cAAc;AAEvB,SAAS,qBAAAC,0BAAyB;AAGlC,SAAS,8BAA8B;AAEhC,IAAM,0BAA0B,CACrC,KACA,WACuE;AACvE,QAAM,CAAC,SAAS,KAAK,IAAI,uBAAuB,KAAK,MAAM;AAC3D,MAAI,OAAO;AACT,WAAO,CAAC,MAAM,KAAK;AAAA,EACrB;AACA,SAAO;AAAA,IACL,SACI,IAAI,CAAC,QAAQ;AACb,YAAM,WAAWA,mBAAkB,KAAK,MAAM,CAAC;AAC/C,UAAI,UAAU;AACZ,eAAO,IAAI,QAAQ,QAAQ;AAAA,MAC7B;AAAA,IACF,CAAC,EACA,OAAO,MAAM,KAAK,CAAC;AAAA,IACtB;AAAA,EACF;AACF;","names":["error","isDivinerInstance","asDivinerInstance"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-diviner",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.11",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -36,36 +36,114 @@
|
|
|
36
36
|
},
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
|
-
"module": "dist/browser/index.mjs",
|
|
40
|
-
"types": "dist/browser/index.d.ts",
|
|
41
39
|
"files": [
|
|
42
40
|
"dist",
|
|
43
|
-
"
|
|
41
|
+
"README.md"
|
|
44
42
|
],
|
|
45
43
|
"dependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@xyo-network/diviner-model": "~5.3.17",
|
|
48
|
-
"@xyo-network/module-model": "~5.3.17",
|
|
49
|
-
"@xyo-network/react-node": "7.5.8"
|
|
44
|
+
"@xyo-network/react-node": "~7.5.11"
|
|
50
45
|
},
|
|
51
46
|
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
47
|
+
"@bitauth/libauth": "~3.0.0",
|
|
48
|
+
"@emotion/react": "^11.14.0",
|
|
49
|
+
"@mui/icons-material": "^7.3.10",
|
|
50
|
+
"@mui/material": "^7.3.10",
|
|
51
|
+
"@mui/system": "^7.3.10",
|
|
52
|
+
"@mui/x-tree-view": "~8.27.2",
|
|
53
|
+
"@opentelemetry/api": "^1.9.1",
|
|
54
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
55
|
+
"@scure/base": "~2.2.0",
|
|
56
|
+
"@types/node": "~25.6.0",
|
|
57
|
+
"@types/react": "^19.2.14",
|
|
58
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
59
|
+
"@xylabs/react-flexbox": "~7.1.20",
|
|
60
|
+
"@xylabs/react-promise": "~7.1.20",
|
|
61
|
+
"@xylabs/react-shared": "~7.1.20",
|
|
62
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
63
|
+
"@xylabs/threads": "~5.0.100",
|
|
64
|
+
"@xylabs/toolchain": "~7.11.9",
|
|
65
|
+
"@xylabs/tsconfig": "^7.11.9",
|
|
66
|
+
"@xylabs/tsconfig-dom": "^7.11.9",
|
|
67
|
+
"@xylabs/tsconfig-react": "~7.11.9",
|
|
68
|
+
"@xyo-network/account": "~5.5.1",
|
|
69
|
+
"@xyo-network/account-model": "^5.5.1",
|
|
70
|
+
"@xyo-network/boundwitness-builder": "^5.5.1",
|
|
71
|
+
"@xyo-network/boundwitness-model": "^5.5.1",
|
|
72
|
+
"@xyo-network/boundwitness-validator": "^5.5.1",
|
|
73
|
+
"@xyo-network/boundwitness-wrapper": "~5.5.1",
|
|
74
|
+
"@xyo-network/config-payload-plugin": "~5.5.1",
|
|
75
|
+
"@xyo-network/diviner-model": "^5.5.5",
|
|
76
|
+
"@xyo-network/manifest-model": "~5.5.1",
|
|
77
|
+
"@xyo-network/module-abstract": "^5.5.5",
|
|
78
|
+
"@xyo-network/module-model": "^5.5.5",
|
|
79
|
+
"@xyo-network/node-memory": "~5.5.5",
|
|
80
|
+
"@xyo-network/node-model": "^5.5.5",
|
|
81
|
+
"@xyo-network/payload-builder": "^5.5.1",
|
|
82
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
83
|
+
"@xyo-network/query-payload-plugin": "~5.5.1",
|
|
84
|
+
"@xyo-network/wallet-model": "^5.5.1",
|
|
85
|
+
"async-mutex": "^0.5.0",
|
|
86
|
+
"axios": "^1.15.2",
|
|
87
|
+
"bn.js": "^5.2.3",
|
|
88
|
+
"buffer": "^6.0.3",
|
|
89
|
+
"chalk": "^5.6.2",
|
|
90
|
+
"debug": "~4.4.3",
|
|
91
|
+
"esbuild": "~0.28.0",
|
|
92
|
+
"eslint": "^10.2.1",
|
|
93
|
+
"ethers": "^6.16.0",
|
|
94
|
+
"hash-wasm": "~4.12.0",
|
|
95
|
+
"lru-cache": "^11.3.5",
|
|
96
|
+
"observable-fns": "~0.6.1",
|
|
97
|
+
"pako": "^2.1.0",
|
|
98
|
+
"react": "^19.2.5",
|
|
99
|
+
"react-dom": "^19.2.5",
|
|
57
100
|
"typescript": "^5.9.3",
|
|
101
|
+
"wasm-feature-detect": "~1.8.0",
|
|
58
102
|
"zod": "^4.3.6"
|
|
59
103
|
},
|
|
60
104
|
"peerDependencies": {
|
|
61
|
-
"@
|
|
62
|
-
"@mui/material": "
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
105
|
+
"@emotion/react": "^11.14.0",
|
|
106
|
+
"@mui/icons-material": "^7.3.10",
|
|
107
|
+
"@mui/material": "^7.3.10",
|
|
108
|
+
"@mui/system": "^7.3.10",
|
|
109
|
+
"@mui/x-tree-view": "~8.27.2",
|
|
110
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
111
|
+
"@scure/base": "~2.2.0",
|
|
112
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
113
|
+
"@xylabs/react-flexbox": "~7.1.20",
|
|
114
|
+
"@xylabs/react-promise": "~7.1.20",
|
|
115
|
+
"@xylabs/react-shared": "~7.1.20",
|
|
116
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
117
|
+
"@xyo-network/account": "~5.5.1",
|
|
118
|
+
"@xyo-network/account-model": "^5.5.1",
|
|
119
|
+
"@xyo-network/boundwitness-builder": "^5.5.1",
|
|
120
|
+
"@xyo-network/boundwitness-model": "^5.5.1",
|
|
121
|
+
"@xyo-network/boundwitness-validator": "^5.5.1",
|
|
122
|
+
"@xyo-network/boundwitness-wrapper": "~5.5.1",
|
|
123
|
+
"@xyo-network/config-payload-plugin": "~5.5.1",
|
|
124
|
+
"@xyo-network/diviner-model": "^5.5.5",
|
|
125
|
+
"@xyo-network/manifest-model": "~5.5.1",
|
|
126
|
+
"@xyo-network/module-abstract": "^5.5.5",
|
|
127
|
+
"@xyo-network/module-model": "^5.5.5",
|
|
128
|
+
"@xyo-network/node-memory": "~5.5.5",
|
|
129
|
+
"@xyo-network/node-model": "^5.5.5",
|
|
130
|
+
"@xyo-network/payload-builder": "^5.5.1",
|
|
131
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
132
|
+
"@xyo-network/query-payload-plugin": "~5.5.1",
|
|
133
|
+
"@xyo-network/wallet-model": "^5.5.1",
|
|
134
|
+
"async-mutex": "^0.5.0",
|
|
135
|
+
"bn.js": "^5.2.3",
|
|
136
|
+
"buffer": "^6.0.3",
|
|
137
|
+
"chalk": "^5.6.2",
|
|
138
|
+
"ethers": "^6.16.0",
|
|
139
|
+
"lru-cache": "^11.3.5",
|
|
140
|
+
"pako": "^2.1.0",
|
|
141
|
+
"react": "^19.2.5",
|
|
142
|
+
"react-dom": "^19.2.5",
|
|
143
|
+
"zod": "^4.3.6"
|
|
66
144
|
},
|
|
67
145
|
"publishConfig": {
|
|
68
146
|
"access": "public"
|
|
69
147
|
},
|
|
70
148
|
"docs": "dist/docs.json"
|
|
71
|
-
}
|
|
149
|
+
}
|
package/src/hooks/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './node/index.ts'
|
package/src/hooks/node/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { DivinerInstance } from '@xyo-network/diviner-model'
|
|
2
|
-
import { asDivinerInstance } from '@xyo-network/diviner-model'
|
|
3
|
-
import type { ModuleFromNodeConfig } from '@xyo-network/react-node'
|
|
4
|
-
import { useModuleFromNode } from '@xyo-network/react-node'
|
|
5
|
-
|
|
6
|
-
/** @deprecated use useWeakDivinerFromNode */
|
|
7
|
-
export const useDivinerFromNode = (
|
|
8
|
-
nameOrAddressOrInstance?: string | DivinerInstance,
|
|
9
|
-
config?: ModuleFromNodeConfig,
|
|
10
|
-
): [DivinerInstance | undefined, Error | undefined] => {
|
|
11
|
-
const [mod, error] = useModuleFromNode(nameOrAddressOrInstance, config)
|
|
12
|
-
const instance = asDivinerInstance(mod)
|
|
13
|
-
if (mod && !instance) {
|
|
14
|
-
const error = new Error(`Resolved module is not a DivinerInstance [${mod.config?.schema}:${mod.config?.name}:${mod.address}]`)
|
|
15
|
-
console.error(error.message)
|
|
16
|
-
return [undefined, error]
|
|
17
|
-
}
|
|
18
|
-
return [instance, error]
|
|
19
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { DivinerInstance } from '@xyo-network/diviner-model'
|
|
2
|
-
import { isDivinerInstance } from '@xyo-network/diviner-model'
|
|
3
|
-
import type { ModuleIdentifier } from '@xyo-network/module-model'
|
|
4
|
-
import type { ModuleFromNodeConfig } from '@xyo-network/react-node'
|
|
5
|
-
import { useModulesFromNode } from '@xyo-network/react-node'
|
|
6
|
-
|
|
7
|
-
/** @deprecated use useWeakDivinersFromNode */
|
|
8
|
-
export const useDivinersFromNode = (
|
|
9
|
-
ids?: ModuleIdentifier[],
|
|
10
|
-
config?: ModuleFromNodeConfig,
|
|
11
|
-
): [DivinerInstance[] | null | undefined, Error | undefined] => {
|
|
12
|
-
const [modules, error] = useModulesFromNode(ids, config)
|
|
13
|
-
if (error) {
|
|
14
|
-
return [null, error]
|
|
15
|
-
}
|
|
16
|
-
return modules
|
|
17
|
-
? [
|
|
18
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
19
|
-
modules.reduce<DivinerInstance[]>((prev, mod) => {
|
|
20
|
-
if (isDivinerInstance(mod)) {
|
|
21
|
-
prev.push(mod)
|
|
22
|
-
}
|
|
23
|
-
return prev
|
|
24
|
-
}, []),
|
|
25
|
-
undefined,
|
|
26
|
-
]
|
|
27
|
-
: [modules, error]
|
|
28
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DivinerInstance } from '@xyo-network/diviner-model'
|
|
2
|
-
import { isDivinerInstance } from '@xyo-network/diviner-model'
|
|
3
|
-
import type { WeakModuleFromNodeConfig } from '@xyo-network/react-node'
|
|
4
|
-
import { useWeakModuleFromNode } from '@xyo-network/react-node'
|
|
5
|
-
|
|
6
|
-
export const useWeakDivinerFromNode = (
|
|
7
|
-
nameOrAddressOrInstance?: string | DivinerInstance,
|
|
8
|
-
config?: WeakModuleFromNodeConfig,
|
|
9
|
-
): [WeakRef<DivinerInstance> | undefined, Error | undefined] => {
|
|
10
|
-
return useWeakModuleFromNode<DivinerInstance>(nameOrAddressOrInstance, { identity: isDivinerInstance, ...config })
|
|
11
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { exists } from '@xylabs/sdk-js'
|
|
2
|
-
import type { DivinerInstance } from '@xyo-network/diviner-model'
|
|
3
|
-
import { asDivinerInstance } from '@xyo-network/diviner-model'
|
|
4
|
-
import type { ModuleIdentifier } from '@xyo-network/module-model'
|
|
5
|
-
import type { ModuleFromNodeConfig } from '@xyo-network/react-node'
|
|
6
|
-
import { useWeakModulesFromNode } from '@xyo-network/react-node'
|
|
7
|
-
|
|
8
|
-
export const useWeakDivinersFromNode = (
|
|
9
|
-
ids?: ModuleIdentifier[],
|
|
10
|
-
config?: ModuleFromNodeConfig,
|
|
11
|
-
): [WeakRef<DivinerInstance>[] | null | undefined, Error | undefined] => {
|
|
12
|
-
const [modules, error] = useWeakModulesFromNode(ids, config)
|
|
13
|
-
if (error) {
|
|
14
|
-
return [null, error]
|
|
15
|
-
}
|
|
16
|
-
return [
|
|
17
|
-
modules
|
|
18
|
-
?.map((mod) => {
|
|
19
|
-
const instance = asDivinerInstance(mod?.deref())
|
|
20
|
-
if (instance) {
|
|
21
|
-
return new WeakRef(instance)
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
.filter(exists) ?? [],
|
|
25
|
-
undefined,
|
|
26
|
-
]
|
|
27
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './hooks/index.ts'
|