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