@xyo-network/react-chain-boundwitness 1.5.12 → 1.5.14

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.
Files changed (42) hide show
  1. package/dist/browser/index.mjs +298 -124
  2. package/dist/browser/index.mjs.map +1 -1
  3. package/dist/types/components/BwPayloadTable.d.ts.map +1 -1
  4. package/dist/types/components/block/BlockBoundWitnessDetails.d.ts.map +1 -1
  5. package/dist/types/components/block/card/Card.d.ts +9 -0
  6. package/dist/types/components/block/card/Card.d.ts.map +1 -0
  7. package/dist/types/components/block/card/CardHeader.d.ts +9 -0
  8. package/dist/types/components/block/card/CardHeader.d.ts.map +1 -0
  9. package/dist/types/components/block/card/hooks/index.d.ts +2 -0
  10. package/dist/types/components/block/card/hooks/index.d.ts.map +1 -0
  11. package/dist/types/components/block/card/hooks/useDetails.d.ts +16 -0
  12. package/dist/types/components/block/card/hooks/useDetails.d.ts.map +1 -0
  13. package/dist/types/components/block/card/index.d.ts +2 -0
  14. package/dist/types/components/block/card/index.d.ts.map +1 -0
  15. package/dist/types/components/transactions/card/Card.d.ts +1 -0
  16. package/dist/types/components/transactions/card/Card.d.ts.map +1 -1
  17. package/dist/types/components/transactions/card/hooks/index.d.ts +2 -0
  18. package/dist/types/components/transactions/card/hooks/index.d.ts.map +1 -0
  19. package/dist/types/components/transactions/card/hooks/useDetails.d.ts +16 -0
  20. package/dist/types/components/transactions/card/hooks/useDetails.d.ts.map +1 -0
  21. package/dist/types/lib/formatFees.d.ts +2 -0
  22. package/dist/types/lib/formatFees.d.ts.map +1 -0
  23. package/dist/types/lib/formatResults.d.ts +5 -0
  24. package/dist/types/lib/formatResults.d.ts.map +1 -0
  25. package/dist/types/lib/index.d.ts +2 -0
  26. package/dist/types/lib/index.d.ts.map +1 -1
  27. package/package.json +21 -20
  28. package/src/components/BwPayloadTable.tsx +3 -1
  29. package/src/components/block/BlockBoundWitnessDetails.stories.tsx +1 -1
  30. package/src/components/block/BlockBoundWitnessDetails.tsx +10 -2
  31. package/src/components/block/card/Card.tsx +62 -0
  32. package/src/components/block/card/CardHeader.tsx +49 -0
  33. package/src/components/block/card/hooks/index.ts +1 -0
  34. package/src/components/block/card/hooks/useDetails.ts +44 -0
  35. package/src/components/block/card/index.ts +1 -0
  36. package/src/components/transactions/TransactionDetails.stories.tsx +1 -1
  37. package/src/components/transactions/card/Card.tsx +41 -72
  38. package/src/components/transactions/card/hooks/index.ts +1 -0
  39. package/src/components/transactions/card/hooks/useDetails.ts +41 -0
  40. package/src/lib/formatFees.ts +9 -0
  41. package/src/lib/formatResults.ts +8 -0
  42. package/src/lib/index.ts +2 -0
@@ -2,21 +2,31 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // src/components/block/BlockBoundWitnessDetails.tsx
5
- import { Divider } from "@mui/material";
6
5
  import { filterAs } from "@xylabs/array";
7
6
  import { ErrorRender } from "@xylabs/react-error";
8
7
  import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
9
8
  import { usePromise } from "@xylabs/react-promise";
10
9
  import { isBoundWitness } from "@xyo-network/boundwitness-model";
10
+ import { SignedHydratedBlockWrapper } from "@xyo-network/chain-wrappers";
11
11
  import { PayloadBuilder } from "@xyo-network/payload-builder";
12
12
  import { BoundWitnessPayloadsTable, BoundWitnessSignatureTable, BWActions, HashHeadingPaper, HeadingPaper as HeadingPaper2 } from "@xyo-network/react-boundwitness-plugin";
13
13
  import { useTxsFromBlock } from "@xyo-network/react-chain-blockchain";
14
14
  import { usePayloadHash } from "@xyo-network/react-shared";
15
15
  import { isTransactionBoundWitness } from "@xyo-network/xl1-protocol";
16
- import React2, { useMemo } from "react";
16
+ import React4, { useMemo as useMemo2 } from "react";
17
17
  import { FaSignature } from "react-icons/fa";
18
18
  import { GrTransaction } from "react-icons/gr";
