@xyo-network/react-chain-blockchain 1.18.0 → 1.18.2
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/components/account/BalanceHistoryFlexbox.d.ts +1 -1
- package/dist/browser/components/account/BalanceHistoryFlexbox.d.ts.map +1 -1
- package/dist/browser/components/account/helpers/formatBalanceMagnitude.d.ts +1 -1
- package/dist/browser/components/account/helpers/formatBalanceMagnitude.d.ts.map +1 -1
- package/dist/browser/components/account/hooks/usePagedAccountBalanceHistory.d.ts +1 -1
- package/dist/browser/components/account/hooks/usePagedAccountBalanceHistory.d.ts.map +1 -1
- package/dist/browser/components/block/ProducerChip.d.ts +1 -1
- package/dist/browser/components/block/ProducerChip.d.ts.map +1 -1
- package/dist/browser/components/block/helpers/blockProducer.d.ts +6 -2
- package/dist/browser/components/block/helpers/blockProducer.d.ts.map +1 -1
- package/dist/browser/components/block/helpers/payloadCountsFromBlock.d.ts +1 -1
- package/dist/browser/components/block/helpers/payloadCountsFromBlock.d.ts.map +1 -1
- package/dist/browser/components/block/hooks/useBlockProducer.d.ts +6 -2
- package/dist/browser/components/block/hooks/useBlockProducer.d.ts.map +1 -1
- package/dist/browser/components/block/hooks/usePayloadCountsFromBlock.d.ts +1 -1
- package/dist/browser/components/block/hooks/usePayloadCountsFromBlock.d.ts.map +1 -1
- package/dist/browser/components/block/menu/Expanded.d.ts +1 -1
- package/dist/browser/components/block/menu/Expanded.d.ts.map +1 -1
- package/dist/browser/components/block/table/cell/lib/BlockTableCellProps.d.ts +1 -1
- package/dist/browser/components/block/table/cell/lib/BlockTableCellProps.d.ts.map +1 -1
- package/dist/browser/components/chain/hooks/useOnBlock.d.ts +21 -13
- package/dist/browser/components/chain/hooks/useOnBlock.d.ts.map +1 -1
- package/dist/browser/components/index.d.ts +1 -0
- package/dist/browser/components/index.d.ts.map +1 -1
- package/dist/browser/components/payload/builder/transfer/Form.d.ts.map +1 -1
- package/dist/browser/components/payload/builder/transfer/builder/SingleFlexbox.d.ts.map +1 -1
- package/dist/browser/components/payload/fields/BlockNumberTextField.d.ts +1 -1
- package/dist/browser/components/payload/fields/BlockNumberTextField.d.ts.map +1 -1
- package/dist/browser/components/payload/fields/XyoAddressTextField.d.ts.map +1 -1
- package/dist/browser/components/rate/SpanTypography.d.ts +8 -0
- package/dist/browser/components/rate/SpanTypography.d.ts.map +1 -0
- package/dist/browser/components/rate/SpeedTypography.d.ts +7 -0
- package/dist/browser/components/rate/SpeedTypography.d.ts.map +1 -0
- package/dist/browser/components/rate/TimeTypography.d.ts +7 -0
- package/dist/browser/components/rate/TimeTypography.d.ts.map +1 -0
- package/dist/browser/components/rate/flexbox/FlexBox.d.ts +7 -0
- package/dist/browser/components/rate/flexbox/FlexBox.d.ts.map +1 -0
- package/dist/browser/components/rate/flexbox/FlexBox.stories.d.ts +10 -0
- package/dist/browser/components/rate/flexbox/FlexBox.stories.d.ts.map +1 -0
- package/dist/browser/components/rate/flexbox/index.d.ts +2 -0
- package/dist/browser/components/rate/flexbox/index.d.ts.map +1 -0
- package/dist/browser/components/rate/gauge/Container.d.ts +15 -0
- package/dist/browser/components/rate/gauge/Container.d.ts.map +1 -0
- package/dist/browser/components/rate/gauge/Container.stories.d.ts +12 -0
- package/dist/browser/components/rate/gauge/Container.stories.d.ts.map +1 -0
- package/dist/browser/components/rate/gauge/Pointer.d.ts +6 -0
- package/dist/browser/components/rate/gauge/Pointer.d.ts.map +1 -0
- package/dist/browser/components/rate/gauge/Ticks.d.ts +38 -0
- package/dist/browser/components/rate/gauge/Ticks.d.ts.map +1 -0
- package/dist/browser/components/rate/gauge/WithLabel.d.ts +5 -0
- package/dist/browser/components/rate/gauge/WithLabel.d.ts.map +1 -0
- package/dist/browser/components/rate/gauge/WithLabel.stories.d.ts +11 -0
- package/dist/browser/components/rate/gauge/WithLabel.stories.d.ts.map +1 -0
- package/dist/browser/components/rate/gauge/helpers/blockRateConversions.d.ts +4 -0
- package/dist/browser/components/rate/gauge/helpers/blockRateConversions.d.ts.map +1 -0
- package/dist/browser/components/rate/gauge/helpers/index.d.ts +2 -0
- package/dist/browser/components/rate/gauge/helpers/index.d.ts.map +1 -0
- package/dist/browser/components/rate/gauge/index.d.ts +5 -0
- package/dist/browser/components/rate/gauge/index.d.ts.map +1 -0
- package/dist/browser/components/rate/index.d.ts +7 -0
- package/dist/browser/components/rate/index.d.ts.map +1 -0
- package/dist/browser/components/rate/support/MetricTypography.d.ts +11 -0
- package/dist/browser/components/rate/support/MetricTypography.d.ts.map +1 -0
- package/dist/browser/components/rate/support/index.d.ts +2 -0
- package/dist/browser/components/rate/support/index.d.ts.map +1 -0
- package/dist/browser/components/transactions/TransactionsQuickTipButton.d.ts +1 -1
- package/dist/browser/components/transactions/TransactionsQuickTipButton.d.ts.map +1 -1
- package/dist/browser/components/transactions/submit/Builder.d.ts +1 -1
- package/dist/browser/components/transactions/submit/Builder.d.ts.map +1 -1
- package/dist/browser/context/analyzer/state.d.ts +1 -1
- package/dist/browser/context/analyzer/state.d.ts.map +1 -1
- package/dist/browser/context/chain/Provider.d.ts.map +1 -1
- package/dist/browser/context/chain/State.d.ts +1 -2
- package/dist/browser/context/chain/State.d.ts.map +1 -1
- package/dist/browser/helpers/rate/index.d.ts +2 -0
- package/dist/browser/helpers/rate/index.d.ts.map +1 -0
- package/dist/browser/helpers/rate/rateUnitToLabel.d.ts +3 -0
- package/dist/browser/helpers/rate/rateUnitToLabel.d.ts.map +1 -0
- package/dist/browser/helpers/txsFromBlock.d.ts +4 -22
- package/dist/browser/helpers/txsFromBlock.d.ts.map +1 -1
- package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts +47 -143
- package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
- package/dist/browser/hooks/useTxsFromBlock.d.ts +2 -22
- package/dist/browser/hooks/useTxsFromBlock.d.ts.map +1 -1
- package/dist/browser/index.mjs +735 -342
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/types/BlockComponentProps.d.ts +1 -1
- package/dist/browser/types/BlockComponentProps.d.ts.map +1 -1
- package/dist/browser/types/BlockComponents.d.ts +1 -1
- package/dist/browser/types/BlockComponents.d.ts.map +1 -1
- package/dist/browser/types/render/BlockChainRenderProps.d.ts +1 -2
- package/dist/browser/types/render/BlockChainRenderProps.d.ts.map +1 -1
- package/package.json +37 -38
- package/src/components/account/BalanceHistoryFlexbox.stories.tsx +1 -1
- package/src/components/account/BalanceHistoryFlexbox.tsx +2 -2
- package/src/components/account/helpers/formatBalanceMagnitude.ts +1 -1
- package/src/components/account/hooks/usePagedAccountBalanceHistory.ts +9 -14
- package/src/components/account/table/BalanceHistoryTableEx.stories.tsx +2 -2
- package/src/components/account/table/RawAmountTableCell.tsx +1 -1
- package/src/components/block/ProducerChip.tsx +1 -1
- package/src/components/block/helpers/blockProducer.ts +1 -1
- package/src/components/block/helpers/payloadCountsFromBlock.ts +1 -1
- package/src/components/block/hooks/useBlockProducer.ts +1 -1
- package/src/components/block/hooks/usePayloadCountsFromBlock.ts +1 -1
- package/src/components/block/menu/Expanded.tsx +1 -1
- package/src/components/block/table/cell/lib/BlockTableCellProps.ts +1 -1
- package/src/components/chain/hooks/useOnBlock.ts +12 -12
- package/src/components/index.ts +1 -0
- package/src/components/payload/builder/producer-intent/Form.tsx +1 -1
- package/src/components/payload/builder/transfer/Form.tsx +6 -4
- package/src/components/payload/builder/transfer/builder/SingleFlexbox.tsx +12 -15
- package/src/components/payload/fields/BlockNumberTextField.tsx +1 -1
- package/src/components/payload/fields/XyoAddressTextField.tsx +10 -3
- package/src/components/rate/SpanTypography.tsx +20 -0
- package/src/components/rate/SpeedTypography.tsx +17 -0
- package/src/components/rate/TimeTypography.tsx +17 -0
- package/src/components/rate/flexbox/FlexBox.stories.tsx +44 -0
- package/src/components/rate/flexbox/FlexBox.tsx +31 -0
- package/src/components/rate/flexbox/index.ts +1 -0
- package/src/components/rate/gauge/Container.stories.tsx +77 -0
- package/src/components/rate/gauge/Container.tsx +75 -0
- package/src/components/rate/gauge/Pointer.tsx +67 -0
- package/src/components/rate/gauge/Ticks.tsx +122 -0
- package/src/components/rate/gauge/WithLabel.stories.tsx +70 -0
- package/src/components/rate/gauge/WithLabel.tsx +20 -0
- package/src/components/rate/gauge/helpers/blockRateConversions.ts +104 -0
- package/src/components/rate/gauge/helpers/index.ts +1 -0
- package/src/components/rate/gauge/index.ts +4 -0
- package/src/components/rate/index.ts +6 -0
- package/src/components/rate/support/MetricTypography.tsx +78 -0
- package/src/components/rate/support/index.ts +1 -0
- package/src/components/transactions/TransactionsQuickTipButton.tsx +15 -10
- package/src/components/transactions/submit/Builder.tsx +2 -2
- package/src/components/transactions/submit/SubmitChain.tsx +2 -2
- package/src/context/analyzer/Provider.tsx +3 -3
- package/src/context/analyzer/state.ts +1 -1
- package/src/context/chain/Provider.tsx +28 -21
- package/src/context/chain/State.ts +1 -2
- package/src/helpers/rate/index.ts +1 -0
- package/src/helpers/rate/rateUnitToLabel.ts +27 -0
- package/src/helpers/txsFromBlock.ts +4 -2
- package/src/hooks/chain-iterator/useChainIteratorParams.ts +13 -4
- package/src/hooks/useTxsFromBlock.ts +1 -1
- package/src/stories/ChainArchivistDecorator.tsx +1 -1
- package/src/stories/ChainArchivistDelayedInsertDecorator.tsx +2 -2
- package/src/types/BlockComponentProps.ts +1 -1
- package/src/types/BlockComponents.ts +1 -1
- package/src/types/render/BlockChainRenderProps.ts +1 -2
|
@@ -8,11 +8,9 @@ import {
|
|
|
8
8
|
} from '@xylabs/react-flexbox'
|
|
9
9
|
import type { QuickTipButtonProps } from '@xylabs/react-quick-tip-button'
|
|
10
10
|
import { QuickTipButton } from '@xylabs/react-quick-tip-button'
|
|
11
|
-
import type
|
|
12
|
-
import type { HydratedBlockWithHashMeta } from '@xyo-network/xl1-
|
|
13
|
-
import React, {
|
|
14
|
-
Fragment, useMemo, useState,
|
|
15
|
-
} from 'react'
|
|
11
|
+
import { type Hash, isDefined } from '@xylabs/sdk-js'
|
|
12
|
+
import type { HydratedBlockWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
13
|
+
import React, { Fragment, useState } from 'react'
|
|
16
14
|
|
|
17
15
|
import { useTxsFromBlock } from '../../hooks/index.ts'
|
|
18
16
|
|
|
@@ -24,8 +22,16 @@ export const TransactionsQuickTipButton: React.FC<TransactionsQuickTipButtonQuic
|
|
|
24
22
|
const [transactions, transactionsError] = useTxsFromBlock(block)
|
|
25
23
|
|
|
26
24
|
const [copied, setCopied] = useState(false)
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
|
|
26
|
+
const [closeDialog, setCloseDialog] = useState(false)
|
|
27
|
+
const open = isDefined(transactionsError)
|
|
28
|
+
|
|
29
|
+
// if the error changes, reopen the dialog
|
|
30
|
+
const [previousTransactionError, setPreviousTransactionError] = useState<Error | undefined>(transactionsError)
|
|
31
|
+
if (isDefined(transactionsError) && transactionsError !== previousTransactionError) {
|
|
32
|
+
setPreviousTransactionError(transactionsError)
|
|
33
|
+
setCloseDialog(false)
|
|
34
|
+
}
|
|
29
35
|
|
|
30
36
|
const onCopy = async (transactionHash: Hash) => {
|
|
31
37
|
await navigator.clipboard.writeText(transactionHash)
|
|
@@ -49,8 +55,7 @@ export const TransactionsQuickTipButton: React.FC<TransactionsQuickTipButtonQuic
|
|
|
49
55
|
? null
|
|
50
56
|
: (
|
|
51
57
|
<FlexGrowCol gap={1} alignItems="stretch">
|
|
52
|
-
{
|
|
53
|
-
{transactions?.map(([transaction, hash]) => (
|
|
58
|
+
{transactions?.map(([_transaction, hash]) => (
|
|
54
59
|
<Fragment key={hash}>
|
|
55
60
|
<FlexGrowRow gap={2} justifyContent="start">
|
|
56
61
|
<ContentCopyIcon sx={{ cursor: 'pointer' }} onClick={() => void onCopy(hash)} />
|
|
@@ -73,7 +78,7 @@ export const TransactionsQuickTipButton: React.FC<TransactionsQuickTipButtonQuic
|
|
|
73
78
|
</FlexGrowCol>
|
|
74
79
|
)}
|
|
75
80
|
</QuickTipButton>
|
|
76
|
-
<Snackbar open={
|
|
81
|
+
<Snackbar open={open && closeDialog === false} onClose={() => setCloseDialog(true)}>
|
|
77
82
|
<ErrorRender error={transactionsError} scope="TransactionsQuickTipButton" />
|
|
78
83
|
</Snackbar>
|
|
79
84
|
</>
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
} from '@mui/material'
|
|
4
4
|
import { FlexCol } from '@xylabs/react-flexbox'
|
|
5
5
|
import { toHex } from '@xylabs/sdk-js'
|
|
6
|
-
import type { ChainId, TransactionBoundWitnessFields } from '@xyo-network/xl1-
|
|
7
|
-
import { defaultTransactionFees, toXL1BlockNumber } from '@xyo-network/xl1-
|
|
6
|
+
import type { ChainId, TransactionBoundWitnessFields } from '@xyo-network/xl1-sdk'
|
|
7
|
+
import { defaultTransactionFees, toXL1BlockNumber } from '@xyo-network/xl1-sdk'
|
|
8
8
|
import React from 'react'
|
|
9
9
|
|
|
10
10
|
export interface ChainTransactionBuilder {
|
|
@@ -11,8 +11,8 @@ import { QueryBoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
|
|
|
11
11
|
import type { ModuleQueryResult } from '@xyo-network/module-model'
|
|
12
12
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
13
13
|
import type { Payload } from '@xyo-network/payload-model'
|
|
14
|
-
import type { TransactionBoundWitnessFields } from '@xyo-network/xl1-
|
|
15
|
-
import { buildTransaction } from '@xyo-network/xl1-
|
|
14
|
+
import type { TransactionBoundWitnessFields } from '@xyo-network/xl1-sdk'
|
|
15
|
+
import { buildTransaction } from '@xyo-network/xl1-sdk'
|
|
16
16
|
import { Axios } from 'axios'
|
|
17
17
|
import React, { useState } from 'react'
|
|
18
18
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isUndefined } from '@xylabs/sdk-js'
|
|
2
|
-
import type { HydratedBlock } from '@xyo-network/xl1-
|
|
2
|
+
import type { HydratedBlock } from '@xyo-network/xl1-sdk'
|
|
3
3
|
import type { PropsWithChildren } from 'react'
|
|
4
4
|
import React, {
|
|
5
5
|
useCallback, useMemo, useState,
|
|
@@ -14,9 +14,9 @@ export interface ChainAnalyzersProviderProps extends PropsWithChildren {
|
|
|
14
14
|
|
|
15
15
|
export const ChainAnalyzersProvider: React.FC<ChainAnalyzersProviderProps> = ({ analyzers: analyzersProp, children }) => {
|
|
16
16
|
const [analyzersState, setAnalyzersState] = useState<ChainAnalyzers>(analyzersProp ?? {} as ChainAnalyzers)
|
|
17
|
-
const [statsUpdated, setStatsUpdated] = useState(
|
|
17
|
+
const [statsUpdated, setStatsUpdated] = useState(1)
|
|
18
18
|
|
|
19
|
-
const analyzers = useMemo(() => ({ ...analyzersProp, ...analyzersState }), [analyzersProp])
|
|
19
|
+
const analyzers = useMemo(() => ({ ...analyzersProp, ...analyzersState }), [analyzersProp, analyzersState])
|
|
20
20
|
|
|
21
21
|
const addAnalyzers: ChainAnalyzersState['addAnalyzers'] = useCallback((analyzers: ChainAnalyzersState['analyzers']) => {
|
|
22
22
|
if (isUndefined(analyzers)) return
|
|
@@ -1,40 +1,47 @@
|
|
|
1
|
+
import { isDefined } from '@xylabs/sdk-js'
|
|
1
2
|
import type { PropsWithChildren } from 'react'
|
|
2
|
-
import React, {
|
|
3
|
+
import React, {
|
|
4
|
+
useCallback, useMemo, useState,
|
|
5
|
+
} from 'react'
|
|
3
6
|
|
|
4
7
|
import { ChainInfoContext } from './Context.ts'
|
|
5
8
|
import type { ChainInfoState } from './State.ts'
|
|
6
9
|
|
|
7
|
-
interface ChainInfoProviderProps extends PropsWithChildren, Omit<ChainInfoState, 'provided'> {
|
|
8
|
-
}
|
|
10
|
+
interface ChainInfoProviderProps extends PropsWithChildren, Omit<ChainInfoState, 'provided'> {}
|
|
9
11
|
|
|
10
12
|
export const ChainInfoProvider: React.FC<ChainInfoProviderProps> = ({
|
|
11
13
|
children, chainArchivist: chainArchivistProp, chainId: chainIdProp, chainIterator: chainIteratorProp,
|
|
12
14
|
}) => {
|
|
13
15
|
const [chainArchivist, setChainArchivist] = useState<ChainInfoState['chainArchivist']>(chainArchivistProp)
|
|
16
|
+
const [previousChainArchivist, setPreviousChainArchivist] = useState<ChainInfoState['chainArchivist']>(chainArchivistProp)
|
|
17
|
+
if (isDefined(chainArchivistProp) && chainArchivistProp !== previousChainArchivist) {
|
|
18
|
+
setChainArchivist(chainArchivistProp)
|
|
19
|
+
setPreviousChainArchivist(chainArchivistProp)
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
const [chainId, setChainId] = useState<ChainInfoState['chainId']>(chainIdProp)
|
|
23
|
+
const [previousChainId, setPreviousChainId] = useState<ChainInfoState['chainId']>(chainIdProp)
|
|
24
|
+
if (isDefined(chainIdProp) && chainIdProp !== previousChainId) {
|
|
25
|
+
setChainId(chainIdProp)
|
|
26
|
+
setPreviousChainId(chainIdProp)
|
|
27
|
+
}
|
|
28
|
+
|
|
15
29
|
const [chainIterator, setChainIterator] = useState<ChainInfoState['chainIterator']>(chainIteratorProp)
|
|
30
|
+
const [previousChainIterator, setPreviousChainIterator] = useState<ChainInfoState['chainIterator']>(chainIteratorProp)
|
|
31
|
+
if (isDefined(chainIteratorProp) && chainIteratorProp !== previousChainIterator) {
|
|
32
|
+
setChainIterator(chainIteratorProp)
|
|
33
|
+
setPreviousChainIterator(chainIteratorProp)
|
|
34
|
+
}
|
|
16
35
|
|
|
17
|
-
const updateChainArchivist = (chainArchivist: ChainInfoState['chainArchivist']) => {
|
|
36
|
+
const updateChainArchivist = useCallback((chainArchivist: ChainInfoState['chainArchivist']) => {
|
|
18
37
|
setChainArchivist(chainArchivist)
|
|
19
|
-
}
|
|
20
|
-
const updateChainId = (chainId: ChainInfoState['chainId']) => {
|
|
38
|
+
}, [])
|
|
39
|
+
const updateChainId = useCallback((chainId: ChainInfoState['chainId']) => {
|
|
21
40
|
setChainId(chainId)
|
|
22
|
-
}
|
|
23
|
-
const updateChainIterator = (chainIterator: ChainInfoState['chainIterator']) => {
|
|
41
|
+
}, [])
|
|
42
|
+
const updateChainIterator = useCallback((chainIterator: ChainInfoState['chainIterator']) => {
|
|
24
43
|
setChainIterator(chainIterator)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
useMemo(() => {
|
|
28
|
-
updateChainArchivist(chainArchivistProp)
|
|
29
|
-
}, [chainArchivistProp])
|
|
30
|
-
|
|
31
|
-
useMemo(() => {
|
|
32
|
-
updateChainId(chainIdProp)
|
|
33
|
-
}, [chainIdProp])
|
|
34
|
-
|
|
35
|
-
useMemo(() => {
|
|
36
|
-
updateChainIterator(chainIteratorProp)
|
|
37
|
-
}, [chainIteratorProp])
|
|
44
|
+
}, [])
|
|
38
45
|
|
|
39
46
|
const chainState: ChainInfoState = useMemo(() => ({
|
|
40
47
|
chainArchivist,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ContextExState } from '@xylabs/react-shared'
|
|
2
2
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
3
|
-
import type { ChainId } from '@xyo-network/xl1-
|
|
4
|
-
import type { ChainBlockNumberIteratorService } from '@xyo-network/xl1-protocol-sdk'
|
|
3
|
+
import type { ChainBlockNumberIteratorService, ChainId } from '@xyo-network/xl1-sdk'
|
|
5
4
|
|
|
6
5
|
export type ChainInfoState = ContextExState<{
|
|
7
6
|
chainArchivist?: ArchivistInstance
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './rateUnitToLabel.ts'
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TimeDurations } from '@xyo-network/xl1-sdk'
|
|
2
|
+
|
|
3
|
+
export const rateUnitToLabel = (rateUnit: keyof TimeDurations) => {
|
|
4
|
+
switch (rateUnit) {
|
|
5
|
+
case 'millis': {
|
|
6
|
+
return 'b/ms'
|
|
7
|
+
}
|
|
8
|
+
case 'seconds': {
|
|
9
|
+
return 'b/s'
|
|
10
|
+
}
|
|
11
|
+
case 'minutes': {
|
|
12
|
+
return 'b/m'
|
|
13
|
+
}
|
|
14
|
+
case 'hours': {
|
|
15
|
+
return 'b/h'
|
|
16
|
+
}
|
|
17
|
+
case 'days': {
|
|
18
|
+
return 'b/d'
|
|
19
|
+
}
|
|
20
|
+
case 'weeks': {
|
|
21
|
+
return 'b/w'
|
|
22
|
+
}
|
|
23
|
+
default: {
|
|
24
|
+
return rateUnit
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/sdk-js'
|
|
1
2
|
import { HydratedBlockWrapper } from '@xyo-network/chain-wrappers'
|
|
2
3
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
3
|
-
import type {
|
|
4
|
+
import type { Payload } from '@xyo-network/payload-model'
|
|
5
|
+
import type { HydratedBlockWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
4
6
|
|
|
5
|
-
export const txsFromBlock = async (block: HydratedBlockWithHashMeta) => {
|
|
7
|
+
export const txsFromBlock = async (block: HydratedBlockWithHashMeta): Promise<[Payload, Hash][]> => {
|
|
6
8
|
const wrapper = await HydratedBlockWrapper.parse(block)
|
|
7
9
|
const txs = wrapper.transactions
|
|
8
10
|
const txPayloads = txs.map(tx => tx.boundWitness)
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { UsePromiseState } from '@xylabs/react-promise'
|
|
1
2
|
import { usePromise } from '@xylabs/react-promise'
|
|
2
3
|
import { type Hash, isHash } from '@xylabs/sdk-js'
|
|
3
4
|
import { assertEx, isDefined } from '@xylabs/sdk-js'
|
|
4
5
|
import type { ReadArchivist } from '@xyo-network/archivist-model'
|
|
5
6
|
import { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
|
|
6
|
-
import type {
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
|
|
8
|
+
import type {
|
|
9
|
+
BlockBoundWitness, BlockBoundWitnessWithHashMeta, ChainId, Config, PayloadMapRead,
|
|
10
|
+
} from '@xyo-network/xl1-sdk'
|
|
11
|
+
import { getDefaultConfig, isBlockBoundWitness } from '@xyo-network/xl1-sdk'
|
|
9
12
|
|
|
10
13
|
import type { BlockChainIterator } from '../../types/index.ts'
|
|
11
14
|
|
|
@@ -26,7 +29,13 @@ export const resolveDefinedHead = async (head: Hash, chainArchivist: ReadArchivi
|
|
|
26
29
|
|
|
27
30
|
export const useChainIteratorParams = ({
|
|
28
31
|
chainMap, chainId, head, name,
|
|
29
|
-
}: BlockChainIterator)
|
|
32
|
+
}: BlockChainIterator): [{
|
|
33
|
+
chainId: ChainId
|
|
34
|
+
chainMap: PayloadMapRead<WithStorageMeta<Payload>>
|
|
35
|
+
config: Config
|
|
36
|
+
head: BlockBoundWitnessWithHashMeta
|
|
37
|
+
name: string
|
|
38
|
+
} | undefined, Error | undefined, UsePromiseState | undefined] => {
|
|
30
39
|
return usePromise(async () => {
|
|
31
40
|
if (isDefined(chainMap) && isDefined(chainId) && isHash(head)) {
|
|
32
41
|
const result = await chainMap.get(head)
|
|
@@ -4,7 +4,7 @@ import { usePromise } from '@xylabs/react-promise'
|
|
|
4
4
|
import { MemoryArchivist } from '@xyo-network/archivist-memory'
|
|
5
5
|
import { ArchivistConfigSchema } from '@xyo-network/archivist-model'
|
|
6
6
|
import { buildRandomBlockChain } from '@xyo-network/react-chain-shared'
|
|
7
|
-
import { flattenHydratedBlocks } from '@xyo-network/xl1-
|
|
7
|
+
import { flattenHydratedBlocks } from '@xyo-network/xl1-sdk'
|
|
8
8
|
import React, { useEffect } from 'react'
|
|
9
9
|
|
|
10
10
|
import { getChainId } from '../lib/index.ts'
|
|
@@ -5,8 +5,8 @@ import { delay } from '@xylabs/sdk-js'
|
|
|
5
5
|
import { MemoryArchivist } from '@xyo-network/archivist-memory'
|
|
6
6
|
import { ArchivistConfigSchema } from '@xyo-network/archivist-model'
|
|
7
7
|
import { buildRandomBlockChain } from '@xyo-network/react-chain-shared'
|
|
8
|
-
import type { BlockBoundWitness } from '@xyo-network/xl1-
|
|
9
|
-
import { flattenHydratedBlock } from '@xyo-network/xl1-
|
|
8
|
+
import type { BlockBoundWitness } from '@xyo-network/xl1-sdk'
|
|
9
|
+
import { flattenHydratedBlock } from '@xyo-network/xl1-sdk'
|
|
10
10
|
import React, { useEffect, useState } from 'react'
|
|
11
11
|
|
|
12
12
|
import { getChainId } from '../lib/index.ts'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Hash } from '@xylabs/sdk-js'
|
|
2
|
-
import type { HydratedBlockWithHashMeta } from '@xyo-network/xl1-
|
|
2
|
+
import type { HydratedBlockWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
3
3
|
|
|
4
4
|
/** Interface for all components that render a single block */
|
|
5
5
|
export interface BlockComponentProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { NodesWithKeys } from '@xylabs/react-animation'
|
|
2
|
-
import type { HydratedBlock } from '@xyo-network/xl1-
|
|
2
|
+
import type { HydratedBlock } from '@xyo-network/xl1-sdk'
|
|
3
3
|
|
|
4
4
|
/** Interface for all block components meant to be rendered in a chain */
|
|
5
5
|
export interface BlockChainRenderComponent extends NodesWithKeys {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { CreatableName, Hash } from '@xylabs/sdk-js'
|
|
2
2
|
import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
|
|
3
|
-
import type { ChainId } from '@xyo-network/xl1-
|
|
4
|
-
import type { PayloadMapRead } from '@xyo-network/xl1-protocol-sdk'
|
|
3
|
+
import type { ChainId, PayloadMapRead } from '@xyo-network/xl1-sdk'
|
|
5
4
|
|
|
6
5
|
/** Props that control the rendering (not blockchain specific) */
|
|
7
6
|
export interface RenderProps {
|