@xyo-network/react-debug 7.5.8 → 7.5.12
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/hooks/useDebugBoundWitness.d.ts +6 -6
- package/dist/browser/hooks/useDebugPayload.d.ts +2 -2
- package/dist/browser/index.mjs +76 -106
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +97 -28
- package/src/components/BoundWitnessDebugger.stories.tsx +0 -26
- package/src/components/BoundWitnessDebugger.tsx +0 -40
- package/src/components/PayloadDebugger.stories.tsx +0 -13
- package/src/components/PayloadDebugger.tsx +0 -37
- package/src/components/index.ts +0 -3
- package/src/components/shared/Chips.tsx +0 -20
- package/src/components/shared/JsonPayloadLikeViewerEx.tsx +0 -17
- package/src/components/shared/index.ts +0 -2
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useDebugBoundWitness.tsx +0 -16
- package/src/hooks/useDebugPayload.tsx +0 -11
- package/src/index.ts +0 -1
|
@@ -8,20 +8,20 @@ export declare const useDebugBoundWitness: (input?: string) => {
|
|
|
8
8
|
} & {
|
|
9
9
|
readonly __address: true;
|
|
10
10
|
})[];
|
|
11
|
-
payload_hashes: import("@xylabs/
|
|
11
|
+
payload_hashes: import("@xylabs/sdk-js").BrandedHash[];
|
|
12
12
|
payload_schemas: import("@xyo-network/payload-model").BrandedSchema<string>[];
|
|
13
|
-
previous_hashes: (import("@xylabs/
|
|
14
|
-
$signatures: (import("@xylabs/
|
|
13
|
+
previous_hashes: (import("@xylabs/sdk-js").BrandedHash | null)[];
|
|
14
|
+
$signatures: (import("@xylabs/sdk-js").BrandedHex | null)[];
|
|
15
15
|
$destination?: (Lowercase<string> & {
|
|
16
16
|
readonly __hex: true;
|
|
17
17
|
} & {
|
|
18
18
|
readonly __address: true;
|
|
19
19
|
}) | undefined;
|
|
20
|
-
$sourceQuery?: import("@xylabs/
|
|
20
|
+
$sourceQuery?: import("@xylabs/sdk-js").BrandedHash | undefined;
|
|
21
21
|
} | undefined;
|
|
22
22
|
errors: Error[];
|
|
23
23
|
valid: boolean;
|
|
24
|
-
rootHash: import("@xylabs/
|
|
25
|
-
dataHash: import("@xylabs/
|
|
24
|
+
rootHash: import("@xylabs/sdk-js").BrandedHash | undefined;
|
|
25
|
+
dataHash: import("@xylabs/sdk-js").BrandedHash | undefined;
|
|
26
26
|
};
|
|
27
27
|
//# sourceMappingURL=useDebugBoundWitness.d.ts.map
|
|
@@ -2,7 +2,7 @@ export declare const useDebugPayload: (input?: string) => {
|
|
|
2
2
|
payload: import("@xyo-network/payload-model").Payload | undefined;
|
|
3
3
|
errors: Error[];
|
|
4
4
|
valid: boolean;
|
|
5
|
-
rootHash: import("@xylabs/
|
|
6
|
-
dataHash: import("@xylabs/
|
|
5
|
+
rootHash: import("@xylabs/sdk-js").BrandedHash | undefined;
|
|
6
|
+
dataHash: import("@xylabs/sdk-js").BrandedHash | undefined;
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=useDebugPayload.d.ts.map
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/components/BoundWitnessDebugger.tsx
|
|
5
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
FormControl,
|
|
4
|
+
Grid,
|
|
5
|
+
TextField
|
|
6
|
+
} from "@mui/material";
|
|
6
7
|
import { ErrorRender } from "@xylabs/react-error";
|
|
7
8
|
import { FlexCol } from "@xylabs/react-flexbox";
|
|
8
|
-
import
|
|
9
|
+
import { useState } from "react";
|
|
9
10
|
|
|
10
11
|
// src/hooks/useDebugBoundWitness.tsx
|
|
11
12
|
import { usePayloadRootHash, useValidateBoundWitness } from "@xyo-network/react-shared";
|
|
12
|
-
var useDebugBoundWitness =
|
|
13
|
+
var useDebugBoundWitness = (input) => {
|
|
13
14
|
const { payload: boundWitness, errors } = useValidateBoundWitness(input);
|
|
14
15
|
const rootHash = usePayloadRootHash(boundWitness);
|
|
15
16
|
const dataHash = usePayloadRootHash(boundWitness);
|
|
@@ -20,11 +21,11 @@ var useDebugBoundWitness = /* @__PURE__ */ __name((input) => {
|
|
|
20
21
|
rootHash,
|
|
21
22
|
dataHash
|
|
22
23
|
};
|
|
23
|
-
}
|
|
24
|
+
};
|
|
24
25
|
|
|
25
26
|
// src/hooks/useDebugPayload.tsx
|
|
26
27
|
import { usePayloadRootHash as usePayloadRootHash2, usePayloadValidate } from "@xyo-network/react-shared";
|
|
27
|
-
var useDebugPayload =
|
|
28
|
+
var useDebugPayload = (input) => {
|
|
28
29
|
const { payload, errors } = usePayloadValidate(input);
|
|
29
30
|
const rootHash = usePayloadRootHash2(payload);
|
|
30
31
|
const dataHash = usePayloadRootHash2(payload);
|
|
@@ -35,124 +36,93 @@ var useDebugPayload = /* @__PURE__ */ __name((input) => {
|
|
|
35
36
|
rootHash,
|
|
36
37
|
dataHash
|
|
37
38
|
};
|
|
38
|
-
}
|
|
39
|
+
};
|
|
39
40
|
|
|
40
41
|
// src/components/shared/Chips.tsx
|
|
41
42
|
import { CheckCircle } from "@mui/icons-material";
|
|
42
43
|
import { Chip } from "@mui/material";
|
|
43
|
-
import
|
|
44
|
-
var ValidationChips =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
label: `Root Hash: ${rootHash}`,
|
|
52
|
-
title:
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
title: dataHash
|
|
56
|
-
}) : null);
|
|
57
|
-
}, "ValidationChips");
|
|
44
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
45
|
+
var ValidationChips = ({
|
|
46
|
+
dataHash,
|
|
47
|
+
rootHash,
|
|
48
|
+
valid
|
|
49
|
+
}) => {
|
|
50
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
51
|
+
valid ? /* @__PURE__ */ jsx(Chip, { avatar: /* @__PURE__ */ jsx(CheckCircle, { color: "success" }), label: "Protocol Valid" }) : null,
|
|
52
|
+
rootHash ? /* @__PURE__ */ jsx(Chip, { label: `Root Hash: ${rootHash}`, title: rootHash }) : null,
|
|
53
|
+
dataHash ? /* @__PURE__ */ jsx(Chip, { label: `Data Hash: ${dataHash}`, title: dataHash }) : null
|
|
54
|
+
] });
|
|
55
|
+
};
|
|
58
56
|
|
|
59
57
|
// src/components/shared/JsonPayloadLikeViewerEx.tsx
|
|
60
58
|
import { Paper, useTheme } from "@mui/material";
|
|
61
59
|
import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
|
|
62
|
-
import
|
|
63
|
-
var JsonPayloadLikeViewerEx =
|
|
60
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
61
|
+
var JsonPayloadLikeViewerEx = ({ ...props }) => {
|
|
64
62
|
const theme = useTheme();
|
|
65
|
-
return props.value ? /* @__PURE__ */
|
|
66
|
-
|
|
67
|
-
width: "100%",
|
|
68
|
-
padding: theme.spacing(2)
|
|
69
|
-
}
|
|
70
|
-
}, /* @__PURE__ */ React2.createElement(JsonViewerEx, {
|
|
71
|
-
style: {
|
|
72
|
-
width: "100%"
|
|
73
|
-
},
|
|
74
|
-
...props
|
|
75
|
-
})) : null;
|
|
76
|
-
}, "JsonPayloadLikeViewerEx");
|
|
63
|
+
return props.value ? /* @__PURE__ */ jsx2(Paper, { sx: { width: "100%", padding: theme.spacing(2) }, children: /* @__PURE__ */ jsx2(JsonViewerEx, { style: { width: "100%" }, ...props }) }) : null;
|
|
64
|
+
};
|
|
77
65
|
|
|
78
66
|
// src/components/BoundWitnessDebugger.tsx
|
|
79
|
-
|
|
67
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
68
|
+
var BoundWitnessDebugger = ({ defaultBoundWitnessInput = "" }) => {
|
|
80
69
|
const [input, setInput] = useState(defaultBoundWitnessInput);
|
|
81
|
-
const {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
justifyContent: "center"
|
|
85
|
-
}, /* @__PURE__ */ React3.createElement(Grid, {
|
|
86
|
-
size: {
|
|
87
|
-
xs: 12,
|
|
88
|
-
sm: 6
|
|
89
|
-
}
|
|
90
|
-
}, /* @__PURE__ */ React3.createElement(FlexCol, {
|
|
91
|
-
gap: 2,
|
|
92
|
-
width: "100%",
|
|
93
|
-
alignItems: "start"
|
|
94
|
-
}, /* @__PURE__ */ React3.createElement("h2", null, "BoundWitness Debugger"), /* @__PURE__ */ React3.createElement(FormControl, {
|
|
95
|
-
fullWidth: true
|
|
96
|
-
}, /* @__PURE__ */ React3.createElement(TextField, {
|
|
97
|
-
value: input,
|
|
98
|
-
multiline: true,
|
|
99
|
-
minRows: 10,
|
|
100
|
-
maxRows: Infinity,
|
|
101
|
-
name: "payload",
|
|
102
|
-
onChange: /* @__PURE__ */ __name((e) => setInput(e.target.value), "onChange")
|
|
103
|
-
})), /* @__PURE__ */ React3.createElement(JsonPayloadLikeViewerEx, {
|
|
104
|
-
value: boundWitness
|
|
105
|
-
}), errors.map((error) => /* @__PURE__ */ React3.createElement(ErrorRender, {
|
|
106
|
-
key: error?.message,
|
|
107
|
-
error
|
|
108
|
-
})), /* @__PURE__ */ React3.createElement(ValidationChips, {
|
|
109
|
-
valid,
|
|
70
|
+
const {
|
|
71
|
+
boundWitness,
|
|
72
|
+
errors,
|
|
110
73
|
rootHash,
|
|
111
|
-
dataHash
|
|
112
|
-
|
|
113
|
-
}
|
|
74
|
+
dataHash,
|
|
75
|
+
valid
|
|
76
|
+
} = useDebugBoundWitness(input);
|
|
77
|
+
return /* @__PURE__ */ jsx3(Grid, { container: true, justifyContent: "center", children: /* @__PURE__ */ jsx3(
|
|
78
|
+
Grid,
|
|
79
|
+
{
|
|
80
|
+
size: { xs: 12, sm: 6 },
|
|
81
|
+
children: /* @__PURE__ */ jsxs2(FlexCol, { gap: 2, width: "100%", alignItems: "start", children: [
|
|
82
|
+
/* @__PURE__ */ jsx3("h2", { children: "BoundWitness Debugger" }),
|
|
83
|
+
/* @__PURE__ */ jsx3(FormControl, { fullWidth: true, children: /* @__PURE__ */ jsx3(TextField, { value: input, multiline: true, minRows: 10, maxRows: Infinity, name: "payload", onChange: (e) => setInput(e.target.value) }) }),
|
|
84
|
+
/* @__PURE__ */ jsx3(JsonPayloadLikeViewerEx, { value: boundWitness }),
|
|
85
|
+
errors.map((error) => /* @__PURE__ */ jsx3(ErrorRender, { error }, error?.message)),
|
|
86
|
+
/* @__PURE__ */ jsx3(ValidationChips, { valid, rootHash, dataHash })
|
|
87
|
+
] })
|
|
88
|
+
}
|
|
89
|
+
) });
|
|
90
|
+
};
|
|
114
91
|
|
|
115
92
|
// src/components/PayloadDebugger.tsx
|
|
116
|
-
import {
|
|
93
|
+
import {
|
|
94
|
+
FormControl as FormControl2,
|
|
95
|
+
Grid as Grid2,
|
|
96
|
+
TextField as TextField2
|
|
97
|
+
} from "@mui/material";
|
|
117
98
|
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
118
99
|
import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
|
|
119
|
-
import
|
|
100
|
+
import { useState as useState2 } from "react";
|
|
101
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
120
102
|
var defaultPayload = '{ "schema": "network.xyo.test", "foo": true }';
|
|
121
|
-
var PayloadDebugger =
|
|
103
|
+
var PayloadDebugger = () => {
|
|
122
104
|
const [input, setInput] = useState2(defaultPayload);
|
|
123
|
-
const {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
justifyContent: "center"
|
|
127
|
-
}, /* @__PURE__ */ React4.createElement(Grid2, {
|
|
128
|
-
size: {
|
|
129
|
-
xs: 12,
|
|
130
|
-
sm: 6
|
|
131
|
-
}
|
|
132
|
-
}, /* @__PURE__ */ React4.createElement(FlexCol2, {
|
|
133
|
-
gap: 2,
|
|
134
|
-
width: "100%",
|
|
135
|
-
alignItems: "start"
|
|
136
|
-
}, /* @__PURE__ */ React4.createElement("h2", null, "Payload Debugger"), /* @__PURE__ */ React4.createElement(FormControl2, {
|
|
137
|
-
fullWidth: true
|
|
138
|
-
}, /* @__PURE__ */ React4.createElement(TextField2, {
|
|
139
|
-
value: input,
|
|
140
|
-
multiline: true,
|
|
141
|
-
minRows: 10,
|
|
142
|
-
maxRows: Infinity,
|
|
143
|
-
name: "payload",
|
|
144
|
-
onChange: /* @__PURE__ */ __name((e) => setInput(e.target.value), "onChange")
|
|
145
|
-
})), /* @__PURE__ */ React4.createElement(JsonPayloadLikeViewerEx, {
|
|
146
|
-
value: payload
|
|
147
|
-
}), errors.map((error) => /* @__PURE__ */ React4.createElement(ErrorRender2, {
|
|
148
|
-
key: error?.message,
|
|
149
|
-
error
|
|
150
|
-
})), /* @__PURE__ */ React4.createElement(ValidationChips, {
|
|
151
|
-
valid,
|
|
105
|
+
const {
|
|
106
|
+
payload,
|
|
107
|
+
errors,
|
|
152
108
|
rootHash,
|
|
153
|
-
dataHash
|
|
154
|
-
|
|
155
|
-
}
|
|
109
|
+
dataHash,
|
|
110
|
+
valid
|
|
111
|
+
} = useDebugPayload(input);
|
|
112
|
+
return /* @__PURE__ */ jsx4(Grid2, { container: true, justifyContent: "center", children: /* @__PURE__ */ jsx4(
|
|
113
|
+
Grid2,
|
|
114
|
+
{
|
|
115
|
+
size: { xs: 12, sm: 6 },
|
|
116
|
+
children: /* @__PURE__ */ jsxs3(FlexCol2, { gap: 2, width: "100%", alignItems: "start", children: [
|
|
117
|
+
/* @__PURE__ */ jsx4("h2", { children: "Payload Debugger" }),
|
|
118
|
+
/* @__PURE__ */ jsx4(FormControl2, { fullWidth: true, children: /* @__PURE__ */ jsx4(TextField2, { value: input, multiline: true, minRows: 10, maxRows: Infinity, name: "payload", onChange: (e) => setInput(e.target.value) }) }),
|
|
119
|
+
/* @__PURE__ */ jsx4(JsonPayloadLikeViewerEx, { value: payload }),
|
|
120
|
+
errors.map((error) => /* @__PURE__ */ jsx4(ErrorRender2, { error }, error?.message)),
|
|
121
|
+
/* @__PURE__ */ jsx4(ValidationChips, { valid, rootHash, dataHash })
|
|
122
|
+
] })
|
|
123
|
+
}
|
|
124
|
+
) });
|
|
125
|
+
};
|
|
156
126
|
export {
|
|
157
127
|
BoundWitnessDebugger,
|
|
158
128
|
JsonPayloadLikeViewerEx,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/BoundWitnessDebugger.tsx","../../src/hooks/useDebugBoundWitness.tsx","../../src/hooks/useDebugPayload.tsx","../../src/components/shared/Chips.tsx","../../src/components/shared/JsonPayloadLikeViewerEx.tsx","../../src/components/PayloadDebugger.tsx"],"sourcesContent":["import {\n FormControl, Grid,\n TextField,\n} from '@mui/material'\nimport { ErrorRender } from '@xylabs/react-error'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport React, { useState } from 'react'\n\nimport { useDebugBoundWitness } from '../hooks/index.ts'\nimport { JsonPayloadLikeViewerEx, ValidationChips } from './shared/index.ts'\n\nexport interface BoundWitnessDebuggerProps {\n defaultBoundWitnessInput?: string\n}\n\nexport const BoundWitnessDebugger: React.FC<BoundWitnessDebuggerProps> = ({ defaultBoundWitnessInput = '' }) => {\n const [input, setInput] = useState<string>(defaultBoundWitnessInput)\n\n const {\n boundWitness, errors, rootHash, dataHash, valid,\n } = useDebugBoundWitness(input)\n\n return (\n <Grid container justifyContent=\"center\">\n <Grid\n size={{ xs: 12, sm: 6 }}\n >\n <FlexCol gap={2} width=\"100%\" alignItems=\"start\">\n <h2>BoundWitness Debugger</h2>\n <FormControl fullWidth>\n <TextField value={input} multiline minRows={10} maxRows={Infinity} name=\"payload\" onChange={e => setInput(e.target.value)} />\n </FormControl>\n <JsonPayloadLikeViewerEx value={boundWitness} />\n {errors.map(error => <ErrorRender key={error?.message} error={error} />)}\n <ValidationChips valid={valid} rootHash={rootHash} dataHash={dataHash} />\n </FlexCol>\n </Grid>\n </Grid>\n )\n}\n","import { usePayloadRootHash, useValidateBoundWitness } from '@xyo-network/react-shared'\n\nexport const useDebugBoundWitness = (input?: string) => {\n const { payload: boundWitness, errors } = useValidateBoundWitness(input)\n\n const rootHash = usePayloadRootHash(boundWitness)\n const dataHash = usePayloadRootHash(boundWitness)\n\n return {\n boundWitness,\n errors: errors ?? [],\n valid: errors ? errors.length === 0 : true,\n rootHash,\n dataHash,\n }\n}\n","import { usePayloadRootHash, usePayloadValidate } from '@xyo-network/react-shared'\n\nexport const useDebugPayload = (input?: string) => {\n const { payload, errors } = usePayloadValidate(input)\n const rootHash = usePayloadRootHash(payload)\n const dataHash = usePayloadRootHash(payload)\n\n return {\n payload, errors: errors ?? [], valid: errors ? errors.length === 0 : true, rootHash, dataHash,\n }\n}\n","import { CheckCircle } from '@mui/icons-material'\nimport { Chip, type ChipProps } from '@mui/material'\nimport React from 'react'\n\nexport interface ValidationChipsProps extends ChipProps {\n dataHash?: string\n rootHash?: string\n valid?: boolean\n}\nexport const ValidationChips: React.FC<ValidationChipsProps> = ({\n dataHash, rootHash, valid,\n}) => {\n return (\n <>\n {valid ? <Chip avatar={<CheckCircle color=\"success\" />} label=\"Protocol Valid\" /> : null}\n {rootHash ? <Chip label={`Root Hash: ${rootHash}`} title={rootHash} /> : null}\n {dataHash ? <Chip label={`Data Hash: ${dataHash}`} title={dataHash} /> : null}\n </>\n )\n}\n","import { Paper, useTheme } from '@mui/material'\nimport { JsonViewerEx, type JsonViewerExProps } from '@xyo-network/react-payload-raw-info'\nimport React from 'react'\n\nexport interface JsonPayloadLikeViewerExProps extends JsonViewerExProps {}\n\nexport const JsonPayloadLikeViewerEx: React.FC<JsonPayloadLikeViewerExProps> = ({ ...props }) => {\n const theme = useTheme()\n\n return props.value\n ? (\n <Paper sx={{ width: '100%', padding: theme.spacing(2) }}>\n <JsonViewerEx style={{ width: '100%' }} {...props} />\n </Paper>\n )\n : null\n}\n","import {\n FormControl, Grid, TextField,\n} from '@mui/material'\nimport { ErrorRender } from '@xylabs/react-error'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport React, { useState } from 'react'\n\nimport { useDebugPayload } from '../hooks/index.ts'\nimport { JsonPayloadLikeViewerEx, ValidationChips } from './shared/index.ts'\n\nconst defaultPayload = '{ \"schema\": \"network.xyo.test\", \"foo\": true }'\n\nexport const PayloadDebugger: React.FC = () => {\n const [input, setInput] = useState<string>(defaultPayload)\n\n const {\n payload, errors, rootHash, dataHash, valid,\n } = useDebugPayload(input)\n\n return (\n <Grid container justifyContent=\"center\">\n <Grid\n size={{ xs: 12, sm: 6 }}\n >\n <FlexCol gap={2} width=\"100%\" alignItems=\"start\">\n <h2>Payload Debugger</h2>\n <FormControl fullWidth>\n <TextField value={input} multiline minRows={10} maxRows={Infinity} name=\"payload\" onChange={e => setInput(e.target.value)} />\n </FormControl>\n <JsonPayloadLikeViewerEx value={payload} />\n {errors.map(error => <ErrorRender key={error?.message} error={error} />)}\n <ValidationChips valid={valid} rootHash={rootHash} dataHash={dataHash} />\n </FlexCol>\n </Grid>\n </Grid>\n )\n}\n"],"mappings":";;;;AAAA,SACEA,aAAaC,MACbC,iBACK;AACP,SAASC,mBAAmB;AAC5B,SAASC,eAAe;AACxB,OAAOC,UAASC,gBAAgB;;;ACNhC,SAASC,oBAAoBC,+BAA+B;AAErD,IAAMC,uBAAuB,wBAACC,UAAAA;AACnC,QAAM,EAAEC,SAASC,cAAcC,OAAM,IAAKC,wBAAwBJ,KAAAA;AAElE,QAAMK,WAAWC,mBAAmBJ,YAAAA;AACpC,QAAMK,WAAWD,mBAAmBJ,YAAAA;AAEpC,SAAO;IACLA;IACAC,QAAQA,UAAU,CAAA;IAClBK,OAAOL,SAASA,OAAOM,WAAW,IAAI;IACtCJ;IACAE;EACF;AACF,GAboC;;;ACFpC,SAASG,sBAAAA,qBAAoBC,0BAA0B;AAEhD,IAAMC,kBAAkB,wBAACC,UAAAA;AAC9B,QAAM,EAAEC,SAASC,OAAM,IAAKC,mBAAmBH,KAAAA;AAC/C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;IAAGC,OAAM;IAAOC,YAAW;KACvC,gBAAAV,OAAA,cAACW,MAAAA,MAAG,kBAAA,GACJ,gBAAAX,OAAA,cAACY,cAAAA;IAAYC,WAAAA;KACX,gBAAAb,OAAA,cAACc,YAAAA;IAAUC,OAAOxB;IAAOyB,WAAAA;IAAUC,SAAS;IAAIC,SAASC;IAAUC,MAAK;IAAUC,UAAUC,wBAAAA,MAAK9B,SAAS8B,EAAEC,OAAOR,KAAK,GAA5BO;OAE9F,gBAAAtB,OAAA,cAACwB,yBAAAA;IAAwBT,OAAOrB;MAC/BC,OAAO8B,IAAIC,CAAAA,UAAS,gBAAA1B,OAAA,cAAC2B,cAAAA;IAAYC,KAAKF,OAAOG;IAASH;OACvD,gBAAA1B,OAAA,cAAC8B,iBAAAA;IAAgBhC;IAAcF;IAAoBC;;AAK7D,GAxByC;","names":["FormControl","Grid","TextField","ErrorRender","FlexCol","React","useState","usePayloadRootHash","useValidateBoundWitness","useDebugBoundWitness","input","payload","boundWitness","errors","useValidateBoundWitness","rootHash","usePayloadRootHash","dataHash","valid","length","usePayloadRootHash","usePayloadValidate","useDebugPayload","input","payload","errors","usePayloadValidate","rootHash","usePayloadRootHash","dataHash","valid","length","CheckCircle","Chip","React","ValidationChips","dataHash","rootHash","valid","Chip","avatar","CheckCircle","color","label","title","Paper","useTheme","JsonViewerEx","React","JsonPayloadLikeViewerEx","props","theme","useTheme","value","React","Paper","sx","width","padding","spacing","JsonViewerEx","style","BoundWitnessDebugger","defaultBoundWitnessInput","input","setInput","useState","boundWitness","errors","rootHash","dataHash","valid","useDebugBoundWitness","React","Grid","container","justifyContent","size","xs","sm","FlexCol","gap","width","alignItems","h2","FormControl","fullWidth","TextField","value","multiline","minRows","maxRows","Infinity","name","onChange","e","target","JsonPayloadLikeViewerEx","map","error","ErrorRender","key","message","ValidationChips","FormControl","Grid","TextField","ErrorRender","FlexCol","React","useState","defaultPayload","PayloadDebugger","input","setInput","useState","payload","errors","rootHash","dataHash","valid","useDebugPayload","React","Grid","container","justifyContent","size","xs","sm","FlexCol","gap","width","alignItems","h2","FormControl","fullWidth","TextField","value","multiline","minRows","maxRows","Infinity","name","onChange","e","target","JsonPayloadLikeViewerEx","map","error","ErrorRender","key","message","ValidationChips"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/BoundWitnessDebugger.tsx","../../src/hooks/useDebugBoundWitness.tsx","../../src/hooks/useDebugPayload.tsx","../../src/components/shared/Chips.tsx","../../src/components/shared/JsonPayloadLikeViewerEx.tsx","../../src/components/PayloadDebugger.tsx"],"sourcesContent":["import {\n FormControl, Grid,\n TextField,\n} from '@mui/material'\nimport { ErrorRender } from '@xylabs/react-error'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport React, { useState } from 'react'\n\nimport { useDebugBoundWitness } from '../hooks/index.ts'\nimport { JsonPayloadLikeViewerEx, ValidationChips } from './shared/index.ts'\n\nexport interface BoundWitnessDebuggerProps {\n defaultBoundWitnessInput?: string\n}\n\nexport const BoundWitnessDebugger: React.FC<BoundWitnessDebuggerProps> = ({ defaultBoundWitnessInput = '' }) => {\n const [input, setInput] = useState<string>(defaultBoundWitnessInput)\n\n const {\n boundWitness, errors, rootHash, dataHash, valid,\n } = useDebugBoundWitness(input)\n\n return (\n <Grid container justifyContent=\"center\">\n <Grid\n size={{ xs: 12, sm: 6 }}\n >\n <FlexCol gap={2} width=\"100%\" alignItems=\"start\">\n <h2>BoundWitness Debugger</h2>\n <FormControl fullWidth>\n <TextField value={input} multiline minRows={10} maxRows={Infinity} name=\"payload\" onChange={e => setInput(e.target.value)} />\n </FormControl>\n <JsonPayloadLikeViewerEx value={boundWitness} />\n {errors.map(error => <ErrorRender key={error?.message} error={error} />)}\n <ValidationChips valid={valid} rootHash={rootHash} dataHash={dataHash} />\n </FlexCol>\n </Grid>\n </Grid>\n )\n}\n","import { usePayloadRootHash, useValidateBoundWitness } from '@xyo-network/react-shared'\n\nexport const useDebugBoundWitness = (input?: string) => {\n const { payload: boundWitness, errors } = useValidateBoundWitness(input)\n\n const rootHash = usePayloadRootHash(boundWitness)\n const dataHash = usePayloadRootHash(boundWitness)\n\n return {\n boundWitness,\n errors: errors ?? [],\n valid: errors ? errors.length === 0 : true,\n rootHash,\n dataHash,\n }\n}\n","import { usePayloadRootHash, usePayloadValidate } from '@xyo-network/react-shared'\n\nexport const useDebugPayload = (input?: string) => {\n const { payload, errors } = usePayloadValidate(input)\n const rootHash = usePayloadRootHash(payload)\n const dataHash = usePayloadRootHash(payload)\n\n return {\n payload, errors: errors ?? [], valid: errors ? errors.length === 0 : true, rootHash, dataHash,\n }\n}\n","import { CheckCircle } from '@mui/icons-material'\nimport { Chip, type ChipProps } from '@mui/material'\nimport React from 'react'\n\nexport interface ValidationChipsProps extends ChipProps {\n dataHash?: string\n rootHash?: string\n valid?: boolean\n}\nexport const ValidationChips: React.FC<ValidationChipsProps> = ({\n dataHash, rootHash, valid,\n}) => {\n return (\n <>\n {valid ? <Chip avatar={<CheckCircle color=\"success\" />} label=\"Protocol Valid\" /> : null}\n {rootHash ? <Chip label={`Root Hash: ${rootHash}`} title={rootHash} /> : null}\n {dataHash ? <Chip label={`Data Hash: ${dataHash}`} title={dataHash} /> : null}\n </>\n )\n}\n","import { Paper, useTheme } from '@mui/material'\nimport { JsonViewerEx, type JsonViewerExProps } from '@xyo-network/react-payload-raw-info'\nimport React from 'react'\n\nexport interface JsonPayloadLikeViewerExProps extends JsonViewerExProps {}\n\nexport const JsonPayloadLikeViewerEx: React.FC<JsonPayloadLikeViewerExProps> = ({ ...props }) => {\n const theme = useTheme()\n\n return props.value\n ? (\n <Paper sx={{ width: '100%', padding: theme.spacing(2) }}>\n <JsonViewerEx style={{ width: '100%' }} {...props} />\n </Paper>\n )\n : null\n}\n","import {\n FormControl, Grid, TextField,\n} from '@mui/material'\nimport { ErrorRender } from '@xylabs/react-error'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport React, { useState } from 'react'\n\nimport { useDebugPayload } from '../hooks/index.ts'\nimport { JsonPayloadLikeViewerEx, ValidationChips } from './shared/index.ts'\n\nconst defaultPayload = '{ \"schema\": \"network.xyo.test\", \"foo\": true }'\n\nexport const PayloadDebugger: React.FC = () => {\n const [input, setInput] = useState<string>(defaultPayload)\n\n const {\n payload, errors, rootHash, dataHash, valid,\n } = useDebugPayload(input)\n\n return (\n <Grid container justifyContent=\"center\">\n <Grid\n size={{ xs: 12, sm: 6 }}\n >\n <FlexCol gap={2} width=\"100%\" alignItems=\"start\">\n <h2>Payload Debugger</h2>\n <FormControl fullWidth>\n <TextField value={input} multiline minRows={10} maxRows={Infinity} name=\"payload\" onChange={e => setInput(e.target.value)} />\n </FormControl>\n <JsonPayloadLikeViewerEx value={payload} />\n {errors.map(error => <ErrorRender key={error?.message} error={error} />)}\n <ValidationChips valid={valid} rootHash={rootHash} dataHash={dataHash} />\n </FlexCol>\n </Grid>\n </Grid>\n )\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EAAa;AAAA,EACb;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAgB,gBAAgB;;;ACNhC,SAAS,oBAAoB,+BAA+B;AAErD,IAAM,uBAAuB,CAAC,UAAmB;AACtD,QAAM,EAAE,SAAS,cAAc,OAAO,IAAI,wBAAwB,KAAK;AAEvE,QAAM,WAAW,mBAAmB,YAAY;AAChD,QAAM,WAAW,mBAAmB,YAAY;AAEhD,SAAO;AAAA,IACL;AAAA,IACA,QAAQ,UAAU,CAAC;AAAA,IACnB,OAAO,SAAS,OAAO,WAAW,IAAI;AAAA,IACtC;AAAA,IACA;AAAA,EACF;AACF;;;ACfA,SAAS,sBAAAA,qBAAoB,0BAA0B;AAEhD,IAAM,kBAAkB,CAAC,UAAmB;AACjD,QAAM,EAAE,SAAS,OAAO,IAAI,mBAAmB,KAAK;AACpD,QAAM,WAAWA,oBAAmB,OAAO;AAC3C,QAAM,WAAWA,oBAAmB,OAAO;AAE3C,SAAO;AAAA,IACL;AAAA,IAAS,QAA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,YAAA,EAAU,OAAO,OAAO,WAAS,MAAC,SAAS,IAAI,SAAS,UAAU,MAAK,WAAU,UAAU,OAAK,SAAS,EAAE,OAAO,KAAK,GAAG,GAC7H;AAAA,QACA,gBAAAN,KAAC,2BAAwB,OAAO,SAAS;AAAA,QACxC,OAAO,IAAI,WAAS,gBAAAA,KAACO,cAAA,EAAiC,SAAhB,OAAO,OAAuB,CAAE;AAAA,QACvE,gBAAAP,KAAC,mBAAgB,OAAc,UAAoB,UAAoB;AAAA,SACzE;AAAA;AAAA,EACF,GACF;AAEJ;","names":["usePayloadRootHash","jsx","jsx","jsxs","FormControl","Grid","TextField","ErrorRender","FlexCol","useState","jsx","jsxs","useState","Grid","FlexCol","FormControl","TextField","ErrorRender"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-debug",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.12",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -36,46 +36,115 @@
|
|
|
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
|
-
"@
|
|
48
|
-
"@xyo-network/react-payload-raw-info": "7.5.8",
|
|
49
|
-
"@xyo-network/react-shared": "7.5.8"
|
|
44
|
+
"@xyo-network/react-shared": "~7.5.12",
|
|
45
|
+
"@xyo-network/react-payload-raw-info": "~7.5.12"
|
|
50
46
|
},
|
|
51
47
|
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
48
|
+
"@bitauth/libauth": "~3.0.0",
|
|
49
|
+
"@emotion/react": "^11.14.0",
|
|
50
|
+
"@emotion/styled": "^11.14.1",
|
|
51
|
+
"@mui/icons-material": "^7.3.10",
|
|
52
|
+
"@mui/material": "^7.3.10",
|
|
53
|
+
"@opentelemetry/api": "^1.9.1",
|
|
54
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
55
|
+
"@scure/base": "~2.2.0",
|
|
56
|
+
"@storybook/react-vite": "~10.3.5",
|
|
57
|
+
"@textea/json-viewer": "~4.0.1",
|
|
58
|
+
"@types/node": "~25.6.0",
|
|
55
59
|
"@types/react": "^19.2.14",
|
|
56
|
-
"@xylabs/
|
|
57
|
-
"@xylabs/
|
|
58
|
-
"@xylabs/
|
|
59
|
-
"@xylabs/
|
|
60
|
-
"@xylabs/
|
|
61
|
-
"react": "
|
|
62
|
-
"react-
|
|
63
|
-
"react-
|
|
64
|
-
"
|
|
60
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
61
|
+
"@xylabs/react-button": "~7.1.20",
|
|
62
|
+
"@xylabs/react-dialogs": "~7.1.20",
|
|
63
|
+
"@xylabs/react-error": "~7.1.20",
|
|
64
|
+
"@xylabs/react-flexbox": "~7.1.20",
|
|
65
|
+
"@xylabs/react-hooks": "~7.1.20",
|
|
66
|
+
"@xylabs/react-link": "~7.1.20",
|
|
67
|
+
"@xylabs/react-promise": "~7.1.20",
|
|
68
|
+
"@xylabs/react-quick-tip-button": "~7.1.20",
|
|
69
|
+
"@xylabs/react-shared": "~7.1.20",
|
|
70
|
+
"@xylabs/react-theme": "~7.1.20",
|
|
71
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
72
|
+
"@xylabs/threads": "~5.0.100",
|
|
73
|
+
"@xylabs/toolchain": "~7.11.9",
|
|
74
|
+
"@xylabs/tsconfig": "^7.11.9",
|
|
75
|
+
"@xylabs/tsconfig-dom": "^7.11.9",
|
|
76
|
+
"@xylabs/tsconfig-react": "~7.11.9",
|
|
77
|
+
"@xylabs/zod": "~5.0.100",
|
|
78
|
+
"@xyo-network/boundwitness-model": "^5.5.1",
|
|
79
|
+
"@xyo-network/boundwitness-validator": "^5.5.1",
|
|
80
|
+
"@xyo-network/payload-builder": "^5.5.1",
|
|
81
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
82
|
+
"async-mutex": "^0.5.0",
|
|
83
|
+
"axios": "^1.15.2",
|
|
84
|
+
"bn.js": "^5.2.3",
|
|
85
|
+
"bowser": "^2.14.1",
|
|
86
|
+
"buffer": "^6.0.3",
|
|
87
|
+
"chalk": "^5.6.2",
|
|
88
|
+
"debug": "~4.4.3",
|
|
89
|
+
"esbuild": "~0.28.0",
|
|
90
|
+
"eslint": "^10.2.1",
|
|
91
|
+
"ethers": "^6.16.0",
|
|
92
|
+
"fast-deep-equal": "~3.1.3",
|
|
93
|
+
"hash-wasm": "~4.12.0",
|
|
94
|
+
"js-cookie": "~3.0.5",
|
|
95
|
+
"observable-fns": "~0.6.1",
|
|
96
|
+
"pako": "^2.1.0",
|
|
97
|
+
"react": "^19.2.5",
|
|
98
|
+
"react-dom": "^19.2.5",
|
|
99
|
+
"react-router-dom": "^7.14.2",
|
|
100
|
+
"spark-md5": "~3.0.2",
|
|
101
|
+
"storybook": "^10.3.5",
|
|
65
102
|
"typescript": "^5.9.3",
|
|
66
|
-
"vite": "
|
|
103
|
+
"vite": "^8.0.10",
|
|
104
|
+
"wasm-feature-detect": "~1.8.0",
|
|
67
105
|
"zod": "^4.3.6"
|
|
68
106
|
},
|
|
69
107
|
"peerDependencies": {
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
108
|
+
"@emotion/react": "^11.14.0",
|
|
109
|
+
"@emotion/styled": "^11.14.1",
|
|
110
|
+
"@mui/icons-material": "^7.3.10",
|
|
111
|
+
"@mui/material": "^7.3.10",
|
|
112
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
113
|
+
"@scure/base": "~2.2.0",
|
|
114
|
+
"@textea/json-viewer": "~4.0.1",
|
|
115
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
116
|
+
"@xylabs/react-button": "~7.1.20",
|
|
117
|
+
"@xylabs/react-error": "~7.1.20",
|
|
118
|
+
"@xylabs/react-flexbox": "~7.1.20",
|
|
119
|
+
"@xylabs/react-hooks": "~7.1.20",
|
|
120
|
+
"@xylabs/react-link": "~7.1.20",
|
|
121
|
+
"@xylabs/react-promise": "~7.1.20",
|
|
122
|
+
"@xylabs/react-quick-tip-button": "~7.1.20",
|
|
123
|
+
"@xylabs/react-shared": "~7.1.20",
|
|
124
|
+
"@xylabs/react-theme": "~7.1.20",
|
|
125
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
126
|
+
"@xylabs/zod": "~5.0.100",
|
|
127
|
+
"@xyo-network/boundwitness-model": "^5.5.1",
|
|
128
|
+
"@xyo-network/boundwitness-validator": "^5.5.1",
|
|
129
|
+
"@xyo-network/payload-builder": "^5.5.1",
|
|
130
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
131
|
+
"async-mutex": "^0.5.0",
|
|
132
|
+
"bn.js": "^5.2.3",
|
|
133
|
+
"bowser": "^2.14.1",
|
|
134
|
+
"buffer": "^6.0.3",
|
|
135
|
+
"chalk": "^5.6.2",
|
|
136
|
+
"ethers": "^6.16.0",
|
|
137
|
+
"fast-deep-equal": "~3.1.3",
|
|
138
|
+
"js-cookie": "~3.0.5",
|
|
139
|
+
"pako": "^2.1.0",
|
|
140
|
+
"react": "^19.2.5",
|
|
141
|
+
"react-dom": "^19.2.5",
|
|
142
|
+
"react-router-dom": "^7.14.2",
|
|
143
|
+
"spark-md5": "~3.0.2",
|
|
144
|
+
"zod": "^4.3.6"
|
|
76
145
|
},
|
|
77
146
|
"publishConfig": {
|
|
78
147
|
"access": "public"
|
|
79
148
|
},
|
|
80
149
|
"docs": "dist/docs.json"
|
|
81
|
-
}
|
|
150
|
+
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import { BoundWitnessDebugger } from './BoundWitnessDebugger.tsx'
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line @stylistic/max-len
|
|
7
|
-
const valid = '{"$sourceQuery":"4668b65854019e2be3477ef64821d3634902a89e49150c94c6e2a75bc2d6458d","addresses":["1895c94d879586fce342ff4507a1c8ecc0d94d74"],"payload_hashes":["8551826d8e11ba065ab547a8e66b534efdc276b1be6119041bbaf3d69bebb8c1","d57d4ab772e1bdc1648c38e2cea7716f197e8ef503d615611f5708ce0d5c579c","cbaa3932580411cde85fda22ed6b532613a73c4ba4833ce298f73cb4a667ab92","364d4d4e29633b31a0d6924ce697ef9ae799e156794671c6bf0821380ca462d5","669ee43ad1e0b512579d531201f96958bbeae7a514b9dc3830f6c6eef4037686","4415a6863ed8ffbc086af5bde278a69dbb0384c93e45b11b0264a563b6c206ac","17c4ac3c9e8f1666321b7abd58b76d114219b17a8fcd17eeb4a11270e100db69","f0c6a68a1ddbcc6c5109d139367f9e6e14b5c2ec7f5aafd8e408de647ee6338f","1df4a80913ed0e18471c0edbac30eeac2470a49b40fb9719a27757ca946463b7","60d7361a72fec37a1c4dfe0a559cb076acd43ed3924115ba83954d32ea93714c"],"payload_schemas":["network.xyo.module.manifest","network.xyo.diviner.schema.stats.config","network.xyo.config","network.xyo.address","network.xyo.query","network.xyo.query","network.xyo.query","network.xyo.query","network.xyo.query","network.xyo.module.description"],"previous_hashes":["a5d24d97867fd13251cae9bad7a7bd73d6bc8ab7490aac9612b75bad961e9bd9"],"schema":"network.xyo.boundwitness","$signatures":["af83f4d2e875648e511fc65f7d87c681a2b683bdf3085e4361dfccb90c56afd44ea56df398ded89c224519856ecf2973ea43999fc9723d43703af89b1d758b37"]}'
|
|
8
|
-
// eslint-disable-next-line @stylistic/max-len
|
|
9
|
-
const inValid = '{"$sourceQuery":"4668b65854019e2be3477ef64821d3634902a89e49150c94c6e2a75bc2d6458d","addresses":["1895c94d879586fce342ff4507a1c8ecc0d94d74"],"payload_hashes":["8551826d8e11ba065ab547a8e66b534efdc276b1be6119041bbaf3d69bebb8c1","d57d4ab772e1bdc1648c38e2cea7716f197e8ef503d615611f5708ce0d5c579c","cbaa3932580411cde85fda22ed6b532613a73c4ba4833ce298f73cb4a667ab92","364d4d4e29633b31a0d6924ce697ef9ae799e156794671c6bf0821380ca462d5","669ee43ad1e0b512579d531201f96958bbeae7a514b9dc3830f6c6eef4037686","4415a6863ed8ffbc086af5bde278a69dbb0384c93e45b11b0264a563b6c206ac","17c4ac3c9e8f1666321b7abd58b76d114219b17a8fcd17eeb4a11270e100db69","f0c6a68a1ddbcc6c5109d139367f9e6e14b5c2ec7f5aafd8e408de647ee6338f","1df4a80913ed0e18471c0edbac30eeac2470a49b40fb9719a27757ca946463b7","60d7361a72fec37a1c4dfe0a559cb076acd43ed3924115ba83954d32ea93714c"],"payload_schemas":["network.xyo.module.manifest","network.xyo.diviner.schema.stats.config","network.xyo.config","network.xyo.address","network.xyo.query","network.xyo.query","network.xyo.query","network.xyo.query","network.xyo.query","network.xyo.break.hash"],"previous_hashes":["a5d24d97867fd13251cae9bad7a7bd73d6bc8ab7490aac9612b75bad961e9bd9"],"schema":"network.xyo.boundwitness","$signatures":["af83f4d2e875648e511fc65f7d87c681a2b683bdf3085e4361dfccb90c56afd44ea56df398ded89c224519856ecf2973ea43999fc9723d43703af89b1d758b37"]}'
|
|
10
|
-
|
|
11
|
-
export default { title: 'debug/BoundWitness', component: BoundWitnessDebugger } as Meta
|
|
12
|
-
|
|
13
|
-
const Template: StoryFn<typeof BoundWitnessDebugger> = args => <BoundWitnessDebugger {...args} />
|
|
14
|
-
|
|
15
|
-
const Default = Template.bind({})
|
|
16
|
-
Default.args = {}
|
|
17
|
-
|
|
18
|
-
const WithValid = Template.bind({})
|
|
19
|
-
WithValid.args = { defaultBoundWitnessInput: valid }
|
|
20
|
-
|
|
21
|
-
const WithInValid = Template.bind({})
|
|
22
|
-
WithInValid.args = { defaultBoundWitnessInput: inValid }
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
Default, WithInValid, WithValid,
|
|
26
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FormControl, Grid,
|
|
3
|
-
TextField,
|
|
4
|
-
} from '@mui/material'
|
|
5
|
-
import { ErrorRender } from '@xylabs/react-error'
|
|
6
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
7
|
-
import React, { useState } from 'react'
|
|
8
|
-
|
|
9
|
-
import { useDebugBoundWitness } from '../hooks/index.ts'
|
|
10
|
-
import { JsonPayloadLikeViewerEx, ValidationChips } from './shared/index.ts'
|
|
11
|
-
|
|
12
|
-
export interface BoundWitnessDebuggerProps {
|
|
13
|
-
defaultBoundWitnessInput?: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const BoundWitnessDebugger: React.FC<BoundWitnessDebuggerProps> = ({ defaultBoundWitnessInput = '' }) => {
|
|
17
|
-
const [input, setInput] = useState<string>(defaultBoundWitnessInput)
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
boundWitness, errors, rootHash, dataHash, valid,
|
|
21
|
-
} = useDebugBoundWitness(input)
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Grid container justifyContent="center">
|
|
25
|
-
<Grid
|
|
26
|
-
size={{ xs: 12, sm: 6 }}
|
|
27
|
-
>
|
|
28
|
-
<FlexCol gap={2} width="100%" alignItems="start">
|
|
29
|
-
<h2>BoundWitness Debugger</h2>
|
|
30
|
-
<FormControl fullWidth>
|
|
31
|
-
<TextField value={input} multiline minRows={10} maxRows={Infinity} name="payload" onChange={e => setInput(e.target.value)} />
|
|
32
|
-
</FormControl>
|
|
33
|
-
<JsonPayloadLikeViewerEx value={boundWitness} />
|
|
34
|
-
{errors.map(error => <ErrorRender key={error?.message} error={error} />)}
|
|
35
|
-
<ValidationChips valid={valid} rootHash={rootHash} dataHash={dataHash} />
|
|
36
|
-
</FlexCol>
|
|
37
|
-
</Grid>
|
|
38
|
-
</Grid>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import { PayloadDebugger } from './PayloadDebugger.tsx'
|
|
5
|
-
|
|
6
|
-
export default { title: 'debug/payload', component: PayloadDebugger } as Meta
|
|
7
|
-
|
|
8
|
-
const Template: StoryFn<typeof PayloadDebugger> = args => <PayloadDebugger {...args} />
|
|
9
|
-
|
|
10
|
-
const Default = Template.bind({})
|
|
11
|
-
Default.args = {}
|
|
12
|
-
|
|
13
|
-
export { Default }
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FormControl, Grid, TextField,
|
|
3
|
-
} from '@mui/material'
|
|
4
|
-
import { ErrorRender } from '@xylabs/react-error'
|
|
5
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
6
|
-
import React, { useState } from 'react'
|
|
7
|
-
|
|
8
|
-
import { useDebugPayload } from '../hooks/index.ts'
|
|
9
|
-
import { JsonPayloadLikeViewerEx, ValidationChips } from './shared/index.ts'
|
|
10
|
-
|
|
11
|
-
const defaultPayload = '{ "schema": "network.xyo.test", "foo": true }'
|
|
12
|
-
|
|
13
|
-
export const PayloadDebugger: React.FC = () => {
|
|
14
|
-
const [input, setInput] = useState<string>(defaultPayload)
|
|
15
|
-
|
|
16
|
-
const {
|
|
17
|
-
payload, errors, rootHash, dataHash, valid,
|
|
18
|
-
} = useDebugPayload(input)
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<Grid container justifyContent="center">
|
|
22
|
-
<Grid
|
|
23
|
-
size={{ xs: 12, sm: 6 }}
|
|
24
|
-
>
|
|
25
|
-
<FlexCol gap={2} width="100%" alignItems="start">
|
|
26
|
-
<h2>Payload Debugger</h2>
|
|
27
|
-
<FormControl fullWidth>
|
|
28
|
-
<TextField value={input} multiline minRows={10} maxRows={Infinity} name="payload" onChange={e => setInput(e.target.value)} />
|
|
29
|
-
</FormControl>
|
|
30
|
-
<JsonPayloadLikeViewerEx value={payload} />
|
|
31
|
-
{errors.map(error => <ErrorRender key={error?.message} error={error} />)}
|
|
32
|
-
<ValidationChips valid={valid} rootHash={rootHash} dataHash={dataHash} />
|
|
33
|
-
</FlexCol>
|
|
34
|
-
</Grid>
|
|
35
|
-
</Grid>
|
|
36
|
-
)
|
|
37
|
-
}
|
package/src/components/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { CheckCircle } from '@mui/icons-material'
|
|
2
|
-
import { Chip, type ChipProps } from '@mui/material'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
export interface ValidationChipsProps extends ChipProps {
|
|
6
|
-
dataHash?: string
|
|
7
|
-
rootHash?: string
|
|
8
|
-
valid?: boolean
|
|
9
|
-
}
|
|
10
|
-
export const ValidationChips: React.FC<ValidationChipsProps> = ({
|
|
11
|
-
dataHash, rootHash, valid,
|
|
12
|
-
}) => {
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
{valid ? <Chip avatar={<CheckCircle color="success" />} label="Protocol Valid" /> : null}
|
|
16
|
-
{rootHash ? <Chip label={`Root Hash: ${rootHash}`} title={rootHash} /> : null}
|
|
17
|
-
{dataHash ? <Chip label={`Data Hash: ${dataHash}`} title={dataHash} /> : null}
|
|
18
|
-
</>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Paper, useTheme } from '@mui/material'
|
|
2
|
-
import { JsonViewerEx, type JsonViewerExProps } from '@xyo-network/react-payload-raw-info'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
export interface JsonPayloadLikeViewerExProps extends JsonViewerExProps {}
|
|
6
|
-
|
|
7
|
-
export const JsonPayloadLikeViewerEx: React.FC<JsonPayloadLikeViewerExProps> = ({ ...props }) => {
|
|
8
|
-
const theme = useTheme()
|
|
9
|
-
|
|
10
|
-
return props.value
|
|
11
|
-
? (
|
|
12
|
-
<Paper sx={{ width: '100%', padding: theme.spacing(2) }}>
|
|
13
|
-
<JsonViewerEx style={{ width: '100%' }} {...props} />
|
|
14
|
-
</Paper>
|
|
15
|
-
)
|
|
16
|
-
: null
|
|
17
|
-
}
|
package/src/hooks/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { usePayloadRootHash, useValidateBoundWitness } from '@xyo-network/react-shared'
|
|
2
|
-
|
|
3
|
-
export const useDebugBoundWitness = (input?: string) => {
|
|
4
|
-
const { payload: boundWitness, errors } = useValidateBoundWitness(input)
|
|
5
|
-
|
|
6
|
-
const rootHash = usePayloadRootHash(boundWitness)
|
|
7
|
-
const dataHash = usePayloadRootHash(boundWitness)
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
boundWitness,
|
|
11
|
-
errors: errors ?? [],
|
|
12
|
-
valid: errors ? errors.length === 0 : true,
|
|
13
|
-
rootHash,
|
|
14
|
-
dataHash,
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { usePayloadRootHash, usePayloadValidate } from '@xyo-network/react-shared'
|
|
2
|
-
|
|
3
|
-
export const useDebugPayload = (input?: string) => {
|
|
4
|
-
const { payload, errors } = usePayloadValidate(input)
|
|
5
|
-
const rootHash = usePayloadRootHash(payload)
|
|
6
|
-
const dataHash = usePayloadRootHash(payload)
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
payload, errors: errors ?? [], valid: errors ? errors.length === 0 : true, rootHash, dataHash,
|
|
10
|
-
}
|
|
11
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components/index.ts'
|