@xyo-network/react-chain-blockchain 1.16.9 → 1.16.11

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 (99) hide show
  1. package/dist/browser/components/account/BalanceHistoryFlexbox.d.ts +11 -0
  2. package/dist/browser/components/account/BalanceHistoryFlexbox.d.ts.map +1 -0
  3. package/dist/browser/components/account/BalanceHistoryFlexbox.stories.d.ts +6 -0
  4. package/dist/browser/components/account/BalanceHistoryFlexbox.stories.d.ts.map +1 -0
  5. package/dist/browser/components/account/index.d.ts +3 -0
  6. package/dist/browser/components/account/index.d.ts.map +1 -0
  7. package/dist/browser/components/account/table/AddressTableCell.d.ts +8 -0
  8. package/dist/browser/components/account/table/AddressTableCell.d.ts.map +1 -0
  9. package/dist/browser/components/account/table/BalanceHistoryTable.d.ts +9 -0
  10. package/dist/browser/components/account/table/BalanceHistoryTable.d.ts.map +1 -0
  11. package/dist/browser/components/account/table/BalanceHistoryTable.stories.d.ts +7 -0
  12. package/dist/browser/components/account/table/BalanceHistoryTable.stories.d.ts.map +1 -0
  13. package/dist/browser/components/account/table/BalanceHistoryTableRow.d.ts +8 -0
  14. package/dist/browser/components/account/table/BalanceHistoryTableRow.d.ts.map +1 -0
  15. package/dist/browser/components/account/table/RawAmountTableCell.d.ts +9 -0
  16. package/dist/browser/components/account/table/RawAmountTableCell.d.ts.map +1 -0
  17. package/dist/browser/components/account/table/index.d.ts +5 -0
  18. package/dist/browser/components/account/table/index.d.ts.map +1 -0
  19. package/dist/browser/components/account/table/types/index.d.ts +9 -0
  20. package/dist/browser/components/account/table/types/index.d.ts.map +1 -0
  21. package/dist/browser/components/block/helpers/blockProducer.d.ts +1 -3
  22. package/dist/browser/components/block/helpers/blockProducer.d.ts.map +1 -1
  23. package/dist/browser/components/block/hooks/useBlockProducer.d.ts +1 -3
  24. package/dist/browser/components/block/hooks/useBlockProducer.d.ts.map +1 -1
  25. package/dist/browser/components/block/table/cell/BlockNumber.d.ts +1 -0
  26. package/dist/browser/components/block/table/cell/BlockNumber.d.ts.map +1 -1
  27. package/dist/browser/components/block/table/cell/JsonView.d.ts.map +1 -1
  28. package/dist/browser/components/block/table/cell/PayloadCounts.d.ts +1 -1
  29. package/dist/browser/components/block/table/cell/PayloadCounts.d.ts.map +1 -1
  30. package/dist/browser/components/block/table/cell/TransactionCount.d.ts +1 -1
  31. package/dist/browser/components/block/table/cell/TransactionCount.d.ts.map +1 -1
  32. package/dist/browser/components/index.d.ts +1 -0
  33. package/dist/browser/components/index.d.ts.map +1 -1
  34. package/dist/browser/components/payload/builder/transfer/Transfer.d.ts +1 -1
  35. package/dist/browser/components/payload/builder/transfer/Transfer.d.ts.map +1 -1
  36. package/dist/browser/components/payload/builder/transfer/builder/SingleFlexbox.d.ts.map +1 -1
  37. package/dist/browser/components/payload/fields/XyoAddressTextField.d.ts +1 -1
  38. package/dist/browser/components/payload/fields/XyoAddressTextField.d.ts.map +1 -1
  39. package/dist/browser/components/transactions/TransactionCountChip.d.ts +1 -1
  40. package/dist/browser/components/transactions/TransactionCountChip.d.ts.map +1 -1
  41. package/dist/browser/components/transactions/TransactionsQuickTipButton.d.ts.map +1 -1
  42. package/dist/browser/components/transactions/submit/SubmitChain.d.ts.map +1 -1
  43. package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts +6 -12
  44. package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
  45. package/dist/browser/index.mjs +475 -293
  46. package/dist/browser/index.mjs.map +1 -1
  47. package/dist/browser/lib/getChainId.d.ts +1 -2
  48. package/dist/browser/lib/getChainId.d.ts.map +1 -1
  49. package/dist/browser/stories/ChainInfoContextDecorator.d.ts.map +1 -1
  50. package/dist/browser/types/BlockComponentProps.d.ts +1 -1
  51. package/dist/browser/types/BlockComponentProps.d.ts.map +1 -1
  52. package/dist/browser/types/render/BlockChainRenderProps.d.ts +1 -2
  53. package/dist/browser/types/render/BlockChainRenderProps.d.ts.map +1 -1
  54. package/package.json +31 -32
  55. package/src/components/account/BalanceHistoryFlexbox.stories.tsx +25 -0
  56. package/src/components/account/BalanceHistoryFlexbox.tsx +65 -0
  57. package/src/components/account/index.ts +2 -0
  58. package/src/components/account/table/AddressTableCell.tsx +25 -0
  59. package/src/components/account/table/BalanceHistoryTable.stories.tsx +75 -0
  60. package/src/components/account/table/BalanceHistoryTable.tsx +36 -0
  61. package/src/components/account/table/BalanceHistoryTableRow.tsx +41 -0
  62. package/src/components/account/table/RawAmountTableCell.tsx +52 -0
  63. package/src/components/account/table/index.ts +4 -0
  64. package/src/components/account/table/types/index.ts +17 -0
  65. package/src/components/block/BlockHeadingFlexbox.tsx +1 -1
  66. package/src/components/block/ProducerChip.tsx +3 -3
  67. package/src/components/block/hooks/useStaticBlockComponents.ts +1 -1
  68. package/src/components/block/table/Ex.stories.tsx +1 -1
  69. package/src/components/block/table/cell/BlockNumber.tsx +8 -3
  70. package/src/components/block/table/cell/Epoch.tsx +1 -1
  71. package/src/components/block/table/cell/Hash.tsx +1 -1
  72. package/src/components/block/table/cell/JsonView.tsx +1 -2
  73. package/src/components/block/table/cell/PayloadCounts.tsx +1 -1
  74. package/src/components/block/table/cell/TransactionCount.tsx +1 -1
  75. package/src/components/chain/render/static/flexbox/Flexbox.stories.tsx +1 -1
  76. package/src/components/chain/render/static/flexbox/variants/WithAnalysis.tsx +1 -1
  77. package/src/components/chain/render/static/hooks/useStaticBlockRenderComponents.ts +2 -2
  78. package/src/components/chain/render/static/table/Ex.stories.tsx +1 -1
  79. package/src/components/index.ts +1 -0
  80. package/src/components/payload/builder/producer-intent/Form.tsx +1 -1
  81. package/src/components/payload/builder/transfer/Form.tsx +2 -2
  82. package/src/components/payload/builder/transfer/Transfer.ts +1 -1
  83. package/src/components/payload/builder/transfer/builder/SingleFlexbox.tsx +2 -2
  84. package/src/components/payload/fields/XyoAddressTextField.tsx +2 -2
  85. package/src/components/transactions/TransactionCountChip.tsx +1 -1
  86. package/src/components/transactions/TransactionsQuickTipButton.tsx +1 -1
  87. package/src/components/transactions/submit/Builder.tsx +1 -1
  88. package/src/components/transactions/submit/SubmitChain.tsx +6 -2
  89. package/src/context/analyzer/Provider.tsx +1 -1
  90. package/src/hooks/chain-iterator/ChainIteratorStore.ts +1 -1
  91. package/src/hooks/chain-iterator/useChainIteratorParams.ts +2 -3
  92. package/src/hooks/chain-iterator/useChainIteratorUpdatingHead.ts +1 -1
  93. package/src/hooks/useIterateChain.ts +1 -1
  94. package/src/lib/getChainArchivist.ts +1 -1
  95. package/src/lib/getChainId.ts +2 -2
  96. package/src/stories/ChainArchivistDelayedInsertDecorator.tsx +1 -1
  97. package/src/stories/ChainInfoContextDecorator.tsx +1 -2
  98. package/src/types/BlockComponentProps.ts +1 -1
  99. package/src/types/render/BlockChainRenderProps.ts +1 -2
