@xyo-network/react-chain-blockchain 1.5.35 → 1.5.36

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 (69) hide show
  1. package/dist/browser/index.mjs +293 -252
  2. package/dist/browser/index.mjs.map +1 -1
  3. package/dist/types/components/block/ChipSkeleton.d.ts +4 -0
  4. package/dist/types/components/block/ChipSkeleton.d.ts.map +1 -0
  5. package/dist/types/components/block/ProducerChip.d.ts.map +1 -1
  6. package/dist/types/components/block/hooks/useDynamicBlockComponents.d.ts +2 -1
  7. package/dist/types/components/block/hooks/useDynamicBlockComponents.d.ts.map +1 -1
  8. package/dist/types/components/block/hooks/useStaticBlockComponents.d.ts +2 -1
  9. package/dist/types/components/block/hooks/useStaticBlockComponents.d.ts.map +1 -1
  10. package/dist/types/components/block/index.d.ts +1 -0
  11. package/dist/types/components/block/index.d.ts.map +1 -1
  12. package/dist/types/components/block/table/cell/Epoch.d.ts.map +1 -1
  13. package/dist/types/components/block/table/cell/Hash.d.ts.map +1 -1
  14. package/dist/types/components/block/table/cell/hooks/useLinkedBlockItem.d.ts.map +1 -1
  15. package/dist/types/components/chain/render/dynamic/flexbox/variants/WithAnalysis.d.ts.map +1 -1
  16. package/dist/types/components/chain/render/dynamic/hooks/useRemoteBlockChainRenderProps.d.ts.map +1 -1
  17. package/dist/types/components/chain/render/static/flexbox/variants/WithAnalysis.d.ts.map +1 -1
  18. package/dist/types/context/chain/Context.d.ts +3 -3
  19. package/dist/types/context/chain/State.d.ts +3 -2
  20. package/dist/types/context/chain/State.d.ts.map +1 -1
  21. package/dist/types/context/chain/use.d.ts +1 -1
  22. package/dist/types/hooks/chain-iterator/ChainIteratorStore.d.ts +2 -1
  23. package/dist/types/hooks/chain-iterator/ChainIteratorStore.d.ts.map +1 -1
  24. package/dist/types/hooks/chain-iterator/useChainIteratorParams.d.ts +6 -4
  25. package/dist/types/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
  26. package/dist/types/hooks/chain-iterator/useChainIteratorStore.d.ts +1 -1
  27. package/dist/types/hooks/chain-iterator/useChainIteratorStore.d.ts.map +1 -1
  28. package/dist/types/hooks/useIterateChain.d.ts +2 -1
  29. package/dist/types/hooks/useIterateChain.d.ts.map +1 -1
  30. package/dist/types/lib/getChainId.d.ts +4 -0
  31. package/dist/types/lib/getChainId.d.ts.map +1 -0
  32. package/dist/types/lib/index.d.ts +1 -1
  33. package/dist/types/lib/index.d.ts.map +1 -1
  34. package/dist/types/stories/ChainInfoContextDecorator.d.ts.map +1 -1
  35. package/dist/types/types/render/BlockChainRenderProps.d.ts +3 -3
  36. package/dist/types/types/render/BlockChainRenderProps.d.ts.map +1 -1
  37. package/package.json +52 -52
  38. package/src/components/block/ChipSkeleton.tsx +7 -0
  39. package/src/components/block/ProducerChip.tsx +18 -3
  40. package/src/components/block/hooks/useDynamicBlockComponents.ts +2 -1
  41. package/src/components/block/hooks/useStaticBlockComponents.ts +2 -1
  42. package/src/components/block/index.ts +1 -0
  43. package/src/components/block/table/cell/Epoch.tsx +2 -1
  44. package/src/components/block/table/cell/Hash.tsx +18 -20
  45. package/src/components/block/table/cell/hooks/useLinkedBlockItem.tsx +6 -1
  46. package/src/components/chain/render/dynamic/flexbox/Flexbox.stories.tsx +1 -1
  47. package/src/components/chain/render/dynamic/flexbox/Remote.stories.tsx +4 -3
  48. package/src/components/chain/render/dynamic/flexbox/variants/WithAnalysis.tsx +4 -3
  49. package/src/components/chain/render/dynamic/hooks/useDynamicBlockRenderComponents.ts +1 -1
  50. package/src/components/chain/render/dynamic/hooks/useRemoteBlockChainRenderProps.ts +1 -0
  51. package/src/components/chain/render/static/flexbox/Flexbox.stories.tsx +2 -2
  52. package/src/components/chain/render/static/flexbox/variants/WithAnalysis.tsx +4 -3
  53. package/src/components/chain/render/static/hooks/useStaticBlockRenderComponents.ts +1 -1
  54. package/src/components/chain/render/static/table/Ex.stories.tsx +2 -2
  55. package/src/context/chain/Provider.tsx +9 -9
  56. package/src/context/chain/State.ts +3 -2
  57. package/src/hooks/chain-iterator/ChainIteratorStore.ts +2 -2
  58. package/src/hooks/chain-iterator/useChainIteratorParams.ts +5 -4
  59. package/src/hooks/chain-iterator/useChainIteratorStore.ts +1 -1
  60. package/src/hooks/useIterateChain.ts +3 -4
  61. package/src/lib/getChainId.ts +8 -0
  62. package/src/lib/index.ts +1 -1
  63. package/src/stories/ChainArchivistDecorator.tsx +4 -4
  64. package/src/stories/ChainArchivistDelayedInsertDecorator.tsx +4 -4
  65. package/src/stories/ChainInfoContextDecorator.tsx +8 -7
  66. package/src/types/render/BlockChainRenderProps.ts +6 -4
  67. package/dist/types/lib/getChainInformation.d.ts +0 -4
  68. package/dist/types/lib/getChainInformation.d.ts.map +0 -1
  69. package/src/lib/getChainInformation.ts +0 -9
