@xyo-network/react-chain-blockchain 1.16.2 → 1.16.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/react-chain-blockchain",
4
- "version": "1.16.2",
4
+ "version": "1.16.4",
5
5
  "description": "XYO Layer One React SDK Blockchain",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -60,30 +60,30 @@
60
60
  "@xylabs/react-shared": "~7.1.8",
61
61
  "@xylabs/react-theme": "~7.1.8",
62
62
  "@xylabs/typeof": "~5.0.22",
63
- "@xyo-network/account": "~5.1.18",
64
- "@xyo-network/archivist-memory": "~5.1.18",
65
- "@xyo-network/archivist-model": "~5.1.18",
66
- "@xyo-network/boundwitness-builder": "~5.1.18",
67
- "@xyo-network/boundwitness-model": "~5.1.18",
68
- "@xyo-network/bridge-http": "~5.1.18",
69
- "@xyo-network/chain-analyze": "~1.16.2",
70
- "@xyo-network/chain-protocol": "~1.16.2",
71
- "@xyo-network/chain-services": "~1.16.2",
72
- "@xyo-network/chain-utils": "~1.16.2",
73
- "@xyo-network/chain-wrappers": "~1.16.2",
74
- "@xyo-network/module-model": "~5.1.18",
75
- "@xyo-network/payload-builder": "~5.1.18",
76
- "@xyo-network/payload-model": "~5.1.18",
63
+ "@xyo-network/account": "~5.1.19",
64
+ "@xyo-network/archivist-memory": "~5.1.19",
65
+ "@xyo-network/archivist-model": "~5.1.19",
66
+ "@xyo-network/boundwitness-builder": "~5.1.19",
67
+ "@xyo-network/boundwitness-model": "~5.1.19",
68
+ "@xyo-network/bridge-http": "~5.1.19",
69
+ "@xyo-network/chain-analyze": "~1.16.4",
70
+ "@xyo-network/chain-protocol": "~1.16.4",
71
+ "@xyo-network/chain-services": "~1.16.4",
72
+ "@xyo-network/chain-utils": "~1.16.4",
73
+ "@xyo-network/chain-wrappers": "~1.16.4",
74
+ "@xyo-network/module-model": "~5.1.19",
75
+ "@xyo-network/payload-builder": "~5.1.19",
76
+ "@xyo-network/payload-model": "~5.1.19",
77
77
  "@xyo-network/react-boundwitness-plugin": "~7.3.10",
78
- "@xyo-network/react-chain-blockies": "~1.16.2",
79
- "@xyo-network/react-chain-shared": "~1.16.2",
78
+ "@xyo-network/react-chain-blockies": "~1.16.4",
79
+ "@xyo-network/react-chain-shared": "~1.16.4",
80
80
  "@xyo-network/react-event": "~7.3.10",
81
81
  "@xyo-network/react-payload-raw-info": "~7.3.10",
82
82
  "@xyo-network/react-payload-table": "~7.3.10",
83
83
  "@xyo-network/react-shared": "~7.3.10",
84
84
  "@xyo-network/react-table": "~7.3.10",
85
85
  "@xyo-network/xl1-protocol": "~1.13.1",
86
- "@xyo-network/xl1-protocol-sdk": "~1.16.2"
86
+ "@xyo-network/xl1-protocol-sdk": "~1.16.4"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@emotion/react": "~11.14.0",
@@ -97,7 +97,7 @@
97
97
  "@xylabs/tsconfig": "~7.2.8",
98
98
  "@xylabs/tsconfig-dom": "~7.2.8",
99
99
  "@xylabs/tsconfig-react": "~7.2.8",
100
- "@xyo-network/api-models": "~5.1.18",
100
+ "@xyo-network/api-models": "~5.1.19",
101
101
  "eslint": "^9.39.1",
102
102
  "react": "~19.2.0",
103
103
  "react-dom": "~19.2.0",
