@xyo-network/react-chain-blockchain 1.16.9 → 1.16.10

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.
Files changed (46) hide show
  1. package/dist/browser/components/account/BalanceHistoryFlexbox.d.ts +11 -0
  2. package/dist/browser/components/account/BalanceHistoryFlexbox.d.ts.map +1 -0
  3. package/dist/browser/components/account/BalanceHistoryFlexbox.stories.d.ts +6 -0
  4. package/dist/browser/components/account/BalanceHistoryFlexbox.stories.d.ts.map +1 -0
  5. package/dist/browser/components/account/index.d.ts +3 -0
  6. package/dist/browser/components/account/index.d.ts.map +1 -0
  7. package/dist/browser/components/account/table/AddressTableCell.d.ts +8 -0
  8. package/dist/browser/components/account/table/AddressTableCell.d.ts.map +1 -0
  9. package/dist/browser/components/account/table/BalanceHistoryTable.d.ts +9 -0
  10. package/dist/browser/components/account/table/BalanceHistoryTable.d.ts.map +1 -0
  11. package/dist/browser/components/account/table/BalanceHistoryTable.stories.d.ts +7 -0
  12. package/dist/browser/components/account/table/BalanceHistoryTable.stories.d.ts.map +1 -0
  13. package/dist/browser/components/account/table/BalanceHistoryTableRow.d.ts +8 -0
  14. package/dist/browser/components/account/table/BalanceHistoryTableRow.d.ts.map +1 -0
  15. package/dist/browser/components/account/table/RawAmountTableCell.d.ts +9 -0
  16. package/dist/browser/components/account/table/RawAmountTableCell.d.ts.map +1 -0
  17. package/dist/browser/components/account/table/index.d.ts +5 -0
  18. package/dist/browser/components/account/table/index.d.ts.map +1 -0
  19. package/dist/browser/components/account/table/types/index.d.ts +9 -0
  20. package/dist/browser/components/account/table/types/index.d.ts.map +1 -0
  21. package/dist/browser/components/block/helpers/blockProducer.d.ts +1 -3
  22. package/dist/browser/components/block/helpers/blockProducer.d.ts.map +1 -1
  23. package/dist/browser/components/block/hooks/useBlockProducer.d.ts +1 -3
  24. package/dist/browser/components/block/hooks/useBlockProducer.d.ts.map +1 -1
  25. package/dist/browser/components/block/table/cell/BlockNumber.d.ts +1 -0
  26. package/dist/browser/components/block/table/cell/BlockNumber.d.ts.map +1 -1
  27. package/dist/browser/components/index.d.ts +1 -0
  28. package/dist/browser/components/index.d.ts.map +1 -1
  29. package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts +3 -9
  30. package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
  31. package/dist/browser/index.mjs +454 -267
  32. package/dist/browser/index.mjs.map +1 -1
  33. package/package.json +25 -21
  34. package/src/components/account/BalanceHistoryFlexbox.stories.tsx +25 -0
  35. package/src/components/account/BalanceHistoryFlexbox.tsx +65 -0
  36. package/src/components/account/index.ts +2 -0
  37. package/src/components/account/table/AddressTableCell.tsx +25 -0
  38. package/src/components/account/table/BalanceHistoryTable.stories.tsx +75 -0
  39. package/src/components/account/table/BalanceHistoryTable.tsx +36 -0
  40. package/src/components/account/table/BalanceHistoryTableRow.tsx +41 -0
  41. package/src/components/account/table/RawAmountTableCell.tsx +53 -0
  42. package/src/components/account/table/index.ts +4 -0
  43. package/src/components/account/table/types/index.ts +17 -0
  44. package/src/components/block/table/Ex.stories.tsx +1 -1
  45. package/src/components/block/table/cell/BlockNumber.tsx +8 -3
  46. package/src/components/index.ts +1 -0
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.9",
4
+ "version": "1.16.10",
5
5
  "description": "XYO Layer One React SDK Blockchain",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -45,13 +45,13 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@storybook/react-vite": "~10.0.7",