@@ -1,7 +1,7 @@
1
1
  import type { Meta, StoryFn } from '@storybook/react-vite'
2
2
  import React from 'react'
3
3
 
4
- import { getChainInformation } from '../../../../../lib/index.ts'
4
+ import { getChainId } from '../../../../../lib/index.ts'
5
5
  import type { BlockChainRenderProps } from '../../../../../types/index.ts'
6
6
  import { DynamicBlockchainRenderFlexbox } from './Flexbox.tsx'
7
7
 
@@ -9,10 +9,11 @@ import { DynamicBlockchainRenderFlexbox } from './Flexbox.tsx'
9
9
  // @ts-expect-error
10
10
  globalThis.rollbar = undefined
11
11
 
12
- const chainInformation = await getChainInformation()
12
+ const chainId = await getChainId()
13
13
 
14
14
  const blockChainRenderProps: BlockChainRenderProps = {
15
- chainInformation,
15
+ name: 'unknown',
16
+ chainId,
16
17
  maxBlocks: 100,
17
18
  }
18
19
 
@@ -1,3 +1,4 @@
1
+ import { isAddress } from '@xylabs/hex'
1
2
  import { ChainProducersAnalyzer } from '@xyo-network/chain-analyze'
2
3
  import React, { useMemo } from 'react'
3
4
 
@@ -7,13 +8,13 @@ import type { BlockChainRenderFlexboxProps } from '../../../../../../types/index
7
8
  import { DynamicListBase } from './Base.tsx'
8
9
 
9
10
  export const WithAnalysis: React.FC<BlockChainRenderFlexboxProps> = ({ blockChainRenderProps, ...props }) => {
10
- const { chainInformation } = blockChainRenderProps ?? {}
11
+ const { chainId } = blockChainRenderProps ?? {}
11
12
 
12
13
  const analyzers = useMemo(() => {
13
- if (chainInformation) {
14
+ if (isAddress(chainId)) {
14
15
  return { producers: new ChainProducersAnalyzer() } as ChainAnalyzers
15
16
  }
16
- }, [chainInformation])
17
+ }, [chainId])
17
18
 
