@xyo-network/react-chain-boundwitness 1.5.35 → 1.5.36
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 +232 -81
- package/dist/browser/index.mjs.map +1 -1
- package/dist/types/components/block/BlockBoundWitnessDetails.d.ts.map +1 -1
- package/dist/types/components/block/card/actions/BlockBoundWitnessActions.d.ts +9 -0
- package/dist/types/components/block/card/actions/BlockBoundWitnessActions.d.ts.map +1 -0
- package/dist/types/components/block/card/actions/BlockBoundWitnessVerification.d.ts +9 -0
- package/dist/types/components/block/card/actions/BlockBoundWitnessVerification.d.ts.map +1 -0
- package/dist/types/components/block/card/actions/index.d.ts +3 -0
- package/dist/types/components/block/card/actions/index.d.ts.map +1 -0
- package/dist/types/components/block/card/index.d.ts +1 -0
- package/dist/types/components/block/card/index.d.ts.map +1 -1
- package/dist/types/components/transactions/card/actions/TransactionActions.d.ts +9 -0
- package/dist/types/components/transactions/card/actions/TransactionActions.d.ts.map +1 -0
- package/dist/types/components/transactions/card/actions/TransactionVerification.d.ts +9 -0
- package/dist/types/components/transactions/card/actions/TransactionVerification.d.ts.map +1 -0
- package/dist/types/components/transactions/card/actions/index.d.ts +3 -0
- package/dist/types/components/transactions/card/actions/index.d.ts.map +1 -0
- package/dist/types/components/transactions/card/index.d.ts +1 -0
- package/dist/types/components/transactions/card/index.d.ts.map +1 -1
- package/package.json +34 -34
- package/src/components/block/BlockBoundWitnessDetails.tsx +2 -2
- package/src/components/block/card/actions/BlockBoundWitnessActions.tsx +38 -0
- package/src/components/block/card/actions/BlockBoundWitnessVerification.tsx +44 -0
- package/src/components/block/card/actions/index.ts +2 -0
- package/src/components/block/card/index.ts +1 -0
- package/src/components/transactions/TransactionBoundWitnessDetails.stories.tsx +9 -2
- package/src/components/transactions/TransactionBoundWitnessDetails.tsx +3 -3
- package/src/components/transactions/card/actions/TransactionActions.tsx +38 -0
- package/src/components/transactions/card/actions/TransactionVerification.tsx +43 -0
- package/src/components/transactions/card/actions/index.ts +2 -0
- package/src/components/transactions/card/index.ts +1 -0
package/dist/browser/index.mjs
CHANGED
|
@@ -5,15 +5,15 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
5
5
|
import { filterAs } from "@xylabs/array";
|
|
6
6
|
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
7
7
|
import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
|
|
8
|
-
import { usePromise as
|
|
8
|
+
import { usePromise as usePromise3 } from "@xylabs/react-promise";
|
|
9
9
|
import { isBoundWitness } from "@xyo-network/boundwitness-model";
|
|
10
10
|
import { HydratedBlockWrapper } from "@xyo-network/chain-wrappers";
|
|
11
11
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
12
|
-
import { BoundWitnessPayloadsTable, BoundWitnessSignatureTable,
|
|
12
|
+
import { BoundWitnessPayloadsTable, BoundWitnessSignatureTable, HashHeadingPaper, HeadingPaper as HeadingPaper2 } from "@xyo-network/react-boundwitness-plugin";
|
|
13
13
|
import { useTxsFromBlock } from "@xyo-network/react-chain-blockchain";
|
|
14
|
-
import { usePayloadHash } from "@xyo-network/react-shared";
|
|
14
|
+
import { usePayloadHash as usePayloadHash2 } from "@xyo-network/react-shared";
|
|
15
15
|
import { isTransactionBoundWitness } from "@xyo-network/xl1-protocol";
|
|
16
|
-
import
|
|
16
|
+
import React6, { useMemo as useMemo3 } from "react";
|
|
17
17
|
import { FaSignature } from "react-icons/fa";
|
|
18
18
|
import { GrTransaction } from "react-icons/gr";
|
|
19
19
|
import { VscSymbolMethod as VscSymbolMethod2, VscSymbolNamespace as VscSymbolNamespace2 } from "react-icons/vsc";
|
|
@@ -293,9 +293,83 @@ var BlockBoundWitnessCard = /* @__PURE__ */ __name(({ linkedAddress = true, view
|
|
|
293
293
|
}))))));
|
|
294
294
|
}, "BlockBoundWitnessCard");
|
|
295
295
|
|
|
296
|
+
// src/components/block/card/actions/BlockBoundWitnessActions.tsx
|
|
297
|
+
import { DataObject as DataObjectIcon } from "@mui/icons-material";
|
|
298
|
+
import { ellipsize } from "@xylabs/eth-address";
|
|
299
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
|
300
|
+
import { QuickTipButton } from "@xylabs/react-quick-tip-button";
|
|
301
|
+
import { BWPreviousHashQuickTipButton } from "@xyo-network/react-boundwitness-plugin";
|
|
302
|
+
import { usePayloadHash } from "@xyo-network/react-shared";
|
|
303
|
+
import React5 from "react";
|
|
304
|
+
|
|
305
|
+
// src/components/block/card/actions/BlockBoundWitnessVerification.tsx
|
|
306
|
+
import { CancelRounded as CancelRoundedIcon } from "@mui/icons-material";
|
|
307
|
+
import { assertEx } from "@xylabs/assert";
|
|
308
|
+
import { ErrorQuickTipButton } from "@xylabs/react-error";
|
|
309
|
+
import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
310
|
+
import { isDefined as isDefined2 } from "@xylabs/typeof";
|
|
311
|
+
import { validateBlock } from "@xyo-network/chain-validation";
|
|
312
|
+
import { isBlockBoundWitness } from "@xyo-network/xl1-protocol";
|
|
313
|
+
import React4, { useMemo as useMemo2 } from "react";
|
|
314
|
+
var InvalidIcon = /* @__PURE__ */ __name(({ ref, ...props }) => /* @__PURE__ */ React4.createElement(CancelRoundedIcon, {
|
|
315
|
+
color: "error",
|
|
316
|
+
ref,
|
|
317
|
+
...props
|
|
318
|
+
}), "InvalidIcon");
|
|
319
|
+
InvalidIcon.displayName = "InvalidIcon";
|
|
320
|
+
var BlockBoundWitnessVerification = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
321
|
+
const [validationErrors, validateError] = usePromise2(async () => {
|
|
322
|
+
if (isDefined2(block)) {
|
|
323
|
+
const resolvedBlock = assertEx(isBlockBoundWitness(block) ? block : void 0, () => "Block must be a BlockBoundWitness");
|
|
324
|
+
return await validateBlock(resolvedBlock);
|
|
325
|
+
}
|
|
326
|
+
}, [
|
|
327
|
+
block
|
|
328
|
+
]);
|
|
329
|
+
const resolvedErrors = useMemo2(() => {
|
|
330
|
+
const errors = [];
|
|
331
|
+
if (isDefined2(validationErrors)) {
|
|
332
|
+
if (Array.isArray(validationErrors)) errors.push(...validationErrors);
|
|
333
|
+
if (validationErrors instanceof Error) errors.push(validationErrors);
|
|
334
|
+
if (isDefined2(validateError)) errors.push(validateError);
|
|
335
|
+
return errors;
|
|
336
|
+
}
|
|
337
|
+
}, [
|
|
338
|
+
validateError,
|
|
339
|
+
validationErrors
|
|
340
|
+
]);
|
|
341
|
+
return /* @__PURE__ */ React4.createElement(ErrorQuickTipButton, {
|
|
342
|
+
boundWitnessType: "Block",
|
|
343
|
+
errors: resolvedErrors,
|
|
344
|
+
...props
|
|
345
|
+
});
|
|
346
|
+
}, "BlockBoundWitnessVerification");
|
|
347
|
+
|
|
348
|
+
// src/components/block/card/actions/BlockBoundWitnessActions.tsx
|
|
349
|
+
var BlockBoundWitnessActions = /* @__PURE__ */ __name(({ boundwitness, validationIconColors = false, ...props }) => {
|
|
350
|
+
const hash = usePayloadHash(boundwitness);
|
|
351
|
+
return /* @__PURE__ */ React5.createElement(FlexRow, props, boundwitness?.previous_hashes.length === 0 ? null : /* @__PURE__ */ React5.createElement(BWPreviousHashQuickTipButton, {
|
|
352
|
+
boundwitness
|
|
353
|
+
}), /* @__PURE__ */ React5.createElement(BlockBoundWitnessVerification, {
|
|
354
|
+
iconColors: validationIconColors,
|
|
355
|
+
block: boundwitness
|
|
356
|
+
}), /* @__PURE__ */ React5.createElement(QuickTipButton, {
|
|
357
|
+
Icon: DataObjectIcon,
|
|
358
|
+
title: `JSON for ${ellipsize(hash ?? "", 8)}`,
|
|
359
|
+
dialogProps: {
|
|
360
|
+
fullWidth: true,
|
|
361
|
+
maxWidth: "md"
|
|
362
|
+
}
|
|
363
|
+
}, /* @__PURE__ */ React5.createElement("pre", {
|
|
364
|
+
style: {
|
|
365
|
+
wordBreak: "break-all"
|
|
366
|
+
}
|
|
367
|
+
}, boundwitness ? JSON.stringify(boundwitness, null, 2) : null)));
|
|
368
|
+
}, "BlockBoundWitnessActions");
|
|
369
|
+
|
|
296
370
|
// src/components/block/BlockBoundWitnessDetails.tsx
|
|
297
371
|
var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ block, paper, viewer, children, ...props }) => {
|
|
298
|
-
const [wrapper, wrapperError] =
|
|
372
|
+
const [wrapper, wrapperError] = usePromise3(async () => {
|
|
299
373
|
if (block) {
|
|
300
374
|
return await HydratedBlockWrapper.parse(block);
|
|
301
375
|
}
|
|
@@ -304,51 +378,51 @@ var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ block, paper, viewer, c
|
|
|
304
378
|
]);
|
|
305
379
|
const boundWitness = block?.[0];
|
|
306
380
|
const payloads = block?.[1];
|
|
307
|
-
const hash =
|
|
381
|
+
const hash = usePayloadHash2(boundWitness);
|
|
308
382
|
const [transactions, txFromBlockError] = useTxsFromBlock(block);
|
|
309
|
-
const { hashes: txHashes, schemas: txSchemas } =
|
|
383
|
+
const { hashes: txHashes, schemas: txSchemas } = useMemo3(() => formatPayloadsForTable(transactions ?? []), [
|
|
310
384
|
transactions
|
|
311
385
|
]);
|
|
312
|
-
const [nonTxBoundWitnesses, bwsFromBlockError] =
|
|
386
|
+
const [nonTxBoundWitnesses, bwsFromBlockError] = usePromise3(async () => {
|
|
313
387
|
const bws = filterAs(payloads ?? [], (payload) => !isTransactionBoundWitness(payload) && isBoundWitness(payload) ? payload : void 0);
|
|
314
388
|
return await PayloadBuilder.hashPairs(bws);
|
|
315
389
|
}, [
|
|
316
390
|
payloads
|
|
317
391
|
]);
|
|
318
|
-
const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } =
|
|
392
|
+
const { hashes: nonTxBwHashes, schemas: nonTxBwSchemas } = useMemo3(() => formatPayloadsForTable(nonTxBoundWitnesses ?? []), [
|
|
319
393
|
nonTxBoundWitnesses
|
|
320
394
|
]);
|
|
321
395
|
const hasNonTxBoundWitnesses = (nonTxBoundWitnesses?.length ?? 0) > 0;
|
|
322
|
-
return /* @__PURE__ */
|
|
396
|
+
return /* @__PURE__ */ React6.createElement(FlexCol2, {
|
|
323
397
|
alignItems: "stretch",
|
|
324
398
|
rowGap: 4,
|
|
325
399
|
...props
|
|
326
|
-
}, /* @__PURE__ */
|
|
400
|
+
}, /* @__PURE__ */ React6.createElement(ErrorRender2, {
|
|
327
401
|
error: txFromBlockError ?? bwsFromBlockError,
|
|
328
402
|
scope: "BlockBoundWitnessDetails.tsx"
|
|
329
|
-
}), /* @__PURE__ */
|
|
403
|
+
}), /* @__PURE__ */ React6.createElement(ErrorRender2, {
|
|
330
404
|
error: wrapperError,
|
|
331
405
|
scope: "BlockBoundWitnessDetails.tsx:wrapperError"
|
|
332
|
-
}), /* @__PURE__ */
|
|
406
|
+
}), /* @__PURE__ */ React6.createElement(HashHeadingPaper, {
|
|
333
407
|
hash,
|
|
334
408
|
paperProps: {
|
|
335
409
|
sx: {
|
|
336
410
|
p: 2
|
|
337
411
|
}
|
|
338
412
|
},
|
|
339
|
-
AdornmentEnd: /* @__PURE__ */
|
|
413
|
+
AdornmentEnd: /* @__PURE__ */ React6.createElement(BlockBoundWitnessActions, {
|
|
340
414
|
boundwitness: boundWitness
|
|
341
415
|
}),
|
|
342
416
|
identiconProps: {
|
|
343
417
|
p: 0.75,
|
|
344
418
|
size: 24
|
|
345
419
|
}
|
|
346
|
-
}), /* @__PURE__ */
|
|
420
|
+
}), /* @__PURE__ */ React6.createElement(BlockBoundWitnessCard, {
|
|
347
421
|
elevation: 4,
|
|
348
422
|
viewer,
|
|
349
423
|
wrapper
|
|
350
|
-
}), (transactions?.length ?? 0) > 0 && /* @__PURE__ */
|
|
351
|
-
IconComponent: /* @__PURE__ */
|
|
424
|
+
}), (transactions?.length ?? 0) > 0 && /* @__PURE__ */ React6.createElement(PayloadTableFlexbox, {
|
|
425
|
+
IconComponent: /* @__PURE__ */ React6.createElement(GrTransaction, null),
|
|
352
426
|
eventNoun: "transaction",
|
|
353
427
|
hashes: txHashes,
|
|
354
428
|
headingTitle: "Transactions",
|
|
@@ -356,17 +430,17 @@ var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ block, paper, viewer, c
|
|
|
356
430
|
sx: {
|
|
357
431
|
mb: 1
|
|
358
432
|
}
|
|
359
|
-
}), /* @__PURE__ */
|
|
433
|
+
}), /* @__PURE__ */ React6.createElement(FlexCol2, {
|
|
360
434
|
alignItems: "stretch",
|
|
361
435
|
rowGap: 1,
|
|
362
436
|
mb: 1
|
|
363
|
-
}, /* @__PURE__ */
|
|
364
|
-
IconComponent: /* @__PURE__ */
|
|
437
|
+
}, /* @__PURE__ */ React6.createElement(HeadingPaper2, {
|
|
438
|
+
IconComponent: /* @__PURE__ */ React6.createElement(VscSymbolNamespace2, null),
|
|
365
439
|
heading: "Payloads"
|
|
366
|
-
}), /* @__PURE__ */
|
|
440
|
+
}), /* @__PURE__ */ React6.createElement(BoundWitnessPayloadsTable, {
|
|
367
441
|
boundwitness: boundWitness
|
|
368
|
-
})), hasNonTxBoundWitnesses ? /* @__PURE__ */
|
|
369
|
-
IconComponent: /* @__PURE__ */
|
|
442
|
+
})), hasNonTxBoundWitnesses ? /* @__PURE__ */ React6.createElement(PayloadTableFlexbox, {
|
|
443
|
+
IconComponent: /* @__PURE__ */ React6.createElement(VscSymbolMethod2, null),
|
|
370
444
|
eventNoun: "boundwitness",
|
|
371
445
|
hashes: nonTxBwHashes,
|
|
372
446
|
headingTitle: "Bound Witnesses",
|
|
@@ -374,31 +448,106 @@ var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ block, paper, viewer, c
|
|
|
374
448
|
sx: {
|
|
375
449
|
mb: 1
|
|
376
450
|
}
|
|
377
|
-
}) : null, /* @__PURE__ */
|
|
451
|
+
}) : null, /* @__PURE__ */ React6.createElement(FlexCol2, {
|
|
378
452
|
alignItems: "stretch",
|
|
379
453
|
rowGap: 1,
|
|
380
454
|
mb: 1
|
|
381
|
-
}, /* @__PURE__ */
|
|
382
|
-
IconComponent: /* @__PURE__ */
|
|
455
|
+
}, /* @__PURE__ */ React6.createElement(HeadingPaper2, {
|
|
456
|
+
IconComponent: /* @__PURE__ */ React6.createElement(FaSignature, null),
|
|
383
457
|
heading: "Signatures"
|
|
384
|
-
}), /* @__PURE__ */
|
|
458
|
+
}), /* @__PURE__ */ React6.createElement(BoundWitnessSignatureTable, {
|
|
385
459
|
block: boundWitness
|
|
386
460
|
})));
|
|
387
461
|
}, "BlockBoundWitnessDetails");
|
|
388
462
|
|
|
463
|
+
// src/components/transactions/card/actions/TransactionActions.tsx
|
|
464
|
+
import { DataObject as DataObjectIcon2 } from "@mui/icons-material";
|
|
465
|
+
import { ellipsize as ellipsize2 } from "@xylabs/eth-address";
|
|
466
|
+
import { FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
467
|
+
import { QuickTipButton as QuickTipButton2 } from "@xylabs/react-quick-tip-button";
|
|
468
|
+
import { BWPreviousHashQuickTipButton as BWPreviousHashQuickTipButton2 } from "@xyo-network/react-boundwitness-plugin";
|
|
469
|
+
import { usePayloadHash as usePayloadHash3 } from "@xyo-network/react-shared";
|
|
470
|
+
import React8 from "react";
|
|
471
|
+
|
|
472
|
+
// src/components/transactions/card/actions/TransactionVerification.tsx
|
|
473
|
+
import { CancelRounded as CancelRoundedIcon2 } from "@mui/icons-material";
|
|
474
|
+
import { assertEx as assertEx2 } from "@xylabs/assert";
|
|
475
|
+
import { ErrorQuickTipButton as ErrorQuickTipButton2 } from "@xylabs/react-error";
|
|
476
|
+
import { usePromise as usePromise4 } from "@xylabs/react-promise";
|
|
477
|
+
import { isDefined as isDefined3 } from "@xylabs/typeof";
|
|
478
|
+
import { validateTransaction } from "@xyo-network/chain-validation";
|
|
479
|
+
import { isHydratedTransaction } from "@xyo-network/xl1-protocol";
|
|
480
|
+
import React7, { useMemo as useMemo4 } from "react";
|
|
481
|
+
var InvalidIcon2 = /* @__PURE__ */ __name(({ ref, ...props }) => /* @__PURE__ */ React7.createElement(CancelRoundedIcon2, {
|
|
482
|
+
color: "error",
|
|
483
|
+
ref,
|
|
484
|
+
...props
|
|
485
|
+
}), "InvalidIcon");
|
|
486
|
+
InvalidIcon2.displayName = "InvalidIcon";
|
|
487
|
+
var TransactionVerification = /* @__PURE__ */ __name(({ transaction, ...props }) => {
|
|
488
|
+
const [validationErrors, validateError] = usePromise4(async () => {
|
|
489
|
+
if (isDefined3(transaction)) {
|
|
490
|
+
const resolvedTransaction = assertEx2(isHydratedTransaction(transaction) ? transaction : void 0, () => "Transaction must be a HydratedTransaction");
|
|
491
|
+
return await validateTransaction(resolvedTransaction);
|
|
492
|
+
}
|
|
493
|
+
}, [
|
|
494
|
+
transaction
|
|
495
|
+
]);
|
|
496
|
+
const resolvedErrors = useMemo4(() => {
|
|
497
|
+
const errors = [];
|
|
498
|
+
if (isDefined3(validationErrors)) {
|
|
499
|
+
if (Array.isArray(validationErrors)) errors.push(...validationErrors);
|
|
500
|
+
if (validationErrors instanceof Error) errors.push(validationErrors);
|
|
501
|
+
if (isDefined3(validateError)) errors.push(validateError);
|
|
502
|
+
return errors;
|
|
503
|
+
}
|
|
504
|
+
}, [
|
|
505
|
+
validateError,
|
|
506
|
+
validationErrors
|
|
507
|
+
]);
|
|
508
|
+
return /* @__PURE__ */ React7.createElement(ErrorQuickTipButton2, {
|
|
509
|
+
boundWitnessType: "Transaction",
|
|
510
|
+
errors: resolvedErrors,
|
|
511
|
+
...props
|
|
512
|
+
});
|
|
513
|
+
}, "TransactionVerification");
|
|
514
|
+
|
|
515
|
+
// src/components/transactions/card/actions/TransactionActions.tsx
|
|
516
|
+
var TransactionActions = /* @__PURE__ */ __name(({ transaction, validationIconColors = false, ...props }) => {
|
|
517
|
+
const txBw = transaction?.[0];
|
|
518
|
+
const hash = usePayloadHash3(txBw);
|
|
519
|
+
return /* @__PURE__ */ React8.createElement(FlexRow2, props, txBw?.previous_hashes.length === 0 ? null : /* @__PURE__ */ React8.createElement(BWPreviousHashQuickTipButton2, {
|
|
520
|
+
boundwitness: txBw
|
|
521
|
+
}), /* @__PURE__ */ React8.createElement(TransactionVerification, {
|
|
522
|
+
iconColors: validationIconColors,
|
|
523
|
+
transaction
|
|
524
|
+
}), /* @__PURE__ */ React8.createElement(QuickTipButton2, {
|
|
525
|
+
Icon: DataObjectIcon2,
|
|
526
|
+
title: `JSON for ${ellipsize2(hash ?? "", 8)}`,
|
|
527
|
+
dialogProps: {
|
|
528
|
+
fullWidth: true,
|
|
529
|
+
maxWidth: "md"
|
|
530
|
+
}
|
|
531
|
+
}, /* @__PURE__ */ React8.createElement("pre", {
|
|
532
|
+
style: {
|
|
533
|
+
wordBreak: "break-all"
|
|
534
|
+
}
|
|
535
|
+
}, transaction ? JSON.stringify(transaction, null, 2) : null)));
|
|
536
|
+
}, "TransactionActions");
|
|
537
|
+
|
|
389
538
|
// src/components/transactions/card/Card.tsx
|
|
390
539
|
import { Card as Card2, CardContent as CardContent2, CardHeader as CardHeader2, Grid as Grid2, Link as Link2, Tooltip as Tooltip3, Typography as Typography2 } from "@mui/material";
|
|
391
540
|
import { BlockiesAvatarAddress as BlockiesAvatarAddress2 } from "@xyo-network/react-chain-blockies";
|
|
392
541
|
import { DetailsStack as DetailsStack2, LabelValueStack as LabelValueStack2 } from "@xyo-network/react-chain-shared";
|
|
393
542
|
import { useEvent as useEvent2 } from "@xyo-network/react-event";
|
|
394
|
-
import
|
|
543
|
+
import React9 from "react";
|
|
395
544
|
import { GiReceiveMoney, GiSandsOfTime } from "react-icons/gi";
|
|
396
545
|
import { IoStatsChartOutline as IoStatsChartOutline2 } from "react-icons/io5";
|
|
397
546
|
|
|
398
547
|
// src/components/transactions/card/hooks/useDetails.ts
|
|
399
|
-
import { useMemo as
|
|
548
|
+
import { useMemo as useMemo5 } from "react";
|
|
400
549
|
var useTransactionDetails = /* @__PURE__ */ __name((wrapper) => {
|
|
401
|
-
const stats =
|
|
550
|
+
const stats = useMemo5(() => {
|
|
402
551
|
const stats2 = {
|
|
403
552
|
"Reward": formatNumber(wrapper.reward()),
|
|
404
553
|
"On Chain Payloads": formatNumber(wrapper.elevatedPayloadCount),
|
|
@@ -410,7 +559,7 @@ var useTransactionDetails = /* @__PURE__ */ __name((wrapper) => {
|
|
|
410
559
|
}, [
|
|
411
560
|
wrapper
|
|
412
561
|
]);
|
|
413
|
-
const fees =
|
|
562
|
+
const fees = useMemo5(() => {
|
|
414
563
|
const fees2 = {
|
|
415
564
|
"Base": formatFee(wrapper.fees.base),
|
|
416
565
|
"Gas": formatFee(wrapper.fees.gasPrice),
|
|
@@ -421,7 +570,7 @@ var useTransactionDetails = /* @__PURE__ */ __name((wrapper) => {
|
|
|
421
570
|
}, [
|
|
422
571
|
wrapper
|
|
423
572
|
]);
|
|
424
|
-
const blockDuration =
|
|
573
|
+
const blockDuration = useMemo5(() => {
|
|
425
574
|
const blockDuration2 = {
|
|
426
575
|
"Expiration": wrapper.boundWitness.exp.toLocaleString(navigator.language ?? "en-US"),
|
|
427
576
|
"Not Before": wrapper.boundWitness.nbf.toLocaleString(navigator.language ?? "en-US")
|
|
@@ -442,11 +591,11 @@ var TransactionBoundWitnessCard = /* @__PURE__ */ __name(({ linkedAddress = true
|
|
|
442
591
|
if (!wrapper) return null;
|
|
443
592
|
const { stats, fees, blockDuration } = useTransactionDetails(wrapper);
|
|
444
593
|
const [ref, dispatch] = useEvent2();
|
|
445
|
-
return /* @__PURE__ */
|
|
594
|
+
return /* @__PURE__ */ React9.createElement(Card2, {
|
|
446
595
|
ref,
|
|
447
596
|
...props
|
|
448
|
-
}, /* @__PURE__ */
|
|
449
|
-
title: /* @__PURE__ */
|
|
597
|
+
}, /* @__PURE__ */ React9.createElement(CardHeader2, {
|
|
598
|
+
title: /* @__PURE__ */ React9.createElement(Typography2, {
|
|
450
599
|
onClick: /* @__PURE__ */ __name(() => linkedAddress && dispatch("address", "click", wrapper.boundWitness.from), "onClick"),
|
|
451
600
|
variant: "body2",
|
|
452
601
|
sx: {
|
|
@@ -455,14 +604,14 @@ var TransactionBoundWitnessCard = /* @__PURE__ */ __name(({ linkedAddress = true
|
|
|
455
604
|
overflow: "hidden",
|
|
456
605
|
fontFamily: "monospace"
|
|
457
606
|
}
|
|
458
|
-
}, linkedAddress ? /* @__PURE__ */
|
|
607
|
+
}, linkedAddress ? /* @__PURE__ */ React9.createElement(Link2, {
|
|
459
608
|
sx: {
|
|
460
609
|
cursor: "pointer"
|
|
461
610
|
}
|
|
462
611
|
}, wrapper?.boundWitness.from) : wrapper?.boundWitness.from),
|
|
463
|
-
avatar: /* @__PURE__ */
|
|
612
|
+
avatar: /* @__PURE__ */ React9.createElement(Tooltip3, {
|
|
464
613
|
title: `From Address - ${wrapper?.boundWitness.from}`
|
|
465
|
-
}, /* @__PURE__ */
|
|
614
|
+
}, /* @__PURE__ */ React9.createElement(BlockiesAvatarAddress2, {
|
|
466
615
|
address: wrapper?.boundWitness.from,
|
|
467
616
|
onClick: /* @__PURE__ */ __name(() => dispatch("address", "click", wrapper.boundWitness.from), "onClick"),
|
|
468
617
|
size: 21,
|
|
@@ -470,49 +619,49 @@ var TransactionBoundWitnessCard = /* @__PURE__ */ __name(({ linkedAddress = true
|
|
|
470
619
|
cursor: "pointer"
|
|
471
620
|
}
|
|
472
621
|
}))
|
|
473
|
-
}), /* @__PURE__ */
|
|
622
|
+
}), /* @__PURE__ */ React9.createElement(CardContent2, null, /* @__PURE__ */ React9.createElement(Grid2, {
|
|
474
623
|
container: true,
|
|
475
624
|
spacing: 6,
|
|
476
625
|
sx: {
|
|
477
626
|
width: "100%"
|
|
478
627
|
}
|
|
479
|
-
}, /* @__PURE__ */
|
|
628
|
+
}, /* @__PURE__ */ React9.createElement(Grid2, {
|
|
480
629
|
size: {
|
|
481
630
|
xs: 12,
|
|
482
631
|
sm: 6,
|
|
483
632
|
md: 4
|
|
484
633
|
}
|
|
485
|
-
}, /* @__PURE__ */
|
|
634
|
+
}, /* @__PURE__ */ React9.createElement(DetailsStack2, {
|
|
486
635
|
IconComponent: IoStatsChartOutline2,
|
|
487
636
|
heading: "Stats",
|
|
488
637
|
tooltipTitle: "Transaction Statistics"
|
|
489
|
-
}, /* @__PURE__ */
|
|
638
|
+
}, /* @__PURE__ */ React9.createElement(LabelValueStack2, {
|
|
490
639
|
labels: stats.labels,
|
|
491
640
|
values: stats.values
|
|
492
|
-
}))), /* @__PURE__ */
|
|
641
|
+
}))), /* @__PURE__ */ React9.createElement(Grid2, {
|
|
493
642
|
size: {
|
|
494
643
|
xs: 12,
|
|
495
644
|
sm: 6,
|
|
496
645
|
md: 4
|
|
497
646
|
}
|
|
498
|
-
}, /* @__PURE__ */
|
|
647
|
+
}, /* @__PURE__ */ React9.createElement(DetailsStack2, {
|
|
499
648
|
IconComponent: GiReceiveMoney,
|
|
500
649
|
heading: "Fees",
|
|
501
650
|
tooltipTitle: "Fees offered to the producer"
|
|
502
|
-
}, /* @__PURE__ */
|
|
651
|
+
}, /* @__PURE__ */ React9.createElement(LabelValueStack2, {
|
|
503
652
|
labels: fees.labels,
|
|
504
653
|
values: fees.values
|
|
505
|
-
}))), /* @__PURE__ */
|
|
654
|
+
}))), /* @__PURE__ */ React9.createElement(Grid2, {
|
|
506
655
|
size: {
|
|
507
656
|
xs: 12,
|
|
508
657
|
sm: 6,
|
|
509
658
|
md: 4
|
|
510
659
|
}
|
|
511
|
-
}, /* @__PURE__ */
|
|
660
|
+
}, /* @__PURE__ */ React9.createElement(DetailsStack2, {
|
|
512
661
|
IconComponent: GiSandsOfTime,
|
|
513
662
|
heading: "Block Duration",
|
|
514
663
|
tooltipTitle: "Block window for the transaction to be valid"
|
|
515
|
-
}, /* @__PURE__ */
|
|
664
|
+
}, /* @__PURE__ */ React9.createElement(LabelValueStack2, {
|
|
516
665
|
labels: blockDuration.labels,
|
|
517
666
|
values: blockDuration.values
|
|
518
667
|
}))))));
|
|
@@ -521,23 +670,23 @@ var TransactionBoundWitnessCard = /* @__PURE__ */ __name(({ linkedAddress = true
|
|
|
521
670
|
// src/components/transactions/TransactionBoundWitnessDetails.tsx
|
|
522
671
|
import { ErrorRender as ErrorRender3 } from "@xylabs/react-error";
|
|
523
672
|
import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
|
|
524
|
-
import { usePromise as
|
|
673
|
+
import { usePromise as usePromise6 } from "@xylabs/react-promise";
|
|
525
674
|
import { HydratedTransactionWrapper } from "@xyo-network/chain-wrappers";
|
|
526
|
-
import { BoundWitnessSignatureTable as BoundWitnessSignatureTable2,
|
|
527
|
-
import
|
|
675
|
+
import { BoundWitnessSignatureTable as BoundWitnessSignatureTable2, HashHeadingPaper as HashHeadingPaper2, HeadingPaper as HeadingPaper3 } from "@xyo-network/react-boundwitness-plugin";
|
|
676
|
+
import React10 from "react";
|
|
528
677
|
import { FaSignature as FaSignature2 } from "react-icons/fa";
|
|
529
678
|
import { VscSymbolNamespace as VscSymbolNamespace3 } from "react-icons/vsc";
|
|
530
679
|
|
|
531
680
|
// src/components/transactions/hooks/usePayloadTypes.ts
|
|
532
681
|
import { isHash } from "@xylabs/hex";
|
|
533
|
-
import { usePromise as
|
|
534
|
-
import { isDefined as
|
|
682
|
+
import { usePromise as usePromise5 } from "@xylabs/react-promise";
|
|
683
|
+
import { isDefined as isDefined4 } from "@xylabs/typeof";
|
|
535
684
|
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
536
685
|
import { isSchema } from "@xyo-network/payload-model";
|
|
537
|
-
import { useMemo as
|
|
686
|
+
import { useMemo as useMemo6, useState } from "react";
|
|
538
687
|
var useTransactionPayloadTypes = /* @__PURE__ */ __name((wrapper) => {
|
|
539
|
-
const [elevatedPayloadSets, elevatedPayloadSetsError] =
|
|
540
|
-
if (
|
|
688
|
+
const [elevatedPayloadSets, elevatedPayloadSetsError] = usePromise5(async () => {
|
|
689
|
+
if (isDefined4(wrapper)) {
|
|
541
690
|
const elevatedPayloads = wrapper.elevatedPayloads;
|
|
542
691
|
const pairs = await PayloadBuilder2.hashPairs(elevatedPayloads);
|
|
543
692
|
return formatPayloadsForTable(pairs);
|
|
@@ -550,8 +699,8 @@ var useTransactionPayloadTypes = /* @__PURE__ */ __name((wrapper) => {
|
|
|
550
699
|
}, [
|
|
551
700
|
wrapper
|
|
552
701
|
]);
|
|
553
|
-
const [publicPayloads, publicPayloadsError] =
|
|
554
|
-
if (
|
|
702
|
+
const [publicPayloads, publicPayloadsError] = usePromise5(async () => {
|
|
703
|
+
if (isDefined4(wrapper)) {
|
|
555
704
|
const publicPayloads2 = wrapper.publicExternalPayloads;
|
|
556
705
|
const pairs = await PayloadBuilder2.hashPairs(publicPayloads2);
|
|
557
706
|
return formatPayloadsForTable(pairs);
|
|
@@ -565,12 +714,12 @@ var useTransactionPayloadTypes = /* @__PURE__ */ __name((wrapper) => {
|
|
|
565
714
|
wrapper
|
|
566
715
|
]);
|
|
567
716
|
const [referencedPayloadsError, setReferencedPayloadsError] = useState([]);
|
|
568
|
-
const referencedPayloads =
|
|
717
|
+
const referencedPayloads = useMemo6(() => {
|
|
569
718
|
const ret = {
|
|
570
719
|
hashes: [],
|
|
571
720
|
schemas: []
|
|
572
721
|
};
|
|
573
|
-
if (
|
|
722
|
+
if (isDefined4(wrapper)) {
|
|
574
723
|
const referencedPayloads2 = wrapper.privateExternalPayloads;
|
|
575
724
|
for (const [hash, schema] of Object.entries(referencedPayloads2)) {
|
|
576
725
|
let resolved = false;
|
|
@@ -616,7 +765,7 @@ var useTransactionPayloadTypes = /* @__PURE__ */ __name((wrapper) => {
|
|
|
616
765
|
// src/components/transactions/TransactionBoundWitnessDetails.tsx
|
|
617
766
|
var nonClickableFields = [];
|
|
618
767
|
var TransactionBoundWitnessDetails = /* @__PURE__ */ __name(({ transaction, ...props }) => {
|
|
619
|
-
const [wrapper, wrapperError] =
|
|
768
|
+
const [wrapper, wrapperError] = usePromise6(async () => {
|
|
620
769
|
if (transaction) {
|
|
621
770
|
return await HydratedTransactionWrapper.parse(transaction);
|
|
622
771
|
}
|
|
@@ -624,64 +773,64 @@ var TransactionBoundWitnessDetails = /* @__PURE__ */ __name(({ transaction, ...p
|
|
|
624
773
|
transaction
|
|
625
774
|
]);
|
|
626
775
|
const { elevatedPayloadHashes, elevatedPayloadSchemas, elevatedPayloadSetsError, publicPayloadHashes, publicPayloadSchemas, publicPayloadsError, referencedPayloadHashes, referencedPayloadSchemas, referencedPayloadsError } = useTransactionPayloadTypes(wrapper);
|
|
627
|
-
return /* @__PURE__ */
|
|
776
|
+
return /* @__PURE__ */ React10.createElement(FlexCol3, {
|
|
628
777
|
alignItems: "stretch",
|
|
629
778
|
rowGap: 2,
|
|
630
779
|
...props
|
|
631
|
-
}, /* @__PURE__ */
|
|
780
|
+
}, /* @__PURE__ */ React10.createElement(HashHeadingPaper2, {
|
|
632
781
|
hash: wrapper?.boundWitness?._hash,
|
|
633
782
|
paperProps: {
|
|
634
783
|
sx: {
|
|
635
784
|
p: 2
|
|
636
785
|
}
|
|
637
786
|
},
|
|
638
|
-
AdornmentEnd: /* @__PURE__ */
|
|
639
|
-
|
|
787
|
+
AdornmentEnd: /* @__PURE__ */ React10.createElement(TransactionActions, {
|
|
788
|
+
transaction
|
|
640
789
|
}),
|
|
641
790
|
identiconProps: {
|
|
642
791
|
p: 0.75,
|
|
643
792
|
size: 24
|
|
644
793
|
}
|
|
645
|
-
}), /* @__PURE__ */
|
|
794
|
+
}), /* @__PURE__ */ React10.createElement(ErrorRender3, {
|
|
646
795
|
error: wrapperError,
|
|
647
796
|
scope: "wrapperError:TransactionBoundWitnessDetails.tsx"
|
|
648
|
-
}), /* @__PURE__ */
|
|
797
|
+
}), /* @__PURE__ */ React10.createElement(ErrorRender3, {
|
|
649
798
|
error: elevatedPayloadSetsError,
|
|
650
799
|
scope: "elevatedPayloadSetsError:TransactionBoundWitnessDetails.tsx"
|
|
651
|
-
}), /* @__PURE__ */
|
|
800
|
+
}), /* @__PURE__ */ React10.createElement(ErrorRender3, {
|
|
652
801
|
error: publicPayloadsError,
|
|
653
802
|
scope: "publicPayloadsError:TransactionBoundWitnessDetails.tsx"
|
|
654
803
|
}), referencedPayloadsError.map((error, index) => (
|
|
655
804
|
// eslint-disable-next-line @eslint-react/no-array-index-key
|
|
656
|
-
/* @__PURE__ */
|
|
805
|
+
/* @__PURE__ */ React10.createElement(ErrorRender3, {
|
|
657
806
|
key: index,
|
|
658
807
|
error,
|
|
659
808
|
scope: "referencedPayloadsError:TransactionBoundWitnessDetails.tsx"
|
|
660
809
|
})
|
|
661
|
-
)), /* @__PURE__ */
|
|
810
|
+
)), /* @__PURE__ */ React10.createElement(TransactionBoundWitnessCard, {
|
|
662
811
|
elevation: 4,
|
|
663
812
|
wrapper
|
|
664
|
-
}), /* @__PURE__ */
|
|
813
|
+
}), /* @__PURE__ */ React10.createElement(PayloadTableFlexbox, {
|
|
665
814
|
tooltip: "Payloads included in the transaction that are elevated and validated.",
|
|
666
|
-
IconComponent: /* @__PURE__ */
|
|
815
|
+
IconComponent: /* @__PURE__ */ React10.createElement(VscSymbolNamespace3, null),
|
|
667
816
|
hashes: elevatedPayloadHashes,
|
|
668
817
|
headingTitle: "On Chain Payloads",
|
|
669
818
|
schemas: elevatedPayloadSchemas,
|
|
670
819
|
sx: {
|
|
671
820
|
mb: 1
|
|
672
821
|
}
|
|
673
|
-
}), (publicPayloadHashes?.length ?? 0) > 0 && /* @__PURE__ */
|
|
822
|
+
}), (publicPayloadHashes?.length ?? 0) > 0 && /* @__PURE__ */ React10.createElement(PayloadTableFlexbox, {
|
|
674
823
|
tooltip: "Public payloads included in the transaction.",
|
|
675
|
-
IconComponent: /* @__PURE__ */
|
|
824
|
+
IconComponent: /* @__PURE__ */ React10.createElement(VscSymbolNamespace3, null),
|
|
676
825
|
hashes: publicPayloadHashes,
|
|
677
826
|
headingTitle: "Public Payloads",
|
|
678
827
|
schemas: publicPayloadSchemas,
|
|
679
828
|
sx: {
|
|
680
829
|
mb: 1
|
|
681
830
|
}
|
|
682
|
-
}), (referencedPayloadHashes?.length ?? 0) > 0 && /* @__PURE__ */
|
|
831
|
+
}), (referencedPayloadHashes?.length ?? 0) > 0 && /* @__PURE__ */ React10.createElement(PayloadTableFlexbox, {
|
|
683
832
|
tooltip: "Payload hashes referenced by the transaction but not included.",
|
|
684
|
-
IconComponent: /* @__PURE__ */
|
|
833
|
+
IconComponent: /* @__PURE__ */ React10.createElement(VscSymbolNamespace3, null),
|
|
685
834
|
clickableFields: nonClickableFields,
|
|
686
835
|
hashes: referencedPayloadHashes,
|
|
687
836
|
headingTitle: "Referenced Payloads",
|
|
@@ -689,21 +838,23 @@ var TransactionBoundWitnessDetails = /* @__PURE__ */ __name(({ transaction, ...p
|
|
|
689
838
|
sx: {
|
|
690
839
|
mb: 1
|
|
691
840
|
}
|
|
692
|
-
}), /* @__PURE__ */
|
|
841
|
+
}), /* @__PURE__ */ React10.createElement(FlexCol3, {
|
|
693
842
|
alignItems: "stretch",
|
|
694
843
|
rowGap: 1,
|
|
695
844
|
mb: 1
|
|
696
|
-
}, /* @__PURE__ */
|
|
697
|
-
IconComponent: /* @__PURE__ */
|
|
845
|
+
}, /* @__PURE__ */ React10.createElement(HeadingPaper3, {
|
|
846
|
+
IconComponent: /* @__PURE__ */ React10.createElement(FaSignature2, null),
|
|
698
847
|
heading: "Signatures"
|
|
699
|
-
}), /* @__PURE__ */
|
|
848
|
+
}), /* @__PURE__ */ React10.createElement(BoundWitnessSignatureTable2, {
|
|
700
849
|
block: wrapper?.boundWitness
|
|
701
850
|
})));
|
|
702
851
|
}, "TransactionBoundWitnessDetails");
|
|
703
852
|
export {
|
|
704
853
|
BlockBoundWitnessDetails,
|
|
705
854
|
PayloadTableFlexbox,
|
|
855
|
+
TransactionActions,
|
|
706
856
|
TransactionBoundWitnessCard,
|
|
707
|
-
TransactionBoundWitnessDetails
|
|
857
|
+
TransactionBoundWitnessDetails,
|
|
858
|
+
TransactionVerification
|
|
708
859
|
};
|
|
709
860
|
//# sourceMappingURL=index.mjs.map
|