48
- "@xylabs/assert": "~5.0.24",
49
- "@xylabs/axios": "~5.0.24",
50
- "@xylabs/delay": "~5.0.24",
51
- "@xylabs/eth-address": "~5.0.24",
52
- "@xylabs/exists": "~5.0.24",
53
- "@xylabs/hex": "~5.0.24",
54
- "@xylabs/promise": "~5.0.24",
48
+ "@xylabs/assert": "~5.0.25",
49
+ "@xylabs/axios": "~5.0.25",
50
+ "@xylabs/delay": "~5.0.25",
51
+ "@xylabs/eth-address": "~5.0.25",
52
+ "@xylabs/exists": "~5.0.25",
53
+ "@xylabs/hex": "~5.0.25",
54
+ "@xylabs/promise": "~5.0.25",
55
55
  "@xylabs/react-animation": "~7.1.8",
56
56
  "@xylabs/react-error": "~7.1.8",
57
57
  "@xylabs/react-flexbox": "~7.1.8",
@@ -59,31 +59,33 @@
59
59
  "@xylabs/react-quick-tip-button": "~7.1.8",
60
60
  "@xylabs/react-shared": "~7.1.8",
61
61
  "@xylabs/react-theme": "~7.1.8",
62
- "@xylabs/typeof": "~5.0.24",
62
+ "@xylabs/typeof": "~5.0.25",
63
63
  "@xyo-network/account": "~5.1.21",
64
64
  "@xyo-network/archivist-memory": "~5.1.21",
65
65
  "@xyo-network/archivist-model": "~5.1.21",
66
66
  "@xyo-network/boundwitness-builder": "~5.1.21",
67
67
  "@xyo-network/boundwitness-model": "~5.1.21",
68
68
  "@xyo-network/bridge-http": "~5.1.21",
69
- "@xyo-network/chain-analyze": "~1.16.9",
70
- "@xyo-network/chain-protocol": "~1.16.9",
71
- "@xyo-network/chain-services": "~1.16.9",
72
- "@xyo-network/chain-utils": "~1.16.9",
73
- "@xyo-network/chain-wrappers": "~1.16.9",
69
+ "@xyo-network/chain-analyze": "~1.16.10",
70
+ "@xyo-network/chain-protocol": "~1.16.10",
71
+ "@xyo-network/chain-services": "~1.16.10",
72
+ "@xyo-network/chain-utils": "~1.16.10",
73
+ "@xyo-network/chain-wrappers": "~1.16.10",
74
74
  "@xyo-network/module-model": "~5.1.21",
75
75
  "@xyo-network/payload-builder": "~5.1.21",
76
76
  "@xyo-network/payload-model": "~5.1.21",
77
77
  "@xyo-network/react-boundwitness-plugin": "~7.3.10",
78
- "@xyo-network/react-chain-blockies": "~1.16.9",
79
- "@xyo-network/react-chain-shared": "~1.16.9",
78
+ "@xyo-network/react-chain-blockies": "~1.16.10",
79
+ "@xyo-network/react-chain-provider": "~1.16.10",
80
+ "@xyo-network/react-chain-shared": "~1.16.10",
81
+ "@xyo-network/react-error": "~7.3.10",
80
82
  "@xyo-network/react-event": "~7.3.10",
81
83
  "@xyo-network/react-payload-raw-info": "~7.3.10",
82
84
  "@xyo-network/react-payload-table": "~7.3.10",
83
85
  "@xyo-network/react-shared": "~7.3.10",
84
86
  "@xyo-network/react-table": "~7.3.10",
85
- "@xyo-network/xl1-protocol": "~1.13.6",
86
- "@xyo-network/xl1-protocol-sdk": "~1.16.9"
87
+ "@xyo-network/xl1-protocol": "~1.13.11",
88
+ "@xyo-network/xl1-protocol-sdk": "~1.16.10"
87
89
  },