18
19
  return (
19
20
  <ChainAnalyzersProvider analyzers={analyzers}>
@@ -14,7 +14,7 @@ export const useDynamicBlockRenderComponents = (
14
14
  ) => {
15
15
  const { maxBlocks } = blockChainRenderProps ?? {}
16
16
 
17
- const chainIteratorParams = useMemo(() => blockChainRenderProps ?? {}, [blockChainRenderProps])
17
+ const chainIteratorParams = useMemo(() => blockChainRenderProps ?? { name: 'unknown' }, [blockChainRenderProps])
18
18
 
19
19
  const [params, paramsError] = useChainIteratorParams(chainIteratorParams)
20
20
 
@@ -20,6 +20,7 @@ export const useRemoteBlockChainRenderProps = (
20
20
  const blockChainRenderProps: BlockChainRenderProps = useMemo(() => ({
21
21
  ...blockChainRenderPropsArg,
22
22
  chainArchivist,
23
+ name: 'blockChainRenderProps',
23
24
  }), [blockChainRenderPropsArg, chainArchivist])
24
25
 
25
26
  return {
@@ -24,11 +24,11 @@ Default.args = {}
24
24
  Default.decorators = [ChainArchivistDecorator]
25
25
 
26
26
  const WithMaxBlocks = Template.bind({})
27
- WithMaxBlocks.args = { blockChainRenderProps: { maxBlocks: 4 } }
27
+ WithMaxBlocks.args = { blockChainRenderProps: { maxBlocks: 4, name: 'unknown' } }
28
28
  WithMaxBlocks.decorators = [ChainArchivistDecorator]
29
29
 
30
30
  const WithPagination = Template.bind({})
31
- WithPagination.args = { blockChainRenderProps: { pageSize: 4 } }
31
+ WithPagination.args = { blockChainRenderProps: { pageSize: 4, name: 'unknown' } }
32
32
  WithPagination.decorators = [ChainArchivistDecorator]
33
33
 
34
34
  export {
@@ -1,3 +1,4 @@
1
+ import { isAddress } from '@xylabs/hex'
1
2
  import { ChainProducersAnalyzer } from '@xyo-network/chain-analyze'
2
3
  import React, { useMemo } from 'react'
3
4
 
@@ -7,13 +8,13 @@ import type { BlockChainRenderFlexboxProps } from '../../../../../../types/index
7
8
  import { StaticListBase } from './Base.tsx'
8
9
 
9
10
  export const WithAnalysis: React.FC<BlockChainRenderFlexboxProps> = ({ blockChainRenderProps, ...props }) => {
10
- const { chainInformation } = blockChainRenderProps ?? {}
11
+ const { chainId } = blockChainRenderProps ?? {}
11
12
 
12
13
  const analyzers = useMemo(() => {
13
- if (chainInformation) {
14
+ if (isAddress(chainId)) {
14
15
  return { producers: new ChainProducersAnalyzer() } as ChainAnalyzers
15
16
  }
16
- }, [chainInformation])
17
+ }, [chainId])
17
18
 
18
19
  return (
19
20
  <ChainAnalyzersProvider analyzers={analyzers}>
@@ -14,7 +14,7 @@ export const useStaticBlockRenderComponents = (BlockComponent: ComponentType<Blo
14
14
  const { maxBlocks } = blockChainRenderProps ?? {}
15
15
  const pageSize = blockChainRenderProps?.pageSize ?? DEFAULT_PAGE_SIZE
16
16
 
17
- const chainIteratorParams = useMemo(() => blockChainRenderProps ?? {}, [blockChainRenderProps])
17
+ const chainIteratorParams = useMemo(() => blockChainRenderProps ?? { name: 'unknown' }, [blockChainRenderProps])
18
18
 
19
19
  const [params, paramsError] = useChainIteratorParams(chainIteratorParams)
20
20
 
@@ -22,11 +22,11 @@ Default.args = {}
22
22
  Default.decorators = [ChainArchivistDecorator]
23
23
 
24
24
  const WithMaxBlocks = Template.bind({})
25
- WithMaxBlocks.args = { blockChainRenderProps: { maxBlocks: 4 } }
25
+ WithMaxBlocks.args = { blockChainRenderProps: { maxBlocks: 4, name: 'unknown' } }
26
26
  WithMaxBlocks.decorators = [ChainArchivistDecorator]
27
27
 
28
28
  const WithPagination = Template.bind({})
29
- WithPagination.args = { blockChainRenderProps: { pageSize: 4 } }
29
+ WithPagination.args = { blockChainRenderProps: { pageSize: 4, name: 'unknown' } }
30
30
  WithPagination.decorators = [ChainArchivistDecorator]
31
31
 
32
32
  export {
@@ -8,17 +8,17 @@ interface ChainInfoProviderProps extends PropsWithChildren, Omit<ChainInfoState,
8
8
  }
9
9
 
10
10
  export const ChainInfoProvider: React.FC<ChainInfoProviderProps> = ({
11
- children, chainArchivist: chainArchivistProp, chainInformation: chainInformationProp, chainIterator: chainIteratorProp,
11
+ children, chainArchivist: chainArchivistProp, chainId: chainIdProp, chainIterator: chainIteratorProp,
12
12
  }) => {
13
13
  const [chainArchivist, setChainArchivist] = useState<ChainInfoState['chainArchivist']>(chainArchivistProp)
14
- const [chainInformation, setChainInformation] = useState<ChainInfoState['chainInformation']>(chainInformationProp)
14
+ const [chainId, setChainId] = useState<ChainInfoState['chainId']>(chainIdProp)
15
15
  const [chainIterator, setChainIterator] = useState<ChainInfoState['chainIterator']>(chainIteratorProp)
16
16
 
17
17
  const updateChainArchivist = (chainArchivist: ChainInfoState['chainArchivist']) => {
18
18
  setChainArchivist(chainArchivist)
19
19
  }
20
- const updateChainInformation = (chainInformation: ChainInfoState['chainInformation']) => {
21
- setChainInformation(chainInformation)
20
+ const updateChainId = (chainId: ChainInfoState['chainId']) => {
21
+ setChainId(chainId)
22
22
  }
23
23
  const updateChainIterator = (chainIterator: ChainInfoState['chainIterator']) => {
24
24
  setChainIterator(chainIterator)
@@ -29,8 +29,8 @@ export const ChainInfoProvider: React.FC<ChainInfoProviderProps> = ({
29
29
  }, [chainArchivistProp])
30
30
 
31
31
  useMemo(() => {
32
- updateChainInformation(chainInformationProp)
33
- }, [chainInformationProp])
32
+ updateChainId(chainIdProp)
33
+ }, [chainIdProp])
34
34
 
35
35
  useMemo(() => {
36
36
  updateChainIterator(chainIteratorProp)
@@ -38,13 +38,13 @@ export const ChainInfoProvider: React.FC<ChainInfoProviderProps> = ({
38
38
 
39
39
  const chainState: ChainInfoState = useMemo(() => ({
40
40
  chainArchivist,
41
- chainInformation,
41
+ chainId,
42
42
  chainIterator,
43
43
  updateChainArchivist,
44
- updateChainInformation,
44
+ updateChainId,
45
45
  updateChainIterator,
46
46
  provided: true,
47
- }), [chainArchivist, chainInformation, chainIterator, updateChainArchivist, updateChainInformation, updateChainIterator])
47
+ }), [chainArchivist, chainId, chainIterator, updateChainArchivist, updateChainId, updateChainIterator])
48
48
 
49
49
  return (
50
50
  <ChainInfoContext value={chainState}>
@@ -1,9 +1,10 @@
1
+ import type { Address } from '@xylabs/hex'
1
2
  import type { ContextExState } from '@xylabs/react-shared'
2
3
  import type { ArchivistInstance } from '@xyo-network/archivist-model'
3
- import type { ChainBlockNumberIterator, ChainInformation } from '@xyo-network/xl1-protocol'
4
+ import type { ChainBlockNumberIterator } from '@xyo-network/xl1-protocol'
4
5
 
5
6
  export type ChainInfoState = ContextExState<{
6
7
  chainArchivist?: ArchivistInstance
7
- chainInformation?: ChainInformation
8
+ chainId?: Address
8
9
  chainIterator?: ChainBlockNumberIterator
9
10
  }>
@@ -1,12 +1,12 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
- import { hydrateBlock } from '@xyo-network/chain-protocol'
2
+ import type { XyoChainIteratorParams } from '@xyo-network/chain-services'
3
3
  import { ChainBlockNumberIterationService } from '@xyo-network/chain-services'
4
4
  import { PayloadBuilder } from '@xyo-network/payload-builder'
5
5
  import type {
6
6
  EventingChainBlockNumberIterator, HeadEventArgs,
7
7
  HydratedBlock,
8
- XyoChainIteratorParams,
9
8
  } from '@xyo-network/xl1-protocol'
9
+ import { hydrateBlock } from '@xyo-network/xl1-protocol-sdk'
10
10
 
11
11
  export type Listener = (...args: Array<unknown>) => void
12
12
 
@@ -1,6 +1,7 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
2
  import { type Hash, isHash } from '@xylabs/hex'
3
3
  import { usePromise } from '@xylabs/react-promise'
4
+ import { isDefined } from '@xylabs/typeof'
4
5
  import type { ReadArchivist } from '@xyo-network/archivist-model'
5
6
  import { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
6
7
  import type { BlockBoundWitness } from '@xyo-network/xl1-protocol'
@@ -24,10 +25,10 @@ export const resolveDefinedHead = async (head: Hash, chainArchivist: ReadArchivi
24
25
  }
25
26
 
26
27
  export const useChainIteratorParams = ({
27
- chainArchivist, chainInformation, head,
28
+ chainArchivist, chainId, head, name,
28
29
  }: BlockChainIterator) => {
29
30
  return usePromise(async () => {
30
- if (chainArchivist && chainInformation && isHash(head)) {
31
+ if (isDefined(chainArchivist) && isDefined(chainId) && isHash(head)) {
31
32
  const [result] = await chainArchivist.get([head])
32
33
  const foundResult = assertEx(result, () => `Head not found: ${head}`)
33
34
  const resolvedHead = assertEx(
@@ -35,8 +36,8 @@ export const useChainIteratorParams = ({
35
36
  () => `Head is not a boundwitness: ${JSON.stringify(foundResult)}`,
36
37
  )
37
38
  return {
38
- chainArchivist, chainInformation, head: resolvedHead,
39
+ chainArchivist, chainId, head: resolvedHead, name,
39
40
  }
40
41
  }
41
- }, [chainArchivist, chainInformation, head])
42
+ }, [chainArchivist, chainId, head])
42
43
  }
@@ -1,5 +1,5 @@
1
1
  import { usePromise } from '@xylabs/react-promise'
2
- import type { XyoChainIteratorParams } from '@xyo-network/xl1-protocol'
2
+ import type { XyoChainIteratorParams } from '@xyo-network/chain-services'
3
3
  import {
4
4
  useEffect,
5
5
  useMemo, useRef, useSyncExternalStore,
@@ -1,13 +1,12 @@
1
1
  import { assertEx } from '@xylabs/assert'
2
2
  import { usePromise } from '@xylabs/react-promise'
3
3
  import type { ReadArchivist } from '@xyo-network/archivist-model'
4
- import { hydrateBlock } from '@xyo-network/chain-protocol'
4
+ import type { XyoChainIteratorParams } from '@xyo-network/chain-services'
5
5
  import { ChainBlockNumberIterationService } from '@xyo-network/chain-services'
6
6
  import { PayloadBuilder } from '@xyo-network/payload-builder'
7
- import type {
8
- BlockBoundWitness, HydratedBlock, XyoChainIteratorParams,
9
- } from '@xyo-network/xl1-protocol'
7
+ import type { BlockBoundWitness, HydratedBlock } from '@xyo-network/xl1-protocol'
10
8
  import { isBlockBoundWitness } from '@xyo-network/xl1-protocol'
9
+ import { hydrateBlock } from '@xyo-network/xl1-protocol-sdk'
11
10
 
12
11
  const getHydratedBlock = async (chainArchivist: ReadArchivist, head: BlockBoundWitness) => {
13
12
  const headHash = await PayloadBuilder.hash(head)
@@ -0,0 +1,8 @@
1
+ import type { Address } from '@xylabs/hex'
2
+ import type { Promisable } from '@xylabs/promise'
3
+
4
+ const id = 'ce080bf3043a40c6c8838c7e813c00ab53df1684'
5
+
6
+ export const getChainId = (): Promisable<Address> => {
7
+ return id
8
+ }
package/src/lib/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from './getChainArchivist.ts'
2
- export * from './getChainInformation.ts'
2
+ export * from './getChainId.ts'
@@ -3,11 +3,11 @@ import type { Decorator } from '@storybook/react-vite'
3
3
  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
- import { flattenHydratedBlocks } from '@xyo-network/chain-protocol'
7
6
  import { buildRandomBlockChain } from '@xyo-network/react-chain-shared'
7
+ import { flattenHydratedBlocks } from '@xyo-network/xl1-protocol-sdk'
8
8
  import React, { useEffect } from 'react'
9
9
 
10
- import { getChainInformation } from '../lib/index.ts'
10
+ import { getChainId } from '../lib/index.ts'
11
11
  import type { BlockChainRenderBaseProps } from '../types/index.ts'
12
12
 
13
13
  export const ChainArchivistDecorator: Decorator = (Story, context) => {
@@ -17,8 +17,8 @@ export const ChainArchivistDecorator: Decorator = (Story, context) => {
17
17
  const chainArchivist = await MemoryArchivist.create({ config: { schema: ArchivistConfigSchema, name: 'ChainArchivist' } })
18
18
  const flattened = flattenHydratedBlocks(randomBlockChain)
19
19
  await chainArchivist.insert(flattened)
20
- const chainInformation = await getChainInformation()
21
- return { chainArchivist, chainInformation }
20
+ const chainId = await getChainId()
21
+ return { chainArchivist, chainId }
22
22
  }
23
23
  }, [randomBlockChain])
24
24
 
@@ -4,12 +4,12 @@ import { delay } from '@xylabs/delay'
4
4
  import { usePromise } from '@xylabs/react-promise'
5
5
  import { MemoryArchivist } from '@xyo-network/archivist-memory'
6
6
  import { ArchivistConfigSchema } from '@xyo-network/archivist-model'
7
- import { flattenHydratedBlock } from '@xyo-network/chain-protocol'
8
7
  import { buildRandomBlockChain } from '@xyo-network/react-chain-shared'
9
8
  import type { BlockBoundWitness } from '@xyo-network/xl1-protocol'
9
+ import { flattenHydratedBlock } from '@xyo-network/xl1-protocol-sdk'
10
10
  import React, { useEffect, useState } from 'react'
11
11
 
12
- import { getChainInformation } from '../lib/index.ts'
12
+ import { getChainId } from '../lib/index.ts'
13
13
  import type { BlockChainRenderBaseProps } from '../types/index.ts'
14
14
 
15
15
  let chainArchivistRef: MemoryArchivist | undefined
@@ -51,8 +51,8 @@ export const ChainArchivistDelayedInsertDecorator: Decorator = (Story, context)
51
51
  }, [delayedInsertError])
52
52
 
53
53
  const [blockChainRenderProps] = usePromise(async () => {
54
- const chainInformation = await getChainInformation()
55
- return { chainArchivist, chainInformation }
54
+ const chainId = await getChainId()
55
+ return { chainArchivist, chainId }
56
56
  }, [chainArchivist])
57
57
 
58
58
  const props = {
@@ -1,6 +1,7 @@
1
1
  import type { Decorator } from '@storybook/react-vite'
2
2
  import { assertEx } from '@xylabs/assert'
3
3
  import { usePromise } from '@xylabs/react-promise'
4
+ import { isDefined } from '@xylabs/typeof'
4
5
  import { ChainBlockNumberIterationService } from '@xyo-network/chain-services'
5
6
  import { findFirstMatching } from '@xyo-network/chain-utils'
6
7
  import type { BlockBoundWitness } from '@xyo-network/xl1-protocol'
@@ -9,7 +10,7 @@ import React from 'react'
9
10
 
10
11
  import { ChainInfoProvider } from '../context/index.ts'
11
12
  import type { BridgedChainArchivistParams } from '../lib/index.ts'
12
- import { getChainArchivistFromBridge, getChainInformation } from '../lib/index.ts'
13
+ import { getChainArchivistFromBridge, getChainId } from '../lib/index.ts'
13
14
 
14
15
  const archivistConfig: BridgedChainArchivistParams = {
15
16
  url: 'http://localhost:8080',
@@ -17,28 +18,28 @@ const archivistConfig: BridgedChainArchivistParams = {
17
18
  }
18
19
 
19
20
  export const ChainInfoContextDecorator: Decorator = (Story, context) => {
20
- const [chainInformationResponse] = usePromise(async () => {
21
- return await getChainInformation()
21
+ const [chainIdResponse] = usePromise(async () => {
22
+ return await getChainId()
22
23
  }, [])
23
24
 
24
- const chainInformation = chainInformationResponse
25
+ const chainId = chainIdResponse
25
26
 
26
27
  const [chainArchivist] = usePromise(async () => {
27
28
  return await getChainArchivistFromBridge(archivistConfig)
28
29
  }, [])
29
30
 
30
31
  const [chainIterator] = usePromise(async () => {
31
- if (chainArchivist && chainInformation) {
32
+ if (isDefined(chainArchivist) && isDefined(chainId)) {
32
33
  const firstMatch = assertEx(await findFirstMatching(chainArchivist), () => `No head found in archivist: ${chainArchivist.id} `)
33
34
  const head: BlockBoundWitness = assertEx(isBlockBoundWitness(firstMatch)
34
35
  ? firstMatch
35
36
  : undefined, () => `Expected a block bound witness: ${JSON.stringify(firstMatch)}`)
36
37
  return await ChainBlockNumberIterationService.create({ chainArchivist, head })
37
38
  }
38
- }, [chainArchivist, chainInformation])
39
+ }, [chainArchivist, chainId])
39
40
 
40
41
  return (
41
- <ChainInfoProvider chainArchivist={chainArchivist} chainInformation={chainInformation} chainIterator={chainIterator}>
42
+ <ChainInfoProvider chainArchivist={chainArchivist} chainId={chainId} chainIterator={chainIterator}>
42
43
  <Story {...context} />
43
44
  </ChainInfoProvider>
44
45
  )
@@ -1,6 +1,5 @@
1
- import type { Hash } from '@xylabs/hex'
1
+ import type { Address, Hash } from '@xylabs/hex'
2
2
  import type { ArchivistInstance } from '@xyo-network/archivist-model'
3
- import type { ChainInformation } from '@xyo-network/xl1-protocol'
4
3
 
5
4
  /** Props that control the rendering (not blockchain specific) */
6
5
  export interface RenderProps {
@@ -11,12 +10,15 @@ export interface RenderProps {
11
10
  /** Fields needed to talk to a block chain iterator */
12
11
  export interface BlockChainIterator {
13
12
  chainArchivist?: ArchivistInstance
14
- chainInformation?: ChainInformation
13
+ chainId?: Address
15
14
  head?: Hash
15
+ name: string
16
16
  }
17
17
 
18
18
  /** Props for rendering a blockchain */
19
- export interface BlockChainRenderProps extends BlockChainIterator, RenderProps {}
19
+ export interface BlockChainRenderProps extends BlockChainIterator, RenderProps {
20
+
21
+ }
20
22
 
21
23
  /** Base interface for encapsulating blockChainRenderProps for easy extension */
22
24
  export interface BlockChainRenderBaseProps {
@@ -1,4 +0,0 @@
1
- import type { Promisable } from '@xylabs/promise';
2
- import type { ChainInformation } from '@xyo-network/xl1-protocol';
3
- export declare const getChainInformation: () => Promisable<ChainInformation>;
4
- //# sourceMappingURL=getChainInformation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getChainInformation.d.ts","sourceRoot":"","sources":["../../../src/lib/getChainInformation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAIjE,eAAO,MAAM,mBAAmB,QAAO,UAAU,CAAC,gBAAgB,CAGjE,CAAA"}
@@ -1,9 +0,0 @@
1
- import type { Promisable } from '@xylabs/promise'
2
- import type { ChainInformation } from '@xyo-network/xl1-protocol'
3
-
4
- const id = 'ce080bf3043a40c6c8838c7e813c00ab53df1684'
5
-
6
- export const getChainInformation = (): Promisable<ChainInformation> => {
7
- const chainInformation: ChainInformation = { id }
8
- return chainInformation
9
- }