19
- import { VscSymbolMethod as VscSymbolMethod2, VscSymbolNamespace } from "react-icons/vsc";
19
+ import { VscSymbolMethod as VscSymbolMethod2, VscSymbolNamespace as VscSymbolNamespace2 } from "react-icons/vsc";
20
+
21
+ // src/lib/formatFees.ts
22
+ import { isUndefined } from "@xylabs/typeof";
23
+ import { bigIntToFixedPointString } from "@xyo-network/chain-utils";
24
+ var formatFee = /* @__PURE__ */ __name((fee) => {
25
+ if (isUndefined(fee)) return "N/A";
26
+ const stringValue = bigIntToFixedPointString(fee, 12);
27
+ if (stringValue === "0") return stringValue;
28
+ return stringValue;
29
+ }, "formatFee");
20
30
 
21
31
  // src/lib/formatPayloadsForTable.ts
22
32
  var formatPayloadsForTable = /* @__PURE__ */ __name((pairs) => {
@@ -32,12 +42,26 @@ var formatPayloadsForTable = /* @__PURE__ */ __name((pairs) => {
32
42
  };
33
43
  }, "formatPayloadsForTable");
34
44
 
45
+ // src/lib/formatResults.ts
46
+ var formatResults = /* @__PURE__ */ __name((results) => {
47
+ const result = {
48
+ labels: [],
49
+ values: []
50
+ };
51
+ for (const [label, value] of Object.entries(results)) {
52
+ result.labels.push(label);
53
+ result.values.push(value);
54
+ }
55
+ return result;
56
+ }, "formatResults");
57
+
35
58
  // src/components/BwPayloadTable.tsx
36
59
  import { FlexCol } from "@xylabs/react-flexbox";
37
60
  import { BoundWitnessPayloadTableBody, BoundWitnessPayloadTableHead, HeadingPaper } from "@xyo-network/react-boundwitness-plugin";
38
61
  import { TableEx } from "@xyo-network/react-table";
39
62
  import React from "react";
40
63
  import { VscSymbolMethod } from "react-icons/vsc";
64
+ var clickableFields = "hash";
41
65
  var BWPayloadTableFlexbox = /* @__PURE__ */ __name(({ IconComponent, eventNoun, hashes, schemas, headingTitle, ...props }) => {
42
66
  const resolvedIconComponent = IconComponent ?? /* @__PURE__ */ React.createElement(VscSymbolMethod, null);
43
67
  return /* @__PURE__ */ React.createElement(FlexCol, {
@@ -50,17 +74,170 @@ var BWPayloadTableFlexbox = /* @__PURE__ */ __name(({ IconComponent, eventNoun,
50
74
  }), /* @__PURE__ */ React.createElement(TableEx, null, /* @__PURE__ */ React.createElement(BoundWitnessPayloadTableHead, null), /* @__PURE__ */ React.createElement(BoundWitnessPayloadTableBody, {
51
75
  payloadHashes: hashes,
52
76
  payloadSchemas: schemas,
53
- eventNoun
77
+ eventNoun,
78
+ clickableFields: [
79
+ clickableFields
80
+ ]
54
81
  })));
55
82
  }, "BWPayloadTableFlexbox");
56
83
 
84
+ // src/components/block/card/Card.tsx
85
+ import { Card, CardContent, Grid } from "@mui/material";
86
+ import { DetailsStack, LabelValueStack } from "@xyo-network/react-chain-shared";
87
+ import React3 from "react";
88
+ import { GrSteps } from "react-icons/gr";
89
+ import { IoStatsChartOutline } from "react-icons/io5";
90
+ import { VscSymbolNamespace } from "react-icons/vsc";
91
+
92
+ // src/components/block/card/CardHeader.tsx
93
+ import { CardHeader, Link, Tooltip, Typography } from "@mui/material";
94
+ import { BlockiesAvatarAddress } from "@xyo-network/react-chain-blockies";
95
+ import { useEvent } from "@xyo-network/react-event";
96
+ import React2 from "react";
97
+ var BlockBoundWitnessCardHeader = /* @__PURE__ */ __name(({ linked = true, address }) => {
98
+ const [ref, dispatch] = useEvent();
99
+ return /* @__PURE__ */ React2.createElement(CardHeader, {
100
+ ref,
101
+ title: /* @__PURE__ */ React2.createElement(Typography, {
102
+ onClick: /* @__PURE__ */ __name(() => linked && dispatch("address", "click", address), "onClick"),
103
+ variant: "body2",
104
+ sx: {
105
+ maxWidth: "100%",
106
+ textOverflow: "ellipsis",
107
+ overflow: "hidden",
108
+ fontFamily: "monospace"
109
+ }
110
+ }, linked ? /* @__PURE__ */ React2.createElement(Link, {
111
+ sx: {
112
+ cursor: "pointer"
113
+ }
114
+ }, address) : address),
115
+ avatar: /* @__PURE__ */ React2.createElement(Tooltip, {
116
+ title: `Address - ${address}`
117
+ }, /* @__PURE__ */ React2.createElement(BlockiesAvatarAddress, {
118
+ address,
119
+ onClick: /* @__PURE__ */ __name(() => dispatch("address", "click", address), "onClick"),
120
+ size: 21,
121
+ sx: {
122
+ cursor: "pointer"
123
+ }
124
+ }))
125
+ });
126
+ }, "BlockBoundWitnessCardHeader");
127
+
128
+ // src/components/block/card/hooks/useDetails.ts
129
+ import { useMemo } from "react";
130
+ var useBlockDetails = /* @__PURE__ */ __name((wrapper) => {
131
+ const stats = useMemo(() => {
132
+ const stats2 = {
133
+ Height: wrapper.boundWitness.block.toLocaleString(navigator.language ?? "en-US"),
134
+ Protocol: wrapper.boundWitness.protocol.toString(),
135
+ Signatures: wrapper.signatureCount.toLocaleString(navigator.language ?? "en-US"),
136
+ $epoch: wrapper.boundWitness.$epoch.toString()
137
+ };
138
+ return formatResults(stats2);
139
+ }, [
140
+ wrapper
141
+ ]);
142
+ const payloads = useMemo(() => {
143
+ const payloads2 = {
144
+ "Transactions": wrapper.transactionCount.toLocaleString(navigator.language ?? "en-US"),
145
+ "Public Payloads": wrapper.publicPayloadCount.toLocaleString(navigator.language ?? "en-US"),
146
+ "Private Payloads": wrapper.privatePayloadCount.toLocaleString(navigator.language ?? "en-US"),
147
+ "Total Payloads": wrapper.payloadCount.toLocaleString(navigator.language ?? "en-US")
148
+ };
149
+ return formatResults(payloads2);
150
+ }, [
151
+ wrapper
152
+ ]);
153
+ const stepHashes = useMemo(() => {
154
+ const stepHashes2 = {};
155
+ let step = 0;
156
+ for (const hash of wrapper.boundWitness.step_hashes) {
157
+ step++;
158
+ stepHashes2[`Step Hash ${step}`] = hash.toString();
159
+ }
160
+ return formatResults(stepHashes2);
161
+ }, [
162
+ wrapper
163
+ ]);
164
+ return {
165
+ stats,
166
+ payloads,
167
+ stepHashes
168
+ };
169
+ }, "useBlockDetails");
170
+
171
+ // src/components/block/card/Card.tsx
172
+ var BlockBoundWitnessCard = /* @__PURE__ */ __name(({ linkedAddress = true, wrapper, ...props }) => {
173
+ if (!wrapper) return null;
174
+ const { stats, payloads, stepHashes } = useBlockDetails(wrapper);
175
+ return /* @__PURE__ */ React3.createElement(Card, props, wrapper?.boundWitness.addresses.map((address) => /* @__PURE__ */ React3.createElement(BlockBoundWitnessCardHeader, {
176
+ key: address,
177
+ address,
178
+ linked: linkedAddress
179
+ })), /* @__PURE__ */ React3.createElement(CardContent, null, /* @__PURE__ */ React3.createElement(Grid, {
180
+ container: true,
181
+ spacing: 6,
182
+ sx: {
183
+ width: "100%"
184
+ }
185
+ }, /* @__PURE__ */ React3.createElement(Grid, {
186
+ size: {
187
+ xs: 12,
188
+ sm: 6,
189
+ md: 4
190
+ }
191
+ }, /* @__PURE__ */ React3.createElement(DetailsStack, {
192
+ IconComponent: IoStatsChartOutline,
193
+ heading: "Stats",
194
+ tooltipTitle: "Transaction Statistics"
195
+ }, /* @__PURE__ */ React3.createElement(LabelValueStack, {
196
+ labels: stats.labels,
197
+ values: stats.values
198
+ }))), /* @__PURE__ */ React3.createElement(Grid, {
199
+ size: {
200
+ xs: 12,
201
+ sm: 6,
202
+ md: 4
203
+ }
204
+ }, /* @__PURE__ */ React3.createElement(DetailsStack, {
205
+ IconComponent: VscSymbolNamespace,
206
+ heading: "Payloads",
207
+ tooltipTitle: "Payloads within the Block"
208
+ }, /* @__PURE__ */ React3.createElement(LabelValueStack, {
209
+ labels: payloads.labels,
210
+ values: payloads.values
211
+ }))), /* @__PURE__ */ React3.createElement(Grid, {
212
+ size: {
213
+ xs: 12,
214
+ sm: 6,
215
+ md: 4
216
+ }
217
+ }, /* @__PURE__ */ React3.createElement(DetailsStack, {
218
+ IconComponent: GrSteps,
219
+ heading: "Step Hashes",
220
+ tooltipTitle: "Step Hashes for the Block"
221
+ }, /* @__PURE__ */ React3.createElement(LabelValueStack, {
222
+ labels: stepHashes.labels,
223
+ values: stepHashes.values
224
+ }))))));
225
+ }, "BlockBoundWitnessCard");
226
+
57
227
  // src/components/block/BlockBoundWitnessDetails.tsx
58
228
  var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ block, paper, children, ...props }) => {
229
+ const [wrapper, wrapperError] = usePromise(async () => {
230
+ if (block) {
231
+ return await SignedHydratedBlockWrapper.parse(block);
232
+ }
233
+ }, [
234
+ block
235
+ ]);
59
236
  const boundWitness = block?.[0];
60
237
  const payloads = block?.[1];
61
238
  const hash = usePayloadHash(boundWitness);
62
239
  const [transactions, txFromBlockError] = useTxsFromBlock(block);
63
- const { hashes: txHashes, schemas: txSchemas } = useMemo(() => formatPayloadsForTable(transactions ?? []), [
240
+ const { hashes: txHashes, schemas: txSchemas } = useMemo2(() => formatPayloadsForTable(transactions ?? []), [
64
241
  transactions
65
242
  ]);
66
243
  const [nonTxBoundWitnesses, bwsFromBlockError] = usePromise(async () => {
@@ -69,35 +246,39 @@ var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ block, paper, children,
69
246
  }, [
70
247
  payloads
71
248
  ]);
72
- const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } = useMemo(() => formatPayloadsForTable(nonTxBoundWitnesses ?? []), [
249
+ const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } = useMemo2(() => formatPayloadsForTable(nonTxBoundWitnesses ?? []), [
73
250
  nonTxBoundWitnesses
74
251
  ]);
75
252
  const hasNonTxBoundWitnesses = (nonTxBoundWitnesses?.length ?? 0) > 0;
76
- return /* @__PURE__ */ React2.createElement(FlexCol2, {
253
+ return /* @__PURE__ */ React4.createElement(FlexCol2, {
77
254
  alignItems: "stretch",
78
255
  rowGap: 4,
79
256
  ...props
80
- }, /* @__PURE__ */ React2.createElement(ErrorRender, {
257
+ }, /* @__PURE__ */ React4.createElement(ErrorRender, {
81
258
  error: txFromBlockError ?? bwsFromBlockError,
82
259
  scope: "BlockBoundWitnessDetails.tsx"
83
- }), /* @__PURE__ */ React2.createElement(HashHeadingPaper, {
260
+ }), /* @__PURE__ */ React4.createElement(ErrorRender, {
261
+ error: wrapperError,
262
+ scope: "BlockBoundWitnessDetails.tsx:wrapperError"
263
+ }), /* @__PURE__ */ React4.createElement(HashHeadingPaper, {
84
264
  hash,
85
265
  paperProps: {
86
266
  sx: {
87
267
  p: 2
88
268
  }
89
269
  },
90
- AdornmentEnd: /* @__PURE__ */ React2.createElement(BWActions, {
270
+ AdornmentEnd: /* @__PURE__ */ React4.createElement(BWActions, {
91
271
  boundwitness: boundWitness
92
272
  }),
93
273
  identiconProps: {
94
274
  p: 0.75,
95
275
  size: 24
96
276
  }
97
- }), /* @__PURE__ */ React2.createElement(Divider, {
98
- flexItem: true
99
- }), (transactions?.length ?? 0) > 0 && /* @__PURE__ */ React2.createElement(BWPayloadTableFlexbox, {
100
- IconComponent: /* @__PURE__ */ React2.createElement(GrTransaction, null),
277
+ }), /* @__PURE__ */ React4.createElement(BlockBoundWitnessCard, {
278
+ elevation: 4,
279
+ wrapper
280
+ }), (transactions?.length ?? 0) > 0 && /* @__PURE__ */ React4.createElement(BWPayloadTableFlexbox, {
281
+ IconComponent: /* @__PURE__ */ React4.createElement(GrTransaction, null),
101
282
  eventNoun: "transaction",
102
283
  hashes: txHashes,
103
284
  headingTitle: "Transactions",
@@ -105,17 +286,17 @@ var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ block, paper, children,
105
286
  sx: {
106
287
  mb: 1
107
288
  }
108
- }), /* @__PURE__ */ React2.createElement(FlexCol2, {
289
+ }), /* @__PURE__ */ React4.createElement(FlexCol2, {
109
290
  alignItems: "stretch",
110
291
  rowGap: 1,
111
292
  mb: 1
112
- }, /* @__PURE__ */ React2.createElement(HeadingPaper2, {
113
- IconComponent: /* @__PURE__ */ React2.createElement(VscSymbolNamespace, null),
293
+ }, /* @__PURE__ */ React4.createElement(HeadingPaper2, {
294
+ IconComponent: /* @__PURE__ */ React4.createElement(VscSymbolNamespace2, null),
114
295
  heading: "Payloads"
115
- }), /* @__PURE__ */ React2.createElement(BoundWitnessPayloadsTable, {
296
+ }), /* @__PURE__ */ React4.createElement(BoundWitnessPayloadsTable, {
116
297
  boundwitness: boundWitness
117
- })), hasNonTxBoundWitnesses ? /* @__PURE__ */ React2.createElement(BWPayloadTableFlexbox, {
118
- IconComponent: /* @__PURE__ */ React2.createElement(VscSymbolMethod2, null),
298
+ })), hasNonTxBoundWitnesses ? /* @__PURE__ */ React4.createElement(BWPayloadTableFlexbox, {
299
+ IconComponent: /* @__PURE__ */ React4.createElement(VscSymbolMethod2, null),
119
300
  eventNoun: "boundwitness",
120
301
  hashes: nonTxBwHashes,
121
302
  headingTitle: "Bound Witnesses",
@@ -123,151 +304,144 @@ var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ block, paper, children,
123
304
  sx: {
124
305
  mb: 1
125
306
  }
126
- }) : null, /* @__PURE__ */ React2.createElement(FlexCol2, {
307
+ }) : null, /* @__PURE__ */ React4.createElement(FlexCol2, {
127
308
  alignItems: "stretch",
128
309
  rowGap: 1,
129
310
  mb: 1
130
- }, /* @__PURE__ */ React2.createElement(HeadingPaper2, {
131
- IconComponent: /* @__PURE__ */ React2.createElement(FaSignature, null),
311
+ }, /* @__PURE__ */ React4.createElement(HeadingPaper2, {
312
+ IconComponent: /* @__PURE__ */ React4.createElement(FaSignature, null),
132
313
  heading: "Signatures"
133
- }), /* @__PURE__ */ React2.createElement(BoundWitnessSignatureTable, {
314
+ }), /* @__PURE__ */ React4.createElement(BoundWitnessSignatureTable, {
134
315
  block: boundWitness
135
316
  })));
136
317
  }, "BlockBoundWitnessDetails");
137
318
 
138
319
  // src/components/transactions/card/Card.tsx
139
- import { Card, CardContent, Grid, Typography } from "@mui/material";
140
- import { isUndefined } from "@xylabs/typeof";
141
- import { bigIntToFixedPointString } from "@xyo-network/chain-utils";
142
- import { DetailsStack, LabelValueStack } from "@xyo-network/react-chain-shared";
143
- import React3, { useMemo as useMemo2 } from "react";
320
+ import { Card as Card2, CardContent as CardContent2, CardHeader as CardHeader2, Grid as Grid2, Link as Link2, Tooltip as Tooltip2, Typography as Typography2 } from "@mui/material";
321
+ import { BlockiesAvatarAddress as BlockiesAvatarAddress2 } from "@xyo-network/react-chain-blockies";
322
+ import { DetailsStack as DetailsStack2, LabelValueStack as LabelValueStack2 } from "@xyo-network/react-chain-shared";
323
+ import { useEvent as useEvent2 } from "@xyo-network/react-event";
324
+ import React5 from "react";
144
325
  import { GiReceiveMoney, GiSandsOfTime } from "react-icons/gi";
145
- import { IoStatsChartOutline } from "react-icons/io5";
146
- import { MdOutlineAlternateEmail } from "react-icons/md";
147
- var formatFee = /* @__PURE__ */ __name((fee) => {
148
- if (isUndefined(fee)) return;
149
- const stringValue = bigIntToFixedPointString(fee, 12);
150
- if (stringValue === "0") return "0.0";
151
- return stringValue;
152
- }, "formatFee");
153
- var TransactionBoundWitnessCard = /* @__PURE__ */ __name(({ wrapper, ...props }) => {
154
- if (!wrapper) return null;
155
- const stats = useMemo2(() => {
156
- const labels = [
157
- "Reward",
158
- "Elevated Payloads",
159
- "Total Payloads",
160
- "Signatures"
161
- ];
162
- const values = [
163
- wrapper.reward().toLocaleString(navigator.language ?? "en-US"),
164
- wrapper.elevatedPayloadCount.toLocaleString(navigator.language ?? "en-US"),
165
- wrapper.payloadCount.toLocaleString(navigator.language ?? "en-US"),
166
- wrapper.signatureCount.toLocaleString(navigator.language ?? "en-US"),
167
- ,
168
- ];
169
- return {
170
- labels,
171
- values
326
+ import { IoStatsChartOutline as IoStatsChartOutline2 } from "react-icons/io5";
327
+
328
+ // src/components/transactions/card/hooks/useDetails.ts
329
+ import { useMemo as useMemo3 } from "react";
330
+ var useTransactionDetails = /* @__PURE__ */ __name((wrapper) => {
331
+ const stats = useMemo3(() => {
332
+ const stats2 = {
333
+ "Reward": wrapper.reward().toLocaleString(navigator.language ?? "en-US"),
334
+ "Elevated Payloads": wrapper.elevatedPayloadCount.toLocaleString(navigator.language ?? "en-US"),
335
+ "Total Payloads": wrapper.payloadCount.toLocaleString(navigator.language ?? "en-US"),
336
+ "Signatures": wrapper.signatureCount.toLocaleString(navigator.language ?? "en-US")
172
337
  };
338
+ return formatResults(stats2);
173
339
  }, [
174
340
  wrapper
175
341
  ]);
176
- const fees = useMemo2(() => {
177
- const labels = [
178
- "Base",
179
- "Gas",
180
- "Priority",
181
- "Gas Limit"
182
- ];
183
- const values = [
184
- formatFee(wrapper.fees.base),
185
- formatFee(wrapper.fees.gasPrice),
186
- formatFee(wrapper.fees.priority),
187
- formatFee(wrapper.fees.gasLimit)
188
- ];
189
- return {
190
- labels,
191
- values
342
+ const fees = useMemo3(() => {
343
+ const fees2 = {
344
+ "Base": formatFee(wrapper.fees.base),
345
+ "Gas": formatFee(wrapper.fees.gasPrice),
346
+ "Priority": formatFee(wrapper.fees.priority),
347
+ "Gas Limit": formatFee(wrapper.fees.gasLimit)
192
348
  };
349
+ return formatResults(fees2);
193
350
  }, [
194
351
  wrapper
195
352
  ]);
196
- const blockDuration = useMemo2(() => {
197
- const labels = [
198
- "Expiration",
199
- "Not Before"
200
- ];
201
- const values = [
202
- wrapper.boundWitness.exp.toLocaleString(navigator.language ?? "en-US"),
203
- wrapper.boundWitness.nbf.toLocaleString(navigator.language ?? "en-US")
204
- ];
205
- return {
206
- labels,
207
- values
353
+ const blockDuration = useMemo3(() => {
354
+ const blockDuration2 = {
355
+ "Expiration": wrapper.boundWitness.exp.toLocaleString(navigator.language ?? "en-US"),
356
+ "Not Before": wrapper.boundWitness.nbf.toLocaleString(navigator.language ?? "en-US")
208
357
  };
358
+ return formatResults(blockDuration2);
209
359
  }, [
210
360
  wrapper
211
361
  ]);
212
- return /* @__PURE__ */ React3.createElement(Card, props, /* @__PURE__ */ React3.createElement(CardContent, null, /* @__PURE__ */ React3.createElement(Grid, {
362
+ return {
363
+ stats,
364
+ fees,
365
+ blockDuration
366
+ };
367
+ }, "useTransactionDetails");
368
+
369
+ // src/components/transactions/card/Card.tsx
370
+ var TransactionBoundWitnessCard = /* @__PURE__ */ __name(({ linkedAddress = true, wrapper, ...props }) => {
371
+ if (!wrapper) return null;
372
+ const { stats, fees, blockDuration } = useTransactionDetails(wrapper);
373
+ const [ref, dispatch] = useEvent2();
374
+ return /* @__PURE__ */ React5.createElement(Card2, {
375
+ ref,
376
+ ...props
377
+ }, /* @__PURE__ */ React5.createElement(CardHeader2, {
378
+ title: /* @__PURE__ */ React5.createElement(Typography2, {
379
+ onClick: /* @__PURE__ */ __name(() => linkedAddress && dispatch("address", "click", wrapper.boundWitness.from), "onClick"),
380
+ variant: "body2",
381
+ sx: {
382
+ maxWidth: "100%",
383
+ textOverflow: "ellipsis",
384
+ overflow: "hidden",
385
+ fontFamily: "monospace"
386
+ }
387
+ }, linkedAddress ? /* @__PURE__ */ React5.createElement(Link2, {
388
+ sx: {
389
+ cursor: "pointer"
390
+ }
391
+ }, wrapper?.boundWitness.from) : wrapper?.boundWitness.from),
392
+ avatar: /* @__PURE__ */ React5.createElement(Tooltip2, {
393
+ title: `From Address - ${wrapper?.boundWitness.from}`
394
+ }, /* @__PURE__ */ React5.createElement(BlockiesAvatarAddress2, {
395
+ address: wrapper?.boundWitness.from,
396
+ onClick: /* @__PURE__ */ __name(() => dispatch("address", "click", wrapper.boundWitness.from), "onClick"),
397
+ size: 21,
398
+ sx: {
399
+ cursor: "pointer"
400
+ }
401
+ }))
402
+ }), /* @__PURE__ */ React5.createElement(CardContent2, null, /* @__PURE__ */ React5.createElement(Grid2, {
213
403
  container: true,
214
404
  spacing: 6,
215
405
  sx: {
216
406
  width: "100%"
217
407
  }
218
- }, /* @__PURE__ */ React3.createElement(Grid, {
219
- size: {
220
- xs: 12
221
- }
222
- }, /* @__PURE__ */ React3.createElement(DetailsStack, {
223
- IconComponent: MdOutlineAlternateEmail,
224
- heading: "From:",
225
- tooltipTitle: "Address of the sender"
226
- }, /* @__PURE__ */ React3.createElement(Typography, {
227
- variant: "body2",
228
- sx: {
229
- maxWidth: "100%",
230
- textOverflow: "ellipsis",
231
- overflow: "hidden",
232
- fontFamily: "monospace"
233
- }
234
- }, wrapper?.boundWitness.from))), /* @__PURE__ */ React3.createElement(Grid, {
408
+ }, /* @__PURE__ */ React5.createElement(Grid2, {
235
409
  size: {
236
410
  xs: 12,
237
411
  sm: 6,
238
412
  md: 4
239
413
  }
240
- }, /* @__PURE__ */ React3.createElement(DetailsStack, {
241
- IconComponent: IoStatsChartOutline,
414
+ }, /* @__PURE__ */ React5.createElement(DetailsStack2, {
415
+ IconComponent: IoStatsChartOutline2,
242
416
  heading: "Stats",
243
417
  tooltipTitle: "Transaction Statistics"
244
- }, /* @__PURE__ */ React3.createElement(LabelValueStack, {
418
+ }, /* @__PURE__ */ React5.createElement(LabelValueStack2, {
245
419
  labels: stats.labels,
246
420
  values: stats.values
247
- }))), /* @__PURE__ */ React3.createElement(Grid, {
421
+ }))), /* @__PURE__ */ React5.createElement(Grid2, {
248
422
  size: {
249
423
  xs: 12,
250
424
  sm: 6,
251
425
  md: 4
252
426
  }
253
- }, /* @__PURE__ */ React3.createElement(DetailsStack, {
427
+ }, /* @__PURE__ */ React5.createElement(DetailsStack2, {
254
428
  IconComponent: GiReceiveMoney,
255
429
  heading: "Fees",
256
430
  tooltipTitle: "Fees offered to the producer"
257
- }, /* @__PURE__ */ React3.createElement(LabelValueStack, {
431
+ }, /* @__PURE__ */ React5.createElement(LabelValueStack2, {
258
432
  labels: fees.labels,
259
433
  values: fees.values
260
- }))), /* @__PURE__ */ React3.createElement(Grid, {
434
+ }))), /* @__PURE__ */ React5.createElement(Grid2, {
261
435
  size: {
262
436
  xs: 12,
263
437
  sm: 6,
264
438
  md: 4
265
439
  }
266
- }, /* @__PURE__ */ React3.createElement(DetailsStack, {
440
+ }, /* @__PURE__ */ React5.createElement(DetailsStack2, {
267
441
  IconComponent: GiSandsOfTime,
268
442
  heading: "Block Duration",
269
443
  tooltipTitle: "Block window for the transaction to be valid"
270
- }, /* @__PURE__ */ React3.createElement(LabelValueStack, {
444
+ }, /* @__PURE__ */ React5.createElement(LabelValueStack2, {
271
445
  labels: blockDuration.labels,
272
446
  values: blockDuration.values
273
447
  }))))));
@@ -281,7 +455,7 @@ import { isDefined } from "@xylabs/typeof";
281
455
  import { SignedHydratedTransactionWrapper } from "@xyo-network/chain-wrappers";
282
456
  import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
283
457
  import { BoundWitnessSignatureTable as BoundWitnessSignatureTable2, BWActions as BWActions2, HashHeadingPaper as HashHeadingPaper2, HeadingPaper as HeadingPaper3 } from "@xyo-network/react-boundwitness-plugin";
284
- import React4 from "react";
458
+ import React6 from "react";
285
459
  import { FaSignature as FaSignature2 } from "react-icons/fa";
286
460
  import { VscSymbolMethod as VscSymbolMethod3 } from "react-icons/vsc";
287
461
  var TransactionBoundWitnessDetails = /* @__PURE__ */ __name(({ transaction, ...props }) => {
@@ -307,49 +481,49 @@ var TransactionBoundWitnessDetails = /* @__PURE__ */ __name(({ transaction, ...p
307
481
  wrapper
308
482
  ]);
309
483
  const { hashes: elevatedPayloadHashes, schemas: elevatedPayloadSchemas } = elevatedPayloadSets ?? {};
310
- return /* @__PURE__ */ React4.createElement(FlexCol3, {
484
+ return /* @__PURE__ */ React6.createElement(FlexCol3, {
311
485
  alignItems: "stretch",
312
486
  rowGap: 2,
313
487
  ...props
314
- }, /* @__PURE__ */ React4.createElement(HashHeadingPaper2, {
488
+ }, /* @__PURE__ */ React6.createElement(HashHeadingPaper2, {
315
489
  hash: wrapper?.boundWitness?._hash,
316
490
  paperProps: {
317
491
  sx: {
318
492
  p: 2
319
493
  }
320
494
  },
321
- AdornmentEnd: /* @__PURE__ */ React4.createElement(BWActions2, {
495
+ AdornmentEnd: /* @__PURE__ */ React6.createElement(BWActions2, {
322
496
  boundwitness: wrapper?.boundWitness
323
497
  }),
324
498
  identiconProps: {
325
499
  p: 0.75,
326
500
  size: 24
327
501
  }
328
- }), /* @__PURE__ */ React4.createElement(ErrorRender2, {
502
+ }), /* @__PURE__ */ React6.createElement(ErrorRender2, {
329
503
  error: wrapperError,
330
504
  scope: "wrapperError:TransactionBoundWitnessDetails.tsx"
331
- }), /* @__PURE__ */ React4.createElement(ErrorRender2, {
505
+ }), /* @__PURE__ */ React6.createElement(ErrorRender2, {
332
506
  error: elevatedPayloadSetsError,
333
507
  scope: "elevatedPayloadSetsError:TransactionBoundWitnessDetails.tsx"
334
- }), /* @__PURE__ */ React4.createElement(TransactionBoundWitnessCard, {
508
+ }), /* @__PURE__ */ React6.createElement(TransactionBoundWitnessCard, {
335
509
  elevation: 4,
336
510
  wrapper
337
- }), /* @__PURE__ */ React4.createElement(BWPayloadTableFlexbox, {
338
- IconComponent: /* @__PURE__ */ React4.createElement(VscSymbolMethod3, null),
511
+ }), /* @__PURE__ */ React6.createElement(BWPayloadTableFlexbox, {
512
+ IconComponent: /* @__PURE__ */ React6.createElement(VscSymbolMethod3, null),
339
513
  hashes: elevatedPayloadHashes,
340
514
  headingTitle: "Elevated Payloads",
341
515
  schemas: elevatedPayloadSchemas,
342
516
  sx: {
343
517
  mb: 1
344
518
  }
345
- }), /* @__PURE__ */ React4.createElement(FlexCol3, {
519
+ }), /* @__PURE__ */ React6.createElement(FlexCol3, {
346
520
  alignItems: "stretch",
347
521
  rowGap: 1,
348
522
  mb: 1
349
- }, /* @__PURE__ */ React4.createElement(HeadingPaper3, {
350
- IconComponent: /* @__PURE__ */ React4.createElement(FaSignature2, null),
523
+ }, /* @__PURE__ */ React6.createElement(HeadingPaper3, {
524
+ IconComponent: /* @__PURE__ */ React6.createElement(FaSignature2, null),
351
525
  heading: "Signatures"
352
- }), /* @__PURE__ */ React4.createElement(BoundWitnessSignatureTable2, {
526
+ }), /* @__PURE__ */ React6.createElement(BoundWitnessSignatureTable2, {
353
527
  block: wrapper?.boundWitness
354
528
  })));
355
529
  }, "TransactionBoundWitnessDetails");