88
90
  "devDependencies": {
89
91
  "@emotion/react": "~11.14.0",
@@ -91,17 +93,19 @@
91
93
  "@mui/icons-material": "~7.3.5",
92
94
  "@mui/material": "~7.3.5",
93
95
  "@types/react": "~19.2.4",
94
- "@xylabs/creatable": "~5.0.24",
95
- "@xylabs/hex": "~5.0.24",
96
+ "@xylabs/creatable": "~5.0.25",
97
+ "@xylabs/hex": "~5.0.25",
96
98
  "@xylabs/ts-scripts-yarn3": "~7.2.8",
97
99
  "@xylabs/tsconfig": "~7.2.8",
98
100
  "@xylabs/tsconfig-dom": "~7.2.8",
99
101
  "@xylabs/tsconfig-react": "~7.2.8",
100
102
  "@xyo-network/api-models": "~5.1.21",
103
+ "@xyo-network/xl1-network-model": "~1.16.10",
104
+ "@xyo-network/xl1-rpc": "~1.16.10",
101
105
  "eslint": "^9.39.1",
102
106
  "react": "~19.2.0",
103
107
  "react-dom": "~19.2.0",
104
- "react-router-dom": "^7.9.5",
108
+ "react-router-dom": "^7.9.6",
105
109
  "storybook": "~10.0.7",
106
110
  "typescript": "~5.9.3"
107
111
  },
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryFn } from '@storybook/react-vite'
2
+ import type { Address } from '@xylabs/hex'
3
+ import { useHttpRpcViewer } from '@xyo-network/react-chain-provider'
4
+ import { LocalNetwork } from '@xyo-network/xl1-network-model'
5
+ import React from 'react'
6
+
7
+ import { AccountBalanceHistoryFlexBox } from './BalanceHistoryFlexbox.tsx'
8
+
9
+ export default {
10
+ title: 'AccountBalanceHistory/FlexBox',
11
+ component: AccountBalanceHistoryFlexBox,
12
+ } as Meta
13
+
14
+ const Template: StoryFn<typeof AccountBalanceHistoryFlexBox> = (args) => {
15
+ const viewer = useHttpRpcViewer(LocalNetwork.url)
16
+ return <AccountBalanceHistoryFlexBox viewer={viewer} {...args} />
17
+ }
18
+
19
+ const Default = Template.bind({})
20
+ Default.args = {
21
+ address: '2b1a21d8c90e658d8bf1e2aad31c8dc892c353c1' as Address,
22
+ refresh: 0,
23
+ }
24
+
25
+ export { Default }
@@ -0,0 +1,65 @@
1
+ import { Typography } from '@mui/material'
2
+ import { type Address } from '@xylabs/hex'
3
+ import type { FlexBoxProps } from '@xylabs/react-flexbox'
4
+ import { FlexCol } from '@xylabs/react-flexbox'
5
+ import { isDefined } from '@xylabs/typeof'
6
+ import { useAccountBalanceHistory } from '@xyo-network/react-chain-provider'
7
+ import { ErrorRender } from '@xyo-network/react-error'
8
+ import { AttoXL1, XL1Amount } from '@xyo-network/xl1-protocol'
9
+ import type { XyoViewer } from '@xyo-network/xl1-protocol-sdk'
10
+ import React from 'react'
11
+
12
+ import { AccountBalanceHistoryTable } from './table/index.ts'
13
+
14
+ export interface AccountBalanceHistoryFlexBoxProps extends FlexBoxProps {
15
+ address?: Address
16
+ refresh?: number
17
+ viewer?: XyoViewer
18
+ }
19
+
20
+ export const AccountBalanceHistoryFlexBox: React.FC<AccountBalanceHistoryFlexBoxProps> = ({
21
+ address, refresh, viewer, ...props
22
+ }) => {
23
+ const [results, error] = useAccountBalanceHistory(address, viewer, refresh)
24
+ const {
25
+ history, balance, truncated,
26
+ } = results || { balance: [AttoXL1(0n), AttoXL1(0n)], history: undefined }
27
+
28
+ const formatBalance = (balance: bigint) => {
29
+ const xl1Amount = new XL1Amount(balance)
30
+ return xl1Amount.toString(undefined, {
31
+ places: 18, maxDecimal: 12, maxCharacters: 12, minDecimals: 1, locale: navigator.language,
32
+ })
33
+ }
34
+
35
+ const formatBalanceMagnitude = (set: [AttoXL1, AttoXL1]) => {
36
+ const [received, sent] = set
37
+ const netBalance = received - sent
38
+ return netBalance < 0n ? `-${formatBalance(sent - received)}` : formatBalance(netBalance)
39
+ }
40
+
41
+ return isDefined(history) && isDefined(address)
42
+ ? (
43
+ <FlexCol {...props}>
44
+ <ErrorRender error={error} scope="AccountBalanceHistoryTable" />
45
+ <Typography variant="h6" gutterBottom>
46
+ {formatBalanceMagnitude(balance)}
47
+ </Typography>
48
+ {truncated
49
+ ? (
50
+ <Typography variant="caption" gutterBottom>
51
+ Ranged Balance from
52
+ {' '}
53
+ {history.at(-1)!.blockNumber}
54
+ {' '}
55
+ -
56
+ {' '}
57
+ {history[0].blockNumber}
58
+ </Typography>
59
+ )
60
+ : null}
61
+ <AccountBalanceHistoryTable history={history} />
62
+ </FlexCol>
63
+ )
64
+ : null
65
+ }
@@ -0,0 +1,2 @@
1
+ export * from './BalanceHistoryFlexbox.tsx'
2
+ export * from './table/index.ts'
@@ -0,0 +1,25 @@
1
+ import type { TableCellProps } from '@mui/material'
2
+ import { TableCell, Tooltip } from '@mui/material'
3
+ import { useEvent } from '@xyo-network/react-event'
4
+
5
+ import { BlockAddressChip } from '../../block/index.ts'
6
+
7
+ export interface AddressTableCellProps extends TableCellProps {
8
+ address?: string
9
+ linked?: boolean
10
+ toolTipTitle?: string
11
+ }
12
+
13
+ export const AddressTableCell: React.FC<AddressTableCellProps> = ({
14
+ address, linked, toolTipTitle, sx, ...props
15
+ }) => {
16
+ const [ref, dispatch] = useEvent()
17
+ const handleClick = () => dispatch('address', 'click', address)
18
+ return (
19
+ <TableCell ref={ref} sx={{ cursor: linked ? 'pointer' : 'default', ...sx }} {...props}>
20
+ <Tooltip title={toolTipTitle}>
21
+ <BlockAddressChip address={address} onClick={handleClick} />
22
+ </Tooltip>
23
+ </TableCell>
24
+ )
25
+ }
@@ -0,0 +1,75 @@
1
+ import {
2
+ Alert, AlertTitle, LinearProgress, Snackbar,
3
+ } from '@mui/material'
4
+ import type { Meta, StoryFn } from '@storybook/react-vite'
5
+ import type { Address } from '@xylabs/hex'
6
+ import { useAccountBalanceHistory, useHttpRpcViewer } from '@xyo-network/react-chain-provider'
7
+ import { ErrorRender } from '@xyo-network/react-error'
8
+ import type { Event } from '@xyo-network/react-event'
9
+ import { useEvent } from '@xyo-network/react-event'
10
+ import { LocalNetwork } from '@xyo-network/xl1-network-model'
11
+ import React, { useState } from 'react'
12
+
13
+ import { AccountBalanceHistoryTable } from './BalanceHistoryTable.tsx'
14
+
15
+ export default {
16
+ title: 'AccountBalanceHistory/Table',
17
+ component: AccountBalanceHistoryTable,
18
+ } as Meta
19
+
20
+ const TEST_ADDRESS = 'aa9401662e9cd3ce8bb8a6ab92a35ed83e85ac67' as Address
21
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
+ const TEST_ADDRESS_1 = '2b1a21d8c90e658d8bf1e2aad31c8dc892c353c1' as Address
23
+
24
+ const useFetchBalanceHistory = (address?: Address) => {
25
+ const viewer = useHttpRpcViewer(LocalNetwork.url)
26
+ return useAccountBalanceHistory(address, viewer)
27
+ }
28
+
29
+ const Template: StoryFn<typeof AccountBalanceHistoryTable> = (args) => {
30
+ const results = useFetchBalanceHistory(TEST_ADDRESS)
31
+ const [history, error, loading] = results
32
+ return (
33
+ <>
34
+ <ErrorRender error={error} scope="AccountBalanceHistoryTableStory" />
35
+ {loading === 'pending' ? <LinearProgress /> : null}
36
+ <AccountBalanceHistoryTable history={history?.history} {...args} />
37
+ </>
38
+ )
39
+ }
40
+
41
+ const TemplateLinked: StoryFn<typeof AccountBalanceHistoryTable> = (args) => {
42
+ const [event, setEvent] = useState<Event>()
43
+ const [ref] = useEvent<HTMLTableElement>((noun, verb, data) => setEvent({
44
+ noun, verb, data,
45
+ }))
46
+
47
+ const results = useFetchBalanceHistory(TEST_ADDRESS)
48
+ const [history, error, loading] = results
49
+
50
+ return (
51
+ <>
52
+ <ErrorRender error={error} scope="AccountBalanceHistoryTableStory" />
53
+ {loading === 'pending' ? <LinearProgress /> : null}
54
+ <AccountBalanceHistoryTable history={history?.history} ref={ref} {...args} />
55
+ <Snackbar autoHideDuration={5000} open={!!event} onClose={() => setEvent(undefined)}>
56
+ <Alert>
57
+ <AlertTitle>
58
+ Event -
59
+ {' '}
60
+ {event?.noun}
61
+ </AlertTitle>
62
+ <pre>{JSON.stringify(event, null, 2)}</pre>
63
+ </Alert>
64
+ </Snackbar>
65
+ </>
66
+ )
67
+ }
68
+
69
+ const Default = Template.bind({})
70
+ Default.args = {}
71
+
72
+ const WithLinked = TemplateLinked.bind({})
73
+ WithLinked.args = { linked: true }
74
+
75
+ export { Default, WithLinked }
@@ -0,0 +1,36 @@
1
+ import type { TableProps } from '@mui/material'
2
+ import {
3
+ Table, TableBody, TableCell, TableHead, TableRow,
4
+ } from '@mui/material'
5
+ import { isDefined } from '@xylabs/typeof'
6
+ import type { AccountBalanceHistoryItemFormatted } from '@xyo-network/react-chain-provider'
7
+ import React from 'react'
8
+
9
+ import { BalanceHistoryTableRow } from './BalanceHistoryTableRow.tsx'
10
+ import { TableHeadingLabels } from './types/index.ts'
11
+
12
+ export interface AccountBalanceHistoryTableProps extends TableProps {
13
+ history?: AccountBalanceHistoryItemFormatted[]
14
+ linked?: boolean
15
+ }
16
+
17
+ export const AccountBalanceHistoryTable: React.FC<AccountBalanceHistoryTableProps> = ({
18
+ history, linked, ...props
19
+ }) => {
20
+ return isDefined(history)
21
+ ? (
22
+ <Table {...props}>
23
+ <TableHead>
24
+ <TableRow>
25
+ {TableHeadingLabels.map(heading => (
26
+ <TableCell key={heading}>{heading}</TableCell>
27
+ ))}
28
+ </TableRow>
29
+ </TableHead>
30
+ <TableBody>
31
+ {history?.map(row => <BalanceHistoryTableRow key={row.key} linked={linked} row={row} />)}
32
+ </TableBody>
33
+ </Table>
34
+ )
35
+ : null
36
+ }
@@ -0,0 +1,41 @@
1
+ import {
2
+ TableCell, TableRow, type TableRowProps,
3
+ } from '@mui/material'
4
+ import type { AccountBalanceHistoryItemFormatted } from '@xyo-network/react-chain-provider'
5
+ import { RawInfoIconButton } from '@xyo-network/react-payload-raw-info'
6
+ import type { JsonValue } from '@xyo-network/xl1-rpc'
7
+ import { useMemo } from 'react'
8
+
9
+ import { BlockEpochTableCellInner, BlockNumberTableCellInner } from '../../block/index.ts'
10
+ import { AddressTableCell } from './AddressTableCell.tsx'
11
+ import { RawAmountTableCell } from './RawAmountTableCell.tsx'
12
+
13
+ export interface BalanceHistoryTableRowProps extends TableRowProps {
14
+ linked?: boolean
15
+ row: AccountBalanceHistoryItemFormatted
16
+ }
17
+
18
+ export const BalanceHistoryTableRow: React.FC<BalanceHistoryTableRowProps> = ({
19
+ linked, row, ...props
20
+ }) => {
21
+ const {
22
+ amount, blockNumber, debug, from, key, timestamp, to, type, txHash,
23
+ } = row ?? {}
24
+
25
+ const linkedTableCallProps = useMemo(() => ({ linked }), [linked])
26
+
27
+ return (
28
+ <TableRow key={key} {...props}>
29
+ <TableCell>{txHash || 'N/A'}</TableCell>
30
+ <BlockNumberTableCellInner blockNumber={blockNumber} {...linkedTableCallProps} />
31
+ <BlockEpochTableCellInner epoch={timestamp} {...linkedTableCallProps} />
32
+ <AddressTableCell address={from} toolTipTitle={`From Address: ${from}`} {...linkedTableCallProps} />
33
+ <AddressTableCell address={to} toolTipTitle={`To Address: ${to}`} {...linkedTableCallProps} />
34
+ {/* Intentionally not passing linked prop here till we know where a link would go */}
35
+ <RawAmountTableCell amount={amount} type={type} />
36
+ <TableCell>
37
+ <RawInfoIconButton rawValue={debug as JsonValue} />
38
+ </TableCell>
39
+ </TableRow>
40
+ )
41
+ }
@@ -0,0 +1,53 @@
1
+ import {
2
+ Link,
3
+ TableCell, type TableCellProps, Tooltip,
4
+ } from '@mui/material'
5
+ import { toHex } from '@xylabs/hex'
6
+ import { isDefined } from '@xylabs/typeof'
7
+ import type { BalanceTransactionType } from '@xyo-network/react-chain-provider'
8
+ import { useEvent } from '@xyo-network/react-event'
9
+ import { XL1Amount } from '@xyo-network/xl1-protocol'
10
+
11
+ import type { BalanceHistoryEventNouns } from './types/index.ts'
12
+
13
+ export interface RawAmountTableCellProps extends TableCellProps {
14
+ amount?: bigint
15
+ linked?: boolean
16
+ type?: BalanceTransactionType
17
+ }
18
+
19
+ export const RawAmountTableCell: React.FC<RawAmountTableCellProps> = ({
20
+ amount, linked, sx, type, ...props
21
+ }) => {
22
+ const [ref, dispatch] = useEvent<HTMLAnchorElement, BalanceHistoryEventNouns>()
23
+ const handleClick = () => dispatch('amount', 'click', isDefined(amount) ? toHex(amount) : '')
24
+
25
+ const formatAmount = (amount?: bigint) => {
26
+ if (!isDefined(amount)) {
27
+ return 'N/A'
28
+ }
29
+ const xl1Amount = new XL1Amount(amount)
30
+ return xl1Amount.toString(undefined, {
31
+ places: 18, maxDecimal: 12, maxCharacters: 12, minDecimals: 1, locale: navigator.language,
32
+ })
33
+ }
34
+ return (
35
+ <TableCell ref={ref} {...props}>
36
+ <Tooltip title={`Raw Amount: ${amount}`}>
37
+ {linked
38
+ ? (
39
+ <Link onClick={handleClick} sx={{ cursor: 'pointer' }}>
40
+ {type === 'send' ? '-' : ''}
41
+ {formatAmount(amount)}
42
+ </Link>
43
+ )
44
+ : (
45
+ <span>
46
+ {type === 'send' ? '-' : ''}
47
+ {formatAmount(amount)}
48
+ </span>
49
+ )}
50
+ </Tooltip>
51
+ </TableCell>
52
+ )
53
+ }
@@ -0,0 +1,4 @@
1
+ export * from './AddressTableCell.tsx'
2
+ export * from './BalanceHistoryTable.tsx'
3
+ export * from './BalanceHistoryTableRow.tsx'
4
+ export * from './types/index.ts'
@@ -0,0 +1,17 @@
1
+ import type { AccountBalanceHistoryItemFormatted } from '@xyo-network/react-chain-provider'
2
+ import type { ExtendEventNoun } from '@xyo-network/react-event'
3
+
4
+ export type BalanceHistoryEventNouns = ExtendEventNoun<'amount' | 'blockNumber'>
5
+
6
+ export type TableHeadingLabels = 'Tx Hash' | 'BlockNumber' | 'Timestamp' | 'From' | 'To' | 'Amount' | 'Debug'
7
+ export type TableHeadings = { [key in keyof AccountBalanceHistoryItemFormatted]: TableHeadingLabels }
8
+
9
+ export const TableHeadingLabels: TableHeadingLabels[] = [
10
+ 'Tx Hash',
11
+ 'BlockNumber',
12
+ 'Timestamp',
13
+ 'From',
14
+ 'To',
15
+ 'Amount',
16
+ 'Debug',
17
+ ] as const
@@ -28,7 +28,7 @@ const TemplateLinked: StoryFn<typeof BlockchainTableEx> = (args) => {
28
28
  return (
29
29
  <>
30
30
  <BlockchainTableEx ref={ref} {...args} />
31
- <Snackbar open={!!event} onClose={() => setEvent(undefined)}>
31
+ <Snackbar open={!!event} autoHideDuration={5000} onClose={() => setEvent(undefined)}>
32
32
  <Alert>
33
33
  <AlertTitle>
34
34
  Event -
@@ -1,9 +1,12 @@
1
1
  import {
2
+ Link,
2
3
  TableCell, Tooltip,
3
4
  Typography,
4
5
  } from '@mui/material'
6
+ import { useEvent } from '@xyo-network/react-event'
5
7
  import React from 'react'
6
8
 
9
+ import type { BlockHeaderEventNouns } from '../../hooks/index.ts'
7
10
  import type { BlockTableCellProps } from './lib/index.ts'
8
11
 
9
12
  export interface BlockNumberTableCellProps extends BlockTableCellProps {}
@@ -16,14 +19,16 @@ export const BlockNumberTableCell: React.FC<BlockNumberTableCellProps> = ({
16
19
  return <BlockNumberTableCellInner blockNumber={blockNumber} linked={linked} {...props} />
17
20
  }
18
21
 
19
- export const BlockNumberTableCellInner: React.FC<BlockNumberTableCellProps & { blockNumber?: number }> = ({
22
+ export const BlockNumberTableCellInner: React.FC<BlockNumberTableCellProps & { blockNumber?: number; linked?: boolean }> = ({
20
23
  blockNumber, linked, ...props
21
24
  }) => {
25
+ const [ref, dispatch] = useEvent<HTMLTableCellElement, BlockHeaderEventNouns>()
26
+ const handleClick = () => dispatch('block-number', 'click', blockNumber?.toString() ?? '')
22
27
  return (
23
- <TableCell {...props}>
28
+ <TableCell ref={ref} {...props}>
24
29
  <Tooltip title={`Block Number: ${blockNumber}`}>
25
30
  <Typography component="span" variant="body1">
26
- {blockNumber}
31
+ {linked ? <Link onClick={handleClick} sx={{ cursor: 'pointer' }}>{blockNumber}</Link> : blockNumber}
27
32
  </Typography>
28
33
  </Tooltip>
29
34
  </TableCell>
@@ -1,3 +1,4 @@
1
+ export * from './account/index.ts'
1
2
  export * from './block/index.ts'
2
3
  export * from './chain/index.ts'
3
4
  export * from './FeatureNotAvailable.tsx'