@xyo-network/react-chain-blockchain 1.3.15 → 1.3.17
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 +49 -49
- package/dist/browser/index.mjs.map +1 -1
- package/dist/types/components/block/ProducerChip.d.ts.map +1 -1
- package/dist/types/components/block/hooks/useDynamicBlockComponents.d.ts +1 -1
- package/dist/types/components/block/hooks/useDynamicBlockComponents.d.ts.map +1 -1
- package/dist/types/components/block/hooks/useStaticBlockComponents.d.ts.map +1 -1
- package/dist/types/components/block/table/cell/Hash.d.ts.map +1 -1
- package/dist/types/components/block/table/cell/JsonView.d.ts.map +1 -1
- package/dist/types/components/payload/fields/BlockNumberTextField.d.ts.map +1 -1
- package/dist/types/components/transactions/submit/SubmitChain.d.ts.map +1 -1
- package/dist/types/hooks/chain-iterator/useChainIteratorParams.d.ts +1 -1
- package/dist/types/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
- package/dist/types/hooks/useIterateChain.d.ts.map +1 -1
- package/package.json +38 -37
- package/src/components/block/ProducerChip.tsx +9 -2
- package/src/components/block/hooks/useDynamicBlockComponents.ts +2 -2
- package/src/components/block/hooks/useStaticBlockComponents.ts +2 -3
- package/src/components/block/table/cell/Hash.tsx +3 -2
- package/src/components/block/table/cell/JsonView.tsx +2 -1
- package/src/components/block/table/cell/hooks/useLinkedBlockItem.tsx +1 -1
- package/src/components/chain/render/dynamic/hooks/useRemoteBlockChainRenderProps.ts +1 -1
- package/src/components/chain/render/static/flexbox/variants/Base.tsx +1 -1
- package/src/components/chain/render/static/table/variants/Base.tsx +1 -1
- package/src/components/chain/stats/Dialog.tsx +1 -1
- package/src/components/payload/builder/producer-intent/Form.tsx +1 -1
- package/src/components/payload/builder/transfer/Form.tsx +2 -2
- package/src/components/payload/builder/transfer/builder/SingleFlexbox.tsx +2 -2
- package/src/components/payload/fields/BlockNumberTextField.tsx +5 -3
- package/src/components/payload/fields/XyoAddressTextField.tsx +3 -3
- package/src/components/transactions/submit/SubmitChain.tsx +1 -2
- package/src/hooks/chain-iterator/useChainIteratorParams.ts +2 -2
- package/src/hooks/chain-iterator/useChainIteratorUpdatingHead.ts +1 -1
- package/src/hooks/useIterateChain.ts +27 -30
package/dist/browser/index.mjs
CHANGED
|
@@ -251,7 +251,6 @@ var SubmitChainTransaction = /* @__PURE__ */ __name(() => {
|
|
|
251
251
|
const [result, setResult] = useState5();
|
|
252
252
|
const [error, setError] = useState5();
|
|
253
253
|
const onSubmitTx = /* @__PURE__ */ __name(async (chainTx) => {
|
|
254
|
-
if (!network) throw new Error("Network not set");
|
|
255
254
|
const randomAccount = await Account.random();
|
|
256
255
|
const [transactionBoundWitness] = await buildTransaction(chainTx.chain, [], [], randomAccount, chainTx.nbf, chainTx.exp);
|
|
257
256
|
const insertQuery = new PayloadBuilder({
|
|
@@ -268,7 +267,7 @@ var SubmitChainTransaction = /* @__PURE__ */ __name(() => {
|
|
|
268
267
|
chainTx
|
|
269
268
|
]
|
|
270
269
|
]);
|
|
271
|
-
if (response.data.errors) {
|
|
270
|
+
if (response.data.errors.length > 0) {
|
|
272
271
|
setError(new Error(response.data.errors.map((e) => e.message).join("\n")));
|
|
273
272
|
} else {
|
|
274
273
|
setResult(response.data.data);
|
|
@@ -403,6 +402,7 @@ var ChainIteratorStore = class _ChainIteratorStore {
|
|
|
403
402
|
|
|
404
403
|
// src/hooks/chain-iterator/useChainIteratorParams.ts
|
|
405
404
|
import { assertEx as assertEx2 } from "@xylabs/assert";
|
|
405
|
+
import { isHash } from "@xylabs/hex";
|
|
406
406
|
import { usePromise } from "@xylabs/react-promise";
|
|
407
407
|
import { BoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
408
408
|
import { isBlockBoundWitness } from "@xyo-network/xl1-protocol";
|
|
@@ -419,7 +419,7 @@ var resolveDefinedHead = /* @__PURE__ */ __name(async (head, chainArchivist) =>
|
|
|
419
419
|
}, "resolveDefinedHead");
|
|
420
420
|
var useChainIteratorParams = /* @__PURE__ */ __name(({ chainArchivist, chainInformation, head }) => {
|
|
421
421
|
return usePromise(async () => {
|
|
422
|
-
if (chainArchivist && chainInformation && head) {
|
|
422
|
+
if (chainArchivist && chainInformation && isHash(head)) {
|
|
423
423
|
const [result] = await chainArchivist.get([
|
|
424
424
|
head
|
|
425
425
|
]);
|
|
@@ -455,7 +455,7 @@ var useChainIteratorUpdatingHead = /* @__PURE__ */ __name(({ chainIterator, inte
|
|
|
455
455
|
try {
|
|
456
456
|
const currentHead = await chainIterator.head();
|
|
457
457
|
const mostRecentBlock = await findMostRecentBlock(chainArchivist);
|
|
458
|
-
if (
|
|
458
|
+
if (mostRecentBlock) {
|
|
459
459
|
const currentBlockNumber = currentHead?.block ?? -1;
|
|
460
460
|
const nextBlockNumber = mostRecentBlock.block;
|
|
461
461
|
if (nextBlockNumber > currentBlockNumber) {
|
|
@@ -552,30 +552,27 @@ var getHydratedBlock = /* @__PURE__ */ __name(async (chainArchivist, head) => {
|
|
|
552
552
|
}, "getHydratedBlock");
|
|
553
553
|
var iterateChain = /* @__PURE__ */ __name(async (chainIteratorParams, maxDepth) => {
|
|
554
554
|
const { chainArchivist, head } = chainIteratorParams ?? {};
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
depth++;
|
|
575
|
-
if (maxDepth && depth >= maxDepth || block?.[0].block === 0) break;
|
|
576
|
-
}
|
|
577
|
-
return blocks;
|
|
555
|
+
const headPayload = assertEx3(isBlockBoundWitness2(head) ? head : null, () => "Head is not a Block Bound Witness");
|
|
556
|
+
const headBlockBoundWitness = assertEx3(isBlockBoundWitness2(headPayload) ? headPayload : null, () => "Invalid head block");
|
|
557
|
+
const chainIterator = await XyoChainBlockNumberIterator2.create({
|
|
558
|
+
head: headBlockBoundWitness,
|
|
559
|
+
chainArchivist
|
|
560
|
+
});
|
|
561
|
+
const chainHead = await chainIterator.head();
|
|
562
|
+
let block = await getHydratedBlock(chainArchivist, chainHead);
|
|
563
|
+
const blocks = [
|
|
564
|
+
block
|
|
565
|
+
];
|
|
566
|
+
let depth = 1;
|
|
567
|
+
while (true) {
|
|
568
|
+
const [, next] = await chainIterator.previous(block[0].block, 2);
|
|
569
|
+
const nextHydratedBlock = await getHydratedBlock(chainArchivist, next);
|
|
570
|
+
blocks.push(nextHydratedBlock);
|
|
571
|
+
block = nextHydratedBlock;
|
|
572
|
+
depth++;
|
|
573
|
+
if (maxDepth !== void 0 && depth >= maxDepth || block?.[0].block === 0) break;
|
|
578
574
|
}
|
|
575
|
+
return blocks;
|
|
579
576
|
}, "iterateChain");
|
|
580
577
|
var useIterateChain = /* @__PURE__ */ __name((chainIteratorParams, maxDepth) => {
|
|
581
578
|
return usePromise3(async () => {
|
|
@@ -761,7 +758,7 @@ var useDynamicBlockComponents = /* @__PURE__ */ __name((BlockComponent, params,
|
|
|
761
758
|
newBlockComponent,
|
|
762
759
|
...blockComponents
|
|
763
760
|
];
|
|
764
|
-
if (maxBlocks && newBlockComponents.length > maxBlocks) {
|
|
761
|
+
if (maxBlocks !== void 0 && newBlockComponents.length > maxBlocks) {
|
|
765
762
|
newBlockComponents.pop();
|
|
766
763
|
}
|
|
767
764
|
return newBlockComponents;
|
|
@@ -801,9 +798,8 @@ var useStaticBlockComponents = /* @__PURE__ */ __name((BlockComponent, params, b
|
|
|
801
798
|
const [blockComponents, blockComponentsError] = usePromise5(async () => {
|
|
802
799
|
const resolvedBlockWithStorage = blocks ?? [];
|
|
803
800
|
if (!params?.chainArchivist) return [];
|
|
804
|
-
const { chainArchivist } = params;
|
|
805
801
|
return await Promise.all(resolvedBlockWithStorage?.map(async (block) => {
|
|
806
|
-
if (onBlock
|
|
802
|
+
if (onBlock) {
|
|
807
803
|
await onBlock(block);
|
|
808
804
|
}
|
|
809
805
|
const blockComponentProps = {
|
|
@@ -886,7 +882,7 @@ import { BlockiesAvatar } from "@xyo-network/react-chain-blockies";
|
|
|
886
882
|
import React12, { useMemo as useMemo9 } from "react";
|
|
887
883
|
var BlockProducerChip = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
888
884
|
const blockProducer2 = block?.[0].addresses[0];
|
|
889
|
-
const shortedBlockProducer = blockProducer2 ? EthAddress.parse(blockProducer2)?.toShortString(3)
|
|
885
|
+
const shortedBlockProducer = blockProducer2 === void 0 ? null : EthAddress.parse(blockProducer2)?.toShortString(3);
|
|
890
886
|
const avatar = useMemo9(() => blockProducer2 === "" ? void 0 : /* @__PURE__ */ React12.createElement(BlockiesAvatar, {
|
|
891
887
|
blockiesOptions: {
|
|
892
888
|
seed: blockProducer2
|
|
@@ -896,7 +892,7 @@ var BlockProducerChip = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
|
896
892
|
]);
|
|
897
893
|
return /* @__PURE__ */ React12.createElement(Chip2, {
|
|
898
894
|
avatar,
|
|
899
|
-
label: shortedBlockProducer ? `${shortedBlockProducer}` : null,
|
|
895
|
+
label: typeof shortedBlockProducer === "string" ? `${shortedBlockProducer}` : null,
|
|
900
896
|
title: `Block producer: ${blockProducer2}`,
|
|
901
897
|
...props
|
|
902
898
|
});
|
|
@@ -968,6 +964,7 @@ var BlockNumberTableCell = /* @__PURE__ */ __name(({ block, linked, ...props })
|
|
|
968
964
|
|
|
969
965
|
// src/components/block/table/cell/Hash.tsx
|
|
970
966
|
import { Avatar, Chip as Chip3, TableCell as TableCell2, Tooltip as Tooltip2 } from "@mui/material";
|
|
967
|
+
import { isHash as isHash2 } from "@xylabs/hex";
|
|
971
968
|
import { Identicon } from "@xylabs/react-identicon";
|
|
972
969
|
import { usePayloadRootHash } from "@xyo-network/react-shared";
|
|
973
970
|
import React16 from "react";
|
|
@@ -986,7 +983,7 @@ var useLinkedBlockItem = /* @__PURE__ */ __name((noun, data) => {
|
|
|
986
983
|
const handleClick = /* @__PURE__ */ __name((event) => {
|
|
987
984
|
event.preventDefault();
|
|
988
985
|
event.stopPropagation();
|
|
989
|
-
if (
|
|
986
|
+
if (noun === void 0) {
|
|
990
987
|
console.warn("useLinkedBlockItem: noun is required");
|
|
991
988
|
return;
|
|
992
989
|
}
|
|
@@ -1003,11 +1000,11 @@ var BlockHashTableCell = /* @__PURE__ */ __name(({ block, identiconProps, notAva
|
|
|
1003
1000
|
const hash = usePayloadRootHash(block?.[0]);
|
|
1004
1001
|
const [ref, handleClick] = useLinkedBlockItem("block-hash", hash);
|
|
1005
1002
|
const [notAvailable, setNotAvailable] = React16.useState(false);
|
|
1006
|
-
const shortenedHash = hash ? `${hash.slice(0, 4)}...${hash.slice(-5, -1)}` : "";
|
|
1003
|
+
const shortenedHash = isHash2(hash) ? `${hash.slice(0, 4)}...${hash.slice(-5, -1)}` : "";
|
|
1007
1004
|
return /* @__PURE__ */ React16.createElement(TableCell2, {
|
|
1008
1005
|
ref,
|
|
1009
1006
|
...props
|
|
1010
|
-
}, hash ? /* @__PURE__ */ React16.createElement(Tooltip2, {
|
|
1007
|
+
}, isHash2(hash) ? /* @__PURE__ */ React16.createElement(Tooltip2, {
|
|
1011
1008
|
title: `Block Hash: ${hash}`
|
|
1012
1009
|
}, /* @__PURE__ */ React16.createElement(Chip3, {
|
|
1013
1010
|
avatar: /* @__PURE__ */ React16.createElement(Avatar, {
|
|
@@ -1035,6 +1032,7 @@ var BlockHashTableCell = /* @__PURE__ */ __name(({ block, identiconProps, notAva
|
|
|
1035
1032
|
import { DataObject } from "@mui/icons-material";
|
|
1036
1033
|
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";
|
|
1037
1034
|
import { ellipsize } from "@xylabs/eth-address";
|
|
1035
|
+
import { isHash as isHash3 } from "@xylabs/hex";
|
|
1038
1036
|
import { FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
|
|
1039
1037
|
import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
|
|
1040
1038
|
import { usePayloadRootHash as usePayloadRootHash2 } from "@xyo-network/react-shared";
|
|
@@ -1043,7 +1041,7 @@ var BlockJsonViewTableCell = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
|
1043
1041
|
const [open, setOpen] = useState10(false);
|
|
1044
1042
|
const onClose = /* @__PURE__ */ __name(() => setOpen(false), "onClose");
|
|
1045
1043
|
const hash = usePayloadRootHash2(block?.[0]);
|
|
1046
|
-
const title = hash ? `JSON for ${ellipsize(hash, 5)}` : "JSON";
|
|
1044
|
+
const title = isHash3(hash) ? `JSON for ${ellipsize(hash, 5)}` : "JSON";
|
|
1047
1045
|
return /* @__PURE__ */ React17.createElement(TableCell3, props, /* @__PURE__ */ React17.createElement(FlexRow3, {
|
|
1048
1046
|
onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick"),
|
|
1049
1047
|
sx: {
|
|
@@ -1357,7 +1355,7 @@ var StyledListItem = styled(ListItem)(() => ({
|
|
|
1357
1355
|
// src/components/chain/stats/Dialog.tsx
|
|
1358
1356
|
var ChainAnalyzerStatsDialog = /* @__PURE__ */ __name((props) => {
|
|
1359
1357
|
const { analyzers, statsUpdated } = useChainAnalyzersContext();
|
|
1360
|
-
return /* @__PURE__ */ React27.createElement(Dialog3, props, /* @__PURE__ */ React27.createElement(DialogTitle3, null, "Chain Analysis"), /* @__PURE__ */ React27.createElement(DialogContent3, null,
|
|
1358
|
+
return /* @__PURE__ */ React27.createElement(Dialog3, props, /* @__PURE__ */ React27.createElement(DialogTitle3, null, "Chain Analysis"), /* @__PURE__ */ React27.createElement(DialogContent3, null, statsUpdated > 0 && Object.entries(analyzers).map(([id2, analyzer]) => /* @__PURE__ */ React27.createElement("div", {
|
|
1361
1359
|
key: id2
|
|
1362
1360
|
}, id2 === "producers" && /* @__PURE__ */ React27.createElement(BlockProducerStatsFlexbox, {
|
|
1363
1361
|
payload: analyzer.result()
|
|
@@ -1661,7 +1659,7 @@ var getChainInformation = /* @__PURE__ */ __name(() => {
|
|
|
1661
1659
|
// src/components/chain/render/dynamic/hooks/useRemoteBlockChainRenderProps.ts
|
|
1662
1660
|
var useRemoteBlockChainRenderProps = /* @__PURE__ */ __name((chainArchivistModuleId, url, blockChainRenderPropsArg) => {
|
|
1663
1661
|
const [chainArchivist, chainArchivistError] = usePromise6(async () => {
|
|
1664
|
-
if (url && chainArchivistModuleId) {
|
|
1662
|
+
if (url !== void 0 && chainArchivistModuleId !== void 0) {
|
|
1665
1663
|
return await getChainArchivistFromBridge({
|
|
1666
1664
|
url,
|
|
1667
1665
|
chainArchivistModuleId
|
|
@@ -1791,7 +1789,7 @@ var StaticListBase = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }
|
|
|
1791
1789
|
error,
|
|
1792
1790
|
key: error.name,
|
|
1793
1791
|
scope: "StaticBlockchainFlexboxInner"
|
|
1794
|
-
})), paginatedBlockComponents?.length ? /* @__PURE__ */ React36.createElement(FlexGrowRow2, {
|
|
1792
|
+
})), (paginatedBlockComponents?.length ?? 0) > 0 ? /* @__PURE__ */ React36.createElement(FlexGrowRow2, {
|
|
1795
1793
|
justifyContent: "space-between",
|
|
1796
1794
|
width: "100%"
|
|
1797
1795
|
}, /* @__PURE__ */ React36.createElement(ChainAnalyzerStatsDialogFromContext, null), /* @__PURE__ */ React36.createElement(BlockChainPagination, {
|
|
@@ -1864,19 +1862,20 @@ var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumber
|
|
|
1864
1862
|
const [blockNumber, setBlockNumber] = useState14();
|
|
1865
1863
|
const handleChange = /* @__PURE__ */ __name((e) => {
|
|
1866
1864
|
const value = e.target.value.replaceAll(/\D/g, "");
|
|
1867
|
-
setBlockNumber(value ? Number(value) : void 0);
|
|
1865
|
+
setBlockNumber(value.length > 0 ? Number(value) : void 0);
|
|
1868
1866
|
onBlockNumberChanged?.(Number.parseInt(value));
|
|
1869
1867
|
onChange?.(e);
|
|
1870
1868
|
}, "handleChange");
|
|
1869
|
+
const errored = errorMessage !== void 0;
|
|
1871
1870
|
return /* @__PURE__ */ React39.createElement(FormControl3, {
|
|
1872
1871
|
fullWidth: true
|
|
1873
1872
|
}, /* @__PURE__ */ React39.createElement(TextField3, {
|
|
1874
|
-
error:
|
|
1873
|
+
error: errored,
|
|
1875
1874
|
onChange: handleChange,
|
|
1876
1875
|
type: "number",
|
|
1877
1876
|
value: blockNumber ?? "",
|
|
1878
1877
|
...props
|
|
1879
|
-
}),
|
|
1878
|
+
}), errored && /* @__PURE__ */ React39.createElement(FormHelperText2, {
|
|
1880
1879
|
sx: {
|
|
1881
1880
|
color: "error.main"
|
|
1882
1881
|
}
|
|
@@ -1885,7 +1884,7 @@ var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumber
|
|
|
1885
1884
|
|
|
1886
1885
|
// src/components/payload/fields/XyoAddressTextField.tsx
|
|
1887
1886
|
import { FormControl as FormControl4, FormHelperText as FormHelperText3, TextField as TextField4 } from "@mui/material";
|
|
1888
|
-
import { asAddress } from "@xylabs/hex";
|
|
1887
|
+
import { asAddress, isAddress } from "@xylabs/hex";
|
|
1889
1888
|
import React40, { useMemo as useMemo19, useState as useState15 } from "react";
|
|
1890
1889
|
var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange, resetValue, ...props }) => {
|
|
1891
1890
|
const [address, setAddress] = useState15("");
|
|
@@ -1897,7 +1896,7 @@ var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange,
|
|
|
1897
1896
|
const { value } = event.target;
|
|
1898
1897
|
onChange?.(event);
|
|
1899
1898
|
const xyoAddress = asAddress(value);
|
|
1900
|
-
if (xyoAddress) {
|
|
1899
|
+
if (isAddress(xyoAddress)) {
|
|
1901
1900
|
onAddressChanged?.(xyoAddress);
|
|
1902
1901
|
}
|
|
1903
1902
|
setAddressError(void 0);
|
|
@@ -1905,7 +1904,7 @@ var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange,
|
|
|
1905
1904
|
}, "handleChange");
|
|
1906
1905
|
const handleBlur = /* @__PURE__ */ __name(() => {
|
|
1907
1906
|
const xyoAddress = asAddress(address);
|
|
1908
|
-
if (!xyoAddress) {
|
|
1907
|
+
if (!isAddress(xyoAddress)) {
|
|
1909
1908
|
setAddressError(new Error("Invalid address"));
|
|
1910
1909
|
onAddressChanged?.();
|
|
1911
1910
|
}
|
|
@@ -1937,7 +1936,7 @@ var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1937
1936
|
setBlockRangeError(new Error("Expires must be greater than Not Before"));
|
|
1938
1937
|
} else {
|
|
1939
1938
|
setBlockRangeError(void 0);
|
|
1940
|
-
if (delegate) {
|
|
1939
|
+
if (delegate !== void 0) {
|
|
1941
1940
|
const payload = createProducerChainStakeIntent(delegate, exp, nbf);
|
|
1942
1941
|
return payload;
|
|
1943
1942
|
}
|
|
@@ -1989,13 +1988,14 @@ import React44 from "react";
|
|
|
1989
1988
|
|
|
1990
1989
|
// src/components/payload/builder/transfer/Form.tsx
|
|
1991
1990
|
import { Button as Button6, FormControl as FormControl7 } from "@mui/material";
|
|
1991
|
+
import { isAddress as isAddress3 } from "@xylabs/hex";
|
|
1992
1992
|
import { TransferSchema } from "@xyo-network/xl1-protocol";
|
|
1993
1993
|
import React43, { useMemo as useMemo22, useState as useState18 } from "react";
|
|
1994
1994
|
|
|
1995
1995
|
// src/components/payload/builder/transfer/builder/SingleFlexbox.tsx
|
|
1996
1996
|
import { RemoveCircle } from "@mui/icons-material";
|
|
1997
1997
|
import { FormControl as FormControl6, Icon as Icon3, IconButton as IconButton5 } from "@mui/material";
|
|
1998
|
-
import { toHex as toHex3 } from "@xylabs/hex";
|
|
1998
|
+
import { isAddress as isAddress2, toHex as toHex3 } from "@xylabs/hex";
|
|
1999
1999
|
import { FlexRow as FlexRow7 } from "@xylabs/react-flexbox";
|
|
2000
2000
|
import { BigIntInput } from "@xyo-network/react-shared";
|
|
2001
2001
|
import React42, { useEffect as useEffect4, useMemo as useMemo21, useState as useState17 } from "react";
|
|
@@ -2003,7 +2003,7 @@ var SingleTransferBuilderFlexbox = /* @__PURE__ */ __name(({ onTransferUpdated,
|
|
|
2003
2003
|
const [toAddress, setToAddress] = useState17();
|
|
2004
2004
|
const [amount, setAmount] = useState17();
|
|
2005
2005
|
const transferAmount = useMemo21(() => {
|
|
2006
|
-
if (toAddress && amount) {
|
|
2006
|
+
if (isAddress2(toAddress) && amount !== void 0) {
|
|
2007
2007
|
return {
|
|
2008
2008
|
...singleTransfer,
|
|
2009
2009
|
amount: toHex3(amount),
|
|
@@ -2049,7 +2049,7 @@ var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
2049
2049
|
const [fromAddress, setFromAddress] = useState18();
|
|
2050
2050
|
const [transfers, setTransfers] = useState18([]);
|
|
2051
2051
|
const transferPayload = useMemo22(() => {
|
|
2052
|
-
if (fromAddress && transfers.length > 0) {
|
|
2052
|
+
if (isAddress3(fromAddress) && transfers.length > 0) {
|
|
2053
2053
|
const transfersRecord = {};
|
|
2054
2054
|
for (const transfer of transfers) {
|
|
2055
2055
|
transfersRecord[transfer.to] = transfer.amount;
|