@xyo-network/react-chain-boundwitness 1.8.4 → 1.10.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/dist/browser/components/block/BlockBoundWitnessDetails.stories.d.ts +3 -3
- package/dist/browser/components/block/BlockBoundWitnessDetails.stories.d.ts.map +1 -1
- package/dist/browser/components/transactions/TransactionBoundWitnessDetails.stories.d.ts +4 -4
- package/dist/browser/components/transactions/TransactionBoundWitnessDetails.stories.d.ts.map +1 -1
- package/dist/browser/index.mjs +455 -550
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +52 -51
package/dist/browser/index.mjs
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/components/block/BlockBoundWitnessDetails.tsx
|
|
5
2
|
import { filterAs } from "@xylabs/array";
|
|
6
3
|
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
@@ -9,11 +6,16 @@ import { usePromise as usePromise3 } from "@xylabs/react-promise";
|
|
|
9
6
|
import { isBoundWitness } from "@xyo-network/boundwitness-model";
|
|
10
7
|
import { HydratedBlockWrapper } from "@xyo-network/chain-wrappers";
|
|
11
8
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
12
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
BoundWitnessPayloadsTable,
|
|
11
|
+
BoundWitnessSignatureTable,
|
|
12
|
+
HashHeadingPaper,
|
|
13
|
+
HeadingPaper as HeadingPaper2
|
|
14
|
+
} from "@xyo-network/react-boundwitness-plugin";
|
|
13
15
|
import { useTxsFromBlock } from "@xyo-network/react-chain-blockchain";
|
|
14
16
|
import { usePayloadHash as usePayloadHash2 } from "@xyo-network/react-shared";
|
|
15
17
|
import { isTransactionBoundWitness } from "@xyo-network/xl1-protocol";
|
|
16
|
-
import
|
|
18
|
+
import { useMemo as useMemo3 } from "react";
|
|
17
19
|
import { FaSignature } from "react-icons/fa";
|
|
18
20
|
import { GrTransaction } from "react-icons/gr";
|
|
19
21
|
import { VscSymbolMethod as VscSymbolMethod2, VscSymbolNamespace as VscSymbolNamespace2 } from "react-icons/vsc";
|
|
@@ -21,79 +23,78 @@ import { VscSymbolMethod as VscSymbolMethod2, VscSymbolNamespace as VscSymbolNam
|
|
|
21
23
|
// src/lib/formatFees.ts
|
|
22
24
|
import { isUndefined } from "@xylabs/typeof";
|
|
23
25
|
import { bigIntToFixedPointString } from "@xyo-network/chain-utils";
|
|
24
|
-
var formatFee =
|
|
26
|
+
var formatFee = (fee) => {
|
|
25
27
|
if (isUndefined(fee)) return "N/A";
|
|
26
28
|
const stringValue = bigIntToFixedPointString(fee, 12);
|
|
27
29
|
if (stringValue === "0") return stringValue;
|
|
28
30
|
return stringValue;
|
|
29
|
-
}
|
|
31
|
+
};
|
|
30
32
|
|
|
31
33
|
// src/lib/formatNumber.ts
|
|
32
|
-
var formatNumber =
|
|
34
|
+
var formatNumber = (num) => {
|
|
33
35
|
return num.toLocaleString(navigator.language ?? "en-US");
|
|
34
|
-
}
|
|
36
|
+
};
|
|
35
37
|
|
|
36
38
|
// src/lib/formatPayloadsForTable.ts
|
|
37
|
-
var formatPayloadsForTable =
|
|
39
|
+
var formatPayloadsForTable = (pairs) => {
|
|
38
40
|
let hashes = [];
|
|
39
41
|
let schemas = [];
|
|
40
42
|
for (const [bw, hash] of pairs ?? []) {
|
|
41
43
|
hashes.push(hash);
|
|
42
44
|
schemas.push(bw?.schema ?? "");
|
|
43
45
|
}
|
|
44
|
-
return {
|
|
45
|
-
|
|
46
|
-
schemas
|
|
47
|
-
};
|
|
48
|
-
}, "formatPayloadsForTable");
|
|
46
|
+
return { hashes, schemas };
|
|
47
|
+
};
|
|
49
48
|
|
|
50
49
|
// src/lib/formatResults.ts
|
|
51
|
-
var formatResults =
|
|
52
|
-
const result = {
|
|
53
|
-
labels: [],
|
|
54
|
-
values: []
|
|
55
|
-
};
|
|
50
|
+
var formatResults = (results) => {
|
|
51
|
+
const result = { labels: [], values: [] };
|
|
56
52
|
for (const [label, value] of Object.entries(results)) {
|
|
57
53
|
result.labels.push(label);
|
|
58
54
|
result.values.push(value);
|
|
59
55
|
}
|
|
60
56
|
return result;
|
|
61
|
-
}
|
|
57
|
+
};
|
|
62
58
|
|
|
63
59
|
// src/components/PayloadTable.tsx
|
|
64
60
|
import { InfoOutline } from "@mui/icons-material";
|
|
65
61
|
import { Tooltip } from "@mui/material";
|
|
66
62
|
import { FlexCol } from "@xylabs/react-flexbox";
|
|
67
63
|
import { isDefined } from "@xylabs/typeof";
|
|
68
|
-
import {
|
|
64
|
+
import {
|
|
65
|
+
BoundWitnessPayloadTableBody,
|
|
66
|
+
BoundWitnessPayloadTableHead,
|
|
67
|
+
HeadingPaper
|
|
68
|
+
} from "@xyo-network/react-boundwitness-plugin";
|
|
69
69
|
import { TableEx } from "@xyo-network/react-table";
|
|
70
|
-
import React from "react";
|
|
71
70
|
import { VscSymbolMethod } from "react-icons/vsc";
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
71
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
72
|
+
var PayloadTableFlexbox = ({
|
|
73
|
+
IconComponent,
|
|
74
|
+
eventNoun,
|
|
75
|
+
hashes,
|
|
76
|
+
schemas,
|
|
77
|
+
headingTitle,
|
|
78
|
+
clickableFields,
|
|
79
|
+
tooltip,
|
|
80
|
+
...props
|
|
81
|
+
}) => {
|
|
82
|
+
const resolvedIconComponent = IconComponent ?? /* @__PURE__ */ jsx(VscSymbolMethod, {});
|
|
83
|
+
return /* @__PURE__ */ jsxs(FlexCol, { alignItems: "stretch", rowGap: 1, ...props, children: [
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
HeadingPaper,
|
|
86
|
+
{
|
|
87
|
+
AdornmentEnd: isDefined(tooltip) ? /* @__PURE__ */ jsx(Tooltip, { title: tooltip, children: /* @__PURE__ */ jsx(InfoOutline, { fontSize: "small", sx: { py: 2, px: 1 } }) }) : null,
|
|
88
|
+
IconComponent: resolvedIconComponent,
|
|
89
|
+
heading: headingTitle
|
|
86
90
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
clickableFields
|
|
95
|
-
})));
|
|
96
|
-
}, "PayloadTableFlexbox");
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsxs(TableEx, { children: [
|
|
93
|
+
/* @__PURE__ */ jsx(BoundWitnessPayloadTableHead, {}),
|
|
94
|
+
/* @__PURE__ */ jsx(BoundWitnessPayloadTableBody, { payloadHashes: hashes, payloadSchemas: schemas, eventNoun, clickableFields })
|
|
95
|
+
] })
|
|
96
|
+
] });
|
|
97
|
+
};
|
|
97
98
|
|
|
98
99
|
// src/components/block/card/actions/BlockBoundWitnessActions.tsx
|
|
99
100
|
import { DataObject as DataObjectIcon } from "@mui/icons-material";
|
|
@@ -102,7 +103,6 @@ import { FlexRow } from "@xylabs/react-flexbox";
|
|
|
102
103
|
import { QuickTipButton } from "@xylabs/react-quick-tip-button";
|
|
103
104
|
import { BWPreviousHashQuickTipButton } from "@xyo-network/react-boundwitness-plugin";
|
|
104
105
|
import { usePayloadHash } from "@xyo-network/react-shared";
|
|
105
|
-
import React3 from "react";
|
|
106
106
|
|
|
107
107
|
// src/components/block/card/actions/BlockBoundWitnessVerification.tsx
|
|
108
108
|
import { CancelRounded as CancelRoundedIcon } from "@mui/icons-material";
|
|
@@ -112,22 +112,17 @@ import { usePromise } from "@xylabs/react-promise";
|
|
|
112
112
|
import { isDefined as isDefined2 } from "@xylabs/typeof";
|
|
113
113
|
import { validateBlock } from "@xyo-network/chain-validation";
|
|
114
114
|
import { isBlockBoundWitness } from "@xyo-network/xl1-protocol";
|
|
115
|
-
import
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
ref,
|
|
119
|
-
...props
|
|
120
|
-
}), "InvalidIcon");
|
|
115
|
+
import { useMemo } from "react";
|
|
116
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
117
|
+
var InvalidIcon = ({ ref, ...props }) => /* @__PURE__ */ jsx2(CancelRoundedIcon, { color: "error", ref, ...props });
|
|
121
118
|
InvalidIcon.displayName = "InvalidIcon";
|
|
122
|
-
var BlockBoundWitnessVerification =
|
|
119
|
+
var BlockBoundWitnessVerification = ({ block, ...props }) => {
|
|
123
120
|
const [validationErrors, validateError] = usePromise(async () => {
|
|
124
121
|
if (isDefined2(block)) {
|
|
125
122
|
const resolvedBlock = assertEx(isBlockBoundWitness(block) ? block : void 0, () => "Block must be a BlockBoundWitness");
|
|
126
123
|
return await validateBlock(resolvedBlock);
|
|
127
124
|
}
|
|
128
|
-
}, [
|
|
129
|
-
block
|
|
130
|
-
]);
|
|
125
|
+
}, [block]);
|
|
131
126
|
const resolvedErrors = useMemo(() => {
|
|
132
127
|
const errors = [];
|
|
133
128
|
if (isDefined2(validationErrors)) {
|
|
@@ -136,98 +131,101 @@ var BlockBoundWitnessVerification = /* @__PURE__ */ __name(({ block, ...props })
|
|
|
136
131
|
if (isDefined2(validateError)) errors.push(validateError);
|
|
137
132
|
return errors;
|
|
138
133
|
}
|
|
139
|
-
}, [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
]);
|
|
143
|
-
return /* @__PURE__ */ React2.createElement(ErrorQuickTipButton, {
|
|
144
|
-
boundWitnessType: "Block",
|
|
145
|
-
errors: resolvedErrors,
|
|
146
|
-
...props
|
|
147
|
-
});
|
|
148
|
-
}, "BlockBoundWitnessVerification");
|
|
134
|
+
}, [validateError, validationErrors]);
|
|
135
|
+
return /* @__PURE__ */ jsx2(ErrorQuickTipButton, { boundWitnessType: "Block", errors: resolvedErrors, ...props });
|
|
136
|
+
};
|
|
149
137
|
|
|
150
138
|
// src/components/block/card/actions/BlockBoundWitnessActions.tsx
|
|
151
|
-
|
|
139
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
140
|
+
var BlockBoundWitnessActions = ({
|
|
141
|
+
boundwitness,
|
|
142
|
+
validationIconColors = false,
|
|
143
|
+
...props
|
|
144
|
+
}) => {
|
|
152
145
|
const hash = usePayloadHash(boundwitness);
|
|
153
|
-
return /* @__PURE__ */
|
|
154
|
-
boundwitness
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
wordBreak: "break-all"
|
|
168
|
-
}
|
|
169
|
-
}, boundwitness ? JSON.stringify(boundwitness, null, 2) : null)));
|
|
170
|
-
}, "BlockBoundWitnessActions");
|
|
146
|
+
return /* @__PURE__ */ jsxs2(FlexRow, { ...props, children: [
|
|
147
|
+
boundwitness?.previous_hashes.length === 0 ? null : /* @__PURE__ */ jsx3(BWPreviousHashQuickTipButton, { boundwitness }),
|
|
148
|
+
/* @__PURE__ */ jsx3(BlockBoundWitnessVerification, { iconColors: validationIconColors, block: boundwitness }),
|
|
149
|
+
/* @__PURE__ */ jsx3(
|
|
150
|
+
QuickTipButton,
|
|
151
|
+
{
|
|
152
|
+
Icon: DataObjectIcon,
|
|
153
|
+
title: `JSON for ${ellipsize(hash ?? "", 8)}`,
|
|
154
|
+
dialogProps: { fullWidth: true, maxWidth: "md" },
|
|
155
|
+
children: /* @__PURE__ */ jsx3("pre", { style: { wordBreak: "break-all" }, children: boundwitness ? JSON.stringify(boundwitness, null, 2) : null })
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
] });
|
|
159
|
+
};
|
|
171
160
|
|
|
172
161
|
// src/components/block/card/Card.tsx
|
|
173
|
-
import {
|
|
162
|
+
import {
|
|
163
|
+
Card,
|
|
164
|
+
CardContent,
|
|
165
|
+
Grid,
|
|
166
|
+
Skeleton,
|
|
167
|
+
Stack
|
|
168
|
+
} from "@mui/material";
|
|
174
169
|
import { ErrorRender } from "@xylabs/react-error";
|
|
175
170
|
import { DetailsStack, LabelValueStack } from "@xyo-network/react-chain-shared";
|
|
176
|
-
import React5 from "react";
|
|
177
171
|
import { GrSteps } from "react-icons/gr";
|
|
178
172
|
import { IoStatsChartOutline } from "react-icons/io5";
|
|
179
173
|
import { VscSymbolNamespace } from "react-icons/vsc";
|
|
180
174
|
|
|
181
175
|
// src/components/block/card/CardHeader.tsx
|
|
182
|
-
import {
|
|
176
|
+
import {
|
|
177
|
+
CardHeader,
|
|
178
|
+
Link,
|
|
179
|
+
Tooltip as Tooltip2,
|
|
180
|
+
Typography
|
|
181
|
+
} from "@mui/material";
|
|
183
182
|
import { BlockiesAvatarAddress } from "@xyo-network/react-chain-blockies";
|
|
184
183
|
import { useEvent } from "@xyo-network/react-event";
|
|
185
|
-
import
|
|
186
|
-
var BlockBoundWitnessCardHeader =
|
|
184
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
185
|
+
var BlockBoundWitnessCardHeader = ({ linked = true, address }) => {
|
|
187
186
|
const [ref, dispatch] = useEvent();
|
|
188
|
-
return /* @__PURE__ */
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
187
|
+
return /* @__PURE__ */ jsx4(
|
|
188
|
+
CardHeader,
|
|
189
|
+
{
|
|
190
|
+
ref,
|
|
191
|
+
title: /* @__PURE__ */ jsx4(
|
|
192
|
+
Typography,
|
|
193
|
+
{
|
|
194
|
+
onClick: () => linked && dispatch("address", "click", address),
|
|
195
|
+
variant: "body2",
|
|
196
|
+
sx: {
|
|
197
|
+
maxWidth: "100%",
|
|
198
|
+
textOverflow: "ellipsis",
|
|
199
|
+
overflow: "hidden",
|
|
200
|
+
fontFamily: "monospace"
|
|
201
|
+
},
|
|
202
|
+
children: linked ? /* @__PURE__ */ jsx4(Link, { sx: { cursor: "pointer" }, children: address }) : address
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
avatar: /* @__PURE__ */ jsx4(Tooltip2, { title: `Address - ${address}`, children: /* @__PURE__ */ jsx4(
|
|
206
|
+
BlockiesAvatarAddress,
|
|
207
|
+
{
|
|
208
|
+
address,
|
|
209
|
+
onClick: () => dispatch("address", "click", address),
|
|
210
|
+
size: 21,
|
|
211
|
+
sx: { cursor: "pointer" }
|
|
212
|
+
}
|
|
213
|
+
) })
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
};
|
|
216
217
|
|
|
217
218
|
// src/components/block/card/hooks/useDetails.ts
|
|
218
219
|
import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
219
220
|
import { StepSizes } from "@xyo-network/xl1-protocol";
|
|
220
221
|
import { useMemo as useMemo2 } from "react";
|
|
221
|
-
var generateStepHashText =
|
|
222
|
+
var generateStepHashText = (blockNumber, stepHashIndex) => {
|
|
222
223
|
const stepSize = StepSizes[stepHashIndex];
|
|
223
224
|
const stepStart = blockNumber - stepSize + 1;
|
|
224
225
|
const stepStop = blockNumber;
|
|
225
|
-
return [
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
];
|
|
229
|
-
}, "generateStepHashText");
|
|
230
|
-
var useBlockDetails = /* @__PURE__ */ __name((wrapper, viewer) => {
|
|
226
|
+
return [`Step ${stepHashIndex} (${stepSize})`, `${formatNumber(stepStart)} - ${formatNumber(stepStop)}`];
|
|
227
|
+
};
|
|
228
|
+
var useBlockDetails = (wrapper, viewer) => {
|
|
231
229
|
const stats = useMemo2(() => {
|
|
232
230
|
const stats2 = {
|
|
233
231
|
Height: formatNumber(wrapper.boundWitness.block),
|
|
@@ -236,18 +234,14 @@ var useBlockDetails = /* @__PURE__ */ __name((wrapper, viewer) => {
|
|
|
236
234
|
$epoch: wrapper.boundWitness.$epoch.toString()
|
|
237
235
|
};
|
|
238
236
|
return formatResults(stats2);
|
|
239
|
-
}, [
|
|
240
|
-
wrapper
|
|
241
|
-
]);
|
|
237
|
+
}, [wrapper]);
|
|
242
238
|
const payloads = useMemo2(() => {
|
|
243
239
|
const payloads2 = {
|
|
244
240
|
"Transactions": formatNumber(wrapper.transactionCount),
|
|
245
241
|
"Total Payloads": formatNumber(wrapper.payloadCount)
|
|
246
242
|
};
|
|
247
243
|
return formatResults(payloads2);
|
|
248
|
-
}, [
|
|
249
|
-
wrapper
|
|
250
|
-
]);
|
|
244
|
+
}, [wrapper]);
|
|
251
245
|
const [stepHashes, stepHashesError, stepHashesLoading] = usePromise2(async () => {
|
|
252
246
|
if (viewer) {
|
|
253
247
|
const stepHashes2 = {};
|
|
@@ -269,15 +263,7 @@ var useBlockDetails = /* @__PURE__ */ __name((wrapper, viewer) => {
|
|
|
269
263
|
}
|
|
270
264
|
return formatResults(stepHashes2);
|
|
271
265
|
}
|
|
272
|
-
}, [
|
|
273
|
-
wrapper,
|
|
274
|
-
viewer
|
|
275
|
-
], {
|
|
276
|
-
defaultValue: {
|
|
277
|
-
labels: [],
|
|
278
|
-
values: []
|
|
279
|
-
}
|
|
280
|
-
});
|
|
266
|
+
}, [wrapper, viewer], { defaultValue: { labels: [], values: [] } });
|
|
281
267
|
return {
|
|
282
268
|
stats,
|
|
283
269
|
payloads,
|
|
@@ -285,184 +271,144 @@ var useBlockDetails = /* @__PURE__ */ __name((wrapper, viewer) => {
|
|
|
285
271
|
stepHashesError,
|
|
286
272
|
stepHashesLoading
|
|
287
273
|
};
|
|
288
|
-
}
|
|
274
|
+
};
|
|
289
275
|
|
|
290
276
|
// src/components/block/card/Card.tsx
|
|
291
|
-
|
|
277
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
278
|
+
var BlockBoundWitnessCard = ({
|
|
279
|
+
linkedAddress = true,
|
|
280
|
+
viewer,
|
|
281
|
+
wrapper,
|
|
282
|
+
...props
|
|
283
|
+
}) => {
|
|
292
284
|
if (!wrapper) return null;
|
|
293
|
-
const {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
spacing: 6,
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
height: 20
|
|
349
|
-
}), /* @__PURE__ */ React5.createElement(Skeleton, {
|
|
350
|
-
variant: "text",
|
|
351
|
-
width: "100%",
|
|
352
|
-
height: 20
|
|
353
|
-
}), /* @__PURE__ */ React5.createElement(Skeleton, {
|
|
354
|
-
variant: "text",
|
|
355
|
-
width: "100%",
|
|
356
|
-
height: 20
|
|
357
|
-
}), /* @__PURE__ */ React5.createElement(Skeleton, {
|
|
358
|
-
variant: "text",
|
|
359
|
-
width: "100%",
|
|
360
|
-
height: 20
|
|
361
|
-
})) : null, /* @__PURE__ */ React5.createElement(LabelValueStack, {
|
|
362
|
-
labels: stepHashes?.labels ?? [],
|
|
363
|
-
values: stepHashes?.values ?? []
|
|
364
|
-
}))))));
|
|
365
|
-
}, "BlockBoundWitnessCard");
|
|
285
|
+
const {
|
|
286
|
+
stats,
|
|
287
|
+
payloads,
|
|
288
|
+
stepHashes,
|
|
289
|
+
stepHashesError,
|
|
290
|
+
stepHashesLoading
|
|
291
|
+
} = useBlockDetails(wrapper, viewer);
|
|
292
|
+
return /* @__PURE__ */ jsxs3(Card, { ...props, children: [
|
|
293
|
+
wrapper?.boundWitness.addresses.map((address) => /* @__PURE__ */ jsx5(BlockBoundWitnessCardHeader, { address, linked: linkedAddress }, address)),
|
|
294
|
+
/* @__PURE__ */ jsx5(ErrorRender, { error: stepHashesError, scope: "BlockBoundWitnessCard.tsx:stepHashesError" }),
|
|
295
|
+
/* @__PURE__ */ jsx5(CardContent, { children: /* @__PURE__ */ jsxs3(Grid, { container: true, spacing: 6, sx: { width: "100%" }, children: [
|
|
296
|
+
/* @__PURE__ */ jsx5(
|
|
297
|
+
Grid,
|
|
298
|
+
{
|
|
299
|
+
size: {
|
|
300
|
+
xs: 12,
|
|
301
|
+
sm: 6,
|
|
302
|
+
md: 4
|
|
303
|
+
},
|
|
304
|
+
children: /* @__PURE__ */ jsx5(DetailsStack, { IconComponent: IoStatsChartOutline, heading: "Stats", tooltipTitle: "Transaction Statistics", children: /* @__PURE__ */ jsx5(LabelValueStack, { labels: stats.labels, values: stats.values }) })
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
/* @__PURE__ */ jsx5(
|
|
308
|
+
Grid,
|
|
309
|
+
{
|
|
310
|
+
size: {
|
|
311
|
+
xs: 12,
|
|
312
|
+
sm: 6,
|
|
313
|
+
md: 4
|
|
314
|
+
},
|
|
315
|
+
children: /* @__PURE__ */ jsx5(DetailsStack, { IconComponent: VscSymbolNamespace, heading: "Payloads", tooltipTitle: "Payloads within the Block", children: /* @__PURE__ */ jsx5(LabelValueStack, { labels: payloads.labels, values: payloads.values }) })
|
|
316
|
+
}
|
|
317
|
+
),
|
|
318
|
+
/* @__PURE__ */ jsx5(
|
|
319
|
+
Grid,
|
|
320
|
+
{
|
|
321
|
+
size: {
|
|
322
|
+
xs: 12,
|
|
323
|
+
sm: 6,
|
|
324
|
+
md: 4
|
|
325
|
+
},
|
|
326
|
+
children: /* @__PURE__ */ jsxs3(DetailsStack, { IconComponent: GrSteps, heading: "Step Hashes", tooltipTitle: "Step Hashes for the Block", children: [
|
|
327
|
+
stepHashesLoading === "pending" ? /* @__PURE__ */ jsxs3(Stack, { gap: 0.25, children: [
|
|
328
|
+
/* @__PURE__ */ jsx5(Skeleton, { variant: "text", width: "100%", height: 20 }),
|
|
329
|
+
/* @__PURE__ */ jsx5(Skeleton, { variant: "text", width: "100%", height: 20 }),
|
|
330
|
+
/* @__PURE__ */ jsx5(Skeleton, { variant: "text", width: "100%", height: 20 }),
|
|
331
|
+
/* @__PURE__ */ jsx5(Skeleton, { variant: "text", width: "100%", height: 20 })
|
|
332
|
+
] }) : null,
|
|
333
|
+
/* @__PURE__ */ jsx5(LabelValueStack, { labels: stepHashes?.labels ?? [], values: stepHashes?.values ?? [] })
|
|
334
|
+
] })
|
|
335
|
+
}
|
|
336
|
+
)
|
|
337
|
+
] }) })
|
|
338
|
+
] });
|
|
339
|
+
};
|
|
366
340
|
|
|
367
341
|
// src/components/block/BlockBoundWitnessDetails.tsx
|
|
368
|
-
|
|
342
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
343
|
+
var BlockBoundWitnessDetails = ({
|
|
344
|
+
block,
|
|
345
|
+
paper,
|
|
346
|
+
viewer,
|
|
347
|
+
children,
|
|
348
|
+
...props
|
|
349
|
+
}) => {
|
|
369
350
|
const [wrapper, wrapperError] = usePromise3(async () => {
|
|
370
351
|
if (block) {
|
|
371
352
|
return await HydratedBlockWrapper.parse(block);
|
|
372
353
|
}
|
|
373
|
-
}, [
|
|
374
|
-
block
|
|
375
|
-
]);
|
|
354
|
+
}, [block]);
|
|
376
355
|
const boundWitness = block?.[0];
|
|
377
356
|
const payloads = block?.[1];
|
|
378
357
|
const hash = usePayloadHash2(boundWitness);
|
|
379
358
|
const [transactions, txFromBlockError] = useTxsFromBlock(block);
|
|
380
|
-
const { hashes: txHashes, schemas: txSchemas } = useMemo3(() => formatPayloadsForTable(transactions ?? []), [
|
|
381
|
-
transactions
|
|
382
|
-
]);
|
|
359
|
+
const { hashes: txHashes, schemas: txSchemas } = useMemo3(() => formatPayloadsForTable(transactions ?? []), [transactions]);
|
|
383
360
|
const [nonTxBoundWitnesses, bwsFromBlockError] = usePromise3(async () => {
|
|
384
361
|
const bws = filterAs(payloads ?? [], (payload) => !isTransactionBoundWitness(payload) && isBoundWitness(payload) ? payload : void 0);
|
|
385
362
|
return await PayloadBuilder.hashPairs(bws);
|
|
386
|
-
}, [
|
|
387
|
-
|
|
388
|
-
]);
|
|
389
|
-
const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } = useMemo3(() => formatPayloadsForTable(nonTxBoundWitnesses ?? []), [
|
|
390
|
-
nonTxBoundWitnesses
|
|
391
|
-
]);
|
|
363
|
+
}, [payloads]);
|
|
364
|
+
const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } = useMemo3(() => formatPayloadsForTable(nonTxBoundWitnesses ?? []), [nonTxBoundWitnesses]);
|
|
392
365
|
const hasNonTxBoundWitnesses = (nonTxBoundWitnesses?.length ?? 0) > 0;
|
|
393
|
-
return /* @__PURE__ */
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}), /* @__PURE__ */ React6.createElement(HashHeadingPaper, {
|
|
404
|
-
hash,
|
|
405
|
-
paperProps: {
|
|
406
|
-
sx: {
|
|
407
|
-
p: 2
|
|
366
|
+
return /* @__PURE__ */ jsxs4(FlexCol2, { alignItems: "stretch", rowGap: 4, ...props, children: [
|
|
367
|
+
/* @__PURE__ */ jsx6(ErrorRender2, { error: txFromBlockError ?? bwsFromBlockError, scope: "BlockBoundWitnessDetails.tsx" }),
|
|
368
|
+
/* @__PURE__ */ jsx6(ErrorRender2, { error: wrapperError, scope: "BlockBoundWitnessDetails.tsx:wrapperError" }),
|
|
369
|
+
/* @__PURE__ */ jsx6(
|
|
370
|
+
HashHeadingPaper,
|
|
371
|
+
{
|
|
372
|
+
hash,
|
|
373
|
+
paperProps: { sx: { p: 2 } },
|
|
374
|
+
AdornmentEnd: /* @__PURE__ */ jsx6(BlockBoundWitnessActions, { boundwitness: boundWitness }),
|
|
375
|
+
identiconProps: { p: 0.75, size: 24 }
|
|
408
376
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
"hash"
|
|
426
|
-
],
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
"hash"
|
|
445
|
-
]
|
|
446
|
-
})), hasNonTxBoundWitnesses ? /* @__PURE__ */ React6.createElement(PayloadTableFlexbox, {
|
|
447
|
-
IconComponent: /* @__PURE__ */ React6.createElement(VscSymbolMethod2, null),
|
|
448
|
-
eventNoun: "boundwitness",
|
|
449
|
-
hashes: nonTxBwHashes,
|
|
450
|
-
headingTitle: "Bound Witnesses",
|
|
451
|
-
schemas: nonTxBwSchemas,
|
|
452
|
-
sx: {
|
|
453
|
-
mb: 1
|
|
454
|
-
}
|
|
455
|
-
}) : null, /* @__PURE__ */ React6.createElement(FlexCol2, {
|
|
456
|
-
alignItems: "stretch",
|
|
457
|
-
rowGap: 1,
|
|
458
|
-
mb: 1
|
|
459
|
-
}, /* @__PURE__ */ React6.createElement(HeadingPaper2, {
|
|
460
|
-
IconComponent: /* @__PURE__ */ React6.createElement(FaSignature, null),
|
|
461
|
-
heading: "Signatures"
|
|
462
|
-
}), /* @__PURE__ */ React6.createElement(BoundWitnessSignatureTable, {
|
|
463
|
-
block: boundWitness
|
|
464
|
-
})));
|
|
465
|
-
}, "BlockBoundWitnessDetails");
|
|
377
|
+
),
|
|
378
|
+
/* @__PURE__ */ jsx6(BlockBoundWitnessCard, { elevation: 4, viewer, wrapper }),
|
|
379
|
+
(transactions?.length ?? 0) > 0 && /* @__PURE__ */ jsx6(
|
|
380
|
+
PayloadTableFlexbox,
|
|
381
|
+
{
|
|
382
|
+
IconComponent: /* @__PURE__ */ jsx6(GrTransaction, {}),
|
|
383
|
+
eventNoun: "transaction",
|
|
384
|
+
clickableFields: ["hash"],
|
|
385
|
+
hashes: txHashes,
|
|
386
|
+
headingTitle: "Transactions",
|
|
387
|
+
schemas: txSchemas,
|
|
388
|
+
sx: { mb: 1 }
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
/* @__PURE__ */ jsxs4(FlexCol2, { alignItems: "stretch", rowGap: 1, mb: 1, children: [
|
|
392
|
+
/* @__PURE__ */ jsx6(HeadingPaper2, { IconComponent: /* @__PURE__ */ jsx6(VscSymbolNamespace2, {}), heading: "Payloads" }),
|
|
393
|
+
/* @__PURE__ */ jsx6(BoundWitnessPayloadsTable, { boundwitness: boundWitness, eventNoun: "payload", clickableFields: ["hash"] })
|
|
394
|
+
] }),
|
|
395
|
+
hasNonTxBoundWitnesses ? /* @__PURE__ */ jsx6(
|
|
396
|
+
PayloadTableFlexbox,
|
|
397
|
+
{
|
|
398
|
+
IconComponent: /* @__PURE__ */ jsx6(VscSymbolMethod2, {}),
|
|
399
|
+
eventNoun: "boundwitness",
|
|
400
|
+
hashes: nonTxBwHashes,
|
|
401
|
+
headingTitle: "Bound Witnesses",
|
|
402
|
+
schemas: nonTxBwSchemas,
|
|
403
|
+
sx: { mb: 1 }
|
|
404
|
+
}
|
|
405
|
+
) : null,
|
|
406
|
+
/* @__PURE__ */ jsxs4(FlexCol2, { alignItems: "stretch", rowGap: 1, mb: 1, children: [
|
|
407
|
+
/* @__PURE__ */ jsx6(HeadingPaper2, { IconComponent: /* @__PURE__ */ jsx6(FaSignature, {}), heading: "Signatures" }),
|
|
408
|
+
/* @__PURE__ */ jsx6(BoundWitnessSignatureTable, { block: boundWitness })
|
|
409
|
+
] })
|
|
410
|
+
] });
|
|
411
|
+
};
|
|
466
412
|
|
|
467
413
|
// src/components/transactions/card/actions/TransactionActions.tsx
|
|
468
414
|
import { DataObject as DataObjectIcon2 } from "@mui/icons-material";
|
|
@@ -471,7 +417,6 @@ import { FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
|
471
417
|
import { QuickTipButton as QuickTipButton2 } from "@xylabs/react-quick-tip-button";
|
|
472
418
|
import { BWPreviousHashQuickTipButton as BWPreviousHashQuickTipButton2 } from "@xyo-network/react-boundwitness-plugin";
|
|
473
419
|
import { usePayloadHash as usePayloadHash3 } from "@xyo-network/react-shared";
|
|
474
|
-
import React8 from "react";
|
|
475
420
|
|
|
476
421
|
// src/components/transactions/card/actions/TransactionVerification.tsx
|
|
477
422
|
import { CancelRounded as CancelRoundedIcon2 } from "@mui/icons-material";
|
|
@@ -481,22 +426,17 @@ import { usePromise as usePromise4 } from "@xylabs/react-promise";
|
|
|
481
426
|
import { isDefined as isDefined3 } from "@xylabs/typeof";
|
|
482
427
|
import { isHydratedTransaction } from "@xyo-network/xl1-protocol";
|
|
483
428
|
import { validateTransaction } from "@xyo-network/xl1-validation";
|
|
484
|
-
import
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
ref,
|
|
488
|
-
...props
|
|
489
|
-
}), "InvalidIcon");
|
|
429
|
+
import { useMemo as useMemo4 } from "react";
|
|
430
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
431
|
+
var InvalidIcon2 = ({ ref, ...props }) => /* @__PURE__ */ jsx7(CancelRoundedIcon2, { color: "error", ref, ...props });
|
|
490
432
|
InvalidIcon2.displayName = "InvalidIcon";
|
|
491
|
-
var TransactionVerification =
|
|
433
|
+
var TransactionVerification = ({ transaction, ...props }) => {
|
|
492
434
|
const [validationErrors, validateError] = usePromise4(async () => {
|
|
493
435
|
if (isDefined3(transaction)) {
|
|
494
436
|
const resolvedTransaction = assertEx2(isHydratedTransaction(transaction) ? transaction : void 0, () => "Transaction must be a HydratedTransaction");
|
|
495
437
|
return await validateTransaction(resolvedTransaction);
|
|
496
438
|
}
|
|
497
|
-
}, [
|
|
498
|
-
transaction
|
|
499
|
-
]);
|
|
439
|
+
}, [transaction]);
|
|
500
440
|
const resolvedErrors = useMemo4(() => {
|
|
501
441
|
const errors = [];
|
|
502
442
|
if (isDefined3(validationErrors)) {
|
|
@@ -505,52 +445,53 @@ var TransactionVerification = /* @__PURE__ */ __name(({ transaction, ...props })
|
|
|
505
445
|
if (isDefined3(validateError)) errors.push(validateError);
|
|
506
446
|
return errors;
|
|
507
447
|
}
|
|
508
|
-
}, [
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
]);
|
|
512
|
-
return /* @__PURE__ */ React7.createElement(ErrorQuickTipButton2, {
|
|
513
|
-
boundWitnessType: "Transaction",
|
|
514
|
-
errors: resolvedErrors,
|
|
515
|
-
...props
|
|
516
|
-
});
|
|
517
|
-
}, "TransactionVerification");
|
|
448
|
+
}, [validateError, validationErrors]);
|
|
449
|
+
return /* @__PURE__ */ jsx7(ErrorQuickTipButton2, { boundWitnessType: "Transaction", errors: resolvedErrors, ...props });
|
|
450
|
+
};
|
|
518
451
|
|
|
519
452
|
// src/components/transactions/card/actions/TransactionActions.tsx
|
|
520
|
-
|
|
453
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
454
|
+
var TransactionActions = ({
|
|
455
|
+
transaction,
|
|
456
|
+
validationIconColors = false,
|
|
457
|
+
...props
|
|
458
|
+
}) => {
|
|
521
459
|
const txBw = transaction?.[0];
|
|
522
460
|
const hash = usePayloadHash3(txBw);
|
|
523
|
-
return /* @__PURE__ */
|
|
524
|
-
boundwitness: txBw
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
wordBreak: "break-all"
|
|
538
|
-
}
|
|
539
|
-
}, transaction ? JSON.stringify(transaction, null, 2) : null)));
|
|
540
|
-
}, "TransactionActions");
|
|
461
|
+
return /* @__PURE__ */ jsxs5(FlexRow2, { ...props, children: [
|
|
462
|
+
txBw?.previous_hashes.length === 0 ? null : /* @__PURE__ */ jsx8(BWPreviousHashQuickTipButton2, { boundwitness: txBw }),
|
|
463
|
+
/* @__PURE__ */ jsx8(TransactionVerification, { iconColors: validationIconColors, transaction }),
|
|
464
|
+
/* @__PURE__ */ jsx8(
|
|
465
|
+
QuickTipButton2,
|
|
466
|
+
{
|
|
467
|
+
Icon: DataObjectIcon2,
|
|
468
|
+
title: `JSON for ${ellipsize2(hash ?? "", 8)}`,
|
|
469
|
+
dialogProps: { fullWidth: true, maxWidth: "md" },
|
|
470
|
+
children: /* @__PURE__ */ jsx8("pre", { style: { wordBreak: "break-all" }, children: transaction ? JSON.stringify(transaction, null, 2) : null })
|
|
471
|
+
}
|
|
472
|
+
)
|
|
473
|
+
] });
|
|
474
|
+
};
|
|
541
475
|
|
|
542
476
|
// src/components/transactions/card/Card.tsx
|
|
543
|
-
import {
|
|
477
|
+
import {
|
|
478
|
+
Card as Card2,
|
|
479
|
+
CardContent as CardContent2,
|
|
480
|
+
CardHeader as CardHeader2,
|
|
481
|
+
Grid as Grid2,
|
|
482
|
+
Link as Link2,
|
|
483
|
+
Tooltip as Tooltip3,
|
|
484
|
+
Typography as Typography2
|
|
485
|
+
} from "@mui/material";
|
|
544
486
|
import { BlockiesAvatarAddress as BlockiesAvatarAddress2 } from "@xyo-network/react-chain-blockies";
|
|
545
487
|
import { DetailsStack as DetailsStack2, LabelValueStack as LabelValueStack2 } from "@xyo-network/react-chain-shared";
|
|
546
488
|
import { useEvent as useEvent2 } from "@xyo-network/react-event";
|
|
547
|
-
import React9 from "react";
|
|
548
489
|
import { GiReceiveMoney, GiSandsOfTime } from "react-icons/gi";
|
|
549
490
|
import { IoStatsChartOutline as IoStatsChartOutline2 } from "react-icons/io5";
|
|
550
491
|
|
|
551
492
|
// src/components/transactions/card/hooks/useDetails.ts
|
|
552
493
|
import { useMemo as useMemo5 } from "react";
|
|
553
|
-
var useTransactionDetails =
|
|
494
|
+
var useTransactionDetails = (wrapper) => {
|
|
554
495
|
const stats = useMemo5(() => {
|
|
555
496
|
const stats2 = {
|
|
556
497
|
"Reward": formatNumber(wrapper.reward()),
|
|
@@ -560,9 +501,7 @@ var useTransactionDetails = /* @__PURE__ */ __name((wrapper) => {
|
|
|
560
501
|
"Signatures": formatNumber(wrapper.signatureCount)
|
|
561
502
|
};
|
|
562
503
|
return formatResults(stats2);
|
|
563
|
-
}, [
|
|
564
|
-
wrapper
|
|
565
|
-
]);
|
|
504
|
+
}, [wrapper]);
|
|
566
505
|
const fees = useMemo5(() => {
|
|
567
506
|
const fees2 = {
|
|
568
507
|
"Base": formatFee(wrapper.fees.base),
|
|
@@ -571,113 +510,112 @@ var useTransactionDetails = /* @__PURE__ */ __name((wrapper) => {
|
|
|
571
510
|
"Gas Limit": formatFee(wrapper.fees.gasLimit)
|
|
572
511
|
};
|
|
573
512
|
return formatResults(fees2);
|
|
574
|
-
}, [
|
|
575
|
-
wrapper
|
|
576
|
-
]);
|
|
513
|
+
}, [wrapper]);
|
|
577
514
|
const blockDuration = useMemo5(() => {
|
|
578
515
|
const blockDuration2 = {
|
|
579
516
|
"Expiration": wrapper.boundWitness.exp.toLocaleString(navigator.language ?? "en-US"),
|
|
580
517
|
"Not Before": wrapper.boundWitness.nbf.toLocaleString(navigator.language ?? "en-US")
|
|
581
518
|
};
|
|
582
519
|
return formatResults(blockDuration2);
|
|
583
|
-
}, [
|
|
584
|
-
wrapper
|
|
585
|
-
]);
|
|
520
|
+
}, [wrapper]);
|
|
586
521
|
return {
|
|
587
522
|
stats,
|
|
588
523
|
fees,
|
|
589
524
|
blockDuration
|
|
590
525
|
};
|
|
591
|
-
}
|
|
526
|
+
};
|
|
592
527
|
|
|
593
528
|
// src/components/transactions/card/Card.tsx
|
|
594
|
-
|
|
529
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
530
|
+
var TransactionBoundWitnessCard = ({
|
|
531
|
+
linkedAddress = true,
|
|
532
|
+
wrapper,
|
|
533
|
+
...props
|
|
534
|
+
}) => {
|
|
595
535
|
if (!wrapper) return null;
|
|
596
|
-
const {
|
|
536
|
+
const {
|
|
537
|
+
stats,
|
|
538
|
+
fees,
|
|
539
|
+
blockDuration
|
|
540
|
+
} = useTransactionDetails(wrapper);
|
|
597
541
|
const [ref, dispatch] = useEvent2();
|
|
598
|
-
return /* @__PURE__ */
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
542
|
+
return /* @__PURE__ */ jsxs6(Card2, { ref, ...props, children: [
|
|
543
|
+
/* @__PURE__ */ jsx9(
|
|
544
|
+
CardHeader2,
|
|
545
|
+
{
|
|
546
|
+
title: /* @__PURE__ */ jsx9(
|
|
547
|
+
Typography2,
|
|
548
|
+
{
|
|
549
|
+
onClick: () => linkedAddress && dispatch("address", "click", wrapper.boundWitness.from),
|
|
550
|
+
variant: "body2",
|
|
551
|
+
sx: {
|
|
552
|
+
maxWidth: "100%",
|
|
553
|
+
textOverflow: "ellipsis",
|
|
554
|
+
overflow: "hidden",
|
|
555
|
+
fontFamily: "monospace"
|
|
556
|
+
},
|
|
557
|
+
children: linkedAddress ? /* @__PURE__ */ jsx9(Link2, { sx: { cursor: "pointer" }, children: wrapper?.boundWitness.from }) : wrapper?.boundWitness.from
|
|
558
|
+
}
|
|
559
|
+
),
|
|
560
|
+
avatar: /* @__PURE__ */ jsx9(Tooltip3, { title: `From Address - ${wrapper?.boundWitness.from}`, children: /* @__PURE__ */ jsx9(
|
|
561
|
+
BlockiesAvatarAddress2,
|
|
562
|
+
{
|
|
563
|
+
address: wrapper?.boundWitness.from,
|
|
564
|
+
onClick: () => dispatch("address", "click", wrapper.boundWitness.from),
|
|
565
|
+
size: 21,
|
|
566
|
+
sx: { cursor: "pointer" }
|
|
567
|
+
}
|
|
568
|
+
) })
|
|
624
569
|
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
}
|
|
664
|
-
}, /* @__PURE__ */ React9.createElement(DetailsStack2, {
|
|
665
|
-
IconComponent: GiSandsOfTime,
|
|
666
|
-
heading: "Block Duration",
|
|
667
|
-
tooltipTitle: "Block window for the transaction to be valid"
|
|
668
|
-
}, /* @__PURE__ */ React9.createElement(LabelValueStack2, {
|
|
669
|
-
labels: blockDuration.labels,
|
|
670
|
-
values: blockDuration.values
|
|
671
|
-
}))))));
|
|
672
|
-
}, "TransactionBoundWitnessCard");
|
|
570
|
+
),
|
|
571
|
+
/* @__PURE__ */ jsx9(CardContent2, { children: /* @__PURE__ */ jsxs6(Grid2, { container: true, spacing: 6, sx: { width: "100%" }, children: [
|
|
572
|
+
/* @__PURE__ */ jsx9(
|
|
573
|
+
Grid2,
|
|
574
|
+
{
|
|
575
|
+
size: {
|
|
576
|
+
xs: 12,
|
|
577
|
+
sm: 6,
|
|
578
|
+
md: 4
|
|
579
|
+
},
|
|
580
|
+
children: /* @__PURE__ */ jsx9(DetailsStack2, { IconComponent: IoStatsChartOutline2, heading: "Stats", tooltipTitle: "Transaction Statistics", children: /* @__PURE__ */ jsx9(LabelValueStack2, { labels: stats.labels, values: stats.values }) })
|
|
581
|
+
}
|
|
582
|
+
),
|
|
583
|
+
/* @__PURE__ */ jsx9(
|
|
584
|
+
Grid2,
|
|
585
|
+
{
|
|
586
|
+
size: {
|
|
587
|
+
xs: 12,
|
|
588
|
+
sm: 6,
|
|
589
|
+
md: 4
|
|
590
|
+
},
|
|
591
|
+
children: /* @__PURE__ */ jsx9(DetailsStack2, { IconComponent: GiReceiveMoney, heading: "Fees", tooltipTitle: "Fees offered to the producer", children: /* @__PURE__ */ jsx9(LabelValueStack2, { labels: fees.labels, values: fees.values }) })
|
|
592
|
+
}
|
|
593
|
+
),
|
|
594
|
+
/* @__PURE__ */ jsx9(
|
|
595
|
+
Grid2,
|
|
596
|
+
{
|
|
597
|
+
size: {
|
|
598
|
+
xs: 12,
|
|
599
|
+
sm: 6,
|
|
600
|
+
md: 4
|
|
601
|
+
},
|
|
602
|
+
children: /* @__PURE__ */ jsx9(DetailsStack2, { IconComponent: GiSandsOfTime, heading: "Block Duration", tooltipTitle: "Block window for the transaction to be valid", children: /* @__PURE__ */ jsx9(LabelValueStack2, { labels: blockDuration.labels, values: blockDuration.values }) })
|
|
603
|
+
}
|
|
604
|
+
)
|
|
605
|
+
] }) })
|
|
606
|
+
] });
|
|
607
|
+
};
|
|
673
608
|
|
|
674
609
|
// src/components/transactions/TransactionBoundWitnessDetails.tsx
|
|
675
610
|
import { ErrorRender as ErrorRender3 } from "@xylabs/react-error";
|
|
676
611
|
import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
|
|
677
612
|
import { usePromise as usePromise6 } from "@xylabs/react-promise";
|
|
678
|
-
import {
|
|
613
|
+
import {
|
|
614
|
+
BoundWitnessSignatureTable as BoundWitnessSignatureTable2,
|
|
615
|
+
HashHeadingPaper as HashHeadingPaper2,
|
|
616
|
+
HeadingPaper as HeadingPaper3
|
|
617
|
+
} from "@xyo-network/react-boundwitness-plugin";
|
|
679
618
|
import { HydratedTransactionWrapper } from "@xyo-network/xl1-wrappers";
|
|
680
|
-
import React10 from "react";
|
|
681
619
|
import { FaSignature as FaSignature2 } from "react-icons/fa";
|
|
682
620
|
import { VscSymbolNamespace as VscSymbolNamespace3 } from "react-icons/vsc";
|
|
683
621
|
|
|
@@ -688,41 +626,28 @@ import { isDefined as isDefined4 } from "@xylabs/typeof";
|
|
|
688
626
|
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
689
627
|
import { isSchema } from "@xyo-network/payload-model";
|
|
690
628
|
import { useMemo as useMemo6, useState } from "react";
|
|
691
|
-
var useTransactionPayloadTypes =
|
|
629
|
+
var useTransactionPayloadTypes = (wrapper) => {
|
|
692
630
|
const [elevatedPayloadSets, elevatedPayloadSetsError] = usePromise5(async () => {
|
|
693
631
|
if (isDefined4(wrapper)) {
|
|
694
632
|
const elevatedPayloads = wrapper.elevatedPayloads;
|
|
695
633
|
const pairs = await PayloadBuilder2.hashPairs(elevatedPayloads);
|
|
696
634
|
return formatPayloadsForTable(pairs);
|
|
697
635
|
} else {
|
|
698
|
-
return {
|
|
699
|
-
hashes: [],
|
|
700
|
-
schemas: []
|
|
701
|
-
};
|
|
636
|
+
return { hashes: [], schemas: [] };
|
|
702
637
|
}
|
|
703
|
-
}, [
|
|
704
|
-
wrapper
|
|
705
|
-
]);
|
|
638
|
+
}, [wrapper]);
|
|
706
639
|
const [publicPayloads, publicPayloadsError] = usePromise5(async () => {
|
|
707
640
|
if (isDefined4(wrapper)) {
|
|
708
641
|
const publicPayloads2 = wrapper.publicExternalPayloads;
|
|
709
642
|
const pairs = await PayloadBuilder2.hashPairs(publicPayloads2);
|
|
710
643
|
return formatPayloadsForTable(pairs);
|
|
711
644
|
} else {
|
|
712
|
-
return {
|
|
713
|
-
hashes: [],
|
|
714
|
-
schemas: []
|
|
715
|
-
};
|
|
645
|
+
return { hashes: [], schemas: [] };
|
|
716
646
|
}
|
|
717
|
-
}, [
|
|
718
|
-
wrapper
|
|
719
|
-
]);
|
|
647
|
+
}, [wrapper]);
|
|
720
648
|
const [referencedPayloadsError, setReferencedPayloadsError] = useState([]);
|
|
721
649
|
const referencedPayloads = useMemo6(() => {
|
|
722
|
-
const ret = {
|
|
723
|
-
hashes: [],
|
|
724
|
-
schemas: []
|
|
725
|
-
};
|
|
650
|
+
const ret = { hashes: [], schemas: [] };
|
|
726
651
|
if (isDefined4(wrapper)) {
|
|
727
652
|
const referencedPayloads2 = wrapper.privateExternalPayloads;
|
|
728
653
|
for (const [hash, schema] of Object.entries(referencedPayloads2)) {
|
|
@@ -736,20 +661,14 @@ var useTransactionPayloadTypes = /* @__PURE__ */ __name((wrapper) => {
|
|
|
736
661
|
resolved = true;
|
|
737
662
|
}
|
|
738
663
|
if (!resolved) {
|
|
739
|
-
setReferencedPayloadsError((prev) => [
|
|
740
|
-
...prev,
|
|
741
|
-
new Error(`Unexpected payload or schema type for hash ${hash}: ${schema}`)
|
|
742
|
-
]);
|
|
664
|
+
setReferencedPayloadsError((prev) => [...prev, new Error(`Unexpected payload or schema type for hash ${hash}: ${schema}`)]);
|
|
743
665
|
}
|
|
744
666
|
}
|
|
745
667
|
return ret;
|
|
746
668
|
} else {
|
|
747
669
|
return ret;
|
|
748
670
|
}
|
|
749
|
-
}, [
|
|
750
|
-
wrapper,
|
|
751
|
-
elevatedPayloadSets
|
|
752
|
-
]);
|
|
671
|
+
}, [wrapper, elevatedPayloadSets]);
|
|
753
672
|
const { hashes: elevatedPayloadHashes, schemas: elevatedPayloadSchemas } = elevatedPayloadSets ?? {};
|
|
754
673
|
const { hashes: publicPayloadHashes, schemas: publicPayloadSchemas } = publicPayloads ?? {};
|
|
755
674
|
const { hashes: referencedPayloadHashes, schemas: referencedPayloadSchemas } = referencedPayloads ?? {};
|
|
@@ -764,104 +683,90 @@ var useTransactionPayloadTypes = /* @__PURE__ */ __name((wrapper) => {
|
|
|
764
683
|
referencedPayloadSchemas,
|
|
765
684
|
referencedPayloadsError
|
|
766
685
|
};
|
|
767
|
-
}
|
|
686
|
+
};
|
|
768
687
|
|
|
769
688
|
// src/components/transactions/TransactionBoundWitnessDetails.tsx
|
|
689
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
770
690
|
var nonClickableFields = [];
|
|
771
|
-
var TransactionBoundWitnessDetails =
|
|
691
|
+
var TransactionBoundWitnessDetails = ({ transaction, ...props }) => {
|
|
772
692
|
const [wrapper, wrapperError] = usePromise6(async () => {
|
|
773
693
|
if (transaction) {
|
|
774
694
|
return await HydratedTransactionWrapper.parse(transaction);
|
|
775
695
|
}
|
|
776
|
-
}, [
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
696
|
+
}, [transaction]);
|
|
697
|
+
const {
|
|
698
|
+
elevatedPayloadHashes,
|
|
699
|
+
elevatedPayloadSchemas,
|
|
700
|
+
elevatedPayloadSetsError,
|
|
701
|
+
publicPayloadHashes,
|
|
702
|
+
publicPayloadSchemas,
|
|
703
|
+
publicPayloadsError,
|
|
704
|
+
referencedPayloadHashes,
|
|
705
|
+
referencedPayloadSchemas,
|
|
706
|
+
referencedPayloadsError
|
|
707
|
+
} = useTransactionPayloadTypes(wrapper);
|
|
708
|
+
return /* @__PURE__ */ jsxs7(FlexCol3, { alignItems: "stretch", rowGap: 2, ...props, children: [
|
|
709
|
+
/* @__PURE__ */ jsx10(
|
|
710
|
+
HashHeadingPaper2,
|
|
711
|
+
{
|
|
712
|
+
hash: wrapper?.boundWitness?._hash,
|
|
713
|
+
paperProps: { sx: { p: 2 } },
|
|
714
|
+
AdornmentEnd: /* @__PURE__ */ jsx10(TransactionActions, { transaction }),
|
|
715
|
+
identiconProps: { p: 0.75, size: 24 }
|
|
789
716
|
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
}),
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
}), (referencedPayloadHashes?.length ?? 0) > 0 && /* @__PURE__ */ React10.createElement(PayloadTableFlexbox, {
|
|
844
|
-
// TODO - bring back once the hashes can be searched via datalake
|
|
845
|
-
tooltip: "Payload hashes referenced by the transaction but not included.",
|
|
846
|
-
IconComponent: /* @__PURE__ */ React10.createElement(VscSymbolNamespace3, null),
|
|
847
|
-
clickableFields: nonClickableFields,
|
|
848
|
-
hashes: referencedPayloadHashes,
|
|
849
|
-
headingTitle: "Referenced Payloads",
|
|
850
|
-
schemas: referencedPayloadSchemas,
|
|
851
|
-
sx: {
|
|
852
|
-
mb: 1
|
|
853
|
-
}
|
|
854
|
-
}), /* @__PURE__ */ React10.createElement(FlexCol3, {
|
|
855
|
-
alignItems: "stretch",
|
|
856
|
-
rowGap: 1,
|
|
857
|
-
mb: 1
|
|
858
|
-
}, /* @__PURE__ */ React10.createElement(HeadingPaper3, {
|
|
859
|
-
IconComponent: /* @__PURE__ */ React10.createElement(FaSignature2, null),
|
|
860
|
-
heading: "Signatures"
|
|
861
|
-
}), /* @__PURE__ */ React10.createElement(BoundWitnessSignatureTable2, {
|
|
862
|
-
block: wrapper?.boundWitness
|
|
863
|
-
})));
|
|
864
|
-
}, "TransactionBoundWitnessDetails");
|
|
717
|
+
),
|
|
718
|
+
/* @__PURE__ */ jsx10(ErrorRender3, { error: wrapperError, scope: "wrapperError:TransactionBoundWitnessDetails.tsx" }),
|
|
719
|
+
/* @__PURE__ */ jsx10(ErrorRender3, { error: elevatedPayloadSetsError, scope: "elevatedPayloadSetsError:TransactionBoundWitnessDetails.tsx" }),
|
|
720
|
+
/* @__PURE__ */ jsx10(ErrorRender3, { error: publicPayloadsError, scope: "publicPayloadsError:TransactionBoundWitnessDetails.tsx" }),
|
|
721
|
+
referencedPayloadsError.map((error, index) => (
|
|
722
|
+
// eslint-disable-next-line @eslint-react/no-array-index-key
|
|
723
|
+
/* @__PURE__ */ jsx10(ErrorRender3, { error, scope: "referencedPayloadsError:TransactionBoundWitnessDetails.tsx" }, index)
|
|
724
|
+
)),
|
|
725
|
+
/* @__PURE__ */ jsx10(TransactionBoundWitnessCard, { elevation: 4, wrapper }),
|
|
726
|
+
/* @__PURE__ */ jsx10(
|
|
727
|
+
PayloadTableFlexbox,
|
|
728
|
+
{
|
|
729
|
+
eventNoun: "payload",
|
|
730
|
+
clickableFields: ["hash"],
|
|
731
|
+
tooltip: "Payloads included in the transaction that are elevated and validated.",
|
|
732
|
+
IconComponent: /* @__PURE__ */ jsx10(VscSymbolNamespace3, {}),
|
|
733
|
+
hashes: elevatedPayloadHashes,
|
|
734
|
+
headingTitle: "On Chain Payloads",
|
|
735
|
+
schemas: elevatedPayloadSchemas,
|
|
736
|
+
sx: { mb: 1 }
|
|
737
|
+
}
|
|
738
|
+
),
|
|
739
|
+
(publicPayloadHashes?.length ?? 0) > 0 && /* @__PURE__ */ jsx10(
|
|
740
|
+
PayloadTableFlexbox,
|
|
741
|
+
{
|
|
742
|
+
eventNoun: "payload",
|
|
743
|
+
clickableFields: ["hash"],
|
|
744
|
+
tooltip: "Public payloads included in the transaction.",
|
|
745
|
+
IconComponent: /* @__PURE__ */ jsx10(VscSymbolNamespace3, {}),
|
|
746
|
+
hashes: publicPayloadHashes,
|
|
747
|
+
headingTitle: "Public Payloads",
|
|
748
|
+
schemas: publicPayloadSchemas,
|
|
749
|
+
sx: { mb: 1 }
|
|
750
|
+
}
|
|
751
|
+
),
|
|
752
|
+
(referencedPayloadHashes?.length ?? 0) > 0 && /* @__PURE__ */ jsx10(
|
|
753
|
+
PayloadTableFlexbox,
|
|
754
|
+
{
|
|
755
|
+
tooltip: "Payload hashes referenced by the transaction but not included.",
|
|
756
|
+
IconComponent: /* @__PURE__ */ jsx10(VscSymbolNamespace3, {}),
|
|
757
|
+
clickableFields: nonClickableFields,
|
|
758
|
+
hashes: referencedPayloadHashes,
|
|
759
|
+
headingTitle: "Referenced Payloads",
|
|
760
|
+
schemas: referencedPayloadSchemas,
|
|
761
|
+
sx: { mb: 1 }
|
|
762
|
+
}
|
|
763
|
+
),
|
|
764
|
+
/* @__PURE__ */ jsxs7(FlexCol3, { alignItems: "stretch", rowGap: 1, mb: 1, children: [
|
|
765
|
+
/* @__PURE__ */ jsx10(HeadingPaper3, { IconComponent: /* @__PURE__ */ jsx10(FaSignature2, {}), heading: "Signatures" }),
|
|
766
|
+
/* @__PURE__ */ jsx10(BoundWitnessSignatureTable2, { block: wrapper?.boundWitness })
|
|
767
|
+
] })
|
|
768
|
+
] });
|
|
769
|
+
};
|
|
865
770
|
export {
|
|
866
771
|
BlockBoundWitnessDetails,
|
|
867
772
|
PayloadTableFlexbox,
|