@xyo-network/react-chain-blockchain 1.2.3 → 1.2.5
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 +282 -174
- package/dist/browser/index.mjs.map +1 -1
- package/dist/types/components/block/helpers/index.d.ts +1 -0
- package/dist/types/components/block/helpers/index.d.ts.map +1 -1
- package/dist/types/components/block/helpers/payloadCountsFromBlock.d.ts +3 -0
- package/dist/types/components/block/helpers/payloadCountsFromBlock.d.ts.map +1 -0
- package/dist/types/components/block/helpers/tsxFromBlock.d.ts +2 -2
- package/dist/types/components/block/helpers/tsxFromBlock.d.ts.map +1 -1
- package/dist/types/components/block/hooks/index.d.ts +1 -0
- package/dist/types/components/block/hooks/index.d.ts.map +1 -1
- package/dist/types/components/block/hooks/useBlockHeadingEvents.d.ts +1 -1
- package/dist/types/components/block/hooks/useBlockHeadingEvents.d.ts.map +1 -1
- package/dist/types/components/block/hooks/usePayloadCountsFromBlock.d.ts +3 -0
- package/dist/types/components/block/hooks/usePayloadCountsFromBlock.d.ts.map +1 -0
- package/dist/types/components/block/hooks/useTxsFromBlock.d.ts +1 -1
- package/dist/types/components/block/table/cell/JsonView.d.ts.map +1 -1
- package/dist/types/components/block/table/cell/PayloadCounts.d.ts +12 -0
- package/dist/types/components/block/table/cell/PayloadCounts.d.ts.map +1 -0
- package/dist/types/components/block/table/cell/TransactionCount.d.ts +5 -0
- package/dist/types/components/block/table/cell/TransactionCount.d.ts.map +1 -1
- package/dist/types/components/block/table/cell/hooks/useLinkedBlockItem.d.ts +1 -1
- package/dist/types/components/block/table/cell/hooks/useLinkedBlockItem.d.ts.map +1 -1
- package/dist/types/components/block/table/cell/index.d.ts +1 -0
- package/dist/types/components/block/table/cell/index.d.ts.map +1 -1
- package/dist/types/components/block/table/head/TableHead.d.ts.map +1 -1
- package/dist/types/components/block/table/row/TableRow.d.ts.map +1 -1
- package/package.json +24 -24
- package/src/components/block/helpers/index.ts +1 -0
- package/src/components/block/helpers/payloadCountsFromBlock.ts +12 -0
- package/src/components/block/helpers/tsxFromBlock.ts +2 -3
- package/src/components/block/hooks/index.ts +1 -0
- package/src/components/block/hooks/useBlockHeadingEvents.ts +1 -1
- package/src/components/block/hooks/usePayloadCountsFromBlock.ts +13 -0
- package/src/components/block/table/cell/Hash.tsx +2 -2
- package/src/components/block/table/cell/JsonView.tsx +4 -6
- package/src/components/block/table/cell/PayloadCounts.tsx +49 -0
- package/src/components/block/table/cell/TransactionCount.tsx +17 -3
- package/src/components/block/table/cell/hooks/useLinkedBlockItem.tsx +2 -2
- package/src/components/block/table/cell/index.ts +1 -0
- package/src/components/block/table/head/TableHead.tsx +28 -6
- package/src/components/block/table/row/TableRow.tsx +4 -3
package/dist/browser/index.mjs
CHANGED
|
@@ -443,10 +443,10 @@ var blockProducer = /* @__PURE__ */ __name((block) => {
|
|
|
443
443
|
import React9 from "react";
|
|
444
444
|
|
|
445
445
|
// src/components/block/helpers/tsxFromBlock.ts
|
|
446
|
-
import { isBoundWitness } from "@xyo-network/boundwitness-model";
|
|
447
446
|
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
447
|
+
import { isTransactionBoundWitness } from "@xyo-network/xl1-model";
|
|
448
448
|
var txsFromBlock = /* @__PURE__ */ __name(async (block) => {
|
|
449
|
-
const transactionPayloads = block[1].filter((payload) =>
|
|
449
|
+
const transactionPayloads = block[1].filter((payload) => isTransactionBoundWitness(payload));
|
|
450
450
|
return await PayloadBuilder2.hashPairs(transactionPayloads);
|
|
451
451
|
}, "txsFromBlock");
|
|
452
452
|
|
|
@@ -470,6 +470,22 @@ var buildBlockHeadingComponent = /* @__PURE__ */ __name(async (blockComponentPro
|
|
|
470
470
|
return await buildBlockChainRenderComponent(BlockHeadingFlexbox, blockComponentProps);
|
|
471
471
|
}, "buildBlockHeadingComponent");
|
|
472
472
|
|
|
473
|
+
// src/components/block/helpers/payloadCountsFromBlock.ts
|
|
474
|
+
import { BoundWitnessSchema } from "@xyo-network/boundwitness-model";
|
|
475
|
+
import { isTransactionBoundWitness as isTransactionBoundWitness2 } from "@xyo-network/xl1-model";
|
|
476
|
+
var payloadCountsFromBlock = /* @__PURE__ */ __name(([block, payloads]) => {
|
|
477
|
+
const privPayloads = block.payload_schemas.filter((schema) => schema !== BoundWitnessSchema);
|
|
478
|
+
const transactionPayloads = payloads.filter((payload) => isTransactionBoundWitness2(payload));
|
|
479
|
+
let privPayloadsCount = 0;
|
|
480
|
+
for (let tx of transactionPayloads) {
|
|
481
|
+
privPayloadsCount += tx.payload_hashes.length - tx.$opCodes.filter((opCode) => !opCode.startsWith("elevate|")).length;
|
|
482
|
+
}
|
|
483
|
+
return [
|
|
484
|
+
privPayloads.length,
|
|
485
|
+
privPayloadsCount
|
|
486
|
+
];
|
|
487
|
+
}, "payloadCountsFromBlock");
|
|
488
|
+
|
|
473
489
|
// src/components/block/hooks/useDynamicBlockComponents.ts
|
|
474
490
|
var useDynamicBlockComponents = /* @__PURE__ */ __name((BlockComponent, params, maxBlocks) => {
|
|
475
491
|
const { chainArchivist } = params ?? {};
|
|
@@ -501,6 +517,26 @@ var useDynamicBlockComponents = /* @__PURE__ */ __name((BlockComponent, params,
|
|
|
501
517
|
};
|
|
502
518
|
}, "useDynamicBlockComponents");
|
|
503
519
|
|
|
520
|
+
// src/components/block/hooks/usePayloadCountsFromBlock.ts
|
|
521
|
+
import { useMemo as useMemo7 } from "react";
|
|
522
|
+
var usePayloadCountsFromBlock = /* @__PURE__ */ __name((block) => {
|
|
523
|
+
return useMemo7(() => {
|
|
524
|
+
if (block) {
|
|
525
|
+
return [
|
|
526
|
+
...payloadCountsFromBlock(block),
|
|
527
|
+
void 0
|
|
528
|
+
];
|
|
529
|
+
}
|
|
530
|
+
return [
|
|
531
|
+
void 0,
|
|
532
|
+
void 0,
|
|
533
|
+
void 0
|
|
534
|
+
];
|
|
535
|
+
}, [
|
|
536
|
+
block
|
|
537
|
+
]);
|
|
538
|
+
}, "usePayloadCountsFromBlock");
|
|
539
|
+
|
|
504
540
|
// src/components/block/hooks/useStaticBlockComponents.ts
|
|
505
541
|
import { usePromise } from "@xylabs/react-promise";
|
|
506
542
|
var useStaticBlockComponents = /* @__PURE__ */ __name((BlockComponent, params, blocks) => {
|
|
@@ -602,11 +638,11 @@ var BlockMenuExpanded = /* @__PURE__ */ __name(({ block }) => {
|
|
|
602
638
|
import { Chip as Chip2 } from "@mui/material";
|
|
603
639
|
import { EthAddress } from "@xylabs/eth-address";
|
|
604
640
|
import { BlockiesAvatar } from "@xyo-network/react-chain-blockies";
|
|
605
|
-
import React12, { useMemo as
|
|
641
|
+
import React12, { useMemo as useMemo8 } from "react";
|
|
606
642
|
var BlockProducerChip = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
607
643
|
const blockProducer2 = block?.[0].addresses[0];
|
|
608
644
|
const shortedBlockProducer = blockProducer2 ? EthAddress.parse(blockProducer2)?.toShortString(3) : null;
|
|
609
|
-
const avatar =
|
|
645
|
+
const avatar = useMemo8(() => blockProducer2 === "" ? void 0 : /* @__PURE__ */ React12.createElement(BlockiesAvatar, {
|
|
610
646
|
blockiesOptions: {
|
|
611
647
|
seed: blockProducer2
|
|
612
648
|
}
|
|
@@ -715,7 +751,7 @@ var BlockNumberTableCell = /* @__PURE__ */ __name(({ block, linked, ...props })
|
|
|
715
751
|
// src/components/block/table/cell/Hash.tsx
|
|
716
752
|
import { Avatar, Chip as Chip3, TableCell as TableCell2, Tooltip as Tooltip2 } from "@mui/material";
|
|
717
753
|
import { Identicon } from "@xylabs/react-identicon";
|
|
718
|
-
import {
|
|
754
|
+
import { usePayloadRootHash } from "@xyo-network/react-shared";
|
|
719
755
|
import React16 from "react";
|
|
720
756
|
|
|
721
757
|
// src/components/FeatureNotAvailable.tsx
|
|
@@ -727,7 +763,7 @@ var FeatureNotAvailable = /* @__PURE__ */ __name(({ featureName = "Feature", ...
|
|
|
727
763
|
|
|
728
764
|
// src/components/block/table/cell/Hash.tsx
|
|
729
765
|
var BlockHashTableCell = /* @__PURE__ */ __name(({ block, identiconProps, notAvailableDialog, linked, ...props }) => {
|
|
730
|
-
const hash =
|
|
766
|
+
const hash = usePayloadRootHash(block?.[0]);
|
|
731
767
|
const [ref, handleClick] = useLinkedBlockItem("block-hash", hash);
|
|
732
768
|
const [notAvailable, setNotAvailable] = React16.useState(false);
|
|
733
769
|
const shortenedHash = hash ? `${hash.slice(0, 4)}...${hash.slice(-5, -1)}` : "";
|
|
@@ -759,19 +795,17 @@ var BlockHashTableCell = /* @__PURE__ */ __name(({ block, identiconProps, notAva
|
|
|
759
795
|
}, "BlockHashTableCell");
|
|
760
796
|
|
|
761
797
|
// src/components/block/table/cell/JsonView.tsx
|
|
762
|
-
import {
|
|
798
|
+
import { DataObject } from "@mui/icons-material";
|
|
763
799
|
import { Button as Button3, Dialog as Dialog2, DialogActions as DialogActions2, DialogContent as DialogContent2, DialogTitle as DialogTitle2, IconButton as IconButton2, TableCell as TableCell3 } from "@mui/material";
|
|
764
800
|
import { ellipsize } from "@xylabs/eth-address";
|
|
765
801
|
import { FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
|
|
766
|
-
import { useIsDark } from "@xylabs/react-theme";
|
|
767
802
|
import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
|
|
768
|
-
import {
|
|
803
|
+
import { usePayloadRootHash as usePayloadRootHash2 } from "@xyo-network/react-shared";
|
|
769
804
|
import React17, { useState as useState9 } from "react";
|
|
770
805
|
var BlockJsonViewTableCell = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
771
806
|
const [open, setOpen] = useState9(false);
|
|
772
807
|
const onClose = /* @__PURE__ */ __name(() => setOpen(false), "onClose");
|
|
773
|
-
const
|
|
774
|
-
const hash = usePayloadHash3(block?.[0]);
|
|
808
|
+
const hash = usePayloadRootHash2(block?.[0]);
|
|
775
809
|
const title = hash ? `JSON for ${ellipsize(hash, 5)}` : "JSON";
|
|
776
810
|
return /* @__PURE__ */ React17.createElement(TableCell3, props, /* @__PURE__ */ React17.createElement(FlexRow3, {
|
|
777
811
|
sx: {
|
|
@@ -779,7 +813,7 @@ var BlockJsonViewTableCell = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
|
779
813
|
}
|
|
780
814
|
}, /* @__PURE__ */ React17.createElement(IconButton2, {
|
|
781
815
|
onClick: /* @__PURE__ */ __name(() => setOpen(true), "onClick")
|
|
782
|
-
}, /* @__PURE__ */ React17.createElement(
|
|
816
|
+
}, /* @__PURE__ */ React17.createElement(DataObject, null))), /* @__PURE__ */ React17.createElement(Dialog2, {
|
|
783
817
|
open,
|
|
784
818
|
onClose
|
|
785
819
|
}, /* @__PURE__ */ React17.createElement(DialogTitle2, null, title), /* @__PURE__ */ React17.createElement(DialogContent2, null, /* @__PURE__ */ React17.createElement(JsonViewerEx, {
|
|
@@ -796,31 +830,59 @@ var BlockJsonViewTableCell = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
|
796
830
|
}, "Close"))));
|
|
797
831
|
}, "BlockJsonViewTableCell");
|
|
798
832
|
|
|
833
|
+
// src/components/block/table/cell/PayloadCounts.tsx
|
|
834
|
+
import { Error as Error2 } from "@mui/icons-material";
|
|
835
|
+
import { Link as Link2, TableCell as TableCell4, Tooltip as Tooltip3 } from "@mui/material";
|
|
836
|
+
import React18 from "react";
|
|
837
|
+
var BlockPayloadCountsTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
838
|
+
const [publicPayloads, privatePayloads, error] = usePayloadCountsFromBlock(block);
|
|
839
|
+
const data = block && privatePayloads !== void 0 && publicPayloads !== void 0 ? {
|
|
840
|
+
publicPayloads,
|
|
841
|
+
privatePayloads,
|
|
842
|
+
block: block[0]._hash
|
|
843
|
+
} : void 0;
|
|
844
|
+
const [ref, handleClick] = useLinkedBlockItem("payload-counts", data);
|
|
845
|
+
const renderText = `${publicPayloads ?? "--"} / ${privatePayloads ?? "--"}`;
|
|
846
|
+
return /* @__PURE__ */ React18.createElement(TableCell4, {
|
|
847
|
+
ref,
|
|
848
|
+
...props
|
|
849
|
+
}, /* @__PURE__ */ React18.createElement("span", null, error ? /* @__PURE__ */ React18.createElement(Tooltip3, {
|
|
850
|
+
title: error.message
|
|
851
|
+
}, /* @__PURE__ */ React18.createElement(Error2, {
|
|
852
|
+
color: "error"
|
|
853
|
+
})) : null, linked ? /* @__PURE__ */ React18.createElement(Link2, {
|
|
854
|
+
onClick: handleClick,
|
|
855
|
+
sx: {
|
|
856
|
+
cursor: "pointer"
|
|
857
|
+
}
|
|
858
|
+
}, renderText) : renderText));
|
|
859
|
+
}, "BlockPayloadCountsTableCell");
|
|
860
|
+
|
|
799
861
|
// src/components/block/table/cell/Producer.tsx
|
|
800
|
-
import { TableCell as
|
|
862
|
+
import { TableCell as TableCell5, Tooltip as Tooltip4 } from "@mui/material";
|
|
801
863
|
import { FlexRow as FlexRow4 } from "@xylabs/react-flexbox";
|
|
802
|
-
import
|
|
864
|
+
import React19 from "react";
|
|
803
865
|
var BlockProducerTableCell = /* @__PURE__ */ __name(({ block, linked, notAvailableDialog, producerChipProps, ...props }) => {
|
|
804
866
|
const [ref, handleClick] = useLinkedBlockItem("block-producer", JSON.stringify(block));
|
|
805
867
|
const producer = useBlockProducer(block);
|
|
806
|
-
const [notAvailable, setNotAvailable] =
|
|
807
|
-
return /* @__PURE__ */
|
|
868
|
+
const [notAvailable, setNotAvailable] = React19.useState(false);
|
|
869
|
+
return /* @__PURE__ */ React19.createElement(TableCell5, {
|
|
808
870
|
ref,
|
|
809
871
|
...props
|
|
810
|
-
}, /* @__PURE__ */
|
|
872
|
+
}, /* @__PURE__ */ React19.createElement(Tooltip4, {
|
|
811
873
|
title: `Block Producer: ${producer}`
|
|
812
|
-
}, /* @__PURE__ */
|
|
874
|
+
}, /* @__PURE__ */ React19.createElement(FlexRow4, {
|
|
813
875
|
sx: {
|
|
814
876
|
width: "100%"
|
|
815
877
|
}
|
|
816
|
-
}, /* @__PURE__ */
|
|
878
|
+
}, /* @__PURE__ */ React19.createElement(BlockProducerChip, {
|
|
817
879
|
sx: {
|
|
818
880
|
cursor: "pointer"
|
|
819
881
|
},
|
|
820
882
|
onClick: linked ? handleClick : () => setNotAvailable(true),
|
|
821
883
|
block,
|
|
822
884
|
...producerChipProps
|
|
823
|
-
}))), notAvailableDialog && notAvailable ? /* @__PURE__ */
|
|
885
|
+
}))), notAvailableDialog && notAvailable ? /* @__PURE__ */ React19.createElement(FeatureNotAvailable, {
|
|
824
886
|
featureName: "Producer Details",
|
|
825
887
|
open: notAvailable,
|
|
826
888
|
onClick: /* @__PURE__ */ __name(() => setNotAvailable(false), "onClick")
|
|
@@ -828,42 +890,46 @@ var BlockProducerTableCell = /* @__PURE__ */ __name(({ block, linked, notAvailab
|
|
|
828
890
|
}, "BlockProducerTableCell");
|
|
829
891
|
|
|
830
892
|
// src/components/block/table/cell/TransactionCount.tsx
|
|
831
|
-
import { Error as
|
|
832
|
-
import { Link as
|
|
833
|
-
import
|
|
893
|
+
import { Error as Error3 } from "@mui/icons-material";
|
|
894
|
+
import { Link as Link3, TableCell as TableCell6, Tooltip as Tooltip5 } from "@mui/material";
|
|
895
|
+
import React20 from "react";
|
|
834
896
|
var BlockTransactionCountTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
835
|
-
const [
|
|
836
|
-
const
|
|
837
|
-
|
|
897
|
+
const [transactions, error] = useTxsFromBlock(block);
|
|
898
|
+
const data = block && transactions !== void 0 ? {
|
|
899
|
+
transactions: transactions.length,
|
|
900
|
+
block: block[0]._hash
|
|
901
|
+
} : void 0;
|
|
902
|
+
const [ref, handleClick] = useLinkedBlockItem("transaction-count", data);
|
|
903
|
+
return /* @__PURE__ */ React20.createElement(TableCell6, {
|
|
838
904
|
ref,
|
|
839
905
|
...props
|
|
840
|
-
}, /* @__PURE__ */
|
|
906
|
+
}, /* @__PURE__ */ React20.createElement("span", null, error ? /* @__PURE__ */ React20.createElement(Tooltip5, {
|
|
841
907
|
title: error.message
|
|
842
|
-
}, /* @__PURE__ */
|
|
908
|
+
}, /* @__PURE__ */ React20.createElement(Error3, {
|
|
843
909
|
color: "error"
|
|
844
|
-
})) : null, linked ? /* @__PURE__ */
|
|
910
|
+
})) : null, linked ? /* @__PURE__ */ React20.createElement(Link3, {
|
|
845
911
|
onClick: handleClick,
|
|
846
912
|
sx: {
|
|
847
913
|
cursor: "pointer"
|
|
848
914
|
}
|
|
849
|
-
},
|
|
915
|
+
}, transactions?.length ?? "--") : transactions?.length ?? "--"));
|
|
850
916
|
}, "BlockTransactionCountTableCell");
|
|
851
917
|
|
|
852
918
|
// src/components/block/table/cell/Verification.tsx
|
|
853
|
-
import { TableCell as
|
|
919
|
+
import { TableCell as TableCell7 } from "@mui/material";
|
|
854
920
|
import { FlexRow as FlexRow5 } from "@xylabs/react-flexbox";
|
|
855
921
|
import { BWVerification as BWVerification2 } from "@xyo-network/react-chain-boundwitness";
|
|
856
|
-
import
|
|
922
|
+
import React21 from "react";
|
|
857
923
|
var BlockVerificationTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
858
924
|
const [ref, handleClick] = useLinkedBlockItem("block-verification", block?.[0].block.toString());
|
|
859
|
-
return /* @__PURE__ */
|
|
925
|
+
return /* @__PURE__ */ React21.createElement(TableCell7, {
|
|
860
926
|
ref,
|
|
861
927
|
...props
|
|
862
|
-
}, /* @__PURE__ */
|
|
928
|
+
}, /* @__PURE__ */ React21.createElement(FlexRow5, {
|
|
863
929
|
sx: {
|
|
864
930
|
width: "100%"
|
|
865
931
|
}
|
|
866
|
-
}, /* @__PURE__ */
|
|
932
|
+
}, /* @__PURE__ */ React21.createElement(BWVerification2, {
|
|
867
933
|
onClick: linked ? handleClick : void 0,
|
|
868
934
|
iconColors: true,
|
|
869
935
|
boundwitness: block?.[0]
|
|
@@ -873,82 +939,121 @@ var BlockVerificationTableCell = /* @__PURE__ */ __name(({ block, linked, ...pro
|
|
|
873
939
|
// src/components/block/table/Ex.tsx
|
|
874
940
|
import { TableBody } from "@mui/material";
|
|
875
941
|
import { TableEx } from "@xyo-network/react-table";
|
|
876
|
-
import
|
|
942
|
+
import React23 from "react";
|
|
877
943
|
|
|
878
944
|
// src/components/block/table/head/TableHead.tsx
|
|
879
|
-
import {
|
|
880
|
-
import
|
|
945
|
+
import { InfoOutline } from "@mui/icons-material";
|
|
946
|
+
import { TableCell as TableCell8, TableHead, TableRow, Tooltip as Tooltip6, Typography as Typography3 } from "@mui/material";
|
|
947
|
+
import { FlexRow as FlexRow6 } from "@xylabs/react-flexbox";
|
|
948
|
+
import React22 from "react";
|
|
949
|
+
var ToolTipTableCell = /* @__PURE__ */ __name(({ children, align, title, ...props }) => {
|
|
950
|
+
return /* @__PURE__ */ React22.createElement(TableCell8, {
|
|
951
|
+
title,
|
|
952
|
+
...props
|
|
953
|
+
}, /* @__PURE__ */ React22.createElement(Tooltip6, {
|
|
954
|
+
title
|
|
955
|
+
}, /* @__PURE__ */ React22.createElement(FlexRow6, {
|
|
956
|
+
justifyContent: align
|
|
957
|
+
}, /* @__PURE__ */ React22.createElement(Typography3, {
|
|
958
|
+
variant: "body2"
|
|
959
|
+
}, children), "\xA0", /* @__PURE__ */ React22.createElement(InfoOutline, {
|
|
960
|
+
fontSize: "small"
|
|
961
|
+
}))));
|
|
962
|
+
}, "ToolTipTableCell");
|
|
881
963
|
var BlockchainTableHead = /* @__PURE__ */ __name(() => {
|
|
882
|
-
return /* @__PURE__ */
|
|
883
|
-
|
|
884
|
-
}, "Block
|
|
885
|
-
align: "center"
|
|
886
|
-
|
|
887
|
-
|
|
964
|
+
return /* @__PURE__ */ React22.createElement(TableHead, null, /* @__PURE__ */ React22.createElement(TableRow, null, /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
965
|
+
title: "The hash of the block"
|
|
966
|
+
}, "Block Hash"), /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
967
|
+
align: "center",
|
|
968
|
+
title: "The block number that is included in the block"
|
|
969
|
+
}, "Block Number"), /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
970
|
+
align: "center",
|
|
971
|
+
title: "Count of transactions that are included in the block"
|
|
972
|
+
}, "Transactions"), /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
973
|
+
align: "center",
|
|
974
|
+
title: "Count of public and private payload counts for the block"
|
|
975
|
+
}, "Payloads"), /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
976
|
+
align: "center",
|
|
977
|
+
title: "The address of the block producer that produced the block"
|
|
978
|
+
}, "Block Producer"), /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
979
|
+
align: "center",
|
|
980
|
+
title: "The result of the local validation check for the block"
|
|
981
|
+
}, "Valid"), /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
982
|
+
align: "center",
|
|
983
|
+
title: "Link to display the raw JSON of the block"
|
|
888
984
|
}, "JSON")));
|
|
889
985
|
}, "BlockchainTableHead");
|
|
890
986
|
|
|
891
987
|
// src/components/block/table/Ex.tsx
|
|
892
988
|
var BlockchainTableEx = /* @__PURE__ */ __name(({ ref, children, ...props }) => {
|
|
893
|
-
return /* @__PURE__ */
|
|
989
|
+
return /* @__PURE__ */ React23.createElement(TableEx, {
|
|
894
990
|
ref,
|
|
895
991
|
...props
|
|
896
|
-
}, /* @__PURE__ */
|
|
992
|
+
}, /* @__PURE__ */ React23.createElement(BlockchainTableHead, null), /* @__PURE__ */ React23.createElement(TableBody, null, children));
|
|
897
993
|
}, "BlockchainTableEx");
|
|
898
994
|
BlockchainTableEx.displayName = "BlockchainTableEx";
|
|
899
995
|
|
|
900
996
|
// src/components/block/table/row/TableRow.tsx
|
|
901
997
|
import { TableRow as TableRow2 } from "@mui/material";
|
|
902
|
-
import
|
|
998
|
+
import React24, { useMemo as useMemo9 } from "react";
|
|
903
999
|
var BlockChainTableRow = /* @__PURE__ */ __name(({ block, defaultExpanded, linked, sx, ...props }) => {
|
|
904
|
-
const linkedTableCellProps =
|
|
1000
|
+
const linkedTableCellProps = useMemo9(() => ({
|
|
905
1001
|
block,
|
|
906
1002
|
linked
|
|
907
1003
|
}), [
|
|
908
1004
|
block,
|
|
909
1005
|
linked
|
|
910
1006
|
]);
|
|
911
|
-
const defaultTableCellProps =
|
|
1007
|
+
const defaultTableCellProps = useMemo9(() => ({
|
|
912
1008
|
block
|
|
913
1009
|
}), [
|
|
914
1010
|
block
|
|
915
1011
|
]);
|
|
916
|
-
return /* @__PURE__ */
|
|
1012
|
+
return /* @__PURE__ */ React24.createElement(TableRow2, {
|
|
917
1013
|
sx: {
|
|
918
1014
|
overflowY: "scroll",
|
|
919
1015
|
...sx
|
|
920
1016
|
},
|
|
921
1017
|
...props
|
|
922
|
-
}, /* @__PURE__ */
|
|
1018
|
+
}, /* @__PURE__ */ React24.createElement(BlockHashTableCell, linkedTableCellProps), /* @__PURE__ */ React24.createElement(BlockNumberTableCell, {
|
|
1019
|
+
align: "center",
|
|
1020
|
+
...linkedTableCellProps
|
|
1021
|
+
}), /* @__PURE__ */ React24.createElement(BlockTransactionCountTableCell, {
|
|
1022
|
+
align: "center",
|
|
1023
|
+
...linkedTableCellProps
|
|
1024
|
+
}), /* @__PURE__ */ React24.createElement(BlockPayloadCountsTableCell, {
|
|
1025
|
+
align: "center",
|
|
1026
|
+
...linkedTableCellProps
|
|
1027
|
+
}), /* @__PURE__ */ React24.createElement(BlockProducerTableCell, linkedTableCellProps), /* @__PURE__ */ React24.createElement(BlockVerificationTableCell, defaultTableCellProps), /* @__PURE__ */ React24.createElement(BlockJsonViewTableCell, defaultTableCellProps));
|
|
923
1028
|
}, "BlockChainTableRow");
|
|
924
1029
|
|
|
925
1030
|
// src/components/chain/controls/PollingControlsFlexbox.tsx
|
|
926
1031
|
import { Autorenew, Pause } from "@mui/icons-material";
|
|
927
|
-
import { Alert as Alert3, AlertTitle as AlertTitle2, Grow, Icon as Icon2, IconButton as IconButton4, Tooltip as
|
|
928
|
-
import { FlexRow as
|
|
929
|
-
import
|
|
1032
|
+
import { Alert as Alert3, AlertTitle as AlertTitle2, Grow, Icon as Icon2, IconButton as IconButton4, Tooltip as Tooltip7 } from "@mui/material";
|
|
1033
|
+
import { FlexRow as FlexRow7 } from "@xylabs/react-flexbox";
|
|
1034
|
+
import React29, { memo } from "react";
|
|
930
1035
|
|
|
931
1036
|
// src/components/chain/stats/Dialog.tsx
|
|
932
1037
|
import { QueryStats } from "@mui/icons-material";
|
|
933
1038
|
import { Dialog as Dialog3, DialogContent as DialogContent3, DialogTitle as DialogTitle3, IconButton as IconButton3 } from "@mui/material";
|
|
934
|
-
import
|
|
1039
|
+
import React27, { useState as useState10 } from "react";
|
|
935
1040
|
|
|
936
1041
|
// src/components/chain/stats/producer/ProducerFlexbox.tsx
|
|
937
|
-
import { ListItem, styled, Typography as
|
|
1042
|
+
import { ListItem, styled, Typography as Typography4 } from "@mui/material";
|
|
938
1043
|
import { ErrorRender as ErrorRender3 } from "@xylabs/react-error";
|
|
939
1044
|
import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
|
|
940
1045
|
import { isChainSummaryProducers } from "@xyo-network/chain-protocol";
|
|
941
|
-
import
|
|
1046
|
+
import React26, { useMemo as useMemo10 } from "react";
|
|
942
1047
|
|
|
943
1048
|
// src/components/chain/stats/producer/Table.tsx
|
|
944
|
-
import { Table, TableBody as TableBody2, TableCell as
|
|
1049
|
+
import { Table, TableBody as TableBody2, TableCell as TableCell9, TableHead as TableHead2, TableRow as TableRow3, useTheme } from "@mui/material";
|
|
945
1050
|
import { BlockiesAvatar as BlockiesAvatar2 } from "@xyo-network/react-chain-blockies";
|
|
946
|
-
import
|
|
1051
|
+
import React25 from "react";
|
|
947
1052
|
var ChainProducerStatsTable = /* @__PURE__ */ __name(({ producers, ...props }) => {
|
|
948
1053
|
const theme = useTheme();
|
|
949
|
-
return /* @__PURE__ */
|
|
1054
|
+
return /* @__PURE__ */ React25.createElement(Table, props, /* @__PURE__ */ React25.createElement(TableHead2, null, /* @__PURE__ */ React25.createElement(TableRow3, null, /* @__PURE__ */ React25.createElement(TableCell9, null, "Address"), /* @__PURE__ */ React25.createElement(TableCell9, null, "Blocks Produced"), /* @__PURE__ */ React25.createElement(TableCell9, null, "Rewards Earned Produced"))), /* @__PURE__ */ React25.createElement(TableBody2, null, producers?.map((producer) => /* @__PURE__ */ React25.createElement(TableRow3, {
|
|
950
1055
|
key: producer.address
|
|
951
|
-
}, /* @__PURE__ */
|
|
1056
|
+
}, /* @__PURE__ */ React25.createElement(TableCell9, null, /* @__PURE__ */ React25.createElement(BlockiesAvatar2, {
|
|
952
1057
|
blockiesOptions: {
|
|
953
1058
|
seed: producer.address
|
|
954
1059
|
},
|
|
@@ -956,12 +1061,12 @@ var ChainProducerStatsTable = /* @__PURE__ */ __name(({ producers, ...props }) =
|
|
|
956
1061
|
height: theme.spacing(2.75),
|
|
957
1062
|
width: theme.spacing(2.75)
|
|
958
1063
|
}
|
|
959
|
-
})), /* @__PURE__ */
|
|
1064
|
+
})), /* @__PURE__ */ React25.createElement(TableCell9, null, producer.blocksProduced.toString()), /* @__PURE__ */ React25.createElement(TableCell9, null, producer.rewardsEarned.toString())))));
|
|
960
1065
|
}, "ChainProducerStatsTable");
|
|
961
1066
|
|
|
962
1067
|
// src/components/chain/stats/producer/ProducerFlexbox.tsx
|
|
963
1068
|
var BlockProducerStatsFlexbox = /* @__PURE__ */ __name(({ payload, ...props }) => {
|
|
964
|
-
const [producer, producerError] =
|
|
1069
|
+
const [producer, producerError] = useMemo10(() => {
|
|
965
1070
|
if (payload) {
|
|
966
1071
|
return isChainSummaryProducers(payload) ? [
|
|
967
1072
|
payload
|
|
@@ -975,19 +1080,19 @@ var BlockProducerStatsFlexbox = /* @__PURE__ */ __name(({ payload, ...props }) =
|
|
|
975
1080
|
}, [
|
|
976
1081
|
payload
|
|
977
1082
|
]);
|
|
978
|
-
const producersArray =
|
|
1083
|
+
const producersArray = useMemo10(() => Object.values(producer?.producers ?? {}), [
|
|
979
1084
|
producer
|
|
980
1085
|
]);
|
|
981
|
-
return /* @__PURE__ */
|
|
1086
|
+
return /* @__PURE__ */ React26.createElement(FlexCol3, {
|
|
982
1087
|
alignItems: "start",
|
|
983
1088
|
gap: 1,
|
|
984
1089
|
...props
|
|
985
|
-
}, /* @__PURE__ */
|
|
1090
|
+
}, /* @__PURE__ */ React26.createElement(ErrorRender3, {
|
|
986
1091
|
error: producerError,
|
|
987
1092
|
scope: "BlockProducerStatsFlexbox"
|
|
988
|
-
}), /* @__PURE__ */
|
|
1093
|
+
}), /* @__PURE__ */ React26.createElement(Typography4, {
|
|
989
1094
|
fontSize: "1rem"
|
|
990
|
-
}, "Block Producers"), /* @__PURE__ */
|
|
1095
|
+
}, "Block Producers"), /* @__PURE__ */ React26.createElement(ChainProducerStatsTable, {
|
|
991
1096
|
producers: producersArray
|
|
992
1097
|
}));
|
|
993
1098
|
}, "BlockProducerStatsFlexbox");
|
|
@@ -999,18 +1104,18 @@ var StyledListItem = styled(ListItem)(() => ({
|
|
|
999
1104
|
// src/components/chain/stats/Dialog.tsx
|
|
1000
1105
|
var ChainAnalyzerStatsDialog = /* @__PURE__ */ __name((props) => {
|
|
1001
1106
|
const { analyzers, statsUpdated } = useChainAnalyzersContext();
|
|
1002
|
-
return /* @__PURE__ */
|
|
1107
|
+
return /* @__PURE__ */ React27.createElement(Dialog3, props, /* @__PURE__ */ React27.createElement(DialogTitle3, null, "Chain Analysis"), /* @__PURE__ */ React27.createElement(DialogContent3, null, !!statsUpdated && Object.entries(analyzers).map(([id2, analyzer]) => /* @__PURE__ */ React27.createElement("div", {
|
|
1003
1108
|
key: id2
|
|
1004
|
-
}, id2 === "producers" && /* @__PURE__ */
|
|
1109
|
+
}, id2 === "producers" && /* @__PURE__ */ React27.createElement(BlockProducerStatsFlexbox, {
|
|
1005
1110
|
payload: analyzer.result()
|
|
1006
1111
|
})))));
|
|
1007
1112
|
}, "ChainAnalyzerStatsDialog");
|
|
1008
1113
|
var ChainAnalyzerStatsDialogFromContext = /* @__PURE__ */ __name((props) => {
|
|
1009
1114
|
const [open, setOpen] = useState10(false);
|
|
1010
1115
|
const handleClose = /* @__PURE__ */ __name(() => setOpen(false), "handleClose");
|
|
1011
|
-
return /* @__PURE__ */
|
|
1116
|
+
return /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(IconButton3, {
|
|
1012
1117
|
onClick: /* @__PURE__ */ __name(() => setOpen(true), "onClick")
|
|
1013
|
-
}, /* @__PURE__ */
|
|
1118
|
+
}, /* @__PURE__ */ React27.createElement(QueryStats, null)), /* @__PURE__ */ React27.createElement(ChainAnalyzerStatsDialog, {
|
|
1014
1119
|
onClose: handleClose,
|
|
1015
1120
|
open,
|
|
1016
1121
|
...props
|
|
@@ -1019,19 +1124,19 @@ var ChainAnalyzerStatsDialogFromContext = /* @__PURE__ */ __name((props) => {
|
|
|
1019
1124
|
|
|
1020
1125
|
// src/components/chain/controls/PulseSvgIcon.tsx
|
|
1021
1126
|
import { alpha, createSvgIcon, keyframes, styled as styled2 } from "@mui/material";
|
|
1022
|
-
import
|
|
1023
|
-
var PulseSvgIcon = createSvgIcon(/* @__PURE__ */
|
|
1127
|
+
import React28 from "react";
|
|
1128
|
+
var PulseSvgIcon = createSvgIcon(/* @__PURE__ */ React28.createElement("svg", {
|
|
1024
1129
|
viewBox: "0 0 80 80",
|
|
1025
1130
|
version: "1.1",
|
|
1026
1131
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1027
|
-
}, /* @__PURE__ */
|
|
1132
|
+
}, /* @__PURE__ */ React28.createElement("g", {
|
|
1028
1133
|
transform: "translate(34,34)"
|
|
1029
|
-
}, /* @__PURE__ */
|
|
1134
|
+
}, /* @__PURE__ */ React28.createElement("circle", {
|
|
1030
1135
|
className: "core",
|
|
1031
1136
|
cx: "0",
|
|
1032
1137
|
cy: "0",
|
|
1033
1138
|
r: "6"
|
|
1034
|
-
}), /* @__PURE__ */
|
|
1139
|
+
}), /* @__PURE__ */ React28.createElement("circle", {
|
|
1035
1140
|
className: "radar",
|
|
1036
1141
|
cx: "0",
|
|
1037
1142
|
cy: "0",
|
|
@@ -1095,24 +1200,24 @@ var StyledPulseSvgIcon = styled2(PulseSvgIcon)(({ theme }) => {
|
|
|
1095
1200
|
var PollingControlsFlexbox = /* @__PURE__ */ __name(({ blocksBehind, pollingState, setPollingState }) => {
|
|
1096
1201
|
const paused = pollingState === "paused";
|
|
1097
1202
|
const running = pollingState === "running";
|
|
1098
|
-
return /* @__PURE__ */
|
|
1203
|
+
return /* @__PURE__ */ React29.createElement(FlexRow7, {
|
|
1099
1204
|
justifyContent: "space-between",
|
|
1100
1205
|
width: "100%"
|
|
1101
|
-
}, /* @__PURE__ */
|
|
1206
|
+
}, /* @__PURE__ */ React29.createElement(FlexRow7, {
|
|
1102
1207
|
gap: 2
|
|
1103
|
-
}, running && /* @__PURE__ */
|
|
1208
|
+
}, running && /* @__PURE__ */ React29.createElement(IconButton4, {
|
|
1104
1209
|
onClick: /* @__PURE__ */ __name(() => setPollingState?.("paused"), "onClick"),
|
|
1105
1210
|
title: "Pause Block Stream"
|
|
1106
|
-
}, /* @__PURE__ */
|
|
1211
|
+
}, /* @__PURE__ */ React29.createElement(Pause, null)), paused && /* @__PURE__ */ React29.createElement(IconButton4, {
|
|
1107
1212
|
onClick: /* @__PURE__ */ __name(() => setPollingState?.("running"), "onClick"),
|
|
1108
1213
|
title: "Re-Sync Block Stream"
|
|
1109
|
-
}, /* @__PURE__ */
|
|
1214
|
+
}, /* @__PURE__ */ React29.createElement(Autorenew, null)), /* @__PURE__ */ React29.createElement(ChainAnalyzerStatsDialogFromContext, null)), /* @__PURE__ */ React29.createElement(FlexRow7, {
|
|
1110
1215
|
gap: 2
|
|
1111
|
-
}, /* @__PURE__ */
|
|
1216
|
+
}, /* @__PURE__ */ React29.createElement(Grow, {
|
|
1112
1217
|
in: (blocksBehind ?? 0) > 0
|
|
1113
|
-
}, /* @__PURE__ */
|
|
1218
|
+
}, /* @__PURE__ */ React29.createElement(Tooltip7, {
|
|
1114
1219
|
title: "Click to Re-Sync"
|
|
1115
|
-
}, /* @__PURE__ */
|
|
1220
|
+
}, /* @__PURE__ */ React29.createElement(Alert3, {
|
|
1116
1221
|
sx: {
|
|
1117
1222
|
py: 0,
|
|
1118
1223
|
px: 1,
|
|
@@ -1120,11 +1225,11 @@ var PollingControlsFlexbox = /* @__PURE__ */ __name(({ blocksBehind, pollingStat
|
|
|
1120
1225
|
},
|
|
1121
1226
|
severity: "warning",
|
|
1122
1227
|
onClick: /* @__PURE__ */ __name(() => setPollingState?.("running"), "onClick")
|
|
1123
|
-
}, /* @__PURE__ */
|
|
1228
|
+
}, /* @__PURE__ */ React29.createElement(AlertTitle2, {
|
|
1124
1229
|
sx: {
|
|
1125
1230
|
mb: 0
|
|
1126
1231
|
}
|
|
1127
|
-
}, "Behind:", " ", blocksBehind)))), /* @__PURE__ */
|
|
1232
|
+
}, "Behind:", " ", blocksBehind)))), /* @__PURE__ */ React29.createElement(Icon2, null, /* @__PURE__ */ React29.createElement(StyledPulseSvgIcon, {
|
|
1128
1233
|
className: running ? "" : "paused"
|
|
1129
1234
|
}))));
|
|
1130
1235
|
}, "PollingControlsFlexbox");
|
|
@@ -1132,9 +1237,9 @@ var MemoizedPollingControlsFlexbox = /* @__PURE__ */ memo(PollingControlsFlexbox
|
|
|
1132
1237
|
|
|
1133
1238
|
// src/components/chain/dialog/Dialog.tsx
|
|
1134
1239
|
import { Button as Button4, Dialog as Dialog4, DialogActions as DialogActions3, DialogContent as DialogContent4 } from "@mui/material";
|
|
1135
|
-
import
|
|
1240
|
+
import React30 from "react";
|
|
1136
1241
|
var TransactionsDialog = /* @__PURE__ */ __name((props) => {
|
|
1137
|
-
return /* @__PURE__ */
|
|
1242
|
+
return /* @__PURE__ */ React30.createElement(Dialog4, props, /* @__PURE__ */ React30.createElement(DialogContent4, null, "Transactions Dialog"), /* @__PURE__ */ React30.createElement(DialogActions3, null, /* @__PURE__ */ React30.createElement(Button4, {
|
|
1138
1243
|
variant: "outlined",
|
|
1139
1244
|
onClick: /* @__PURE__ */ __name((e) => props?.onClose?.(e, "escapeKeyDown"), "onClick")
|
|
1140
1245
|
}, "Close")));
|
|
@@ -1174,9 +1279,9 @@ var useOnBlock = /* @__PURE__ */ __name((initialHeadNumber, onAddBlock, liveHead
|
|
|
1174
1279
|
|
|
1175
1280
|
// src/components/chain/pagination/BlockChainPagination.tsx
|
|
1176
1281
|
import { TablePaginationActions } from "@xyo-network/react-payload-table";
|
|
1177
|
-
import
|
|
1282
|
+
import React31 from "react";
|
|
1178
1283
|
var BlockChainPagination = /* @__PURE__ */ __name(({ count = 0, onPageChange, page, rowsPerPage = 10 }) => {
|
|
1179
|
-
return /* @__PURE__ */
|
|
1284
|
+
return /* @__PURE__ */ React31.createElement(TablePaginationActions, {
|
|
1180
1285
|
count,
|
|
1181
1286
|
onPageChange,
|
|
1182
1287
|
page,
|
|
@@ -1185,10 +1290,10 @@ var BlockChainPagination = /* @__PURE__ */ __name(({ count = 0, onPageChange, pa
|
|
|
1185
1290
|
}, "BlockChainPagination");
|
|
1186
1291
|
|
|
1187
1292
|
// src/components/chain/pagination/hooks/usePagination.tsx
|
|
1188
|
-
import { useMemo as
|
|
1293
|
+
import { useMemo as useMemo11, useState as useState11 } from "react";
|
|
1189
1294
|
var useChainPagination = /* @__PURE__ */ __name((pageSize, blockComponents) => {
|
|
1190
1295
|
const [page, setPage] = useState11(0);
|
|
1191
|
-
const paginatedBlockComponents =
|
|
1296
|
+
const paginatedBlockComponents = useMemo11(() => {
|
|
1192
1297
|
const startIndex = page * pageSize;
|
|
1193
1298
|
const endIndex = startIndex + pageSize;
|
|
1194
1299
|
return blockComponents?.slice(startIndex, endIndex);
|
|
@@ -1210,11 +1315,11 @@ var useChainPagination = /* @__PURE__ */ __name((pageSize, blockComponents) => {
|
|
|
1210
1315
|
// src/components/chain/render/dynamic/flexbox/variants/Base.tsx
|
|
1211
1316
|
import { ErrorRender as ErrorRender4 } from "@xylabs/react-error";
|
|
1212
1317
|
import { FlexCol as FlexCol5 } from "@xylabs/react-flexbox";
|
|
1213
|
-
import
|
|
1318
|
+
import React33 from "react";
|
|
1214
1319
|
|
|
1215
1320
|
// src/components/chain/list/Animated.tsx
|
|
1216
1321
|
import { AnimatedList } from "@xylabs/react-animation";
|
|
1217
|
-
import
|
|
1322
|
+
import React32 from "react";
|
|
1218
1323
|
|
|
1219
1324
|
// src/components/chain/styled/BlockListWrapperFlexbox.tsx
|
|
1220
1325
|
import { styled as styled3 } from "@mui/material";
|
|
@@ -1235,17 +1340,17 @@ var BlockListWrapperFlexBox = styled3(FlexCol4, {
|
|
|
1235
1340
|
|
|
1236
1341
|
// src/components/chain/list/Animated.tsx
|
|
1237
1342
|
var BlockListAnimated = /* @__PURE__ */ __name(({ blockChainRenderComponents }) => {
|
|
1238
|
-
return /* @__PURE__ */
|
|
1343
|
+
return /* @__PURE__ */ React32.createElement(BlockListWrapperFlexBox, {
|
|
1239
1344
|
alignItems: "stretch",
|
|
1240
1345
|
width: "100%"
|
|
1241
|
-
}, /* @__PURE__ */
|
|
1346
|
+
}, /* @__PURE__ */ React32.createElement(AnimatedList, {
|
|
1242
1347
|
fullWidth: true,
|
|
1243
1348
|
items: blockChainRenderComponents
|
|
1244
1349
|
}));
|
|
1245
1350
|
}, "BlockListAnimated");
|
|
1246
1351
|
|
|
1247
1352
|
// src/components/chain/render/dynamic/hooks/useDynamicBlockRenderComponents.ts
|
|
1248
|
-
import { useMemo as
|
|
1353
|
+
import { useMemo as useMemo13 } from "react";
|
|
1249
1354
|
|
|
1250
1355
|
// src/hooks/chain-iterator/ChainIteratorStore.ts
|
|
1251
1356
|
import { assertEx } from "@xylabs/assert";
|
|
@@ -1350,7 +1455,7 @@ var useChainIteratorParams = /* @__PURE__ */ __name(({ chainArchivist, chainInfo
|
|
|
1350
1455
|
|
|
1351
1456
|
// src/hooks/chain-iterator/useChainIteratorStore.ts
|
|
1352
1457
|
import { usePromise as usePromise4 } from "@xylabs/react-promise";
|
|
1353
|
-
import { useEffect as useEffect3, useMemo as
|
|
1458
|
+
import { useEffect as useEffect3, useMemo as useMemo12, useRef as useRef3, useSyncExternalStore } from "react";
|
|
1354
1459
|
|
|
1355
1460
|
// src/hooks/chain-iterator/useChainIteratorUpdatingHead.ts
|
|
1356
1461
|
import { toHex as toHex2 } from "@xylabs/hex";
|
|
@@ -1417,7 +1522,7 @@ var useChainIteratorStore = /* @__PURE__ */ __name((chainIteratorParams) => {
|
|
|
1417
1522
|
chainIteratorStore
|
|
1418
1523
|
]);
|
|
1419
1524
|
const cachedSnapshot = useRef3({});
|
|
1420
|
-
const { getSnapShot, subscribe } =
|
|
1525
|
+
const { getSnapShot, subscribe } = useMemo12(() => {
|
|
1421
1526
|
if (chainIteratorStore) {
|
|
1422
1527
|
return {
|
|
1423
1528
|
getSnapShot: /* @__PURE__ */ __name(() => {
|
|
@@ -1499,7 +1604,7 @@ var useIterateChain = /* @__PURE__ */ __name((chainIteratorParams, maxDepth) =>
|
|
|
1499
1604
|
// src/components/chain/render/dynamic/hooks/useDynamicBlockRenderComponents.ts
|
|
1500
1605
|
var useDynamicBlockRenderComponents = /* @__PURE__ */ __name((BlockComponent, blockChainRenderProps) => {
|
|
1501
1606
|
const { maxBlocks } = blockChainRenderProps ?? {};
|
|
1502
|
-
const chainIteratorParams =
|
|
1607
|
+
const chainIteratorParams = useMemo13(() => blockChainRenderProps ?? {}, [
|
|
1503
1608
|
blockChainRenderProps
|
|
1504
1609
|
]);
|
|
1505
1610
|
const [params, paramsError] = useChainIteratorParams(chainIteratorParams);
|
|
@@ -1520,7 +1625,7 @@ var useDynamicBlockRenderComponents = /* @__PURE__ */ __name((BlockComponent, bl
|
|
|
1520
1625
|
|
|
1521
1626
|
// src/components/chain/render/dynamic/hooks/useRemoteBlockChainRenderProps.ts
|
|
1522
1627
|
import { usePromise as usePromise6 } from "@xylabs/react-promise";
|
|
1523
|
-
import { useMemo as
|
|
1628
|
+
import { useMemo as useMemo14 } from "react";
|
|
1524
1629
|
|
|
1525
1630
|
// src/lib/getChainArchivist.ts
|
|
1526
1631
|
import { assertEx as assertEx4 } from "@xylabs/assert";
|
|
@@ -1564,7 +1669,7 @@ var useRemoteBlockChainRenderProps = /* @__PURE__ */ __name((chainArchivistModul
|
|
|
1564
1669
|
url,
|
|
1565
1670
|
chainArchivistModuleId
|
|
1566
1671
|
]);
|
|
1567
|
-
const blockChainRenderProps =
|
|
1672
|
+
const blockChainRenderProps = useMemo14(() => ({
|
|
1568
1673
|
...blockChainRenderPropsArg,
|
|
1569
1674
|
chainArchivist
|
|
1570
1675
|
}), [
|
|
@@ -1580,28 +1685,28 @@ var useRemoteBlockChainRenderProps = /* @__PURE__ */ __name((chainArchivistModul
|
|
|
1580
1685
|
// src/components/chain/render/dynamic/flexbox/variants/Base.tsx
|
|
1581
1686
|
var DynamicListBase = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1582
1687
|
const { errors, blockChainRenderComponents, blocksWhilePaused, pollingState, updatePollingState } = useDynamicBlockRenderComponents(BlockHeadingFlexbox, blockChainRenderProps);
|
|
1583
|
-
return /* @__PURE__ */
|
|
1688
|
+
return /* @__PURE__ */ React33.createElement(FlexCol5, {
|
|
1584
1689
|
alignItems: "start",
|
|
1585
1690
|
...props
|
|
1586
|
-
}, errors?.map((error) => /* @__PURE__ */
|
|
1691
|
+
}, errors?.map((error) => /* @__PURE__ */ React33.createElement(ErrorRender4, {
|
|
1587
1692
|
error,
|
|
1588
1693
|
key: error?.name,
|
|
1589
1694
|
scope: "DynamicBlockchainRenderFlexboxInner"
|
|
1590
|
-
})), /* @__PURE__ */
|
|
1695
|
+
})), /* @__PURE__ */ React33.createElement(MemoizedPollingControlsFlexbox, {
|
|
1591
1696
|
blocksBehind: blocksWhilePaused?.length,
|
|
1592
1697
|
pollingState,
|
|
1593
1698
|
setPollingState: updatePollingState
|
|
1594
|
-
}), /* @__PURE__ */
|
|
1699
|
+
}), /* @__PURE__ */ React33.createElement(BlockListAnimated, {
|
|
1595
1700
|
blockChainRenderComponents
|
|
1596
1701
|
}));
|
|
1597
1702
|
}, "DynamicListBase");
|
|
1598
1703
|
|
|
1599
1704
|
// src/components/chain/render/dynamic/flexbox/variants/WithAnalysis.tsx
|
|
1600
1705
|
import { ChainProducersAnalyzer } from "@xyo-network/chain-protocol";
|
|
1601
|
-
import
|
|
1706
|
+
import React34, { useMemo as useMemo15 } from "react";
|
|
1602
1707
|
var WithAnalysis = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1603
1708
|
const { chainInformation } = blockChainRenderProps ?? {};
|
|
1604
|
-
const analyzers =
|
|
1709
|
+
const analyzers = useMemo15(() => {
|
|
1605
1710
|
if (chainInformation) {
|
|
1606
1711
|
return {
|
|
1607
1712
|
producers: new ChainProducersAnalyzer()
|
|
@@ -1610,9 +1715,9 @@ var WithAnalysis = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props })
|
|
|
1610
1715
|
}, [
|
|
1611
1716
|
chainInformation
|
|
1612
1717
|
]);
|
|
1613
|
-
return /* @__PURE__ */
|
|
1718
|
+
return /* @__PURE__ */ React34.createElement(ChainAnalyzersProvider, {
|
|
1614
1719
|
analyzers
|
|
1615
|
-
}, /* @__PURE__ */
|
|
1720
|
+
}, /* @__PURE__ */ React34.createElement(ChainPollingProvider, null, /* @__PURE__ */ React34.createElement(DynamicListBase, {
|
|
1616
1721
|
blockChainRenderProps,
|
|
1617
1722
|
...props
|
|
1618
1723
|
})));
|
|
@@ -1620,13 +1725,13 @@ var WithAnalysis = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props })
|
|
|
1620
1725
|
|
|
1621
1726
|
// src/components/chain/render/dynamic/flexbox/variants/WithRemote.tsx
|
|
1622
1727
|
import { ErrorRender as ErrorRender5 } from "@xylabs/react-error";
|
|
1623
|
-
import
|
|
1728
|
+
import React35 from "react";
|
|
1624
1729
|
var WithRemote = /* @__PURE__ */ __name(({ url, chainArchivistModuleId, blockChainRenderProps: blockChainRenderPropsArg, ...props }) => {
|
|
1625
1730
|
const { error, blockChainRenderProps } = useRemoteBlockChainRenderProps(chainArchivistModuleId, url, blockChainRenderPropsArg);
|
|
1626
|
-
return /* @__PURE__ */
|
|
1731
|
+
return /* @__PURE__ */ React35.createElement(React35.Fragment, null, /* @__PURE__ */ React35.createElement(ErrorRender5, {
|
|
1627
1732
|
error,
|
|
1628
1733
|
scope: "RemoteChainProviderFlexbox"
|
|
1629
|
-
}), /* @__PURE__ */
|
|
1734
|
+
}), /* @__PURE__ */ React35.createElement(WithAnalysis, {
|
|
1630
1735
|
blockChainRenderProps,
|
|
1631
1736
|
...props
|
|
1632
1737
|
}));
|
|
@@ -1642,16 +1747,16 @@ var DynamicBlockchainRenderFlexbox = {
|
|
|
1642
1747
|
// src/components/chain/render/static/flexbox/variants/Base.tsx
|
|
1643
1748
|
import { ErrorRender as ErrorRender6 } from "@xylabs/react-error";
|
|
1644
1749
|
import { FlexCol as FlexCol6, FlexGrowRow as FlexGrowRow2 } from "@xylabs/react-flexbox";
|
|
1645
|
-
import
|
|
1750
|
+
import React36 from "react";
|
|
1646
1751
|
|
|
1647
1752
|
// src/components/chain/render/static/hooks/useStaticBlockRenderComponents.ts
|
|
1648
1753
|
import { exists } from "@xylabs/exists";
|
|
1649
|
-
import { useMemo as
|
|
1754
|
+
import { useMemo as useMemo16 } from "react";
|
|
1650
1755
|
var DEFAULT_PAGE_SIZE = 25;
|
|
1651
1756
|
var useStaticBlockRenderComponents = /* @__PURE__ */ __name((BlockComponent, blockChainRenderProps) => {
|
|
1652
1757
|
const { maxBlocks } = blockChainRenderProps ?? {};
|
|
1653
1758
|
const pageSize = blockChainRenderProps?.pageSize ?? DEFAULT_PAGE_SIZE;
|
|
1654
|
-
const chainIteratorParams =
|
|
1759
|
+
const chainIteratorParams = useMemo16(() => blockChainRenderProps ?? {}, [
|
|
1655
1760
|
blockChainRenderProps
|
|
1656
1761
|
]);
|
|
1657
1762
|
const [params, paramsError] = useChainIteratorParams(chainIteratorParams);
|
|
@@ -1675,34 +1780,34 @@ var useStaticBlockRenderComponents = /* @__PURE__ */ __name((BlockComponent, blo
|
|
|
1675
1780
|
// src/components/chain/render/static/flexbox/variants/Base.tsx
|
|
1676
1781
|
var StaticListBase = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1677
1782
|
const { blockComponents, errors, paginatedBlockComponents, onPageChange, page, pageSize } = useStaticBlockRenderComponents(BlockHeadingFlexbox, blockChainRenderProps);
|
|
1678
|
-
return /* @__PURE__ */
|
|
1783
|
+
return /* @__PURE__ */ React36.createElement(FlexCol6, {
|
|
1679
1784
|
alignItems: "start",
|
|
1680
1785
|
gap: 2,
|
|
1681
1786
|
width: "100%",
|
|
1682
1787
|
...props
|
|
1683
|
-
}, errors?.map((error) => /* @__PURE__ */
|
|
1788
|
+
}, errors?.map((error) => /* @__PURE__ */ React36.createElement(ErrorRender6, {
|
|
1684
1789
|
error,
|
|
1685
1790
|
key: error.name,
|
|
1686
1791
|
scope: "StaticBlockchainFlexboxInner"
|
|
1687
|
-
})), paginatedBlockComponents?.length ? /* @__PURE__ */
|
|
1792
|
+
})), paginatedBlockComponents?.length ? /* @__PURE__ */ React36.createElement(FlexGrowRow2, {
|
|
1688
1793
|
justifyContent: "space-between",
|
|
1689
1794
|
width: "100%"
|
|
1690
|
-
}, /* @__PURE__ */
|
|
1795
|
+
}, /* @__PURE__ */ React36.createElement(ChainAnalyzerStatsDialogFromContext, null), /* @__PURE__ */ React36.createElement(BlockChainPagination, {
|
|
1691
1796
|
count: blockComponents?.length ?? 0,
|
|
1692
1797
|
onPageChange,
|
|
1693
1798
|
page,
|
|
1694
1799
|
rowsPerPage: pageSize
|
|
1695
|
-
})) : null, /* @__PURE__ */
|
|
1800
|
+
})) : null, /* @__PURE__ */ React36.createElement(BlockListAnimated, {
|
|
1696
1801
|
blockChainRenderComponents: paginatedBlockComponents
|
|
1697
1802
|
}));
|
|
1698
1803
|
}, "StaticListBase");
|
|
1699
1804
|
|
|
1700
1805
|
// src/components/chain/render/static/flexbox/variants/WithAnalysis.tsx
|
|
1701
1806
|
import { ChainProducersAnalyzer as ChainProducersAnalyzer2 } from "@xyo-network/chain-protocol";
|
|
1702
|
-
import
|
|
1807
|
+
import React37, { useMemo as useMemo17 } from "react";
|
|
1703
1808
|
var WithAnalysis2 = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1704
1809
|
const { chainInformation } = blockChainRenderProps ?? {};
|
|
1705
|
-
const analyzers =
|
|
1810
|
+
const analyzers = useMemo17(() => {
|
|
1706
1811
|
if (chainInformation) {
|
|
1707
1812
|
return {
|
|
1708
1813
|
producers: new ChainProducersAnalyzer2()
|
|
@@ -1711,9 +1816,9 @@ var WithAnalysis2 = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props })
|
|
|
1711
1816
|
}, [
|
|
1712
1817
|
chainInformation
|
|
1713
1818
|
]);
|
|
1714
|
-
return /* @__PURE__ */
|
|
1819
|
+
return /* @__PURE__ */ React37.createElement(ChainAnalyzersProvider, {
|
|
1715
1820
|
analyzers
|
|
1716
|
-
}, /* @__PURE__ */
|
|
1821
|
+
}, /* @__PURE__ */ React37.createElement(StaticListBase, {
|
|
1717
1822
|
blockChainRenderProps,
|
|
1718
1823
|
...props
|
|
1719
1824
|
}));
|
|
@@ -1728,19 +1833,19 @@ var StaticBlockchainRenderFlexBox = {
|
|
|
1728
1833
|
// src/components/payload/builder/Flexbox.tsx
|
|
1729
1834
|
import { FlexCol as FlexCol7 } from "@xylabs/react-flexbox";
|
|
1730
1835
|
import { JsonViewerEx as JsonViewerEx2 } from "@xyo-network/react-payload-raw-info";
|
|
1731
|
-
import
|
|
1836
|
+
import React38, { useState as useState13 } from "react";
|
|
1732
1837
|
var PayloadBuilderFlexbox = /* @__PURE__ */ __name(({ BuilderComponent, onBuild, ...props }) => {
|
|
1733
1838
|
const [payload, setPayload] = useState13();
|
|
1734
1839
|
const onBuildLocal = /* @__PURE__ */ __name((payload2) => {
|
|
1735
1840
|
onBuild?.(payload2);
|
|
1736
1841
|
setPayload(payload2);
|
|
1737
1842
|
}, "onBuildLocal");
|
|
1738
|
-
return /* @__PURE__ */
|
|
1843
|
+
return /* @__PURE__ */ React38.createElement(FlexCol7, {
|
|
1739
1844
|
gap: 2,
|
|
1740
1845
|
...props
|
|
1741
|
-
}, /* @__PURE__ */
|
|
1846
|
+
}, /* @__PURE__ */ React38.createElement(BuilderComponent, {
|
|
1742
1847
|
onBuild: onBuildLocal
|
|
1743
|
-
}), payload && /* @__PURE__ */
|
|
1848
|
+
}), payload && /* @__PURE__ */ React38.createElement(JsonViewerEx2, {
|
|
1744
1849
|
value: payload
|
|
1745
1850
|
}));
|
|
1746
1851
|
}, "PayloadBuilderFlexbox");
|
|
@@ -1748,11 +1853,11 @@ var PayloadBuilderFlexbox = /* @__PURE__ */ __name(({ BuilderComponent, onBuild,
|
|
|
1748
1853
|
// src/components/payload/builder/producer-intent/Form.tsx
|
|
1749
1854
|
import { Button as Button5, FormControl as FormControl5 } from "@mui/material";
|
|
1750
1855
|
import { createProducerChainStakeIntent } from "@xyo-network/chain-ethereum";
|
|
1751
|
-
import
|
|
1856
|
+
import React41, { useMemo as useMemo19, useState as useState16 } from "react";
|
|
1752
1857
|
|
|
1753
1858
|
// src/components/payload/fields/BlockNumberTextField.tsx
|
|
1754
1859
|
import { FormControl as FormControl3, FormHelperText as FormHelperText2, TextField as TextField3 } from "@mui/material";
|
|
1755
|
-
import
|
|
1860
|
+
import React39, { useState as useState14 } from "react";
|
|
1756
1861
|
var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumberChanged, onChange, ...props }) => {
|
|
1757
1862
|
const [blockNumber, setBlockNumber] = useState14();
|
|
1758
1863
|
const handleChange = /* @__PURE__ */ __name((e) => {
|
|
@@ -1761,15 +1866,15 @@ var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumber
|
|
|
1761
1866
|
onBlockNumberChanged?.(Number.parseInt(value));
|
|
1762
1867
|
onChange?.(e);
|
|
1763
1868
|
}, "handleChange");
|
|
1764
|
-
return /* @__PURE__ */
|
|
1869
|
+
return /* @__PURE__ */ React39.createElement(FormControl3, {
|
|
1765
1870
|
fullWidth: true
|
|
1766
|
-
}, /* @__PURE__ */
|
|
1871
|
+
}, /* @__PURE__ */ React39.createElement(TextField3, {
|
|
1767
1872
|
error: !!errorMessage,
|
|
1768
1873
|
onChange: handleChange,
|
|
1769
1874
|
type: "number",
|
|
1770
1875
|
value: blockNumber ?? "",
|
|
1771
1876
|
...props
|
|
1772
|
-
}), errorMessage && /* @__PURE__ */
|
|
1877
|
+
}), errorMessage && /* @__PURE__ */ React39.createElement(FormHelperText2, {
|
|
1773
1878
|
sx: {
|
|
1774
1879
|
color: /* @__PURE__ */ __name((theme) => theme.palette.error.main, "color")
|
|
1775
1880
|
}
|
|
@@ -1779,11 +1884,11 @@ var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumber
|
|
|
1779
1884
|
// src/components/payload/fields/XyoAddressTextField.tsx
|
|
1780
1885
|
import { FormControl as FormControl4, FormHelperText as FormHelperText3, TextField as TextField4 } from "@mui/material";
|
|
1781
1886
|
import { asAddress } from "@xylabs/hex";
|
|
1782
|
-
import
|
|
1887
|
+
import React40, { useMemo as useMemo18, useState as useState15 } from "react";
|
|
1783
1888
|
var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange, resetValue, ...props }) => {
|
|
1784
1889
|
const [address, setAddress] = useState15("");
|
|
1785
1890
|
const [addressError, setAddressError] = useState15();
|
|
1786
|
-
|
|
1891
|
+
useMemo18(() => setAddress(""), [
|
|
1787
1892
|
resetValue
|
|
1788
1893
|
]);
|
|
1789
1894
|
const handleChange = /* @__PURE__ */ __name((event) => {
|
|
@@ -1803,15 +1908,15 @@ var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange,
|
|
|
1803
1908
|
onAddressChanged?.();
|
|
1804
1909
|
}
|
|
1805
1910
|
}, "handleBlur");
|
|
1806
|
-
return /* @__PURE__ */
|
|
1911
|
+
return /* @__PURE__ */ React40.createElement(FormControl4, {
|
|
1807
1912
|
fullWidth: true
|
|
1808
|
-
}, /* @__PURE__ */
|
|
1913
|
+
}, /* @__PURE__ */ React40.createElement(TextField4, {
|
|
1809
1914
|
error: !!addressError,
|
|
1810
1915
|
onBlur: handleBlur,
|
|
1811
1916
|
onChange: handleChange,
|
|
1812
1917
|
value: address,
|
|
1813
1918
|
...props
|
|
1814
|
-
}), addressError && /* @__PURE__ */
|
|
1919
|
+
}), addressError && /* @__PURE__ */ React40.createElement(FormHelperText3, {
|
|
1815
1920
|
sx: {
|
|
1816
1921
|
color: /* @__PURE__ */ __name((theme) => theme.palette.error.main, "color")
|
|
1817
1922
|
}
|
|
@@ -1824,7 +1929,7 @@ var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1824
1929
|
const [exp, setExp] = useState16();
|
|
1825
1930
|
const [nbf, setNbf] = useState16();
|
|
1826
1931
|
const [blockRangeError, setBlockRangeError] = useState16();
|
|
1827
|
-
const intentPayload =
|
|
1932
|
+
const intentPayload = useMemo19(() => {
|
|
1828
1933
|
if (exp !== void 0 && nbf !== void 0) {
|
|
1829
1934
|
if (exp <= nbf) {
|
|
1830
1935
|
setBlockRangeError(new Error("Expires must be greater than Not Before"));
|
|
@@ -1844,33 +1949,33 @@ var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1844
1949
|
const onBuildLocal = /* @__PURE__ */ __name(() => {
|
|
1845
1950
|
if (onBuild && intentPayload) onBuild?.(intentPayload);
|
|
1846
1951
|
}, "onBuildLocal");
|
|
1847
|
-
return /* @__PURE__ */
|
|
1952
|
+
return /* @__PURE__ */ React41.createElement(React41.Fragment, null, /* @__PURE__ */ React41.createElement(FormControl5, {
|
|
1848
1953
|
fullWidth: true
|
|
1849
|
-
}, /* @__PURE__ */
|
|
1954
|
+
}, /* @__PURE__ */ React41.createElement(XyoAddressTextField, {
|
|
1850
1955
|
label: "Delegate",
|
|
1851
1956
|
name: "delegate",
|
|
1852
1957
|
onAddressChanged: setDelegate,
|
|
1853
1958
|
required: true,
|
|
1854
1959
|
size: "small"
|
|
1855
|
-
})), /* @__PURE__ */
|
|
1960
|
+
})), /* @__PURE__ */ React41.createElement(FormControl5, {
|
|
1856
1961
|
fullWidth: true
|
|
1857
|
-
}, /* @__PURE__ */
|
|
1962
|
+
}, /* @__PURE__ */ React41.createElement(BlockNumberTextField, {
|
|
1858
1963
|
errorMessage: blockRangeError?.message,
|
|
1859
1964
|
label: "Expires",
|
|
1860
1965
|
name: "exp",
|
|
1861
1966
|
onBlockNumberChanged: setExp,
|
|
1862
1967
|
required: true,
|
|
1863
1968
|
size: "small"
|
|
1864
|
-
})), /* @__PURE__ */
|
|
1969
|
+
})), /* @__PURE__ */ React41.createElement(FormControl5, {
|
|
1865
1970
|
fullWidth: true
|
|
1866
|
-
}, /* @__PURE__ */
|
|
1971
|
+
}, /* @__PURE__ */ React41.createElement(BlockNumberTextField, {
|
|
1867
1972
|
errorMessage: blockRangeError?.message,
|
|
1868
1973
|
label: "Not Before",
|
|
1869
1974
|
name: "nbf",
|
|
1870
1975
|
onBlockNumberChanged: setNbf,
|
|
1871
1976
|
required: true,
|
|
1872
1977
|
size: "small"
|
|
1873
|
-
})), /* @__PURE__ */
|
|
1978
|
+
})), /* @__PURE__ */ React41.createElement(Button5, {
|
|
1874
1979
|
disabled: !intentPayload,
|
|
1875
1980
|
variant: "contained",
|
|
1876
1981
|
onClick: onBuildLocal
|
|
@@ -1878,24 +1983,24 @@ var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1878
1983
|
}, "ProducerIntentBuilderForm");
|
|
1879
1984
|
|
|
1880
1985
|
// src/components/payload/builder/transfer/Flexbox.tsx
|
|
1881
|
-
import
|
|
1986
|
+
import React44 from "react";
|
|
1882
1987
|
|
|
1883
1988
|
// src/components/payload/builder/transfer/Form.tsx
|
|
1884
1989
|
import { Button as Button6, FormControl as FormControl7 } from "@mui/material";
|
|
1885
1990
|
import { TransferSchema } from "@xyo-network/xl1-model";
|
|
1886
|
-
import
|
|
1991
|
+
import React43, { useMemo as useMemo21, useState as useState18 } from "react";
|
|
1887
1992
|
|
|
1888
1993
|
// src/components/payload/builder/transfer/builder/SingleFlexbox.tsx
|
|
1889
1994
|
import { RemoveCircle } from "@mui/icons-material";
|
|
1890
1995
|
import { FormControl as FormControl6, Icon as Icon3, IconButton as IconButton5 } from "@mui/material";
|
|
1891
1996
|
import { toHex as toHex3 } from "@xylabs/hex";
|
|
1892
|
-
import { FlexRow as
|
|
1997
|
+
import { FlexRow as FlexRow8 } from "@xylabs/react-flexbox";
|
|
1893
1998
|
import { BigIntInput } from "@xyo-network/react-shared";
|
|
1894
|
-
import
|
|
1999
|
+
import React42, { useEffect as useEffect4, useMemo as useMemo20, useState as useState17 } from "react";
|
|
1895
2000
|
var SingleTransferBuilderFlexbox = /* @__PURE__ */ __name(({ onTransferUpdated, onRemoveTransfer, singleTransfer, ...props }) => {
|
|
1896
2001
|
const [toAddress, setToAddress] = useState17();
|
|
1897
2002
|
const [amount, setAmount] = useState17();
|
|
1898
|
-
const transferAmount =
|
|
2003
|
+
const transferAmount = useMemo20(() => {
|
|
1899
2004
|
if (toAddress && amount) {
|
|
1900
2005
|
return {
|
|
1901
2006
|
...singleTransfer,
|
|
@@ -1912,36 +2017,36 @@ var SingleTransferBuilderFlexbox = /* @__PURE__ */ __name(({ onTransferUpdated,
|
|
|
1912
2017
|
}, [
|
|
1913
2018
|
transferAmount
|
|
1914
2019
|
]);
|
|
1915
|
-
return /* @__PURE__ */
|
|
2020
|
+
return /* @__PURE__ */ React42.createElement(FlexRow8, {
|
|
1916
2021
|
alignItems: "start",
|
|
1917
2022
|
gap: 1,
|
|
1918
2023
|
...props
|
|
1919
|
-
}, /* @__PURE__ */
|
|
2024
|
+
}, /* @__PURE__ */ React42.createElement(FormControl6, {
|
|
1920
2025
|
fullWidth: true
|
|
1921
|
-
}, /* @__PURE__ */
|
|
2026
|
+
}, /* @__PURE__ */ React42.createElement(XyoAddressTextField, {
|
|
1922
2027
|
label: "To",
|
|
1923
2028
|
name: "to",
|
|
1924
2029
|
onAddressChanged: setToAddress,
|
|
1925
2030
|
required: true,
|
|
1926
2031
|
size: "small"
|
|
1927
|
-
})), /* @__PURE__ */
|
|
2032
|
+
})), /* @__PURE__ */ React42.createElement(FormControl6, {
|
|
1928
2033
|
fullWidth: true
|
|
1929
|
-
}, /* @__PURE__ */
|
|
2034
|
+
}, /* @__PURE__ */ React42.createElement(BigIntInput.TextField, {
|
|
1930
2035
|
label: "Amount",
|
|
1931
2036
|
name: "amount",
|
|
1932
2037
|
onChangeFixedPoint: setAmount,
|
|
1933
2038
|
required: true,
|
|
1934
2039
|
size: "small"
|
|
1935
|
-
})), /* @__PURE__ */
|
|
2040
|
+
})), /* @__PURE__ */ React42.createElement(IconButton5, {
|
|
1936
2041
|
onClick: /* @__PURE__ */ __name(() => onRemoveTransfer?.(singleTransfer.transferId), "onClick")
|
|
1937
|
-
}, /* @__PURE__ */
|
|
2042
|
+
}, /* @__PURE__ */ React42.createElement(Icon3, null, /* @__PURE__ */ React42.createElement(RemoveCircle, null))));
|
|
1938
2043
|
}, "SingleTransferBuilderFlexbox");
|
|
1939
2044
|
|
|
1940
2045
|
// src/components/payload/builder/transfer/Form.tsx
|
|
1941
2046
|
var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
1942
2047
|
const [fromAddress, setFromAddress] = useState18();
|
|
1943
2048
|
const [transfers, setTransfers] = useState18([]);
|
|
1944
|
-
const transferPayload =
|
|
2049
|
+
const transferPayload = useMemo21(() => {
|
|
1945
2050
|
if (fromAddress && transfers.length > 0) {
|
|
1946
2051
|
const transfersRecord = {};
|
|
1947
2052
|
for (const transfer of transfers) {
|
|
@@ -1983,19 +2088,19 @@ var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1983
2088
|
return transfer;
|
|
1984
2089
|
}));
|
|
1985
2090
|
}, "onTransferUpdated");
|
|
1986
|
-
return /* @__PURE__ */
|
|
2091
|
+
return /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(FormControl7, {
|
|
1987
2092
|
fullWidth: true
|
|
1988
|
-
}, /* @__PURE__ */
|
|
2093
|
+
}, /* @__PURE__ */ React43.createElement(XyoAddressTextField, {
|
|
1989
2094
|
label: "From",
|
|
1990
2095
|
name: "from",
|
|
1991
2096
|
onAddressChanged: setFromAddress,
|
|
1992
2097
|
required: true,
|
|
1993
2098
|
size: "small"
|
|
1994
|
-
})), /* @__PURE__ */
|
|
2099
|
+
})), /* @__PURE__ */ React43.createElement(Button6, {
|
|
1995
2100
|
onClick: onTransferAdded,
|
|
1996
2101
|
size: "small",
|
|
1997
2102
|
variant: "contained"
|
|
1998
|
-
}, "Add Transfer"), transfers.map((transfer) => /* @__PURE__ */
|
|
2103
|
+
}, "Add Transfer"), transfers.map((transfer) => /* @__PURE__ */ React43.createElement(SingleTransferBuilderFlexbox, {
|
|
1999
2104
|
key: transfer.transferId,
|
|
2000
2105
|
onTransferUpdated,
|
|
2001
2106
|
onRemoveTransfer: onTransferRemoved,
|
|
@@ -2003,7 +2108,7 @@ var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
2003
2108
|
sx: {
|
|
2004
2109
|
width: "100%"
|
|
2005
2110
|
}
|
|
2006
|
-
})), /* @__PURE__ */
|
|
2111
|
+
})), /* @__PURE__ */ React43.createElement(Button6, {
|
|
2007
2112
|
disabled: !transferPayload,
|
|
2008
2113
|
variant: "contained",
|
|
2009
2114
|
onClick: onBuildLocal
|
|
@@ -2011,7 +2116,7 @@ var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
2011
2116
|
}, "TransferBuilderForm");
|
|
2012
2117
|
|
|
2013
2118
|
// src/components/payload/builder/transfer/Flexbox.tsx
|
|
2014
|
-
var TransferBuilderFlexbox = /* @__PURE__ */ __name(({ onBuild, ...props }) => /* @__PURE__ */
|
|
2119
|
+
var TransferBuilderFlexbox = /* @__PURE__ */ __name(({ onBuild, ...props }) => /* @__PURE__ */ React44.createElement(PayloadBuilderFlexbox, {
|
|
2015
2120
|
gap: 4,
|
|
2016
2121
|
alignItems: "start",
|
|
2017
2122
|
BuilderComponent: TransferBuilderForm,
|
|
@@ -2038,7 +2143,7 @@ import { usePromise as usePromise7 } from "@xylabs/react-promise";
|
|
|
2038
2143
|
import { MemoryArchivist } from "@xyo-network/archivist-memory";
|
|
2039
2144
|
import { ArchivistConfigSchema } from "@xyo-network/archivist-model";
|
|
2040
2145
|
import { flattenHydratedBlocks } from "@xyo-network/chain-protocol";
|
|
2041
|
-
import
|
|
2146
|
+
import React45, { useEffect as useEffect5 } from "react";
|
|
2042
2147
|
var ChainArchivistDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
2043
2148
|
const [randomBlockChain] = usePromise7(async () => await buildRandomBlockChain(), []);
|
|
2044
2149
|
const [blockChainRenderProps, blockChainRenderPropsError] = usePromise7(async () => {
|
|
@@ -2078,7 +2183,7 @@ var ChainArchivistDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
|
2078
2183
|
}
|
|
2079
2184
|
}
|
|
2080
2185
|
};
|
|
2081
|
-
return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */
|
|
2186
|
+
return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */ React45.createElement(Story, props) : /* @__PURE__ */ React45.createElement(CircularProgress, null);
|
|
2082
2187
|
}, "ChainArchivistDecorator");
|
|
2083
2188
|
|
|
2084
2189
|
// src/stories/ChainArchivistDelayedInsertDecorator.tsx
|
|
@@ -2088,7 +2193,7 @@ import { usePromise as usePromise8 } from "@xylabs/react-promise";
|
|
|
2088
2193
|
import { MemoryArchivist as MemoryArchivist2 } from "@xyo-network/archivist-memory";
|
|
2089
2194
|
import { ArchivistConfigSchema as ArchivistConfigSchema2 } from "@xyo-network/archivist-model";
|
|
2090
2195
|
import { flattenHydratedBlock } from "@xyo-network/chain-protocol";
|
|
2091
|
-
import
|
|
2196
|
+
import React46, { useEffect as useEffect6, useState as useState19 } from "react";
|
|
2092
2197
|
var chainArchivistRef;
|
|
2093
2198
|
var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
2094
2199
|
const [firstBlock, setFirstBlock] = useState19();
|
|
@@ -2146,7 +2251,7 @@ var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, contex
|
|
|
2146
2251
|
}
|
|
2147
2252
|
}
|
|
2148
2253
|
};
|
|
2149
|
-
return firstBlock ? /* @__PURE__ */
|
|
2254
|
+
return firstBlock ? /* @__PURE__ */ React46.createElement(Story, props) : /* @__PURE__ */ React46.createElement(CircularProgress2, null);
|
|
2150
2255
|
}, "ChainArchivistDelayedInsertDecorator");
|
|
2151
2256
|
|
|
2152
2257
|
// src/stories/ChainInfoContextDecorator.tsx
|
|
@@ -2155,7 +2260,7 @@ import { usePromise as usePromise9 } from "@xylabs/react-promise";
|
|
|
2155
2260
|
import { XyoChainBlockNumberIterator as XyoChainBlockNumberIterator3 } from "@xyo-network/chain-services";
|
|
2156
2261
|
import { findFirstMatching } from "@xyo-network/chain-utils";
|
|
2157
2262
|
import { isBlockBoundWitness as isBlockBoundWitness3 } from "@xyo-network/xl1-model";
|
|
2158
|
-
import
|
|
2263
|
+
import React47 from "react";
|
|
2159
2264
|
var archivistConfig = {
|
|
2160
2265
|
url: "http://localhost:8080",
|
|
2161
2266
|
chainArchivistModuleId: "XYOPublic:XYOChain:Chain"
|
|
@@ -2181,11 +2286,11 @@ var ChainInfoContextDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
|
2181
2286
|
chainArchivist,
|
|
2182
2287
|
chainInformation
|
|
2183
2288
|
]);
|
|
2184
|
-
return /* @__PURE__ */
|
|
2289
|
+
return /* @__PURE__ */ React47.createElement(ChainInfoProvider, {
|
|
2185
2290
|
chainArchivist,
|
|
2186
2291
|
chainInformation,
|
|
2187
2292
|
chainIterator
|
|
2188
|
-
}, /* @__PURE__ */
|
|
2293
|
+
}, /* @__PURE__ */ React47.createElement(Story, context));
|
|
2189
2294
|
}, "ChainInfoContextDecorator");
|
|
2190
2295
|
export {
|
|
2191
2296
|
BlockChainPagination,
|
|
@@ -2196,6 +2301,7 @@ export {
|
|
|
2196
2301
|
BlockListWrapperFlexBox,
|
|
2197
2302
|
BlockNumberTableCell,
|
|
2198
2303
|
BlockNumberTextField,
|
|
2304
|
+
BlockPayloadCountsTableCell,
|
|
2199
2305
|
BlockProducerChip,
|
|
2200
2306
|
BlockProducerTableCell,
|
|
2201
2307
|
BlockTransactionCountTableCell,
|
|
@@ -2231,6 +2337,7 @@ export {
|
|
|
2231
2337
|
buildBlockHeadingComponent,
|
|
2232
2338
|
buildRandomBlockChain,
|
|
2233
2339
|
buildRandomBlockChainBlocksOnly,
|
|
2340
|
+
payloadCountsFromBlock,
|
|
2234
2341
|
resolveDefinedHead,
|
|
2235
2342
|
txsFromBlock,
|
|
2236
2343
|
useAnchorElement,
|
|
@@ -2243,6 +2350,7 @@ export {
|
|
|
2243
2350
|
useDynamicBlockComponents,
|
|
2244
2351
|
useIterateChain,
|
|
2245
2352
|
useOnBlock,
|
|
2353
|
+
usePayloadCountsFromBlock,
|
|
2246
2354
|
useStaticBlockComponents,
|
|
2247
2355
|
useTxsFromBlock
|
|
2248
2356
|
};
|