@xyo-network/react-chain-blockchain 1.18.0 → 1.18.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/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/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/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/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.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 +719 -326
- 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 +31 -31
- 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/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/table/cell/lib/BlockTableCellProps.ts +1 -1
- package/src/components/chain/hooks/useOnBlock.ts +3 -3
- package/src/components/index.ts +1 -0
- package/src/components/payload/builder/transfer/Form.tsx +5 -2
- package/src/components/payload/builder/transfer/builder/SingleFlexbox.tsx +12 -15
- 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 +14 -9
- package/src/context/analyzer/Provider.tsx +2 -2
- 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/types/BlockComponentProps.ts +1 -1
- package/src/types/BlockComponents.ts +1 -1
- package/src/types/render/BlockChainRenderProps.ts +1 -2
|
@@ -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
|
/** Interface for all components that render a single block */
|
|
4
4
|
export interface BlockComponentProps {
|
|
5
5
|
block: HydratedBlockWithHashMeta;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockComponentProps.d.ts","sourceRoot":"","sources":["../../../src/types/BlockComponentProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BlockComponentProps.d.ts","sourceRoot":"","sources":["../../../src/types/BlockComponentProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAA;AAErE,8DAA8D;AAC9D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,yBAAyB,CAAA;IAChC,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,gFAAgF;AAChF,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACrE,YAAY,EAAE,IAAI,EAAE,CAAA;CACrB"}
|
|
@@ -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
|
/** Interface for all block components meant to be rendered in a chain */
|
|
4
4
|
export interface BlockChainRenderComponent extends NodesWithKeys {
|
|
5
5
|
block: HydratedBlock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockComponents.d.ts","sourceRoot":"","sources":["../../../src/types/BlockComponents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BlockComponents.d.ts","sourceRoot":"","sources":["../../../src/types/BlockComponents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzD,yEAAyE;AACzE,MAAM,WAAW,yBAA0B,SAAQ,aAAa;IAC9D,KAAK,EAAE,aAAa,CAAA;CACrB"}
|
|
@@ -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
|
/** Props that control the rendering (not blockchain specific) */
|
|
6
5
|
export interface RenderProps {
|
|
7
6
|
maxBlocks?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockChainRenderProps.d.ts","sourceRoot":"","sources":["../../../../src/types/render/BlockChainRenderProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"BlockChainRenderProps.d.ts","sourceRoot":"","sources":["../../../../src/types/render/BlockChainRenderProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAEnE,iEAAiE;AACjE,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,sDAAsD;AACtD,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAA;IACnD,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,IAAI,EAAE,aAAa,CAAA;CACpB;AAED,uCAAuC;AACvC,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB,EAAE,WAAW;CAE7E;AAED,gFAAgF;AAChF,MAAM,WAAW,yBAAyB;IACxC,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAC7C,KAAK,CAAC,EAAE,KAAK,CAAA;CACd"}
|
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.18.
|
|
4
|
+
"version": "1.18.1",
|
|
5
5
|
"description": "XYO Layer One React SDK Blockchain",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"package-cycle": "echo Nothing to do"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@storybook/react-vite": "~10.1.
|
|
51
|
-
"@xylabs/axios": "~5.0.
|
|
50
|
+
"@storybook/react-vite": "~10.1.11",
|
|
51
|
+
"@xylabs/axios": "~5.0.61",
|
|
52
52
|
"@xylabs/react-animation": "~7.1.9",
|
|
53
53
|
"@xylabs/react-error": "~7.1.9",
|
|
54
54
|
"@xylabs/react-flexbox": "~7.1.9",
|
|
@@ -56,53 +56,52 @@
|
|
|
56
56
|
"@xylabs/react-quick-tip-button": "~7.1.9",
|
|
57
57
|
"@xylabs/react-shared": "~7.1.9",
|
|
58
58
|
"@xylabs/react-theme": "~7.1.9",
|
|
59
|
-
"@xylabs/sdk-js": "~5.0.
|
|
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.18.
|
|
66
|
-
"@xyo-network/chain-protocol": "~1.18.
|
|
67
|
-
"@xyo-network/chain-wrappers": "~1.18.
|
|
68
|
-
"@xyo-network/module-model": "~5.2.
|
|
69
|
-
"@xyo-network/payload-builder": "~5.2.
|
|
70
|
-
"@xyo-network/payload-model": "~5.2.
|
|
59
|
+
"@xylabs/sdk-js": "~5.0.61",
|
|
60
|
+
"@xyo-network/account": "~5.2.22",
|
|
61
|
+
"@xyo-network/archivist-memory": "~5.2.22",
|
|
62
|
+
"@xyo-network/archivist-model": "~5.2.22",
|
|
63
|
+
"@xyo-network/boundwitness-builder": "~5.2.22",
|
|
64
|
+
"@xyo-network/boundwitness-model": "~5.2.22",
|
|
65
|
+
"@xyo-network/chain-analyze": "~1.18.1",
|
|
66
|
+
"@xyo-network/chain-protocol": "~1.18.1",
|
|
67
|
+
"@xyo-network/chain-wrappers": "~1.18.1",
|
|
68
|
+
"@xyo-network/module-model": "~5.2.22",
|
|
69
|
+
"@xyo-network/payload-builder": "~5.2.22",
|
|
70
|
+
"@xyo-network/payload-model": "~5.2.22",
|
|
71
71
|
"@xyo-network/react-boundwitness-plugin": "~7.4.2",
|
|
72
|
-
"@xyo-network/react-chain-blockies": "~1.18.
|
|
73
|
-
"@xyo-network/react-chain-provider": "~1.18.
|
|
74
|
-
"@xyo-network/react-chain-shared": "~1.18.
|
|
72
|
+
"@xyo-network/react-chain-blockies": "~1.18.1",
|
|
73
|
+
"@xyo-network/react-chain-provider": "~1.18.1",
|
|
74
|
+
"@xyo-network/react-chain-shared": "~1.18.1",
|
|
75
75
|
"@xyo-network/react-error": "~7.4.2",
|
|
76
76
|
"@xyo-network/react-event": "~7.4.2",
|
|
77
77
|
"@xyo-network/react-payload-raw-info": "~7.4.2",
|
|
78
78
|
"@xyo-network/react-payload-table": "~7.4.2",
|
|
79
79
|
"@xyo-network/react-shared": "~7.4.2",
|
|
80
80
|
"@xyo-network/react-table": "~7.4.2",
|
|
81
|
-
"@xyo-network/xl1-
|
|
82
|
-
"@xyo-network/xl1-protocol-sdk": "~1.18.0"
|
|
81
|
+
"@xyo-network/xl1-sdk": "~1.18.2"
|
|
83
82
|
},
|
|
84
83
|
"devDependencies": {
|
|
85
84
|
"@emotion/react": "~11.14.0",
|
|
86
85
|
"@emotion/styled": "~11.14.1",
|
|
87
|
-
"@mui/icons-material": "~7.3.
|
|
88
|
-
"@mui/material": "~7.3.
|
|
89
|
-
"@types/react": "~19.2.
|
|
86
|
+
"@mui/icons-material": "~7.3.7",
|
|
87
|
+
"@mui/material": "~7.3.7",
|
|
88
|
+
"@types/react": "~19.2.8",
|
|
90
89
|
"@xylabs/react-button": "~7.1.9",
|
|
91
|
-
"@xylabs/sdk-js": "~5.0.
|
|
90
|
+
"@xylabs/sdk-js": "~5.0.61",
|
|
92
91
|
"@xylabs/ts-scripts-yarn3": "~7.2.32",
|
|
93
92
|
"@xylabs/tsconfig": "~7.2.32",
|
|
94
93
|
"@xylabs/tsconfig-dom": "~7.2.32",
|
|
95
94
|
"@xylabs/tsconfig-react": "~7.2.32",
|
|
96
|
-
"@xyo-network/api-models": "~5.2.
|
|
97
|
-
"@xyo-network/bridge-http": "~5.2.
|
|
98
|
-
"@xyo-network/xl1-network-model": "~1.18.
|
|
99
|
-
"@xyo-network/xl1-
|
|
95
|
+
"@xyo-network/api-models": "~5.2.22",
|
|
96
|
+
"@xyo-network/bridge-http": "~5.2.22",
|
|
97
|
+
"@xyo-network/xl1-network-model": "~1.18.14",
|
|
98
|
+
"@xyo-network/xl1-sdk": "~1.18.2",
|
|
100
99
|
"axios": "^1.13.2",
|
|
101
100
|
"eslint": "^9.39.2",
|
|
102
101
|
"react": "~19.2.3",
|
|
103
102
|
"react-dom": "~19.2.3",
|
|
104
|
-
"react-router-dom": "^7.
|
|
105
|
-
"storybook": "~10.1.
|
|
103
|
+
"react-router-dom": "^7.12.0",
|
|
104
|
+
"storybook": "~10.1.11",
|
|
106
105
|
"typescript": "~5.9.3"
|
|
107
106
|
},
|
|
108
107
|
"peerDependencies": {
|
|
@@ -110,6 +109,7 @@
|
|
|
110
109
|
"@emotion/styled": "~11",
|
|
111
110
|
"@mui/icons-material": ">=6 <8",
|
|
112
111
|
"@mui/material": ">=6 <8",
|
|
112
|
+
"@mui/x-charts": "~8.23.0",
|
|
113
113
|
"axios": "^1",
|
|
114
114
|
"react": "~19",
|
|
115
115
|
"react-dom": "~19",
|
|
@@ -119,4 +119,4 @@
|
|
|
119
119
|
"access": "restricted"
|
|
120
120
|
},
|
|
121
121
|
"docs": "dist/docs.json"
|
|
122
|
-
}
|
|
122
|
+
}
|
|
@@ -5,8 +5,8 @@ import { type Address } from '@xylabs/sdk-js'
|
|
|
5
5
|
import { isDefined } from '@xylabs/sdk-js'
|
|
6
6
|
import { useAccountBalanceHistory } from '@xyo-network/react-chain-provider'
|
|
7
7
|
import { ErrorRender } from '@xyo-network/react-error'
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
8
|
+
import type { XyoViewer } from '@xyo-network/xl1-sdk'
|
|
9
|
+
import { AttoXL1 } from '@xyo-network/xl1-sdk'
|
|
10
10
|
import React from 'react'
|
|
11
11
|
|
|
12
12
|
import { formatBalanceMagnitude } from './helpers/index.ts'
|
|
@@ -2,11 +2,8 @@ import type { Address } from '@xylabs/sdk-js'
|
|
|
2
2
|
import { isDefined } from '@xylabs/sdk-js'
|
|
3
3
|
import type { AccountBalanceHistoryItemFormatted } from '@xyo-network/react-chain-provider'
|
|
4
4
|
import { useAccountBalanceHistory } from '@xyo-network/react-chain-provider'
|
|
5
|
-
import type { XL1BlockRange } from '@xyo-network/xl1-
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
useCallback, useMemo, useState,
|
|
9
|
-
} from 'react'
|
|
5
|
+
import type { XL1BlockRange, XyoViewer } from '@xyo-network/xl1-sdk'
|
|
6
|
+
import { useCallback, useState } from 'react'
|
|
10
7
|
|
|
11
8
|
export const usePagedAccountBalanceHistory = (address?: Address, viewer?: XyoViewer, maxPage = 1) => {
|
|
12
9
|
const [updatedBlockRange, setUpdatedBlockRange] = useState<XL1BlockRange>()
|
|
@@ -14,16 +11,14 @@ export const usePagedAccountBalanceHistory = (address?: Address, viewer?: XyoVie
|
|
|
14
11
|
const [results, error, loading] = useAccountBalanceHistory(address, viewer, maxPage, updatedBlockRange)
|
|
15
12
|
|
|
16
13
|
const { history, truncated } = results || {}
|
|
14
|
+
const [previousHistory, setPreviousHistory] = useState(history)
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
}, [history])
|
|
16
|
+
// Reset paged history when address changes
|
|
17
|
+
if (isDefined(history) && history !== previousHistory) {
|
|
18
|
+
setPagedHistory([...pagedHistory ?? [], ...history])
|
|
19
|
+
setPreviousHistory(history)
|
|
20
|
+
}
|
|
25
21
|
|
|
26
|
-
const firstBlock = isDefined(history) ? history.at(0)?.blockNumber : undefined
|
|
27
22
|
const lastBlock = isDefined(history) ? history.at(-1)?.blockNumber : undefined
|
|
28
23
|
const historyComplete = isDefined(history) && history.length === 0
|
|
29
24
|
|
|
@@ -32,7 +27,7 @@ export const usePagedAccountBalanceHistory = (address?: Address, viewer?: XyoVie
|
|
|
32
27
|
const newEndBlock = lastBlock - 1
|
|
33
28
|
setUpdatedBlockRange([0, newEndBlock] as XL1BlockRange)
|
|
34
29
|
}
|
|
35
|
-
}, [
|
|
30
|
+
}, [lastBlock, truncated])
|
|
36
31
|
|
|
37
32
|
return {
|
|
38
33
|
pagedHistory,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BoundWitnessSchema } from '@xyo-network/boundwitness-model'
|
|
2
|
-
import { type HydratedBlock, isTransactionBoundWitness } from '@xyo-network/xl1-
|
|
2
|
+
import { type HydratedBlock, isTransactionBoundWitness } from '@xyo-network/xl1-sdk'
|
|
3
3
|
|
|
4
4
|
export const payloadCountsFromBlock = ([block, payloads]: HydratedBlock): [number, number] => {
|
|
5
5
|
const publicPayloads = block.payload_schemas.filter(schema => schema !== BoundWitnessSchema)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TableCellProps } from '@mui/material'
|
|
2
|
-
import type { HydratedBlockWithHashMeta } from '@xyo-network/xl1-
|
|
2
|
+
import type { HydratedBlockWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
3
3
|
|
|
4
4
|
export interface BlockTableCellProps extends TableCellProps {
|
|
5
5
|
block?: HydratedBlockWithHashMeta
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HydratedBlock } from '@xyo-network/xl1-
|
|
1
|
+
import type { HydratedBlock } from '@xyo-network/xl1-sdk'
|
|
2
2
|
import { useEffect, useRef } from 'react'
|
|
3
3
|
|
|
4
4
|
export type PollingState = 'paused' | 'running'
|
|
@@ -49,7 +49,7 @@ export const useOnBlock = (
|
|
|
49
49
|
void onAddBlock(liveHead)
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
}, [liveHead, pollingState])
|
|
52
|
+
}, [initialHeadNumber, liveHead, onAddBlock, pollingState])
|
|
53
53
|
|
|
54
|
-
return blocksWhilePaused
|
|
54
|
+
return blocksWhilePaused
|
|
55
55
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -17,6 +17,9 @@ export const TransferBuilderForm: React.FC<TransferBuilderFormProps> = ({ onBuil
|
|
|
17
17
|
const [fromAddress, setFromAddress] = useState<Address>()
|
|
18
18
|
const [transfers, setTransfers] = useState<TransferAmount[]>([])
|
|
19
19
|
|
|
20
|
+
// eslint-disable-next-line react-naming-convention/use-state
|
|
21
|
+
const [epoch] = useState(() => Date.now())
|
|
22
|
+
|
|
20
23
|
const transferPayload: Transfer | undefined = useMemo(() => {
|
|
21
24
|
if (isAddress(fromAddress) && transfers.length > 0) {
|
|
22
25
|
const transfersRecord = {} as Transfer['transfers']
|
|
@@ -28,10 +31,10 @@ export const TransferBuilderForm: React.FC<TransferBuilderFormProps> = ({ onBuil
|
|
|
28
31
|
from: fromAddress,
|
|
29
32
|
schema: TransferSchema,
|
|
30
33
|
transfers: transfersRecord,
|
|
31
|
-
epoch
|
|
34
|
+
epoch,
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
|
-
}, [fromAddress, transfers])
|
|
37
|
+
}, [fromAddress, transfers, epoch])
|
|
35
38
|
|
|
36
39
|
const onBuildLocal: MouseEventHandler<HTMLButtonElement> = () => {
|
|
37
40
|
if (onBuild && transferPayload) onBuild?.(transferPayload)
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
6
6
|
import { FlexRow } from '@xylabs/react-flexbox'
|
|
7
7
|
import type { Address } from '@xylabs/sdk-js'
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
isAddress, isDefinedNotNull, toHex,
|
|
10
|
+
} from '@xylabs/sdk-js'
|
|
9
11
|
import { BigIntInput } from '@xyo-network/react-shared'
|
|
10
|
-
import React, {
|
|
11
|
-
useEffect, useMemo, useState,
|
|
12
|
-
} from 'react'
|
|
12
|
+
import React, { useEffect, useState } from 'react'
|
|
13
13
|
|
|
14
14
|
import { XyoAddressTextField } from '../../../fields/index.ts'
|
|
15
15
|
import type { TransferAmount } from '../Transfer.ts'
|
|
@@ -26,19 +26,16 @@ export const SingleTransferBuilderFlexbox: React.FC<SingleTransferBuilderFlexbox
|
|
|
26
26
|
const [toAddress, setToAddress] = useState<Address>()
|
|
27
27
|
const [amount, setAmount] = useState<bigint>()
|
|
28
28
|
|
|
29
|
-
const transferAmount = useMemo(() => {
|
|
30
|
-
if (isAddress(toAddress) && amount !== undefined) {
|
|
31
|
-
return {
|
|
32
|
-
...singleTransfer,
|
|
33
|
-
amount: toHex(amount),
|
|
34
|
-
to: toAddress,
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}, [toAddress, amount])
|
|
38
|
-
|
|
39
29
|
useEffect(() => {
|
|
30
|
+
const transferAmount = isAddress(toAddress) && isDefinedNotNull(amount)
|
|
31
|
+
? {
|
|
32
|
+
...singleTransfer,
|
|
33
|
+
amount: toHex(amount),
|
|
34
|
+
to: toAddress,
|
|
35
|
+
}
|
|
36
|
+
: undefined
|
|
40
37
|
if (transferAmount) onTransferUpdated?.(transferAmount)
|
|
41
|
-
}, [
|
|
38
|
+
}, [amount, onTransferUpdated, singleTransfer, toAddress])
|
|
42
39
|
|
|
43
40
|
return (
|
|
44
41
|
<FlexRow alignItems="start" gap={1} {...props}>
|
|
@@ -3,8 +3,10 @@ import {
|
|
|
3
3
|
FormControl, FormHelperText, TextField,
|
|
4
4
|
} from '@mui/material'
|
|
5
5
|
import type { Address } from '@xylabs/sdk-js'
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
asAddress, isAddress, isDefined,
|
|
8
|
+
} from '@xylabs/sdk-js'
|
|
9
|
+
import React, { useState } from 'react'
|
|
8
10
|
|
|
9
11
|
interface XyoAddressTextFieldProps extends Omit<StandardTextFieldProps, 'value'> {
|
|
10
12
|
onAddressChanged?: (address?: Address) => void
|
|
@@ -18,7 +20,12 @@ export const XyoAddressTextField: React.FC<XyoAddressTextFieldProps> = ({
|
|
|
18
20
|
const [address, setAddress] = useState<string>('')
|
|
19
21
|
const [addressError, setAddressError] = useState<Error>()
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
const [previousResetValue, setPreviousResetValue] = useState<number | undefined>(resetValue)
|
|
24
|
+
|
|
25
|
+
if (isDefined(resetValue) && resetValue !== previousResetValue) {
|
|
26
|
+
setPreviousResetValue(resetValue)
|
|
27
|
+
setAddress('')
|
|
28
|
+
}
|
|
22
29
|
|
|
23
30
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
24
31
|
const { value } = event.target
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ViewAgendaOutlined } from '@mui/icons-material'
|
|
2
|
+
import { Tooltip, type TypographyProps } from '@mui/material'
|
|
3
|
+
import type { XL1BlockRange } from '@xyo-network/xl1-sdk'
|
|
4
|
+
|
|
5
|
+
import { MetricTypography } from './support/index.ts'
|
|
6
|
+
|
|
7
|
+
export interface BlockRateSpanTypographyProps extends TypographyProps {
|
|
8
|
+
range?: XL1BlockRange
|
|
9
|
+
span?: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const BlockRateSpanTypography: React.FC<BlockRateSpanTypographyProps> = ({
|
|
13
|
+
range, span, sx, ...props
|
|
14
|
+
}) => {
|
|
15
|
+
return (
|
|
16
|
+
<Tooltip title={`Block Range: ${range?.join(' - ')}`}>
|
|
17
|
+
<MetricTypography icon={<ViewAgendaOutlined fontSize="large" />} metric={span} label="blocks" {...props} />
|
|
18
|
+
</Tooltip>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SpeedOutlined } from '@mui/icons-material'
|
|
2
|
+
import type { TypographyProps } from '@mui/material'
|
|
3
|
+
|
|
4
|
+
import { MetricTypography } from './support/index.ts'
|
|
5
|
+
|
|
6
|
+
export interface BlockRateSpeedTypographyProps extends TypographyProps {
|
|
7
|
+
rate?: number
|
|
8
|
+
rateUnitLabel?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const BlockRateSpeedTypography: React.FC<BlockRateSpeedTypographyProps> = ({
|
|
12
|
+
rate, rateUnitLabel, ...props
|
|
13
|
+
}) => {
|
|
14
|
+
return (
|
|
15
|
+
<MetricTypography icon={<SpeedOutlined fontSize="large" />} metric={rate} label={rateUnitLabel} {...props} />
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TimelapseOutlined } from '@mui/icons-material'
|
|
2
|
+
import { type TypographyProps } from '@mui/material'
|
|
3
|
+
|
|
4
|
+
import { MetricTypography } from './support/index.ts'
|
|
5
|
+
|
|
6
|
+
export interface BlockRateTimeTypographyProps extends TypographyProps {
|
|
7
|
+
rateUnit?: string
|
|
8
|
+
timeDifference?: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const BlockRateTimeTypography: React.FC<BlockRateTimeTypographyProps> = ({
|
|
12
|
+
rateUnit, timeDifference, sx, ...props
|
|
13
|
+
}) => {
|
|
14
|
+
return (
|
|
15
|
+
<MetricTypography icon={<TimelapseOutlined fontSize="large" />} metric={timeDifference} label={rateUnit} {...props} />
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
+
import type { BlockRate } from '@xyo-network/xl1-sdk'
|
|
3
|
+
import { asXL1BlockRange } from '@xyo-network/xl1-sdk'
|
|
4
|
+
|
|
5
|
+
import { BlockRateFlexBox } from './FlexBox.tsx'
|
|
6
|
+
|
|
7
|
+
const blockRateSeconds: BlockRate = {
|
|
8
|
+
range: asXL1BlockRange([100, 200], true),
|
|
9
|
+
span: 100,
|
|
10
|
+
rate: 0.12,
|
|
11
|
+
rateUnit: 'seconds',
|
|
12
|
+
timeDifference: (100 * 12),
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const blockRateMinutes: BlockRate = {
|
|
16
|
+
range: asXL1BlockRange([100, 200], true),
|
|
17
|
+
span: 100,
|
|
18
|
+
rate: 12,
|
|
19
|
+
rateUnit: 'minutes',
|
|
20
|
+
timeDifference: (100 * 12) / 60,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
title: 'BlockRate/FlexBox',
|
|
25
|
+
component: BlockRateFlexBox,
|
|
26
|
+
} satisfies Meta<typeof BlockRateFlexBox>
|
|
27
|
+
|
|
28
|
+
const Template: StoryFn<typeof BlockRateFlexBox> = (args) => {
|
|
29
|
+
return <BlockRateFlexBox {...args} />
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const Default = Template.bind({})
|
|
33
|
+
Default.args = {}
|
|
34
|
+
|
|
35
|
+
const WithBlockRateSeconds = Template.bind({})
|
|
36
|
+
WithBlockRateSeconds.args = { blockRate: blockRateSeconds }
|
|
37
|
+
|
|
38
|
+
const WithBlockRateMinutes = Template.bind({})
|
|
39
|
+
WithBlockRateMinutes.args = { blockRate: blockRateMinutes }
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
Default, WithBlockRateMinutes,
|
|
43
|
+
WithBlockRateSeconds,
|
|
44
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
2
|
+
import { FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
+
import { isDefined } from '@xylabs/sdk-js'
|
|
4
|
+
import type { BlockRate } from '@xyo-network/xl1-sdk'
|
|
5
|
+
|
|
6
|
+
import { rateUnitToLabel } from '../../../helpers/rate/index.ts'
|
|
7
|
+
import { BlockRateSpanTypography } from '../SpanTypography.tsx'
|
|
8
|
+
import { BlockRateSpeedTypography } from '../SpeedTypography.tsx'
|
|
9
|
+
import { BlockRateTimeTypography } from '../TimeTypography.tsx'
|
|
10
|
+
|
|
11
|
+
export interface BlockRateFlexBoxProps extends FlexBoxProps {
|
|
12
|
+
blockRate?: BlockRate
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const BlockRateFlexBox: React.FC<BlockRateFlexBoxProps> = ({
|
|
16
|
+
blockRate,
|
|
17
|
+
...flexBoxProps
|
|
18
|
+
}) => {
|
|
19
|
+
const {
|
|
20
|
+
range, span, rate, rateUnit, timeDifference,
|
|
21
|
+
} = blockRate ?? {}
|
|
22
|
+
const rateUnitLabel = isDefined(rateUnit) ? rateUnitToLabel(rateUnit) : ''
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<FlexCol alignItems="start" {...flexBoxProps}>
|
|
26
|
+
<BlockRateSpeedTypography rate={rate} rateUnitLabel={rateUnitLabel} />
|
|
27
|
+
<BlockRateSpanTypography range={range} span={span} />
|
|
28
|
+
<BlockRateTimeTypography rateUnit={rateUnit} timeDifference={timeDifference} />
|
|
29
|
+
</FlexCol>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FlexBox.tsx'
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
+
import type { BlockRate } from '@xyo-network/xl1-sdk'
|
|
3
|
+
import { asXL1BlockRange } from '@xyo-network/xl1-sdk'
|
|
4
|
+
|
|
5
|
+
import type { GaugeConfig } from './Container.tsx'
|
|
6
|
+
import { BlockRateSpeedGaugeContainer } from './Container.tsx'
|
|
7
|
+
|
|
8
|
+
const blockRateSeconds: BlockRate = {
|
|
9
|
+
range: asXL1BlockRange([100, 200], true),
|
|
10
|
+
span: 100,
|
|
11
|
+
rate: 0.083_33,
|
|
12
|
+
rateUnit: 'seconds',
|
|
13
|
+
timeDifference: (100 * 12),
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const blockRateMinutes: BlockRate = {
|
|
17
|
+
range: asXL1BlockRange([100, 200], true),
|
|
18
|
+
span: 100,
|
|
19
|
+
rate: 5,
|
|
20
|
+
rateUnit: 'minutes',
|
|
21
|
+
timeDifference: (100 * 12) / 60,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const blockRateHour: BlockRate = {
|
|
25
|
+
range: asXL1BlockRange([100, 200], true),
|
|
26
|
+
span: 100,
|
|
27
|
+
// up the block rate to test gauge scaling
|
|
28
|
+
rate: 7 * 60,
|
|
29
|
+
rateUnit: 'hours',
|
|
30
|
+
timeDifference: (100 * 12) / 60,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const gaugeConfigHour: GaugeConfig = {
|
|
34
|
+
// The target block rate per hour is less than blockRateHour.rate
|
|
35
|
+
// this is to show the pointer as higher than the targetPosition of 75 out of 110 max
|
|
36
|
+
targetBlockRate: 5 * 60,
|
|
37
|
+
targetBlockRateUnit: 'hours',
|
|
38
|
+
targetPosition: 75,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const gaugeConfigHourWithoutTicks: GaugeConfig = {
|
|
42
|
+
targetBlockRate: 5 * 60,
|
|
43
|
+
targetBlockRateUnit: 'hours',
|
|
44
|
+
targetPosition: 75,
|
|
45
|
+
showTicks: false,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
title: 'BlockRate/Gauge',
|
|
50
|
+
component: BlockRateSpeedGaugeContainer,
|
|
51
|
+
} satisfies Meta<typeof BlockRateSpeedGaugeContainer>
|
|
52
|
+
|
|
53
|
+
const Template: StoryFn<typeof BlockRateSpeedGaugeContainer> = (args) => {
|
|
54
|
+
return <BlockRateSpeedGaugeContainer {...args} />
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const Default = Template.bind({})
|
|
58
|
+
Default.args = {}
|
|
59
|
+
|
|
60
|
+
const WithBlockRateSeconds = Template.bind({})
|
|
61
|
+
WithBlockRateSeconds.args = { blockRate: blockRateSeconds }
|
|
62
|
+
|
|
63
|
+
const WithBlockRateMinutes = Template.bind({})
|
|
64
|
+
WithBlockRateMinutes.args = { blockRate: blockRateMinutes }
|
|
65
|
+
|
|
66
|
+
const WithBlockRateHoursHigherThanTarget = Template.bind({})
|
|
67
|
+
WithBlockRateHoursHigherThanTarget.args = { blockRate: blockRateHour, gaugeConfig: gaugeConfigHour }
|
|
68
|
+
|
|
69
|
+
const WithBlockRateHoursWithoutTicks = Template.bind({})
|
|
70
|
+
WithBlockRateHoursWithoutTicks.args = { blockRate: blockRateHour, gaugeConfig: gaugeConfigHourWithoutTicks }
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
Default, WithBlockRateHoursHigherThanTarget,
|
|
74
|
+
WithBlockRateHoursWithoutTicks,
|
|
75
|
+
WithBlockRateMinutes,
|
|
76
|
+
WithBlockRateSeconds,
|
|
77
|
+
}
|