@xyo-network/react-chain-boundwitness 1.3.24 → 1.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.mjs +235 -17
- package/dist/browser/index.mjs.map +1 -1
- package/dist/types/components/block/BlockBoundWitnessDetails.d.ts.map +1 -0
- package/dist/types/components/block/index.d.ts +2 -0
- package/dist/types/components/block/index.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/transactions/TransactionDetails.d.ts +8 -0
- package/dist/types/components/transactions/TransactionDetails.d.ts.map +1 -0
- package/dist/types/components/transactions/card/Card.d.ts +8 -0
- package/dist/types/components/transactions/card/Card.d.ts.map +1 -0
- package/dist/types/components/transactions/card/DetailsStack.d.ts +9 -0
- package/dist/types/components/transactions/card/DetailsStack.d.ts.map +1 -0
- package/dist/types/components/transactions/card/index.d.ts +2 -0
- package/dist/types/components/transactions/card/index.d.ts.map +1 -0
- package/dist/types/components/transactions/index.d.ts +2 -0
- package/dist/types/components/transactions/index.d.ts.map +1 -0
- package/dist/types/lib/formatPayloadsForTable.d.ts +7 -0
- package/dist/types/lib/formatPayloadsForTable.d.ts.map +1 -0
- package/dist/types/lib/index.d.ts +2 -0
- package/dist/types/lib/index.d.ts.map +1 -0
- package/package.json +10 -6
- package/src/components/BwPayloadTable.tsx +7 -7
- package/src/components/{BlockBoundWitnessDetails.tsx → block/BlockBoundWitnessDetails.tsx} +14 -26
- package/src/components/block/index.ts +1 -0
- package/src/components/index.ts +2 -1
- package/src/components/transactions/TransactionDetails.stories.tsx +22 -0
- package/src/components/transactions/TransactionDetails.tsx +69 -0
- package/src/components/transactions/card/Card.tsx +121 -0
- package/src/components/transactions/card/DetailsStack.tsx +35 -0
- package/src/components/transactions/card/index.ts +1 -0
- package/src/components/transactions/index.ts +1 -0
- package/src/lib/formatPayloadsForTable.ts +12 -0
- package/src/lib/index.ts +1 -0
- package/dist/types/components/BlockBoundWitnessDetails.d.ts.map +0 -1
- /package/dist/types/components/{BlockBoundWitnessDetails.d.ts → block/BlockBoundWitnessDetails.d.ts} +0 -0
- /package/src/components/{BlockBoundWitnessDetails.stories.tsx → block/BlockBoundWitnessDetails.stories.tsx} +0 -0
package/dist/browser/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
-
// src/components/BlockBoundWitnessDetails.tsx
|
|
4
|
+
// src/components/block/BlockBoundWitnessDetails.tsx
|
|
5
5
|
import { Divider } from "@mui/material";
|
|
6
6
|
import { filterAs } from "@xylabs/array";
|
|
7
7
|
import { ErrorRender } from "@xylabs/react-error";
|
|
@@ -18,6 +18,20 @@ import { FaSignature } from "react-icons/fa";
|
|
|
18
18
|
import { GrTransaction } from "react-icons/gr";
|
|
19
19
|
import { VscSymbolMethod as VscSymbolMethod2, VscSymbolNamespace } from "react-icons/vsc";
|
|
20
20
|
|
|
21
|
+
// src/lib/formatPayloadsForTable.ts
|
|
22
|
+
var formatPayloadsForTable = /* @__PURE__ */ __name((pairs) => {
|
|
23
|
+
let hashes = [];
|
|
24
|
+
let schemas = [];
|
|
25
|
+
for (const [bw, hash] of pairs ?? []) {
|
|
26
|
+
hashes.push(hash);
|
|
27
|
+
schemas.push(bw?.schema ?? "");
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
hashes,
|
|
31
|
+
schemas
|
|
32
|
+
};
|
|
33
|
+
}, "formatPayloadsForTable");
|
|
34
|
+
|
|
21
35
|
// src/components/BwPayloadTable.tsx
|
|
22
36
|
import { FlexCol } from "@xylabs/react-flexbox";
|
|
23
37
|
import { BoundWitnessPayloadTableBody, BoundWitnessPayloadTableHead, HeadingPaper } from "@xyo-network/react-boundwitness-plugin";
|
|
@@ -40,25 +54,13 @@ var BWPayloadTableFlexbox = /* @__PURE__ */ __name(({ IconComponent, eventNoun,
|
|
|
40
54
|
})));
|
|
41
55
|
}, "BWPayloadTableFlexbox");
|
|
42
56
|
|
|
43
|
-
// src/components/BlockBoundWitnessDetails.tsx
|
|
44
|
-
var formatBwsForTable = /* @__PURE__ */ __name((pairs) => {
|
|
45
|
-
let hashes = [];
|
|
46
|
-
let schemas = [];
|
|
47
|
-
for (const [bw, hash] of pairs ?? []) {
|
|
48
|
-
hashes.push(hash);
|
|
49
|
-
schemas.push(bw?.schema ?? "");
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
hashes,
|
|
53
|
-
schemas
|
|
54
|
-
};
|
|
55
|
-
}, "formatBwsForTable");
|
|
57
|
+
// src/components/block/BlockBoundWitnessDetails.tsx
|
|
56
58
|
var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ block, paper, children, ...props }) => {
|
|
57
59
|
const boundWitness = block?.[0];
|
|
58
60
|
const payloads = block?.[1];
|
|
59
61
|
const hash = usePayloadHash(boundWitness);
|
|
60
62
|
const [transactions, txFromBlockError] = useTxsFromBlock(block);
|
|
61
|
-
const { hashes: txHashes, schemas: txSchemas } = useMemo(() =>
|
|
63
|
+
const { hashes: txHashes, schemas: txSchemas } = useMemo(() => formatPayloadsForTable(transactions ?? []), [
|
|
62
64
|
transactions
|
|
63
65
|
]);
|
|
64
66
|
const [nonTxBoundWitnesses, bwsFromBlockError] = usePromise(async () => {
|
|
@@ -67,7 +69,7 @@ var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ block, paper, children,
|
|
|
67
69
|
}, [
|
|
68
70
|
payloads
|
|
69
71
|
]);
|
|
70
|
-
const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } = useMemo(() =>
|
|
72
|
+
const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } = useMemo(() => formatPayloadsForTable(nonTxBoundWitnesses ?? []), [
|
|
71
73
|
nonTxBoundWitnesses
|
|
72
74
|
]);
|
|
73
75
|
const hasNonTxBoundWitnesses = (nonTxBoundWitnesses?.length ?? 0) > 0;
|
|
@@ -132,8 +134,224 @@ var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ block, paper, children,
|
|
|
132
134
|
block: boundWitness
|
|
133
135
|
})));
|
|
134
136
|
}, "BlockBoundWitnessDetails");
|
|
137
|
+
|
|
138
|
+
// src/components/transactions/TransactionDetails.tsx
|
|
139
|
+
import { Divider as Divider2 } from "@mui/material";
|
|
140
|
+
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
141
|
+
import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
|
|
142
|
+
import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
143
|
+
import { isDefined } from "@xylabs/typeof";
|
|
144
|
+
import { SignedHydratedTransactionWrapper } from "@xyo-network/chain-wrappers";
|
|
145
|
+
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
146
|
+
import { BoundWitnessSignatureTable as BoundWitnessSignatureTable2, BWActions as BWActions2, HashHeadingPaper as HashHeadingPaper2, HeadingPaper as HeadingPaper3 } from "@xyo-network/react-boundwitness-plugin";
|
|
147
|
+
import React5 from "react";
|
|
148
|
+
import { FaSignature as FaSignature2 } from "react-icons/fa";
|
|
149
|
+
import { VscSymbolMethod as VscSymbolMethod3 } from "react-icons/vsc";
|
|
150
|
+
|
|
151
|
+
// src/components/transactions/card/Card.tsx
|
|
152
|
+
import { Card, CardContent, Grid, Typography as Typography2 } from "@mui/material";
|
|
153
|
+
import { isUndefined } from "@xylabs/typeof";
|
|
154
|
+
import { bigIntToFixedPointString } from "@xyo-network/chain-utils";
|
|
155
|
+
import React4, { useCallback } from "react";
|
|
156
|
+
import { GiReceiveMoney, GiSandsOfTime } from "react-icons/gi";
|
|
157
|
+
import { IoStatsChartOutline } from "react-icons/io5";
|
|
158
|
+
import { MdOutlineAlternateEmail } from "react-icons/md";
|
|
159
|
+
|
|
160
|
+
// src/components/transactions/card/DetailsStack.tsx
|
|
161
|
+
import { Icon, Stack, styled, Typography } from "@mui/material";
|
|
162
|
+
import React3 from "react";
|
|
163
|
+
var DetailsStack = /* @__PURE__ */ __name(({ IconComponent, heading, children, ...props }) => {
|
|
164
|
+
return /* @__PURE__ */ React3.createElement(Stack, {
|
|
165
|
+
direction: "row",
|
|
166
|
+
mb: 1,
|
|
167
|
+
gap: 1,
|
|
168
|
+
...props
|
|
169
|
+
}, IconComponent && /* @__PURE__ */ React3.createElement(Icon, {
|
|
170
|
+
fontSize: "small",
|
|
171
|
+
sx: {
|
|
172
|
+
mr: 0.25
|
|
173
|
+
}
|
|
174
|
+
}, /* @__PURE__ */ React3.createElement(IconComponent, {
|
|
175
|
+
style: {
|
|
176
|
+
height: "0.7em"
|
|
177
|
+
}
|
|
178
|
+
})), /* @__PURE__ */ React3.createElement(Stack, {
|
|
179
|
+
direction: "column",
|
|
180
|
+
flexWrap: "wrap",
|
|
181
|
+
mb: 1
|
|
182
|
+
}, /* @__PURE__ */ React3.createElement(SectionHeadingTypography, null, heading), children));
|
|
183
|
+
}, "DetailsStack");
|
|
184
|
+
var SectionHeadingTypography = styled(Typography, {
|
|
185
|
+
name: "SectionHeadingTypography"
|
|
186
|
+
})(({ theme }) => ({
|
|
187
|
+
display: "inline-flex",
|
|
188
|
+
alignItems: "baseline",
|
|
189
|
+
fontFamily: "monospace",
|
|
190
|
+
fontSize: 16,
|
|
191
|
+
marginBottom: theme.spacing(0.75)
|
|
192
|
+
}));
|
|
193
|
+
|
|
194
|
+
// src/components/transactions/card/Card.tsx
|
|
195
|
+
var TransactionBoundWitnessCard = /* @__PURE__ */ __name(({ wrapper, ...props }) => {
|
|
196
|
+
if (!wrapper) return null;
|
|
197
|
+
const formatFee = useCallback((fee) => {
|
|
198
|
+
if (isUndefined(fee)) return;
|
|
199
|
+
return bigIntToFixedPointString(fee, 12);
|
|
200
|
+
}, []);
|
|
201
|
+
return /* @__PURE__ */ React4.createElement(Card, props, /* @__PURE__ */ React4.createElement(CardContent, {
|
|
202
|
+
sx: {
|
|
203
|
+
display: "flex",
|
|
204
|
+
flexDirection: "row",
|
|
205
|
+
gap: 2,
|
|
206
|
+
flexWrap: "wrap"
|
|
207
|
+
}
|
|
208
|
+
}, /* @__PURE__ */ React4.createElement(Grid, {
|
|
209
|
+
container: true,
|
|
210
|
+
spacing: 3,
|
|
211
|
+
sx: {
|
|
212
|
+
width: "100%"
|
|
213
|
+
}
|
|
214
|
+
}, /* @__PURE__ */ React4.createElement(Grid, {
|
|
215
|
+
size: {
|
|
216
|
+
xs: 12
|
|
217
|
+
}
|
|
218
|
+
}, /* @__PURE__ */ React4.createElement(DetailsStack, {
|
|
219
|
+
IconComponent: MdOutlineAlternateEmail,
|
|
220
|
+
heading: "From:"
|
|
221
|
+
}, /* @__PURE__ */ React4.createElement(Typography2, {
|
|
222
|
+
variant: "body2",
|
|
223
|
+
sx: {
|
|
224
|
+
maxWidth: "100%",
|
|
225
|
+
textOverflow: "ellipsis",
|
|
226
|
+
overflow: "hidden"
|
|
227
|
+
}
|
|
228
|
+
}, wrapper?.boundWitness.from))), /* @__PURE__ */ React4.createElement(Grid, {
|
|
229
|
+
size: {
|
|
230
|
+
xs: 12,
|
|
231
|
+
sm: 6,
|
|
232
|
+
md: 4
|
|
233
|
+
}
|
|
234
|
+
}, /* @__PURE__ */ React4.createElement(DetailsStack, {
|
|
235
|
+
IconComponent: IoStatsChartOutline,
|
|
236
|
+
heading: "Stats"
|
|
237
|
+
}, /* @__PURE__ */ React4.createElement(Typography2, {
|
|
238
|
+
variant: "body2"
|
|
239
|
+
}, "Reward:", " ", wrapper?.reward()), /* @__PURE__ */ React4.createElement(Typography2, {
|
|
240
|
+
variant: "body2"
|
|
241
|
+
}, "Elevated Payloads:", " ", wrapper?.elevatedPayloadCount), /* @__PURE__ */ React4.createElement(Typography2, {
|
|
242
|
+
variant: "body2"
|
|
243
|
+
}, "Total Payloads:", " ", wrapper?.payloadCount), /* @__PURE__ */ React4.createElement(Typography2, {
|
|
244
|
+
variant: "body2"
|
|
245
|
+
}, "Signatures:", " ", wrapper?.signatureCount))), /* @__PURE__ */ React4.createElement(Grid, {
|
|
246
|
+
size: {
|
|
247
|
+
xs: 12,
|
|
248
|
+
sm: 6,
|
|
249
|
+
md: 4
|
|
250
|
+
}
|
|
251
|
+
}, /* @__PURE__ */ React4.createElement(DetailsStack, {
|
|
252
|
+
IconComponent: GiReceiveMoney,
|
|
253
|
+
heading: "Fees"
|
|
254
|
+
}, /* @__PURE__ */ React4.createElement(Typography2, {
|
|
255
|
+
variant: "body2"
|
|
256
|
+
}, "Base:", " ", formatFee(wrapper?.fees.base)), /* @__PURE__ */ React4.createElement(Typography2, {
|
|
257
|
+
variant: "body2"
|
|
258
|
+
}, "Gas:", " ", formatFee(wrapper?.fees.gasPrice)), /* @__PURE__ */ React4.createElement(Typography2, {
|
|
259
|
+
variant: "body2"
|
|
260
|
+
}, "Priority:", " ", formatFee(wrapper?.fees.priority)), /* @__PURE__ */ React4.createElement(Typography2, {
|
|
261
|
+
variant: "body2"
|
|
262
|
+
}, "Gas Limit:", " ", formatFee(wrapper?.fees.gasLimit)))), /* @__PURE__ */ React4.createElement(Grid, {
|
|
263
|
+
size: {
|
|
264
|
+
xs: 12,
|
|
265
|
+
sm: 6,
|
|
266
|
+
md: 4
|
|
267
|
+
}
|
|
268
|
+
}, /* @__PURE__ */ React4.createElement(DetailsStack, {
|
|
269
|
+
IconComponent: GiSandsOfTime,
|
|
270
|
+
heading: "Block Duration"
|
|
271
|
+
}, /* @__PURE__ */ React4.createElement(Typography2, {
|
|
272
|
+
variant: "body2"
|
|
273
|
+
}, "Expiration:", " ", wrapper?.boundWitness.exp), /* @__PURE__ */ React4.createElement(Typography2, {
|
|
274
|
+
variant: "body2"
|
|
275
|
+
}, "Not Before:", " ", wrapper?.boundWitness?.nbf))))));
|
|
276
|
+
}, "TransactionBoundWitnessCard");
|
|
277
|
+
|
|
278
|
+
// src/components/transactions/TransactionDetails.tsx
|
|
279
|
+
var TransactionBoundWitnessDetails = /* @__PURE__ */ __name(({ transaction, ...props }) => {
|
|
280
|
+
const [wrapper, wrapperError] = usePromise2(async () => {
|
|
281
|
+
if (transaction) {
|
|
282
|
+
return await SignedHydratedTransactionWrapper.parse(transaction);
|
|
283
|
+
}
|
|
284
|
+
}, [
|
|
285
|
+
transaction
|
|
286
|
+
]);
|
|
287
|
+
const [elevatedPayloadSets, elevatedPayloadSetsError] = usePromise2(async () => {
|
|
288
|
+
if (isDefined(wrapper)) {
|
|
289
|
+
const elevatedPayloads = wrapper.elevatedPayloads;
|
|
290
|
+
const pairs = await PayloadBuilder2.hashPairs(elevatedPayloads);
|
|
291
|
+
return formatPayloadsForTable(pairs);
|
|
292
|
+
} else {
|
|
293
|
+
return {
|
|
294
|
+
hashes: [],
|
|
295
|
+
schemas: []
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
}, [
|
|
299
|
+
wrapper
|
|
300
|
+
]);
|
|
301
|
+
const { hashes: elevatedPayloadHashes, schemas: elevatedPayloadSchemas } = elevatedPayloadSets ?? {};
|
|
302
|
+
return /* @__PURE__ */ React5.createElement(FlexCol3, {
|
|
303
|
+
alignItems: "stretch",
|
|
304
|
+
rowGap: 4,
|
|
305
|
+
...props
|
|
306
|
+
}, /* @__PURE__ */ React5.createElement(HashHeadingPaper2, {
|
|
307
|
+
hash: wrapper?.boundWitness?._hash,
|
|
308
|
+
paperProps: {
|
|
309
|
+
sx: {
|
|
310
|
+
p: 2
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
AdornmentEnd: /* @__PURE__ */ React5.createElement(BWActions2, {
|
|
314
|
+
boundwitness: wrapper?.boundWitness
|
|
315
|
+
}),
|
|
316
|
+
identiconProps: {
|
|
317
|
+
p: 0.75,
|
|
318
|
+
size: 24
|
|
319
|
+
}
|
|
320
|
+
}), /* @__PURE__ */ React5.createElement(ErrorRender2, {
|
|
321
|
+
error: wrapperError,
|
|
322
|
+
scope: "wrapperError:TransactionBoundWitnessDetails.tsx"
|
|
323
|
+
}), /* @__PURE__ */ React5.createElement(ErrorRender2, {
|
|
324
|
+
error: elevatedPayloadSetsError,
|
|
325
|
+
scope: "elevatedPayloadSetsError:TransactionBoundWitnessDetails.tsx"
|
|
326
|
+
}), /* @__PURE__ */ React5.createElement(Divider2, {
|
|
327
|
+
flexItem: true
|
|
328
|
+
}), /* @__PURE__ */ React5.createElement(TransactionBoundWitnessCard, {
|
|
329
|
+
elevation: 4,
|
|
330
|
+
wrapper
|
|
331
|
+
}), /* @__PURE__ */ React5.createElement(Divider2, {
|
|
332
|
+
flexItem: true
|
|
333
|
+
}), /* @__PURE__ */ React5.createElement(BWPayloadTableFlexbox, {
|
|
334
|
+
IconComponent: /* @__PURE__ */ React5.createElement(VscSymbolMethod3, null),
|
|
335
|
+
hashes: elevatedPayloadHashes,
|
|
336
|
+
headingTitle: "Elevated Payloads",
|
|
337
|
+
schemas: elevatedPayloadSchemas,
|
|
338
|
+
sx: {
|
|
339
|
+
mb: 1
|
|
340
|
+
}
|
|
341
|
+
}), /* @__PURE__ */ React5.createElement(FlexCol3, {
|
|
342
|
+
alignItems: "stretch",
|
|
343
|
+
rowGap: 1,
|
|
344
|
+
mb: 1
|
|
345
|
+
}, /* @__PURE__ */ React5.createElement(HeadingPaper3, {
|
|
346
|
+
IconComponent: /* @__PURE__ */ React5.createElement(FaSignature2, null),
|
|
347
|
+
heading: "Signatures"
|
|
348
|
+
}), /* @__PURE__ */ React5.createElement(BoundWitnessSignatureTable2, {
|
|
349
|
+
block: wrapper?.boundWitness
|
|
350
|
+
})));
|
|
351
|
+
}, "TransactionBoundWitnessDetails");
|
|
135
352
|
export {
|
|
136
353
|
BWPayloadTableFlexbox,
|
|
137
|
-
BlockBoundWitnessDetails
|
|
354
|
+
BlockBoundWitnessDetails,
|
|
355
|
+
TransactionBoundWitnessDetails
|
|
138
356
|
};
|
|
139
357
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/BlockBoundWitnessDetails.tsx","../../src/components/BwPayloadTable.tsx"],"sourcesContent":["import { Divider } from '@mui/material'\nimport { filterAs } from '@xylabs/array'\nimport type { Hash } from '@xylabs/hex'\nimport { ErrorRender } from '@xylabs/react-error'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport type { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport {\n BoundWitnessPayloadsTable,\n BoundWitnessSignatureTable,\n BWActions,\n HashHeadingPaper,\n HeadingPaper,\n} from '@xyo-network/react-boundwitness-plugin'\nimport { useTxsFromBlock } from '@xyo-network/react-chain-blockchain'\nimport { useEvent } from '@xyo-network/react-event'\nimport { usePayloadHash } from '@xyo-network/react-shared'\nimport { isTransactionBoundWitness, type SignedHydratedBlock } from '@xyo-network/xl1-protocol'\nimport React, { useMemo } from 'react'\nimport { FaSignature } from 'react-icons/fa'\nimport { GrTransaction } from 'react-icons/gr'\nimport { VscSymbolMethod, VscSymbolNamespace } from 'react-icons/vsc'\n\nimport type { TransactionBoundWitnessEvents } from '../types/index.ts'\nimport { BWPayloadTableFlexbox } from './BwPayloadTable.tsx'\n\nconst formatBwsForTable = (pairs: [BoundWitness, Hash][]) => {\n let hashes: Hash[] = []\n let schemas: string[] = []\n for (const [bw, hash] of pairs ?? []) {\n hashes.push(hash)\n schemas.push(bw?.schema ?? '')\n }\n return { hashes, schemas }\n}\n\nexport interface BoundWitnessDetailsProps extends FlexBoxProps {\n block?: SignedHydratedBlock\n}\n\nexport const BlockBoundWitnessDetails = ({\n block, paper, children, ...props\n}: BoundWitnessDetailsProps) => {\n const boundWitness = block?.[0]\n const payloads = block?.[1]\n\n const hash = usePayloadHash(boundWitness)\n\n const [transactions, txFromBlockError] = useTxsFromBlock(block)\n\n const { hashes: txHashes, schemas: txSchemas } = useMemo(() => formatBwsForTable(transactions ?? []), [transactions])\n\n const [nonTxBoundWitnesses, bwsFromBlockError] = usePromise(async () => {\n const bws = filterAs(payloads ?? [], payload =>\n (!isTransactionBoundWitness(payload) && isBoundWitness(payload)) ? payload : undefined)\n return await PayloadBuilder.hashPairs(bws)\n }, [payloads])\n\n const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } = useMemo(() => formatBwsForTable(nonTxBoundWitnesses ?? []), [nonTxBoundWitnesses])\n const hasNonTxBoundWitnesses = (nonTxBoundWitnesses?.length ?? 0) > 0\n\n return (\n <FlexCol alignItems=\"stretch\" rowGap={4} {...props}>\n <ErrorRender error={txFromBlockError ?? bwsFromBlockError} scope=\"BlockBoundWitnessDetails.tsx\" />\n <HashHeadingPaper\n hash={hash}\n paperProps={{ sx: { p: 2 } }}\n AdornmentEnd={<BWActions boundwitness={boundWitness} />}\n identiconProps={{ p: 0.75, size: 24 }}\n />\n <Divider flexItem />\n {(transactions?.length ?? 0) > 0 && (\n <BWPayloadTableFlexbox<TransactionBoundWitnessEvents>\n IconComponent={<GrTransaction />}\n eventNoun=\"transaction\"\n hashes={txHashes}\n headingTitle=\"Transactions\"\n schemas={txSchemas}\n sx={{ mb: 1 }}\n />\n )}\n <FlexCol alignItems=\"stretch\" rowGap={1} mb={1}>\n <HeadingPaper IconComponent={<VscSymbolNamespace />} heading=\"Payloads\" />\n <BoundWitnessPayloadsTable boundwitness={boundWitness} />\n </FlexCol>\n {hasNonTxBoundWitnesses\n ? (\n <BWPayloadTableFlexbox<TransactionBoundWitnessEvents>\n IconComponent={<VscSymbolMethod />}\n eventNoun=\"boundwitness\"\n hashes={nonTxBwHashes}\n headingTitle=\"Bound Witnesses\"\n schemas={nonTxBwSchemas}\n sx={{ mb: 1 }}\n />\n )\n : null}\n <FlexCol alignItems=\"stretch\" rowGap={1} mb={1}>\n <HeadingPaper IconComponent={<FaSignature />} heading=\"Signatures\" />\n <BoundWitnessSignatureTable block={boundWitness} />\n </FlexCol>\n </FlexCol>\n )\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport {\n BoundWitnessPayloadTableBody, BoundWitnessPayloadTableHead, HeadingPaper,\n} from '@xyo-network/react-boundwitness-plugin'\nimport type { EventNoun, ExtendEventNoun } from '@xyo-network/react-event'\nimport { TableEx } from '@xyo-network/react-table'\nimport React from 'react'\nimport { VscSymbolMethod } from 'react-icons/vsc'\n\nexport interface BWPayloadTableFlexboxProps<TNoun extends ExtendEventNoun = EventNoun> extends FlexBoxProps {\n IconComponent?: React.ReactNode\n eventNoun?: TNoun\n hashes?: Hash[]\n headingTitle?: string\n schemas?: string[]\n}\n\nexport const BWPayloadTableFlexbox = <TNoun extends ExtendEventNoun = EventNoun>({\n IconComponent,\n eventNoun,\n hashes,\n schemas,\n headingTitle,\n ...props\n}: BWPayloadTableFlexboxProps<TNoun>) => {\n const resolvedIconComponent = IconComponent ?? <VscSymbolMethod />\n return (\n <FlexCol alignItems=\"stretch\" rowGap={1} {...props}>\n <HeadingPaper IconComponent={resolvedIconComponent} heading={headingTitle} />\n <TableEx>\n <BoundWitnessPayloadTableHead />\n <BoundWitnessPayloadTableBody<TNoun> payloadHashes={hashes} payloadSchemas={schemas} eventNoun={eventNoun} />\n </TableEx>\n </FlexCol>\n )\n}\n"],"mappings":";;;;AAAA,SAASA,eAAe;AACxB,SAASC,gBAAgB;AAEzB,SAASC,mBAAmB;AAE5B,SAASC,WAAAA,gBAAe;AACxB,SAASC,kBAAkB;AAE3B,SAASC,sBAAsB;AAC/B,SAASC,sBAAsB;AAC/B,SACEC,2BACAC,4BACAC,WACAC,kBACAC,gBAAAA,qBACK;AACP,SAASC,uBAAuB;AAEhC,SAASC,sBAAsB;AAC/B,SAASC,iCAA2D;AACpE,OAAOC,UAASC,eAAe;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,qBAAqB;AAC9B,SAASC,mBA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;IAA0Bd,cAAcrC;OAE1CsB,yBAEG,gBAAAE,OAAA,cAACkB,uBAAAA;IACCC,eAAe,gBAAAnB,OAAA,cAAC4B,kBAAAA,IAAAA;IAChBP,WAAU;IACVxD,QAAQ+B;IACR0B,cAAa;IACbxD,SAAS+B;IACTY,IAAI;MAAEc,IAAI;IAAE;OAGd,MACJ,gBAAAvB,OAAA,cAACC,UAAAA;IAAQC,YAAW;IAAUC,QAAQ;IAAGoB,IAAI;KAC3C,gBAAAvB,OAAA,cAACwB,eAAAA;IAAaL,eAAe,gBAAAnB,OAAA,cAAC6B,aAAAA,IAAAA;IAAgBH,SAAQ;MACtD,gBAAA1B,OAAA,cAAC8B,4BAAAA;IAA2B1D,OAAOI;;AAI3C,GA/DwC;","names":["Divider","filterAs","ErrorRender","FlexCol","usePromise","isBoundWitness","PayloadBuilder","BoundWitnessPayloadsTable","BoundWitnessSignatureTable","BWActions","HashHeadingPaper","HeadingPaper","useTxsFromBlock","usePayloadHash","isTransactionBoundWitness","React","useMemo","FaSignature","GrTransaction","VscSymbolMethod","VscSymbolNamespace","FlexCol","BoundWitnessPayloadTableBody","BoundWitnessPayloadTableHead","HeadingPaper","TableEx","React","VscSymbolMethod","BWPayloadTableFlexbox","IconComponent","eventNoun","hashes","schemas","headingTitle","props","resolvedIconComponent","VscSymbolMethod","FlexCol","alignItems","rowGap","HeadingPaper","heading","TableEx","BoundWitnessPayloadTableHead","BoundWitnessPayloadTableBody","payloadHashes","payloadSchemas","formatBwsForTable","pairs","hashes","schemas","bw","hash","push","schema","BlockBoundWitnessDetails","block","paper","children","props","boundWitness","payloads","usePayloadHash","transactions","txFromBlockError","useTxsFromBlock","txHashes","txSchemas","useMemo","nonTxBoundWitnesses","bwsFromBlockError","usePromise","bws","filterAs","payload","isTransactionBoundWitness","isBoundWitness","undefined","PayloadBuilder","hashPairs","nonTxBwHashes","nonTxBwSchemas","hasNonTxBoundWitnesses","length","React","FlexCol","alignItems","rowGap","ErrorRender","error","scope","HashHeadingPaper","paperProps","sx","p","AdornmentEnd","BWActions","boundwitness","identiconProps","size","Divider","flexItem","BWPayloadTableFlexbox","IconComponent","GrTransaction","eventNoun","headingTitle","mb","HeadingPaper","VscSymbolNamespace","heading","BoundWitnessPayloadsTable","VscSymbolMethod","FaSignature","BoundWitnessSignatureTable"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/block/BlockBoundWitnessDetails.tsx","../../src/lib/formatPayloadsForTable.ts","../../src/components/BwPayloadTable.tsx","../../src/components/transactions/TransactionDetails.tsx","../../src/components/transactions/card/Card.tsx","../../src/components/transactions/card/DetailsStack.tsx"],"sourcesContent":["import { Divider } from '@mui/material'\nimport { filterAs } from '@xylabs/array'\nimport { ErrorRender } from '@xylabs/react-error'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport {\n BoundWitnessPayloadsTable,\n BoundWitnessSignatureTable,\n BWActions,\n HashHeadingPaper,\n HeadingPaper,\n} from '@xyo-network/react-boundwitness-plugin'\nimport { useTxsFromBlock } from '@xyo-network/react-chain-blockchain'\nimport { usePayloadHash } from '@xyo-network/react-shared'\nimport { isTransactionBoundWitness, type SignedHydratedBlock } from '@xyo-network/xl1-protocol'\nimport React, { useMemo } from 'react'\nimport { FaSignature } from 'react-icons/fa'\nimport { GrTransaction } from 'react-icons/gr'\nimport { VscSymbolMethod, VscSymbolNamespace } from 'react-icons/vsc'\n\nimport { formatPayloadsForTable } from '../../lib/index.ts'\nimport type { TransactionBoundWitnessEvents } from '../../types/index.ts'\nimport { BWPayloadTableFlexbox } from '../BwPayloadTable.tsx'\n\nexport interface BoundWitnessDetailsProps extends FlexBoxProps {\n block?: SignedHydratedBlock\n}\n\nexport const BlockBoundWitnessDetails = ({\n block, paper, children, ...props\n}: BoundWitnessDetailsProps) => {\n const boundWitness = block?.[0]\n const payloads = block?.[1]\n\n const hash = usePayloadHash(boundWitness)\n\n const [transactions, txFromBlockError] = useTxsFromBlock(block)\n\n const { hashes: txHashes, schemas: txSchemas } = useMemo(() => formatPayloadsForTable(transactions ?? []), [transactions])\n\n const [nonTxBoundWitnesses, bwsFromBlockError] = usePromise(async () => {\n const bws = filterAs(payloads ?? [], payload =>\n (!isTransactionBoundWitness(payload) && isBoundWitness(payload)) ? payload : undefined)\n return await PayloadBuilder.hashPairs(bws)\n }, [payloads])\n\n const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } = useMemo(() => formatPayloadsForTable(nonTxBoundWitnesses ?? []), [nonTxBoundWitnesses])\n const hasNonTxBoundWitnesses = (nonTxBoundWitnesses?.length ?? 0) > 0\n\n return (\n <FlexCol alignItems=\"stretch\" rowGap={4} {...props}>\n <ErrorRender error={txFromBlockError ?? bwsFromBlockError} scope=\"BlockBoundWitnessDetails.tsx\" />\n <HashHeadingPaper\n hash={hash}\n paperProps={{ sx: { p: 2 } }}\n AdornmentEnd={<BWActions boundwitness={boundWitness} />}\n identiconProps={{ p: 0.75, size: 24 }}\n />\n <Divider flexItem />\n {(transactions?.length ?? 0) > 0 && (\n <BWPayloadTableFlexbox<TransactionBoundWitnessEvents>\n IconComponent={<GrTransaction />}\n eventNoun=\"transaction\"\n hashes={txHashes}\n headingTitle=\"Transactions\"\n schemas={txSchemas}\n sx={{ mb: 1 }}\n />\n )}\n <FlexCol alignItems=\"stretch\" rowGap={1} mb={1}>\n <HeadingPaper IconComponent={<VscSymbolNamespace />} heading=\"Payloads\" />\n <BoundWitnessPayloadsTable boundwitness={boundWitness} />\n </FlexCol>\n {hasNonTxBoundWitnesses\n ? (\n <BWPayloadTableFlexbox<TransactionBoundWitnessEvents>\n IconComponent={<VscSymbolMethod />}\n eventNoun=\"boundwitness\"\n hashes={nonTxBwHashes}\n headingTitle=\"Bound Witnesses\"\n schemas={nonTxBwSchemas}\n sx={{ mb: 1 }}\n />\n )\n : null}\n <FlexCol alignItems=\"stretch\" rowGap={1} mb={1}>\n <HeadingPaper IconComponent={<FaSignature />} heading=\"Signatures\" />\n <BoundWitnessSignatureTable block={boundWitness} />\n </FlexCol>\n </FlexCol>\n )\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { Payload } from '@xyo-network/payload-model'\n\nexport const formatPayloadsForTable = (pairs: [Payload, Hash][]) => {\n let hashes: Hash[] = []\n let schemas: string[] = []\n for (const [bw, hash] of pairs ?? []) {\n hashes.push(hash)\n schemas.push(bw?.schema ?? '')\n }\n return { hashes, schemas }\n}\n","import type { Hash } from '@xylabs/hex'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport {\n BoundWitnessPayloadTableBody, BoundWitnessPayloadTableHead, HeadingPaper,\n} from '@xyo-network/react-boundwitness-plugin'\nimport type { EventNoun, ExtendEventNoun } from '@xyo-network/react-event'\nimport { TableEx } from '@xyo-network/react-table'\nimport React from 'react'\nimport { VscSymbolMethod } from 'react-icons/vsc'\n\nexport interface BWPayloadTableFlexboxProps<TNoun extends ExtendEventNoun = EventNoun> extends FlexBoxProps {\n IconComponent?: React.ReactNode\n eventNoun?: TNoun\n hashes?: Hash[]\n headingTitle?: string\n schemas?: string[]\n}\n\nexport const BWPayloadTableFlexbox = <TNoun extends ExtendEventNoun = EventNoun>({\n IconComponent,\n eventNoun,\n hashes,\n schemas,\n headingTitle,\n ...props\n}: BWPayloadTableFlexboxProps<TNoun>) => {\n const resolvedIconComponent = IconComponent ?? <VscSymbolMethod />\n return (\n <FlexCol alignItems=\"stretch\" rowGap={1} {...props}>\n <HeadingPaper IconComponent={resolvedIconComponent} heading={headingTitle} />\n <TableEx>\n <BoundWitnessPayloadTableHead />\n <BoundWitnessPayloadTableBody<TNoun> payloadHashes={hashes} payloadSchemas={schemas} eventNoun={eventNoun} />\n </TableEx>\n </FlexCol>\n )\n}\n","import { Divider } from '@mui/material'\nimport { ErrorRender } from '@xylabs/react-error'\nimport { type FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { isDefined } from '@xylabs/typeof'\nimport { SignedHydratedTransactionWrapper } from '@xyo-network/chain-wrappers'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport {\n BoundWitnessSignatureTable, BWActions, HashHeadingPaper, HeadingPaper,\n} from '@xyo-network/react-boundwitness-plugin'\nimport type { SignedHydratedTransaction } from '@xyo-network/xl1-protocol'\nimport React from 'react'\nimport { FaSignature } from 'react-icons/fa'\nimport { VscSymbolMethod } from 'react-icons/vsc'\n\nimport { formatPayloadsForTable } from '../../lib/index.ts'\nimport { BWPayloadTableFlexbox } from '../BwPayloadTable.tsx'\nimport { TransactionBoundWitnessCard } from './card/index.ts'\n\nexport interface TransactionBoundWitnessDetailsProps extends FlexBoxProps {\n transaction?: SignedHydratedTransaction\n}\n\nexport const TransactionBoundWitnessDetails: React.FC<TransactionBoundWitnessDetailsProps> = ({ transaction, ...props }) => {\n const [wrapper, wrapperError] = usePromise(async () => {\n if (transaction) {\n return await SignedHydratedTransactionWrapper.parse(transaction)\n }\n }, [transaction])\n\n const [elevatedPayloadSets, elevatedPayloadSetsError] = usePromise(async () => {\n if (isDefined(wrapper)) {\n const elevatedPayloads = wrapper.elevatedPayloads\n const pairs = await PayloadBuilder.hashPairs(elevatedPayloads)\n return formatPayloadsForTable(pairs)\n } else {\n return { hashes: [], schemas: [] }\n }\n }, [wrapper])\n\n const { hashes: elevatedPayloadHashes, schemas: elevatedPayloadSchemas } = elevatedPayloadSets ?? {}\n\n return (\n <FlexCol alignItems=\"stretch\" rowGap={4} {...props}>\n <HashHeadingPaper\n hash={wrapper?.boundWitness?._hash}\n paperProps={{ sx: { p: 2 } }}\n AdornmentEnd={<BWActions boundwitness={wrapper?.boundWitness} />}\n identiconProps={{ p: 0.75, size: 24 }}\n />\n <ErrorRender error={wrapperError} scope=\"wrapperError:TransactionBoundWitnessDetails.tsx\" />\n <ErrorRender error={elevatedPayloadSetsError} scope=\"elevatedPayloadSetsError:TransactionBoundWitnessDetails.tsx\" />\n <Divider flexItem />\n <TransactionBoundWitnessCard elevation={4} wrapper={wrapper} />\n <Divider flexItem />\n <BWPayloadTableFlexbox\n IconComponent={<VscSymbolMethod />}\n hashes={elevatedPayloadHashes}\n headingTitle=\"Elevated Payloads\"\n schemas={elevatedPayloadSchemas}\n sx={{ mb: 1 }}\n />\n <FlexCol alignItems=\"stretch\" rowGap={1} mb={1}>\n <HeadingPaper IconComponent={<FaSignature />} heading=\"Signatures\" />\n <BoundWitnessSignatureTable block={wrapper?.boundWitness} />\n </FlexCol>\n </FlexCol>\n )\n}\n","import type { CardProps } from '@mui/material'\nimport {\n Card, CardContent, Grid, Typography,\n} from '@mui/material'\nimport { isUndefined } from '@xylabs/typeof'\nimport { bigIntToFixedPointString } from '@xyo-network/chain-utils'\nimport type { SignedHydratedTransactionInstance } from '@xyo-network/xl1-protocol-sdk'\nimport React, { useCallback } from 'react'\nimport { GiReceiveMoney, GiSandsOfTime } from 'react-icons/gi'\nimport { IoStatsChartOutline } from 'react-icons/io5'\nimport { MdOutlineAlternateEmail } from 'react-icons/md'\n\nimport { DetailsStack } from './DetailsStack.tsx'\n\nexport interface TransactionBoundWitnessCardProps extends CardProps {\n wrapper?: SignedHydratedTransactionInstance\n}\n\nexport const TransactionBoundWitnessCard: React.FC<TransactionBoundWitnessCardProps> = ({ wrapper, ...props }) => {\n if (!wrapper) return null\n\n const formatFee = useCallback((fee?: bigint) => {\n if (isUndefined(fee)) return\n return bigIntToFixedPointString(fee, 12)\n }, [])\n\n return (\n <Card {...props}>\n <CardContent sx={{\n display: 'flex', flexDirection: 'row', gap: 2, flexWrap: 'wrap',\n }}\n >\n <Grid container spacing={3} sx={{ width: '100%' }}>\n <Grid size={{ xs: 12 }}>\n <DetailsStack IconComponent={MdOutlineAlternateEmail} heading=\"From:\">\n <Typography\n variant=\"body2\"\n sx={{\n maxWidth: '100%', textOverflow: 'ellipsis', overflow: 'hidden',\n }}\n >\n {wrapper?.boundWitness.from}\n </Typography>\n </DetailsStack>\n </Grid>\n <Grid size={{\n xs: 12, sm: 6, md: 4,\n }}\n >\n <DetailsStack IconComponent={IoStatsChartOutline} heading=\"Stats\">\n <Typography variant=\"body2\">\n Reward:\n {' '}\n {wrapper?.reward()}\n </Typography>\n <Typography variant=\"body2\">\n Elevated Payloads:\n {' '}\n {wrapper?.elevatedPayloadCount}\n </Typography>\n <Typography variant=\"body2\">\n Total Payloads:\n {' '}\n {wrapper?.payloadCount}\n </Typography>\n <Typography variant=\"body2\">\n Signatures:\n {' '}\n {wrapper?.signatureCount}\n </Typography>\n </DetailsStack>\n </Grid>\n <Grid size={{\n xs: 12, sm: 6, md: 4,\n }}\n >\n <DetailsStack IconComponent={GiReceiveMoney} heading=\"Fees\">\n <Typography variant=\"body2\">\n Base:\n {' '}\n {formatFee(wrapper?.fees.base)}\n </Typography>\n <Typography variant=\"body2\">\n Gas:\n {' '}\n {formatFee(wrapper?.fees.gasPrice)}\n </Typography>\n <Typography variant=\"body2\">\n Priority:\n {' '}\n {formatFee(wrapper?.fees.priority)}\n </Typography>\n <Typography variant=\"body2\">\n Gas Limit:\n {' '}\n {formatFee(wrapper?.fees.gasLimit)}\n </Typography>\n </DetailsStack>\n </Grid>\n <Grid size={{\n xs: 12, sm: 6, md: 4,\n }}\n >\n <DetailsStack IconComponent={GiSandsOfTime} heading=\"Block Duration\">\n <Typography variant=\"body2\">\n Expiration:\n {' '}\n {wrapper?.boundWitness.exp}\n </Typography>\n <Typography variant=\"body2\">\n Not Before:\n {' '}\n {wrapper?.boundWitness?.nbf}\n </Typography>\n </DetailsStack>\n </Grid>\n </Grid>\n </CardContent>\n </Card>\n )\n}\n","import type { StackProps } from '@mui/material'\nimport {\n Icon, Stack, styled, Typography,\n} from '@mui/material'\nimport type { ComponentType, SVGAttributes } from 'react'\nimport React from 'react'\n\nexport interface DetailsStackProps extends StackProps {\n IconComponent?: ComponentType<SVGAttributes<SVGElement>>\n heading?: string\n}\n\nexport const DetailsStack: React.FC<DetailsStackProps> = ({\n IconComponent, heading, children, ...props\n}) => {\n return (\n <Stack direction=\"row\" mb={1} gap={1} {...props}>\n {IconComponent && <Icon fontSize=\"small\" sx={{ mr: 0.25 }}><IconComponent style={{ height: '0.7em' }} /></Icon>}\n <Stack direction=\"column\" flexWrap=\"wrap\" mb={1}>\n <SectionHeadingTypography>\n {heading}\n </SectionHeadingTypography>\n {children}\n </Stack>\n </Stack>\n )\n}\n\nconst SectionHeadingTypography = styled(Typography, { name: 'SectionHeadingTypography' })(({ theme }) => ({\n display: 'inline-flex',\n alignItems: 'baseline',\n fontFamily: 'monospace',\n fontSize: 16,\n marginBottom: theme.spacing(0.75),\n}))\n"],"mappings":";;;;AAAA,SAASA,eAAe;AACxB,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAE5B,SAASC,WAAAA,gBAAe;AACxB,SAASC,kBAAkB;AAC3B,SAASC,sBAAsB;AAC/B,SAASC,sBAAsB;AAC/B,SACEC,2BACAC,4BACAC,WACAC,kBACAC,gBAAAA,qBACK;AACP,SAASC,uBAAuB;AAChC,SAASC,sBAAsB;AAC/B,SAASC,iCAA2D;AACpE,OAAOC,UAASC,eAAe;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,qBAAqB;AAC9B,SAASC,mBAAAA,kBAAiBC,0BAA0B;;;AClB7C,IAAMC,yBAAyB,wBAACC,UAAAA;AACrC,MAAIC,SAAiB,CAAA;AACrB,MAAIC,UAAoB,CAAA;AACxB,aAAW,CAACC,IAAIC,IAAAA,KAASJ,SAAS,CAAA,GAAI;AACpCC,WAAOI,KAAKD,IAAAA;AACZF,YAAQG,KAAKF,IAAIG,UAAU,EAAA;EAC7B;AACA,SAAO;IAAEL;IAAQC;EAAQ;AAC3B,GARsC;;;ACDtC,SAASK,eAAe;AACxB,SACEC,8BAA8BC,8BAA8BC,oBACvD;AAEP,SAASC,eAAe;AACxB,OA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A,IAAAA;IAChB7B,QAAQE;IACR4B,cAAa;IACb7B,SAASE;IACTU,IAAI;MAAEkB,IAAI;IAAE;MAEd,gBAAA3B,OAAA,cAACC,UAAAA;IAAQC,YAAW;IAAUC,QAAQ;IAAGwB,IAAI;KAC3C,gBAAA3B,OAAA,cAAC4B,eAAAA;IAAaJ,eAAe,gBAAAxB,OAAA,cAAC6B,cAAAA,IAAAA;IAAgBC,SAAQ;MACtD,gBAAA9B,OAAA,cAAC+B,6BAAAA;IAA2BC,OAAOjD,SAASuB;;AAIpD,GA7C6F;","names":["Divider","filterAs","ErrorRender","FlexCol","usePromise","isBoundWitness","PayloadBuilder","BoundWitnessPayloadsTable","BoundWitnessSignatureTable","BWActions","HashHeadingPaper","HeadingPaper","useTxsFromBlock","usePayloadHash","isTransactionBoundWitness","React","useMemo","FaSignature","GrTransaction","VscSymbolMethod","VscSymbolNamespace","formatPayloadsForTable","pairs","hashes","schemas","bw","hash","push","schema","FlexCol","BoundWitnessPayloadTableBody","BoundWitnessPayloadTableHead","HeadingPaper","TableEx","React","VscSymbolMethod","BWPayloadTableFlexbox","IconComponent","eventNoun","hashes","schemas","headingTitle","props","resolvedIconComponent","VscSymbolMethod","FlexCol","alignItems","rowGap","HeadingPaper","heading","TableEx","BoundWitnessPayloadTableHead","BoundWitnessPayloadTableBody","payloadHashes","payloadSchemas","BlockBoundWitnessDetails","block","paper","children","props","boundWitness","payloads","hash","usePayloadHash","transactions","txFromBlockError","useTxsFromBlock","hashes","txHashes","schemas","txSchemas","useMemo","formatPayloadsForTable","nonTxBoundWitnesses","bwsFromBlockError","usePromise","bws","filterAs","payload","isTransactionBoundWitness","isBoundWitness","undefined","PayloadBuilder","hashPairs","nonTxBwHashes","nonTxBwSchemas","hasNonTxBoundWitnesses","length","React","FlexCol","alignItems","rowGap","ErrorRender","error","scope","HashHeadingPaper","paperProps","sx","p","AdornmentEnd","BWActions","boundwitness","identiconProps","size","Divider","flexItem","BWPayloadTableFlexbox","IconComponent","GrTransaction","eventNoun","headingTitle","mb","HeadingPaper","VscSymbolNamespace","heading","BoundWitnessPayloadsTable","VscSymbolMethod","FaSignature","BoundWitnessSignatureTable","Divider","ErrorRender","FlexCol","usePromise","isDefined","SignedHydratedTransactionWrapper","PayloadBuilder","BoundWitnessSignatureTable","BWActions","HashHeadingPaper","HeadingPaper","React","FaSignature","VscSymbolMethod","Card","CardContent","Grid","Typography","isUndefined","bigIntToFixedPointString","React","useCallback","GiReceiveMoney","GiSandsOfTime","IoStatsChartOutline","MdOutlineAlternateEmail","Icon","Stack","styled","Typography","React","DetailsStack","IconComponent","heading","children","props","React","Stack","direction","mb","gap","Icon","fontSize","sx","mr","style","height","flexWrap","SectionHeadingTypography","styled","Typography","name","theme","display","alignItems","fontFamily","marginBottom","spacing","TransactionBoundWitnessCard","wrapper","props","formatFee","useCallback","fee","isUndefined","bigIntToFixedPointString","React","Card","CardContent","sx","display","flexDirection","gap","flexWrap","Grid","container","spacing","width","size","xs","DetailsStack","IconComponent","MdOutlineAlternateEmail","heading","Typography","variant","maxWidth","textOverflow","overflow","boundWitness","from","sm","md","IoStatsChartOutline","reward","elevatedPayloadCount","payloadCount","signatureCount","GiReceiveMoney","fees","base","gasPrice","priority","gasLimit","GiSandsOfTime","exp","nbf","TransactionBoundWitnessDetails","transaction","props","wrapper","wrapperError","usePromise","SignedHydratedTransactionWrapper","parse","elevatedPayloadSets","elevatedPayloadSetsError","isDefined","elevatedPayloads","pairs","PayloadBuilder","hashPairs","formatPayloadsForTable","hashes","schemas","elevatedPayloadHashes","elevatedPayloadSchemas","React","FlexCol","alignItems","rowGap","HashHeadingPaper","hash","boundWitness","_hash","paperProps","sx","p","AdornmentEnd","BWActions","boundwitness","identiconProps","size","ErrorRender","error","scope","Divider","flexItem","TransactionBoundWitnessCard","elevation","BWPayloadTableFlexbox","IconComponent","VscSymbolMethod","headingTitle","mb","HeadingPaper","FaSignature","heading","BoundWitnessSignatureTable","block"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlockBoundWitnessDetails.d.ts","sourceRoot":"","sources":["../../../../src/components/block/BlockBoundWitnessDetails.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAczD,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAU/F,MAAM,WAAW,wBAAyB,SAAQ,YAAY;IAC5D,KAAK,CAAC,EAAE,mBAAmB,CAAA;CAC5B;AAED,eAAO,MAAM,wBAAwB,GAAI,sCAEtC,wBAAwB,4CA6D1B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/block/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FlexBoxProps } from '@xylabs/react-flexbox';
|
|
2
|
+
import type { SignedHydratedTransaction } from '@xyo-network/xl1-protocol';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface TransactionBoundWitnessDetailsProps extends FlexBoxProps {
|
|
5
|
+
transaction?: SignedHydratedTransaction;
|
|
6
|
+
}
|
|
7
|
+
export declare const TransactionBoundWitnessDetails: React.FC<TransactionBoundWitnessDetailsProps>;
|
|
8
|
+
//# sourceMappingURL=TransactionDetails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionDetails.d.ts","sourceRoot":"","sources":["../../../../src/components/transactions/TransactionDetails.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAW,MAAM,uBAAuB,CAAA;AAQlE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,MAAM,WAAW,mCAAoC,SAAQ,YAAY;IACvE,WAAW,CAAC,EAAE,yBAAyB,CAAA;CACxC;AAED,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,EAAE,CAAC,mCAAmC,CA6CxF,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CardProps } from '@mui/material';
|
|
2
|
+
import type { SignedHydratedTransactionInstance } from '@xyo-network/xl1-protocol-sdk';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface TransactionBoundWitnessCardProps extends CardProps {
|
|
5
|
+
wrapper?: SignedHydratedTransactionInstance;
|
|
6
|
+
}
|
|
7
|
+
export declare const TransactionBoundWitnessCard: React.FC<TransactionBoundWitnessCardProps>;
|
|
8
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../../src/components/transactions/card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAM9C,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,+BAA+B,CAAA;AACtF,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,MAAM,WAAW,gCAAiC,SAAQ,SAAS;IACjE,OAAO,CAAC,EAAE,iCAAiC,CAAA;CAC5C;AAED,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAAC,gCAAgC,CAsGlF,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StackProps } from '@mui/material';
|
|
2
|
+
import type { ComponentType, SVGAttributes } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface DetailsStackProps extends StackProps {
|
|
5
|
+
IconComponent?: ComponentType<SVGAttributes<SVGElement>>;
|
|
6
|
+
heading?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const DetailsStack: React.FC<DetailsStackProps>;
|
|
9
|
+
//# sourceMappingURL=DetailsStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailsStack.d.ts","sourceRoot":"","sources":["../../../../../src/components/transactions/card/DetailsStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAI/C,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACnD,aAAa,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAA;IACxD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAcpD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/transactions/card/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/transactions/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex';
|
|
2
|
+
import type { Payload } from '@xyo-network/payload-model';
|
|
3
|
+
export declare const formatPayloadsForTable: (pairs: [Payload, Hash][]) => {
|
|
4
|
+
hashes: Lowercase<string>[];
|
|
5
|
+
schemas: string[];
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=formatPayloadsForTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatPayloadsForTable.d.ts","sourceRoot":"","sources":["../../../src/lib/formatPayloadsForTable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,eAAO,MAAM,sBAAsB,GAAI,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;;;CAQ9D,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/react-chain-boundwitness",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.26",
|
|
5
5
|
"description": "XYO Layer One React SDK BoundWitness",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -35,17 +35,21 @@
|
|
|
35
35
|
"types": "dist/types/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@xylabs/array": "^4.9.18",
|
|
38
|
+
"@xylabs/hex": "^4.9.18",
|
|
38
39
|
"@xylabs/react-error": "^6.3.1",
|
|
39
40
|
"@xylabs/react-flexbox": "^6.3.1",
|
|
40
41
|
"@xylabs/react-promise": "^6.3.1",
|
|
41
|
-
"@
|
|
42
|
-
"@xyo-network/
|
|
42
|
+
"@xylabs/typeof": "^4.9.18",
|
|
43
|
+
"@xyo-network/boundwitness-model": "^3.15.10",
|
|
44
|
+
"@xyo-network/chain-utils": "^1.3.26",
|
|
45
|
+
"@xyo-network/chain-wrappers": "^1.3.26",
|
|
46
|
+
"@xyo-network/payload-builder": "^3.15.10",
|
|
43
47
|
"@xyo-network/react-boundwitness-plugin": "^5.3.3",
|
|
44
|
-
"@xyo-network/react-chain-blockchain": "^1.3.
|
|
48
|
+
"@xyo-network/react-chain-blockchain": "^1.3.26",
|
|
45
49
|
"@xyo-network/react-event": "^5.3.3",
|
|
46
50
|
"@xyo-network/react-shared": "^5.3.3",
|
|
47
51
|
"@xyo-network/react-table": "^5.3.3",
|
|
48
|
-
"@xyo-network/xl1-protocol": "^1.3.
|
|
52
|
+
"@xyo-network/xl1-protocol": "^1.3.17",
|
|
49
53
|
"react-icons": "^5.5.0"
|
|
50
54
|
},
|
|
51
55
|
"devDependencies": {
|
|
@@ -55,7 +59,7 @@
|
|
|
55
59
|
"@mui/material": "^7.1.0",
|
|
56
60
|
"@xylabs/ts-scripts-yarn3": "^6.5.6",
|
|
57
61
|
"@xylabs/tsconfig-react": "^6.5.6",
|
|
58
|
-
"@xyo-network/react-chain-shared": "^1.3.
|
|
62
|
+
"@xyo-network/react-chain-shared": "^1.3.26",
|
|
59
63
|
"knip": "^5.56.0",
|
|
60
64
|
"react": "^19.1.0",
|
|
61
65
|
"react-dom": "^19.1.0",
|
|
@@ -2,7 +2,7 @@ import type { Hash } from '@xylabs/hex'
|
|
|
2
2
|
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
3
3
|
import { FlexCol } from '@xylabs/react-flexbox'
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
BoundWitnessPayloadTableBody, BoundWitnessPayloadTableHead, HeadingPaper,
|
|
6
6
|
} from '@xyo-network/react-boundwitness-plugin'
|
|
7
7
|
import type { EventNoun, ExtendEventNoun } from '@xyo-network/react-event'
|
|
8
8
|
import { TableEx } from '@xyo-network/react-table'
|
|
@@ -18,12 +18,12 @@ export interface BWPayloadTableFlexboxProps<TNoun extends ExtendEventNoun = Even
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export const BWPayloadTableFlexbox = <TNoun extends ExtendEventNoun = EventNoun>({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
IconComponent,
|
|
22
|
+
eventNoun,
|
|
23
|
+
hashes,
|
|
24
|
+
schemas,
|
|
25
|
+
headingTitle,
|
|
26
|
+
...props
|
|
27
27
|
}: BWPayloadTableFlexboxProps<TNoun>) => {
|
|
28
28
|
const resolvedIconComponent = IconComponent ?? <VscSymbolMethod />
|
|
29
29
|
return (
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Divider } from '@mui/material'
|
|
2
2
|
import { filterAs } from '@xylabs/array'
|
|
3
|
-
import type { Hash } from '@xylabs/hex'
|
|
4
3
|
import { ErrorRender } from '@xylabs/react-error'
|
|
5
4
|
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
6
5
|
import { FlexCol } from '@xylabs/react-flexbox'
|
|
7
6
|
import { usePromise } from '@xylabs/react-promise'
|
|
8
|
-
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
9
7
|
import { isBoundWitness } from '@xyo-network/boundwitness-model'
|
|
10
8
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
11
9
|
import {
|
|
@@ -16,7 +14,6 @@ import {
|
|
|
16
14
|
HeadingPaper,
|
|
17
15
|
} from '@xyo-network/react-boundwitness-plugin'
|
|
18
16
|
import { useTxsFromBlock } from '@xyo-network/react-chain-blockchain'
|
|
19
|
-
import { useEvent } from '@xyo-network/react-event'
|
|
20
17
|
import { usePayloadHash } from '@xyo-network/react-shared'
|
|
21
18
|
import { isTransactionBoundWitness, type SignedHydratedBlock } from '@xyo-network/xl1-protocol'
|
|
22
19
|
import React, { useMemo } from 'react'
|
|
@@ -24,18 +21,9 @@ import { FaSignature } from 'react-icons/fa'
|
|
|
24
21
|
import { GrTransaction } from 'react-icons/gr'
|
|
25
22
|
import { VscSymbolMethod, VscSymbolNamespace } from 'react-icons/vsc'
|
|
26
23
|
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
const formatBwsForTable = (pairs: [BoundWitness, Hash][]) => {
|
|
31
|
-
let hashes: Hash[] = []
|
|
32
|
-
let schemas: string[] = []
|
|
33
|
-
for (const [bw, hash] of pairs ?? []) {
|
|
34
|
-
hashes.push(hash)
|
|
35
|
-
schemas.push(bw?.schema ?? '')
|
|
36
|
-
}
|
|
37
|
-
return { hashes, schemas }
|
|
38
|
-
}
|
|
24
|
+
import { formatPayloadsForTable } from '../../lib/index.ts'
|
|
25
|
+
import type { TransactionBoundWitnessEvents } from '../../types/index.ts'
|
|
26
|
+
import { BWPayloadTableFlexbox } from '../BwPayloadTable.tsx'
|
|
39
27
|
|
|
40
28
|
export interface BoundWitnessDetailsProps extends FlexBoxProps {
|
|
41
29
|
block?: SignedHydratedBlock
|
|
@@ -51,15 +39,15 @@ export const BlockBoundWitnessDetails = ({
|
|
|
51
39
|
|
|
52
40
|
const [transactions, txFromBlockError] = useTxsFromBlock(block)
|
|
53
41
|
|
|
54
|
-
const { hashes: txHashes, schemas: txSchemas } = useMemo(() =>
|
|
42
|
+
const { hashes: txHashes, schemas: txSchemas } = useMemo(() => formatPayloadsForTable(transactions ?? []), [transactions])
|
|
55
43
|
|
|
56
44
|
const [nonTxBoundWitnesses, bwsFromBlockError] = usePromise(async () => {
|
|
57
45
|
const bws = filterAs(payloads ?? [], payload =>
|
|
58
46
|
(!isTransactionBoundWitness(payload) && isBoundWitness(payload)) ? payload : undefined)
|
|
59
47
|
return await PayloadBuilder.hashPairs(bws)
|
|
60
|
-
|
|
48
|
+
}, [payloads])
|
|
61
49
|
|
|
62
|
-
const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } = useMemo(() =>
|
|
50
|
+
const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } = useMemo(() => formatPayloadsForTable(nonTxBoundWitnesses ?? []), [nonTxBoundWitnesses])
|
|
63
51
|
const hasNonTxBoundWitnesses = (nonTxBoundWitnesses?.length ?? 0) > 0
|
|
64
52
|
|
|
65
53
|
return (
|
|
@@ -88,14 +76,14 @@ export const BlockBoundWitnessDetails = ({
|
|
|
88
76
|
</FlexCol>
|
|
89
77
|
{hasNonTxBoundWitnesses
|
|
90
78
|
? (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
79
|
+
<BWPayloadTableFlexbox<TransactionBoundWitnessEvents>
|
|
80
|
+
IconComponent={<VscSymbolMethod />}
|
|
81
|
+
eventNoun="boundwitness"
|
|
82
|
+
hashes={nonTxBwHashes}
|
|
83
|
+
headingTitle="Bound Witnesses"
|
|
84
|
+
schemas={nonTxBwSchemas}
|
|
85
|
+
sx={{ mb: 1 }}
|
|
86
|
+
/>
|
|
99
87
|
)
|
|
100
88
|
: null}
|
|
101
89
|
<FlexCol alignItems="stretch" rowGap={1} mb={1}>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BlockBoundWitnessDetails.tsx'
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import { buildRandomTransaction } from '@xyo-network/chain-protocol'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import { TransactionBoundWitnessDetails } from './TransactionDetails.tsx'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'BoundWitness/Transaction/Details/Flexbox',
|
|
9
|
+
component: TransactionBoundWitnessDetails,
|
|
10
|
+
} as Meta
|
|
11
|
+
|
|
12
|
+
const tx = await buildRandomTransaction('0x123')
|
|
13
|
+
|
|
14
|
+
const Template: StoryFn<typeof TransactionBoundWitnessDetails> = args => <TransactionBoundWitnessDetails {...args} />
|
|
15
|
+
|
|
16
|
+
const Default = Template.bind({})
|
|
17
|
+
Default.args = {}
|
|
18
|
+
|
|
19
|
+
const WithData = Template.bind({})
|
|
20
|
+
WithData.args = { transaction: tx }
|
|
21
|
+
|
|
22
|
+
export { Default, WithData }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Divider } from '@mui/material'
|
|
2
|
+
import { ErrorRender } from '@xylabs/react-error'
|
|
3
|
+
import { type FlexBoxProps, FlexCol } from '@xylabs/react-flexbox'
|
|
4
|
+
import { usePromise } from '@xylabs/react-promise'
|
|
5
|
+
import { isDefined } from '@xylabs/typeof'
|
|
6
|
+
import { SignedHydratedTransactionWrapper } from '@xyo-network/chain-wrappers'
|
|
7
|
+
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
8
|
+
import {
|
|
9
|
+
BoundWitnessSignatureTable, BWActions, HashHeadingPaper, HeadingPaper,
|
|
10
|
+
} from '@xyo-network/react-boundwitness-plugin'
|
|
11
|
+
import type { SignedHydratedTransaction } from '@xyo-network/xl1-protocol'
|
|
12
|
+
import React from 'react'
|
|
13
|
+
import { FaSignature } from 'react-icons/fa'
|
|
14
|
+
import { VscSymbolMethod } from 'react-icons/vsc'
|
|
15
|
+
|
|
16
|
+
import { formatPayloadsForTable } from '../../lib/index.ts'
|
|
17
|
+
import { BWPayloadTableFlexbox } from '../BwPayloadTable.tsx'
|
|
18
|
+
import { TransactionBoundWitnessCard } from './card/index.ts'
|
|
19
|
+
|
|
20
|
+
export interface TransactionBoundWitnessDetailsProps extends FlexBoxProps {
|
|
21
|
+
transaction?: SignedHydratedTransaction
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const TransactionBoundWitnessDetails: React.FC<TransactionBoundWitnessDetailsProps> = ({ transaction, ...props }) => {
|
|
25
|
+
const [wrapper, wrapperError] = usePromise(async () => {
|
|
26
|
+
if (transaction) {
|
|
27
|
+
return await SignedHydratedTransactionWrapper.parse(transaction)
|
|
28
|
+
}
|
|
29
|
+
}, [transaction])
|
|
30
|
+
|
|
31
|
+
const [elevatedPayloadSets, elevatedPayloadSetsError] = usePromise(async () => {
|
|
32
|
+
if (isDefined(wrapper)) {
|
|
33
|
+
const elevatedPayloads = wrapper.elevatedPayloads
|
|
34
|
+
const pairs = await PayloadBuilder.hashPairs(elevatedPayloads)
|
|
35
|
+
return formatPayloadsForTable(pairs)
|
|
36
|
+
} else {
|
|
37
|
+
return { hashes: [], schemas: [] }
|
|
38
|
+
}
|
|
39
|
+
}, [wrapper])
|
|
40
|
+
|
|
41
|
+
const { hashes: elevatedPayloadHashes, schemas: elevatedPayloadSchemas } = elevatedPayloadSets ?? {}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<FlexCol alignItems="stretch" rowGap={4} {...props}>
|
|
45
|
+
<HashHeadingPaper
|
|
46
|
+
hash={wrapper?.boundWitness?._hash}
|
|
47
|
+
paperProps={{ sx: { p: 2 } }}
|
|
48
|
+
AdornmentEnd={<BWActions boundwitness={wrapper?.boundWitness} />}
|
|
49
|
+
identiconProps={{ p: 0.75, size: 24 }}
|
|
50
|
+
/>
|
|
51
|
+
<ErrorRender error={wrapperError} scope="wrapperError:TransactionBoundWitnessDetails.tsx" />
|
|
52
|
+
<ErrorRender error={elevatedPayloadSetsError} scope="elevatedPayloadSetsError:TransactionBoundWitnessDetails.tsx" />
|
|
53
|
+
<Divider flexItem />
|
|
54
|
+
<TransactionBoundWitnessCard elevation={4} wrapper={wrapper} />
|
|
55
|
+
<Divider flexItem />
|
|
56
|
+
<BWPayloadTableFlexbox
|
|
57
|
+
IconComponent={<VscSymbolMethod />}
|
|
58
|
+
hashes={elevatedPayloadHashes}
|
|
59
|
+
headingTitle="Elevated Payloads"
|
|
60
|
+
schemas={elevatedPayloadSchemas}
|
|
61
|
+
sx={{ mb: 1 }}
|
|
62
|
+
/>
|
|
63
|
+
<FlexCol alignItems="stretch" rowGap={1} mb={1}>
|
|
64
|
+
<HeadingPaper IconComponent={<FaSignature />} heading="Signatures" />
|
|
65
|
+
<BoundWitnessSignatureTable block={wrapper?.boundWitness} />
|
|
66
|
+
</FlexCol>
|
|
67
|
+
</FlexCol>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { CardProps } from '@mui/material'
|
|
2
|
+
import {
|
|
3
|
+
Card, CardContent, Grid, Typography,
|
|
4
|
+
} from '@mui/material'
|
|
5
|
+
import { isUndefined } from '@xylabs/typeof'
|
|
6
|
+
import { bigIntToFixedPointString } from '@xyo-network/chain-utils'
|
|
7
|
+
import type { SignedHydratedTransactionInstance } from '@xyo-network/xl1-protocol-sdk'
|
|
8
|
+
import React, { useCallback } from 'react'
|
|
9
|
+
import { GiReceiveMoney, GiSandsOfTime } from 'react-icons/gi'
|
|
10
|
+
import { IoStatsChartOutline } from 'react-icons/io5'
|
|
11
|
+
import { MdOutlineAlternateEmail } from 'react-icons/md'
|
|
12
|
+
|
|
13
|
+
import { DetailsStack } from './DetailsStack.tsx'
|
|
14
|
+
|
|
15
|
+
export interface TransactionBoundWitnessCardProps extends CardProps {
|
|
16
|
+
wrapper?: SignedHydratedTransactionInstance
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const TransactionBoundWitnessCard: React.FC<TransactionBoundWitnessCardProps> = ({ wrapper, ...props }) => {
|
|
20
|
+
if (!wrapper) return null
|
|
21
|
+
|
|
22
|
+
const formatFee = useCallback((fee?: bigint) => {
|
|
23
|
+
if (isUndefined(fee)) return
|
|
24
|
+
return bigIntToFixedPointString(fee, 12)
|
|
25
|
+
}, [])
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Card {...props}>
|
|
29
|
+
<CardContent sx={{
|
|
30
|
+
display: 'flex', flexDirection: 'row', gap: 2, flexWrap: 'wrap',
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<Grid container spacing={3} sx={{ width: '100%' }}>
|
|
34
|
+
<Grid size={{ xs: 12 }}>
|
|
35
|
+
<DetailsStack IconComponent={MdOutlineAlternateEmail} heading="From:">
|
|
36
|
+
<Typography
|
|
37
|
+
variant="body2"
|
|
38
|
+
sx={{
|
|
39
|
+
maxWidth: '100%', textOverflow: 'ellipsis', overflow: 'hidden',
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
{wrapper?.boundWitness.from}
|
|
43
|
+
</Typography>
|
|
44
|
+
</DetailsStack>
|
|
45
|
+
</Grid>
|
|
46
|
+
<Grid size={{
|
|
47
|
+
xs: 12, sm: 6, md: 4,
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<DetailsStack IconComponent={IoStatsChartOutline} heading="Stats">
|
|
51
|
+
<Typography variant="body2">
|
|
52
|
+
Reward:
|
|
53
|
+
{' '}
|
|
54
|
+
{wrapper?.reward()}
|
|
55
|
+
</Typography>
|
|
56
|
+
<Typography variant="body2">
|
|
57
|
+
Elevated Payloads:
|
|
58
|
+
{' '}
|
|
59
|
+
{wrapper?.elevatedPayloadCount}
|
|
60
|
+
</Typography>
|
|
61
|
+
<Typography variant="body2">
|
|
62
|
+
Total Payloads:
|
|
63
|
+
{' '}
|
|
64
|
+
{wrapper?.payloadCount}
|
|
65
|
+
</Typography>
|
|
66
|
+
<Typography variant="body2">
|
|
67
|
+
Signatures:
|
|
68
|
+
{' '}
|
|
69
|
+
{wrapper?.signatureCount}
|
|
70
|
+
</Typography>
|
|
71
|
+
</DetailsStack>
|
|
72
|
+
</Grid>
|
|
73
|
+
<Grid size={{
|
|
74
|
+
xs: 12, sm: 6, md: 4,
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<DetailsStack IconComponent={GiReceiveMoney} heading="Fees">
|
|
78
|
+
<Typography variant="body2">
|
|
79
|
+
Base:
|
|
80
|
+
{' '}
|
|
81
|
+
{formatFee(wrapper?.fees.base)}
|
|
82
|
+
</Typography>
|
|
83
|
+
<Typography variant="body2">
|
|
84
|
+
Gas:
|
|
85
|
+
{' '}
|
|
86
|
+
{formatFee(wrapper?.fees.gasPrice)}
|
|
87
|
+
</Typography>
|
|
88
|
+
<Typography variant="body2">
|
|
89
|
+
Priority:
|
|
90
|
+
{' '}
|
|
91
|
+
{formatFee(wrapper?.fees.priority)}
|
|
92
|
+
</Typography>
|
|
93
|
+
<Typography variant="body2">
|
|
94
|
+
Gas Limit:
|
|
95
|
+
{' '}
|
|
96
|
+
{formatFee(wrapper?.fees.gasLimit)}
|
|
97
|
+
</Typography>
|
|
98
|
+
</DetailsStack>
|
|
99
|
+
</Grid>
|
|
100
|
+
<Grid size={{
|
|
101
|
+
xs: 12, sm: 6, md: 4,
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
<DetailsStack IconComponent={GiSandsOfTime} heading="Block Duration">
|
|
105
|
+
<Typography variant="body2">
|
|
106
|
+
Expiration:
|
|
107
|
+
{' '}
|
|
108
|
+
{wrapper?.boundWitness.exp}
|
|
109
|
+
</Typography>
|
|
110
|
+
<Typography variant="body2">
|
|
111
|
+
Not Before:
|
|
112
|
+
{' '}
|
|
113
|
+
{wrapper?.boundWitness?.nbf}
|
|
114
|
+
</Typography>
|
|
115
|
+
</DetailsStack>
|
|
116
|
+
</Grid>
|
|
117
|
+
</Grid>
|
|
118
|
+
</CardContent>
|
|
119
|
+
</Card>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { StackProps } from '@mui/material'
|
|
2
|
+
import {
|
|
3
|
+
Icon, Stack, styled, Typography,
|
|
4
|
+
} from '@mui/material'
|
|
5
|
+
import type { ComponentType, SVGAttributes } from 'react'
|
|
6
|
+
import React from 'react'
|
|
7
|
+
|
|
8
|
+
export interface DetailsStackProps extends StackProps {
|
|
9
|
+
IconComponent?: ComponentType<SVGAttributes<SVGElement>>
|
|
10
|
+
heading?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const DetailsStack: React.FC<DetailsStackProps> = ({
|
|
14
|
+
IconComponent, heading, children, ...props
|
|
15
|
+
}) => {
|
|
16
|
+
return (
|
|
17
|
+
<Stack direction="row" mb={1} gap={1} {...props}>
|
|
18
|
+
{IconComponent && <Icon fontSize="small" sx={{ mr: 0.25 }}><IconComponent style={{ height: '0.7em' }} /></Icon>}
|
|
19
|
+
<Stack direction="column" flexWrap="wrap" mb={1}>
|
|
20
|
+
<SectionHeadingTypography>
|
|
21
|
+
{heading}
|
|
22
|
+
</SectionHeadingTypography>
|
|
23
|
+
{children}
|
|
24
|
+
</Stack>
|
|
25
|
+
</Stack>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const SectionHeadingTypography = styled(Typography, { name: 'SectionHeadingTypography' })(({ theme }) => ({
|
|
30
|
+
display: 'inline-flex',
|
|
31
|
+
alignItems: 'baseline',
|
|
32
|
+
fontFamily: 'monospace',
|
|
33
|
+
fontSize: 16,
|
|
34
|
+
marginBottom: theme.spacing(0.75),
|
|
35
|
+
}))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Card.tsx'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TransactionDetails.tsx'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/hex'
|
|
2
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
3
|
+
|
|
4
|
+
export const formatPayloadsForTable = (pairs: [Payload, Hash][]) => {
|
|
5
|
+
let hashes: Hash[] = []
|
|
6
|
+
let schemas: string[] = []
|
|
7
|
+
for (const [bw, hash] of pairs ?? []) {
|
|
8
|
+
hashes.push(hash)
|
|
9
|
+
schemas.push(bw?.schema ?? '')
|
|
10
|
+
}
|
|
11
|
+
return { hashes, schemas }
|
|
12
|
+
}
|
package/src/lib/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './formatPayloadsForTable.ts'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlockBoundWitnessDetails.d.ts","sourceRoot":"","sources":["../../../src/components/BlockBoundWitnessDetails.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAgBzD,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAmB/F,MAAM,WAAW,wBAAyB,SAAQ,YAAY;IAC5D,KAAK,CAAC,EAAE,mBAAmB,CAAA;CAC5B;AAED,eAAO,MAAM,wBAAwB,GAAI,sCAEtC,wBAAwB,4CA6D1B,CAAA"}
|
/package/dist/types/components/{BlockBoundWitnessDetails.d.ts → block/BlockBoundWitnessDetails.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|