@@ -1,4 +1,3 @@
1
- import { type Address } from '@xylabs/hex';
2
- import type { Promisable } from '@xylabs/promise';
1
+ import type { Address, Promisable } from '@xylabs/sdk-js';
3
2
  export declare const getChainId: () => Promisable<Address>;
4
3
  //# sourceMappingURL=getChainId.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getChainId.d.ts","sourceRoot":"","sources":["../../../src/lib/getChainId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIjD,eAAO,MAAM,UAAU,QAAO,UAAU,CAAC,OAAO,CAE/C,CAAA"}
1
+ {"version":3,"file":"getChainId.d.ts","sourceRoot":"","sources":["../../../src/lib/getChainId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAKzD,eAAO,MAAM,UAAU,QAAO,UAAU,CAAC,OAAO,CAE/C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChainInfoContextDecorator.d.ts","sourceRoot":"","sources":["../../../src/stories/ChainInfoContextDecorator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAqBtD,eAAO,MAAM,yBAAyB,EAAE,SA2BvC,CAAA"}
1
+ {"version":3,"file":"ChainInfoContextDecorator.d.ts","sourceRoot":"","sources":["../../../src/stories/ChainInfoContextDecorator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAoBtD,eAAO,MAAM,yBAAyB,EAAE,SA2BvC,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { Hash } from '@xylabs/hex';
1
+ import type { Hash } from '@xylabs/sdk-js';
2
2
  import type { HydratedBlock } from '@xyo-network/xl1-protocol';
3
3
  /** Interface for all components that render a single block */
4
4
  export interface BlockComponentProps {
@@ -1 +1 @@
1
- {"version":3,"file":"BlockComponentProps.d.ts","sourceRoot":"","sources":["../../../src/types/BlockComponentProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,8DAA8D;AAC9D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,aAAa,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,gFAAgF;AAChF,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACrE,YAAY,EAAE,IAAI,EAAE,CAAA;CACrB"}
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,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,8DAA8D;AAC9D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,aAAa,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,gFAAgF;AAChF,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACrE,YAAY,EAAE,IAAI,EAAE,CAAA;CACrB"}
@@ -1,5 +1,4 @@
1
- import type { CreatableName } from '@xylabs/creatable';
2
- import type { Hash } from '@xylabs/hex';
1
+ import type { CreatableName, Hash } from '@xylabs/sdk-js';
3
2
  import type { Payload, WithStorageMeta } from '@xyo-network/payload-model';
4
3
  import type { ChainId } from '@xyo-network/xl1-protocol';
5
4
  import type { PayloadMapRead } from '@xyo-network/xl1-protocol-sdk';
@@ -1 +1 @@
1
- {"version":3,"file":"BlockChainRenderProps.d.ts","sourceRoot":"","sources":["../../../../src/types/render/BlockChainRenderProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,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"}
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,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,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.16.9",
4
+ "version": "1.16.11",
5
5
  "description": "XYO Layer One React SDK Blockchain",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -45,13 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@storybook/react-vite": "~10.0.7",
48
- "@xylabs/assert": "~5.0.24",
49
- "@xylabs/axios": "~5.0.24",
50
- "@xylabs/delay": "~5.0.24",
51
- "@xylabs/eth-address": "~5.0.24",
52
- "@xylabs/exists": "~5.0.24",
53
- "@xylabs/hex": "~5.0.24",
54
- "@xylabs/promise": "~5.0.24",
48
+ "@xylabs/axios": "~5.0.33",
55
49
  "@xylabs/react-animation": "~7.1.8",
56
50
  "@xylabs/react-error": "~7.1.8",
57
51
  "@xylabs/react-flexbox": "~7.1.8",
@@ -59,49 +53,53 @@
59
53
  "@xylabs/react-quick-tip-button": "~7.1.8",
60
54
  "@xylabs/react-shared": "~7.1.8",
61
55
  "@xylabs/react-theme": "~7.1.8",
62
- "@xylabs/typeof": "~5.0.24",
63
- "@xyo-network/account": "~5.1.21",
64
- "@xyo-network/archivist-memory": "~5.1.21",
65
- "@xyo-network/archivist-model": "~5.1.21",
66
- "@xyo-network/boundwitness-builder": "~5.1.21",
67
- "@xyo-network/boundwitness-model": "~5.1.21",
68
- "@xyo-network/bridge-http": "~5.1.21",
69
- "@xyo-network/chain-analyze": "~1.16.9",
70
- "@xyo-network/chain-protocol": "~1.16.9",
71
- "@xyo-network/chain-services": "~1.16.9",
72
- "@xyo-network/chain-utils": "~1.16.9",
73
- "@xyo-network/chain-wrappers": "~1.16.9",
74
- "@xyo-network/module-model": "~5.1.21",
75
- "@xyo-network/payload-builder": "~5.1.21",
76
- "@xyo-network/payload-model": "~5.1.21",
56
+ "@xylabs/sdk-js": "~5.0.33",
57
+ "@xyo-network/account": "~5.1.22",
58
+ "@xyo-network/archivist-memory": "~5.1.22",
59
+ "@xyo-network/archivist-model": "~5.1.22",
60
+ "@xyo-network/boundwitness-builder": "~5.1.22",
61
+ "@xyo-network/boundwitness-model": "~5.1.22",
62
+ "@xyo-network/bridge-http": "~5.1.22",
63
+ "@xyo-network/chain-analyze": "~1.16.11",
64
+ "@xyo-network/chain-protocol": "~1.16.11",
65
+ "@xyo-network/chain-services": "~1.16.11",
66
+ "@xyo-network/chain-utils": "~1.16.11",
67
+ "@xyo-network/chain-wrappers": "~1.16.11",
68
+ "@xyo-network/module-model": "~5.1.22",
69
+ "@xyo-network/payload-builder": "~5.1.22",
70
+ "@xyo-network/payload-model": "~5.1.22",
77
71
  "@xyo-network/react-boundwitness-plugin": "~7.3.10",
78
- "@xyo-network/react-chain-blockies": "~1.16.9",
79
- "@xyo-network/react-chain-shared": "~1.16.9",
72
+ "@xyo-network/react-chain-blockies": "~1.16.11",
73
+ "@xyo-network/react-chain-provider": "~1.16.11",
74
+ "@xyo-network/react-chain-shared": "~1.16.11",
75
+ "@xyo-network/react-error": "~7.3.10",
80
76
  "@xyo-network/react-event": "~7.3.10",
81
77
  "@xyo-network/react-payload-raw-info": "~7.3.10",
82
78
  "@xyo-network/react-payload-table": "~7.3.10",
83
79
  "@xyo-network/react-shared": "~7.3.10",
84
80
  "@xyo-network/react-table": "~7.3.10",
85
- "@xyo-network/xl1-protocol": "~1.13.6",
86
- "@xyo-network/xl1-protocol-sdk": "~1.16.9"
81
+ "@xyo-network/xl1-protocol": "~1.13.11",
82
+ "@xyo-network/xl1-protocol-sdk": "~1.16.11"
87
83
  },
88
84
  "devDependencies": {
89
85
  "@emotion/react": "~11.14.0",
90
86
  "@emotion/styled": "~11.14.1",
91
87
  "@mui/icons-material": "~7.3.5",
92
88
  "@mui/material": "~7.3.5",
93
- "@types/react": "~19.2.4",
94
- "@xylabs/creatable": "~5.0.24",
95
- "@xylabs/hex": "~5.0.24",
89
+ "@types/react": "~19.2.5",
90
+ "@xylabs/sdk-js": "~5.0.33",
96
91
  "@xylabs/ts-scripts-yarn3": "~7.2.8",
97
92
  "@xylabs/tsconfig": "~7.2.8",
98
93
  "@xylabs/tsconfig-dom": "~7.2.8",
99
94
  "@xylabs/tsconfig-react": "~7.2.8",
100
- "@xyo-network/api-models": "~5.1.21",
95
+ "@xyo-network/api-models": "~5.1.22",
96
+ "@xyo-network/xl1-network-model": "~1.16.11",
97
+ "@xyo-network/xl1-rpc": "~1.16.11",
98
+ "axios": "^1.13.2",
101
99
  "eslint": "^9.39.1",
102
100
  "react": "~19.2.0",
103
101
  "react-dom": "~19.2.0",
104
- "react-router-dom": "^7.9.5",
102
+ "react-router-dom": "^7.9.6",
105
103
  "storybook": "~10.0.7",
106
104
  "typescript": "~5.9.3"
107
105
  },
@@ -110,6 +108,7 @@
110
108
  "@emotion/styled": "~11",
111
109
  "@mui/icons-material": ">=6 <8",
112
110
  "@mui/material": ">=6 <8",
111
+ "axios": "^1",
113
112
  "react": "~19",
114
113
  "react-dom": "~19",
115
114
  "react-router-dom": "^7"
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryFn } from '@storybook/react-vite'
2
+ import type { Address } from '@xylabs/sdk-js'
3
+ import { useHttpRpcViewer } from '@xyo-network/react-chain-provider'
4
+ import { LocalNetwork } from '@xyo-network/xl1-network-model'
5
+ import React from 'react'
6
+
7
+ import { AccountBalanceHistoryFlexBox } from './BalanceHistoryFlexbox.tsx'
8
+
9
+ export default {
10
+ title: 'AccountBalanceHistory/FlexBox',
11
+ component: AccountBalanceHistoryFlexBox,
12
+ } as Meta
13
+
14
+ const Template: StoryFn<typeof AccountBalanceHistoryFlexBox> = (args) => {
15
+ const viewer = useHttpRpcViewer(LocalNetwork.url)
16
+ return <AccountBalanceHistoryFlexBox viewer={viewer} {...args} />
17
+ }
18
+
19
+ const Default = Template.bind({})
20
+ Default.args = {
21
+ address: '2b1a21d8c90e658d8bf1e2aad31c8dc892c353c1' as Address,
22
+ refresh: 0,
23
+ }
24
+
25
+ export { Default }
@@ -0,0 +1,65 @@
1
+ import { Typography } from '@mui/material'
2
+ import type { FlexBoxProps } from '@xylabs/react-flexbox'
3
+ import { FlexCol } from '@xylabs/react-flexbox'
4
+ import { type Address } from '@xylabs/sdk-js'
5
+ import { isDefined } from '@xylabs/sdk-js'
6
+ import { useAccountBalanceHistory } from '@xyo-network/react-chain-provider'
7
+ import { ErrorRender } from '@xyo-network/react-error'
8
+ import { AttoXL1, XL1Amount } from '@xyo-network/xl1-protocol'
9
+ import type { XyoViewer } from '@xyo-network/xl1-protocol-sdk'
10
+ import React from 'react'
11
+
12
+ import { AccountBalanceHistoryTable } from './table/index.ts'
13
+
14
+ export interface AccountBalanceHistoryFlexBoxProps extends FlexBoxProps {
15
+ address?: Address
16
+ refresh?: number
17
+ viewer?: XyoViewer
18
+ }
19
+
20
+ export const AccountBalanceHistoryFlexBox: React.FC<AccountBalanceHistoryFlexBoxProps> = ({
21
+ address, refresh, viewer, ...props
22
+ }) => {
23
+ const [results, error] = useAccountBalanceHistory(address, viewer, refresh)
24
+ const {
25
+ history, balance, truncated,
26
+ } = results || { balance: [AttoXL1(0n), AttoXL1(0n)], history: undefined }
27
+
28
+ const formatBalance = (balance: bigint) => {
29
+ const xl1Amount = new XL1Amount(balance)
30
+ return xl1Amount.toString(undefined, {
31
+ places: 18, maxDecimal: 12, maxCharacters: 12, minDecimals: 1, locale: navigator.language,
32
+ })
33
+ }
34
+
35
+ const formatBalanceMagnitude = (set: [AttoXL1, AttoXL1]) => {
36
+ const [received, sent] = set
37
+ const netBalance = received - sent
38
+ return netBalance < 0n ? `-${formatBalance(sent - received)}` : formatBalance(netBalance)
39
+ }
40
+
41
+ return isDefined(history) && isDefined(address)
42
+ ? (
43
+ <FlexCol {...props}>
44
+ <ErrorRender error={error} scope="AccountBalanceHistoryTable" />
45
+ <Typography variant="h6" gutterBottom>
46
+ {formatBalanceMagnitude(balance)}
47
+ </Typography>
48
+ {truncated
49
+ ? (
50
+ <Typography variant="caption" gutterBottom>
51
+ Ranged Balance from
52
+ {' '}
53
+ {history.at(-1)!.blockNumber}
54
+ {' '}
55
+ -
56
+ {' '}
57
+ {history[0].blockNumber}
58
+ </Typography>
59
+ )
60
+ : null}
61
+ <AccountBalanceHistoryTable history={history} />
62
+ </FlexCol>
63
+ )
64
+ : null
65
+ }
@@ -0,0 +1,2 @@
1
+ export * from './BalanceHistoryFlexbox.tsx'
2
+ export * from './table/index.ts'
@@ -0,0 +1,25 @@
1
+ import type { TableCellProps } from '@mui/material'
2
+ import { TableCell, Tooltip } from '@mui/material'
3
+ import { useEvent } from '@xyo-network/react-event'
4
+
5
+ import { BlockAddressChip } from '../../block/index.ts'
6
+
7
+ export interface AddressTableCellProps extends TableCellProps {
8
+ address?: string
9
+ linked?: boolean
10
+ toolTipTitle?: string
11
+ }
12
+
13
+ export const AddressTableCell: React.FC<AddressTableCellProps> = ({
14
+ address, linked, toolTipTitle, sx, ...props
15
+ }) => {
16
+ const [ref, dispatch] = useEvent()
17
+ const handleClick = () => dispatch('address', 'click', address)
18
+ return (
19
+ <TableCell ref={ref} sx={{ cursor: linked ? 'pointer' : 'default', ...sx }} {...props}>
20
+ <Tooltip title={toolTipTitle}>
21
+ <BlockAddressChip address={address} onClick={handleClick} />
22
+ </Tooltip>
23
+ </TableCell>
24
+ )
25
+ }
@@ -0,0 +1,75 @@
1
+ import {
2
+ Alert, AlertTitle, LinearProgress, Snackbar,
3
+ } from '@mui/material'
4
+ import type { Meta, StoryFn } from '@storybook/react-vite'
5
+ import type { Address } from '@xylabs/sdk-js'
6
+ import { useAccountBalanceHistory, useHttpRpcViewer } from '@xyo-network/react-chain-provider'
7
+ import { ErrorRender } from '@xyo-network/react-error'
8
+ import type { Event } from '@xyo-network/react-event'
9
+ import { useEvent } from '@xyo-network/react-event'
10
+ import { LocalNetwork } from '@xyo-network/xl1-network-model'
11
+ import React, { useState } from 'react'
12
+
13
+ import { AccountBalanceHistoryTable } from './BalanceHistoryTable.tsx'
14
+
15
+ export default {
16
+ title: 'AccountBalanceHistory/Table',
17
+ component: AccountBalanceHistoryTable,
18
+ } as Meta
19
+
20
+ const TEST_ADDRESS = 'aa9401662e9cd3ce8bb8a6ab92a35ed83e85ac67' as Address
21
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
+ const TEST_ADDRESS_1 = '2b1a21d8c90e658d8bf1e2aad31c8dc892c353c1' as Address
23
+
24
+ const useFetchBalanceHistory = (address?: Address) => {
25
+ const viewer = useHttpRpcViewer(LocalNetwork.url)
26
+ return useAccountBalanceHistory(address, viewer)
27
+ }
28
+
29
+ const Template: StoryFn<typeof AccountBalanceHistoryTable> = (args) => {
30
+ const results = useFetchBalanceHistory(TEST_ADDRESS)
31
+ const [history, error, loading] = results
32
+ return (
33
+ <>
34
+ <ErrorRender error={error} scope="AccountBalanceHistoryTableStory" />
35
+ {loading === 'pending' ? <LinearProgress /> : null}
36
+ <AccountBalanceHistoryTable history={history?.history} {...args} />
37
+ </>
38
+ )
39
+ }
40
+
41
+ const TemplateLinked: StoryFn<typeof AccountBalanceHistoryTable> = (args) => {
42
+ const [event, setEvent] = useState<Event>()
43
+ const [ref] = useEvent<HTMLTableElement>((noun, verb, data) => setEvent({
44
+ noun, verb, data,
45
+ }))
46
+
47
+ const results = useFetchBalanceHistory(TEST_ADDRESS)
48
+ const [history, error, loading] = results
49
+
50
+ return (
51
+ <>
52
+ <ErrorRender error={error} scope="AccountBalanceHistoryTableStory" />
53
+ {loading === 'pending' ? <LinearProgress /> : null}
54
+ <AccountBalanceHistoryTable history={history?.history} ref={ref} {...args} />
55
+ <Snackbar autoHideDuration={5000} open={!!event} onClose={() => setEvent(undefined)}>
56
+ <Alert>
57
+ <AlertTitle>
58
+ Event -
59
+ {' '}
60
+ {event?.noun}
61
+ </AlertTitle>
62
+ <pre>{JSON.stringify(event, null, 2)}</pre>
63
+ </Alert>
64
+ </Snackbar>
65
+ </>
66
+ )
67
+ }
68
+
69
+ const Default = Template.bind({})
70
+ Default.args = {}
71
+
72
+ const WithLinked = TemplateLinked.bind({})
73
+ WithLinked.args = { linked: true }
74
+
75
+ export { Default, WithLinked }
@@ -0,0 +1,36 @@
1
+ import type { TableProps } from '@mui/material'
2
+ import {
3
+ Table, TableBody, TableCell, TableHead, TableRow,
4
+ } from '@mui/material'
5
+ import { isDefined } from '@xylabs/sdk-js'
6
+ import type { AccountBalanceHistoryItemFormatted } from '@xyo-network/react-chain-provider'
7
+ import React from 'react'
8
+
9
+ import { BalanceHistoryTableRow } from './BalanceHistoryTableRow.tsx'
10
+ import { TableHeadingLabels } from './types/index.ts'
11
+
12
+ export interface AccountBalanceHistoryTableProps extends TableProps {
13
+ history?: AccountBalanceHistoryItemFormatted[]
14
+ linked?: boolean
15
+ }
16
+
17
+ export const AccountBalanceHistoryTable: React.FC<AccountBalanceHistoryTableProps> = ({
18
+ history, linked, ...props
19
+ }) => {
20
+ return isDefined(history)
21
+ ? (
22
+ <Table {...props}>
23
+ <TableHead>
24
+ <TableRow>
25
+ {TableHeadingLabels.map(heading => (
26
+ <TableCell key={heading}>{heading}</TableCell>
27
+ ))}
28
+ </TableRow>
29
+ </TableHead>
30
+ <TableBody>
31
+ {history?.map(row => <BalanceHistoryTableRow key={row.key} linked={linked} row={row} />)}
32
+ </TableBody>
33
+ </Table>
34
+ )
35
+ : null
36
+ }
@@ -0,0 +1,41 @@
1
+ import {
2
+ TableCell, TableRow, type TableRowProps,
3
+ } from '@mui/material'
4
+ import type { AccountBalanceHistoryItemFormatted } from '@xyo-network/react-chain-provider'
5
+ import { RawInfoIconButton } from '@xyo-network/react-payload-raw-info'
6
+ import type { JsonValue } from '@xyo-network/xl1-rpc'
7
+ import { useMemo } from 'react'
8
+
9
+ import { BlockEpochTableCellInner, BlockNumberTableCellInner } from '../../block/index.ts'
10
+ import { AddressTableCell } from './AddressTableCell.tsx'
11
+ import { RawAmountTableCell } from './RawAmountTableCell.tsx'
12
+
13
+ export interface BalanceHistoryTableRowProps extends TableRowProps {
14
+ linked?: boolean
15
+ row: AccountBalanceHistoryItemFormatted
16
+ }
17
+
18
+ export const BalanceHistoryTableRow: React.FC<BalanceHistoryTableRowProps> = ({
19
+ linked, row, ...props
20
+ }) => {
21
+ const {
22
+ amount, blockNumber, debug, from, key, timestamp, to, type, txHash,
23
+ } = row ?? {}
24
+
25
+ const linkedTableCallProps = useMemo(() => ({ linked }), [linked])
26
+
27
+ return (
28
+ <TableRow key={key} {...props}>
29
+ <TableCell>{txHash || 'N/A'}</TableCell>
30
+ <BlockNumberTableCellInner blockNumber={blockNumber} {...linkedTableCallProps} />
31
+ <BlockEpochTableCellInner epoch={timestamp} {...linkedTableCallProps} />
32
+ <AddressTableCell address={from} toolTipTitle={`From Address: ${from}`} {...linkedTableCallProps} />
33
+ <AddressTableCell address={to} toolTipTitle={`To Address: ${to}`} {...linkedTableCallProps} />
34
+ {/* Intentionally not passing linked prop here till we know where a link would go */}
35
+ <RawAmountTableCell amount={amount} type={type} />
36
+ <TableCell>
37
+ <RawInfoIconButton rawValue={debug as JsonValue} />
38
+ </TableCell>
39
+ </TableRow>
40
+ )
41
+ }
@@ -0,0 +1,52 @@
1
+ import {
2
+ Link,
3
+ TableCell, type TableCellProps, Tooltip,
4
+ } from '@mui/material'
5
+ import { isDefined, toHex } from '@xylabs/sdk-js'
6
+ import type { BalanceTransactionType } from '@xyo-network/react-chain-provider'
7
+ import { useEvent } from '@xyo-network/react-event'
8
+ import { XL1Amount } from '@xyo-network/xl1-protocol'
9
+
10
+ import type { BalanceHistoryEventNouns } from './types/index.ts'
11
+
12
+ export interface RawAmountTableCellProps extends TableCellProps {
13
+ amount?: bigint
14
+ linked?: boolean
15
+ type?: BalanceTransactionType
16
+ }
17
+
18
+ export const RawAmountTableCell: React.FC<RawAmountTableCellProps> = ({
19
+ amount, linked, sx, type, ...props
20
+ }) => {
21
+ const [ref, dispatch] = useEvent<HTMLAnchorElement, BalanceHistoryEventNouns>()
22
+ const handleClick = () => dispatch('amount', 'click', isDefined(amount) ? toHex(amount) : '')
23
+
24
+ const formatAmount = (amount?: bigint) => {
25
+ if (!isDefined(amount)) {
26
+ return 'N/A'
27
+ }
28
+ const xl1Amount = new XL1Amount(amount)
29
+ return xl1Amount.toString(undefined, {
30
+ places: 18, maxDecimal: 12, maxCharacters: 12, minDecimals: 1, locale: navigator.language,
31
+ })
32
+ }
33
+ return (
34
+ <TableCell ref={ref} {...props}>
35
+ <Tooltip title={`Raw Amount: ${amount}`}>
36
+ {linked
37
+ ? (
38
+ <Link onClick={handleClick} sx={{ cursor: 'pointer' }}>
39
+ {type === 'send' ? '-' : ''}
40
+ {formatAmount(amount)}
41
+ </Link>
42
+ )
43
+ : (
44
+ <span>
45
+ {type === 'send' ? '-' : ''}
46
+ {formatAmount(amount)}
47
+ </span>
48
+ )}
49
+ </Tooltip>
50
+ </TableCell>
51
+ )
52
+ }
@@ -0,0 +1,4 @@
1
+ export * from './AddressTableCell.tsx'
2
+ export * from './BalanceHistoryTable.tsx'
3
+ export * from './BalanceHistoryTableRow.tsx'
4
+ export * from './types/index.ts'
@@ -0,0 +1,17 @@
1
+ import type { AccountBalanceHistoryItemFormatted } from '@xyo-network/react-chain-provider'
2
+ import type { ExtendEventNoun } from '@xyo-network/react-event'
3
+
4
+ export type BalanceHistoryEventNouns = ExtendEventNoun<'amount' | 'blockNumber'>
5
+
6
+ export type TableHeadingLabels = 'Tx Hash' | 'BlockNumber' | 'Timestamp' | 'From' | 'To' | 'Amount' | 'Debug'
7
+ export type TableHeadings = { [key in keyof AccountBalanceHistoryItemFormatted]: TableHeadingLabels }
8
+
9
+ export const TableHeadingLabels: TableHeadingLabels[] = [
10
+ 'Tx Hash',
11
+ 'BlockNumber',
12
+ 'Timestamp',
13
+ 'From',
14
+ 'To',
15
+ 'Amount',
16
+ 'Debug',
17
+ ] as const
@@ -1,5 +1,5 @@
1
- import type { Hash } from '@xylabs/hex'
2
1
  import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
2
+ import type { Hash } from '@xylabs/sdk-js'
3
3
  import { BWVerification, HashHeadingPaper } from '@xyo-network/react-boundwitness-plugin'
4
4
  import { usePayloadHash } from '@xyo-network/react-shared'
5
5
  import React from 'react'
@@ -1,8 +1,8 @@
1
1
  import type { ChipProps } from '@mui/material'
2
2
  import { Chip } from '@mui/material'
3
- import { EthAddressWrapper } from '@xylabs/eth-address'
4
- import { toAddress } from '@xylabs/hex'
5
- import { isString, isUndefined } from '@xylabs/typeof'
3
+ import {
4
+ EthAddressWrapper, isString, isUndefined, toAddress,
5
+ } from '@xylabs/sdk-js'
6
6
  import { BlockiesAvatar } from '@xyo-network/react-chain-blockies'
7
7
  import type { HydratedBlock } from '@xyo-network/xl1-protocol'
8
8
  import React, { useMemo } from 'react'
@@ -1,5 +1,5 @@
1
1
  import { usePromise } from '@xylabs/react-promise'
2
- import { isDefined } from '@xylabs/typeof'
2
+ import { isDefined } from '@xylabs/sdk-js'
3
3
  import type { XyoChainIteratorParams } from '@xyo-network/chain-services'
4
4
  import type { HydratedBlock } from '@xyo-network/xl1-protocol'
5
5
  import type { ComponentType } from 'react'
@@ -28,7 +28,7 @@ const TemplateLinked: StoryFn<typeof BlockchainTableEx> = (args) => {
28
28
  return (
29
29
  <>
30
30
  <BlockchainTableEx ref={ref} {...args} />
31
- <Snackbar open={!!event} onClose={() => setEvent(undefined)}>
31
+ <Snackbar open={!!event} autoHideDuration={5000} onClose={() => setEvent(undefined)}>
32
32
  <Alert>
33
33
  <AlertTitle>
34
34
  Event -
@@ -1,9 +1,12 @@
1
1
  import {
2
+ Link,
2
3
  TableCell, Tooltip,
3
4
  Typography,
4
5
  } from '@mui/material'
6
+ import { useEvent } from '@xyo-network/react-event'
5
7
  import React from 'react'
6
8
 
9
+ import type { BlockHeaderEventNouns } from '../../hooks/index.ts'
7
10
  import type { BlockTableCellProps } from './lib/index.ts'
8
11
 
9
12
  export interface BlockNumberTableCellProps extends BlockTableCellProps {}
@@ -16,14 +19,16 @@ export const BlockNumberTableCell: React.FC<BlockNumberTableCellProps> = ({
16
19
  return <BlockNumberTableCellInner blockNumber={blockNumber} linked={linked} {...props} />
17
20
  }
18
21
 
19
- export const BlockNumberTableCellInner: React.FC<BlockNumberTableCellProps & { blockNumber?: number }> = ({
22
+ export const BlockNumberTableCellInner: React.FC<BlockNumberTableCellProps & { blockNumber?: number; linked?: boolean }> = ({
20
23
  blockNumber, linked, ...props
21
24
  }) => {
25
+ const [ref, dispatch] = useEvent<HTMLTableCellElement, BlockHeaderEventNouns>()
26
+ const handleClick = () => dispatch('block-number', 'click', blockNumber?.toString() ?? '')
22
27
  return (
23
- <TableCell {...props}>
28
+ <TableCell ref={ref} {...props}>
24
29
  <Tooltip title={`Block Number: ${blockNumber}`}>
25
30
  <Typography component="span" variant="body1">
26
- {blockNumber}
31
+ {linked ? <Link onClick={handleClick} sx={{ cursor: 'pointer' }}>{blockNumber}</Link> : blockNumber}
27
32
  </Typography>
28
33
  </Tooltip>
29
34
  </TableCell>
@@ -2,7 +2,7 @@ import {
2
2
  Skeleton,
3
3
  TableCell, Tooltip, Typography,
4
4
  } from '@mui/material'
5
- import { isDefined } from '@xylabs/typeof'
5
+ import { isDefined } from '@xylabs/sdk-js'
6
6
  import React from 'react'
7
7
 
8
8
  import {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Link, TableCell, Tooltip,
3
3
  } from '@mui/material'
4
- import { isHash } from '@xylabs/hex'
4
+ import { isHash } from '@xylabs/sdk-js'
5
5
  import { usePayloadRootHash } from '@xyo-network/react-shared'
6
6
  import React, { useState } from 'react'
7
7
 
@@ -3,9 +3,8 @@ import {
3
3
  Button,
4
4
  Dialog, DialogActions, DialogContent, DialogTitle, IconButton, TableCell,
5
5
  } from '@mui/material'
6
- import { ellipsize } from '@xylabs/eth-address'
7
- import { isHash } from '@xylabs/hex'
8
6
  import { FlexRow } from '@xylabs/react-flexbox'
7
+ import { ellipsize, isHash } from '@xylabs/sdk-js'
9
8
  import { JsonViewerEx } from '@xyo-network/react-payload-raw-info'
10
9
  import { usePayloadRootHash } from '@xyo-network/react-shared'
11
10
  import React, { useState } from 'react'
@@ -2,7 +2,7 @@ import { Error } from '@mui/icons-material'
2
2
  import {
3
3
  Link, TableCell, Tooltip,
4
4
  } from '@mui/material'
5
- import type { Hash } from '@xylabs/hex'
5
+ import type { Hash } from '@xylabs/sdk-js'
6
6
  import React from 'react'
7
7
 
8
8
  import { usePayloadCountsFromBlock } from '../../hooks/index.ts'
@@ -2,7 +2,7 @@ import { Error } from '@mui/icons-material'
2
2
  import {
3
3
  Link, TableCell, Tooltip,
4
4
  } from '@mui/material'
5
- import type { Hash } from '@xylabs/hex'
5
+ import type { Hash } from '@xylabs/sdk-js'
6
6
  import React, { useMemo } from 'react'
7
7
 
8
8
  import { useTxsFromBlock } from '../../../../hooks/index.ts'
@@ -1,5 +1,5 @@
1
1
  import type { Meta, StoryFn } from '@storybook/react-vite'
2
- import type { CreatableName } from '@xylabs/creatable'
2
+ import type { CreatableName } from '@xylabs/sdk-js'
3
3
  import React from 'react'
4
4
 
5
5
  import { ChainArchivistDecorator } from '../../../../../stories/index.ts'