@@ -18,20 +18,24 @@ const formatProducerAddress = (address?: string): string | undefined => {
18
18
  export interface BlockProducerChipProps extends ChipProps {
19
19
  block?: HydratedBlock
20
20
  }
21
- export const BlockProducerChip: React.FC<BlockProducerChipProps> = ({
22
- block, sx, ...props
23
- }) => {
21
+ export const BlockProducerChip: React.FC<BlockProducerChipProps> = ({ block, ...props }) => {
24
22
  const blockProducer = block?.[0].addresses[0]
25
23
 
26
- const shortedBlockProducer = blockProducer === undefined ? null : formatProducerAddress(blockProducer)
24
+ return <BlockAddressChip address={blockProducer} toolTipTitle={`Block producer: ${blockProducer}`} {...props} />
25
+ }
26
+
27
+ export const BlockAddressChip: React.FC<BlockProducerChipProps & { address?: string; toolTipTitle?: string }> = ({
28
+ address, sx, toolTipTitle, ...props
29
+ }) => {
30
+ const shortedBlockProducer = address === undefined ? null : formatProducerAddress(address)
27
31
 
28
- const avatar = useMemo(() => blockProducer === '' ? undefined : <BlockiesAvatar blockiesOptions={{ seed: blockProducer }} />, [blockProducer])
32
+ const avatar = useMemo(() => address === '' ? undefined : <BlockiesAvatar blockiesOptions={{ seed: address }} />, [address])
29
33
 
30
34
  return (
31
35
  <Chip
32
36
  avatar={avatar}
33
37
  label={shortedBlockProducer ?? <ChipSkeleton width={115} />}
34
- title={`Block producer: ${blockProducer}`}
38
+ title={toolTipTitle}
35
39
  sx={{
36
40
  fontFamily: 'monospace', cursor: 'pointer', ...sx,
37
41
  }}
@@ -13,6 +13,12 @@ export const BlockNumberTableCell: React.FC<BlockNumberTableCellProps> = ({
13
13
  }) => {
14
14
  const blockNumber = block?.[0].block
15
15
 
16
+ return <BlockNumberTableCellInner blockNumber={blockNumber} linked={linked} {...props} />
17
+ }
18
+
19
+ export const BlockNumberTableCellInner: React.FC<BlockNumberTableCellProps & { blockNumber?: number }> = ({
20
+ blockNumber, linked, ...props
21
+ }) => {
16
22
  return (
17
23
  <TableCell {...props}>
18
24
  <Tooltip title={`Block Number: ${blockNumber}`}>
@@ -29,3 +29,20 @@ export const BlockEpochTableCell: React.FC<BlockEpochTableCellProps> = ({
29
29
  </TableCell>
30
30
  )
31
31
  }
32
+
33
+ export const BlockEpochTableCellInner: React.FC<BlockEpochTableCellProps & { epoch?: number }> = ({
34
+ epoch, linked, ...props
35
+ }) => {
36
+ const dateTime = dateFormat.format(epoch)
37
+ const age = isDefined(epoch) ? timeAgo(epoch) : undefined
38
+
39
+ return (
40
+ <TableCell {...props}>
41
+ <Tooltip title={`Block Epoch: ${dateTime}`}>
42
+ <Typography component="span" variant="body1">
43
+ {age ?? <Skeleton width={115} /> }
44
+ </Typography>
45
+ </Tooltip>
46
+ </TableCell>
47
+ )
48
+ }
@@ -1,10 +1,11 @@
1
1
  import { TableCell, Tooltip } from '@mui/material'
2
- import React from 'react'
2
+ import type { MouseEvent } from 'react'
3
+ import React, { useState } from 'react'
3
4
 
4
5
  import { FeatureNotAvailable } from '../../../FeatureNotAvailable.tsx'
5
6
  import { useBlockProducer } from '../../hooks/index.ts'
6
7
  import type { BlockProducerChipProps } from '../../ProducerChip.tsx'
7
- import { BlockProducerChip } from '../../ProducerChip.tsx'
8
+ import { BlockAddressChip } from '../../ProducerChip.tsx'
8
9
  import { useLinkedBlockItem } from './hooks/index.ts'
9
10
  import type { BlockTableCellProps } from './lib/index.ts'
10
11
 
@@ -18,12 +19,41 @@ export const BlockProducerTableCell: React.FC<BlockProducerTableCell> = ({
18
19
  }) => {
19
20
  const [ref, handleClick] = useLinkedBlockItem('block-producer', JSON.stringify(block))
20
21
  const producer = useBlockProducer(block)
21
- const [notAvailable, setNotAvailable] = React.useState(false)
22
22
 
23
23
  return (
24
- <TableCell ref={ref} {...props}>
25
- <Tooltip title={`Block Producer: ${producer}`}>
26
- <BlockProducerChip sx={{ cursor: 'pointer' }} onClick={linked ? handleClick : () => setNotAvailable(true)} block={block} {...producerChipProps} />
24
+ <BlockProducerTableCellInner
25
+ address={producer}
26
+ handleClick={handleClick}
27
+ linked={linked}
28
+ notAvailableDialog={notAvailableDialog}
29
+ producerChipProps={producerChipProps}
30
+ {...props}
31
+ ref={ref}
32
+ />
33
+ )
34
+ }
35
+
36
+ export interface BlockProducerTableCellInner extends BlockTableCellProps {
37
+ address?: string
38
+ handleClick?: (event: MouseEvent) => void
39
+ notAvailableDialog?: boolean
40
+ producerChipProps?: BlockProducerChipProps
41
+ }
42
+
43
+ export const BlockProducerTableCellInner: React.FC<BlockProducerTableCell & BlockProducerTableCellInner> = ({
44
+ address, handleClick, linked, notAvailableDialog, producerChipProps, ...props
45
+ }) => {
46
+ const [notAvailable, setNotAvailable] = useState(false)
47
+ return (
48
+ <TableCell {...props}>
49
+ <Tooltip title={`Block Producer: ${address}`}>
50
+ <BlockAddressChip
51
+ sx={{ cursor: 'pointer' }}
52
+ onClick={linked ? handleClick : () => setNotAvailable(true)}
53
+ address={address}
54
+ toolTipTitle={`Block Producer: ${address}`}
55
+ {...producerChipProps}
56
+ />
27
57
  </Tooltip>
28
58
  {(notAvailableDialog && notAvailable)
29
59
  ? <FeatureNotAvailable featureName="Producer Details" open={notAvailable} onClick={() => setNotAvailable(false)} />