@xyo-network/react-chain-boundwitness 1.5.13 → 1.5.15

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