@xyo-network/react-chain-blockchain 1.20.15 → 1.20.16
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/README.md +9 -8854
- package/dist/browser/components/block/table/cell/NumberChip.d.ts.map +1 -1
- package/dist/browser/components/chain/controls/PulseSvgIcon.d.ts +5 -2
- package/dist/browser/components/chain/controls/PulseSvgIcon.d.ts.map +1 -1
- package/dist/browser/components/chain/hooks/useOnBlock.d.ts +7 -7
- package/dist/browser/components/chain/styled/BlockListWrapperFlexbox.d.ts +6 -1
- package/dist/browser/components/chain/styled/BlockListWrapperFlexbox.d.ts.map +1 -1
- package/dist/browser/components/table/StyledLinkableTableRow.d.ts +5 -4
- package/dist/browser/components/table/StyledLinkableTableRow.d.ts.map +1 -1
- package/dist/browser/context/analyzer/context.d.ts +3 -3
- package/dist/browser/context/analyzer/use.d.ts +1 -1
- package/dist/browser/context/chain/Context.d.ts +3 -3
- package/dist/browser/context/chain/use.d.ts +1 -1
- package/dist/browser/hooks/useBaseContext.d.ts +2 -8
- package/dist/browser/hooks/useBaseContext.d.ts.map +1 -1
- package/dist/browser/hooks/useTxsFromBlock.d.ts +1 -1
- package/dist/browser/hooks/useTxsFromBlock.d.ts.map +1 -1
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +167 -58
- package/src/components/FeatureNotAvailable.tsx +0 -20
- package/src/components/account/BalanceHistoryFlexbox.stories.tsx +0 -25
- package/src/components/account/BalanceHistoryFlexbox.tsx +0 -53
- package/src/components/account/helpers/formatBalanceMagnitude.ts +0 -14
- package/src/components/account/helpers/index.ts +0 -1
- package/src/components/account/hooks/index.ts +0 -1
- package/src/components/account/hooks/usePagedAccountBalanceHistory.ts +0 -39
- package/src/components/account/index.ts +0 -4
- package/src/components/account/table/BalanceHistoryTableEx.stories.tsx +0 -111
- package/src/components/account/table/BalanceHistoryTableEx.tsx +0 -37
- package/src/components/account/table/BalanceHistoryTableRow.stories.tsx +0 -53
- package/src/components/account/table/BalanceHistoryTableRow.tsx +0 -60
- package/src/components/account/table/RawAmountTableCell.tsx +0 -53
- package/src/components/account/table/cell/AddressTableCell.tsx +0 -27
- package/src/components/account/table/cell/BlockNumber.tsx +0 -39
- package/src/components/account/table/cell/HashTableCell.tsx +0 -46
- package/src/components/account/table/cell/index.ts +0 -3
- package/src/components/account/table/hooks/index.ts +0 -1
- package/src/components/account/table/hooks/useLinkedBalanceHistoryItem.tsx +0 -29
- package/src/components/account/table/index.ts +0 -5
- package/src/components/account/table/types/index.ts +0 -18
- package/src/components/block/BlockHeadingFlexbox.stories.tsx +0 -75
- package/src/components/block/BlockHeadingFlexbox.tsx +0 -56
- package/src/components/block/ChipSkeleton.tsx +0 -7
- package/src/components/block/LinkedDivider.tsx +0 -27
- package/src/components/block/ProducerChip.tsx +0 -45
- package/src/components/block/helpers/blockProducer.ts +0 -5
- package/src/components/block/helpers/buildBlockChainRenderComponent.tsx +0 -32
- package/src/components/block/helpers/index.ts +0 -3
- package/src/components/block/helpers/payloadCountsFromBlock.ts +0 -10
- package/src/components/block/hooks/index.ts +0 -4
- package/src/components/block/hooks/useAnchorElement.ts +0 -19
- package/src/components/block/hooks/useBlockHeadingEvents.ts +0 -11
- package/src/components/block/hooks/useBlockProducer.ts +0 -11
- package/src/components/block/hooks/usePayloadCountsFromBlock.ts +0 -13
- package/src/components/block/index.ts +0 -6
- package/src/components/block/menu/Expanded.tsx +0 -34
- package/src/components/block/menu/index.ts +0 -1
- package/src/components/block/table/Ex.stories.tsx +0 -64
- package/src/components/block/table/Ex.tsx +0 -21
- package/src/components/block/table/cell/BlockNumber.tsx +0 -35
- package/src/components/block/table/cell/Epoch.tsx +0 -46
- package/src/components/block/table/cell/Hash.tsx +0 -46
- package/src/components/block/table/cell/JsonView.tsx +0 -44
- package/src/components/block/table/cell/NumberChip.tsx +0 -12
- package/src/components/block/table/cell/PayloadCounts.tsx +0 -65
- package/src/components/block/table/cell/Producer.tsx +0 -63
- package/src/components/block/table/cell/TransactionCount.tsx +0 -56
- package/src/components/block/table/cell/Verification.tsx +0 -25
- package/src/components/block/table/cell/helpers/index.ts +0 -1
- package/src/components/block/table/cell/helpers/timeFunctions.ts +0 -44
- package/src/components/block/table/cell/hooks/index.ts +0 -1
- package/src/components/block/table/cell/hooks/useLinkedBlockItem.tsx +0 -25
- package/src/components/block/table/cell/index.ts +0 -8
- package/src/components/block/table/cell/lib/BlockTableCellProps.ts +0 -7
- package/src/components/block/table/cell/lib/index.ts +0 -1
- package/src/components/block/table/head/TableHead.tsx +0 -48
- package/src/components/block/table/head/index.ts +0 -1
- package/src/components/block/table/index.ts +0 -4
- package/src/components/block/table/row/TableRow.stories.tsx +0 -34
- package/src/components/block/table/row/TableRow.tsx +0 -46
- package/src/components/block/table/row/index.ts +0 -1
- package/src/components/chain/controls/PollingControlsFlexbox.tsx +0 -76
- package/src/components/chain/controls/PulseSvgIcon.tsx +0 -71
- package/src/components/chain/controls/index.ts +0 -2
- package/src/components/chain/dialog/Dialog.tsx +0 -20
- package/src/components/chain/dialog/index.ts +0 -1
- package/src/components/chain/hooks/index.ts +0 -1
- package/src/components/chain/hooks/useOnBlock.ts +0 -55
- package/src/components/chain/index.ts +0 -6
- package/src/components/chain/list/Animated.tsx +0 -19
- package/src/components/chain/list/TableEx.tsx +0 -12
- package/src/components/chain/list/index.ts +0 -2
- package/src/components/chain/pagination/BlockChainPagination.tsx +0 -11
- package/src/components/chain/pagination/hooks/index.ts +0 -1
- package/src/components/chain/pagination/hooks/usePagination.tsx +0 -22
- package/src/components/chain/pagination/index.ts +0 -2
- package/src/components/chain/stats/Dialog.tsx +0 -49
- package/src/components/chain/stats/index.ts +0 -1
- package/src/components/chain/stats/producer/ProducerFlexbox.tsx +0 -32
- package/src/components/chain/stats/producer/Table.tsx +0 -39
- package/src/components/chain/stats/producer/index.ts +0 -2
- package/src/components/chain/styled/BlockListWrapperFlexbox.tsx +0 -15
- package/src/components/chain/styled/index.ts +0 -1
- package/src/components/index.ts +0 -7
- package/src/components/payload/builder/BuilderComponentProps.ts +0 -5
- package/src/components/payload/builder/Flexbox.tsx +0 -30
- package/src/components/payload/builder/index.ts +0 -4
- package/src/components/payload/builder/producer-intent/Flexbox.stories.tsx +0 -14
- package/src/components/payload/builder/producer-intent/Flexbox.tsx +0 -15
- package/src/components/payload/builder/producer-intent/Form.tsx +0 -69
- package/src/components/payload/builder/producer-intent/index.ts +0 -1
- package/src/components/payload/builder/transfer/Flexbox.stories.tsx +0 -14
- package/src/components/payload/builder/transfer/Flexbox.tsx +0 -15
- package/src/components/payload/builder/transfer/Form.tsx +0 -82
- package/src/components/payload/builder/transfer/Transfer.ts +0 -3
- package/src/components/payload/builder/transfer/builder/SingleFlexbox.tsx +0 -51
- package/src/components/payload/builder/transfer/builder/index.ts +0 -1
- package/src/components/payload/builder/transfer/index.ts +0 -2
- package/src/components/payload/fields/BlockNumberTextField.tsx +0 -40
- package/src/components/payload/fields/XyoAddressTextField.tsx +0 -71
- package/src/components/payload/fields/index.ts +0 -2
- package/src/components/payload/index.ts +0 -2
- package/src/components/rate/SpanTypography.tsx +0 -20
- package/src/components/rate/SpeedTypography.tsx +0 -17
- package/src/components/rate/TimeTypography.tsx +0 -17
- package/src/components/rate/flexbox/FlexBox.stories.tsx +0 -46
- package/src/components/rate/flexbox/FlexBox.tsx +0 -31
- package/src/components/rate/flexbox/index.ts +0 -1
- package/src/components/rate/gauge/Container.stories.tsx +0 -80
- package/src/components/rate/gauge/Container.tsx +0 -75
- package/src/components/rate/gauge/Pointer.tsx +0 -67
- package/src/components/rate/gauge/Ticks.tsx +0 -122
- package/src/components/rate/gauge/WithLabel.stories.tsx +0 -73
- package/src/components/rate/gauge/WithLabel.tsx +0 -20
- package/src/components/rate/gauge/helpers/blockRateConversions.ts +0 -104
- package/src/components/rate/gauge/helpers/index.ts +0 -1
- package/src/components/rate/gauge/index.ts +0 -4
- package/src/components/rate/index.ts +0 -6
- package/src/components/rate/support/MetricTypography.tsx +0 -78
- package/src/components/rate/support/index.ts +0 -1
- package/src/components/table/StyledLinkableTableRow.tsx +0 -12
- package/src/components/table/index.ts +0 -1
- package/src/components/transactions/TransactionCountChip.tsx +0 -34
- package/src/components/transactions/TransactionsQuickTipButton.tsx +0 -86
- package/src/components/transactions/index.ts +0 -3
- package/src/components/transactions/submit/Builder.tsx +0 -55
- package/src/components/transactions/submit/Network.tsx +0 -36
- package/src/components/transactions/submit/SubmitChain.stories.tsx +0 -14
- package/src/components/transactions/submit/SubmitChain.tsx +0 -91
- package/src/components/transactions/submit/index.ts +0 -3
- package/src/context/analyzer/Provider.tsx +0 -41
- package/src/context/analyzer/context.ts +0 -5
- package/src/context/analyzer/index.ts +0 -5
- package/src/context/analyzer/state.ts +0 -13
- package/src/context/analyzer/use.ts +0 -6
- package/src/context/chain/Context.ts +0 -5
- package/src/context/chain/Provider.tsx +0 -49
- package/src/context/chain/State.ts +0 -8
- package/src/context/chain/index.ts +0 -4
- package/src/context/chain/use.ts +0 -6
- package/src/context/index.ts +0 -3
- package/src/context/polling/Provider.tsx +0 -27
- package/src/context/polling/context.ts +0 -5
- package/src/context/polling/index.ts +0 -4
- package/src/context/polling/state.ts +0 -8
- package/src/context/polling/use.ts +0 -5
- package/src/helpers/index.ts +0 -1
- package/src/helpers/rate/index.ts +0 -1
- package/src/helpers/rate/rateUnitToLabel.ts +0 -27
- package/src/helpers/txsFromBlock.ts +0 -12
- package/src/hooks/chain-iterator/index.ts +0 -1
- package/src/hooks/chain-iterator/useChainIteratorParams.ts +0 -55
- package/src/hooks/index.ts +0 -3
- package/src/hooks/useBaseContext.ts +0 -8
- package/src/hooks/useTxsFromBlock.ts +0 -12
- package/src/index.ts +0 -3
- package/src/lib/getChainArchivist.ts +0 -20
- package/src/lib/getChainId.ts +0 -8
- package/src/lib/index.ts +0 -2
- package/src/stories/ChainArchivistDecorator.tsx +0 -43
- package/src/stories/ChainArchivistDelayedInsertDecorator.tsx +0 -71
- package/src/stories/index.ts +0 -2
- package/src/types/BlockComponentProps.ts +0 -13
- package/src/types/BlockComponents.ts +0 -7
- package/src/types/BlockListComponentProps.ts +0 -6
- package/src/types/global.d.ts +0 -1
- package/src/types/index.ts +0 -4
- package/src/types/render/BlockChainRenderProps.ts +0 -28
- package/src/types/render/RemoteArchivistProps.ts +0 -5
- package/src/types/render/flexbox/BlockChainRenderFlexboxProps.ts +0 -8
- package/src/types/render/flexbox/RenderFlexboxProps.ts +0 -5
- package/src/types/render/flexbox/index.ts +0 -2
- package/src/types/render/index.ts +0 -4
- package/src/types/render/table/BlockChainRenderTableExProps.ts +0 -8
- package/src/types/render/table/RenderTableProps.ts +0 -5
- package/src/types/render/table/index.ts +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './TableHead.tsx'
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Table, TableBody } from '@mui/material'
|
|
2
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
3
|
-
import { buildRandomBlockChainBlocksOnly } from '@xyo-network/react-chain-shared'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
|
|
6
|
-
import { BlockChainTableRow } from './TableRow.tsx'
|
|
7
|
-
|
|
8
|
-
const [block] = await buildRandomBlockChainBlocksOnly(1)
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
title: 'Block/TableRow',
|
|
12
|
-
component: BlockChainTableRow,
|
|
13
|
-
} as Meta
|
|
14
|
-
|
|
15
|
-
const Template: StoryFn<typeof BlockChainTableRow> = args => (
|
|
16
|
-
<Table>
|
|
17
|
-
<TableBody>
|
|
18
|
-
<BlockChainTableRow {...args} />
|
|
19
|
-
</TableBody>
|
|
20
|
-
</Table>
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
const Default = Template.bind({})
|
|
24
|
-
Default.args = {}
|
|
25
|
-
|
|
26
|
-
const WithData = Template.bind({})
|
|
27
|
-
WithData.args = { block }
|
|
28
|
-
|
|
29
|
-
const WithDataLinked = Template.bind({})
|
|
30
|
-
WithDataLinked.args = { block, linked: true }
|
|
31
|
-
|
|
32
|
-
export {
|
|
33
|
-
Default, WithData, WithDataLinked,
|
|
34
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { TableRowProps } from '@mui/material'
|
|
2
|
-
import { usePayloadRootHash } from '@xyo-network/react-shared'
|
|
3
|
-
import type { Ref } from 'react'
|
|
4
|
-
import React, { useMemo } from 'react'
|
|
5
|
-
|
|
6
|
-
import type { BlockComponentProps } from '../../../../types/index.ts'
|
|
7
|
-
import { StyledLinkableTableRow } from '../../../table/index.ts'
|
|
8
|
-
import { useLinkedBlockItem } from '../cell/hooks/index.ts'
|
|
9
|
-
import {
|
|
10
|
-
BlockEpochTableCell,
|
|
11
|
-
BlockHashTableCell, BlockJsonViewTableCell, BlockNumberTableCell, BlockPayloadCountsTableCell,
|
|
12
|
-
BlockProducerTableCell,
|
|
13
|
-
BlockTransactionCountTableCell, BlockVerificationTableCell,
|
|
14
|
-
} from '../cell/index.ts'
|
|
15
|
-
|
|
16
|
-
export interface BlockChainTableRowProps extends BlockComponentProps, TableRowProps {
|
|
17
|
-
deepValidation?: boolean
|
|
18
|
-
linked?: boolean
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const BlockChainTableRow: React.FC<BlockChainTableRowProps> = ({
|
|
22
|
-
block, deepValidation, defaultExpanded, linked, ...props
|
|
23
|
-
}) => {
|
|
24
|
-
const linkedTableCellProps = useMemo(() => ({ block, linked }), [block, linked])
|
|
25
|
-
const defaultTableCellProps = useMemo(() => ({ block }), [block])
|
|
26
|
-
const hash = usePayloadRootHash(block?.[0])
|
|
27
|
-
const [ref, handleClick] = useLinkedBlockItem('block-hash', hash)
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<StyledLinkableTableRow
|
|
31
|
-
onClick={linked ? handleClick : undefined}
|
|
32
|
-
ref={ref as Ref<HTMLTableRowElement> | undefined}
|
|
33
|
-
linked={linked}
|
|
34
|
-
{...props}
|
|
35
|
-
>
|
|
36
|
-
<BlockNumberTableCell align="left" {...linkedTableCellProps} />
|
|
37
|
-
<BlockHashTableCell align="left" {...linkedTableCellProps} />
|
|
38
|
-
<BlockEpochTableCell align="left" {...linkedTableCellProps} />
|
|
39
|
-
<BlockProducerTableCell align="left" {...linkedTableCellProps} />
|
|
40
|
-
<BlockTransactionCountTableCell align="left" {...linkedTableCellProps} />
|
|
41
|
-
<BlockPayloadCountsTableCell align="left" {...linkedTableCellProps} />
|
|
42
|
-
<BlockVerificationTableCell deepValidation={deepValidation} {...defaultTableCellProps} />
|
|
43
|
-
<BlockJsonViewTableCell {...defaultTableCellProps} />
|
|
44
|
-
</StyledLinkableTableRow>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './TableRow.tsx'
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Autorenew,
|
|
3
|
-
Pause,
|
|
4
|
-
} from '@mui/icons-material'
|
|
5
|
-
import {
|
|
6
|
-
Alert,
|
|
7
|
-
AlertTitle,
|
|
8
|
-
Grow,
|
|
9
|
-
Icon, IconButton, Tooltip,
|
|
10
|
-
} from '@mui/material'
|
|
11
|
-
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
12
|
-
import { FlexRow } from '@xylabs/react-flexbox'
|
|
13
|
-
import React, { memo } from 'react'
|
|
14
|
-
|
|
15
|
-
import type { PollingState } from '../hooks/index.ts'
|
|
16
|
-
import { ChainAnalyzerStatsDialogFromContext } from '../stats/index.ts'
|
|
17
|
-
import { StyledPulseSvgIcon } from './PulseSvgIcon.tsx'
|
|
18
|
-
|
|
19
|
-
export interface PollingControlsFlexboxProps extends FlexBoxProps {
|
|
20
|
-
blocksBehind?: number
|
|
21
|
-
pollingState?: PollingState
|
|
22
|
-
setPollingState?: (newState: PollingState) => void
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const PollingControlsFlexbox: React.FC<PollingControlsFlexboxProps> = ({
|
|
26
|
-
blocksBehind, pollingState, setPollingState,
|
|
27
|
-
}) => {
|
|
28
|
-
const paused = pollingState === 'paused'
|
|
29
|
-
const running = pollingState === 'running'
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<FlexRow justifyContent="space-between" width="100%">
|
|
33
|
-
<FlexRow gap={2}>
|
|
34
|
-
{running
|
|
35
|
-
? (
|
|
36
|
-
<IconButton onClick={() => setPollingState?.('paused')} title="Pause Block Stream">
|
|
37
|
-
<Pause />
|
|
38
|
-
</IconButton>
|
|
39
|
-
)
|
|
40
|
-
: null}
|
|
41
|
-
{paused
|
|
42
|
-
? (
|
|
43
|
-
<IconButton onClick={() => setPollingState?.('running')} title="Re-Sync Block Stream">
|
|
44
|
-
<Autorenew />
|
|
45
|
-
</IconButton>
|
|
46
|
-
)
|
|
47
|
-
: null}
|
|
48
|
-
<ChainAnalyzerStatsDialogFromContext />
|
|
49
|
-
</FlexRow>
|
|
50
|
-
<FlexRow gap={2}>
|
|
51
|
-
<Grow in={(blocksBehind ?? 0) > 0}>
|
|
52
|
-
<Tooltip title="Click to Re-Sync">
|
|
53
|
-
<Alert
|
|
54
|
-
sx={{
|
|
55
|
-
py: 0, px: 1, cursor: 'pointer',
|
|
56
|
-
}}
|
|
57
|
-
severity="warning"
|
|
58
|
-
onClick={() => setPollingState?.('running')}
|
|
59
|
-
>
|
|
60
|
-
<AlertTitle sx={{ mb: 0 }}>
|
|
61
|
-
Behind:
|
|
62
|
-
{' '}
|
|
63
|
-
{blocksBehind}
|
|
64
|
-
</AlertTitle>
|
|
65
|
-
</Alert>
|
|
66
|
-
</Tooltip>
|
|
67
|
-
</Grow>
|
|
68
|
-
<Icon>
|
|
69
|
-
<StyledPulseSvgIcon className={running ? '' : 'paused'} />
|
|
70
|
-
</Icon>
|
|
71
|
-
</FlexRow>
|
|
72
|
-
</FlexRow>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export const MemoizedPollingControlsFlexbox = memo(PollingControlsFlexbox)
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createSvgIcon, keyframes, styled,
|
|
3
|
-
} from '@mui/material'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
|
|
6
|
-
// Adapted from - https://codepen.io/Taver/pen/PWyEqp
|
|
7
|
-
export const PulseSvgIcon = createSvgIcon(
|
|
8
|
-
<svg viewBox="0 0 80 80" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
9
|
-
<g transform="translate(34,34)">
|
|
10
|
-
<circle className="core" cx="0" cy="0" r="6"></circle>
|
|
11
|
-
<circle className="radar" cx="0" cy="0" r="6"></circle>
|
|
12
|
-
</g>
|
|
13
|
-
</svg>,
|
|
14
|
-
'PulseSvgIcon',
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
const pulse1 = keyframes`
|
|
18
|
-
0% {
|
|
19
|
-
opacity: 0;
|
|
20
|
-
transform: scale(0);
|
|
21
|
-
}
|
|
22
|
-
30% {
|
|
23
|
-
opacity: 1;
|
|
24
|
-
transform: scale(1.5);
|
|
25
|
-
}
|
|
26
|
-
60% {
|
|
27
|
-
opacity: 1;
|
|
28
|
-
transform: scale(2);
|
|
29
|
-
}
|
|
30
|
-
100% {
|
|
31
|
-
opacity: 0;
|
|
32
|
-
transform: scale(2);
|
|
33
|
-
}
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
const pulse2 = keyframes`
|
|
37
|
-
0% {
|
|
38
|
-
transform: scale(1, 1);
|
|
39
|
-
opacity: 0;
|
|
40
|
-
}
|
|
41
|
-
50% {
|
|
42
|
-
opacity: 1;
|
|
43
|
-
}
|
|
44
|
-
100% {
|
|
45
|
-
transform: scale(6, 6);
|
|
46
|
-
opacity: 0;
|
|
47
|
-
}
|
|
48
|
-
`
|
|
49
|
-
|
|
50
|
-
export const StyledPulseSvgIcon = styled(PulseSvgIcon)(({ theme }) => {
|
|
51
|
-
return {
|
|
52
|
-
'& .core': {
|
|
53
|
-
animation: `${pulse1} 1.25s ease-in-out infinite`,
|
|
54
|
-
fill: theme.vars.palette.success.main,
|
|
55
|
-
},
|
|
56
|
-
'&.paused .core': {
|
|
57
|
-
animation: 'none',
|
|
58
|
-
fill: theme.vars.palette.divider,
|
|
59
|
-
transform: 'scale(2)',
|
|
60
|
-
},
|
|
61
|
-
'& .radar': {
|
|
62
|
-
animation: `${pulse2} 1.25s ease-in-out infinite`,
|
|
63
|
-
fill: `color-mix(in srgb, ${theme.vars.palette.success.main}, transparent 50%)`,
|
|
64
|
-
},
|
|
65
|
-
'&.paused .radar': {
|
|
66
|
-
animation: 'none',
|
|
67
|
-
fill: theme.vars.palette.divider,
|
|
68
|
-
transform: 'scale(6)',
|
|
69
|
-
},
|
|
70
|
-
}
|
|
71
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { DialogProps } from '@mui/material'
|
|
2
|
-
import {
|
|
3
|
-
Button, Dialog, DialogActions, DialogContent,
|
|
4
|
-
} from '@mui/material'
|
|
5
|
-
import React from 'react'
|
|
6
|
-
|
|
7
|
-
export interface TransactionsDialogProps extends DialogProps {}
|
|
8
|
-
|
|
9
|
-
export const TransactionsDialog: React.FC<TransactionsDialogProps> = ({ onClose, ...props }) => {
|
|
10
|
-
return (
|
|
11
|
-
<Dialog onClose={onClose} {...props}>
|
|
12
|
-
<DialogContent>
|
|
13
|
-
Transactions Dialog
|
|
14
|
-
</DialogContent>
|
|
15
|
-
<DialogActions>
|
|
16
|
-
<Button variant="outlined" onClick={e => onClose?.(e, 'escapeKeyDown')}>Close</Button>
|
|
17
|
-
</DialogActions>
|
|
18
|
-
</Dialog>
|
|
19
|
-
)
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Dialog.tsx'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useOnBlock.ts'
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { HydratedBlock } from '@xyo-network/xl1-sdk'
|
|
2
|
-
import { useEffect, useRef } from 'react'
|
|
3
|
-
|
|
4
|
-
export type PollingState = 'paused' | 'running'
|
|
5
|
-
|
|
6
|
-
export const useOnBlock = (
|
|
7
|
-
initialHeadNumber?: number,
|
|
8
|
-
onAddBlock?: (block: HydratedBlock) => Promise<void>,
|
|
9
|
-
liveHead?: HydratedBlock,
|
|
10
|
-
pollingState?: PollingState,
|
|
11
|
-
) => {
|
|
12
|
-
/**
|
|
13
|
-
* blocksWhilePaused is a ref because we don't want to re-render the component when it changes.
|
|
14
|
-
* But, since we get new blockComponents regardless, the hook rerenders anyway so consumers can get
|
|
15
|
-
* the latest blocksWhilePaused value without having to rely on a state update.
|
|
16
|
-
*/
|
|
17
|
-
const blocksWhilePausedRef = useRef<HydratedBlock[]>([])
|
|
18
|
-
// Because the useEffect has liveHead AND pollingState, every time the polling state changes, the hook will
|
|
19
|
-
// run a second time with the live head from the previous run. This is why we need to keep track of the last
|
|
20
|
-
// live head so we can compare it to the current live head and prevent the hook from adding the same block twice
|
|
21
|
-
const lastLiveHeadRef = useRef<HydratedBlock | undefined>(liveHead)
|
|
22
|
-
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
const lastLiveHeadBlock = lastLiveHeadRef.current?.[0]
|
|
25
|
-
const blocksWhilePausedBlock = lastLiveHeadRef.current?.[0]
|
|
26
|
-
const liveHeadBlock = liveHead?.[0]
|
|
27
|
-
|
|
28
|
-
// use lastLiveHead to prevent the hook from adding the same block multiple times
|
|
29
|
-
if (lastLiveHeadBlock?.block === liveHeadBlock?.block) return
|
|
30
|
-
|
|
31
|
-
if (liveHead && onAddBlock) {
|
|
32
|
-
// update lastLiveHead
|
|
33
|
-
lastLiveHeadRef.current = liveHead
|
|
34
|
-
|
|
35
|
-
// if the polling state is paused and the block is new, add it to the blocksWhilePaused array
|
|
36
|
-
const isNewBlock = initialHeadNumber !== liveHeadBlock?.block && liveHeadBlock?.block !== blocksWhilePausedBlock?.block
|
|
37
|
-
if (pollingState === 'paused' && isNewBlock) {
|
|
38
|
-
blocksWhilePausedRef.current.push(liveHead)
|
|
39
|
-
} else if (pollingState === 'running') {
|
|
40
|
-
// if the polling state is running, add the blocksWhilePaused
|
|
41
|
-
if (blocksWhilePausedRef.current.length > 0) {
|
|
42
|
-
for (const block of blocksWhilePausedRef.current) {
|
|
43
|
-
void onAddBlock(block)
|
|
44
|
-
}
|
|
45
|
-
// clear the blocksWhilePaused array
|
|
46
|
-
blocksWhilePausedRef.current = []
|
|
47
|
-
}
|
|
48
|
-
// add the liveHead block
|
|
49
|
-
void onAddBlock(liveHead)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}, [initialHeadNumber, liveHead, onAddBlock, pollingState])
|
|
53
|
-
|
|
54
|
-
return blocksWhilePausedRef
|
|
55
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AnimatedList } from '@xylabs/react-animation'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import type { BlockListComponentProps } from '../../../types/index.ts'
|
|
5
|
-
import { BlockListWrapperFlexBox } from '../styled/index.ts'
|
|
6
|
-
|
|
7
|
-
export const BlockListAnimated: React.FC<BlockListComponentProps> = ({ blockChainRenderComponents }) => {
|
|
8
|
-
return (
|
|
9
|
-
<BlockListWrapperFlexBox
|
|
10
|
-
alignItems="stretch"
|
|
11
|
-
width="100%"
|
|
12
|
-
>
|
|
13
|
-
<AnimatedList
|
|
14
|
-
fullWidth
|
|
15
|
-
items={blockChainRenderComponents}
|
|
16
|
-
/>
|
|
17
|
-
</BlockListWrapperFlexBox>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React, { Fragment } from 'react'
|
|
2
|
-
|
|
3
|
-
import type { BlockListComponentProps } from '../../../types/index.ts'
|
|
4
|
-
import { BlockchainTableEx } from '../../block/index.ts'
|
|
5
|
-
|
|
6
|
-
export const BlockListTableEx: React.FC<BlockListComponentProps> = ({ blockChainRenderComponents }) => {
|
|
7
|
-
return (
|
|
8
|
-
<BlockchainTableEx>
|
|
9
|
-
{blockChainRenderComponents?.map(({ child, key }) => <Fragment key={key}>{child}</Fragment>)}
|
|
10
|
-
</BlockchainTableEx>
|
|
11
|
-
)
|
|
12
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TablePaginationActionsProps } from '@xyo-network/react-payload-table'
|
|
2
|
-
import { TablePaginationActions } from '@xyo-network/react-payload-table'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
export interface BlockChainPaginationProps extends TablePaginationActionsProps {}
|
|
6
|
-
|
|
7
|
-
export const BlockChainPagination: React.FC<BlockChainPaginationProps> = ({
|
|
8
|
-
count = 0, onPageChange, page, rowsPerPage = 10,
|
|
9
|
-
}) => {
|
|
10
|
-
return <TablePaginationActions count={count} onPageChange={onPageChange} page={page} rowsPerPage={rowsPerPage} />
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './usePagination.tsx'
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { MouseEvent } from 'react'
|
|
2
|
-
import { useMemo, useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import type { BlockChainRenderComponent } from '../../../../types/index.ts'
|
|
5
|
-
|
|
6
|
-
export const useChainPagination = (pageSize: number, blockComponents?: BlockChainRenderComponent[]) => {
|
|
7
|
-
const [page, setPage] = useState(0)
|
|
8
|
-
|
|
9
|
-
const paginatedBlockComponents = useMemo(() => {
|
|
10
|
-
const startIndex = page * pageSize
|
|
11
|
-
const endIndex = startIndex + pageSize
|
|
12
|
-
return blockComponents?.slice(startIndex, endIndex)
|
|
13
|
-
}, [blockComponents, page, pageSize])
|
|
14
|
-
|
|
15
|
-
const onPageChange = (_event: MouseEvent<HTMLButtonElement>, newPage: number) => {
|
|
16
|
-
setPage(newPage)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
onPageChange, page, paginatedBlockComponents,
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { QueryStats } from '@mui/icons-material'
|
|
2
|
-
import type { DialogProps } from '@mui/material'
|
|
3
|
-
import {
|
|
4
|
-
Dialog, DialogContent,
|
|
5
|
-
DialogTitle, IconButton,
|
|
6
|
-
} from '@mui/material'
|
|
7
|
-
import React, { useState } from 'react'
|
|
8
|
-
|
|
9
|
-
import { useChainAnalyzersContext } from '../../../context/index.ts'
|
|
10
|
-
import { BlockProducerStatsFlexbox } from './producer/index.ts'
|
|
11
|
-
|
|
12
|
-
export interface ChainAnalyzerStatsDialogProps extends DialogProps {}
|
|
13
|
-
|
|
14
|
-
export const ChainAnalyzerStatsDialog: React.FC<ChainAnalyzerStatsDialogProps> = (props) => {
|
|
15
|
-
const { analyzers, statsUpdated } = useChainAnalyzersContext()
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Dialog {...props}>
|
|
19
|
-
<DialogTitle>Chain Analysis</DialogTitle>
|
|
20
|
-
<DialogContent>
|
|
21
|
-
{statsUpdated > 0
|
|
22
|
-
? Object.entries(analyzers).map(([id, analyzer]) => (
|
|
23
|
-
<div key={id}>
|
|
24
|
-
{id === 'producers'
|
|
25
|
-
? (
|
|
26
|
-
<BlockProducerStatsFlexbox payload={analyzer.result()} />
|
|
27
|
-
)
|
|
28
|
-
: null}
|
|
29
|
-
</div>
|
|
30
|
-
))
|
|
31
|
-
: null}
|
|
32
|
-
</DialogContent>
|
|
33
|
-
</Dialog>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export const ChainAnalyzerStatsDialogFromContext: React.FC = (props) => {
|
|
38
|
-
const [open, setOpen] = useState(false)
|
|
39
|
-
const handleClose = () => setOpen(false)
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<>
|
|
43
|
-
<IconButton onClick={() => setOpen(true)}>
|
|
44
|
-
<QueryStats />
|
|
45
|
-
</IconButton>
|
|
46
|
-
<ChainAnalyzerStatsDialog onClose={handleClose} open={open} {...props} />
|
|
47
|
-
</>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Dialog.tsx'
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Typography } from '@mui/material'
|
|
2
|
-
import { ErrorRender } from '@xylabs/react-error'
|
|
3
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
4
|
-
import { isChainSummaryProducers } from '@xyo-network/chain-analyze'
|
|
5
|
-
import type { Payload } from '@xyo-network/sdk-js'
|
|
6
|
-
import React, { useMemo } from 'react'
|
|
7
|
-
|
|
8
|
-
import { ChainProducerStatsTable } from './Table.tsx'
|
|
9
|
-
|
|
10
|
-
export interface BlockProducerStatsFlexboxProps {
|
|
11
|
-
payload?: Payload
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const BlockProducerStatsFlexbox: React.FC<BlockProducerStatsFlexboxProps> = ({ payload, ...props }) => {
|
|
15
|
-
const [producer, producerError] = useMemo(() => {
|
|
16
|
-
if (payload) {
|
|
17
|
-
return isChainSummaryProducers(payload) ? [payload] : [undefined, new Error('Payload is not a Chain Producer')]
|
|
18
|
-
} else {
|
|
19
|
-
return []
|
|
20
|
-
}
|
|
21
|
-
}, [payload])
|
|
22
|
-
|
|
23
|
-
const producersArray = useMemo(() => Object.values(producer?.producers ?? {}), [producer])
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<FlexCol alignItems="start" gap={1} {...props}>
|
|
27
|
-
<ErrorRender error={producerError} scope="BlockProducerStatsFlexbox" />
|
|
28
|
-
<Typography fontSize="1rem">Block Producers</Typography>
|
|
29
|
-
<ChainProducerStatsTable producers={producersArray} />
|
|
30
|
-
</FlexCol>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { TableProps } from '@mui/material'
|
|
2
|
-
import {
|
|
3
|
-
Table, TableBody, TableCell, TableHead,
|
|
4
|
-
TableRow,
|
|
5
|
-
useTheme,
|
|
6
|
-
} from '@mui/material'
|
|
7
|
-
import type { AnalyzedProducer } from '@xyo-network/chain-analyze'
|
|
8
|
-
import { BlockiesAvatar } from '@xyo-network/react-chain-blockies'
|
|
9
|
-
import React from 'react'
|
|
10
|
-
|
|
11
|
-
export interface ChainProducerStatsTableProps extends TableProps {
|
|
12
|
-
producers?: AnalyzedProducer[]
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const ChainProducerStatsTable: React.FC<ChainProducerStatsTableProps> = ({ producers, ...props }) => {
|
|
16
|
-
const theme = useTheme()
|
|
17
|
-
return (
|
|
18
|
-
<Table {...props}>
|
|
19
|
-
<TableHead>
|
|
20
|
-
<TableRow>
|
|
21
|
-
<TableCell>Address</TableCell>
|
|
22
|
-
<TableCell>Blocks Produced</TableCell>
|
|
23
|
-
<TableCell>Rewards Earned Produced</TableCell>
|
|
24
|
-
</TableRow>
|
|
25
|
-
</TableHead>
|
|
26
|
-
<TableBody>
|
|
27
|
-
{producers?.map(producer => (
|
|
28
|
-
<TableRow key={producer.address}>
|
|
29
|
-
<TableCell>
|
|
30
|
-
<BlockiesAvatar blockiesOptions={{ seed: producer.address }} sx={{ height: theme.spacing(2.75), width: theme.spacing(2.75) }} />
|
|
31
|
-
</TableCell>
|
|
32
|
-
<TableCell>{producer.blocksProduced.toString()}</TableCell>
|
|
33
|
-
<TableCell>{producer.rewardsEarned.toString()}</TableCell>
|
|
34
|
-
</TableRow>
|
|
35
|
-
))}
|
|
36
|
-
</TableBody>
|
|
37
|
-
</Table>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { styled } from '@mui/material'
|
|
2
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
-
|
|
4
|
-
// Target the first visible child (first actual child is a hidden div) and hide the after pseudo element that visually links blocks together
|
|
5
|
-
export const BlockListWrapperFlexBox = styled(FlexCol, { name: 'BlockListWrapperFlexbox' })(() => ({
|
|
6
|
-
'& > div:nth-of-type(2) .block-heading-flexbox .divider-spacer': {
|
|
7
|
-
// hide the spacer for the first element
|
|
8
|
-
visibility: 'hidden',
|
|
9
|
-
},
|
|
10
|
-
'& > div:nth-of-type(2) .block-heading-flexbox .divider': {
|
|
11
|
-
// keep the first element divider at 0 height so we can animate it to the correct height
|
|
12
|
-
// when the next block comes in
|
|
13
|
-
height: 0,
|
|
14
|
-
},
|
|
15
|
-
}))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './BlockListWrapperFlexbox.tsx'
|
package/src/components/index.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
2
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
-
import { JsonViewerEx } from '@xyo-network/react-payload-raw-info'
|
|
4
|
-
import type { Payload } from '@xyo-network/sdk-js'
|
|
5
|
-
import type { ComponentType } from 'react'
|
|
6
|
-
import React, { useState } from 'react'
|
|
7
|
-
|
|
8
|
-
import type { PayloadBuilderComponentProps } from './BuilderComponentProps.ts'
|
|
9
|
-
|
|
10
|
-
export interface PayloadBuilderFlexboxProps extends PayloadBuilderComponentProps, FlexBoxProps {
|
|
11
|
-
BuilderComponent: ComponentType<PayloadBuilderComponentProps>
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const PayloadBuilderFlexbox: React.FC<PayloadBuilderFlexboxProps> = ({
|
|
15
|
-
BuilderComponent, onBuild, ...props
|
|
16
|
-
}) => {
|
|
17
|
-
const [payload, setPayload] = useState<Payload>()
|
|
18
|
-
|
|
19
|
-
const onBuildLocal = (payload: Payload) => {
|
|
20
|
-
onBuild?.(payload)
|
|
21
|
-
setPayload(payload)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<FlexCol gap={2} {...props}>
|
|
26
|
-
<BuilderComponent onBuild={onBuildLocal} />
|
|
27
|
-
{payload ? <JsonViewerEx value={payload} /> : null}
|
|
28
|
-
</FlexCol>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import { ProducerIntentBuilderFlexbox } from './Flexbox.tsx'
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Payload/Builder/ProducerIntent',
|
|
8
|
-
component: ProducerIntentBuilderFlexbox,
|
|
9
|
-
} as Meta
|
|
10
|
-
|
|
11
|
-
const Template: StoryFn<typeof ProducerIntentBuilderFlexbox> = args => <ProducerIntentBuilderFlexbox {...args} />
|
|
12
|
-
|
|
13
|
-
export const Default = Template.bind({})
|
|
14
|
-
Default.args = {}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
import type { PayloadBuilderComponentProps } from '../BuilderComponentProps.ts'
|
|
4
|
-
import { PayloadBuilderFlexbox } from '../Flexbox.tsx'
|
|
5
|
-
import { ProducerIntentBuilderForm } from './Form.tsx'
|
|
6
|
-
|
|
7
|
-
export const ProducerIntentBuilderFlexbox: React.FC<PayloadBuilderComponentProps> = ({ onBuild, ...props }) => (
|
|
8
|
-
<PayloadBuilderFlexbox
|
|
9
|
-
gap={4}
|
|
10
|
-
alignItems="start"
|
|
11
|
-
BuilderComponent={ProducerIntentBuilderForm}
|
|
12
|
-
onBuild={onBuild}
|
|
13
|
-
{...props}
|
|
14
|
-
/>
|
|
15
|
-
)
|