@xyo-network/react-chain-blockchain 1.18.5 → 1.19.1
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/block/helpers/buildBlockChainRenderComponent.d.ts +2 -1
- package/dist/browser/components/block/helpers/buildBlockChainRenderComponent.d.ts.map +1 -1
- package/dist/browser/components/block/helpers/payloadCountsFromBlock.d.ts +2 -2
- package/dist/browser/components/block/helpers/payloadCountsFromBlock.d.ts.map +1 -1
- package/dist/browser/components/block/hooks/usePayloadCountsFromBlock.d.ts +2 -2
- package/dist/browser/components/block/hooks/usePayloadCountsFromBlock.d.ts.map +1 -1
- package/dist/browser/components/chain/hooks/useOnBlock.d.ts +5 -3
- package/dist/browser/components/chain/hooks/useOnBlock.d.ts.map +1 -1
- package/dist/browser/helpers/txsFromBlock.d.ts +2 -2
- package/dist/browser/helpers/txsFromBlock.d.ts.map +1 -1
- package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts +10 -6
- package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
- package/dist/browser/hooks/index.d.ts +1 -0
- package/dist/browser/hooks/index.d.ts.map +1 -1
- package/dist/browser/hooks/useBaseContext.d.ts +3 -0
- package/dist/browser/hooks/useBaseContext.d.ts.map +1 -0
- package/dist/browser/hooks/useTxsFromBlock.d.ts.map +1 -1
- package/dist/browser/index.mjs +64 -52
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +38 -38
- package/src/components/block/helpers/buildBlockChainRenderComponent.tsx +3 -1
- package/src/components/block/helpers/payloadCountsFromBlock.ts +4 -3
- package/src/components/block/hooks/usePayloadCountsFromBlock.ts +2 -2
- package/src/helpers/txsFromBlock.ts +3 -3
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useBaseContext.ts +8 -0
- package/src/hooks/useTxsFromBlock.ts +3 -1
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.
|
|
4
|
+
"version": "1.19.1",
|
|
5
5
|
"description": "XYO Layer One React SDK Blockchain",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -47,60 +47,60 @@
|
|
|
47
47
|
"package-cycle": "echo Nothing to do"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@storybook/react-vite": "~10.2.
|
|
50
|
+
"@storybook/react-vite": "~10.2.1",
|
|
51
51
|
"@xylabs/axios": "~5.0.64",
|
|
52
|
-
"@xylabs/react-animation": "~7.1.
|
|
53
|
-
"@xylabs/react-error": "~7.1.
|
|
54
|
-
"@xylabs/react-flexbox": "~7.1.
|
|
55
|
-
"@xylabs/react-promise": "~7.1.
|
|
56
|
-
"@xylabs/react-quick-tip-button": "~7.1.
|
|
57
|
-
"@xylabs/react-shared": "~7.1.
|
|
58
|
-
"@xylabs/react-theme": "~7.1.
|
|
52
|
+
"@xylabs/react-animation": "~7.1.11",
|
|
53
|
+
"@xylabs/react-error": "~7.1.11",
|
|
54
|
+
"@xylabs/react-flexbox": "~7.1.11",
|
|
55
|
+
"@xylabs/react-promise": "~7.1.11",
|
|
56
|
+
"@xylabs/react-quick-tip-button": "~7.1.11",
|
|
57
|
+
"@xylabs/react-shared": "~7.1.11",
|
|
58
|
+
"@xylabs/react-theme": "~7.1.11",
|
|
59
59
|
"@xylabs/sdk-js": "~5.0.64",
|
|
60
|
-
"@xyo-network/account": "~5.2
|
|
61
|
-
"@xyo-network/archivist-memory": "~5.2
|
|
62
|
-
"@xyo-network/archivist-model": "~5.2
|
|
63
|
-
"@xyo-network/boundwitness-builder": "~5.2
|
|
64
|
-
"@xyo-network/boundwitness-model": "~5.2
|
|
65
|
-
"@xyo-network/chain-analyze": "~1.
|
|
66
|
-
"@xyo-network/chain-protocol": "~1.
|
|
67
|
-
"@xyo-network/chain-wrappers": "~1.
|
|
68
|
-
"@xyo-network/module-model": "~5.2
|
|
69
|
-
"@xyo-network/payload-builder": "~5.2
|
|
70
|
-
"@xyo-network/payload-model": "~5.2
|
|
71
|
-
"@xyo-network/react-boundwitness-plugin": "~7.
|
|
72
|
-
"@xyo-network/react-chain-blockies": "~1.
|
|
73
|
-
"@xyo-network/react-chain-provider": "~1.
|
|
74
|
-
"@xyo-network/react-chain-shared": "~1.
|
|
75
|
-
"@xyo-network/react-error": "~7.
|
|
76
|
-
"@xyo-network/react-event": "~7.
|
|
77
|
-
"@xyo-network/react-payload-raw-info": "~7.
|
|
78
|
-
"@xyo-network/react-payload-table": "~7.
|
|
79
|
-
"@xyo-network/react-shared": "~7.
|
|
80
|
-
"@xyo-network/react-table": "~7.
|
|
81
|
-
"@xyo-network/xl1-sdk": "~1.
|
|
60
|
+
"@xyo-network/account": "~5.3.2",
|
|
61
|
+
"@xyo-network/archivist-memory": "~5.3.2",
|
|
62
|
+
"@xyo-network/archivist-model": "~5.3.2",
|
|
63
|
+
"@xyo-network/boundwitness-builder": "~5.3.2",
|
|
64
|
+
"@xyo-network/boundwitness-model": "~5.3.2",
|
|
65
|
+
"@xyo-network/chain-analyze": "~1.19.1",
|
|
66
|
+
"@xyo-network/chain-protocol": "~1.19.1",
|
|
67
|
+
"@xyo-network/chain-wrappers": "~1.19.1",
|
|
68
|
+
"@xyo-network/module-model": "~5.3.2",
|
|
69
|
+
"@xyo-network/payload-builder": "~5.3.2",
|
|
70
|
+
"@xyo-network/payload-model": "~5.3.2",
|
|
71
|
+
"@xyo-network/react-boundwitness-plugin": "~7.5.0",
|
|
72
|
+
"@xyo-network/react-chain-blockies": "~1.19.1",
|
|
73
|
+
"@xyo-network/react-chain-provider": "~1.19.1",
|
|
74
|
+
"@xyo-network/react-chain-shared": "~1.19.1",
|
|
75
|
+
"@xyo-network/react-error": "~7.5.0",
|
|
76
|
+
"@xyo-network/react-event": "~7.5.0",
|
|
77
|
+
"@xyo-network/react-payload-raw-info": "~7.5.0",
|
|
78
|
+
"@xyo-network/react-payload-table": "~7.5.0",
|
|
79
|
+
"@xyo-network/react-shared": "~7.5.0",
|
|
80
|
+
"@xyo-network/react-table": "~7.5.0",
|
|
81
|
+
"@xyo-network/xl1-sdk": "~1.20.9"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@emotion/react": "~11.14.0",
|
|
85
85
|
"@emotion/styled": "~11.14.1",
|
|
86
86
|
"@mui/icons-material": "~7.3.7",
|
|
87
87
|
"@mui/material": "~7.3.7",
|
|
88
|
-
"@types/react": "~19.2.
|
|
89
|
-
"@xylabs/react-button": "~7.1.
|
|
88
|
+
"@types/react": "~19.2.10",
|
|
89
|
+
"@xylabs/react-button": "~7.1.11",
|
|
90
90
|
"@xylabs/sdk-js": "~5.0.64",
|
|
91
91
|
"@xylabs/ts-scripts-yarn3": "~7.3.2",
|
|
92
92
|
"@xylabs/tsconfig": "~7.3.2",
|
|
93
93
|
"@xylabs/tsconfig-dom": "~7.3.2",
|
|
94
94
|
"@xylabs/tsconfig-react": "~7.3.2",
|
|
95
|
-
"@xyo-network/api-models": "~5.2
|
|
96
|
-
"@xyo-network/bridge-http": "~5.2
|
|
97
|
-
"@xyo-network/xl1-sdk": "~1.
|
|
98
|
-
"axios": "^1.13.
|
|
95
|
+
"@xyo-network/api-models": "~5.3.2",
|
|
96
|
+
"@xyo-network/bridge-http": "~5.3.2",
|
|
97
|
+
"@xyo-network/xl1-sdk": "~1.20.9",
|
|
98
|
+
"axios": "^1.13.4",
|
|
99
99
|
"eslint": "^9.39.2",
|
|
100
100
|
"react": "~19.2.4",
|
|
101
101
|
"react-dom": "~19.2.4",
|
|
102
102
|
"react-router-dom": "^7.13.0",
|
|
103
|
-
"storybook": "~10.2.
|
|
103
|
+
"storybook": "~10.2.1",
|
|
104
104
|
"typescript": "~5.9.3"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BaseContext } from '@xyo-network/xl1-sdk'
|
|
1
2
|
import type { ComponentType } from 'react'
|
|
2
3
|
import React from 'react'
|
|
3
4
|
|
|
@@ -8,11 +9,12 @@ import type {
|
|
|
8
9
|
} from '../../../types/index.ts'
|
|
9
10
|
|
|
10
11
|
export const buildBlockChainRenderComponent = async (
|
|
12
|
+
context: BaseContext,
|
|
11
13
|
BlockComponent: ComponentType<BlockComponentWithTxsProps>,
|
|
12
14
|
blockComponentProps: BlockComponentProps,
|
|
13
15
|
) => {
|
|
14
16
|
const { block, ...remainingProps } = blockComponentProps
|
|
15
|
-
const blockTxs = await txsFromBlock(block)
|
|
17
|
+
const blockTxs = await txsFromBlock(context, block)
|
|
16
18
|
const txHashes = blockTxs.map(([_, hash]) => hash)
|
|
17
19
|
|
|
18
20
|
const item: BlockChainRenderComponent = {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import
|
|
2
|
+
import type { HydratedBlockWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
3
|
+
import { isTransactionBoundWitness } from '@xyo-network/xl1-sdk'
|
|
3
4
|
|
|
4
|
-
export const payloadCountsFromBlock = ([block, payloads]:
|
|
5
|
+
export const payloadCountsFromBlock = ([block, payloads]: HydratedBlockWithHashMeta): [number, number] => {
|
|
5
6
|
const publicPayloads = block.payload_schemas.filter(schema => schema !== BoundWitnessSchema)
|
|
6
7
|
const transactionHashes = payloads.filter(payload => isTransactionBoundWitness(payload)).flatMap(payload => payload.payload_hashes)
|
|
7
|
-
const privateHashes = transactionHashes.filter(hash => !
|
|
8
|
+
const privateHashes = transactionHashes.filter(hash => !payloads.some(payload => payload._hash === hash))
|
|
8
9
|
return [publicPayloads.length, privateHashes.length]
|
|
9
10
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HydratedBlockWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
2
2
|
import { useMemo } from 'react'
|
|
3
3
|
|
|
4
4
|
import { payloadCountsFromBlock } from '../helpers/index.ts'
|
|
5
5
|
|
|
6
|
-
export const usePayloadCountsFromBlock = (block?:
|
|
6
|
+
export const usePayloadCountsFromBlock = (block?: HydratedBlockWithHashMeta): [number | undefined, number | undefined, Error | undefined] => {
|
|
7
7
|
return useMemo(() => {
|
|
8
8
|
if (block) {
|
|
9
9
|
return [...payloadCountsFromBlock(block), undefined]
|
|
@@ -2,10 +2,10 @@ import type { Hash } from '@xylabs/sdk-js'
|
|
|
2
2
|
import { HydratedBlockWrapper } from '@xyo-network/chain-wrappers'
|
|
3
3
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
4
4
|
import type { Payload } from '@xyo-network/payload-model'
|
|
5
|
-
import type { HydratedBlockWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
5
|
+
import type { BaseContext, HydratedBlockWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
6
6
|
|
|
7
|
-
export const txsFromBlock = async (block: HydratedBlockWithHashMeta): Promise<[Payload, Hash][]> => {
|
|
8
|
-
const wrapper = await HydratedBlockWrapper.parse(block)
|
|
7
|
+
export const txsFromBlock = async (context: BaseContext, block: HydratedBlockWithHashMeta): Promise<[Payload, Hash][]> => {
|
|
8
|
+
const wrapper = await HydratedBlockWrapper.parse(context, block)
|
|
9
9
|
const txs = wrapper.transactions
|
|
10
10
|
const txPayloads = txs.map(tx => tx.boundWitness)
|
|
11
11
|
return await PayloadBuilder.hashPairs(txPayloads)
|
package/src/hooks/index.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BaseContext } from '@xyo-network/xl1-sdk'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
|
|
4
|
+
export const useBaseContext = () => {
|
|
5
|
+
const [context] = useState<BaseContext>({ caches: {}, singletons: {} })
|
|
6
|
+
// TODO: Update to use actual rect context when available
|
|
7
|
+
return context
|
|
8
|
+
}
|
|
@@ -2,11 +2,13 @@ import { usePromise } from '@xylabs/react-promise'
|
|
|
2
2
|
import type { HydratedBlockWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
3
3
|
|
|
4
4
|
import { txsFromBlock } from '../helpers/index.ts'
|
|
5
|
+
import { useBaseContext } from './useBaseContext.ts'
|
|
5
6
|
|
|
6
7
|
export const useTxsFromBlock = (block?: HydratedBlockWithHashMeta) => {
|
|
8
|
+
const context = useBaseContext()
|
|
7
9
|
return usePromise(async () => {
|
|
8
10
|
if (block) {
|
|
9
|
-
return await txsFromBlock(block)
|
|
11
|
+
return await txsFromBlock(context, block)
|
|
10
12
|
}
|
|
11
13
|
}, [block])
|
|
12
14
|
}
|