@xyo-network/react-chain-blockchain 1.0.10 → 1.0.11
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 +245 -225
- package/dist/browser/index.mjs.map +1 -1
- package/dist/types/components/block/ProducerChip.d.ts +2 -2
- package/dist/types/components/block/ProducerChip.d.ts.map +1 -1
- package/dist/types/components/block/helpers/buildBlockChainRenderComponent.d.ts +2 -3
- package/dist/types/components/block/helpers/buildBlockChainRenderComponent.d.ts.map +1 -1
- package/dist/types/components/block/helpers/tsxFromBlock.d.ts +3 -4
- package/dist/types/components/block/helpers/tsxFromBlock.d.ts.map +1 -1
- package/dist/types/components/block/hooks/useBlockProducer.d.ts +2 -2
- package/dist/types/components/block/hooks/useBlockProducer.d.ts.map +1 -1
- package/dist/types/components/block/hooks/useDynamicBlockComponents.d.ts +2 -2
- package/dist/types/components/block/hooks/useDynamicBlockComponents.d.ts.map +1 -1
- package/dist/types/components/block/hooks/useStaticBlockComponents.d.ts +2 -2
- package/dist/types/components/block/hooks/useStaticBlockComponents.d.ts.map +1 -1
- package/dist/types/components/block/hooks/useTxsFromBlock.d.ts +3 -4
- package/dist/types/components/block/hooks/useTxsFromBlock.d.ts.map +1 -1
- package/dist/types/components/block/menu/Expanded.d.ts +2 -2
- package/dist/types/components/block/menu/Expanded.d.ts.map +1 -1
- package/dist/types/components/block/table/Ex.d.ts +1 -4
- package/dist/types/components/block/table/Ex.d.ts.map +1 -1
- package/dist/types/components/block/table/cell/TransactionCount.d.ts +0 -2
- package/dist/types/components/block/table/cell/TransactionCount.d.ts.map +1 -1
- package/dist/types/components/block/table/cell/lib/BlockTableCellProps.d.ts +2 -2
- package/dist/types/components/block/table/cell/lib/BlockTableCellProps.d.ts.map +1 -1
- package/dist/types/components/block/table/head/TableHead.d.ts +3 -0
- package/dist/types/components/block/table/head/TableHead.d.ts.map +1 -0
- package/dist/types/components/block/table/head/index.d.ts +2 -0
- package/dist/types/components/block/table/head/index.d.ts.map +1 -0
- package/dist/types/components/block/table/index.d.ts +1 -0
- package/dist/types/components/block/table/index.d.ts.map +1 -1
- package/dist/types/components/chain/hooks/useOnBlock.d.ts +2 -2
- package/dist/types/components/chain/hooks/useOnBlock.d.ts.map +1 -1
- package/dist/types/components/chain/render/dynamic/flexbox/Flexbox.d.ts +3 -5
- package/dist/types/components/chain/render/dynamic/flexbox/Flexbox.d.ts.map +1 -1
- package/dist/types/components/chain/render/dynamic/flexbox/variants/Base.d.ts +4 -0
- package/dist/types/components/chain/render/dynamic/flexbox/variants/Base.d.ts.map +1 -0
- package/dist/types/components/chain/render/dynamic/flexbox/variants/WithAnalysis.d.ts +4 -0
- package/dist/types/components/chain/render/dynamic/flexbox/variants/WithAnalysis.d.ts.map +1 -0
- package/dist/types/components/chain/render/dynamic/flexbox/variants/WithRemote.d.ts +4 -0
- package/dist/types/components/chain/render/dynamic/flexbox/variants/WithRemote.d.ts.map +1 -0
- package/dist/types/components/chain/render/dynamic/flexbox/variants/index.d.ts +4 -0
- package/dist/types/components/chain/render/dynamic/flexbox/variants/index.d.ts.map +1 -0
- package/dist/types/components/chain/render/dynamic/hooks/useDynamicBlockRenderComponents.d.ts +1 -1
- package/dist/types/components/chain/render/static/flexbox/Flexbox.d.ts +2 -4
- package/dist/types/components/chain/render/static/flexbox/Flexbox.d.ts.map +1 -1
- package/dist/types/components/chain/render/static/flexbox/variants/Base.d.ts +4 -0
- package/dist/types/components/chain/render/static/flexbox/variants/Base.d.ts.map +1 -0
- package/dist/types/components/chain/render/static/flexbox/variants/WithAnalysis.d.ts +4 -0
- package/dist/types/components/chain/render/static/flexbox/variants/WithAnalysis.d.ts.map +1 -0
- package/dist/types/components/chain/render/static/flexbox/variants/index.d.ts +3 -0
- package/dist/types/components/chain/render/static/flexbox/variants/index.d.ts.map +1 -0
- package/dist/types/components/chain/render/static/table/Ex.d.ts +2 -6
- package/dist/types/components/chain/render/static/table/Ex.d.ts.map +1 -1
- package/dist/types/components/chain/render/static/table/variants/Base.d.ts +4 -0
- package/dist/types/components/chain/render/static/table/variants/Base.d.ts.map +1 -0
- package/dist/types/components/chain/render/static/table/variants/WithAnalysis.d.ts +4 -0
- package/dist/types/components/chain/render/static/table/variants/WithAnalysis.d.ts.map +1 -0
- package/dist/types/components/chain/render/static/table/variants/index.d.ts +3 -0
- package/dist/types/components/chain/render/static/table/variants/index.d.ts.map +1 -0
- package/dist/types/components/payload/fields/XyoAddressTextField.d.ts.map +1 -1
- package/dist/types/components/transactions/TransactionsQuickTipButton.d.ts +2 -4
- package/dist/types/components/transactions/TransactionsQuickTipButton.d.ts.map +1 -1
- package/dist/types/context/analyzer/Provider.d.ts.map +1 -1
- package/dist/types/context/analyzer/state.d.ts +2 -3
- package/dist/types/context/analyzer/state.d.ts.map +1 -1
- package/dist/types/hooks/chain-iterator/ChainIteratorStore.d.ts +2 -2
- package/dist/types/hooks/chain-iterator/ChainIteratorStore.d.ts.map +1 -1
- package/dist/types/hooks/chain-iterator/useChainIteratorStore.d.ts.map +1 -1
- package/dist/types/hooks/chain-iterator/useChainIteratorUpdatingHead.d.ts.map +1 -1
- package/dist/types/hooks/useIterateChain.d.ts +2 -2
- package/dist/types/hooks/useIterateChain.d.ts.map +1 -1
- package/dist/types/stories/ChainArchivistDecorator.d.ts.map +1 -1
- package/dist/types/stories/ChainArchivistDelayedInsertDecorator.d.ts.map +1 -1
- package/dist/types/stories/buildRandomBlockchain.d.ts +3 -2
- package/dist/types/stories/buildRandomBlockchain.d.ts.map +1 -1
- package/dist/types/types/BlockComponentProps.d.ts +2 -2
- package/dist/types/types/BlockComponentProps.d.ts.map +1 -1
- package/dist/types/types/BlockComponents.d.ts +2 -2
- package/dist/types/types/BlockComponents.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/components/block/BlockHeadingFlexbox.stories.tsx +2 -2
- package/src/components/block/BlockHeadingFlexbox.tsx +3 -3
- package/src/components/block/ProducerChip.tsx +3 -9
- package/src/components/block/helpers/buildBlockChainRenderComponent.tsx +3 -6
- package/src/components/block/helpers/tsxFromBlock.ts +4 -6
- package/src/components/block/hooks/useBlockProducer.ts +3 -3
- package/src/components/block/hooks/useDynamicBlockComponents.ts +6 -7
- package/src/components/block/hooks/useStaticBlockComponents.ts +4 -4
- package/src/components/block/hooks/useTxsFromBlock.ts +5 -6
- package/src/components/block/menu/Expanded.tsx +4 -4
- package/src/components/block/table/Ex.stories.tsx +4 -8
- package/src/components/block/table/Ex.tsx +5 -14
- package/src/components/block/table/cell/BlockNumber.tsx +3 -3
- package/src/components/block/table/cell/Hash.tsx +1 -1
- package/src/components/block/table/cell/JsonView.tsx +1 -1
- package/src/components/block/table/cell/TransactionCount.tsx +3 -6
- package/src/components/block/table/cell/Verification.tsx +2 -2
- package/src/components/block/table/cell/lib/BlockTableCellProps.ts +2 -2
- package/src/components/block/table/head/TableHead.tsx +19 -0
- package/src/components/block/table/head/index.ts +1 -0
- package/src/components/block/table/index.ts +1 -0
- package/src/components/chain/hooks/useOnBlock.ts +11 -7
- package/src/components/chain/render/dynamic/flexbox/Flexbox.tsx +4 -62
- package/src/components/chain/render/dynamic/flexbox/variants/Base.tsx +27 -0
- package/src/components/chain/render/dynamic/flexbox/variants/WithAnalysis.tsx +25 -0
- package/src/components/chain/render/dynamic/flexbox/variants/WithRemote.tsx +19 -0
- package/src/components/chain/render/dynamic/flexbox/variants/index.ts +3 -0
- package/src/components/chain/render/dynamic/hooks/useDynamicBlockRenderComponents.ts +1 -1
- package/src/components/chain/render/static/flexbox/Flexbox.tsx +2 -54
- package/src/components/chain/render/static/flexbox/variants/Base.tsx +31 -0
- package/src/components/chain/render/static/flexbox/variants/WithAnalysis.tsx +23 -0
- package/src/components/chain/render/static/flexbox/variants/index.ts +2 -0
- package/src/components/chain/render/static/table/Ex.tsx +2 -36
- package/src/components/chain/render/static/table/variants/Base.tsx +29 -0
- package/src/components/chain/render/static/table/variants/WithAnalysis.tsx +11 -0
- package/src/components/chain/render/static/table/variants/index.ts +2 -0
- package/src/components/payload/fields/XyoAddressTextField.tsx +2 -2
- package/src/components/transactions/TransactionsQuickTipButton.tsx +4 -8
- package/src/context/analyzer/Provider.tsx +3 -8
- package/src/context/analyzer/state.ts +2 -3
- package/src/hooks/chain-iterator/ChainIteratorStore.ts +12 -5
- package/src/hooks/chain-iterator/useChainIteratorStore.ts +2 -1
- package/src/hooks/chain-iterator/useChainIteratorUpdatingHead.ts +1 -0
- package/src/hooks/useIterateChain.ts +20 -7
- package/src/stories/ChainArchivistDecorator.tsx +4 -3
- package/src/stories/ChainArchivistDelayedInsertDecorator.tsx +10 -26
- package/src/stories/buildRandomBlockchain.ts +2 -4
- package/src/types/BlockComponentProps.ts +2 -2
- package/src/types/BlockComponents.ts +2 -2
package/dist/browser/index.mjs
CHANGED
|
@@ -12,8 +12,6 @@ import { createContextEx } from "@xyo-network/react-shared";
|
|
|
12
12
|
var ChainAnalyzersContext = createContextEx();
|
|
13
13
|
|
|
14
14
|
// src/context/analyzer/Provider.tsx
|
|
15
|
-
import { hydrateBlock } from "@xyo-network/chain-protocol";
|
|
16
|
-
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
17
15
|
import React, { useCallback, useMemo, useState } from "react";
|
|
18
16
|
var ChainAnalyzersProvider = /* @__PURE__ */ __name(({ analyzers: analyzersProp, children }) => {
|
|
19
17
|
const [analyzersState, setAnalyzersState] = useState(analyzersProp ?? {});
|
|
@@ -31,9 +29,8 @@ var ChainAnalyzersProvider = /* @__PURE__ */ __name(({ analyzers: analyzersProp,
|
|
|
31
29
|
...analyzers2
|
|
32
30
|
}));
|
|
33
31
|
}, []);
|
|
34
|
-
const onBlock = useCallback(async (
|
|
35
|
-
|
|
36
|
-
const hydratedBlock = await hydrateBlock(chainArchivist, hash);
|
|
32
|
+
const onBlock = useCallback(async (hydratedBlock) => {
|
|
33
|
+
await Promise.resolve();
|
|
37
34
|
for (const analyzer of Object.values(analyzers)) {
|
|
38
35
|
void analyzer.onBlock(hydratedBlock);
|
|
39
36
|
setStatsUpdated(Date.now());
|
|
@@ -239,7 +236,7 @@ import { Account } from "@xyo-network/account";
|
|
|
239
236
|
import { ArchivistInsertQuerySchema } from "@xyo-network/archivist-model";
|
|
240
237
|
import { QueryBoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
241
238
|
import { buildTransaction } from "@xyo-network/chain-protocol";
|
|
242
|
-
import { PayloadBuilder
|
|
239
|
+
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
243
240
|
import React6, { useState as useState5 } from "react";
|
|
244
241
|
var BETA_PENDING_TRANSACTIONS_ARCHIVIST = "https://beta.api.chain.xyo.network/8050fee682a2762f504d5449d8269a6f17f0b693";
|
|
245
242
|
var SubmitChainTransaction = /* @__PURE__ */ __name(() => {
|
|
@@ -250,7 +247,7 @@ var SubmitChainTransaction = /* @__PURE__ */ __name(() => {
|
|
|
250
247
|
if (!network) throw new Error("Network not set");
|
|
251
248
|
const randomAccount = await Account.random();
|
|
252
249
|
const [transactionBoundWitness] = await buildTransaction(chainTx.chain, [], BigInt(`0x${chainTx.gas}`), randomAccount, chainTx.nbf, chainTx.exp, []);
|
|
253
|
-
const insertQuery = new
|
|
250
|
+
const insertQuery = new PayloadBuilder({
|
|
254
251
|
schema: ArchivistInsertQuerySchema
|
|
255
252
|
}).build();
|
|
256
253
|
const [queryBoundWitness] = await new QueryBoundWitnessBuilder().payloads([
|
|
@@ -332,8 +329,8 @@ import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
|
332
329
|
import { FlexGrowCol as FlexGrowCol2, FlexGrowRow, FlexRow } from "@xylabs/react-flexbox";
|
|
333
330
|
import { QuickTipButton } from "@xylabs/react-quick-tip-button";
|
|
334
331
|
import React8, { Fragment, useMemo as useMemo5, useState as useState6 } from "react";
|
|
335
|
-
var TransactionsQuickTipButton = /* @__PURE__ */ __name(({ block,
|
|
336
|
-
const [transactions, transactionsError] = useTxsFromBlock(
|
|
332
|
+
var TransactionsQuickTipButton = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
333
|
+
const [transactions, transactionsError] = useTxsFromBlock(block);
|
|
337
334
|
const [copied, setCopied] = useState6(false);
|
|
338
335
|
const [showError, setShowError] = useState6(false);
|
|
339
336
|
useMemo5(() => transactionsError ? setShowError(true) : setShowError(false), [
|
|
@@ -419,7 +416,7 @@ import { useMemo as useMemo6 } from "react";
|
|
|
419
416
|
var useBlockProducer = /* @__PURE__ */ __name((block) => {
|
|
420
417
|
return useMemo6(() => {
|
|
421
418
|
if (block) {
|
|
422
|
-
const producer = block.addresses[0];
|
|
419
|
+
const producer = block[0].addresses[0];
|
|
423
420
|
return producer;
|
|
424
421
|
}
|
|
425
422
|
}, [
|
|
@@ -428,7 +425,6 @@ var useBlockProducer = /* @__PURE__ */ __name((block) => {
|
|
|
428
425
|
}, "useBlockProducer");
|
|
429
426
|
|
|
430
427
|
// src/components/block/hooks/useDynamicBlockComponents.ts
|
|
431
|
-
import { isBlockBoundWitness } from "@xyo-network/chain-model";
|
|
432
428
|
import { useState as useState8 } from "react";
|
|
433
429
|
|
|
434
430
|
// src/components/block/helpers/blockProducer.ts
|
|
@@ -440,18 +436,17 @@ var blockProducer = /* @__PURE__ */ __name((block) => {
|
|
|
440
436
|
import React9 from "react";
|
|
441
437
|
|
|
442
438
|
// src/components/block/helpers/tsxFromBlock.ts
|
|
443
|
-
import {
|
|
444
|
-
import { PayloadBuilder as
|
|
445
|
-
var txsFromBlock = /* @__PURE__ */ __name(async (
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
return await PayloadBuilder3.hashPairs(transactionPayloads);
|
|
439
|
+
import { isBoundWitness } from "@xyo-network/boundwitness-model";
|
|
440
|
+
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
441
|
+
var txsFromBlock = /* @__PURE__ */ __name(async (block) => {
|
|
442
|
+
const transactionPayloads = block[1].filter((payload) => isBoundWitness(payload));
|
|
443
|
+
return await PayloadBuilder2.hashPairs(transactionPayloads);
|
|
449
444
|
}, "txsFromBlock");
|
|
450
445
|
|
|
451
446
|
// src/components/block/helpers/buildBlockChainRenderComponent.tsx
|
|
452
|
-
var buildBlockChainRenderComponent = /* @__PURE__ */ __name(async (BlockComponent, blockComponentProps
|
|
447
|
+
var buildBlockChainRenderComponent = /* @__PURE__ */ __name(async (BlockComponent, blockComponentProps) => {
|
|
453
448
|
const { block, ...remainingProps } = blockComponentProps;
|
|
454
|
-
const blockTxs = await txsFromBlock(
|
|
449
|
+
const blockTxs = await txsFromBlock(block);
|
|
455
450
|
const txHashes = blockTxs.map(([_, hash]) => hash);
|
|
456
451
|
const item = {
|
|
457
452
|
child: /* @__PURE__ */ React9.createElement(BlockComponent, {
|
|
@@ -459,13 +454,13 @@ var buildBlockChainRenderComponent = /* @__PURE__ */ __name(async (BlockComponen
|
|
|
459
454
|
transactions: txHashes,
|
|
460
455
|
...remainingProps
|
|
461
456
|
}),
|
|
462
|
-
key: block.block.toString(),
|
|
457
|
+
key: block[0].block.toString(),
|
|
463
458
|
block
|
|
464
459
|
};
|
|
465
460
|
return item;
|
|
466
461
|
}, "buildBlockChainRenderComponent");
|
|
467
|
-
var buildBlockHeadingComponent = /* @__PURE__ */ __name(async (blockComponentProps
|
|
468
|
-
return await buildBlockChainRenderComponent(BlockHeadingFlexbox, blockComponentProps
|
|
462
|
+
var buildBlockHeadingComponent = /* @__PURE__ */ __name(async (blockComponentProps) => {
|
|
463
|
+
return await buildBlockChainRenderComponent(BlockHeadingFlexbox, blockComponentProps);
|
|
469
464
|
}, "buildBlockHeadingComponent");
|
|
470
465
|
|
|
471
466
|
// src/components/block/hooks/useDynamicBlockComponents.ts
|
|
@@ -474,13 +469,13 @@ var useDynamicBlockComponents = /* @__PURE__ */ __name((BlockComponent, params,
|
|
|
474
469
|
const [blockChainRenderComponents, setBlockChainRenderComponents] = useState8([]);
|
|
475
470
|
const { onBlock } = useChainAnalyzersContext();
|
|
476
471
|
const onAddBlock = /* @__PURE__ */ __name(async (block) => {
|
|
477
|
-
if (!
|
|
472
|
+
if (!block || !chainArchivist) return;
|
|
478
473
|
const blockComponentProps = {
|
|
479
474
|
block
|
|
480
475
|
};
|
|
481
|
-
const newBlockComponent = await buildBlockChainRenderComponent(BlockComponent, blockComponentProps
|
|
482
|
-
if (block.block !== blockChainRenderComponents[0]?.block.block) {
|
|
483
|
-
void onBlock?.(
|
|
476
|
+
const newBlockComponent = await buildBlockChainRenderComponent(BlockComponent, blockComponentProps);
|
|
477
|
+
if (block?.[0].block !== blockChainRenderComponents[0]?.block?.[0].block) {
|
|
478
|
+
void onBlock?.(block);
|
|
484
479
|
setBlockChainRenderComponents((blockComponents) => {
|
|
485
480
|
const newBlockComponents = [
|
|
486
481
|
newBlockComponent,
|
|
@@ -509,13 +504,13 @@ var useStaticBlockComponents = /* @__PURE__ */ __name((BlockComponent, params, b
|
|
|
509
504
|
const { chainArchivist } = params;
|
|
510
505
|
return await Promise.all(resolvedBlockWithStorage?.map(async (block) => {
|
|
511
506
|
if (onBlock && chainArchivist) {
|
|
512
|
-
await onBlock(
|
|
507
|
+
await onBlock(block);
|
|
513
508
|
}
|
|
514
509
|
const blockComponentProps = {
|
|
515
510
|
block,
|
|
516
511
|
defaultExpanded: true
|
|
517
512
|
};
|
|
518
|
-
return await buildBlockChainRenderComponent(BlockComponent, blockComponentProps
|
|
513
|
+
return await buildBlockChainRenderComponent(BlockComponent, blockComponentProps);
|
|
519
514
|
}));
|
|
520
515
|
}, [
|
|
521
516
|
blocks,
|
|
@@ -530,14 +525,13 @@ var useStaticBlockComponents = /* @__PURE__ */ __name((BlockComponent, params, b
|
|
|
530
525
|
|
|
531
526
|
// src/components/block/hooks/useTxsFromBlock.ts
|
|
532
527
|
import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
533
|
-
var useTxsFromBlock = /* @__PURE__ */ __name((
|
|
528
|
+
var useTxsFromBlock = /* @__PURE__ */ __name((block) => {
|
|
534
529
|
return usePromise2(async () => {
|
|
535
|
-
if (block
|
|
536
|
-
return await txsFromBlock(
|
|
530
|
+
if (block) {
|
|
531
|
+
return await txsFromBlock(block);
|
|
537
532
|
}
|
|
538
533
|
}, [
|
|
539
|
-
block
|
|
540
|
-
chainArchivist
|
|
534
|
+
block
|
|
541
535
|
]);
|
|
542
536
|
}, "useTxsFromBlock");
|
|
543
537
|
|
|
@@ -587,11 +581,11 @@ var BlockMenuExpanded = /* @__PURE__ */ __name(({ block }) => {
|
|
|
587
581
|
},
|
|
588
582
|
onClose: handleClose
|
|
589
583
|
}, /* @__PURE__ */ React11.createElement(BWPreviousHashMenuItem, {
|
|
590
|
-
boundwitness: block,
|
|
584
|
+
boundwitness: block?.[0],
|
|
591
585
|
dense: true,
|
|
592
586
|
onDialogClose: handleClose
|
|
593
587
|
}), /* @__PURE__ */ React11.createElement(BWJsonMenuItem, {
|
|
594
|
-
boundwitness: block,
|
|
588
|
+
boundwitness: block?.[0],
|
|
595
589
|
dense: true,
|
|
596
590
|
onDialogClose: handleClose
|
|
597
591
|
})));
|
|
@@ -603,15 +597,7 @@ import { EthAddress } from "@xylabs/eth-address";
|
|
|
603
597
|
import { BlockiesAvatar } from "@xyo-network/react-chain-blockies";
|
|
604
598
|
import React12, { useMemo as useMemo7 } from "react";
|
|
605
599
|
var BlockProducerChip = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
606
|
-
const
|
|
607
|
-
const blockProducer2 = useMemo7(() => {
|
|
608
|
-
if (block) {
|
|
609
|
-
const producer = block.addresses.find((address) => address !== sharedAddress);
|
|
610
|
-
return producer;
|
|
611
|
-
}
|
|
612
|
-
}, [
|
|
613
|
-
block
|
|
614
|
-
]);
|
|
600
|
+
const blockProducer2 = block?.[0].addresses[0];
|
|
615
601
|
const shortedBlockProducer = blockProducer2 ? EthAddress.parse(blockProducer2)?.toShortString(3) : null;
|
|
616
602
|
const avatar = useMemo7(() => blockProducer2 === "" ? void 0 : /* @__PURE__ */ React12.createElement(BlockiesAvatar, {
|
|
617
603
|
blockiesOptions: {
|
|
@@ -630,7 +616,7 @@ var BlockProducerChip = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
|
630
616
|
|
|
631
617
|
// src/components/block/BlockHeadingFlexbox.tsx
|
|
632
618
|
var BlockHeadingFlexbox = /* @__PURE__ */ __name(({ block, defaultExpanded, transactions }) => {
|
|
633
|
-
const hash = usePayloadHash(block);
|
|
619
|
+
const hash = usePayloadHash(block?.[0]);
|
|
634
620
|
const [blockHeadingRef, blockHeadingListener] = useBlockHeadingEvents();
|
|
635
621
|
const { pollingState } = useChainPollingContext();
|
|
636
622
|
const expanded = pollingState === "paused" || defaultExpanded;
|
|
@@ -645,7 +631,7 @@ var BlockHeadingFlexbox = /* @__PURE__ */ __name(({ block, defaultExpanded, tran
|
|
|
645
631
|
onClick: /* @__PURE__ */ __name(() => blockHeadingListener("block-hash", "click", hash), "onClick")
|
|
646
632
|
}, /* @__PURE__ */ React13.createElement(LinkedDivider, null), /* @__PURE__ */ React13.createElement(HashHeadingPaper, {
|
|
647
633
|
hash,
|
|
648
|
-
heading: block?.block === void 0 ? "" : block.block.toString(),
|
|
634
|
+
heading: block?.[0].block === void 0 ? "" : block?.[0].block.toString(),
|
|
649
635
|
paperProps: {
|
|
650
636
|
sx: {
|
|
651
637
|
p: 1,
|
|
@@ -661,7 +647,7 @@ var BlockHeadingFlexbox = /* @__PURE__ */ __name(({ block, defaultExpanded, tran
|
|
|
661
647
|
transactions
|
|
662
648
|
}), /* @__PURE__ */ React13.createElement(BWVerification, {
|
|
663
649
|
iconColors: true,
|
|
664
|
-
boundwitness: block
|
|
650
|
+
boundwitness: block?.[0]
|
|
665
651
|
}), /* @__PURE__ */ React13.createElement("span", {
|
|
666
652
|
style: {
|
|
667
653
|
// maxWidth is required for css animation to work and 28px is the width of the icon button
|
|
@@ -703,20 +689,20 @@ var useLinkedBlockItem = /* @__PURE__ */ __name((noun, data) => {
|
|
|
703
689
|
|
|
704
690
|
// src/components/block/table/cell/BlockNumber.tsx
|
|
705
691
|
var BlockNumberTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
706
|
-
const [ref, handleClick] = useLinkedBlockItem("block-number", block?.block.toString());
|
|
707
|
-
const blockNumberBigInt = block ? block.block.toString() : "";
|
|
692
|
+
const [ref, handleClick] = useLinkedBlockItem("block-number", block?.[0].block.toString());
|
|
693
|
+
const blockNumberBigInt = block ? block[0].block.toString() : "";
|
|
708
694
|
return /* @__PURE__ */ React14.createElement(TableCell, {
|
|
709
695
|
ref,
|
|
710
696
|
...props
|
|
711
697
|
}, /* @__PURE__ */ React14.createElement(Tooltip, {
|
|
712
698
|
title: `Block Number: ${blockNumberBigInt}`
|
|
713
699
|
}, /* @__PURE__ */ React14.createElement("span", null, linked && block ? /* @__PURE__ */ React14.createElement(Link, {
|
|
714
|
-
title: block.block.toString(),
|
|
700
|
+
title: block[0].block.toString(),
|
|
715
701
|
onClick: handleClick,
|
|
716
702
|
sx: {
|
|
717
703
|
cursor: "pointer"
|
|
718
704
|
}
|
|
719
|
-
}, block.block.toString()) : null, !linked && blockNumberBigInt)));
|
|
705
|
+
}, block[0].block.toString()) : null, !linked && blockNumberBigInt)));
|
|
720
706
|
}, "BlockNumberTableCell");
|
|
721
707
|
|
|
722
708
|
// src/components/block/table/cell/Hash.tsx
|
|
@@ -725,7 +711,7 @@ import { Identicon } from "@xylabs/react-identicon";
|
|
|
725
711
|
import { usePayloadHash as usePayloadHash2 } from "@xyo-network/react-shared";
|
|
726
712
|
import React15 from "react";
|
|
727
713
|
var BlockHashTableCell = /* @__PURE__ */ __name(({ block, identiconProps, linked, ...props }) => {
|
|
728
|
-
const hash = usePayloadHash2(block);
|
|
714
|
+
const hash = usePayloadHash2(block?.[0]);
|
|
729
715
|
const [ref, handleClick] = useLinkedBlockItem("block-hash", hash);
|
|
730
716
|
const shortenedHash = hash ? `${hash.slice(0, 4)}...${hash.slice(-5, -1)}` : "";
|
|
731
717
|
return /* @__PURE__ */ React15.createElement(TableCell2, {
|
|
@@ -759,7 +745,7 @@ import React16, { useState as useState9 } from "react";
|
|
|
759
745
|
var BlockJsonViewTableCell = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
760
746
|
const [open, setOpen] = useState9(false);
|
|
761
747
|
const onClose = /* @__PURE__ */ __name(() => setOpen(false), "onClose");
|
|
762
|
-
const hash = usePayloadHash3(block);
|
|
748
|
+
const hash = usePayloadHash3(block?.[0]);
|
|
763
749
|
const title = hash ? `JSON for ${ellipsize(hash, 5)}` : "JSON";
|
|
764
750
|
return /* @__PURE__ */ React16.createElement(TableCell3, props, /* @__PURE__ */ React16.createElement(FlexRow3, {
|
|
765
751
|
sx: {
|
|
@@ -811,8 +797,8 @@ var BlockProducerTableCell = /* @__PURE__ */ __name(({ block, linked, producerCh
|
|
|
811
797
|
import { Error as Error2 } from "@mui/icons-material";
|
|
812
798
|
import { Link as Link2, TableCell as TableCell5, Tooltip as Tooltip4 } from "@mui/material";
|
|
813
799
|
import React18 from "react";
|
|
814
|
-
var BlockTransactionCountTableCell = /* @__PURE__ */ __name(({ block,
|
|
815
|
-
const [txs, error] = useTxsFromBlock(
|
|
800
|
+
var BlockTransactionCountTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
801
|
+
const [txs, error] = useTxsFromBlock(block);
|
|
816
802
|
const [ref, handleClick] = useLinkedBlockItem("transaction-count", JSON.stringify(txs ?? null));
|
|
817
803
|
return /* @__PURE__ */ React18.createElement(TableCell5, {
|
|
818
804
|
ref,
|
|
@@ -835,7 +821,7 @@ import { FlexRow as FlexRow5 } from "@xylabs/react-flexbox";
|
|
|
835
821
|
import { BWVerification as BWVerification2 } from "@xyo-network/react-chain-boundwitness";
|
|
836
822
|
import React19 from "react";
|
|
837
823
|
var BlockVerificationTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
838
|
-
const [ref, handleClick] = useLinkedBlockItem("block-verification", block?.block.toString());
|
|
824
|
+
const [ref, handleClick] = useLinkedBlockItem("block-verification", block?.[0].block.toString());
|
|
839
825
|
return /* @__PURE__ */ React19.createElement(TableCell6, {
|
|
840
826
|
ref,
|
|
841
827
|
...props
|
|
@@ -846,31 +832,40 @@ var BlockVerificationTableCell = /* @__PURE__ */ __name(({ block, linked, ...pro
|
|
|
846
832
|
}, /* @__PURE__ */ React19.createElement(BWVerification2, {
|
|
847
833
|
onClick: linked ? handleClick : void 0,
|
|
848
834
|
iconColors: true,
|
|
849
|
-
boundwitness: block
|
|
835
|
+
boundwitness: block?.[0]
|
|
850
836
|
})));
|
|
851
837
|
}, "BlockVerificationTableCell");
|
|
852
838
|
|
|
853
839
|
// src/components/block/table/Ex.tsx
|
|
854
|
-
import { TableBody
|
|
840
|
+
import { TableBody } from "@mui/material";
|
|
855
841
|
import { TableEx } from "@xyo-network/react-table";
|
|
842
|
+
import React21 from "react";
|
|
843
|
+
|
|
844
|
+
// src/components/block/table/head/TableHead.tsx
|
|
845
|
+
import { TableCell as TableCell7, TableHead, TableRow } from "@mui/material";
|
|
856
846
|
import React20 from "react";
|
|
857
|
-
var
|
|
858
|
-
return /* @__PURE__ */ React20.createElement(
|
|
859
|
-
ref,
|
|
860
|
-
...props
|
|
861
|
-
}, /* @__PURE__ */ React20.createElement(TableHead, null, /* @__PURE__ */ React20.createElement(TableRow, null, /* @__PURE__ */ React20.createElement(TableCell7, null, "Block Hash"), /* @__PURE__ */ React20.createElement(TableCell7, null, "Block Number"), /* @__PURE__ */ React20.createElement(TableCell7, null, "Transaction Count"), /* @__PURE__ */ React20.createElement(TableCell7, {
|
|
847
|
+
var BlockchainTableHead = /* @__PURE__ */ __name(() => {
|
|
848
|
+
return /* @__PURE__ */ React20.createElement(TableHead, null, /* @__PURE__ */ React20.createElement(TableRow, null, /* @__PURE__ */ React20.createElement(TableCell7, null, "Block Hash"), /* @__PURE__ */ React20.createElement(TableCell7, null, "Block Number"), /* @__PURE__ */ React20.createElement(TableCell7, null, "Transaction Count"), /* @__PURE__ */ React20.createElement(TableCell7, {
|
|
862
849
|
align: "center"
|
|
863
850
|
}, "Block Producer"), /* @__PURE__ */ React20.createElement(TableCell7, {
|
|
864
851
|
align: "center"
|
|
865
852
|
}, "Valid"), /* @__PURE__ */ React20.createElement(TableCell7, {
|
|
866
853
|
align: "center"
|
|
867
|
-
}, "JSON")))
|
|
854
|
+
}, "JSON")));
|
|
855
|
+
}, "BlockchainTableHead");
|
|
856
|
+
|
|
857
|
+
// src/components/block/table/Ex.tsx
|
|
858
|
+
var BlockchainTableEx = /* @__PURE__ */ __name(({ ref, children, ...props }) => {
|
|
859
|
+
return /* @__PURE__ */ React21.createElement(TableEx, {
|
|
860
|
+
ref,
|
|
861
|
+
...props
|
|
862
|
+
}, /* @__PURE__ */ React21.createElement(BlockchainTableHead, null), /* @__PURE__ */ React21.createElement(TableBody, null, children));
|
|
868
863
|
}, "BlockchainTableEx");
|
|
869
864
|
BlockchainTableEx.displayName = "BlockchainTableEx";
|
|
870
865
|
|
|
871
866
|
// src/components/block/table/row/TableRow.tsx
|
|
872
867
|
import { TableRow as TableRow2 } from "@mui/material";
|
|
873
|
-
import
|
|
868
|
+
import React22, { useMemo as useMemo8 } from "react";
|
|
874
869
|
var BlockChainTableRow = /* @__PURE__ */ __name(({
|
|
875
870
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
876
871
|
block,
|
|
@@ -890,36 +885,36 @@ var BlockChainTableRow = /* @__PURE__ */ __name(({
|
|
|
890
885
|
}), [
|
|
891
886
|
block
|
|
892
887
|
]);
|
|
893
|
-
return /* @__PURE__ */
|
|
888
|
+
return /* @__PURE__ */ React22.createElement(TableRow2, props, /* @__PURE__ */ React22.createElement(BlockHashTableCell, defaultTableCellProps), /* @__PURE__ */ React22.createElement(BlockNumberTableCell, linkedTableCellProps), /* @__PURE__ */ React22.createElement(BlockTransactionCountTableCell, linkedTableCellProps), /* @__PURE__ */ React22.createElement(BlockProducerTableCell, defaultTableCellProps), /* @__PURE__ */ React22.createElement(BlockVerificationTableCell, defaultTableCellProps), /* @__PURE__ */ React22.createElement(BlockJsonViewTableCell, defaultTableCellProps));
|
|
894
889
|
}, "BlockChainTableRow");
|
|
895
890
|
|
|
896
891
|
// src/components/chain/controls/PollingControlsFlexbox.tsx
|
|
897
892
|
import { Autorenew, Pause } from "@mui/icons-material";
|
|
898
893
|
import { Alert as Alert3, AlertTitle as AlertTitle2, Grow, Icon as Icon2, IconButton as IconButton4, Tooltip as Tooltip5 } from "@mui/material";
|
|
899
894
|
import { FlexRow as FlexRow6 } from "@xylabs/react-flexbox";
|
|
900
|
-
import
|
|
895
|
+
import React27, { memo } from "react";
|
|
901
896
|
|
|
902
897
|
// src/components/chain/stats/Dialog.tsx
|
|
903
898
|
import { QueryStats } from "@mui/icons-material";
|
|
904
899
|
import { Dialog as Dialog2, DialogContent as DialogContent2, DialogTitle as DialogTitle2, IconButton as IconButton3 } from "@mui/material";
|
|
905
|
-
import
|
|
900
|
+
import React25, { useState as useState10 } from "react";
|
|
906
901
|
|
|
907
902
|
// src/components/chain/stats/producer/ProducerFlexbox.tsx
|
|
908
903
|
import { ListItem, styled, Typography as Typography3 } from "@mui/material";
|
|
909
904
|
import { ErrorRender as ErrorRender3 } from "@xylabs/react-error";
|
|
910
905
|
import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
|
|
911
906
|
import { isChainSummaryProducers } from "@xyo-network/chain-protocol";
|
|
912
|
-
import
|
|
907
|
+
import React24, { useMemo as useMemo9 } from "react";
|
|
913
908
|
|
|
914
909
|
// src/components/chain/stats/producer/Table.tsx
|
|
915
910
|
import { Table, TableBody as TableBody2, TableCell as TableCell8, TableHead as TableHead2, TableRow as TableRow3, useTheme } from "@mui/material";
|
|
916
911
|
import { BlockiesAvatar as BlockiesAvatar2 } from "@xyo-network/react-chain-blockies";
|
|
917
|
-
import
|
|
912
|
+
import React23 from "react";
|
|
918
913
|
var ChainProducerStatsTable = /* @__PURE__ */ __name(({ producers, ...props }) => {
|
|
919
914
|
const theme = useTheme();
|
|
920
|
-
return /* @__PURE__ */
|
|
915
|
+
return /* @__PURE__ */ React23.createElement(Table, props, /* @__PURE__ */ React23.createElement(TableHead2, null, /* @__PURE__ */ React23.createElement(TableRow3, null, /* @__PURE__ */ React23.createElement(TableCell8, null, "Address"), /* @__PURE__ */ React23.createElement(TableCell8, null, "Blocks Produced"), /* @__PURE__ */ React23.createElement(TableCell8, null, "Rewards Earned Produced"))), /* @__PURE__ */ React23.createElement(TableBody2, null, producers?.map((producer) => /* @__PURE__ */ React23.createElement(TableRow3, {
|
|
921
916
|
key: producer.address
|
|
922
|
-
}, /* @__PURE__ */
|
|
917
|
+
}, /* @__PURE__ */ React23.createElement(TableCell8, null, /* @__PURE__ */ React23.createElement(BlockiesAvatar2, {
|
|
923
918
|
blockiesOptions: {
|
|
924
919
|
seed: producer.address
|
|
925
920
|
},
|
|
@@ -927,7 +922,7 @@ var ChainProducerStatsTable = /* @__PURE__ */ __name(({ producers, ...props }) =
|
|
|
927
922
|
height: theme.spacing(2.75),
|
|
928
923
|
width: theme.spacing(2.75)
|
|
929
924
|
}
|
|
930
|
-
})), /* @__PURE__ */
|
|
925
|
+
})), /* @__PURE__ */ React23.createElement(TableCell8, null, producer.blocksProduced.toString()), /* @__PURE__ */ React23.createElement(TableCell8, null, producer.rewardsEarned.toString())))));
|
|
931
926
|
}, "ChainProducerStatsTable");
|
|
932
927
|
|
|
933
928
|
// src/components/chain/stats/producer/ProducerFlexbox.tsx
|
|
@@ -949,16 +944,16 @@ var BlockProducerStatsFlexbox = /* @__PURE__ */ __name(({ payload, ...props }) =
|
|
|
949
944
|
const producersArray = useMemo9(() => Object.values(producer?.producers ?? {}), [
|
|
950
945
|
producer
|
|
951
946
|
]);
|
|
952
|
-
return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ React24.createElement(FlexCol3, {
|
|
953
948
|
alignItems: "start",
|
|
954
949
|
gap: 1,
|
|
955
950
|
...props
|
|
956
|
-
}, /* @__PURE__ */
|
|
951
|
+
}, /* @__PURE__ */ React24.createElement(ErrorRender3, {
|
|
957
952
|
error: producerError,
|
|
958
953
|
scope: "BlockProducerStatsFlexbox"
|
|
959
|
-
}), /* @__PURE__ */
|
|
954
|
+
}), /* @__PURE__ */ React24.createElement(Typography3, {
|
|
960
955
|
fontSize: "1rem"
|
|
961
|
-
}, "Block Producers"), /* @__PURE__ */
|
|
956
|
+
}, "Block Producers"), /* @__PURE__ */ React24.createElement(ChainProducerStatsTable, {
|
|
962
957
|
producers: producersArray
|
|
963
958
|
}));
|
|
964
959
|
}, "BlockProducerStatsFlexbox");
|
|
@@ -970,18 +965,18 @@ var StyledListItem = styled(ListItem)(() => ({
|
|
|
970
965
|
// src/components/chain/stats/Dialog.tsx
|
|
971
966
|
var ChainAnalyzerStatsDialog = /* @__PURE__ */ __name((props) => {
|
|
972
967
|
const { analyzers, statsUpdated } = useChainAnalyzersContext();
|
|
973
|
-
return /* @__PURE__ */
|
|
968
|
+
return /* @__PURE__ */ React25.createElement(Dialog2, props, /* @__PURE__ */ React25.createElement(DialogTitle2, null, "Chain Analysis"), /* @__PURE__ */ React25.createElement(DialogContent2, null, !!statsUpdated && Object.entries(analyzers).map(([id2, analyzer]) => /* @__PURE__ */ React25.createElement("div", {
|
|
974
969
|
key: id2
|
|
975
|
-
}, id2 === "producers" && /* @__PURE__ */
|
|
970
|
+
}, id2 === "producers" && /* @__PURE__ */ React25.createElement(BlockProducerStatsFlexbox, {
|
|
976
971
|
payload: analyzer.result()
|
|
977
972
|
})))));
|
|
978
973
|
}, "ChainAnalyzerStatsDialog");
|
|
979
974
|
var ChainAnalyzerStatsDialogFromContext = /* @__PURE__ */ __name((props) => {
|
|
980
975
|
const [open, setOpen] = useState10(false);
|
|
981
976
|
const handleClose = /* @__PURE__ */ __name(() => setOpen(false), "handleClose");
|
|
982
|
-
return /* @__PURE__ */
|
|
977
|
+
return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(IconButton3, {
|
|
983
978
|
onClick: /* @__PURE__ */ __name(() => setOpen(true), "onClick")
|
|
984
|
-
}, /* @__PURE__ */
|
|
979
|
+
}, /* @__PURE__ */ React25.createElement(QueryStats, null)), /* @__PURE__ */ React25.createElement(ChainAnalyzerStatsDialog, {
|
|
985
980
|
onClose: handleClose,
|
|
986
981
|
open,
|
|
987
982
|
...props
|
|
@@ -990,19 +985,19 @@ var ChainAnalyzerStatsDialogFromContext = /* @__PURE__ */ __name((props) => {
|
|
|
990
985
|
|
|
991
986
|
// src/components/chain/controls/PulseSvgIcon.tsx
|
|
992
987
|
import { alpha, createSvgIcon, keyframes, styled as styled2 } from "@mui/material";
|
|
993
|
-
import
|
|
994
|
-
var PulseSvgIcon = createSvgIcon(/* @__PURE__ */
|
|
988
|
+
import React26 from "react";
|
|
989
|
+
var PulseSvgIcon = createSvgIcon(/* @__PURE__ */ React26.createElement("svg", {
|
|
995
990
|
viewBox: "0 0 80 80",
|
|
996
991
|
version: "1.1",
|
|
997
992
|
xmlns: "http://www.w3.org/2000/svg"
|
|
998
|
-
}, /* @__PURE__ */
|
|
993
|
+
}, /* @__PURE__ */ React26.createElement("g", {
|
|
999
994
|
transform: "translate(34,34)"
|
|
1000
|
-
}, /* @__PURE__ */
|
|
995
|
+
}, /* @__PURE__ */ React26.createElement("circle", {
|
|
1001
996
|
className: "core",
|
|
1002
997
|
cx: "0",
|
|
1003
998
|
cy: "0",
|
|
1004
999
|
r: "6"
|
|
1005
|
-
}), /* @__PURE__ */
|
|
1000
|
+
}), /* @__PURE__ */ React26.createElement("circle", {
|
|
1006
1001
|
className: "radar",
|
|
1007
1002
|
cx: "0",
|
|
1008
1003
|
cy: "0",
|
|
@@ -1066,24 +1061,24 @@ var StyledPulseSvgIcon = styled2(PulseSvgIcon)(({ theme }) => {
|
|
|
1066
1061
|
var PollingControlsFlexbox = /* @__PURE__ */ __name(({ blocksBehind, pollingState, setPollingState }) => {
|
|
1067
1062
|
const paused = pollingState === "paused";
|
|
1068
1063
|
const running = pollingState === "running";
|
|
1069
|
-
return /* @__PURE__ */
|
|
1064
|
+
return /* @__PURE__ */ React27.createElement(FlexRow6, {
|
|
1070
1065
|
justifyContent: "space-between",
|
|
1071
1066
|
width: "100%"
|
|
1072
|
-
}, /* @__PURE__ */
|
|
1067
|
+
}, /* @__PURE__ */ React27.createElement(FlexRow6, {
|
|
1073
1068
|
gap: 2
|
|
1074
|
-
}, running && /* @__PURE__ */
|
|
1069
|
+
}, running && /* @__PURE__ */ React27.createElement(IconButton4, {
|
|
1075
1070
|
onClick: /* @__PURE__ */ __name(() => setPollingState?.("paused"), "onClick"),
|
|
1076
1071
|
title: "Pause Block Stream"
|
|
1077
|
-
}, /* @__PURE__ */
|
|
1072
|
+
}, /* @__PURE__ */ React27.createElement(Pause, null)), paused && /* @__PURE__ */ React27.createElement(IconButton4, {
|
|
1078
1073
|
onClick: /* @__PURE__ */ __name(() => setPollingState?.("running"), "onClick"),
|
|
1079
1074
|
title: "Re-Sync Block Stream"
|
|
1080
|
-
}, /* @__PURE__ */
|
|
1075
|
+
}, /* @__PURE__ */ React27.createElement(Autorenew, null)), /* @__PURE__ */ React27.createElement(ChainAnalyzerStatsDialogFromContext, null)), /* @__PURE__ */ React27.createElement(FlexRow6, {
|
|
1081
1076
|
gap: 2
|
|
1082
|
-
}, /* @__PURE__ */
|
|
1077
|
+
}, /* @__PURE__ */ React27.createElement(Grow, {
|
|
1083
1078
|
in: (blocksBehind ?? 0) > 0
|
|
1084
|
-
}, /* @__PURE__ */
|
|
1079
|
+
}, /* @__PURE__ */ React27.createElement(Tooltip5, {
|
|
1085
1080
|
title: "Click to Re-Sync"
|
|
1086
|
-
}, /* @__PURE__ */
|
|
1081
|
+
}, /* @__PURE__ */ React27.createElement(Alert3, {
|
|
1087
1082
|
sx: {
|
|
1088
1083
|
py: 0,
|
|
1089
1084
|
px: 1,
|
|
@@ -1091,11 +1086,11 @@ var PollingControlsFlexbox = /* @__PURE__ */ __name(({ blocksBehind, pollingStat
|
|
|
1091
1086
|
},
|
|
1092
1087
|
severity: "warning",
|
|
1093
1088
|
onClick: /* @__PURE__ */ __name(() => setPollingState?.("running"), "onClick")
|
|
1094
|
-
}, /* @__PURE__ */
|
|
1089
|
+
}, /* @__PURE__ */ React27.createElement(AlertTitle2, {
|
|
1095
1090
|
sx: {
|
|
1096
1091
|
mb: 0
|
|
1097
1092
|
}
|
|
1098
|
-
}, "Behind:", " ", blocksBehind)))), /* @__PURE__ */
|
|
1093
|
+
}, "Behind:", " ", blocksBehind)))), /* @__PURE__ */ React27.createElement(Icon2, null, /* @__PURE__ */ React27.createElement(StyledPulseSvgIcon, {
|
|
1099
1094
|
className: running ? "" : "paused"
|
|
1100
1095
|
}))));
|
|
1101
1096
|
}, "PollingControlsFlexbox");
|
|
@@ -1103,9 +1098,9 @@ var MemoizedPollingControlsFlexbox = /* @__PURE__ */ memo(PollingControlsFlexbox
|
|
|
1103
1098
|
|
|
1104
1099
|
// src/components/chain/dialog/Dialog.tsx
|
|
1105
1100
|
import { Button as Button3, Dialog as Dialog3, DialogActions as DialogActions2, DialogContent as DialogContent3 } from "@mui/material";
|
|
1106
|
-
import
|
|
1101
|
+
import React28 from "react";
|
|
1107
1102
|
var TransactionsDialog = /* @__PURE__ */ __name((props) => {
|
|
1108
|
-
return /* @__PURE__ */
|
|
1103
|
+
return /* @__PURE__ */ React28.createElement(Dialog3, props, /* @__PURE__ */ React28.createElement(DialogContent3, null, "Transactions Dialog"), /* @__PURE__ */ React28.createElement(DialogActions2, null, /* @__PURE__ */ React28.createElement(Button3, {
|
|
1109
1104
|
variant: "outlined",
|
|
1110
1105
|
onClick: /* @__PURE__ */ __name((e) => props?.onClose?.(e, "escapeKeyDown"), "onClick")
|
|
1111
1106
|
}, "Close")));
|
|
@@ -1117,10 +1112,13 @@ var useOnBlock = /* @__PURE__ */ __name((initialHeadNumber, onAddBlock, liveHead
|
|
|
1117
1112
|
const blocksWhilePaused = useRef2([]);
|
|
1118
1113
|
const lastLiveHead = useRef2(liveHead);
|
|
1119
1114
|
useEffect(() => {
|
|
1120
|
-
|
|
1115
|
+
const lastLiveHeadBlock = lastLiveHead.current?.[0];
|
|
1116
|
+
const blocksWhilePausedBlock = lastLiveHead.current?.[0];
|
|
1117
|
+
const liveHeadBlock = liveHead?.[0];
|
|
1118
|
+
if (lastLiveHeadBlock?.block === liveHeadBlock?.block) return;
|
|
1121
1119
|
if (liveHead && onAddBlock) {
|
|
1122
1120
|
lastLiveHead.current = liveHead;
|
|
1123
|
-
const isNewBlock = initialHeadNumber !==
|
|
1121
|
+
const isNewBlock = initialHeadNumber !== liveHeadBlock?.block && liveHeadBlock?.block !== blocksWhilePausedBlock?.block;
|
|
1124
1122
|
if (pollingState === "paused" && isNewBlock) {
|
|
1125
1123
|
blocksWhilePaused.current.push(liveHead);
|
|
1126
1124
|
} else if (pollingState === "running") {
|
|
@@ -1142,9 +1140,9 @@ var useOnBlock = /* @__PURE__ */ __name((initialHeadNumber, onAddBlock, liveHead
|
|
|
1142
1140
|
|
|
1143
1141
|
// src/components/chain/pagination/BlockChainPagination.tsx
|
|
1144
1142
|
import { TablePaginationActions } from "@xyo-network/react-payload-table";
|
|
1145
|
-
import
|
|
1143
|
+
import React29 from "react";
|
|
1146
1144
|
var BlockChainPagination = /* @__PURE__ */ __name(({ count = 0, onPageChange, page, rowsPerPage = 10 }) => {
|
|
1147
|
-
return /* @__PURE__ */
|
|
1145
|
+
return /* @__PURE__ */ React29.createElement(TablePaginationActions, {
|
|
1148
1146
|
count,
|
|
1149
1147
|
onPageChange,
|
|
1150
1148
|
page,
|
|
@@ -1175,15 +1173,14 @@ var useChainPagination = /* @__PURE__ */ __name((pageSize, blockComponents) => {
|
|
|
1175
1173
|
};
|
|
1176
1174
|
}, "useChainPagination");
|
|
1177
1175
|
|
|
1178
|
-
// src/components/chain/render/dynamic/flexbox/
|
|
1176
|
+
// src/components/chain/render/dynamic/flexbox/variants/Base.tsx
|
|
1179
1177
|
import { ErrorRender as ErrorRender4 } from "@xylabs/react-error";
|
|
1180
1178
|
import { FlexCol as FlexCol5 } from "@xylabs/react-flexbox";
|
|
1181
|
-
import
|
|
1182
|
-
import React30, { useMemo as useMemo14 } from "react";
|
|
1179
|
+
import React31 from "react";
|
|
1183
1180
|
|
|
1184
1181
|
// src/components/chain/list/Animated.tsx
|
|
1185
1182
|
import { AnimatedList } from "@xylabs/react-animation";
|
|
1186
|
-
import
|
|
1183
|
+
import React30 from "react";
|
|
1187
1184
|
|
|
1188
1185
|
// src/components/chain/styled/BlockListWrapperFlexbox.tsx
|
|
1189
1186
|
import { styled as styled3 } from "@mui/material";
|
|
@@ -1204,10 +1201,10 @@ var BlockListWrapperFlexBox = styled3(FlexCol4, {
|
|
|
1204
1201
|
|
|
1205
1202
|
// src/components/chain/list/Animated.tsx
|
|
1206
1203
|
var BlockListAnimated = /* @__PURE__ */ __name(({ blockChainRenderComponents }) => {
|
|
1207
|
-
return /* @__PURE__ */
|
|
1204
|
+
return /* @__PURE__ */ React30.createElement(BlockListWrapperFlexBox, {
|
|
1208
1205
|
alignItems: "stretch",
|
|
1209
1206
|
width: "100%"
|
|
1210
|
-
}, /* @__PURE__ */
|
|
1207
|
+
}, /* @__PURE__ */ React30.createElement(AnimatedList, {
|
|
1211
1208
|
fullWidth: true,
|
|
1212
1209
|
items: blockChainRenderComponents
|
|
1213
1210
|
}));
|
|
@@ -1218,7 +1215,9 @@ import { useMemo as useMemo12 } from "react";
|
|
|
1218
1215
|
|
|
1219
1216
|
// src/hooks/chain-iterator/ChainIteratorStore.ts
|
|
1220
1217
|
import { assertEx } from "@xylabs/assert";
|
|
1218
|
+
import { hydrateBlock } from "@xyo-network/chain-protocol";
|
|
1221
1219
|
import { XyoChainBlockNumberIterator } from "@xyo-network/chain-services";
|
|
1220
|
+
import { PayloadBuilder as PayloadBuilder3 } from "@xyo-network/payload-builder";
|
|
1222
1221
|
var ChainIteratorStore = class _ChainIteratorStore {
|
|
1223
1222
|
static {
|
|
1224
1223
|
__name(this, "ChainIteratorStore");
|
|
@@ -1237,14 +1236,17 @@ var ChainIteratorStore = class _ChainIteratorStore {
|
|
|
1237
1236
|
const instance = new _ChainIteratorStore();
|
|
1238
1237
|
const chainIterator = await XyoChainBlockNumberIterator.create(params);
|
|
1239
1238
|
instance._chainIterator = chainIterator;
|
|
1239
|
+
const head = await chainIterator.head();
|
|
1240
|
+
const hydratedHead = await hydrateBlock(params.chainArchivist, await PayloadBuilder3.hash(head));
|
|
1240
1241
|
instance._values = {
|
|
1241
1242
|
chainIterator,
|
|
1242
|
-
head:
|
|
1243
|
+
head: hydratedHead
|
|
1243
1244
|
};
|
|
1244
|
-
const headUpdatedListener = /* @__PURE__ */ __name(({ blocks }) => {
|
|
1245
|
+
const headUpdatedListener = /* @__PURE__ */ __name(async ({ blocks }) => {
|
|
1246
|
+
const hydratedBlock = await hydrateBlock(params.chainArchivist, await PayloadBuilder3.hash(blocks?.[0]));
|
|
1245
1247
|
instance._values = {
|
|
1246
1248
|
chainIterator,
|
|
1247
|
-
head:
|
|
1249
|
+
head: hydratedBlock
|
|
1248
1250
|
};
|
|
1249
1251
|
instance.emitChange();
|
|
1250
1252
|
}, "headUpdatedListener");
|
|
@@ -1279,7 +1281,7 @@ var ChainIteratorStore = class _ChainIteratorStore {
|
|
|
1279
1281
|
import { assertEx as assertEx2 } from "@xylabs/assert";
|
|
1280
1282
|
import { usePromise as usePromise3 } from "@xylabs/react-promise";
|
|
1281
1283
|
import { BoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
1282
|
-
import { isBlockBoundWitness
|
|
1284
|
+
import { isBlockBoundWitness } from "@xyo-network/chain-model";
|
|
1283
1285
|
var resolveDefinedHead = /* @__PURE__ */ __name(async (head, chainArchivist) => {
|
|
1284
1286
|
const [headPayload] = await chainArchivist.get([
|
|
1285
1287
|
head
|
|
@@ -1288,7 +1290,7 @@ var resolveDefinedHead = /* @__PURE__ */ __name(async (head, chainArchivist) =>
|
|
|
1288
1290
|
const [currentHead] = await new BoundWitnessBuilder().build();
|
|
1289
1291
|
return currentHead;
|
|
1290
1292
|
} else {
|
|
1291
|
-
return assertEx2(
|
|
1293
|
+
return assertEx2(isBlockBoundWitness(headPayload) ? headPayload : void 0, () => `Expected a block bound witness: ${JSON.stringify(headPayload)}`);
|
|
1292
1294
|
}
|
|
1293
1295
|
}, "resolveDefinedHead");
|
|
1294
1296
|
var useChainIteratorParams = /* @__PURE__ */ __name(({ chainArchivist, chainInformation, head }) => {
|
|
@@ -1298,7 +1300,7 @@ var useChainIteratorParams = /* @__PURE__ */ __name(({ chainArchivist, chainInfo
|
|
|
1298
1300
|
head
|
|
1299
1301
|
]);
|
|
1300
1302
|
const foundResult = assertEx2(result, () => `Head not found: ${head}`);
|
|
1301
|
-
const resolvedHead = assertEx2(
|
|
1303
|
+
const resolvedHead = assertEx2(isBlockBoundWitness(foundResult) ? foundResult : void 0, () => `Head is not a boundwitness: ${JSON.stringify(foundResult)}`);
|
|
1302
1304
|
return {
|
|
1303
1305
|
chainArchivist,
|
|
1304
1306
|
chainInformation,
|
|
@@ -1391,7 +1393,8 @@ var useChainIteratorStore = /* @__PURE__ */ __name((chainIteratorParams) => {
|
|
|
1391
1393
|
error
|
|
1392
1394
|
};
|
|
1393
1395
|
const noCachedValue = cachedSnapshot.current.chainIterator === void 0;
|
|
1394
|
-
const
|
|
1396
|
+
const cachedBlock = cachedSnapshot.current?.head?.[0]?.block;
|
|
1397
|
+
const newBlock = cachedBlock !== newValues.head?.[0]?.block;
|
|
1395
1398
|
if (noCachedValue || newBlock) {
|
|
1396
1399
|
cachedSnapshot.current = newValues;
|
|
1397
1400
|
return newValues;
|
|
@@ -1415,29 +1418,37 @@ var useChainIteratorStore = /* @__PURE__ */ __name((chainIteratorParams) => {
|
|
|
1415
1418
|
// src/hooks/useIterateChain.ts
|
|
1416
1419
|
import { assertEx as assertEx3 } from "@xylabs/assert";
|
|
1417
1420
|
import { usePromise as usePromise5 } from "@xylabs/react-promise";
|
|
1418
|
-
import { isBlockBoundWitness as
|
|
1421
|
+
import { isBlockBoundWitness as isBlockBoundWitness2 } from "@xyo-network/chain-model";
|
|
1422
|
+
import { hydrateBlock as hydrateBlock2 } from "@xyo-network/chain-protocol";
|
|
1419
1423
|
import { XyoChainBlockNumberIterator as XyoChainBlockNumberIterator2 } from "@xyo-network/chain-services";
|
|
1424
|
+
import { PayloadBuilder as PayloadBuilder4 } from "@xyo-network/payload-builder";
|
|
1425
|
+
var getHydratedBlock = /* @__PURE__ */ __name(async (chainArchivist, head) => {
|
|
1426
|
+
const headHash = await PayloadBuilder4.hash(head);
|
|
1427
|
+
return await hydrateBlock2(chainArchivist, headHash);
|
|
1428
|
+
}, "getHydratedBlock");
|
|
1420
1429
|
var iterateChain = /* @__PURE__ */ __name(async (chainIteratorParams, maxDepth) => {
|
|
1421
1430
|
const { chainArchivist, head } = chainIteratorParams ?? {};
|
|
1422
1431
|
if (chainArchivist && head) {
|
|
1423
|
-
const headPayload = assertEx3(
|
|
1424
|
-
const headBlockBoundWitness = assertEx3(
|
|
1432
|
+
const headPayload = assertEx3(isBlockBoundWitness2(head) ? head : null, () => "Head is not a Block Bound Witness");
|
|
1433
|
+
const headBlockBoundWitness = assertEx3(isBlockBoundWitness2(headPayload) ? headPayload : null, () => "Invalid head block");
|
|
1425
1434
|
const chainIterator = await XyoChainBlockNumberIterator2.create({
|
|
1426
1435
|
head: headBlockBoundWitness,
|
|
1427
1436
|
chainArchivist
|
|
1428
1437
|
});
|
|
1429
|
-
|
|
1438
|
+
const chainHead = await chainIterator.head();
|
|
1439
|
+
let block = await getHydratedBlock(chainArchivist, chainHead);
|
|
1430
1440
|
const blocks = [
|
|
1431
1441
|
block
|
|
1432
1442
|
];
|
|
1433
1443
|
let depth = 1;
|
|
1434
1444
|
while (block) {
|
|
1435
|
-
const [, next] = await chainIterator.previous(block.block, 2);
|
|
1445
|
+
const [, next] = await chainIterator.previous(block[0].block, 2);
|
|
1436
1446
|
if (!next) break;
|
|
1437
|
-
|
|
1438
|
-
|
|
1447
|
+
const nextHydratedBlock = await getHydratedBlock(chainArchivist, next);
|
|
1448
|
+
blocks.push(nextHydratedBlock);
|
|
1449
|
+
block = nextHydratedBlock;
|
|
1439
1450
|
depth++;
|
|
1440
|
-
if (maxDepth && depth >= maxDepth || block?.block === 0) break;
|
|
1451
|
+
if (maxDepth && depth >= maxDepth || block?.[0].block === 0) break;
|
|
1441
1452
|
}
|
|
1442
1453
|
return blocks;
|
|
1443
1454
|
}
|
|
@@ -1461,7 +1472,7 @@ var useDynamicBlockRenderComponents = /* @__PURE__ */ __name((BlockComponent, bl
|
|
|
1461
1472
|
const { blockChainRenderComponents, onAddBlock } = useDynamicBlockComponents(BlockComponent, params, maxBlocks);
|
|
1462
1473
|
const { head: liveHead } = useChainIteratorStore(params);
|
|
1463
1474
|
const { pollingState, updatePollingState } = useChainPollingContext();
|
|
1464
|
-
const blocksWhilePaused = useOnBlock(blockChainRenderComponents[0]?.block.block, onAddBlock, liveHead, pollingState);
|
|
1475
|
+
const blocksWhilePaused = useOnBlock(blockChainRenderComponents[0]?.block?.[0].block, onAddBlock, liveHead, pollingState);
|
|
1465
1476
|
return {
|
|
1466
1477
|
errors: [
|
|
1467
1478
|
paramsError
|
|
@@ -1532,24 +1543,28 @@ var useRemoteBlockChainRenderProps = /* @__PURE__ */ __name((chainArchivistModul
|
|
|
1532
1543
|
};
|
|
1533
1544
|
}, "useRemoteBlockChainRenderProps");
|
|
1534
1545
|
|
|
1535
|
-
// src/components/chain/render/dynamic/flexbox/
|
|
1536
|
-
var
|
|
1546
|
+
// src/components/chain/render/dynamic/flexbox/variants/Base.tsx
|
|
1547
|
+
var DynamicListBase = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1537
1548
|
const { errors, blockChainRenderComponents, blocksWhilePaused, pollingState, updatePollingState } = useDynamicBlockRenderComponents(BlockHeadingFlexbox, blockChainRenderProps);
|
|
1538
|
-
return /* @__PURE__ */
|
|
1549
|
+
return /* @__PURE__ */ React31.createElement(FlexCol5, {
|
|
1539
1550
|
alignItems: "start",
|
|
1540
1551
|
...props
|
|
1541
|
-
}, errors?.map((error
|
|
1552
|
+
}, errors?.map((error) => /* @__PURE__ */ React31.createElement(ErrorRender4, {
|
|
1542
1553
|
error,
|
|
1543
|
-
key:
|
|
1554
|
+
key: error?.name,
|
|
1544
1555
|
scope: "DynamicBlockchainRenderFlexboxInner"
|
|
1545
|
-
})), /* @__PURE__ */
|
|
1556
|
+
})), /* @__PURE__ */ React31.createElement(MemoizedPollingControlsFlexbox, {
|
|
1546
1557
|
blocksBehind: blocksWhilePaused?.length,
|
|
1547
1558
|
pollingState,
|
|
1548
1559
|
setPollingState: updatePollingState
|
|
1549
|
-
}), /* @__PURE__ */
|
|
1560
|
+
}), /* @__PURE__ */ React31.createElement(BlockListAnimated, {
|
|
1550
1561
|
blockChainRenderComponents
|
|
1551
1562
|
}));
|
|
1552
|
-
}, "
|
|
1563
|
+
}, "DynamicListBase");
|
|
1564
|
+
|
|
1565
|
+
// src/components/chain/render/dynamic/flexbox/variants/WithAnalysis.tsx
|
|
1566
|
+
import { ChainProducersAnalyzer } from "@xyo-network/chain-protocol";
|
|
1567
|
+
import React32, { useMemo as useMemo14 } from "react";
|
|
1553
1568
|
var WithAnalysis = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1554
1569
|
const { chainInformation } = blockChainRenderProps ?? {};
|
|
1555
1570
|
const analyzers = useMemo14(() => {
|
|
@@ -1561,34 +1576,39 @@ var WithAnalysis = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props })
|
|
|
1561
1576
|
}, [
|
|
1562
1577
|
chainInformation
|
|
1563
1578
|
]);
|
|
1564
|
-
return /* @__PURE__ */
|
|
1579
|
+
return /* @__PURE__ */ React32.createElement(ChainAnalyzersProvider, {
|
|
1565
1580
|
analyzers
|
|
1566
|
-
}, /* @__PURE__ */
|
|
1581
|
+
}, /* @__PURE__ */ React32.createElement(ChainPollingProvider, null, /* @__PURE__ */ React32.createElement(DynamicListBase, {
|
|
1567
1582
|
blockChainRenderProps,
|
|
1568
1583
|
...props
|
|
1569
1584
|
})));
|
|
1570
1585
|
}, "WithAnalysis");
|
|
1586
|
+
|
|
1587
|
+
// src/components/chain/render/dynamic/flexbox/variants/WithRemote.tsx
|
|
1588
|
+
import { ErrorRender as ErrorRender5 } from "@xylabs/react-error";
|
|
1589
|
+
import React33 from "react";
|
|
1571
1590
|
var WithRemote = /* @__PURE__ */ __name(({ url, chainArchivistModuleId, blockChainRenderProps: blockChainRenderPropsArg, ...props }) => {
|
|
1572
1591
|
const { error, blockChainRenderProps } = useRemoteBlockChainRenderProps(chainArchivistModuleId, url, blockChainRenderPropsArg);
|
|
1573
|
-
return /* @__PURE__ */
|
|
1592
|
+
return /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement(ErrorRender5, {
|
|
1574
1593
|
error,
|
|
1575
1594
|
scope: "RemoteChainProviderFlexbox"
|
|
1576
|
-
}), /* @__PURE__ */
|
|
1595
|
+
}), /* @__PURE__ */ React33.createElement(WithAnalysis, {
|
|
1577
1596
|
blockChainRenderProps,
|
|
1578
1597
|
...props
|
|
1579
1598
|
}));
|
|
1580
1599
|
}, "WithRemote");
|
|
1600
|
+
|
|
1601
|
+
// src/components/chain/render/dynamic/flexbox/Flexbox.tsx
|
|
1581
1602
|
var DynamicBlockchainRenderFlexbox = {
|
|
1582
|
-
Base,
|
|
1603
|
+
Base: DynamicListBase,
|
|
1583
1604
|
WithAnalysis,
|
|
1584
1605
|
WithRemote
|
|
1585
1606
|
};
|
|
1586
1607
|
|
|
1587
|
-
// src/components/chain/render/static/flexbox/
|
|
1588
|
-
import { ErrorRender as
|
|
1608
|
+
// src/components/chain/render/static/flexbox/variants/Base.tsx
|
|
1609
|
+
import { ErrorRender as ErrorRender6 } from "@xylabs/react-error";
|
|
1589
1610
|
import { FlexCol as FlexCol6, FlexGrowRow as FlexGrowRow2 } from "@xylabs/react-flexbox";
|
|
1590
|
-
import
|
|
1591
|
-
import React31, { useMemo as useMemo16 } from "react";
|
|
1611
|
+
import React34 from "react";
|
|
1592
1612
|
|
|
1593
1613
|
// src/components/chain/render/static/hooks/useStaticBlockRenderComponents.ts
|
|
1594
1614
|
import { exists } from "@xylabs/exists";
|
|
@@ -1618,30 +1638,34 @@ var useStaticBlockRenderComponents = /* @__PURE__ */ __name((BlockComponent, blo
|
|
|
1618
1638
|
};
|
|
1619
1639
|
}, "useStaticBlockRenderComponents");
|
|
1620
1640
|
|
|
1621
|
-
// src/components/chain/render/static/flexbox/
|
|
1622
|
-
var
|
|
1641
|
+
// src/components/chain/render/static/flexbox/variants/Base.tsx
|
|
1642
|
+
var StaticListBase = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1623
1643
|
const { blockComponents, errors, paginatedBlockComponents, onPageChange, page, pageSize } = useStaticBlockRenderComponents(BlockHeadingFlexbox, blockChainRenderProps);
|
|
1624
|
-
return /* @__PURE__ */
|
|
1644
|
+
return /* @__PURE__ */ React34.createElement(FlexCol6, {
|
|
1625
1645
|
alignItems: "start",
|
|
1626
1646
|
gap: 2,
|
|
1627
1647
|
width: "100%",
|
|
1628
1648
|
...props
|
|
1629
|
-
}, errors?.map((error
|
|
1649
|
+
}, errors?.map((error) => /* @__PURE__ */ React34.createElement(ErrorRender6, {
|
|
1630
1650
|
error,
|
|
1631
|
-
key:
|
|
1651
|
+
key: error.name,
|
|
1632
1652
|
scope: "StaticBlockchainFlexboxInner"
|
|
1633
|
-
})), paginatedBlockComponents?.length ? /* @__PURE__ */
|
|
1653
|
+
})), paginatedBlockComponents?.length ? /* @__PURE__ */ React34.createElement(FlexGrowRow2, {
|
|
1634
1654
|
justifyContent: "space-between",
|
|
1635
1655
|
width: "100%"
|
|
1636
|
-
}, /* @__PURE__ */
|
|
1656
|
+
}, /* @__PURE__ */ React34.createElement(ChainAnalyzerStatsDialogFromContext, null), /* @__PURE__ */ React34.createElement(BlockChainPagination, {
|
|
1637
1657
|
count: blockComponents?.length ?? 0,
|
|
1638
1658
|
onPageChange,
|
|
1639
1659
|
page,
|
|
1640
1660
|
rowsPerPage: pageSize
|
|
1641
|
-
})) : null, /* @__PURE__ */
|
|
1661
|
+
})) : null, /* @__PURE__ */ React34.createElement(BlockListAnimated, {
|
|
1642
1662
|
blockChainRenderComponents: paginatedBlockComponents
|
|
1643
1663
|
}));
|
|
1644
|
-
}, "
|
|
1664
|
+
}, "StaticListBase");
|
|
1665
|
+
|
|
1666
|
+
// src/components/chain/render/static/flexbox/variants/WithAnalysis.tsx
|
|
1667
|
+
import { ChainProducersAnalyzer as ChainProducersAnalyzer2 } from "@xyo-network/chain-protocol";
|
|
1668
|
+
import React35, { useMemo as useMemo16 } from "react";
|
|
1645
1669
|
var WithAnalysis2 = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1646
1670
|
const { chainInformation } = blockChainRenderProps ?? {};
|
|
1647
1671
|
const analyzers = useMemo16(() => {
|
|
@@ -1653,34 +1677,36 @@ var WithAnalysis2 = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props })
|
|
|
1653
1677
|
}, [
|
|
1654
1678
|
chainInformation
|
|
1655
1679
|
]);
|
|
1656
|
-
return /* @__PURE__ */
|
|
1680
|
+
return /* @__PURE__ */ React35.createElement(ChainAnalyzersProvider, {
|
|
1657
1681
|
analyzers
|
|
1658
|
-
}, /* @__PURE__ */
|
|
1682
|
+
}, /* @__PURE__ */ React35.createElement(StaticListBase, {
|
|
1659
1683
|
blockChainRenderProps,
|
|
1660
1684
|
...props
|
|
1661
1685
|
}));
|
|
1662
1686
|
}, "WithAnalysis");
|
|
1687
|
+
|
|
1688
|
+
// src/components/chain/render/static/flexbox/Flexbox.tsx
|
|
1663
1689
|
var StaticBlockchainRenderFlexBox = {
|
|
1664
|
-
Base:
|
|
1690
|
+
Base: StaticListBase,
|
|
1665
1691
|
WithAnalysis: WithAnalysis2
|
|
1666
1692
|
};
|
|
1667
1693
|
|
|
1668
1694
|
// src/components/payload/builder/Flexbox.tsx
|
|
1669
1695
|
import { FlexCol as FlexCol7 } from "@xylabs/react-flexbox";
|
|
1670
1696
|
import { JsonViewerEx as JsonViewerEx2 } from "@xyo-network/react-payload-raw-info";
|
|
1671
|
-
import
|
|
1697
|
+
import React36, { useState as useState13 } from "react";
|
|
1672
1698
|
var PayloadBuilderFlexbox = /* @__PURE__ */ __name(({ BuilderComponent, onBuild, ...props }) => {
|
|
1673
1699
|
const [payload, setPayload] = useState13();
|
|
1674
1700
|
const onBuildLocal = /* @__PURE__ */ __name((payload2) => {
|
|
1675
1701
|
onBuild?.(payload2);
|
|
1676
1702
|
setPayload(payload2);
|
|
1677
1703
|
}, "onBuildLocal");
|
|
1678
|
-
return /* @__PURE__ */
|
|
1704
|
+
return /* @__PURE__ */ React36.createElement(FlexCol7, {
|
|
1679
1705
|
gap: 2,
|
|
1680
1706
|
...props
|
|
1681
|
-
}, /* @__PURE__ */
|
|
1707
|
+
}, /* @__PURE__ */ React36.createElement(BuilderComponent, {
|
|
1682
1708
|
onBuild: onBuildLocal
|
|
1683
|
-
}), payload && /* @__PURE__ */
|
|
1709
|
+
}), payload && /* @__PURE__ */ React36.createElement(JsonViewerEx2, {
|
|
1684
1710
|
value: payload
|
|
1685
1711
|
}));
|
|
1686
1712
|
}, "PayloadBuilderFlexbox");
|
|
@@ -1688,11 +1714,11 @@ var PayloadBuilderFlexbox = /* @__PURE__ */ __name(({ BuilderComponent, onBuild,
|
|
|
1688
1714
|
// src/components/payload/builder/producer-intent/Form.tsx
|
|
1689
1715
|
import { Button as Button4, FormControl as FormControl5 } from "@mui/material";
|
|
1690
1716
|
import { createProducerChainStakeIntent } from "@xyo-network/chain-ethereum";
|
|
1691
|
-
import
|
|
1717
|
+
import React39, { useMemo as useMemo18, useState as useState16 } from "react";
|
|
1692
1718
|
|
|
1693
1719
|
// src/components/payload/fields/BlockNumberTextField.tsx
|
|
1694
1720
|
import { FormControl as FormControl3, FormHelperText as FormHelperText2, TextField as TextField3 } from "@mui/material";
|
|
1695
|
-
import
|
|
1721
|
+
import React37, { useState as useState14 } from "react";
|
|
1696
1722
|
var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumberChanged, onChange, ...props }) => {
|
|
1697
1723
|
const [blockNumber, setBlockNumber] = useState14();
|
|
1698
1724
|
const handleChange = /* @__PURE__ */ __name((e) => {
|
|
@@ -1701,15 +1727,15 @@ var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumber
|
|
|
1701
1727
|
onBlockNumberChanged?.(Number.parseInt(value));
|
|
1702
1728
|
onChange?.(e);
|
|
1703
1729
|
}, "handleChange");
|
|
1704
|
-
return /* @__PURE__ */
|
|
1730
|
+
return /* @__PURE__ */ React37.createElement(FormControl3, {
|
|
1705
1731
|
fullWidth: true
|
|
1706
|
-
}, /* @__PURE__ */
|
|
1732
|
+
}, /* @__PURE__ */ React37.createElement(TextField3, {
|
|
1707
1733
|
error: !!errorMessage,
|
|
1708
1734
|
onChange: handleChange,
|
|
1709
1735
|
type: "number",
|
|
1710
1736
|
value: blockNumber ?? "",
|
|
1711
1737
|
...props
|
|
1712
|
-
}), errorMessage && /* @__PURE__ */
|
|
1738
|
+
}), errorMessage && /* @__PURE__ */ React37.createElement(FormHelperText2, {
|
|
1713
1739
|
sx: {
|
|
1714
1740
|
color: /* @__PURE__ */ __name((theme) => theme.palette.error.main, "color")
|
|
1715
1741
|
}
|
|
@@ -1719,11 +1745,11 @@ var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumber
|
|
|
1719
1745
|
// src/components/payload/fields/XyoAddressTextField.tsx
|
|
1720
1746
|
import { FormControl as FormControl4, FormHelperText as FormHelperText3, TextField as TextField4 } from "@mui/material";
|
|
1721
1747
|
import { asAddress } from "@xylabs/hex";
|
|
1722
|
-
import
|
|
1748
|
+
import React38, { useMemo as useMemo17, useState as useState15 } from "react";
|
|
1723
1749
|
var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange, resetValue, ...props }) => {
|
|
1724
1750
|
const [address, setAddress] = useState15("");
|
|
1725
1751
|
const [addressError, setAddressError] = useState15();
|
|
1726
|
-
|
|
1752
|
+
useMemo17(() => setAddress(""), [
|
|
1727
1753
|
resetValue
|
|
1728
1754
|
]);
|
|
1729
1755
|
const handleChange = /* @__PURE__ */ __name((event) => {
|
|
@@ -1743,15 +1769,15 @@ var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange,
|
|
|
1743
1769
|
onAddressChanged?.();
|
|
1744
1770
|
}
|
|
1745
1771
|
}, "handleBlur");
|
|
1746
|
-
return /* @__PURE__ */
|
|
1772
|
+
return /* @__PURE__ */ React38.createElement(FormControl4, {
|
|
1747
1773
|
fullWidth: true
|
|
1748
|
-
}, /* @__PURE__ */
|
|
1774
|
+
}, /* @__PURE__ */ React38.createElement(TextField4, {
|
|
1749
1775
|
error: !!addressError,
|
|
1750
1776
|
onBlur: handleBlur,
|
|
1751
1777
|
onChange: handleChange,
|
|
1752
1778
|
value: address,
|
|
1753
1779
|
...props
|
|
1754
|
-
}), addressError && /* @__PURE__ */
|
|
1780
|
+
}), addressError && /* @__PURE__ */ React38.createElement(FormHelperText3, {
|
|
1755
1781
|
sx: {
|
|
1756
1782
|
color: /* @__PURE__ */ __name((theme) => theme.palette.error.main, "color")
|
|
1757
1783
|
}
|
|
@@ -1764,7 +1790,7 @@ var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1764
1790
|
const [exp, setExp] = useState16();
|
|
1765
1791
|
const [nbf, setNbf] = useState16();
|
|
1766
1792
|
const [blockRangeError, setBlockRangeError] = useState16();
|
|
1767
|
-
const intentPayload =
|
|
1793
|
+
const intentPayload = useMemo18(() => {
|
|
1768
1794
|
if (exp !== void 0 && nbf !== void 0) {
|
|
1769
1795
|
if (exp <= nbf) {
|
|
1770
1796
|
setBlockRangeError(new Error("Expires must be greater than Not Before"));
|
|
@@ -1784,33 +1810,33 @@ var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1784
1810
|
const onBuildLocal = /* @__PURE__ */ __name(() => {
|
|
1785
1811
|
if (onBuild && intentPayload) onBuild?.(intentPayload);
|
|
1786
1812
|
}, "onBuildLocal");
|
|
1787
|
-
return /* @__PURE__ */
|
|
1813
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(FormControl5, {
|
|
1788
1814
|
fullWidth: true
|
|
1789
|
-
}, /* @__PURE__ */
|
|
1815
|
+
}, /* @__PURE__ */ React39.createElement(XyoAddressTextField, {
|
|
1790
1816
|
label: "Delegate",
|
|
1791
1817
|
name: "delegate",
|
|
1792
1818
|
onAddressChanged: setDelegate,
|
|
1793
1819
|
required: true,
|
|
1794
1820
|
size: "small"
|
|
1795
|
-
})), /* @__PURE__ */
|
|
1821
|
+
})), /* @__PURE__ */ React39.createElement(FormControl5, {
|
|
1796
1822
|
fullWidth: true
|
|
1797
|
-
}, /* @__PURE__ */
|
|
1823
|
+
}, /* @__PURE__ */ React39.createElement(BlockNumberTextField, {
|
|
1798
1824
|
errorMessage: blockRangeError?.message,
|
|
1799
1825
|
label: "Expires",
|
|
1800
1826
|
name: "exp",
|
|
1801
1827
|
onBlockNumberChanged: setExp,
|
|
1802
1828
|
required: true,
|
|
1803
1829
|
size: "small"
|
|
1804
|
-
})), /* @__PURE__ */
|
|
1830
|
+
})), /* @__PURE__ */ React39.createElement(FormControl5, {
|
|
1805
1831
|
fullWidth: true
|
|
1806
|
-
}, /* @__PURE__ */
|
|
1832
|
+
}, /* @__PURE__ */ React39.createElement(BlockNumberTextField, {
|
|
1807
1833
|
errorMessage: blockRangeError?.message,
|
|
1808
1834
|
label: "Not Before",
|
|
1809
1835
|
name: "nbf",
|
|
1810
1836
|
onBlockNumberChanged: setNbf,
|
|
1811
1837
|
required: true,
|
|
1812
1838
|
size: "small"
|
|
1813
|
-
})), /* @__PURE__ */
|
|
1839
|
+
})), /* @__PURE__ */ React39.createElement(Button4, {
|
|
1814
1840
|
disabled: !intentPayload,
|
|
1815
1841
|
variant: "contained",
|
|
1816
1842
|
onClick: onBuildLocal
|
|
@@ -1818,12 +1844,12 @@ var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1818
1844
|
}, "ProducerIntentBuilderForm");
|
|
1819
1845
|
|
|
1820
1846
|
// src/components/payload/builder/transfer/Flexbox.tsx
|
|
1821
|
-
import
|
|
1847
|
+
import React42 from "react";
|
|
1822
1848
|
|
|
1823
1849
|
// src/components/payload/builder/transfer/Form.tsx
|
|
1824
1850
|
import { Button as Button5, FormControl as FormControl7 } from "@mui/material";
|
|
1825
1851
|
import { elevate, TransferSchema } from "@xyo-network/chain-model";
|
|
1826
|
-
import
|
|
1852
|
+
import React41, { useMemo as useMemo20, useState as useState18 } from "react";
|
|
1827
1853
|
|
|
1828
1854
|
// src/components/payload/builder/transfer/builder/SingleFlexbox.tsx
|
|
1829
1855
|
import { RemoveCircle } from "@mui/icons-material";
|
|
@@ -1831,11 +1857,11 @@ import { FormControl as FormControl6, Icon as Icon3, IconButton as IconButton5 }
|
|
|
1831
1857
|
import { toHex as toHex2 } from "@xylabs/hex";
|
|
1832
1858
|
import { FlexRow as FlexRow7 } from "@xylabs/react-flexbox";
|
|
1833
1859
|
import { BigIntInput } from "@xyo-network/react-shared";
|
|
1834
|
-
import
|
|
1860
|
+
import React40, { useEffect as useEffect4, useMemo as useMemo19, useState as useState17 } from "react";
|
|
1835
1861
|
var SingleTransferBuilderFlexbox = /* @__PURE__ */ __name(({ onTransferUpdated, onRemoveTransfer, singleTransfer, ...props }) => {
|
|
1836
1862
|
const [toAddress, setToAddress] = useState17();
|
|
1837
1863
|
const [amount, setAmount] = useState17();
|
|
1838
|
-
const transferAmount =
|
|
1864
|
+
const transferAmount = useMemo19(() => {
|
|
1839
1865
|
if (toAddress && amount) {
|
|
1840
1866
|
return {
|
|
1841
1867
|
...singleTransfer,
|
|
@@ -1847,41 +1873,41 @@ var SingleTransferBuilderFlexbox = /* @__PURE__ */ __name(({ onTransferUpdated,
|
|
|
1847
1873
|
toAddress,
|
|
1848
1874
|
amount
|
|
1849
1875
|
]);
|
|
1850
|
-
|
|
1876
|
+
useEffect4(() => {
|
|
1851
1877
|
if (transferAmount) onTransferUpdated?.(transferAmount);
|
|
1852
1878
|
}, [
|
|
1853
1879
|
transferAmount
|
|
1854
1880
|
]);
|
|
1855
|
-
return /* @__PURE__ */
|
|
1881
|
+
return /* @__PURE__ */ React40.createElement(FlexRow7, {
|
|
1856
1882
|
alignItems: "start",
|
|
1857
1883
|
gap: 1,
|
|
1858
1884
|
...props
|
|
1859
|
-
}, /* @__PURE__ */
|
|
1885
|
+
}, /* @__PURE__ */ React40.createElement(FormControl6, {
|
|
1860
1886
|
fullWidth: true
|
|
1861
|
-
}, /* @__PURE__ */
|
|
1887
|
+
}, /* @__PURE__ */ React40.createElement(XyoAddressTextField, {
|
|
1862
1888
|
label: "To",
|
|
1863
1889
|
name: "to",
|
|
1864
1890
|
onAddressChanged: setToAddress,
|
|
1865
1891
|
required: true,
|
|
1866
1892
|
size: "small"
|
|
1867
|
-
})), /* @__PURE__ */
|
|
1893
|
+
})), /* @__PURE__ */ React40.createElement(FormControl6, {
|
|
1868
1894
|
fullWidth: true
|
|
1869
|
-
}, /* @__PURE__ */
|
|
1895
|
+
}, /* @__PURE__ */ React40.createElement(BigIntInput.TextField, {
|
|
1870
1896
|
label: "Amount",
|
|
1871
1897
|
name: "amount",
|
|
1872
1898
|
onChangeFixedPoint: setAmount,
|
|
1873
1899
|
required: true,
|
|
1874
1900
|
size: "small"
|
|
1875
|
-
})), /* @__PURE__ */
|
|
1901
|
+
})), /* @__PURE__ */ React40.createElement(IconButton5, {
|
|
1876
1902
|
onClick: /* @__PURE__ */ __name(() => onRemoveTransfer?.(singleTransfer.transferId), "onClick")
|
|
1877
|
-
}, /* @__PURE__ */
|
|
1903
|
+
}, /* @__PURE__ */ React40.createElement(Icon3, null, /* @__PURE__ */ React40.createElement(RemoveCircle, null))));
|
|
1878
1904
|
}, "SingleTransferBuilderFlexbox");
|
|
1879
1905
|
|
|
1880
1906
|
// src/components/payload/builder/transfer/Form.tsx
|
|
1881
1907
|
var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
1882
1908
|
const [fromAddress, setFromAddress] = useState18();
|
|
1883
1909
|
const [transfers, setTransfers] = useState18([]);
|
|
1884
|
-
const transferPayload =
|
|
1910
|
+
const transferPayload = useMemo20(() => {
|
|
1885
1911
|
if (fromAddress && transfers.length > 0) {
|
|
1886
1912
|
const transfersRecord = {};
|
|
1887
1913
|
for (const transfer of transfers) {
|
|
@@ -1922,19 +1948,19 @@ var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1922
1948
|
return transfer;
|
|
1923
1949
|
}));
|
|
1924
1950
|
}, "onTransferUpdated");
|
|
1925
|
-
return /* @__PURE__ */
|
|
1951
|
+
return /* @__PURE__ */ React41.createElement(React41.Fragment, null, /* @__PURE__ */ React41.createElement(FormControl7, {
|
|
1926
1952
|
fullWidth: true
|
|
1927
|
-
}, /* @__PURE__ */
|
|
1953
|
+
}, /* @__PURE__ */ React41.createElement(XyoAddressTextField, {
|
|
1928
1954
|
label: "From",
|
|
1929
1955
|
name: "from",
|
|
1930
1956
|
onAddressChanged: setFromAddress,
|
|
1931
1957
|
required: true,
|
|
1932
1958
|
size: "small"
|
|
1933
|
-
})), /* @__PURE__ */
|
|
1959
|
+
})), /* @__PURE__ */ React41.createElement(Button5, {
|
|
1934
1960
|
onClick: onTransferAdded,
|
|
1935
1961
|
size: "small",
|
|
1936
1962
|
variant: "contained"
|
|
1937
|
-
}, "Add Transfer"), transfers.map((transfer) => /* @__PURE__ */
|
|
1963
|
+
}, "Add Transfer"), transfers.map((transfer) => /* @__PURE__ */ React41.createElement(SingleTransferBuilderFlexbox, {
|
|
1938
1964
|
key: transfer.transferId,
|
|
1939
1965
|
onTransferUpdated,
|
|
1940
1966
|
onRemoveTransfer: onTransferRemoved,
|
|
@@ -1942,7 +1968,7 @@ var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1942
1968
|
sx: {
|
|
1943
1969
|
width: "100%"
|
|
1944
1970
|
}
|
|
1945
|
-
})), /* @__PURE__ */
|
|
1971
|
+
})), /* @__PURE__ */ React41.createElement(Button5, {
|
|
1946
1972
|
disabled: !transferPayload,
|
|
1947
1973
|
variant: "contained",
|
|
1948
1974
|
onClick: onBuildLocal
|
|
@@ -1950,7 +1976,7 @@ var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1950
1976
|
}, "TransferBuilderForm");
|
|
1951
1977
|
|
|
1952
1978
|
// src/components/payload/builder/transfer/Flexbox.tsx
|
|
1953
|
-
var TransferBuilderFlexbox = /* @__PURE__ */ __name(({ onBuild, ...props }) => /* @__PURE__ */
|
|
1979
|
+
var TransferBuilderFlexbox = /* @__PURE__ */ __name(({ onBuild, ...props }) => /* @__PURE__ */ React42.createElement(PayloadBuilderFlexbox, {
|
|
1954
1980
|
gap: 4,
|
|
1955
1981
|
alignItems: "start",
|
|
1956
1982
|
BuilderComponent: TransferBuilderForm,
|
|
@@ -1961,16 +1987,14 @@ var TransferBuilderFlexbox = /* @__PURE__ */ __name(({ onBuild, ...props }) => /
|
|
|
1961
1987
|
// src/stories/buildRandomBlockchain.ts
|
|
1962
1988
|
import { Account as Account2 } from "@xyo-network/account";
|
|
1963
1989
|
import { buildRandomChain } from "@xyo-network/chain-ethereum";
|
|
1964
|
-
import { flattenHydratedBlocks } from "@xyo-network/chain-protocol";
|
|
1965
1990
|
var buildRandomBlockChain = /* @__PURE__ */ __name(async (blockCount = 10) => {
|
|
1966
1991
|
const initialBlockProducer = await Account2.random();
|
|
1967
1992
|
const blocks = await buildRandomChain(initialBlockProducer, blockCount);
|
|
1968
|
-
return
|
|
1993
|
+
return blocks;
|
|
1969
1994
|
}, "buildRandomBlockChain");
|
|
1970
1995
|
var buildRandomBlockChainBlocksOnly = /* @__PURE__ */ __name(async (blockCount = 10) => {
|
|
1971
1996
|
const chain = await buildRandomChain(await Account2.random(), blockCount);
|
|
1972
|
-
|
|
1973
|
-
return blocks;
|
|
1997
|
+
return chain;
|
|
1974
1998
|
}, "buildRandomBlockChainBlocksOnly");
|
|
1975
1999
|
|
|
1976
2000
|
// src/stories/ChainArchivistDecorator.tsx
|
|
@@ -1978,8 +2002,8 @@ import { CircularProgress } from "@mui/material";
|
|
|
1978
2002
|
import { usePromise as usePromise7 } from "@xylabs/react-promise";
|
|
1979
2003
|
import { MemoryArchivist } from "@xyo-network/archivist-memory";
|
|
1980
2004
|
import { ArchivistConfigSchema } from "@xyo-network/archivist-model";
|
|
1981
|
-
import {
|
|
1982
|
-
import
|
|
2005
|
+
import { flattenHydratedBlocks } from "@xyo-network/chain-protocol";
|
|
2006
|
+
import React43, { useEffect as useEffect5 } from "react";
|
|
1983
2007
|
var ChainArchivistDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
1984
2008
|
const [randomBlockChain] = usePromise7(async () => await buildRandomBlockChain(), []);
|
|
1985
2009
|
const [blockChainRenderProps, blockChainRenderPropsError] = usePromise7(async () => {
|
|
@@ -1990,7 +2014,8 @@ var ChainArchivistDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
|
1990
2014
|
name: "ChainArchivist"
|
|
1991
2015
|
}
|
|
1992
2016
|
});
|
|
1993
|
-
|
|
2017
|
+
const flattened = flattenHydratedBlocks(randomBlockChain);
|
|
2018
|
+
await chainArchivist.insert(flattened);
|
|
1994
2019
|
const chainInformation = await getChainInformation();
|
|
1995
2020
|
return {
|
|
1996
2021
|
chainArchivist,
|
|
@@ -2000,7 +2025,7 @@ var ChainArchivistDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
|
2000
2025
|
}, [
|
|
2001
2026
|
randomBlockChain
|
|
2002
2027
|
]);
|
|
2003
|
-
|
|
2028
|
+
useEffect5(() => {
|
|
2004
2029
|
if (blockChainRenderPropsError) {
|
|
2005
2030
|
console.error(blockChainRenderPropsError);
|
|
2006
2031
|
}
|
|
@@ -2014,11 +2039,11 @@ var ChainArchivistDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
|
2014
2039
|
blockChainRenderProps: {
|
|
2015
2040
|
...context.args.blockChainRenderProps,
|
|
2016
2041
|
...blockChainRenderProps,
|
|
2017
|
-
head: randomBlockChain?.toReversed().
|
|
2042
|
+
head: randomBlockChain?.toReversed()[0][0]._hash
|
|
2018
2043
|
}
|
|
2019
2044
|
}
|
|
2020
2045
|
};
|
|
2021
|
-
return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */
|
|
2046
|
+
return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */ React43.createElement(Story, props) : /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(CircularProgress, null));
|
|
2022
2047
|
}, "ChainArchivistDecorator");
|
|
2023
2048
|
|
|
2024
2049
|
// src/stories/ChainArchivistDelayedInsertDecorator.tsx
|
|
@@ -2027,8 +2052,8 @@ import { delay } from "@xylabs/delay";
|
|
|
2027
2052
|
import { usePromise as usePromise8 } from "@xylabs/react-promise";
|
|
2028
2053
|
import { MemoryArchivist as MemoryArchivist2 } from "@xyo-network/archivist-memory";
|
|
2029
2054
|
import { ArchivistConfigSchema as ArchivistConfigSchema2 } from "@xyo-network/archivist-model";
|
|
2030
|
-
import {
|
|
2031
|
-
import
|
|
2055
|
+
import { flattenHydratedBlock } from "@xyo-network/chain-protocol";
|
|
2056
|
+
import React44, { useEffect as useEffect6, useState as useState19 } from "react";
|
|
2032
2057
|
var chainArchivistRef;
|
|
2033
2058
|
var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
2034
2059
|
const [firstBlock, setFirstBlock] = useState19();
|
|
@@ -2048,24 +2073,18 @@ var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, contex
|
|
|
2048
2073
|
}, []);
|
|
2049
2074
|
const [, delayedInsertError] = usePromise8(async () => {
|
|
2050
2075
|
if (chainArchivist && randomBlockChain) {
|
|
2051
|
-
const
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
setFirstBlock((prev) => prev || payload);
|
|
2057
|
-
nextBlockPayloads.length = 0;
|
|
2058
|
-
await delay(1e3);
|
|
2059
|
-
} else {
|
|
2060
|
-
nextBlockPayloads.push(payload);
|
|
2061
|
-
}
|
|
2076
|
+
for (const hydratedBlock of randomBlockChain) {
|
|
2077
|
+
const flattened = flattenHydratedBlock(hydratedBlock);
|
|
2078
|
+
await chainArchivist.insert(flattened);
|
|
2079
|
+
setFirstBlock((prev) => prev || hydratedBlock[0]);
|
|
2080
|
+
await delay(1e3);
|
|
2062
2081
|
}
|
|
2063
2082
|
}
|
|
2064
2083
|
}, [
|
|
2065
2084
|
chainArchivist,
|
|
2066
2085
|
randomBlockChain
|
|
2067
2086
|
]);
|
|
2068
|
-
|
|
2087
|
+
useEffect6(() => {
|
|
2069
2088
|
if (delayedInsertError) {
|
|
2070
2089
|
console.error(delayedInsertError);
|
|
2071
2090
|
}
|
|
@@ -2088,20 +2107,20 @@ var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, contex
|
|
|
2088
2107
|
blockChainRenderProps: {
|
|
2089
2108
|
...context.args.blockChainRenderProps,
|
|
2090
2109
|
...blockChainRenderProps,
|
|
2091
|
-
head: randomBlockChain?.
|
|
2110
|
+
head: randomBlockChain?.[0][0]?._hash
|
|
2092
2111
|
}
|
|
2093
2112
|
}
|
|
2094
2113
|
};
|
|
2095
|
-
return firstBlock ? /* @__PURE__ */
|
|
2114
|
+
return firstBlock ? /* @__PURE__ */ React44.createElement(Story, props) : /* @__PURE__ */ React44.createElement(CircularProgress2, null);
|
|
2096
2115
|
}, "ChainArchivistDelayedInsertDecorator");
|
|
2097
2116
|
|
|
2098
2117
|
// src/stories/ChainInfoContextDecorator.tsx
|
|
2099
2118
|
import { assertEx as assertEx5 } from "@xylabs/assert";
|
|
2100
2119
|
import { usePromise as usePromise9 } from "@xylabs/react-promise";
|
|
2101
|
-
import { isBlockBoundWitness as
|
|
2120
|
+
import { isBlockBoundWitness as isBlockBoundWitness3 } from "@xyo-network/chain-model";
|
|
2102
2121
|
import { XyoChainBlockNumberIterator as XyoChainBlockNumberIterator3 } from "@xyo-network/chain-services";
|
|
2103
2122
|
import { findFirstMatching } from "@xyo-network/chain-utils";
|
|
2104
|
-
import
|
|
2123
|
+
import React45 from "react";
|
|
2105
2124
|
var archivistConfig = {
|
|
2106
2125
|
url: "http://localhost:8080",
|
|
2107
2126
|
chainArchivistModuleId: "XYOPublic:XYOChain:Chain"
|
|
@@ -2117,7 +2136,7 @@ var ChainInfoContextDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
|
2117
2136
|
const [chainIterator] = usePromise9(async () => {
|
|
2118
2137
|
if (chainArchivist && chainInformation) {
|
|
2119
2138
|
const firstMatch = assertEx5(await findFirstMatching(chainArchivist), () => `No head found in archivist: ${chainArchivist.id} `);
|
|
2120
|
-
const head = assertEx5(
|
|
2139
|
+
const head = assertEx5(isBlockBoundWitness3(firstMatch) ? firstMatch : void 0, () => `Expected a block bound witness: ${JSON.stringify(firstMatch)}`);
|
|
2121
2140
|
return await XyoChainBlockNumberIterator3.create({
|
|
2122
2141
|
chainArchivist,
|
|
2123
2142
|
head
|
|
@@ -2127,11 +2146,11 @@ var ChainInfoContextDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
|
2127
2146
|
chainArchivist,
|
|
2128
2147
|
chainInformation
|
|
2129
2148
|
]);
|
|
2130
|
-
return /* @__PURE__ */
|
|
2149
|
+
return /* @__PURE__ */ React45.createElement(ChainInfoProvider, {
|
|
2131
2150
|
chainArchivist,
|
|
2132
2151
|
chainInformation,
|
|
2133
2152
|
chainIterator
|
|
2134
|
-
}, /* @__PURE__ */
|
|
2153
|
+
}, /* @__PURE__ */ React45.createElement(Story, context));
|
|
2135
2154
|
}, "ChainInfoContextDecorator");
|
|
2136
2155
|
export {
|
|
2137
2156
|
BlockChainPagination,
|
|
@@ -2147,6 +2166,7 @@ export {
|
|
|
2147
2166
|
BlockTransactionCountTableCell,
|
|
2148
2167
|
BlockVerificationTableCell,
|
|
2149
2168
|
BlockchainTableEx,
|
|
2169
|
+
BlockchainTableHead,
|
|
2150
2170
|
ChainAnalyzerStatsDialog,
|
|
2151
2171
|
ChainAnalyzerStatsDialogFromContext,
|
|
2152
2172
|
ChainArchivistDecorator,
|