@xyo-network/react-chain-blockchain 1.3.15 → 1.3.16
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/index.mjs +49 -49
- package/dist/browser/index.mjs.map +1 -1
- package/dist/types/components/block/ProducerChip.d.ts.map +1 -1
- package/dist/types/components/block/hooks/useDynamicBlockComponents.d.ts +1 -1
- package/dist/types/components/block/hooks/useDynamicBlockComponents.d.ts.map +1 -1
- package/dist/types/components/block/hooks/useStaticBlockComponents.d.ts.map +1 -1
- package/dist/types/components/block/table/cell/Hash.d.ts.map +1 -1
- package/dist/types/components/block/table/cell/JsonView.d.ts.map +1 -1
- package/dist/types/components/payload/fields/BlockNumberTextField.d.ts.map +1 -1
- package/dist/types/components/transactions/submit/SubmitChain.d.ts.map +1 -1
- package/dist/types/hooks/chain-iterator/useChainIteratorParams.d.ts +1 -1
- package/dist/types/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
- package/dist/types/hooks/useIterateChain.d.ts.map +1 -1
- package/package.json +22 -21
- package/src/components/block/ProducerChip.tsx +9 -2
- package/src/components/block/hooks/useDynamicBlockComponents.ts +2 -2
- package/src/components/block/hooks/useStaticBlockComponents.ts +2 -3
- package/src/components/block/table/cell/Hash.tsx +3 -2
- package/src/components/block/table/cell/JsonView.tsx +2 -1
- package/src/components/block/table/cell/hooks/useLinkedBlockItem.tsx +1 -1
- package/src/components/chain/render/dynamic/hooks/useRemoteBlockChainRenderProps.ts +1 -1
- package/src/components/chain/render/static/flexbox/variants/Base.tsx +1 -1
- package/src/components/chain/render/static/table/variants/Base.tsx +1 -1
- package/src/components/chain/stats/Dialog.tsx +1 -1
- package/src/components/payload/builder/producer-intent/Form.tsx +1 -1
- package/src/components/payload/builder/transfer/Form.tsx +2 -2
- package/src/components/payload/builder/transfer/builder/SingleFlexbox.tsx +2 -2
- package/src/components/payload/fields/BlockNumberTextField.tsx +5 -3
- package/src/components/payload/fields/XyoAddressTextField.tsx +3 -3
- package/src/components/transactions/submit/SubmitChain.tsx +1 -2
- package/src/hooks/chain-iterator/useChainIteratorParams.ts +2 -2
- package/src/hooks/chain-iterator/useChainIteratorUpdatingHead.ts +1 -1
- package/src/hooks/useIterateChain.ts +27 -30
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProducerChip.d.ts","sourceRoot":"","sources":["../../../../src/components/block/ProducerChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAI9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAkB,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACvD,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB;AACD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"ProducerChip.d.ts","sourceRoot":"","sources":["../../../../src/components/block/ProducerChip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAI9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAkB,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACvD,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB;AACD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAe9D,CAAA"}
|
|
@@ -3,6 +3,6 @@ import type { ComponentType } from 'react';
|
|
|
3
3
|
import type { BlockChainRenderComponent, BlockComponentWithTxsProps } from '../../../types/index.ts';
|
|
4
4
|
export declare const useDynamicBlockComponents: (BlockComponent: ComponentType<BlockComponentWithTxsProps>, params?: XyoChainIteratorParams, maxBlocks?: number) => {
|
|
5
5
|
blockChainRenderComponents: BlockChainRenderComponent[];
|
|
6
|
-
onAddBlock: (block: HydratedBlock) => Promise<void>;
|
|
6
|
+
onAddBlock: (block: HydratedBlock | undefined) => Promise<void>;
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=useDynamicBlockComponents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDynamicBlockComponents.d.ts","sourceRoot":"","sources":["../../../../../src/components/block/hooks/useDynamicBlockComponents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAI1C,OAAO,KAAK,EACV,yBAAyB,EACJ,0BAA0B,EAChD,MAAM,yBAAyB,CAAA;AAGhC,eAAO,MAAM,yBAAyB,GAAI,gBAAgB,aAAa,CAAC,0BAA0B,CAAC,EAAE,SAAS,sBAAsB,EAAE,YAAY,MAAM;;wBAMrH,aAAa;
|
|
1
|
+
{"version":3,"file":"useDynamicBlockComponents.d.ts","sourceRoot":"","sources":["../../../../../src/components/block/hooks/useDynamicBlockComponents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAI1C,OAAO,KAAK,EACV,yBAAyB,EACJ,0BAA0B,EAChD,MAAM,yBAAyB,CAAA;AAGhC,eAAO,MAAM,yBAAyB,GAAI,gBAAgB,aAAa,CAAC,0BAA0B,CAAC,EAAE,SAAS,sBAAsB,EAAE,YAAY,MAAM;;wBAMrH,aAAa,GAAG,SAAS;CAuB3D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStaticBlockComponents.d.ts","sourceRoot":"","sources":["../../../../../src/components/block/hooks/useStaticBlockComponents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAG1C,OAAO,KAAK,EAAuB,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AAG9F,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,aAAa,CAAC,0BAA0B,CAAC,EACzD,SAAS,sBAAsB,EAC/B,SAAS,aAAa,EAAE;;;
|
|
1
|
+
{"version":3,"file":"useStaticBlockComponents.d.ts","sourceRoot":"","sources":["../../../../../src/components/block/hooks/useStaticBlockComponents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAG1C,OAAO,KAAK,EAAuB,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AAG9F,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,aAAa,CAAC,0BAA0B,CAAC,EACzD,SAAS,sBAAsB,EAC/B,SAAS,aAAa,EAAE;;;CAoBzB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hash.d.ts","sourceRoot":"","sources":["../../../../../../src/components/block/table/cell/Hash.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Hash.d.ts","sourceRoot":"","sources":["../../../../../../src/components/block/table/cell/Hash.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAG7D,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAqChE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonView.d.ts","sourceRoot":"","sources":["../../../../../../src/components/block/table/cell/JsonView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"JsonView.d.ts","sourceRoot":"","sources":["../../../../../../src/components/block/table/cell/JsonView.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEzD,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;CAAG;AAE3E,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CA4BxE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockNumberTextField.d.ts","sourceRoot":"","sources":["../../../../../src/components/payload/fields/BlockNumberTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAK3D,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,UAAU,yBAA0B,SAAQ,sBAAsB;IAChE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oBAAoB,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CACtD;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"BlockNumberTextField.d.ts","sourceRoot":"","sources":["../../../../../src/components/payload/fields/BlockNumberTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAK3D,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,UAAU,yBAA0B,SAAQ,sBAAsB;IAChE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oBAAoB,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CACtD;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA0BpE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmitChain.d.ts","sourceRoot":"","sources":["../../../../../src/components/transactions/submit/SubmitChain.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAQvC,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"SubmitChain.d.ts","sourceRoot":"","sources":["../../../../../src/components/transactions/submit/SubmitChain.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAQvC,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EA6D1C,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Hash } from '@xylabs/hex';
|
|
2
2
|
import type { ReadArchivist } from '@xyo-network/archivist-model';
|
|
3
3
|
import type { BlockBoundWitness } from '@xyo-network/xl1-protocol';
|
|
4
4
|
import type { BlockChainIterator } from '../../types/index.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChainIteratorParams.d.ts","sourceRoot":"","sources":["../../../../src/hooks/chain-iterator/useChainIteratorParams.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useChainIteratorParams.d.ts","sourceRoot":"","sources":["../../../../src/hooks/chain-iterator/useChainIteratorParams.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAU,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAEjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAGlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAE9D,eAAO,MAAM,kBAAkB,GAAU,MAAM,IAAI,EAAE,gBAAgB,aAAa,iFAajF,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,6CAEpC,kBAAkB;;;;;;;;;;;;;;;;;;;;8FAcpB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIterateChain.d.ts","sourceRoot":"","sources":["../../../src/hooks/useIterateChain.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACS,aAAa,EAAE,sBAAsB,EACzD,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"useIterateChain.d.ts","sourceRoot":"","sources":["../../../src/hooks/useIterateChain.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACS,aAAa,EAAE,sBAAsB,EACzD,MAAM,2BAA2B,CAAA;AA2ClC,eAAO,MAAM,eAAe,GAC1B,sBAAsB,sBAAsB,EAC5C,WAAW,MAAM,kHAKlB,CAAA"}
|
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.3.
|
|
4
|
+
"version": "1.3.16",
|
|
5
5
|
"description": "XYO Layer One React SDK Blockchain",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"package-cycle": "echo Nothing to do"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@xylabs/assert": "^4.
|
|
41
|
-
"@xylabs/axios": "^4.
|
|
42
|
-
"@xylabs/eth-address": "^4.
|
|
43
|
-
"@xylabs/exists": "^4.
|
|
44
|
-
"@xylabs/hex": "^4.
|
|
45
|
-
"@xylabs/promise": "^4.
|
|
40
|
+
"@xylabs/assert": "^4.9.2",
|
|
41
|
+
"@xylabs/axios": "^4.9.2",
|
|
42
|
+
"@xylabs/eth-address": "^4.9.2",
|
|
43
|
+
"@xylabs/exists": "^4.9.2",
|
|
44
|
+
"@xylabs/hex": "^4.9.2",
|
|
45
|
+
"@xylabs/promise": "^4.9.2",
|
|
46
46
|
"@xylabs/react-animation": "^6.2.19",
|
|
47
47
|
"@xylabs/react-error": "^6.2.19",
|
|
48
48
|
"@xylabs/react-flexbox": "^6.2.19",
|
|
@@ -55,38 +55,39 @@
|
|
|
55
55
|
"@xyo-network/boundwitness-builder": "^3.14.16",
|
|
56
56
|
"@xyo-network/boundwitness-model": "^3.14.16",
|
|
57
57
|
"@xyo-network/bridge-http": "^3.14.16",
|
|
58
|
-
"@xyo-network/chain-analyze": "^1.3.
|
|
59
|
-
"@xyo-network/chain-protocol": "^1.3.
|
|
60
|
-
"@xyo-network/chain-services": "^1.3.
|
|
58
|
+
"@xyo-network/chain-analyze": "^1.3.16",
|
|
59
|
+
"@xyo-network/chain-protocol": "^1.3.16",
|
|
60
|
+
"@xyo-network/chain-services": "^1.3.16",
|
|
61
61
|
"@xyo-network/module-model": "^3.14.16",
|
|
62
62
|
"@xyo-network/payload-builder": "^3.14.16",
|
|
63
63
|
"@xyo-network/payload-model": "^3.14.16",
|
|
64
64
|
"@xyo-network/react-boundwitness-plugin": "^5.2.7",
|
|
65
|
-
"@xyo-network/react-chain-blockies": "^1.3.
|
|
65
|
+
"@xyo-network/react-chain-blockies": "^1.3.16",
|
|
66
66
|
"@xyo-network/react-event": "^5.2.7",
|
|
67
67
|
"@xyo-network/react-payload-raw-info": "^5.2.7",
|
|
68
68
|
"@xyo-network/react-payload-table": "^5.2.7",
|
|
69
69
|
"@xyo-network/react-shared": "^5.2.7",
|
|
70
70
|
"@xyo-network/react-table": "^5.2.7",
|
|
71
|
-
"@xyo-network/xl1-protocol": "^1.3.
|
|
72
|
-
"@xyo-network/xl1-protocol-sdk": "^1.3.
|
|
71
|
+
"@xyo-network/xl1-protocol": "^1.3.12",
|
|
72
|
+
"@xyo-network/xl1-protocol-sdk": "^1.3.16"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@emotion/react": "^11.14.0",
|
|
76
76
|
"@emotion/styled": "^11.14.0",
|
|
77
|
-
"@mui/icons-material": "^7.0
|
|
78
|
-
"@mui/material": "^7.0
|
|
77
|
+
"@mui/icons-material": "^7.1.0",
|
|
78
|
+
"@mui/material": "^7.1.0",
|
|
79
79
|
"@storybook/react": "^8.6.12",
|
|
80
|
-
"@types/react": "^19.1.
|
|
81
|
-
"@xylabs/delay": "^4.
|
|
82
|
-
"@xylabs/hex": "^4.
|
|
80
|
+
"@types/react": "^19.1.3",
|
|
81
|
+
"@xylabs/delay": "^4.9.2",
|
|
82
|
+
"@xylabs/hex": "^4.9.2",
|
|
83
83
|
"@xylabs/ts-scripts-yarn3": "^6.5.5",
|
|
84
84
|
"@xylabs/tsconfig-react": "^6.5.5",
|
|
85
85
|
"@xyo-network/api-models": "^3.14.16",
|
|
86
86
|
"@xyo-network/archivist-memory": "^3.14.16",
|
|
87
|
-
"@xyo-network/chain-ethereum": "^1.3.
|
|
88
|
-
"@xyo-network/chain-utils": "^1.3.
|
|
89
|
-
"
|
|
87
|
+
"@xyo-network/chain-ethereum": "^1.3.16",
|
|
88
|
+
"@xyo-network/chain-utils": "^1.3.16",
|
|
89
|
+
"@xyo-network/react-chain-shared": "^1.3.16",
|
|
90
|
+
"knip": "^5.54.1",
|
|
90
91
|
"react": "^19.1.0",
|
|
91
92
|
"react-dom": "^19.1.0",
|
|
92
93
|
"react-router-dom": "^7.5.3",
|
|
@@ -11,9 +11,16 @@ export interface BlockProducerChipProps extends ChipProps {
|
|
|
11
11
|
export const BlockProducerChip: React.FC<BlockProducerChipProps> = ({ block, ...props }) => {
|
|
12
12
|
const blockProducer = block?.[0].addresses[0]
|
|
13
13
|
|
|
14
|
-
const shortedBlockProducer = blockProducer ? EthAddress.parse(blockProducer)?.toShortString(3)
|
|
14
|
+
const shortedBlockProducer = blockProducer === undefined ? null : EthAddress.parse(blockProducer)?.toShortString(3)
|
|
15
15
|
|
|
16
16
|
const avatar = useMemo(() => blockProducer === '' ? undefined : <BlockiesAvatar blockiesOptions={{ seed: blockProducer }} />, [blockProducer])
|
|
17
17
|
|
|
18
|
-
return
|
|
18
|
+
return (
|
|
19
|
+
<Chip
|
|
20
|
+
avatar={avatar}
|
|
21
|
+
label={typeof shortedBlockProducer === 'string' ? `${shortedBlockProducer}` : null}
|
|
22
|
+
title={`Block producer: ${blockProducer}`}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
19
26
|
}
|
|
@@ -15,7 +15,7 @@ export const useDynamicBlockComponents = (BlockComponent: ComponentType<BlockCom
|
|
|
15
15
|
|
|
16
16
|
const { onBlock } = useChainAnalyzersContext()
|
|
17
17
|
|
|
18
|
-
const onAddBlock = async (block: HydratedBlock) => {
|
|
18
|
+
const onAddBlock = async (block: HydratedBlock | undefined) => {
|
|
19
19
|
if (!block || !chainArchivist) return
|
|
20
20
|
|
|
21
21
|
const blockComponentProps: BlockComponentProps = { block }
|
|
@@ -27,7 +27,7 @@ export const useDynamicBlockComponents = (BlockComponent: ComponentType<BlockCom
|
|
|
27
27
|
setBlockChainRenderComponents((blockComponents) => {
|
|
28
28
|
const newBlockComponents = [newBlockComponent, ...blockComponents]
|
|
29
29
|
|
|
30
|
-
if (maxBlocks && newBlockComponents.length > maxBlocks) {
|
|
30
|
+
if (maxBlocks !== undefined && newBlockComponents.length > maxBlocks) {
|
|
31
31
|
// trim the last block if we exceed the max
|
|
32
32
|
newBlockComponents.pop()
|
|
33
33
|
}
|
|
@@ -17,10 +17,9 @@ export const useStaticBlockComponents = (
|
|
|
17
17
|
const resolvedBlockWithStorage = blocks ?? []
|
|
18
18
|
if (!params?.chainArchivist) return []
|
|
19
19
|
|
|
20
|
-
const { chainArchivist } = params
|
|
21
|
-
|
|
22
20
|
return await Promise.all(resolvedBlockWithStorage?.map(async (block) => {
|
|
23
|
-
|
|
21
|
+
// TODO: Figure out why this onBlock is always defined (per TS), even though the context is optional?
|
|
22
|
+
if (onBlock) {
|
|
24
23
|
await onBlock(block)
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
Chip,
|
|
4
4
|
TableCell, Tooltip,
|
|
5
5
|
} from '@mui/material'
|
|
6
|
+
import { isHash } from '@xylabs/hex'
|
|
6
7
|
import type { IdenticonProps } from '@xylabs/react-identicon'
|
|
7
8
|
import { Identicon } from '@xylabs/react-identicon'
|
|
8
9
|
import { usePayloadRootHash } from '@xyo-network/react-shared'
|
|
@@ -25,11 +26,11 @@ export const BlockHashTableCell: React.FC<BlockHashTableCellProps> = ({
|
|
|
25
26
|
const [ref, handleClick] = useLinkedBlockItem('block-hash', hash)
|
|
26
27
|
const [notAvailable, setNotAvailable] = React.useState(false)
|
|
27
28
|
|
|
28
|
-
const shortenedHash = hash ? `${hash.slice(0, 4)}...${hash.slice(-5, -1)}` : ''
|
|
29
|
+
const shortenedHash = isHash(hash) ? `${hash.slice(0, 4)}...${hash.slice(-5, -1)}` : ''
|
|
29
30
|
|
|
30
31
|
return (
|
|
31
32
|
<TableCell ref={ref} {...props}>
|
|
32
|
-
{hash
|
|
33
|
+
{isHash(hash)
|
|
33
34
|
? (
|
|
34
35
|
<Tooltip title={`Block Hash: ${hash}`}>
|
|
35
36
|
<Chip
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
Dialog, DialogActions, DialogContent, DialogTitle, IconButton, TableCell,
|
|
5
5
|
} from '@mui/material'
|
|
6
6
|
import { ellipsize } from '@xylabs/eth-address'
|
|
7
|
+
import { isHash } from '@xylabs/hex'
|
|
7
8
|
import { FlexRow } from '@xylabs/react-flexbox'
|
|
8
9
|
import { JsonViewerEx } from '@xyo-network/react-payload-raw-info'
|
|
9
10
|
import { usePayloadRootHash } from '@xyo-network/react-shared'
|
|
@@ -18,7 +19,7 @@ export const BlockJsonViewTableCell: React.FC<BlockJsonViewTableCellProps> = ({
|
|
|
18
19
|
const onClose = () => setOpen(false)
|
|
19
20
|
|
|
20
21
|
const hash = usePayloadRootHash(block?.[0])
|
|
21
|
-
const title = hash ? `JSON for ${ellipsize(hash, 5)}` : 'JSON'
|
|
22
|
+
const title = isHash(hash) ? `JSON for ${ellipsize(hash, 5)}` : 'JSON'
|
|
22
23
|
|
|
23
24
|
return (
|
|
24
25
|
<TableCell {...props}>
|
|
@@ -9,7 +9,7 @@ export const useLinkedBlockItem = (noun?: BlockHeaderEventNouns, data?: string |
|
|
|
9
9
|
const handleClick = (event: React.MouseEvent) => {
|
|
10
10
|
event.preventDefault()
|
|
11
11
|
event.stopPropagation()
|
|
12
|
-
if (
|
|
12
|
+
if (noun === undefined) {
|
|
13
13
|
console.warn('useLinkedBlockItem: noun is required')
|
|
14
14
|
return
|
|
15
15
|
}
|
|
@@ -12,7 +12,7 @@ export const useRemoteBlockChainRenderProps = (
|
|
|
12
12
|
blockChainRenderPropsArg?: BlockChainRenderProps,
|
|
13
13
|
): BlockChainRenderBaseProps => {
|
|
14
14
|
const [chainArchivist, chainArchivistError] = usePromise(async () => {
|
|
15
|
-
if (url && chainArchivistModuleId) {
|
|
15
|
+
if (url !== undefined && chainArchivistModuleId !== undefined) {
|
|
16
16
|
return await getChainArchivistFromBridge({ url, chainArchivistModuleId })
|
|
17
17
|
}
|
|
18
18
|
}, [url, chainArchivistModuleId])
|
|
@@ -17,7 +17,7 @@ export const StaticListBase: React.FC<BlockChainRenderFlexboxProps> = ({ blockCh
|
|
|
17
17
|
return (
|
|
18
18
|
<FlexCol alignItems="start" gap={2} width="100%" {...props}>
|
|
19
19
|
{errors?.map(error => <ErrorRender error={error} key={error.name} scope="StaticBlockchainFlexboxInner" />)}
|
|
20
|
-
{paginatedBlockComponents?.length
|
|
20
|
+
{(paginatedBlockComponents?.length ?? 0) > 0
|
|
21
21
|
? (
|
|
22
22
|
<FlexGrowRow justifyContent="space-between" width="100%">
|
|
23
23
|
<ChainAnalyzerStatsDialogFromContext />
|
|
@@ -16,7 +16,7 @@ export const Base: React.FC<BlockChainRenderTableExProps> = ({ blockChainRenderP
|
|
|
16
16
|
return (
|
|
17
17
|
<FlexCol alignItems="start" gap={2} width="100%" {...props}>
|
|
18
18
|
{errors?.map(error => <ErrorRender error={error} key={error.name} scope="StaticBlockchainFlexboxInner" />)}
|
|
19
|
-
{paginatedBlockComponents?.length
|
|
19
|
+
{(paginatedBlockComponents?.length ?? 0) > 0
|
|
20
20
|
? (
|
|
21
21
|
<FlexGrowRow justifyContent="space-between" width="100%">
|
|
22
22
|
<BlockChainPagination count={blockComponents?.length ?? 0} onPageChange={onPageChange} page={page} rowsPerPage={pageSize} />
|
|
@@ -18,7 +18,7 @@ export const ChainAnalyzerStatsDialog: React.FC<ChainAnalyzerStatsDialogProps> =
|
|
|
18
18
|
<Dialog {...props}>
|
|
19
19
|
<DialogTitle>Chain Analysis</DialogTitle>
|
|
20
20
|
<DialogContent>
|
|
21
|
-
{
|
|
21
|
+
{statsUpdated > 0 && Object.entries(analyzers).map(([id, analyzer]) => (
|
|
22
22
|
<div key={id}>
|
|
23
23
|
{id === 'producers' && (
|
|
24
24
|
<BlockProducerStatsFlexbox payload={analyzer.result()} />
|
|
@@ -24,7 +24,7 @@ export const ProducerIntentBuilderForm: React.FC<ProducerIntentBuilderFormProps>
|
|
|
24
24
|
setBlockRangeError(new Error('Expires must be greater than Not Before'))
|
|
25
25
|
} else {
|
|
26
26
|
setBlockRangeError(undefined)
|
|
27
|
-
if (delegate) {
|
|
27
|
+
if (delegate !== undefined) {
|
|
28
28
|
// create the payload
|
|
29
29
|
const payload = createProducerChainStakeIntent(delegate, exp, nbf)
|
|
30
30
|
return payload
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button, FormControl } from '@mui/material'
|
|
2
|
-
import type
|
|
2
|
+
import { type Address, isAddress } from '@xylabs/hex'
|
|
3
3
|
import type { Transfer } from '@xyo-network/xl1-protocol'
|
|
4
4
|
import { TransferSchema } from '@xyo-network/xl1-protocol'
|
|
5
5
|
import type { MouseEventHandler } from 'react'
|
|
@@ -17,7 +17,7 @@ export const TransferBuilderForm: React.FC<TransferBuilderFormProps> = ({ onBuil
|
|
|
17
17
|
const [transfers, setTransfers] = useState<TransferAmount[]>([])
|
|
18
18
|
|
|
19
19
|
const transferPayload: Transfer | undefined = useMemo(() => {
|
|
20
|
-
if (fromAddress && transfers.length > 0) {
|
|
20
|
+
if (isAddress(fromAddress) && transfers.length > 0) {
|
|
21
21
|
const transfersRecord = {} as Transfer['transfers']
|
|
22
22
|
for (const transfer of transfers) {
|
|
23
23
|
transfersRecord[transfer.to] = transfer.amount
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
FormControl, Icon, IconButton,
|
|
4
4
|
} from '@mui/material'
|
|
5
5
|
import type { Address } from '@xylabs/hex'
|
|
6
|
-
import { toHex } from '@xylabs/hex'
|
|
6
|
+
import { isAddress, toHex } from '@xylabs/hex'
|
|
7
7
|
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
8
8
|
import { FlexRow } from '@xylabs/react-flexbox'
|
|
9
9
|
import { BigIntInput } from '@xyo-network/react-shared'
|
|
@@ -27,7 +27,7 @@ export const SingleTransferBuilderFlexbox: React.FC<SingleTransferBuilderFlexbox
|
|
|
27
27
|
const [amount, setAmount] = useState<bigint>()
|
|
28
28
|
|
|
29
29
|
const transferAmount = useMemo(() => {
|
|
30
|
-
if (toAddress && amount) {
|
|
30
|
+
if (isAddress(toAddress) && amount !== undefined) {
|
|
31
31
|
return {
|
|
32
32
|
...singleTransfer,
|
|
33
33
|
amount: toHex(amount),
|
|
@@ -17,21 +17,23 @@ export const BlockNumberTextField: React.FC<BlockNumberTextFieldProps> = ({
|
|
|
17
17
|
|
|
18
18
|
const handleChange: ChangeEventHandler<HTMLInputElement> = (e) => {
|
|
19
19
|
const value = e.target.value.replaceAll(/\D/g, '') // Remove non-digit characters
|
|
20
|
-
setBlockNumber(value ? Number(value) : undefined)
|
|
20
|
+
setBlockNumber(value.length > 0 ? Number(value) : undefined)
|
|
21
21
|
onBlockNumberChanged?.(Number.parseInt(value))
|
|
22
22
|
onChange?.(e)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
const errored = errorMessage !== undefined
|
|
26
|
+
|
|
25
27
|
return (
|
|
26
28
|
<FormControl fullWidth>
|
|
27
29
|
<TextField
|
|
28
|
-
error={
|
|
30
|
+
error={errored}
|
|
29
31
|
onChange={handleChange}
|
|
30
32
|
type="number"
|
|
31
33
|
value={blockNumber ?? ''}
|
|
32
34
|
{...props}
|
|
33
35
|
/>
|
|
34
|
-
{
|
|
36
|
+
{errored && <FormHelperText sx={{ color: 'error.main' }}>{errorMessage}</FormHelperText>}
|
|
35
37
|
</FormControl>
|
|
36
38
|
)
|
|
37
39
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
FormControl, FormHelperText, TextField,
|
|
4
4
|
} from '@mui/material'
|
|
5
5
|
import type { Address } from '@xylabs/hex'
|
|
6
|
-
import { asAddress } from '@xylabs/hex'
|
|
6
|
+
import { asAddress, isAddress } from '@xylabs/hex'
|
|
7
7
|
import React, { useMemo, useState } from 'react'
|
|
8
8
|
|
|
9
9
|
interface XyoAddressTextFieldProps extends Omit<StandardTextFieldProps, 'value'> {
|
|
@@ -25,7 +25,7 @@ export const XyoAddressTextField: React.FC<XyoAddressTextFieldProps> = ({
|
|
|
25
25
|
onChange?.(event)
|
|
26
26
|
|
|
27
27
|
const xyoAddress = asAddress(value)
|
|
28
|
-
if (xyoAddress) {
|
|
28
|
+
if (isAddress(xyoAddress)) {
|
|
29
29
|
onAddressChanged?.(xyoAddress)
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -35,7 +35,7 @@ export const XyoAddressTextField: React.FC<XyoAddressTextFieldProps> = ({
|
|
|
35
35
|
|
|
36
36
|
const handleBlur = () => {
|
|
37
37
|
const xyoAddress = asAddress(address)
|
|
38
|
-
if (!xyoAddress) {
|
|
38
|
+
if (!isAddress(xyoAddress)) {
|
|
39
39
|
setAddressError(new Error('Invalid address'))
|
|
40
40
|
onAddressChanged?.()
|
|
41
41
|
}
|
|
@@ -27,7 +27,6 @@ export const SubmitChainTransaction: React.FC = () => {
|
|
|
27
27
|
const [error, setError] = useState<Error>()
|
|
28
28
|
|
|
29
29
|
const onSubmitTx = async (chainTx: TransactionBoundWitnessFields) => {
|
|
30
|
-
if (!network) throw new Error('Network not set')
|
|
31
30
|
const randomAccount = await Account.random()
|
|
32
31
|
const [transactionBoundWitness] = await buildTransaction(
|
|
33
32
|
chainTx.chain,
|
|
@@ -46,7 +45,7 @@ export const SubmitChainTransaction: React.FC = () => {
|
|
|
46
45
|
.build()
|
|
47
46
|
|
|
48
47
|
const response = await axios.post<ApiEnvelope<ModuleQueryResult>>(network.href, [queryBoundWitness, [insertQuery, transactionBoundWitness, chainTx]])
|
|
49
|
-
if (response.data.errors) {
|
|
48
|
+
if (response.data.errors.length > 0) {
|
|
50
49
|
setError(new Error(response.data.errors.map(e => e.message).join('\n')))
|
|
51
50
|
} else {
|
|
52
51
|
setResult(response.data.data)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import type
|
|
2
|
+
import { type Hash, isHash } from '@xylabs/hex'
|
|
3
3
|
import { usePromise } from '@xylabs/react-promise'
|
|
4
4
|
import type { ReadArchivist } from '@xyo-network/archivist-model'
|
|
5
5
|
import { BoundWitnessBuilder } from '@xyo-network/boundwitness-builder'
|
|
@@ -27,7 +27,7 @@ export const useChainIteratorParams = ({
|
|
|
27
27
|
chainArchivist, chainInformation, head,
|
|
28
28
|
}: BlockChainIterator) => {
|
|
29
29
|
return usePromise(async () => {
|
|
30
|
-
if (chainArchivist && chainInformation && head) {
|
|
30
|
+
if (chainArchivist && chainInformation && isHash(head)) {
|
|
31
31
|
const [result] = await chainArchivist.get([head])
|
|
32
32
|
const foundResult = assertEx(result, () => `Head not found: ${head}`)
|
|
33
33
|
const resolvedHead = assertEx(
|
|
@@ -25,7 +25,7 @@ export const useChainIteratorUpdatingHead = ({
|
|
|
25
25
|
try {
|
|
26
26
|
const currentHead = await chainIterator.head()
|
|
27
27
|
const mostRecentBlock = await findMostRecentBlock(chainArchivist)
|
|
28
|
-
if (
|
|
28
|
+
if (mostRecentBlock) {
|
|
29
29
|
const currentBlockNumber = currentHead?.block ?? -1
|
|
30
30
|
const nextBlockNumber = mostRecentBlock.block
|
|
31
31
|
if (nextBlockNumber > currentBlockNumber) {
|
|
@@ -16,40 +16,37 @@ const getHydratedBlock = async (chainArchivist: ReadArchivist, head: BlockBoundW
|
|
|
16
16
|
|
|
17
17
|
const iterateChain = async (chainIteratorParams?: XyoChainIteratorParams, maxDepth?: number) => {
|
|
18
18
|
const { chainArchivist, head } = chainIteratorParams ?? {} as XyoChainIteratorParams
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const chainIterator = await XyoChainBlockNumberIterator.create({ head: headBlockBoundWitness, chainArchivist })
|
|
19
|
+
const headPayload = assertEx(isBlockBoundWitness(head) ? head : null, () => 'Head is not a Block Bound Witness')
|
|
20
|
+
// confirm the head is a block
|
|
21
|
+
const headBlockBoundWitness = assertEx(isBlockBoundWitness(headPayload) ? headPayload : null, () => 'Invalid head block')
|
|
22
|
+
// create the chain iterator
|
|
23
|
+
const chainIterator = await XyoChainBlockNumberIterator.create({ head: headBlockBoundWitness, chainArchivist })
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
// get head of the chain
|
|
26
|
+
const chainHead = await chainIterator.head()
|
|
27
|
+
let block = await getHydratedBlock(chainArchivist, chainHead)
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
// create the blocks array
|
|
30
|
+
const blocks: HydratedBlock[] = [block]
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if ((maxDepth && depth >= maxDepth) || block?.[0].block === 0) break
|
|
50
|
-
}
|
|
51
|
-
return blocks
|
|
32
|
+
// track the depth
|
|
33
|
+
let depth = 1
|
|
34
|
+
// iterate the chain
|
|
35
|
+
while (true) {
|
|
36
|
+
// get the next block
|
|
37
|
+
const [, next] = await chainIterator.previous(block[0].block, 2)
|
|
38
|
+
|
|
39
|
+
const nextHydratedBlock = await getHydratedBlock(chainArchivist, next)
|
|
40
|
+
// push the next block
|
|
41
|
+
blocks.push(nextHydratedBlock)
|
|
42
|
+
// set the next block as the current block
|
|
43
|
+
block = nextHydratedBlock
|
|
44
|
+
// increment the depth
|
|
45
|
+
depth++
|
|
46
|
+
// if max depth is set and we have reached it, break
|
|
47
|
+
if ((maxDepth !== undefined && depth >= maxDepth) || block?.[0].block === 0) break
|
|
52
48
|
}
|
|
49
|
+
return blocks
|
|
53
50
|
}
|
|
54
51
|
|
|
55
52
|
export const useIterateChain = (
|