@xyo-network/react-chain-blockchain 1.11.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/components/block/BlockHeadingFlexbox.stories.d.ts +3 -3
- package/dist/browser/components/block/BlockHeadingFlexbox.stories.d.ts.map +1 -1
- package/dist/browser/components/block/helpers/blockProducer.d.ts +5 -1
- package/dist/browser/components/block/helpers/blockProducer.d.ts.map +1 -1
- package/dist/browser/components/block/hooks/useBlockProducer.d.ts +5 -1
- package/dist/browser/components/block/hooks/useBlockProducer.d.ts.map +1 -1
- package/dist/browser/components/block/table/Ex.stories.d.ts +3 -3
- package/dist/browser/components/block/table/Ex.stories.d.ts.map +1 -1
- package/dist/browser/components/block/table/row/TableRow.stories.d.ts +2 -2
- package/dist/browser/components/block/table/row/TableRow.stories.d.ts.map +1 -1
- package/dist/browser/components/chain/controls/PulseSvgIcon.d.ts +1 -1
- package/dist/browser/components/chain/controls/PulseSvgIcon.d.ts.map +1 -1
- package/dist/browser/components/chain/render/dynamic/flexbox/Flexbox.stories.d.ts +3 -3
- package/dist/browser/components/chain/render/dynamic/flexbox/Flexbox.stories.d.ts.map +1 -1
- package/dist/browser/components/chain/render/dynamic/flexbox/Remote.stories.d.ts +3 -3
- package/dist/browser/components/chain/render/dynamic/flexbox/Remote.stories.d.ts.map +1 -1
- package/dist/browser/components/chain/render/static/flexbox/Flexbox.stories.d.ts +3 -3
- package/dist/browser/components/chain/render/static/flexbox/Flexbox.stories.d.ts.map +1 -1
- package/dist/browser/components/chain/render/static/table/Ex.stories.d.ts +3 -3
- package/dist/browser/components/chain/render/static/table/Ex.stories.d.ts.map +1 -1
- package/dist/browser/components/chain/stats/producer/ProducerFlexbox.d.ts +1 -1
- package/dist/browser/components/chain/stats/producer/ProducerFlexbox.d.ts.map +1 -1
- package/dist/browser/components/chain/styled/BlockListWrapperFlexbox.d.ts +1 -1
- package/dist/browser/components/chain/styled/BlockListWrapperFlexbox.d.ts.map +1 -1
- package/dist/browser/components/payload/builder/producer-intent/Flexbox.stories.d.ts +1 -1
- package/dist/browser/components/payload/builder/producer-intent/Flexbox.stories.d.ts.map +1 -1
- package/dist/browser/components/payload/builder/transfer/Flexbox.stories.d.ts +1 -1
- package/dist/browser/components/payload/builder/transfer/Flexbox.stories.d.ts.map +1 -1
- package/dist/browser/components/transactions/submit/Builder.d.ts +1 -1
- package/dist/browser/components/transactions/submit/Builder.d.ts.map +1 -1
- package/dist/browser/components/transactions/submit/SubmitChain.stories.d.ts +1 -1
- package/dist/browser/components/transactions/submit/SubmitChain.stories.d.ts.map +1 -1
- package/dist/browser/context/chain/Context.d.ts +3 -3
- package/dist/browser/context/chain/State.d.ts +2 -3
- package/dist/browser/context/chain/State.d.ts.map +1 -1
- package/dist/browser/context/chain/use.d.ts +1 -1
- package/dist/browser/helpers/txsFromBlock.d.ts +5 -1
- package/dist/browser/helpers/txsFromBlock.d.ts.map +1 -1
- package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts +19 -19
- package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
- package/dist/browser/hooks/useTxsFromBlock.d.ts +5 -1
- package/dist/browser/hooks/useTxsFromBlock.d.ts.map +1 -1
- package/dist/browser/index.mjs +1321 -1142
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/types/render/BlockChainRenderProps.d.ts +3 -2
- package/dist/browser/types/render/BlockChainRenderProps.d.ts.map +1 -1
- package/package.json +50 -50
- package/src/components/transactions/submit/Builder.tsx +4 -3
- package/src/context/chain/State.ts +2 -3
- package/src/types/render/BlockChainRenderProps.ts +3 -2
package/dist/browser/index.mjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
1
4
|
// src/components/block/BlockHeadingFlexbox.tsx
|
|
2
5
|
import { FlexCol as FlexCol2, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
3
6
|
import { BWVerification, HashHeadingPaper } from "@xyo-network/react-boundwitness-plugin";
|
|
4
7
|
import { usePayloadHash } from "@xyo-network/react-shared";
|
|
8
|
+
import React14 from "react";
|
|
5
9
|
|
|
6
10
|
// src/context/analyzer/context.ts
|
|
7
11
|
import { createContextEx } from "@xylabs/react-shared";
|
|
@@ -9,19 +13,22 @@ var ChainAnalyzersContext = createContextEx();
|
|
|
9
13
|
|
|
10
14
|
// src/context/analyzer/Provider.tsx
|
|
11
15
|
import { isUndefined } from "@xylabs/typeof";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
useMemo,
|
|
15
|
-
useState
|
|
16
|
-
} from "react";
|
|
17
|
-
import { jsx } from "react/jsx-runtime";
|
|
18
|
-
var ChainAnalyzersProvider = ({ analyzers: analyzersProp, children }) => {
|
|
16
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
17
|
+
var ChainAnalyzersProvider = /* @__PURE__ */ __name(({ analyzers: analyzersProp, children }) => {
|
|
19
18
|
const [analyzersState, setAnalyzersState] = useState(analyzersProp ?? {});
|
|
20
19
|
const [statsUpdated, setStatsUpdated] = useState(Date.now());
|
|
21
|
-
const analyzers = useMemo(() => ({
|
|
20
|
+
const analyzers = useMemo(() => ({
|
|
21
|
+
...analyzersProp,
|
|
22
|
+
...analyzersState
|
|
23
|
+
}), [
|
|
24
|
+
analyzersProp
|
|
25
|
+
]);
|
|
22
26
|
const addAnalyzers = useCallback((analyzers2) => {
|
|
23
27
|
if (isUndefined(analyzers2)) return;
|
|
24
|
-
setAnalyzersState((prev) => ({
|
|
28
|
+
setAnalyzersState((prev) => ({
|
|
29
|
+
...prev,
|
|
30
|
+
...analyzers2
|
|
31
|
+
}));
|
|
25
32
|
}, []);
|
|
26
33
|
const onBlock = useCallback(async (hydratedBlock) => {
|
|
27
34
|
await Promise.resolve();
|
|
@@ -29,55 +36,64 @@ var ChainAnalyzersProvider = ({ analyzers: analyzersProp, children }) => {
|
|
|
29
36
|
void analyzer.onBlock(hydratedBlock);
|
|
30
37
|
setStatsUpdated(Date.now());
|
|
31
38
|
}
|
|
32
|
-
}, [
|
|
39
|
+
}, [
|
|
40
|
+
analyzers
|
|
41
|
+
]);
|
|
33
42
|
const value = useMemo(() => ({
|
|
34
43
|
analyzers,
|
|
35
44
|
addAnalyzers,
|
|
36
45
|
onBlock,
|
|
37
46
|
statsUpdated,
|
|
38
47
|
provided: true
|
|
39
|
-
}), [
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
}), [
|
|
49
|
+
analyzers,
|
|
50
|
+
addAnalyzers,
|
|
51
|
+
onBlock,
|
|
52
|
+
statsUpdated
|
|
53
|
+
]);
|
|
54
|
+
return /* @__PURE__ */ React.createElement(ChainAnalyzersContext, {
|
|
55
|
+
value
|
|
56
|
+
}, children);
|
|
57
|
+
}, "ChainAnalyzersProvider");
|
|
42
58
|
|
|
43
59
|
// src/context/analyzer/use.ts
|
|
44
60
|
import { useContextEx } from "@xylabs/react-shared";
|
|
45
|
-
var useChainAnalyzersContext = (required = false) => useContextEx(ChainAnalyzersContext, "ChainAnalyzers", required);
|
|
61
|
+
var useChainAnalyzersContext = /* @__PURE__ */ __name((required = false) => useContextEx(ChainAnalyzersContext, "ChainAnalyzers", required), "useChainAnalyzersContext");
|
|
46
62
|
|
|
47
63
|
// src/context/chain/Context.ts
|
|
48
64
|
import { createContextEx as createContextEx2 } from "@xylabs/react-shared";
|
|
49
65
|
var ChainInfoContext = createContextEx2();
|
|
50
66
|
|
|
51
67
|
// src/context/chain/Provider.tsx
|
|
52
|
-
import { useMemo as useMemo2, useState as useState2 } from "react";
|
|
53
|
-
|
|
54
|
-
var ChainInfoProvider = ({
|
|
55
|
-
children,
|
|
56
|
-
chainArchivist: chainArchivistProp,
|
|
57
|
-
chainId: chainIdProp,
|
|
58
|
-
chainIterator: chainIteratorProp
|
|
59
|
-
}) => {
|
|
68
|
+
import React2, { useMemo as useMemo2, useState as useState2 } from "react";
|
|
69
|
+
var ChainInfoProvider = /* @__PURE__ */ __name(({ children, chainArchivist: chainArchivistProp, chainId: chainIdProp, chainIterator: chainIteratorProp }) => {
|
|
60
70
|
const [chainArchivist, setChainArchivist] = useState2(chainArchivistProp);
|
|
61
71
|
const [chainId, setChainId] = useState2(chainIdProp);
|
|
62
72
|
const [chainIterator, setChainIterator] = useState2(chainIteratorProp);
|
|
63
|
-
const updateChainArchivist = (chainArchivist2) => {
|
|
73
|
+
const updateChainArchivist = /* @__PURE__ */ __name((chainArchivist2) => {
|
|
64
74
|
setChainArchivist(chainArchivist2);
|
|
65
|
-
};
|
|
66
|
-
const updateChainId = (chainId2) => {
|
|
75
|
+
}, "updateChainArchivist");
|
|
76
|
+
const updateChainId = /* @__PURE__ */ __name((chainId2) => {
|
|
67
77
|
setChainId(chainId2);
|
|
68
|
-
};
|
|
69
|
-
const updateChainIterator = (chainIterator2) => {
|
|
78
|
+
}, "updateChainId");
|
|
79
|
+
const updateChainIterator = /* @__PURE__ */ __name((chainIterator2) => {
|
|
70
80
|
setChainIterator(chainIterator2);
|
|
71
|
-
};
|
|
81
|
+
}, "updateChainIterator");
|
|
72
82
|
useMemo2(() => {
|
|
73
83
|
updateChainArchivist(chainArchivistProp);
|
|
74
|
-
}, [
|
|
84
|
+
}, [
|
|
85
|
+
chainArchivistProp
|
|
86
|
+
]);
|
|
75
87
|
useMemo2(() => {
|
|
76
88
|
updateChainId(chainIdProp);
|
|
77
|
-
}, [
|
|
89
|
+
}, [
|
|
90
|
+
chainIdProp
|
|
91
|
+
]);
|
|
78
92
|
useMemo2(() => {
|
|
79
93
|
updateChainIterator(chainIteratorProp);
|
|
80
|
-
}, [
|
|
94
|
+
}, [
|
|
95
|
+
chainIteratorProp
|
|
96
|
+
]);
|
|
81
97
|
const chainState = useMemo2(() => ({
|
|
82
98
|
chainArchivist,
|
|
83
99
|
chainId,
|
|
@@ -86,22 +102,26 @@ var ChainInfoProvider = ({
|
|
|
86
102
|
updateChainId,
|
|
87
103
|
updateChainIterator,
|
|
88
104
|
provided: true
|
|
89
|
-
}), [
|
|
90
|
-
|
|
91
|
-
|
|
105
|
+
}), [
|
|
106
|
+
chainArchivist,
|
|
107
|
+
chainId,
|
|
108
|
+
chainIterator,
|
|
109
|
+
updateChainArchivist,
|
|
110
|
+
updateChainId,
|
|
111
|
+
updateChainIterator
|
|
112
|
+
]);
|
|
113
|
+
return /* @__PURE__ */ React2.createElement(ChainInfoContext, {
|
|
114
|
+
value: chainState
|
|
115
|
+
}, children);
|
|
116
|
+
}, "ChainInfoProvider");
|
|
92
117
|
|
|
93
118
|
// src/context/polling/context.ts
|
|
94
119
|
import { createContextEx as createContextEx3 } from "@xylabs/react-shared";
|
|
95
120
|
var ChainPollingContext = createContextEx3();
|
|
96
121
|
|
|
97
122
|
// src/context/polling/Provider.tsx
|
|
98
|
-
import {
|
|
99
|
-
|
|
100
|
-
useMemo as useMemo3,
|
|
101
|
-
useState as useState3
|
|
102
|
-
} from "react";
|
|
103
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
104
|
-
var ChainPollingProvider = ({ children, pollingState: pollingStateProp = "running" }) => {
|
|
123
|
+
import React3, { useCallback as useCallback2, useMemo as useMemo3, useState as useState3 } from "react";
|
|
124
|
+
var ChainPollingProvider = /* @__PURE__ */ __name(({ children, pollingState: pollingStateProp = "running" }) => {
|
|
105
125
|
const [pollingState, setPollingState] = useState3(pollingStateProp);
|
|
106
126
|
const updatePollingState = useCallback2((newPollingState) => {
|
|
107
127
|
setPollingState(newPollingState);
|
|
@@ -110,26 +130,27 @@ var ChainPollingProvider = ({ children, pollingState: pollingStateProp = "runnin
|
|
|
110
130
|
pollingState,
|
|
111
131
|
provided: true,
|
|
112
132
|
updatePollingState
|
|
113
|
-
}), [
|
|
114
|
-
|
|
115
|
-
|
|
133
|
+
}), [
|
|
134
|
+
pollingState,
|
|
135
|
+
updatePollingState
|
|
136
|
+
]);
|
|
137
|
+
return /* @__PURE__ */ React3.createElement(ChainPollingContext, {
|
|
138
|
+
value
|
|
139
|
+
}, children);
|
|
140
|
+
}, "ChainPollingProvider");
|
|
116
141
|
|
|
117
142
|
// src/context/polling/use.ts
|
|
118
143
|
import { useContextEx as useContextEx2 } from "@xylabs/react-shared";
|
|
119
|
-
var useChainPollingContext = (required = false) => useContextEx2(ChainPollingContext, "ChainPolling", required);
|
|
144
|
+
var useChainPollingContext = /* @__PURE__ */ __name((required = false) => useContextEx2(ChainPollingContext, "ChainPolling", required), "useChainPollingContext");
|
|
120
145
|
|
|
121
146
|
// src/components/transactions/submit/Builder.tsx
|
|
122
|
-
import {
|
|
123
|
-
Button,
|
|
124
|
-
FormControl,
|
|
125
|
-
TextField
|
|
126
|
-
} from "@mui/material";
|
|
147
|
+
import { Button, FormControl, TextField } from "@mui/material";
|
|
127
148
|
import { toHex } from "@xylabs/hex";
|
|
128
149
|
import { FlexCol } from "@xylabs/react-flexbox";
|
|
129
150
|
import { defaultTransactionFees } from "@xyo-network/xl1-protocol";
|
|
130
|
-
import
|
|
131
|
-
var ChainTransactionBuilder = ({ onSubmitTx }) => {
|
|
132
|
-
const handleSubmit = async (event) => {
|
|
151
|
+
import React4 from "react";
|
|
152
|
+
var ChainTransactionBuilder = /* @__PURE__ */ __name(({ onSubmitTx }) => {
|
|
153
|
+
const handleSubmit = /* @__PURE__ */ __name(async (event) => {
|
|
133
154
|
event.preventDefault();
|
|
134
155
|
const formData = new FormData(event.currentTarget);
|
|
135
156
|
const chainTx = {
|
|
@@ -144,31 +165,50 @@ var ChainTransactionBuilder = ({ onSubmitTx }) => {
|
|
|
144
165
|
}
|
|
145
166
|
};
|
|
146
167
|
await onSubmitTx?.(chainTx);
|
|
147
|
-
};
|
|
148
|
-
return /* @__PURE__ */
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
168
|
+
}, "handleSubmit");
|
|
169
|
+
return /* @__PURE__ */ React4.createElement("form", {
|
|
170
|
+
onSubmit: /* @__PURE__ */ __name((event) => void handleSubmit(event), "onSubmit"),
|
|
171
|
+
style: {
|
|
172
|
+
width: "100%"
|
|
173
|
+
}
|
|
174
|
+
}, /* @__PURE__ */ React4.createElement(FlexCol, {
|
|
175
|
+
gap: 2
|
|
176
|
+
}, /* @__PURE__ */ React4.createElement(FormControl, {
|
|
177
|
+
fullWidth: true
|
|
178
|
+
}, /* @__PURE__ */ React4.createElement(TextField, {
|
|
179
|
+
label: "Chain Address",
|
|
180
|
+
name: "chain",
|
|
181
|
+
required: true
|
|
182
|
+
})), /* @__PURE__ */ React4.createElement(FormControl, {
|
|
183
|
+
fullWidth: true
|
|
184
|
+
}, /* @__PURE__ */ React4.createElement(TextField, {
|
|
185
|
+
label: "Gas",
|
|
186
|
+
name: "gas",
|
|
187
|
+
required: true
|
|
188
|
+
})), /* @__PURE__ */ React4.createElement(FormControl, {
|
|
189
|
+
fullWidth: true
|
|
190
|
+
}, /* @__PURE__ */ React4.createElement(TextField, {
|
|
191
|
+
label: "Not Before Block",
|
|
192
|
+
name: "nbf",
|
|
193
|
+
required: true
|
|
194
|
+
})), /* @__PURE__ */ React4.createElement(FormControl, {
|
|
195
|
+
fullWidth: true
|
|
196
|
+
}, /* @__PURE__ */ React4.createElement(TextField, {
|
|
197
|
+
label: "Not After Block",
|
|
198
|
+
name: "exp",
|
|
199
|
+
required: true
|
|
200
|
+
})), /* @__PURE__ */ React4.createElement(Button, {
|
|
201
|
+
type: "submit",
|
|
202
|
+
variant: "contained"
|
|
203
|
+
}, "Submit")));
|
|
204
|
+
}, "ChainTransactionBuilder");
|
|
156
205
|
|
|
157
206
|
// src/components/transactions/submit/Network.tsx
|
|
158
|
-
import {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
TextField as TextField2
|
|
162
|
-
} from "@mui/material";
|
|
163
|
-
import { useState as useState4 } from "react";
|
|
164
|
-
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
165
|
-
var ChainTransactionNetwork = ({
|
|
166
|
-
network,
|
|
167
|
-
onNetworkChange,
|
|
168
|
-
...props
|
|
169
|
-
}) => {
|
|
207
|
+
import { FormControl as FormControl2, FormHelperText, TextField as TextField2 } from "@mui/material";
|
|
208
|
+
import React5, { useState as useState4 } from "react";
|
|
209
|
+
var ChainTransactionNetwork = /* @__PURE__ */ __name(({ network, onNetworkChange, ...props }) => {
|
|
170
210
|
const [error, setError] = useState4();
|
|
171
|
-
const handleChange = (event) => {
|
|
211
|
+
const handleChange = /* @__PURE__ */ __name((event) => {
|
|
172
212
|
try {
|
|
173
213
|
const url = new URL(event.target.value);
|
|
174
214
|
setError(void 0);
|
|
@@ -177,19 +217,25 @@ var ChainTransactionNetwork = ({
|
|
|
177
217
|
console.error(error2);
|
|
178
218
|
setError(error2);
|
|
179
219
|
}
|
|
180
|
-
};
|
|
181
|
-
return /* @__PURE__ */
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
220
|
+
}, "handleChange");
|
|
221
|
+
return /* @__PURE__ */ React5.createElement(FormControl2, {
|
|
222
|
+
fullWidth: true
|
|
223
|
+
}, /* @__PURE__ */ React5.createElement(TextField2, {
|
|
224
|
+
label: "Network",
|
|
225
|
+
name: "network",
|
|
226
|
+
onChange: handleChange,
|
|
227
|
+
required: true,
|
|
228
|
+
value: network,
|
|
229
|
+
...props
|
|
230
|
+
}), /* @__PURE__ */ React5.createElement(FormHelperText, {
|
|
231
|
+
sx: {
|
|
232
|
+
color: error ? "red" : void 0
|
|
233
|
+
}
|
|
234
|
+
}, error ? "Not a valid url" : "Enter full url of archivist"));
|
|
235
|
+
}, "ChainTransactionNetwork");
|
|
186
236
|
|
|
187
237
|
// src/components/transactions/submit/SubmitChain.tsx
|
|
188
|
-
import {
|
|
189
|
-
Alert,
|
|
190
|
-
Grid,
|
|
191
|
-
Typography
|
|
192
|
-
} from "@mui/material";
|
|
238
|
+
import { Alert, Grid, Typography } from "@mui/material";
|
|
193
239
|
import { axios } from "@xylabs/axios";
|
|
194
240
|
import { ErrorRender } from "@xylabs/react-error";
|
|
195
241
|
import { FlexGrowCol } from "@xylabs/react-flexbox";
|
|
@@ -198,113 +244,100 @@ import { ArchivistInsertQuerySchema } from "@xyo-network/archivist-model";
|
|
|
198
244
|
import { QueryBoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
199
245
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
200
246
|
import { buildTransaction } from "@xyo-network/xl1-protocol-sdk";
|
|
201
|
-
import { useState as useState5 } from "react";
|
|
202
|
-
import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
247
|
+
import React6, { useState as useState5 } from "react";
|
|
203
248
|
var BETA_PENDING_TRANSACTIONS_ARCHIVIST = "https://beta.api.chain.xyo.network/8050fee682a2762f504d5449d8269a6f17f0b693";
|
|
204
249
|
var defaultNetwork = new URL(BETA_PENDING_TRANSACTIONS_ARCHIVIST);
|
|
205
|
-
var SubmitChainTransaction = () => {
|
|
250
|
+
var SubmitChainTransaction = /* @__PURE__ */ __name(() => {
|
|
206
251
|
const [network, setNetwork] = useState5(defaultNetwork);
|
|
207
252
|
const [result, setResult] = useState5();
|
|
208
253
|
const [error, setError] = useState5();
|
|
209
|
-
const onSubmitTx = async (chainTx) => {
|
|
254
|
+
const onSubmitTx = /* @__PURE__ */ __name(async (chainTx) => {
|
|
210
255
|
if (network) {
|
|
211
256
|
const randomAccount = await Account.random();
|
|
212
|
-
const [transactionBoundWitness] = await buildTransaction(
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
257
|
+
const [transactionBoundWitness] = await buildTransaction(chainTx.chain, [], [], randomAccount, chainTx.nbf, chainTx.exp);
|
|
258
|
+
const insertQuery = new PayloadBuilder({
|
|
259
|
+
schema: ArchivistInsertQuerySchema
|
|
260
|
+
}).build();
|
|
261
|
+
const [queryBoundWitness] = await new QueryBoundWitnessBuilder().payloads([
|
|
262
|
+
transactionBoundWitness
|
|
263
|
+
]).query(insertQuery).signer(randomAccount).build();
|
|
264
|
+
const response = await axios.post(network.href, [
|
|
265
|
+
queryBoundWitness,
|
|
266
|
+
[
|
|
267
|
+
insertQuery,
|
|
268
|
+
transactionBoundWitness,
|
|
269
|
+
chainTx
|
|
270
|
+
]
|
|
271
|
+
]);
|
|
223
272
|
if (response.data.errors.length > 0) {
|
|
224
273
|
setError(new Error(response.data.errors.map((e) => e.message).join("\n")));
|
|
225
274
|
} else {
|
|
226
275
|
setResult(response.data.data);
|
|
227
276
|
}
|
|
228
277
|
}
|
|
229
|
-
};
|
|
230
|
-
const onNetworkChange = (url) => {
|
|
278
|
+
}, "onSubmitTx");
|
|
279
|
+
const onNetworkChange = /* @__PURE__ */ __name((url) => {
|
|
231
280
|
setNetwork(url);
|
|
232
|
-
};
|
|
233
|
-
return /* @__PURE__ */
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
},
|
|
241
|
-
children: /* @__PURE__ */ jsxs3(FlexGrowCol, { alignItems: "start", gap: 2, children: [
|
|
242
|
-
/* @__PURE__ */ jsx6(ChainTransactionNetwork, { network, onNetworkChange }),
|
|
243
|
-
network ? /* @__PURE__ */ jsx6(ChainTransactionBuilder, { onSubmitTx }) : null,
|
|
244
|
-
result?.[2].length === 0 ? /* @__PURE__ */ jsx6(Alert, { severity: "success", children: "Success" }) : null,
|
|
245
|
-
error ? /* @__PURE__ */ jsx6(ErrorRender, { error }) : null,
|
|
246
|
-
result?.[2] && result?.[2].length > 0 ? /* @__PURE__ */ jsx6(ErrorRender, { error: new Error("Failed insert...see result below") }) : null,
|
|
247
|
-
result ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
248
|
-
/* @__PURE__ */ jsx6(Typography, { variant: "h6", children: "Result:" }),
|
|
249
|
-
/* @__PURE__ */ jsx6("pre", { children: JSON.stringify(result, null, 2) })
|
|
250
|
-
] }) : null
|
|
251
|
-
] })
|
|
281
|
+
}, "onNetworkChange");
|
|
282
|
+
return /* @__PURE__ */ React6.createElement(Grid, {
|
|
283
|
+
container: true
|
|
284
|
+
}, /* @__PURE__ */ React6.createElement(Grid, {
|
|
285
|
+
size: {
|
|
286
|
+
xs: 12,
|
|
287
|
+
sm: 6,
|
|
288
|
+
md: 4
|
|
252
289
|
}
|
|
253
|
-
|
|
254
|
-
|
|
290
|
+
}, /* @__PURE__ */ React6.createElement(FlexGrowCol, {
|
|
291
|
+
alignItems: "start",
|
|
292
|
+
gap: 2
|
|
293
|
+
}, /* @__PURE__ */ React6.createElement(ChainTransactionNetwork, {
|
|
294
|
+
network,
|
|
295
|
+
onNetworkChange
|
|
296
|
+
}), network ? /* @__PURE__ */ React6.createElement(ChainTransactionBuilder, {
|
|
297
|
+
onSubmitTx
|
|
298
|
+
}) : null, result?.[2].length === 0 ? /* @__PURE__ */ React6.createElement(Alert, {
|
|
299
|
+
severity: "success"
|
|
300
|
+
}, "Success") : null, error ? /* @__PURE__ */ React6.createElement(ErrorRender, {
|
|
301
|
+
error
|
|
302
|
+
}) : null, result?.[2] && result?.[2].length > 0 ? /* @__PURE__ */ React6.createElement(ErrorRender, {
|
|
303
|
+
error: new Error("Failed insert...see result below")
|
|
304
|
+
}) : null, result ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(Typography, {
|
|
305
|
+
variant: "h6"
|
|
306
|
+
}, "Result:"), /* @__PURE__ */ React6.createElement("pre", null, JSON.stringify(result, null, 2))) : null)));
|
|
307
|
+
}, "SubmitChainTransaction");
|
|
255
308
|
|
|
256
309
|
// src/components/transactions/TransactionCountChip.tsx
|
|
257
310
|
import CompareArrowsIcon from "@mui/icons-material/CompareArrows";
|
|
258
311
|
import { Chip, Icon } from "@mui/material";
|
|
259
|
-
import { useMemo as useMemo4 } from "react";
|
|
260
|
-
|
|
261
|
-
var TransactionCountChip = ({
|
|
262
|
-
transactions,
|
|
263
|
-
sx,
|
|
264
|
-
...props
|
|
265
|
-
}) => {
|
|
312
|
+
import React7, { useMemo as useMemo4 } from "react";
|
|
313
|
+
var TransactionCountChip = /* @__PURE__ */ __name(({ transactions, sx, ...props }) => {
|
|
266
314
|
const label = useMemo4(() => {
|
|
267
315
|
if (!transactions) return "0";
|
|
268
316
|
return transactions?.length > 10 ? "+10" : transactions.length;
|
|
269
|
-
}, [
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
};
|
|
317
|
+
}, [
|
|
318
|
+
transactions
|
|
319
|
+
]);
|
|
320
|
+
return /* @__PURE__ */ React7.createElement(Chip, {
|
|
321
|
+
avatar: /* @__PURE__ */ React7.createElement(Icon, null, /* @__PURE__ */ React7.createElement(CompareArrowsIcon, null)),
|
|
322
|
+
label,
|
|
323
|
+
title: transactions ? `Block contains ${transactions.length} transactions` : void 0,
|
|
324
|
+
sx: {
|
|
325
|
+
display: "inline-flex",
|
|
326
|
+
alignItems: "center",
|
|
327
|
+
justifyContent: "center",
|
|
328
|
+
...sx
|
|
329
|
+
},
|
|
330
|
+
...props
|
|
331
|
+
});
|
|
332
|
+
}, "TransactionCountChip");
|
|
286
333
|
|
|
287
334
|
// src/components/transactions/TransactionsQuickTipButton.tsx
|
|
288
335
|
import { ContentCopy as ContentCopyIcon, Paid } from "@mui/icons-material";
|
|
289
|
-
import {
|
|
290
|
-
Alert as Alert2,
|
|
291
|
-
AlertTitle,
|
|
292
|
-
Collapse,
|
|
293
|
-
Snackbar,
|
|
294
|
-
Typography as Typography2
|
|
295
|
-
} from "@mui/material";
|
|
336
|
+
import { Alert as Alert2, AlertTitle, Collapse, Snackbar, Typography as Typography2 } from "@mui/material";
|
|
296
337
|
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
297
|
-
import {
|
|
298
|
-
FlexGrowCol as FlexGrowCol2,
|
|
299
|
-
FlexGrowRow,
|
|
300
|
-
FlexRow
|
|
301
|
-
} from "@xylabs/react-flexbox";
|
|
338
|
+
import { FlexGrowCol as FlexGrowCol2, FlexGrowRow, FlexRow } from "@xylabs/react-flexbox";
|
|
302
339
|
import { QuickTipButton } from "@xylabs/react-quick-tip-button";
|
|
303
|
-
import {
|
|
304
|
-
Fragment as Fragment2,
|
|
305
|
-
useMemo as useMemo6,
|
|
306
|
-
useState as useState7
|
|
307
|
-
} from "react";
|
|
340
|
+
import React8, { Fragment, useMemo as useMemo6, useState as useState7 } from "react";
|
|
308
341
|
|
|
309
342
|
// src/hooks/chain-iterator/ChainIteratorStore.ts
|
|
310
343
|
import { assertEx } from "@xylabs/assert";
|
|
@@ -312,6 +345,9 @@ import { ChainBlockNumberIterationService } from "@xyo-network/chain-services";
|
|
|
312
345
|
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
313
346
|
import { hydrateBlock } from "@xyo-network/xl1-protocol-sdk";
|
|
314
347
|
var ChainIteratorStore = class _ChainIteratorStore {
|
|
348
|
+
static {
|
|
349
|
+
__name(this, "ChainIteratorStore");
|
|
350
|
+
}
|
|
315
351
|
_chainIterator;
|
|
316
352
|
_externalListeners = [];
|
|
317
353
|
_internalUnsubscribes = [];
|
|
@@ -332,14 +368,14 @@ var ChainIteratorStore = class _ChainIteratorStore {
|
|
|
332
368
|
chainIterator,
|
|
333
369
|
head: hydratedHead
|
|
334
370
|
};
|
|
335
|
-
const headUpdatedListener = async ({ blocks }) => {
|
|
371
|
+
const headUpdatedListener = /* @__PURE__ */ __name(async ({ blocks }) => {
|
|
336
372
|
const hydratedBlock = await hydrateBlock(params.chainArchivist, await PayloadBuilder2.hash(blocks?.[0]));
|
|
337
373
|
instance._values = {
|
|
338
374
|
chainIterator,
|
|
339
375
|
head: hydratedBlock
|
|
340
376
|
};
|
|
341
377
|
instance.emitChange();
|
|
342
|
-
};
|
|
378
|
+
}, "headUpdatedListener");
|
|
343
379
|
const unsubscribe = chainIterator.on("headUpdated", headUpdatedListener);
|
|
344
380
|
const weakRefListener = new WeakRef(unsubscribe);
|
|
345
381
|
instance._internalUnsubscribes.push(weakRefListener);
|
|
@@ -375,29 +411,25 @@ import { isDefined } from "@xylabs/typeof";
|
|
|
375
411
|
import { BoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
376
412
|
import { isBlockBoundWitness } from "@xyo-network/xl1-protocol";
|
|
377
413
|
import { getDefaultConfig } from "@xyo-network/xl1-protocol-sdk";
|
|
378
|
-
var resolveDefinedHead = async (head, chainArchivist) => {
|
|
379
|
-
const [headPayload] = await chainArchivist.get([
|
|
414
|
+
var resolveDefinedHead = /* @__PURE__ */ __name(async (head, chainArchivist) => {
|
|
415
|
+
const [headPayload] = await chainArchivist.get([
|
|
416
|
+
head
|
|
417
|
+
]);
|
|
380
418
|
if (headPayload === void 0) {
|
|
381
419
|
const [currentHead] = await new BoundWitnessBuilder().build();
|
|
382
420
|
return currentHead;
|
|
383
421
|
} else {
|
|
384
422
|
return assertEx2(isBlockBoundWitness(headPayload) ? headPayload : void 0, () => `Expected a block bound witness: ${JSON.stringify(headPayload)}`);
|
|
385
423
|
}
|
|
386
|
-
};
|
|
387
|
-
var useChainIteratorParams = ({
|
|
388
|
-
chainArchivist,
|
|
389
|
-
chainId,
|
|
390
|
-
head,
|
|
391
|
-
name
|
|
392
|
-
}) => {
|
|
424
|
+
}, "resolveDefinedHead");
|
|
425
|
+
var useChainIteratorParams = /* @__PURE__ */ __name(({ chainArchivist, chainId, head, name }) => {
|
|
393
426
|
return usePromise(async () => {
|
|
394
427
|
if (isDefined(chainArchivist) && isDefined(chainId) && isHash(head)) {
|
|
395
|
-
const [result] = await chainArchivist.get([
|
|
428
|
+
const [result] = await chainArchivist.get([
|
|
429
|
+
head
|
|
430
|
+
]);
|
|
396
431
|
const foundResult = assertEx2(result, () => `Head not found: ${head}`);
|
|
397
|
-
const resolvedHead = assertEx2(
|
|
398
|
-
isBlockBoundWitness(foundResult) ? foundResult : void 0,
|
|
399
|
-
() => `Head is not a boundwitness: ${JSON.stringify(foundResult)}`
|
|
400
|
-
);
|
|
432
|
+
const resolvedHead = assertEx2(isBlockBoundWitness(foundResult) ? foundResult : void 0, () => `Head is not a boundwitness: ${JSON.stringify(foundResult)}`);
|
|
401
433
|
const config = getDefaultConfig();
|
|
402
434
|
config.chain.id = chainId;
|
|
403
435
|
return {
|
|
@@ -408,32 +440,26 @@ var useChainIteratorParams = ({
|
|
|
408
440
|
name
|
|
409
441
|
};
|
|
410
442
|
}
|
|
411
|
-
}, [
|
|
412
|
-
|
|
443
|
+
}, [
|
|
444
|
+
chainArchivist,
|
|
445
|
+
chainId,
|
|
446
|
+
head
|
|
447
|
+
]);
|
|
448
|
+
}, "useChainIteratorParams");
|
|
413
449
|
|
|
414
450
|
// src/hooks/chain-iterator/useChainIteratorStore.ts
|
|
415
451
|
import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
416
|
-
import {
|
|
417
|
-
useEffect as useEffect2,
|
|
418
|
-
useMemo as useMemo5,
|
|
419
|
-
useRef,
|
|
420
|
-
useSyncExternalStore
|
|
421
|
-
} from "react";
|
|
452
|
+
import { useEffect as useEffect2, useMemo as useMemo5, useRef, useSyncExternalStore } from "react";
|
|
422
453
|
|
|
423
454
|
// src/hooks/chain-iterator/useChainIteratorUpdatingHead.ts
|
|
424
455
|
import { toHex as toHex2 } from "@xylabs/hex";
|
|
425
456
|
import { findMostRecentBlock } from "@xyo-network/chain-protocol";
|
|
426
457
|
import { useEffect, useState as useState6 } from "react";
|
|
427
|
-
var useChainIteratorUpdatingHead = ({
|
|
428
|
-
chainIterator,
|
|
429
|
-
interval = 500,
|
|
430
|
-
maxBlocks,
|
|
431
|
-
chainArchivist
|
|
432
|
-
}) => {
|
|
458
|
+
var useChainIteratorUpdatingHead = /* @__PURE__ */ __name(({ chainIterator, interval = 500, maxBlocks, chainArchivist }) => {
|
|
433
459
|
const [error, setError] = useState6();
|
|
434
460
|
useEffect(() => {
|
|
435
461
|
let pollArchivistTimeout;
|
|
436
|
-
const pollingFunction = async () => {
|
|
462
|
+
const pollingFunction = /* @__PURE__ */ __name(async () => {
|
|
437
463
|
if (chainIterator && chainArchivist) {
|
|
438
464
|
try {
|
|
439
465
|
const currentHead = await chainIterator.head();
|
|
@@ -454,34 +480,46 @@ var useChainIteratorUpdatingHead = ({
|
|
|
454
480
|
}
|
|
455
481
|
}
|
|
456
482
|
pollArchivistTimeout = setTimeout(() => void pollingFunction(), interval);
|
|
457
|
-
};
|
|
483
|
+
}, "pollingFunction");
|
|
458
484
|
void pollingFunction();
|
|
459
485
|
return () => clearInterval(pollArchivistTimeout);
|
|
460
|
-
}, [
|
|
486
|
+
}, [
|
|
487
|
+
interval,
|
|
488
|
+
chainIterator,
|
|
489
|
+
chainArchivist,
|
|
490
|
+
maxBlocks
|
|
491
|
+
]);
|
|
461
492
|
return error;
|
|
462
|
-
};
|
|
493
|
+
}, "useChainIteratorUpdatingHead");
|
|
463
494
|
|
|
464
495
|
// src/hooks/chain-iterator/useChainIteratorStore.ts
|
|
465
496
|
var stub = {};
|
|
466
|
-
var useChainIteratorStore = (chainIteratorParams) => {
|
|
497
|
+
var useChainIteratorStore = /* @__PURE__ */ __name((chainIteratorParams) => {
|
|
467
498
|
const [chainIteratorStore] = usePromise2(async () => {
|
|
468
499
|
return chainIteratorParams ? await ChainIteratorStore.create(chainIteratorParams) : void 0;
|
|
469
|
-
}, [
|
|
500
|
+
}, [
|
|
501
|
+
chainIteratorParams
|
|
502
|
+
]);
|
|
470
503
|
const { chainIterator } = chainIteratorStore || {};
|
|
471
504
|
const chainArchivist = chainIteratorParams?.chainArchivist;
|
|
472
|
-
const error = useChainIteratorUpdatingHead({
|
|
505
|
+
const error = useChainIteratorUpdatingHead({
|
|
506
|
+
chainIterator,
|
|
507
|
+
chainArchivist
|
|
508
|
+
});
|
|
473
509
|
useEffect2(() => {
|
|
474
510
|
return () => {
|
|
475
511
|
if (chainIteratorStore) {
|
|
476
512
|
chainIteratorStore.cleanup();
|
|
477
513
|
}
|
|
478
514
|
};
|
|
479
|
-
}, [
|
|
515
|
+
}, [
|
|
516
|
+
chainIteratorStore
|
|
517
|
+
]);
|
|
480
518
|
const cachedSnapshot = useRef({});
|
|
481
519
|
const { getSnapShot, subscribe } = useMemo5(() => {
|
|
482
520
|
if (chainIteratorStore) {
|
|
483
521
|
return {
|
|
484
|
-
getSnapShot: () => {
|
|
522
|
+
getSnapShot: /* @__PURE__ */ __name(() => {
|
|
485
523
|
const snapshot = chainIteratorStore.getSnapshot();
|
|
486
524
|
const newValues = {
|
|
487
525
|
...snapshot,
|
|
@@ -495,18 +533,20 @@ var useChainIteratorStore = (chainIteratorParams) => {
|
|
|
495
533
|
return newValues;
|
|
496
534
|
}
|
|
497
535
|
return cachedSnapshot.current;
|
|
498
|
-
},
|
|
536
|
+
}, "getSnapShot"),
|
|
499
537
|
subscribe: chainIteratorStore.subscribe.bind(chainIteratorStore)
|
|
500
538
|
};
|
|
501
539
|
}
|
|
502
540
|
return {
|
|
503
|
-
getSnapShot: () => stub,
|
|
504
|
-
subscribe: () => () => {
|
|
505
|
-
}
|
|
541
|
+
getSnapShot: /* @__PURE__ */ __name(() => stub, "getSnapShot"),
|
|
542
|
+
subscribe: /* @__PURE__ */ __name(() => () => {
|
|
543
|
+
}, "subscribe")
|
|
506
544
|
};
|
|
507
|
-
}, [
|
|
545
|
+
}, [
|
|
546
|
+
chainIteratorStore
|
|
547
|
+
]);
|
|
508
548
|
return useSyncExternalStore(subscribe, getSnapShot);
|
|
509
|
-
};
|
|
549
|
+
}, "useChainIteratorStore");
|
|
510
550
|
|
|
511
551
|
// src/hooks/useIterateChain.ts
|
|
512
552
|
import { assertEx as assertEx3 } from "@xylabs/assert";
|
|
@@ -515,18 +555,23 @@ import { ChainBlockNumberIterationService as ChainBlockNumberIterationService2 }
|
|
|
515
555
|
import { PayloadBuilder as PayloadBuilder3 } from "@xyo-network/payload-builder";
|
|
516
556
|
import { isBlockBoundWitness as isBlockBoundWitness2 } from "@xyo-network/xl1-protocol";
|
|
517
557
|
import { hydrateBlock as hydrateBlock2 } from "@xyo-network/xl1-protocol-sdk";
|
|
518
|
-
var getHydratedBlock = async (chainArchivist, head) => {
|
|
558
|
+
var getHydratedBlock = /* @__PURE__ */ __name(async (chainArchivist, head) => {
|
|
519
559
|
const headHash = await PayloadBuilder3.hash(head);
|
|
520
560
|
return await hydrateBlock2(chainArchivist, headHash);
|
|
521
|
-
};
|
|
522
|
-
var iterateChain = async (chainIteratorParams, maxDepth) => {
|
|
561
|
+
}, "getHydratedBlock");
|
|
562
|
+
var iterateChain = /* @__PURE__ */ __name(async (chainIteratorParams, maxDepth) => {
|
|
523
563
|
const { chainArchivist, head } = chainIteratorParams ?? {};
|
|
524
564
|
const headPayload = assertEx3(isBlockBoundWitness2(head) ? head : null, () => "Head is not a Block Bound Witness");
|
|
525
565
|
const headBlockBoundWitness = assertEx3(isBlockBoundWitness2(headPayload) ? headPayload : null, () => "Invalid head block");
|
|
526
|
-
const chainIterator = await ChainBlockNumberIterationService2.create({
|
|
566
|
+
const chainIterator = await ChainBlockNumberIterationService2.create({
|
|
567
|
+
head: headBlockBoundWitness,
|
|
568
|
+
chainArchivist
|
|
569
|
+
});
|
|
527
570
|
const chainHead = await chainIterator.head();
|
|
528
571
|
let block = await getHydratedBlock(chainArchivist, chainHead);
|
|
529
|
-
const blocks = [
|
|
572
|
+
const blocks = [
|
|
573
|
+
block
|
|
574
|
+
];
|
|
530
575
|
let depth = 1;
|
|
531
576
|
while (true) {
|
|
532
577
|
const [, next] = await chainIterator.previous(block[0].block, 2);
|
|
@@ -537,12 +582,15 @@ var iterateChain = async (chainIteratorParams, maxDepth) => {
|
|
|
537
582
|
if (maxDepth !== void 0 && depth >= maxDepth || block?.[0].block === 0) break;
|
|
538
583
|
}
|
|
539
584
|
return blocks;
|
|
540
|
-
};
|
|
541
|
-
var useIterateChain = (chainIteratorParams, maxDepth) => {
|
|
585
|
+
}, "iterateChain");
|
|
586
|
+
var useIterateChain = /* @__PURE__ */ __name((chainIteratorParams, maxDepth) => {
|
|
542
587
|
return usePromise3(async () => {
|
|
543
588
|
return await iterateChain(chainIteratorParams, maxDepth);
|
|
544
|
-
}, [
|
|
545
|
-
|
|
589
|
+
}, [
|
|
590
|
+
chainIteratorParams,
|
|
591
|
+
maxDepth
|
|
592
|
+
]);
|
|
593
|
+
}, "useIterateChain");
|
|
546
594
|
|
|
547
595
|
// src/hooks/useTxsFromBlock.ts
|
|
548
596
|
import { usePromise as usePromise4 } from "@xylabs/react-promise";
|
|
@@ -550,81 +598,92 @@ import { usePromise as usePromise4 } from "@xylabs/react-promise";
|
|
|
550
598
|
// src/helpers/txsFromBlock.ts
|
|
551
599
|
import { HydratedBlockWrapper } from "@xyo-network/chain-wrappers";
|
|
552
600
|
import { PayloadBuilder as PayloadBuilder4 } from "@xyo-network/payload-builder";
|
|
553
|
-
var txsFromBlock = async (block) => {
|
|
601
|
+
var txsFromBlock = /* @__PURE__ */ __name(async (block) => {
|
|
554
602
|
const wrapper = await HydratedBlockWrapper.parse(block);
|
|
555
603
|
const txs = wrapper.transactions;
|
|
556
604
|
const txPayloads = txs.map((tx) => tx.boundWitness);
|
|
557
605
|
return await PayloadBuilder4.hashPairs(txPayloads);
|
|
558
|
-
};
|
|
606
|
+
}, "txsFromBlock");
|
|
559
607
|
|
|
560
608
|
// src/hooks/useTxsFromBlock.ts
|
|
561
|
-
var useTxsFromBlock = (block) => {
|
|
609
|
+
var useTxsFromBlock = /* @__PURE__ */ __name((block) => {
|
|
562
610
|
return usePromise4(async () => {
|
|
563
611
|
if (block) {
|
|
564
612
|
return await txsFromBlock(block);
|
|
565
613
|
}
|
|
566
|
-
}, [
|
|
567
|
-
|
|
614
|
+
}, [
|
|
615
|
+
block
|
|
616
|
+
]);
|
|
617
|
+
}, "useTxsFromBlock");
|
|
568
618
|
|
|
569
619
|
// src/components/transactions/TransactionsQuickTipButton.tsx
|
|
570
|
-
|
|
571
|
-
var TransactionsQuickTipButton = ({ block, ...props }) => {
|
|
620
|
+
var TransactionsQuickTipButton = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
572
621
|
const [transactions, transactionsError] = useTxsFromBlock(block);
|
|
573
622
|
const [copied, setCopied] = useState7(false);
|
|
574
623
|
const [showError, setShowError] = useState7(false);
|
|
575
|
-
useMemo6(() => transactionsError ? setShowError(true) : setShowError(false), [
|
|
576
|
-
|
|
624
|
+
useMemo6(() => transactionsError ? setShowError(true) : setShowError(false), [
|
|
625
|
+
transactionsError
|
|
626
|
+
]);
|
|
627
|
+
const onCopy = /* @__PURE__ */ __name(async (transactionHash) => {
|
|
577
628
|
await navigator.clipboard.writeText(transactionHash);
|
|
578
629
|
setCopied(true);
|
|
579
630
|
setTimeout(() => {
|
|
580
631
|
setCopied(false);
|
|
581
632
|
}, 5e3);
|
|
582
|
-
};
|
|
583
|
-
return /* @__PURE__ */
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
633
|
+
}, "onCopy");
|
|
634
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(QuickTipButton, {
|
|
635
|
+
Icon: Paid,
|
|
636
|
+
disabled: transactions?.length === 0,
|
|
637
|
+
hoverText: `Transaction Count: ${transactions?.length ?? 0}`,
|
|
638
|
+
disableDialog: transactions?.length === 0,
|
|
639
|
+
dialogProps: {
|
|
640
|
+
fullWidth: true,
|
|
641
|
+
maxWidth: "md"
|
|
642
|
+
},
|
|
643
|
+
...props
|
|
644
|
+
}, transactions?.length === 0 ? null : /* @__PURE__ */ React8.createElement(FlexGrowCol2, {
|
|
645
|
+
gap: 1,
|
|
646
|
+
alignItems: "stretch"
|
|
647
|
+
}, transactions?.map(([transaction, hash]) => /* @__PURE__ */ React8.createElement(Fragment, {
|
|
648
|
+
key: hash
|
|
649
|
+
}, /* @__PURE__ */ React8.createElement(FlexGrowRow, {
|
|
650
|
+
gap: 2,
|
|
651
|
+
justifyContent: "start"
|
|
652
|
+
}, /* @__PURE__ */ React8.createElement(ContentCopyIcon, {
|
|
653
|
+
sx: {
|
|
654
|
+
cursor: "pointer"
|
|
655
|
+
},
|
|
656
|
+
onClick: /* @__PURE__ */ __name(() => void onCopy(hash), "onClick")
|
|
657
|
+
}), /* @__PURE__ */ React8.createElement(Typography2, {
|
|
658
|
+
sx: {
|
|
659
|
+
overflow: "hidden",
|
|
660
|
+
textOverflow: "ellipsis",
|
|
661
|
+
whiteSpace: "nowrap"
|
|
662
|
+
}
|
|
663
|
+
}, hash)), /* @__PURE__ */ React8.createElement(FlexRow, null, /* @__PURE__ */ React8.createElement(Collapse, {
|
|
664
|
+
in: copied,
|
|
665
|
+
unmountOnExit: true
|
|
666
|
+
}, /* @__PURE__ */ React8.createElement(Alert2, null, /* @__PURE__ */ React8.createElement(AlertTitle, null, "Previous hash copied to clipboard")))))))), /* @__PURE__ */ React8.createElement(Snackbar, {
|
|
667
|
+
open: showError,
|
|
668
|
+
onClose: /* @__PURE__ */ __name(() => setShowError(false), "onClose")
|
|
669
|
+
}, /* @__PURE__ */ React8.createElement(ErrorRender2, {
|
|
670
|
+
error: transactionsError,
|
|
671
|
+
scope: "TransactionsQuickTipButton"
|
|
672
|
+
})));
|
|
673
|
+
}, "TransactionsQuickTipButton");
|
|
615
674
|
|
|
616
675
|
// src/components/block/hooks/useAnchorElement.ts
|
|
617
676
|
import { useRef as useRef2, useState as useState8 } from "react";
|
|
618
|
-
var useAnchorElement = () => {
|
|
677
|
+
var useAnchorElement = /* @__PURE__ */ __name(() => {
|
|
619
678
|
const [anchorEl, setAnchorEl] = useState8(null);
|
|
620
679
|
const anchorRef = useRef2(null);
|
|
621
680
|
const open = Boolean(anchorEl);
|
|
622
|
-
const handleClick = (event) => {
|
|
681
|
+
const handleClick = /* @__PURE__ */ __name((event) => {
|
|
623
682
|
setAnchorEl(event.currentTarget);
|
|
624
|
-
};
|
|
625
|
-
const handleClose = () => {
|
|
683
|
+
}, "handleClick");
|
|
684
|
+
const handleClose = /* @__PURE__ */ __name(() => {
|
|
626
685
|
setAnchorEl(null);
|
|
627
|
-
};
|
|
686
|
+
}, "handleClose");
|
|
628
687
|
return {
|
|
629
688
|
anchorEl,
|
|
630
689
|
anchorRef,
|
|
@@ -632,102 +691,121 @@ var useAnchorElement = () => {
|
|
|
632
691
|
handleClick,
|
|
633
692
|
handleClose
|
|
634
693
|
};
|
|
635
|
-
};
|
|
694
|
+
}, "useAnchorElement");
|
|
636
695
|
|
|
637
696
|
// src/components/block/hooks/useBlockHeadingEvents.ts
|
|
638
697
|
import { useEvent } from "@xyo-network/react-event";
|
|
639
|
-
var useBlockHeadingEvents = (...args) => {
|
|
698
|
+
var useBlockHeadingEvents = /* @__PURE__ */ __name((...args) => {
|
|
640
699
|
return useEvent(...args);
|
|
641
|
-
};
|
|
700
|
+
}, "useBlockHeadingEvents");
|
|
642
701
|
|
|
643
702
|
// src/components/block/hooks/useBlockProducer.ts
|
|
644
703
|
import { useMemo as useMemo7 } from "react";
|
|
645
|
-
var useBlockProducer = (block) => {
|
|
704
|
+
var useBlockProducer = /* @__PURE__ */ __name((block) => {
|
|
646
705
|
return useMemo7(() => {
|
|
647
706
|
if (block) {
|
|
648
707
|
const producer = block[0].addresses[0];
|
|
649
708
|
return producer;
|
|
650
709
|
}
|
|
651
|
-
}, [
|
|
652
|
-
|
|
710
|
+
}, [
|
|
711
|
+
block
|
|
712
|
+
]);
|
|
713
|
+
}, "useBlockProducer");
|
|
653
714
|
|
|
654
715
|
// src/components/block/hooks/useDynamicBlockComponents.ts
|
|
655
716
|
import { useState as useState9 } from "react";
|
|
656
717
|
|
|
657
718
|
// src/components/block/helpers/blockProducer.ts
|
|
658
|
-
var blockProducer = (block) => {
|
|
719
|
+
var blockProducer = /* @__PURE__ */ __name((block) => {
|
|
659
720
|
return block.addresses[0];
|
|
660
|
-
};
|
|
721
|
+
}, "blockProducer");
|
|
661
722
|
|
|
662
723
|
// src/components/block/helpers/buildBlockChainRenderComponent.tsx
|
|
663
|
-
import
|
|
664
|
-
var buildBlockChainRenderComponent = async (BlockComponent, blockComponentProps) => {
|
|
724
|
+
import React9 from "react";
|
|
725
|
+
var buildBlockChainRenderComponent = /* @__PURE__ */ __name(async (BlockComponent, blockComponentProps) => {
|
|
665
726
|
const { block, ...remainingProps } = blockComponentProps;
|
|
666
727
|
const blockTxs = await txsFromBlock(block);
|
|
667
728
|
const txHashes = blockTxs.map(([_, hash]) => hash);
|
|
668
729
|
const item = {
|
|
669
|
-
child: /* @__PURE__ */
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
...remainingProps
|
|
675
|
-
}
|
|
676
|
-
),
|
|
730
|
+
child: /* @__PURE__ */ React9.createElement(BlockComponent, {
|
|
731
|
+
block,
|
|
732
|
+
transactions: txHashes,
|
|
733
|
+
...remainingProps
|
|
734
|
+
}),
|
|
677
735
|
key: block[0].block.toString(),
|
|
678
736
|
block
|
|
679
737
|
};
|
|
680
738
|
return item;
|
|
681
|
-
};
|
|
739
|
+
}, "buildBlockChainRenderComponent");
|
|
682
740
|
|
|
683
741
|
// src/components/block/helpers/payloadCountsFromBlock.ts
|
|
684
742
|
import { BoundWitnessSchema } from "@xyo-network/boundwitness-model";
|
|
685
743
|
import { isTransactionBoundWitness } from "@xyo-network/xl1-protocol";
|
|
686
|
-
var payloadCountsFromBlock = ([block, payloads]) => {
|
|
744
|
+
var payloadCountsFromBlock = /* @__PURE__ */ __name(([block, payloads]) => {
|
|
687
745
|
const publicPayloads = block.payload_schemas.filter((schema) => schema !== BoundWitnessSchema);
|
|
688
746
|
const transactionHashes = payloads.filter((payload) => isTransactionBoundWitness(payload)).flatMap((payload) => payload.payload_hashes);
|
|
689
747
|
const privateHashes = transactionHashes.filter((hash) => !publicPayloads.includes(hash));
|
|
690
|
-
return [
|
|
691
|
-
|
|
748
|
+
return [
|
|
749
|
+
publicPayloads.length,
|
|
750
|
+
privateHashes.length
|
|
751
|
+
];
|
|
752
|
+
}, "payloadCountsFromBlock");
|
|
692
753
|
|
|
693
754
|
// src/components/block/hooks/useDynamicBlockComponents.ts
|
|
694
|
-
var useDynamicBlockComponents = (BlockComponent, params, maxBlocks) => {
|
|
755
|
+
var useDynamicBlockComponents = /* @__PURE__ */ __name((BlockComponent, params, maxBlocks) => {
|
|
695
756
|
const { chainArchivist } = params ?? {};
|
|
696
757
|
const [blockChainRenderComponents, setBlockChainRenderComponents] = useState9([]);
|
|
697
758
|
const { onBlock } = useChainAnalyzersContext();
|
|
698
|
-
const onAddBlock = async (block) => {
|
|
759
|
+
const onAddBlock = /* @__PURE__ */ __name(async (block) => {
|
|
699
760
|
if (!block || !chainArchivist) return;
|
|
700
|
-
const blockComponentProps = {
|
|
761
|
+
const blockComponentProps = {
|
|
762
|
+
block
|
|
763
|
+
};
|
|
701
764
|
const newBlockComponent = await buildBlockChainRenderComponent(BlockComponent, blockComponentProps);
|
|
702
765
|
if (block?.[0].block !== blockChainRenderComponents[0]?.block?.[0].block) {
|
|
703
766
|
void onBlock?.(block);
|
|
704
767
|
setBlockChainRenderComponents((blockComponents) => {
|
|
705
|
-
const newBlockComponents = [
|
|
768
|
+
const newBlockComponents = [
|
|
769
|
+
newBlockComponent,
|
|
770
|
+
...blockComponents
|
|
771
|
+
];
|
|
706
772
|
if (maxBlocks !== void 0 && newBlockComponents.length > maxBlocks) {
|
|
707
773
|
newBlockComponents.pop();
|
|
708
774
|
}
|
|
709
775
|
return newBlockComponents;
|
|
710
776
|
});
|
|
711
777
|
}
|
|
778
|
+
}, "onAddBlock");
|
|
779
|
+
return {
|
|
780
|
+
blockChainRenderComponents,
|
|
781
|
+
onAddBlock
|
|
712
782
|
};
|
|
713
|
-
|
|
714
|
-
};
|
|
783
|
+
}, "useDynamicBlockComponents");
|
|
715
784
|
|
|
716
785
|
// src/components/block/hooks/usePayloadCountsFromBlock.ts
|
|
717
786
|
import { useMemo as useMemo8 } from "react";
|
|
718
|
-
var usePayloadCountsFromBlock = (block) => {
|
|
787
|
+
var usePayloadCountsFromBlock = /* @__PURE__ */ __name((block) => {
|
|
719
788
|
return useMemo8(() => {
|
|
720
789
|
if (block) {
|
|
721
|
-
return [
|
|
790
|
+
return [
|
|
791
|
+
...payloadCountsFromBlock(block),
|
|
792
|
+
void 0
|
|
793
|
+
];
|
|
722
794
|
}
|
|
723
|
-
return [
|
|
724
|
-
|
|
725
|
-
|
|
795
|
+
return [
|
|
796
|
+
void 0,
|
|
797
|
+
void 0,
|
|
798
|
+
void 0
|
|
799
|
+
];
|
|
800
|
+
}, [
|
|
801
|
+
block
|
|
802
|
+
]);
|
|
803
|
+
}, "usePayloadCountsFromBlock");
|
|
726
804
|
|
|
727
805
|
// src/components/block/hooks/useStaticBlockComponents.ts
|
|
728
806
|
import { usePromise as usePromise5 } from "@xylabs/react-promise";
|
|
729
807
|
import { isDefined as isDefined2 } from "@xylabs/typeof";
|
|
730
|
-
var useStaticBlockComponents = (BlockComponent, params, blocks) => {
|
|
808
|
+
var useStaticBlockComponents = /* @__PURE__ */ __name((BlockComponent, params, blocks) => {
|
|
731
809
|
const { onBlock } = useChainAnalyzersContext();
|
|
732
810
|
const [blockComponents, blockComponentsError] = usePromise5(async () => {
|
|
733
811
|
const resolvedBlockWithStorage = blocks ?? [];
|
|
@@ -736,74 +814,78 @@ var useStaticBlockComponents = (BlockComponent, params, blocks) => {
|
|
|
736
814
|
if (isDefined2(onBlock)) {
|
|
737
815
|
await onBlock(block);
|
|
738
816
|
}
|
|
739
|
-
const blockComponentProps = {
|
|
817
|
+
const blockComponentProps = {
|
|
818
|
+
block,
|
|
819
|
+
defaultExpanded: true
|
|
820
|
+
};
|
|
740
821
|
return await buildBlockChainRenderComponent(BlockComponent, blockComponentProps);
|
|
741
822
|
}));
|
|
742
|
-
}, [
|
|
743
|
-
|
|
744
|
-
|
|
823
|
+
}, [
|
|
824
|
+
blocks,
|
|
825
|
+
params,
|
|
826
|
+
BlockComponent
|
|
827
|
+
]);
|
|
828
|
+
return {
|
|
829
|
+
blockComponents,
|
|
830
|
+
errors: blockComponentsError
|
|
831
|
+
};
|
|
832
|
+
}, "useStaticBlockComponents");
|
|
745
833
|
|
|
746
834
|
// src/components/block/LinkedDivider.tsx
|
|
747
835
|
import { Divider, Stack } from "@mui/material";
|
|
748
|
-
import
|
|
749
|
-
var LinkedDivider = () => {
|
|
750
|
-
return /* @__PURE__ */
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
height: 24,
|
|
758
|
-
justifyContent: "end"
|
|
759
|
-
},
|
|
760
|
-
children: /* @__PURE__ */ jsx10(
|
|
761
|
-
Divider,
|
|
762
|
-
{
|
|
763
|
-
className: "divider",
|
|
764
|
-
orientation: "vertical",
|
|
765
|
-
flexItem: true,
|
|
766
|
-
sx: {
|
|
767
|
-
borderRightWidth: 2,
|
|
768
|
-
height: 24,
|
|
769
|
-
transition: "height 1s"
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
)
|
|
836
|
+
import React10 from "react";
|
|
837
|
+
var LinkedDivider = /* @__PURE__ */ __name(() => {
|
|
838
|
+
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(Stack, {
|
|
839
|
+
className: "divider-spacer",
|
|
840
|
+
justifyContent: "end",
|
|
841
|
+
sx: {
|
|
842
|
+
width: "50%",
|
|
843
|
+
height: 24,
|
|
844
|
+
justifyContent: "end"
|
|
773
845
|
}
|
|
774
|
-
|
|
775
|
-
|
|
846
|
+
}, /* @__PURE__ */ React10.createElement(Divider, {
|
|
847
|
+
className: "divider",
|
|
848
|
+
orientation: "vertical",
|
|
849
|
+
flexItem: true,
|
|
850
|
+
sx: {
|
|
851
|
+
borderRightWidth: 2,
|
|
852
|
+
height: 24,
|
|
853
|
+
transition: "height 1s"
|
|
854
|
+
}
|
|
855
|
+
})));
|
|
856
|
+
}, "LinkedDivider");
|
|
776
857
|
|
|
777
858
|
// src/components/block/menu/Expanded.tsx
|
|
778
859
|
import { MoreVert } from "@mui/icons-material";
|
|
779
860
|
import { IconButton, Menu } from "@mui/material";
|
|
780
861
|
import { BWJsonMenuItem, BWPreviousHashMenuItem } from "@xyo-network/react-boundwitness-plugin";
|
|
781
|
-
import
|
|
782
|
-
var BlockMenuExpanded = ({ block }) => {
|
|
783
|
-
const {
|
|
784
|
-
|
|
785
|
-
anchorRef,
|
|
862
|
+
import React11 from "react";
|
|
863
|
+
var BlockMenuExpanded = /* @__PURE__ */ __name(({ block }) => {
|
|
864
|
+
const { anchorEl, anchorRef, open, handleClick, handleClose } = useAnchorElement();
|
|
865
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(IconButton, {
|
|
866
|
+
ref: anchorRef,
|
|
867
|
+
size: "small",
|
|
868
|
+
onClick: handleClick
|
|
869
|
+
}, /* @__PURE__ */ React11.createElement(MoreVert, {
|
|
870
|
+
fontSize: "inherit"
|
|
871
|
+
})), /* @__PURE__ */ React11.createElement(Menu, {
|
|
786
872
|
open,
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
}
|
|
804
|
-
)
|
|
805
|
-
] });
|
|
806
|
-
};
|
|
873
|
+
anchorEl,
|
|
874
|
+
anchorOrigin: {
|
|
875
|
+
horizontal: "left",
|
|
876
|
+
vertical: "bottom"
|
|
877
|
+
},
|
|
878
|
+
onClose: handleClose
|
|
879
|
+
}, /* @__PURE__ */ React11.createElement(BWPreviousHashMenuItem, {
|
|
880
|
+
boundwitness: block?.[0],
|
|
881
|
+
dense: true,
|
|
882
|
+
onDialogClose: handleClose
|
|
883
|
+
}), /* @__PURE__ */ React11.createElement(BWJsonMenuItem, {
|
|
884
|
+
boundwitness: block?.[0],
|
|
885
|
+
dense: true,
|
|
886
|
+
onDialogClose: handleClose
|
|
887
|
+
})));
|
|
888
|
+
}, "BlockMenuExpanded");
|
|
807
889
|
|
|
808
890
|
// src/components/block/ProducerChip.tsx
|
|
809
891
|
import { Chip as Chip2 } from "@mui/material";
|
|
@@ -811,122 +893,117 @@ import { EthAddressWrapper } from "@xylabs/eth-address";
|
|
|
811
893
|
import { toAddress } from "@xylabs/hex";
|
|
812
894
|
import { isString, isUndefined as isUndefined2 } from "@xylabs/typeof";
|
|
813
895
|
import { BlockiesAvatar } from "@xyo-network/react-chain-blockies";
|
|
814
|
-
import { useMemo as useMemo9 } from "react";
|
|
896
|
+
import React13, { useMemo as useMemo9 } from "react";
|
|
815
897
|
|
|
816
898
|
// src/components/block/ChipSkeleton.tsx
|
|
817
899
|
import { Skeleton } from "@mui/material";
|
|
818
|
-
import
|
|
819
|
-
var ChipSkeleton = (props) => {
|
|
820
|
-
return /* @__PURE__ */
|
|
821
|
-
|
|
900
|
+
import React12 from "react";
|
|
901
|
+
var ChipSkeleton = /* @__PURE__ */ __name((props) => {
|
|
902
|
+
return /* @__PURE__ */ React12.createElement(Skeleton, {
|
|
903
|
+
width: 100,
|
|
904
|
+
...props
|
|
905
|
+
});
|
|
906
|
+
}, "ChipSkeleton");
|
|
822
907
|
|
|
823
908
|
// src/components/block/ProducerChip.tsx
|
|
824
|
-
|
|
825
|
-
var formatProducerAddress = (address) => {
|
|
909
|
+
var formatProducerAddress = /* @__PURE__ */ __name((address) => {
|
|
826
910
|
if (isUndefined2(address) || !isString(address)) return void 0;
|
|
827
911
|
const formattedAddress = toAddress(address);
|
|
828
912
|
return EthAddressWrapper.parse(formattedAddress)?.toShortString(4);
|
|
829
|
-
};
|
|
830
|
-
var BlockProducerChip = ({
|
|
831
|
-
block,
|
|
832
|
-
sx,
|
|
833
|
-
...props
|
|
834
|
-
}) => {
|
|
913
|
+
}, "formatProducerAddress");
|
|
914
|
+
var BlockProducerChip = /* @__PURE__ */ __name(({ block, sx, ...props }) => {
|
|
835
915
|
const blockProducer2 = block?.[0].addresses[0];
|
|
836
916
|
const shortedBlockProducer = blockProducer2 === void 0 ? null : formatProducerAddress(blockProducer2);
|
|
837
|
-
const avatar = useMemo9(() => blockProducer2 === "" ? void 0 : /* @__PURE__ */
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
{
|
|
841
|
-
avatar,
|
|
842
|
-
label: shortedBlockProducer ?? /* @__PURE__ */ jsx13(ChipSkeleton, { width: 115 }),
|
|
843
|
-
title: `Block producer: ${blockProducer2}`,
|
|
844
|
-
sx: {
|
|
845
|
-
fontFamily: "monospace",
|
|
846
|
-
cursor: "pointer",
|
|
847
|
-
...sx
|
|
848
|
-
},
|
|
849
|
-
...props
|
|
917
|
+
const avatar = useMemo9(() => blockProducer2 === "" ? void 0 : /* @__PURE__ */ React13.createElement(BlockiesAvatar, {
|
|
918
|
+
blockiesOptions: {
|
|
919
|
+
seed: blockProducer2
|
|
850
920
|
}
|
|
851
|
-
)
|
|
852
|
-
|
|
921
|
+
}), [
|
|
922
|
+
blockProducer2
|
|
923
|
+
]);
|
|
924
|
+
return /* @__PURE__ */ React13.createElement(Chip2, {
|
|
925
|
+
avatar,
|
|
926
|
+
label: shortedBlockProducer ?? /* @__PURE__ */ React13.createElement(ChipSkeleton, {
|
|
927
|
+
width: 115
|
|
928
|
+
}),
|
|
929
|
+
title: `Block producer: ${blockProducer2}`,
|
|
930
|
+
sx: {
|
|
931
|
+
fontFamily: "monospace",
|
|
932
|
+
cursor: "pointer",
|
|
933
|
+
...sx
|
|
934
|
+
},
|
|
935
|
+
...props
|
|
936
|
+
});
|
|
937
|
+
}, "BlockProducerChip");
|
|
853
938
|
|
|
854
939
|
// src/components/block/BlockHeadingFlexbox.tsx
|
|
855
|
-
|
|
856
|
-
var BlockHeadingFlexbox = ({
|
|
857
|
-
block,
|
|
858
|
-
defaultExpanded,
|
|
859
|
-
transactions
|
|
860
|
-
}) => {
|
|
940
|
+
var BlockHeadingFlexbox = /* @__PURE__ */ __name(({ block, defaultExpanded, transactions }) => {
|
|
861
941
|
const hash = usePayloadHash(block?.[0]);
|
|
862
942
|
const [blockHeadingRef, blockHeadingListener] = useBlockHeadingEvents();
|
|
863
943
|
const { pollingState } = useChainPollingContext();
|
|
864
944
|
const expanded = pollingState === "paused" || defaultExpanded;
|
|
865
|
-
const handleTransactionCountClick = (event, transactions2) => {
|
|
945
|
+
const handleTransactionCountClick = /* @__PURE__ */ __name((event, transactions2) => {
|
|
866
946
|
event.stopPropagation();
|
|
867
947
|
blockHeadingListener("transaction-count", "click", JSON.stringify(transactions2));
|
|
868
|
-
};
|
|
869
|
-
return /* @__PURE__ */
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
{
|
|
882
|
-
onClick: (e) => handleTransactionCountClick(e, transactions ?? []),
|
|
883
|
-
transactions
|
|
884
|
-
}
|
|
885
|
-
),
|
|
886
|
-
/* @__PURE__ */ jsx14(BWVerification, { iconColors: true, boundwitness: block?.[0] }),
|
|
887
|
-
/* @__PURE__ */ jsx14(
|
|
888
|
-
"span",
|
|
889
|
-
{
|
|
890
|
-
style: {
|
|
891
|
-
// maxWidth is required for css animation to work and 28px is the width of the icon button
|
|
892
|
-
display: "flex",
|
|
893
|
-
transition: "max-width .5s",
|
|
894
|
-
maxWidth: expanded ? "28px" : 0
|
|
895
|
-
},
|
|
896
|
-
children: /* @__PURE__ */ jsx14(BlockMenuExpanded, { block })
|
|
897
|
-
}
|
|
898
|
-
)
|
|
899
|
-
] }),
|
|
900
|
-
identiconProps: { p: 0.75, size: 18 }
|
|
948
|
+
}, "handleTransactionCountClick");
|
|
949
|
+
return /* @__PURE__ */ React14.createElement(FlexCol2, {
|
|
950
|
+
className: "block-heading-flexbox",
|
|
951
|
+
alignItems: "stretch",
|
|
952
|
+
ref: blockHeadingRef,
|
|
953
|
+
onClick: /* @__PURE__ */ __name(() => blockHeadingListener("block-hash", "click", hash), "onClick")
|
|
954
|
+
}, /* @__PURE__ */ React14.createElement(LinkedDivider, null), /* @__PURE__ */ React14.createElement(HashHeadingPaper, {
|
|
955
|
+
hash,
|
|
956
|
+
heading: block?.[0].block === void 0 ? "" : block?.[0].block.toString(),
|
|
957
|
+
paperProps: {
|
|
958
|
+
sx: {
|
|
959
|
+
p: 1,
|
|
960
|
+
width: "100%"
|
|
901
961
|
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
962
|
+
},
|
|
963
|
+
AdornmentEnd: /* @__PURE__ */ React14.createElement(FlexRow2, {
|
|
964
|
+
gap: 1
|
|
965
|
+
}, /* @__PURE__ */ React14.createElement(BlockProducerChip, {
|
|
966
|
+
block
|
|
967
|
+
}), /* @__PURE__ */ React14.createElement(TransactionCountChip, {
|
|
968
|
+
onClick: /* @__PURE__ */ __name((e) => handleTransactionCountClick(e, transactions ?? []), "onClick"),
|
|
969
|
+
transactions
|
|
970
|
+
}), /* @__PURE__ */ React14.createElement(BWVerification, {
|
|
971
|
+
iconColors: true,
|
|
972
|
+
boundwitness: block?.[0]
|
|
973
|
+
}), /* @__PURE__ */ React14.createElement("span", {
|
|
974
|
+
style: {
|
|
975
|
+
// maxWidth is required for css animation to work and 28px is the width of the icon button
|
|
976
|
+
display: "flex",
|
|
977
|
+
transition: "max-width .5s",
|
|
978
|
+
maxWidth: expanded ? "28px" : 0
|
|
979
|
+
}
|
|
980
|
+
}, /* @__PURE__ */ React14.createElement(BlockMenuExpanded, {
|
|
981
|
+
block
|
|
982
|
+
}))),
|
|
983
|
+
identiconProps: {
|
|
984
|
+
p: 0.75,
|
|
985
|
+
size: 18
|
|
986
|
+
}
|
|
987
|
+
}));
|
|
988
|
+
}, "BlockHeadingFlexbox");
|
|
905
989
|
|
|
906
990
|
// src/components/block/table/cell/BlockNumber.tsx
|
|
907
|
-
import {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
Typography as Typography3
|
|
911
|
-
} from "@mui/material";
|
|
912
|
-
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
913
|
-
var BlockNumberTableCell = ({
|
|
914
|
-
block,
|
|
915
|
-
linked,
|
|
916
|
-
...props
|
|
917
|
-
}) => {
|
|
991
|
+
import { TableCell, Tooltip, Typography as Typography3 } from "@mui/material";
|
|
992
|
+
import React15 from "react";
|
|
993
|
+
var BlockNumberTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
918
994
|
const blockNumber = block?.[0].block;
|
|
919
|
-
return /* @__PURE__ */
|
|
920
|
-
}
|
|
995
|
+
return /* @__PURE__ */ React15.createElement(TableCell, props, /* @__PURE__ */ React15.createElement(Tooltip, {
|
|
996
|
+
title: `Block Number: ${blockNumber}`
|
|
997
|
+
}, /* @__PURE__ */ React15.createElement(Typography3, {
|
|
998
|
+
component: "span",
|
|
999
|
+
variant: "body1"
|
|
1000
|
+
}, blockNumber)));
|
|
1001
|
+
}, "BlockNumberTableCell");
|
|
921
1002
|
|
|
922
1003
|
// src/components/block/table/cell/Epoch.tsx
|
|
923
|
-
import {
|
|
924
|
-
Skeleton as Skeleton2,
|
|
925
|
-
TableCell as TableCell2,
|
|
926
|
-
Tooltip as Tooltip2,
|
|
927
|
-
Typography as Typography4
|
|
928
|
-
} from "@mui/material";
|
|
1004
|
+
import { Skeleton as Skeleton2, TableCell as TableCell2, Tooltip as Tooltip2, Typography as Typography4 } from "@mui/material";
|
|
929
1005
|
import { isDefined as isDefined3 } from "@xylabs/typeof";
|
|
1006
|
+
import React16 from "react";
|
|
930
1007
|
|
|
931
1008
|
// src/components/block/table/cell/lib/timeFunctions.ts
|
|
932
1009
|
var dateFormat = Intl.DateTimeFormat(globalThis.navigator.language ?? "en-US", {
|
|
@@ -937,7 +1014,7 @@ var dateFormat = Intl.DateTimeFormat(globalThis.navigator.language ?? "en-US", {
|
|
|
937
1014
|
minute: "2-digit",
|
|
938
1015
|
second: "2-digit"
|
|
939
1016
|
});
|
|
940
|
-
var timeAgo = (epoch, locale = navigator.language ?? "en-US") => {
|
|
1017
|
+
var timeAgo = /* @__PURE__ */ __name((epoch, locale = navigator.language ?? "en-US") => {
|
|
941
1018
|
const now = Date.now();
|
|
942
1019
|
const diffInSeconds = Math.floor((now - epoch) / 1e3);
|
|
943
1020
|
const units = [
|
|
@@ -980,54 +1057,46 @@ var timeAgo = (epoch, locale = navigator.language ?? "en-US") => {
|
|
|
980
1057
|
for (const unit of units) {
|
|
981
1058
|
if (Math.abs(diffInSeconds) < unit.max) {
|
|
982
1059
|
const value = Math.round(diffInSeconds / unit.value);
|
|
983
|
-
return new Intl.RelativeTimeFormat(locale, {
|
|
1060
|
+
return new Intl.RelativeTimeFormat(locale, {
|
|
1061
|
+
numeric: "auto"
|
|
1062
|
+
}).format(-value, unit.name);
|
|
984
1063
|
}
|
|
985
1064
|
}
|
|
986
|
-
};
|
|
1065
|
+
}, "timeAgo");
|
|
987
1066
|
|
|
988
1067
|
// src/components/block/table/cell/Epoch.tsx
|
|
989
|
-
|
|
990
|
-
var BlockEpochTableCell = ({
|
|
991
|
-
block,
|
|
992
|
-
linked,
|
|
993
|
-
...props
|
|
994
|
-
}) => {
|
|
1068
|
+
var BlockEpochTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
995
1069
|
const epoch = block?.[0]?.$epoch;
|
|
996
1070
|
const dateTime = dateFormat.format(epoch);
|
|
997
1071
|
const age = isDefined3(epoch) ? timeAgo(epoch) : void 0;
|
|
998
|
-
return /* @__PURE__ */
|
|
999
|
-
}
|
|
1072
|
+
return /* @__PURE__ */ React16.createElement(TableCell2, props, /* @__PURE__ */ React16.createElement(Tooltip2, {
|
|
1073
|
+
title: `Block Epoch: ${dateTime}`
|
|
1074
|
+
}, /* @__PURE__ */ React16.createElement(Typography4, {
|
|
1075
|
+
component: "span",
|
|
1076
|
+
variant: "body1"
|
|
1077
|
+
}, age ?? /* @__PURE__ */ React16.createElement(Skeleton2, {
|
|
1078
|
+
width: 115
|
|
1079
|
+
}))));
|
|
1080
|
+
}, "BlockEpochTableCell");
|
|
1000
1081
|
|
|
1001
1082
|
// src/components/block/table/cell/Hash.tsx
|
|
1002
|
-
import {
|
|
1003
|
-
Link,
|
|
1004
|
-
TableCell as TableCell3,
|
|
1005
|
-
Tooltip as Tooltip3
|
|
1006
|
-
} from "@mui/material";
|
|
1083
|
+
import { Link, TableCell as TableCell3, Tooltip as Tooltip3 } from "@mui/material";
|
|
1007
1084
|
import { isHash as isHash2 } from "@xylabs/hex";
|
|
1008
1085
|
import { usePayloadRootHash } from "@xyo-network/react-shared";
|
|
1009
|
-
import { useState as useState10 } from "react";
|
|
1086
|
+
import React18, { useState as useState10 } from "react";
|
|
1010
1087
|
|
|
1011
1088
|
// src/components/FeatureNotAvailable.tsx
|
|
1012
|
-
import {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
DialogTitle
|
|
1018
|
-
} from "@mui/material";
|
|
1019
|
-
import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1020
|
-
var FeatureNotAvailable = ({ featureName = "Feature", ...props }) => /* @__PURE__ */ jsxs7(Dialog, { ...props, children: [
|
|
1021
|
-
/* @__PURE__ */ jsx17(DialogTitle, { children: `${featureName} Not Available` }),
|
|
1022
|
-
/* @__PURE__ */ jsx17(DialogContent, { children: "This feature is not currently available. Either you do not have access to it or it is currently undergoing maintenance." }),
|
|
1023
|
-
/* @__PURE__ */ jsx17(DialogActions, { children: /* @__PURE__ */ jsx17(Button2, { onClick: (e) => props.onClose?.(e, "backdropClick"), children: "Close" }) })
|
|
1024
|
-
] });
|
|
1089
|
+
import { Button as Button2, Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
|
1090
|
+
import React17 from "react";
|
|
1091
|
+
var FeatureNotAvailable = /* @__PURE__ */ __name(({ featureName = "Feature", ...props }) => /* @__PURE__ */ React17.createElement(Dialog, props, /* @__PURE__ */ React17.createElement(DialogTitle, null, `${featureName} Not Available`), /* @__PURE__ */ React17.createElement(DialogContent, null, "This feature is not currently available. Either you do not have access to it or it is currently undergoing maintenance."), /* @__PURE__ */ React17.createElement(DialogActions, null, /* @__PURE__ */ React17.createElement(Button2, {
|
|
1092
|
+
onClick: /* @__PURE__ */ __name((e) => props.onClose?.(e, "backdropClick"), "onClick")
|
|
1093
|
+
}, "Close"))), "FeatureNotAvailable");
|
|
1025
1094
|
|
|
1026
1095
|
// src/components/block/table/cell/hooks/useLinkedBlockItem.tsx
|
|
1027
1096
|
import { useEvent as useEvent2 } from "@xyo-network/react-event";
|
|
1028
|
-
var useLinkedBlockItem = (noun, data) => {
|
|
1097
|
+
var useLinkedBlockItem = /* @__PURE__ */ __name((noun, data) => {
|
|
1029
1098
|
const [ref, dispatch] = useEvent2();
|
|
1030
|
-
const handleClick = (event) => {
|
|
1099
|
+
const handleClick = /* @__PURE__ */ __name((event) => {
|
|
1031
1100
|
event.preventDefault();
|
|
1032
1101
|
event.stopPropagation();
|
|
1033
1102
|
if (noun === void 0) {
|
|
@@ -1039,91 +1108,79 @@ var useLinkedBlockItem = (noun, data) => {
|
|
|
1039
1108
|
if (!isTextSelected) {
|
|
1040
1109
|
dispatch(noun, "click", data);
|
|
1041
1110
|
}
|
|
1042
|
-
};
|
|
1043
|
-
return [
|
|
1044
|
-
|
|
1111
|
+
}, "handleClick");
|
|
1112
|
+
return [
|
|
1113
|
+
ref,
|
|
1114
|
+
handleClick
|
|
1115
|
+
];
|
|
1116
|
+
}, "useLinkedBlockItem");
|
|
1045
1117
|
|
|
1046
1118
|
// src/components/block/table/cell/Hash.tsx
|
|
1047
|
-
|
|
1048
|
-
var BlockHashTableCell = ({
|
|
1049
|
-
block,
|
|
1050
|
-
notAvailableDialog,
|
|
1051
|
-
linked,
|
|
1052
|
-
...props
|
|
1053
|
-
}) => {
|
|
1119
|
+
var BlockHashTableCell = /* @__PURE__ */ __name(({ block, notAvailableDialog, linked, ...props }) => {
|
|
1054
1120
|
const hash = usePayloadRootHash(block?.[0]);
|
|
1055
1121
|
const [ref, handleClick] = useLinkedBlockItem("block-hash", hash);
|
|
1056
1122
|
const [notAvailable, setNotAvailable] = useState10(false);
|
|
1057
1123
|
const shortenedHash = isHash2(hash) ? `${hash.slice(0, 4)}...${hash.slice(-5, -1)}` : void 0;
|
|
1058
|
-
return /* @__PURE__ */
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1124
|
+
return /* @__PURE__ */ React18.createElement(TableCell3, {
|
|
1125
|
+
ref,
|
|
1126
|
+
...props
|
|
1127
|
+
}, /* @__PURE__ */ React18.createElement(Tooltip3, {
|
|
1128
|
+
title: `Block Hash: ${hash}`
|
|
1129
|
+
}, linked ? /* @__PURE__ */ React18.createElement(Link, {
|
|
1130
|
+
sx: {
|
|
1131
|
+
cursor: "pointer"
|
|
1132
|
+
},
|
|
1133
|
+
onClick: linked ? handleClick : () => setNotAvailable(true)
|
|
1134
|
+
}, shortenedHash ?? /* @__PURE__ */ React18.createElement(ChipSkeleton, null)) : /* @__PURE__ */ React18.createElement("span", null, shortenedHash ?? /* @__PURE__ */ React18.createElement(ChipSkeleton, null))), notAvailableDialog && notAvailable ? /* @__PURE__ */ React18.createElement(FeatureNotAvailable, {
|
|
1135
|
+
featureName: "Block Details",
|
|
1136
|
+
open: notAvailable,
|
|
1137
|
+
onClick: /* @__PURE__ */ __name(() => setNotAvailable(false), "onClick")
|
|
1138
|
+
}) : null);
|
|
1139
|
+
}, "BlockHashTableCell");
|
|
1070
1140
|
|
|
1071
1141
|
// src/components/block/table/cell/JsonView.tsx
|
|
1072
1142
|
import { DataObject } from "@mui/icons-material";
|
|
1073
|
-
import {
|
|
1074
|
-
Button as Button3,
|
|
1075
|
-
Dialog as Dialog2,
|
|
1076
|
-
DialogActions as DialogActions2,
|
|
1077
|
-
DialogContent as DialogContent2,
|
|
1078
|
-
DialogTitle as DialogTitle2,
|
|
1079
|
-
IconButton as IconButton2,
|
|
1080
|
-
TableCell as TableCell4
|
|
1081
|
-
} from "@mui/material";
|
|
1143
|
+
import { Button as Button3, Dialog as Dialog2, DialogActions as DialogActions2, DialogContent as DialogContent2, DialogTitle as DialogTitle2, IconButton as IconButton2, TableCell as TableCell4 } from "@mui/material";
|
|
1082
1144
|
import { ellipsize } from "@xylabs/eth-address";
|
|
1083
1145
|
import { isHash as isHash3 } from "@xylabs/hex";
|
|
1084
1146
|
import { FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
|
|
1085
1147
|
import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
|
|
1086
1148
|
import { usePayloadRootHash as usePayloadRootHash2 } from "@xyo-network/react-shared";
|
|
1087
|
-
import { useState as useState11 } from "react";
|
|
1088
|
-
|
|
1089
|
-
var BlockJsonViewTableCell = ({ block, ...props }) => {
|
|
1149
|
+
import React19, { useState as useState11 } from "react";
|
|
1150
|
+
var BlockJsonViewTableCell = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
1090
1151
|
const [open, setOpen] = useState11(false);
|
|
1091
|
-
const onClose = () => setOpen(false);
|
|
1152
|
+
const onClose = /* @__PURE__ */ __name(() => setOpen(false), "onClose");
|
|
1092
1153
|
const hash = usePayloadRootHash2(block?.[0]);
|
|
1093
1154
|
const title = isHash3(hash) ? `JSON for ${ellipsize(hash, 5)}` : "JSON";
|
|
1094
|
-
return /* @__PURE__ */
|
|
1095
|
-
/* @__PURE__ */
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
}
|
|
1155
|
+
return /* @__PURE__ */ React19.createElement(TableCell4, props, /* @__PURE__ */ React19.createElement(FlexRow3, {
|
|
1156
|
+
onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick"),
|
|
1157
|
+
sx: {
|
|
1158
|
+
width: "100%"
|
|
1159
|
+
}
|
|
1160
|
+
}, /* @__PURE__ */ React19.createElement(IconButton2, {
|
|
1161
|
+
onClick: /* @__PURE__ */ __name(() => setOpen(true), "onClick")
|
|
1162
|
+
}, /* @__PURE__ */ React19.createElement(DataObject, null)), /* @__PURE__ */ React19.createElement(Dialog2, {
|
|
1163
|
+
open,
|
|
1164
|
+
onClose
|
|
1165
|
+
}, /* @__PURE__ */ React19.createElement(DialogTitle2, null, title), /* @__PURE__ */ React19.createElement(DialogContent2, null, /* @__PURE__ */ React19.createElement(JsonViewerEx, {
|
|
1166
|
+
value: block
|
|
1167
|
+
})), /* @__PURE__ */ React19.createElement(DialogActions2, {
|
|
1168
|
+
sx: {
|
|
1169
|
+
display: "flex",
|
|
1170
|
+
flexDirection: "row",
|
|
1171
|
+
justifyContent: "end"
|
|
1172
|
+
}
|
|
1173
|
+
}, /* @__PURE__ */ React19.createElement(Button3, {
|
|
1174
|
+
variant: "contained",
|
|
1175
|
+
onClick: onClose
|
|
1176
|
+
}, "Close")))));
|
|
1177
|
+
}, "BlockJsonViewTableCell");
|
|
1113
1178
|
|
|
1114
1179
|
// src/components/block/table/cell/PayloadCounts.tsx
|
|
1115
1180
|
import { Error as Error2 } from "@mui/icons-material";
|
|
1116
|
-
import {
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
Tooltip as Tooltip4
|
|
1120
|
-
} from "@mui/material";
|
|
1121
|
-
import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1122
|
-
var BlockPayloadCountsTableCell = ({
|
|
1123
|
-
block,
|
|
1124
|
-
linked,
|
|
1125
|
-
...props
|
|
1126
|
-
}) => {
|
|
1181
|
+
import { Link as Link2, TableCell as TableCell5, Tooltip as Tooltip4 } from "@mui/material";
|
|
1182
|
+
import React20 from "react";
|
|
1183
|
+
var BlockPayloadCountsTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
1127
1184
|
const [publicPayloads, privatePayloads, error] = usePayloadCountsFromBlock(block);
|
|
1128
1185
|
const data = block && privatePayloads !== void 0 && publicPayloads !== void 0 ? {
|
|
1129
1186
|
publicPayloads,
|
|
@@ -1132,306 +1189,340 @@ var BlockPayloadCountsTableCell = ({
|
|
|
1132
1189
|
} : void 0;
|
|
1133
1190
|
const payloadCount = (publicPayloads ?? 0) + (privatePayloads ?? 0);
|
|
1134
1191
|
const [ref, handleClick] = useLinkedBlockItem("payload-counts", data);
|
|
1135
|
-
return /* @__PURE__ */
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1192
|
+
return /* @__PURE__ */ React20.createElement(TableCell5, {
|
|
1193
|
+
ref,
|
|
1194
|
+
...props
|
|
1195
|
+
}, /* @__PURE__ */ React20.createElement("span", null, error ? /* @__PURE__ */ React20.createElement(Tooltip4, {
|
|
1196
|
+
title: error.message
|
|
1197
|
+
}, /* @__PURE__ */ React20.createElement(Error2, {
|
|
1198
|
+
color: "error"
|
|
1199
|
+
})) : null, linked ? /* @__PURE__ */ React20.createElement(Tooltip4, {
|
|
1200
|
+
title: `Public Payloads: ${publicPayloads ?? "--"} Private Payloads: ${privatePayloads ?? "--"}`
|
|
1201
|
+
}, /* @__PURE__ */ React20.createElement(Link2, {
|
|
1202
|
+
onClick: handleClick,
|
|
1203
|
+
sx: {
|
|
1204
|
+
cursor: "pointer"
|
|
1205
|
+
}
|
|
1206
|
+
}, payloadCount)) : /* @__PURE__ */ React20.createElement(Tooltip4, {
|
|
1207
|
+
title: `Public Payloads: ${publicPayloads ?? "--"} Private Payloads: ${privatePayloads ?? "--"}`
|
|
1208
|
+
}, /* @__PURE__ */ React20.createElement("span", null, payloadCount))));
|
|
1209
|
+
}, "BlockPayloadCountsTableCell");
|
|
1147
1210
|
|
|
1148
1211
|
// src/components/block/table/cell/Producer.tsx
|
|
1149
1212
|
import { TableCell as TableCell6, Tooltip as Tooltip5 } from "@mui/material";
|
|
1150
|
-
import
|
|
1151
|
-
|
|
1152
|
-
var BlockProducerTableCell = ({
|
|
1153
|
-
block,
|
|
1154
|
-
linked,
|
|
1155
|
-
notAvailableDialog,
|
|
1156
|
-
producerChipProps,
|
|
1157
|
-
...props
|
|
1158
|
-
}) => {
|
|
1213
|
+
import React21 from "react";
|
|
1214
|
+
var BlockProducerTableCell = /* @__PURE__ */ __name(({ block, linked, notAvailableDialog, producerChipProps, ...props }) => {
|
|
1159
1215
|
const [ref, handleClick] = useLinkedBlockItem("block-producer", JSON.stringify(block));
|
|
1160
1216
|
const producer = useBlockProducer(block);
|
|
1161
|
-
const [notAvailable, setNotAvailable] =
|
|
1162
|
-
return /* @__PURE__ */
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
}
|
|
1217
|
+
const [notAvailable, setNotAvailable] = React21.useState(false);
|
|
1218
|
+
return /* @__PURE__ */ React21.createElement(TableCell6, {
|
|
1219
|
+
ref,
|
|
1220
|
+
...props
|
|
1221
|
+
}, /* @__PURE__ */ React21.createElement(Tooltip5, {
|
|
1222
|
+
title: `Block Producer: ${producer}`
|
|
1223
|
+
}, /* @__PURE__ */ React21.createElement(BlockProducerChip, {
|
|
1224
|
+
sx: {
|
|
1225
|
+
cursor: "pointer"
|
|
1226
|
+
},
|
|
1227
|
+
onClick: linked ? handleClick : () => setNotAvailable(true),
|
|
1228
|
+
block,
|
|
1229
|
+
...producerChipProps
|
|
1230
|
+
})), notAvailableDialog && notAvailable ? /* @__PURE__ */ React21.createElement(FeatureNotAvailable, {
|
|
1231
|
+
featureName: "Producer Details",
|
|
1232
|
+
open: notAvailable,
|
|
1233
|
+
onClick: /* @__PURE__ */ __name(() => setNotAvailable(false), "onClick")
|
|
1234
|
+
}) : null);
|
|
1235
|
+
}, "BlockProducerTableCell");
|
|
1167
1236
|
|
|
1168
1237
|
// src/components/block/table/cell/TransactionCount.tsx
|
|
1169
1238
|
import { Error as Error3 } from "@mui/icons-material";
|
|
1170
|
-
import {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
Tooltip as Tooltip6
|
|
1174
|
-
} from "@mui/material";
|
|
1175
|
-
import { useMemo as useMemo10 } from "react";
|
|
1176
|
-
import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1177
|
-
var BlockTransactionCountTableCell = ({
|
|
1178
|
-
block,
|
|
1179
|
-
linked,
|
|
1180
|
-
...props
|
|
1181
|
-
}) => {
|
|
1239
|
+
import { Link as Link3, TableCell as TableCell7, Tooltip as Tooltip6 } from "@mui/material";
|
|
1240
|
+
import React22, { useMemo as useMemo10 } from "react";
|
|
1241
|
+
var BlockTransactionCountTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
1182
1242
|
const [transactions, error] = useTxsFromBlock(block);
|
|
1183
|
-
const txHashes = useMemo10(() => transactions?.map(([, hash]) => hash), [
|
|
1243
|
+
const txHashes = useMemo10(() => transactions?.map(([, hash]) => hash), [
|
|
1244
|
+
transactions
|
|
1245
|
+
]);
|
|
1184
1246
|
const data = block && transactions !== void 0 ? {
|
|
1185
1247
|
transactions: transactions.length,
|
|
1186
1248
|
block: block[0]._hash
|
|
1187
1249
|
} : void 0;
|
|
1188
1250
|
const [ref, handleClick] = useLinkedBlockItem("transaction-count", data);
|
|
1189
|
-
return /* @__PURE__ */
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1251
|
+
return /* @__PURE__ */ React22.createElement(TableCell7, {
|
|
1252
|
+
ref,
|
|
1253
|
+
...props
|
|
1254
|
+
}, /* @__PURE__ */ React22.createElement("span", null, error ? /* @__PURE__ */ React22.createElement(Tooltip6, {
|
|
1255
|
+
title: error.message
|
|
1256
|
+
}, /* @__PURE__ */ React22.createElement(Error3, {
|
|
1257
|
+
color: "error"
|
|
1258
|
+
})) : null, linked ? /* @__PURE__ */ React22.createElement(Link3, {
|
|
1259
|
+
onClick: handleClick,
|
|
1260
|
+
sx: {
|
|
1261
|
+
cursor: "pointer"
|
|
1262
|
+
}
|
|
1263
|
+
}, txHashes?.length) : txHashes?.length));
|
|
1264
|
+
}, "BlockTransactionCountTableCell");
|
|
1194
1265
|
|
|
1195
1266
|
// src/components/block/table/cell/Verification.tsx
|
|
1196
1267
|
import { CheckCircleOutlineRounded } from "@mui/icons-material";
|
|
1197
1268
|
import { TableCell as TableCell8 } from "@mui/material";
|
|
1198
1269
|
import { FlexRow as FlexRow4 } from "@xylabs/react-flexbox";
|
|
1199
1270
|
import { BWVerification as BWVerification2 } from "@xyo-network/react-boundwitness-plugin";
|
|
1200
|
-
import
|
|
1201
|
-
var BlockVerificationTableCell = ({
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1271
|
+
import React23 from "react";
|
|
1272
|
+
var BlockVerificationTableCell = /* @__PURE__ */ __name(({ block, linked, deepValidation, ...props }) => {
|
|
1273
|
+
return /* @__PURE__ */ React23.createElement(TableCell8, props, /* @__PURE__ */ React23.createElement(FlexRow4, {
|
|
1274
|
+
onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick"),
|
|
1275
|
+
sx: {
|
|
1276
|
+
width: "100%"
|
|
1277
|
+
}
|
|
1278
|
+
}, deepValidation ? /* @__PURE__ */ React23.createElement(BWVerification2, {
|
|
1279
|
+
iconColors: true,
|
|
1280
|
+
boundwitness: block?.[0]
|
|
1281
|
+
}) : /* @__PURE__ */ React23.createElement(CheckCircleOutlineRounded, {
|
|
1282
|
+
color: "success"
|
|
1283
|
+
})));
|
|
1284
|
+
}, "BlockVerificationTableCell");
|
|
1209
1285
|
|
|
1210
1286
|
// src/components/block/table/Ex.tsx
|
|
1211
1287
|
import { TableBody } from "@mui/material";
|
|
1212
1288
|
import { TableEx } from "@xyo-network/react-table";
|
|
1289
|
+
import React25 from "react";
|
|
1213
1290
|
|
|
1214
1291
|
// src/components/block/table/head/TableHead.tsx
|
|
1215
1292
|
import { InfoOutline } from "@mui/icons-material";
|
|
1216
|
-
import {
|
|
1217
|
-
TableCell as TableCell9,
|
|
1218
|
-
TableHead,
|
|
1219
|
-
TableRow,
|
|
1220
|
-
Tooltip as Tooltip7,
|
|
1221
|
-
Typography as Typography5
|
|
1222
|
-
} from "@mui/material";
|
|
1293
|
+
import { TableCell as TableCell9, TableHead, TableRow, Tooltip as Tooltip7, Typography as Typography5 } from "@mui/material";
|
|
1223
1294
|
import { FlexRow as FlexRow5 } from "@xylabs/react-flexbox";
|
|
1224
|
-
import
|
|
1225
|
-
var ToolTipTableCell = ({
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1295
|
+
import React24 from "react";
|
|
1296
|
+
var ToolTipTableCell = /* @__PURE__ */ __name(({ children, align, title, ...props }) => {
|
|
1297
|
+
return /* @__PURE__ */ React24.createElement(TableCell9, {
|
|
1298
|
+
title,
|
|
1299
|
+
...props
|
|
1300
|
+
}, /* @__PURE__ */ React24.createElement(FlexRow5, {
|
|
1301
|
+
justifyContent: align
|
|
1302
|
+
}, /* @__PURE__ */ React24.createElement(Typography5, {
|
|
1303
|
+
variant: "body2"
|
|
1304
|
+
}, children), "\xA0", /* @__PURE__ */ React24.createElement(Tooltip7, {
|
|
1305
|
+
title
|
|
1306
|
+
}, /* @__PURE__ */ React24.createElement(InfoOutline, {
|
|
1307
|
+
fontSize: "small"
|
|
1308
|
+
}))));
|
|
1309
|
+
}, "ToolTipTableCell");
|
|
1310
|
+
var BlockchainTableHead = /* @__PURE__ */ __name(() => {
|
|
1311
|
+
return /* @__PURE__ */ React24.createElement(TableHead, null, /* @__PURE__ */ React24.createElement(TableRow, null, /* @__PURE__ */ React24.createElement(ToolTipTableCell, {
|
|
1312
|
+
align: "left",
|
|
1313
|
+
title: "The block number that is included in the block"
|
|
1314
|
+
}, "Block"), /* @__PURE__ */ React24.createElement(ToolTipTableCell, {
|
|
1315
|
+
title: "The hash of the block",
|
|
1316
|
+
sx: {
|
|
1317
|
+
width: "20%"
|
|
1318
|
+
}
|
|
1319
|
+
}, "Hash"), /* @__PURE__ */ React24.createElement(ToolTipTableCell, {
|
|
1320
|
+
title: "The epoch of the block",
|
|
1321
|
+
sx: {
|
|
1322
|
+
width: "20%"
|
|
1323
|
+
}
|
|
1324
|
+
}, "Epoch"), /* @__PURE__ */ React24.createElement(ToolTipTableCell, {
|
|
1325
|
+
align: "left",
|
|
1326
|
+
title: "The address of the block producer that produced the block",
|
|
1327
|
+
sx: {
|
|
1328
|
+
width: "20%"
|
|
1329
|
+
}
|
|
1330
|
+
}, "Block Producer"), /* @__PURE__ */ React24.createElement(ToolTipTableCell, {
|
|
1331
|
+
align: "left",
|
|
1332
|
+
title: "Count of transactions that are included in the block"
|
|
1333
|
+
}, "Transactions"), /* @__PURE__ */ React24.createElement(ToolTipTableCell, {
|
|
1334
|
+
align: "left",
|
|
1335
|
+
title: "Count of public and private payload counts for the block"
|
|
1336
|
+
}, "Payloads"), /* @__PURE__ */ React24.createElement(ToolTipTableCell, {
|
|
1337
|
+
align: "center",
|
|
1338
|
+
title: "The result of the local validation check for the block"
|
|
1339
|
+
}, "Valid"), /* @__PURE__ */ React24.createElement(ToolTipTableCell, {
|
|
1340
|
+
align: "center",
|
|
1341
|
+
title: "Link to display the raw JSON of the block"
|
|
1342
|
+
}, "JSON")));
|
|
1343
|
+
}, "BlockchainTableHead");
|
|
1257
1344
|
|
|
1258
1345
|
// src/components/block/table/Ex.tsx
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
})
|
|
1265
|
-
return /* @__PURE__ */ jsxs14(TableEx, { ref, ...props, children: [
|
|
1266
|
-
/* @__PURE__ */ jsx25(BlockchainTableHead, {}),
|
|
1267
|
-
/* @__PURE__ */ jsx25(TableBody, { children })
|
|
1268
|
-
] });
|
|
1269
|
-
};
|
|
1346
|
+
var BlockchainTableEx = /* @__PURE__ */ __name(({ ref, children, ...props }) => {
|
|
1347
|
+
return /* @__PURE__ */ React25.createElement(TableEx, {
|
|
1348
|
+
ref,
|
|
1349
|
+
...props
|
|
1350
|
+
}, /* @__PURE__ */ React25.createElement(BlockchainTableHead, null), /* @__PURE__ */ React25.createElement(TableBody, null, children));
|
|
1351
|
+
}, "BlockchainTableEx");
|
|
1270
1352
|
BlockchainTableEx.displayName = "BlockchainTableEx";
|
|
1271
1353
|
|
|
1272
1354
|
// src/components/block/table/row/TableRow.tsx
|
|
1273
1355
|
import { TableRow as TableRow2, useTheme } from "@mui/material";
|
|
1274
1356
|
import { alphaCss } from "@xylabs/react-theme";
|
|
1275
1357
|
import { usePayloadRootHash as usePayloadRootHash3 } from "@xyo-network/react-shared";
|
|
1276
|
-
import { useMemo as useMemo11 } from "react";
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1358
|
+
import React26, { useMemo as useMemo11 } from "react";
|
|
1359
|
+
var BlockChainTableRow = /* @__PURE__ */ __name(({ block, deepValidation, defaultExpanded, linked, sx, ...props }) => {
|
|
1360
|
+
const linkedTableCellProps = useMemo11(() => ({
|
|
1361
|
+
block,
|
|
1362
|
+
linked
|
|
1363
|
+
}), [
|
|
1364
|
+
block,
|
|
1365
|
+
linked
|
|
1366
|
+
]);
|
|
1367
|
+
const defaultTableCellProps = useMemo11(() => ({
|
|
1368
|
+
block
|
|
1369
|
+
}), [
|
|
1370
|
+
block
|
|
1371
|
+
]);
|
|
1288
1372
|
const hash = usePayloadRootHash3(block?.[0]);
|
|
1289
1373
|
const [ref, handleClick] = useLinkedBlockItem("block-hash", hash);
|
|
1290
1374
|
const theme = useTheme();
|
|
1291
|
-
return /* @__PURE__ */
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
"&:hover": { backgroundColor: alphaCss(theme.vars.palette.secondary.light, 0.15) },
|
|
1300
|
-
...sx
|
|
1375
|
+
return /* @__PURE__ */ React26.createElement(TableRow2, {
|
|
1376
|
+
onClick: linked ? handleClick : void 0,
|
|
1377
|
+
ref,
|
|
1378
|
+
sx: {
|
|
1379
|
+
"cursor": linked ? "pointer" : "default",
|
|
1380
|
+
"overflowY": "scroll",
|
|
1381
|
+
"&:hover": {
|
|
1382
|
+
backgroundColor: alphaCss(theme.vars.palette.secondary.light, 0.15)
|
|
1301
1383
|
},
|
|
1302
|
-
...
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
)
|
|
1315
|
-
|
|
1384
|
+
...sx
|
|
1385
|
+
},
|
|
1386
|
+
...props
|
|
1387
|
+
}, /* @__PURE__ */ React26.createElement(BlockNumberTableCell, {
|
|
1388
|
+
align: "left",
|
|
1389
|
+
...linkedTableCellProps
|
|
1390
|
+
}), /* @__PURE__ */ React26.createElement(BlockHashTableCell, {
|
|
1391
|
+
align: "left",
|
|
1392
|
+
...linkedTableCellProps
|
|
1393
|
+
}), /* @__PURE__ */ React26.createElement(BlockEpochTableCell, {
|
|
1394
|
+
align: "left",
|
|
1395
|
+
...linkedTableCellProps
|
|
1396
|
+
}), /* @__PURE__ */ React26.createElement(BlockProducerTableCell, {
|
|
1397
|
+
align: "left",
|
|
1398
|
+
...linkedTableCellProps
|
|
1399
|
+
}), /* @__PURE__ */ React26.createElement(BlockTransactionCountTableCell, {
|
|
1400
|
+
align: "left",
|
|
1401
|
+
...linkedTableCellProps
|
|
1402
|
+
}), /* @__PURE__ */ React26.createElement(BlockPayloadCountsTableCell, {
|
|
1403
|
+
align: "left",
|
|
1404
|
+
...linkedTableCellProps
|
|
1405
|
+
}), /* @__PURE__ */ React26.createElement(BlockVerificationTableCell, {
|
|
1406
|
+
deepValidation,
|
|
1407
|
+
...defaultTableCellProps
|
|
1408
|
+
}), /* @__PURE__ */ React26.createElement(BlockJsonViewTableCell, defaultTableCellProps));
|
|
1409
|
+
}, "BlockChainTableRow");
|
|
1316
1410
|
|
|
1317
1411
|
// src/components/chain/controls/PollingControlsFlexbox.tsx
|
|
1318
|
-
import {
|
|
1319
|
-
|
|
1320
|
-
Pause
|
|
1321
|
-
} from "@mui/icons-material";
|
|
1322
|
-
import {
|
|
1323
|
-
Alert as Alert3,
|
|
1324
|
-
AlertTitle as AlertTitle2,
|
|
1325
|
-
Grow,
|
|
1326
|
-
Icon as Icon2,
|
|
1327
|
-
IconButton as IconButton4,
|
|
1328
|
-
Tooltip as Tooltip8
|
|
1329
|
-
} from "@mui/material";
|
|
1412
|
+
import { Autorenew, Pause } from "@mui/icons-material";
|
|
1413
|
+
import { Alert as Alert3, AlertTitle as AlertTitle2, Grow, Icon as Icon2, IconButton as IconButton4, Tooltip as Tooltip8 } from "@mui/material";
|
|
1330
1414
|
import { FlexRow as FlexRow6 } from "@xylabs/react-flexbox";
|
|
1331
|
-
import { memo } from "react";
|
|
1415
|
+
import React31, { memo } from "react";
|
|
1332
1416
|
|
|
1333
1417
|
// src/components/chain/stats/Dialog.tsx
|
|
1334
1418
|
import { QueryStats } from "@mui/icons-material";
|
|
1335
|
-
import {
|
|
1336
|
-
|
|
1337
|
-
DialogContent as DialogContent3,
|
|
1338
|
-
DialogTitle as DialogTitle3,
|
|
1339
|
-
IconButton as IconButton3
|
|
1340
|
-
} from "@mui/material";
|
|
1341
|
-
import { useState as useState12 } from "react";
|
|
1419
|
+
import { Dialog as Dialog3, DialogContent as DialogContent3, DialogTitle as DialogTitle3, IconButton as IconButton3 } from "@mui/material";
|
|
1420
|
+
import React29, { useState as useState12 } from "react";
|
|
1342
1421
|
|
|
1343
1422
|
// src/components/chain/stats/producer/ProducerFlexbox.tsx
|
|
1344
|
-
import {
|
|
1345
|
-
ListItem,
|
|
1346
|
-
styled,
|
|
1347
|
-
Typography as Typography6
|
|
1348
|
-
} from "@mui/material";
|
|
1423
|
+
import { ListItem, styled, Typography as Typography6 } from "@mui/material";
|
|
1349
1424
|
import { ErrorRender as ErrorRender3 } from "@xylabs/react-error";
|
|
1350
1425
|
import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
|
|
1351
1426
|
import { isChainSummaryProducers } from "@xyo-network/chain-analyze";
|
|
1352
|
-
import { useMemo as useMemo12 } from "react";
|
|
1427
|
+
import React28, { useMemo as useMemo12 } from "react";
|
|
1353
1428
|
|
|
1354
1429
|
// src/components/chain/stats/producer/Table.tsx
|
|
1355
|
-
import {
|
|
1356
|
-
Table,
|
|
1357
|
-
TableBody as TableBody2,
|
|
1358
|
-
TableCell as TableCell10,
|
|
1359
|
-
TableHead as TableHead2,
|
|
1360
|
-
TableRow as TableRow3,
|
|
1361
|
-
useTheme as useTheme2
|
|
1362
|
-
} from "@mui/material";
|
|
1430
|
+
import { Table, TableBody as TableBody2, TableCell as TableCell10, TableHead as TableHead2, TableRow as TableRow3, useTheme as useTheme2 } from "@mui/material";
|
|
1363
1431
|
import { BlockiesAvatar as BlockiesAvatar2 } from "@xyo-network/react-chain-blockies";
|
|
1364
|
-
import
|
|
1365
|
-
var ChainProducerStatsTable = ({ producers, ...props }) => {
|
|
1432
|
+
import React27 from "react";
|
|
1433
|
+
var ChainProducerStatsTable = /* @__PURE__ */ __name(({ producers, ...props }) => {
|
|
1366
1434
|
const theme = useTheme2();
|
|
1367
|
-
return /* @__PURE__ */
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
};
|
|
1435
|
+
return /* @__PURE__ */ React27.createElement(Table, props, /* @__PURE__ */ React27.createElement(TableHead2, null, /* @__PURE__ */ React27.createElement(TableRow3, null, /* @__PURE__ */ React27.createElement(TableCell10, null, "Address"), /* @__PURE__ */ React27.createElement(TableCell10, null, "Blocks Produced"), /* @__PURE__ */ React27.createElement(TableCell10, null, "Rewards Earned Produced"))), /* @__PURE__ */ React27.createElement(TableBody2, null, producers?.map((producer) => /* @__PURE__ */ React27.createElement(TableRow3, {
|
|
1436
|
+
key: producer.address
|
|
1437
|
+
}, /* @__PURE__ */ React27.createElement(TableCell10, null, /* @__PURE__ */ React27.createElement(BlockiesAvatar2, {
|
|
1438
|
+
blockiesOptions: {
|
|
1439
|
+
seed: producer.address
|
|
1440
|
+
},
|
|
1441
|
+
sx: {
|
|
1442
|
+
height: theme.spacing(2.75),
|
|
1443
|
+
width: theme.spacing(2.75)
|
|
1444
|
+
}
|
|
1445
|
+
})), /* @__PURE__ */ React27.createElement(TableCell10, null, producer.blocksProduced.toString()), /* @__PURE__ */ React27.createElement(TableCell10, null, producer.rewardsEarned.toString())))));
|
|
1446
|
+
}, "ChainProducerStatsTable");
|
|
1380
1447
|
|
|
1381
1448
|
// src/components/chain/stats/producer/ProducerFlexbox.tsx
|
|
1382
|
-
|
|
1383
|
-
var BlockProducerStatsFlexbox = ({ payload, ...props }) => {
|
|
1449
|
+
var BlockProducerStatsFlexbox = /* @__PURE__ */ __name(({ payload, ...props }) => {
|
|
1384
1450
|
const [producer, producerError] = useMemo12(() => {
|
|
1385
1451
|
if (payload) {
|
|
1386
|
-
return isChainSummaryProducers(payload) ? [
|
|
1452
|
+
return isChainSummaryProducers(payload) ? [
|
|
1453
|
+
payload
|
|
1454
|
+
] : [
|
|
1455
|
+
void 0,
|
|
1456
|
+
new Error("Payload is not a Chain Producer")
|
|
1457
|
+
];
|
|
1387
1458
|
} else {
|
|
1388
1459
|
return [];
|
|
1389
1460
|
}
|
|
1390
|
-
}, [
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1461
|
+
}, [
|
|
1462
|
+
payload
|
|
1463
|
+
]);
|
|
1464
|
+
const producersArray = useMemo12(() => Object.values(producer?.producers ?? {}), [
|
|
1465
|
+
producer
|
|
1466
|
+
]);
|
|
1467
|
+
return /* @__PURE__ */ React28.createElement(FlexCol3, {
|
|
1468
|
+
alignItems: "start",
|
|
1469
|
+
gap: 1,
|
|
1470
|
+
...props
|
|
1471
|
+
}, /* @__PURE__ */ React28.createElement(ErrorRender3, {
|
|
1472
|
+
error: producerError,
|
|
1473
|
+
scope: "BlockProducerStatsFlexbox"
|
|
1474
|
+
}), /* @__PURE__ */ React28.createElement(Typography6, {
|
|
1475
|
+
fontSize: "1rem"
|
|
1476
|
+
}, "Block Producers"), /* @__PURE__ */ React28.createElement(ChainProducerStatsTable, {
|
|
1477
|
+
producers: producersArray
|
|
1478
|
+
}));
|
|
1479
|
+
}, "BlockProducerStatsFlexbox");
|
|
1398
1480
|
var StyledListItem = styled(ListItem)(() => ({
|
|
1399
1481
|
paddingTop: 0,
|
|
1400
1482
|
paddingBottom: 0
|
|
1401
1483
|
}));
|
|
1402
1484
|
|
|
1403
1485
|
// src/components/chain/stats/Dialog.tsx
|
|
1404
|
-
|
|
1405
|
-
var ChainAnalyzerStatsDialog = (props) => {
|
|
1486
|
+
var ChainAnalyzerStatsDialog = /* @__PURE__ */ __name((props) => {
|
|
1406
1487
|
const { analyzers, statsUpdated } = useChainAnalyzersContext();
|
|
1407
|
-
return /* @__PURE__ */
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
};
|
|
1412
|
-
|
|
1488
|
+
return /* @__PURE__ */ React29.createElement(Dialog3, props, /* @__PURE__ */ React29.createElement(DialogTitle3, null, "Chain Analysis"), /* @__PURE__ */ React29.createElement(DialogContent3, null, statsUpdated > 0 && Object.entries(analyzers).map(([id2, analyzer]) => /* @__PURE__ */ React29.createElement("div", {
|
|
1489
|
+
key: id2
|
|
1490
|
+
}, id2 === "producers" && /* @__PURE__ */ React29.createElement(BlockProducerStatsFlexbox, {
|
|
1491
|
+
payload: analyzer.result()
|
|
1492
|
+
})))));
|
|
1493
|
+
}, "ChainAnalyzerStatsDialog");
|
|
1494
|
+
var ChainAnalyzerStatsDialogFromContext = /* @__PURE__ */ __name((props) => {
|
|
1413
1495
|
const [open, setOpen] = useState12(false);
|
|
1414
|
-
const handleClose = () => setOpen(false);
|
|
1415
|
-
return /* @__PURE__ */
|
|
1416
|
-
/* @__PURE__ */
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1496
|
+
const handleClose = /* @__PURE__ */ __name(() => setOpen(false), "handleClose");
|
|
1497
|
+
return /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(IconButton3, {
|
|
1498
|
+
onClick: /* @__PURE__ */ __name(() => setOpen(true), "onClick")
|
|
1499
|
+
}, /* @__PURE__ */ React29.createElement(QueryStats, null)), /* @__PURE__ */ React29.createElement(ChainAnalyzerStatsDialog, {
|
|
1500
|
+
onClose: handleClose,
|
|
1501
|
+
open,
|
|
1502
|
+
...props
|
|
1503
|
+
}));
|
|
1504
|
+
}, "ChainAnalyzerStatsDialogFromContext");
|
|
1420
1505
|
|
|
1421
1506
|
// src/components/chain/controls/PulseSvgIcon.tsx
|
|
1422
|
-
import {
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
"
|
|
1434
|
-
|
|
1507
|
+
import { createSvgIcon, keyframes, styled as styled2 } from "@mui/material";
|
|
1508
|
+
import React30 from "react";
|
|
1509
|
+
var PulseSvgIcon = createSvgIcon(/* @__PURE__ */ React30.createElement("svg", {
|
|
1510
|
+
viewBox: "0 0 80 80",
|
|
1511
|
+
version: "1.1",
|
|
1512
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1513
|
+
}, /* @__PURE__ */ React30.createElement("g", {
|
|
1514
|
+
transform: "translate(34,34)"
|
|
1515
|
+
}, /* @__PURE__ */ React30.createElement("circle", {
|
|
1516
|
+
className: "core",
|
|
1517
|
+
cx: "0",
|
|
1518
|
+
cy: "0",
|
|
1519
|
+
r: "6"
|
|
1520
|
+
}), /* @__PURE__ */ React30.createElement("circle", {
|
|
1521
|
+
className: "radar",
|
|
1522
|
+
cx: "0",
|
|
1523
|
+
cy: "0",
|
|
1524
|
+
r: "6"
|
|
1525
|
+
}))), "PulseSvgIcon");
|
|
1435
1526
|
var pulse1 = keyframes`
|
|
1436
1527
|
0% {
|
|
1437
1528
|
opacity: 0;
|
|
@@ -1487,62 +1578,57 @@ var StyledPulseSvgIcon = styled2(PulseSvgIcon)(({ theme }) => {
|
|
|
1487
1578
|
});
|
|
1488
1579
|
|
|
1489
1580
|
// src/components/chain/controls/PollingControlsFlexbox.tsx
|
|
1490
|
-
|
|
1491
|
-
var PollingControlsFlexbox = ({
|
|
1492
|
-
blocksBehind,
|
|
1493
|
-
pollingState,
|
|
1494
|
-
setPollingState
|
|
1495
|
-
}) => {
|
|
1581
|
+
var PollingControlsFlexbox = /* @__PURE__ */ __name(({ blocksBehind, pollingState, setPollingState }) => {
|
|
1496
1582
|
const paused = pollingState === "paused";
|
|
1497
1583
|
const running = pollingState === "running";
|
|
1498
|
-
return /* @__PURE__ */
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
/* @__PURE__ */
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1584
|
+
return /* @__PURE__ */ React31.createElement(FlexRow6, {
|
|
1585
|
+
justifyContent: "space-between",
|
|
1586
|
+
width: "100%"
|
|
1587
|
+
}, /* @__PURE__ */ React31.createElement(FlexRow6, {
|
|
1588
|
+
gap: 2
|
|
1589
|
+
}, running && /* @__PURE__ */ React31.createElement(IconButton4, {
|
|
1590
|
+
onClick: /* @__PURE__ */ __name(() => setPollingState?.("paused"), "onClick"),
|
|
1591
|
+
title: "Pause Block Stream"
|
|
1592
|
+
}, /* @__PURE__ */ React31.createElement(Pause, null)), paused && /* @__PURE__ */ React31.createElement(IconButton4, {
|
|
1593
|
+
onClick: /* @__PURE__ */ __name(() => setPollingState?.("running"), "onClick"),
|
|
1594
|
+
title: "Re-Sync Block Stream"
|
|
1595
|
+
}, /* @__PURE__ */ React31.createElement(Autorenew, null)), /* @__PURE__ */ React31.createElement(ChainAnalyzerStatsDialogFromContext, null)), /* @__PURE__ */ React31.createElement(FlexRow6, {
|
|
1596
|
+
gap: 2
|
|
1597
|
+
}, /* @__PURE__ */ React31.createElement(Grow, {
|
|
1598
|
+
in: (blocksBehind ?? 0) > 0
|
|
1599
|
+
}, /* @__PURE__ */ React31.createElement(Tooltip8, {
|
|
1600
|
+
title: "Click to Re-Sync"
|
|
1601
|
+
}, /* @__PURE__ */ React31.createElement(Alert3, {
|
|
1602
|
+
sx: {
|
|
1603
|
+
py: 0,
|
|
1604
|
+
px: 1,
|
|
1605
|
+
cursor: "pointer"
|
|
1606
|
+
},
|
|
1607
|
+
severity: "warning",
|
|
1608
|
+
onClick: /* @__PURE__ */ __name(() => setPollingState?.("running"), "onClick")
|
|
1609
|
+
}, /* @__PURE__ */ React31.createElement(AlertTitle2, {
|
|
1610
|
+
sx: {
|
|
1611
|
+
mb: 0
|
|
1612
|
+
}
|
|
1613
|
+
}, "Behind:", " ", blocksBehind)))), /* @__PURE__ */ React31.createElement(Icon2, null, /* @__PURE__ */ React31.createElement(StyledPulseSvgIcon, {
|
|
1614
|
+
className: running ? "" : "paused"
|
|
1615
|
+
}))));
|
|
1616
|
+
}, "PollingControlsFlexbox");
|
|
1617
|
+
var MemoizedPollingControlsFlexbox = /* @__PURE__ */ memo(PollingControlsFlexbox);
|
|
1527
1618
|
|
|
1528
1619
|
// src/components/chain/dialog/Dialog.tsx
|
|
1529
|
-
import {
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
return /* @__PURE__ */ jsxs21(Dialog4, { ...props, children: [
|
|
1538
|
-
/* @__PURE__ */ jsx32(DialogContent4, { children: "Transactions Dialog" }),
|
|
1539
|
-
/* @__PURE__ */ jsx32(DialogActions3, { children: /* @__PURE__ */ jsx32(Button4, { variant: "outlined", onClick: (e) => props?.onClose?.(e, "escapeKeyDown"), children: "Close" }) })
|
|
1540
|
-
] });
|
|
1541
|
-
};
|
|
1620
|
+
import { Button as Button4, Dialog as Dialog4, DialogActions as DialogActions3, DialogContent as DialogContent4 } from "@mui/material";
|
|
1621
|
+
import React32 from "react";
|
|
1622
|
+
var TransactionsDialog = /* @__PURE__ */ __name((props) => {
|
|
1623
|
+
return /* @__PURE__ */ React32.createElement(Dialog4, props, /* @__PURE__ */ React32.createElement(DialogContent4, null, "Transactions Dialog"), /* @__PURE__ */ React32.createElement(DialogActions3, null, /* @__PURE__ */ React32.createElement(Button4, {
|
|
1624
|
+
variant: "outlined",
|
|
1625
|
+
onClick: /* @__PURE__ */ __name((e) => props?.onClose?.(e, "escapeKeyDown"), "onClick")
|
|
1626
|
+
}, "Close")));
|
|
1627
|
+
}, "TransactionsDialog");
|
|
1542
1628
|
|
|
1543
1629
|
// src/components/chain/hooks/useOnBlock.ts
|
|
1544
1630
|
import { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
1545
|
-
var useOnBlock = (initialHeadNumber, onAddBlock, liveHead, pollingState) => {
|
|
1631
|
+
var useOnBlock = /* @__PURE__ */ __name((initialHeadNumber, onAddBlock, liveHead, pollingState) => {
|
|
1546
1632
|
const blocksWhilePaused = useRef3([]);
|
|
1547
1633
|
const lastLiveHead = useRef3(liveHead);
|
|
1548
1634
|
useEffect3(() => {
|
|
@@ -1565,52 +1651,63 @@ var useOnBlock = (initialHeadNumber, onAddBlock, liveHead, pollingState) => {
|
|
|
1565
1651
|
void onAddBlock(liveHead);
|
|
1566
1652
|
}
|
|
1567
1653
|
}
|
|
1568
|
-
}, [
|
|
1654
|
+
}, [
|
|
1655
|
+
liveHead,
|
|
1656
|
+
pollingState
|
|
1657
|
+
]);
|
|
1569
1658
|
return blocksWhilePaused.current;
|
|
1570
|
-
};
|
|
1659
|
+
}, "useOnBlock");
|
|
1571
1660
|
|
|
1572
1661
|
// src/components/chain/pagination/BlockChainPagination.tsx
|
|
1573
1662
|
import { TablePaginationActions } from "@xyo-network/react-payload-table";
|
|
1574
|
-
import
|
|
1575
|
-
var BlockChainPagination = ({
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
};
|
|
1663
|
+
import React33 from "react";
|
|
1664
|
+
var BlockChainPagination = /* @__PURE__ */ __name(({ count = 0, onPageChange, page, rowsPerPage = 10 }) => {
|
|
1665
|
+
return /* @__PURE__ */ React33.createElement(TablePaginationActions, {
|
|
1666
|
+
count,
|
|
1667
|
+
onPageChange,
|
|
1668
|
+
page,
|
|
1669
|
+
rowsPerPage
|
|
1670
|
+
});
|
|
1671
|
+
}, "BlockChainPagination");
|
|
1583
1672
|
|
|
1584
1673
|
// src/components/chain/pagination/hooks/usePagination.tsx
|
|
1585
1674
|
import { useMemo as useMemo13, useState as useState13 } from "react";
|
|
1586
|
-
var useChainPagination = (pageSize, blockComponents) => {
|
|
1675
|
+
var useChainPagination = /* @__PURE__ */ __name((pageSize, blockComponents) => {
|
|
1587
1676
|
const [page, setPage] = useState13(0);
|
|
1588
1677
|
const paginatedBlockComponents = useMemo13(() => {
|
|
1589
1678
|
const startIndex = page * pageSize;
|
|
1590
1679
|
const endIndex = startIndex + pageSize;
|
|
1591
1680
|
return blockComponents?.slice(startIndex, endIndex);
|
|
1592
|
-
}, [
|
|
1593
|
-
|
|
1681
|
+
}, [
|
|
1682
|
+
blockComponents,
|
|
1683
|
+
page,
|
|
1684
|
+
pageSize
|
|
1685
|
+
]);
|
|
1686
|
+
const onPageChange = /* @__PURE__ */ __name((_event, newPage) => {
|
|
1594
1687
|
setPage(newPage);
|
|
1595
|
-
};
|
|
1688
|
+
}, "onPageChange");
|
|
1596
1689
|
return {
|
|
1597
1690
|
onPageChange,
|
|
1598
1691
|
page,
|
|
1599
1692
|
paginatedBlockComponents
|
|
1600
1693
|
};
|
|
1601
|
-
};
|
|
1694
|
+
}, "useChainPagination");
|
|
1602
1695
|
|
|
1603
1696
|
// src/components/chain/render/dynamic/flexbox/variants/Base.tsx
|
|
1604
1697
|
import { ErrorRender as ErrorRender4 } from "@xylabs/react-error";
|
|
1605
1698
|
import { FlexCol as FlexCol5 } from "@xylabs/react-flexbox";
|
|
1699
|
+
import React35 from "react";
|
|
1606
1700
|
|
|
1607
1701
|
// src/components/chain/list/Animated.tsx
|
|
1608
1702
|
import { AnimatedList } from "@xylabs/react-animation";
|
|
1703
|
+
import React34 from "react";
|
|
1609
1704
|
|
|
1610
1705
|
// src/components/chain/styled/BlockListWrapperFlexbox.tsx
|
|
1611
1706
|
import { styled as styled3 } from "@mui/material";
|
|
1612
1707
|
import { FlexCol as FlexCol4 } from "@xylabs/react-flexbox";
|
|
1613
|
-
var BlockListWrapperFlexBox = styled3(FlexCol4, {
|
|
1708
|
+
var BlockListWrapperFlexBox = styled3(FlexCol4, {
|
|
1709
|
+
name: "BlockListWrapperFlexbox"
|
|
1710
|
+
})(() => ({
|
|
1614
1711
|
"& > div:nth-of-type(2) .block-heading-flexbox .divider-spacer": {
|
|
1615
1712
|
// hide the spacer for the first element
|
|
1616
1713
|
visibility: "hidden"
|
|
@@ -1623,42 +1720,40 @@ var BlockListWrapperFlexBox = styled3(FlexCol4, { name: "BlockListWrapperFlexbox
|
|
|
1623
1720
|
}));
|
|
1624
1721
|
|
|
1625
1722
|
// src/components/chain/list/Animated.tsx
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
{
|
|
1636
|
-
fullWidth: true,
|
|
1637
|
-
items: blockChainRenderComponents
|
|
1638
|
-
}
|
|
1639
|
-
)
|
|
1640
|
-
}
|
|
1641
|
-
);
|
|
1642
|
-
};
|
|
1723
|
+
var BlockListAnimated = /* @__PURE__ */ __name(({ blockChainRenderComponents }) => {
|
|
1724
|
+
return /* @__PURE__ */ React34.createElement(BlockListWrapperFlexBox, {
|
|
1725
|
+
alignItems: "stretch",
|
|
1726
|
+
width: "100%"
|
|
1727
|
+
}, /* @__PURE__ */ React34.createElement(AnimatedList, {
|
|
1728
|
+
fullWidth: true,
|
|
1729
|
+
items: blockChainRenderComponents
|
|
1730
|
+
}));
|
|
1731
|
+
}, "BlockListAnimated");
|
|
1643
1732
|
|
|
1644
1733
|
// src/components/chain/render/dynamic/hooks/useDynamicBlockRenderComponents.ts
|
|
1645
1734
|
import { useMemo as useMemo14 } from "react";
|
|
1646
|
-
var useDynamicBlockRenderComponents = (BlockComponent, blockChainRenderProps) => {
|
|
1735
|
+
var useDynamicBlockRenderComponents = /* @__PURE__ */ __name((BlockComponent, blockChainRenderProps) => {
|
|
1647
1736
|
const { maxBlocks } = blockChainRenderProps ?? {};
|
|
1648
|
-
const chainIteratorParams = useMemo14(() => blockChainRenderProps ?? {
|
|
1737
|
+
const chainIteratorParams = useMemo14(() => blockChainRenderProps ?? {
|
|
1738
|
+
name: "unknown"
|
|
1739
|
+
}, [
|
|
1740
|
+
blockChainRenderProps
|
|
1741
|
+
]);
|
|
1649
1742
|
const [params, paramsError] = useChainIteratorParams(chainIteratorParams);
|
|
1650
1743
|
const { blockChainRenderComponents, onAddBlock } = useDynamicBlockComponents(BlockComponent, params, maxBlocks);
|
|
1651
1744
|
const { head: liveHead } = useChainIteratorStore(params);
|
|
1652
1745
|
const { pollingState, updatePollingState } = useChainPollingContext();
|
|
1653
1746
|
const blocksWhilePaused = useOnBlock(blockChainRenderComponents[0]?.block?.[0].block, onAddBlock, liveHead, pollingState);
|
|
1654
1747
|
return {
|
|
1655
|
-
errors: [
|
|
1748
|
+
errors: [
|
|
1749
|
+
paramsError
|
|
1750
|
+
],
|
|
1656
1751
|
blockChainRenderComponents,
|
|
1657
1752
|
blocksWhilePaused,
|
|
1658
1753
|
updatePollingState,
|
|
1659
1754
|
pollingState
|
|
1660
1755
|
};
|
|
1661
|
-
};
|
|
1756
|
+
}, "useDynamicBlockRenderComponents");
|
|
1662
1757
|
|
|
1663
1758
|
// src/components/chain/render/dynamic/hooks/useRemoteBlockChainRenderProps.ts
|
|
1664
1759
|
import { usePromise as usePromise6 } from "@xylabs/react-promise";
|
|
@@ -1668,94 +1763,111 @@ import { useMemo as useMemo15 } from "react";
|
|
|
1668
1763
|
import { assertEx as assertEx4 } from "@xylabs/assert";
|
|
1669
1764
|
import { asArchivistInstance } from "@xyo-network/archivist-model";
|
|
1670
1765
|
import { HttpBridge, HttpBridgeConfigSchema } from "@xyo-network/bridge-http";
|
|
1671
|
-
var getChainArchivistFromBridge = async (params) => {
|
|
1766
|
+
var getChainArchivistFromBridge = /* @__PURE__ */ __name(async (params) => {
|
|
1672
1767
|
const { url, chainArchivistModuleId } = params;
|
|
1673
|
-
const config = {
|
|
1674
|
-
|
|
1768
|
+
const config = {
|
|
1769
|
+
schema: HttpBridgeConfigSchema,
|
|
1770
|
+
client: {
|
|
1771
|
+
url
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
const bridge = await HttpBridge.create({
|
|
1775
|
+
config
|
|
1776
|
+
});
|
|
1675
1777
|
const resolved = await bridge.resolve(chainArchivistModuleId);
|
|
1676
1778
|
const mod = assertEx4(resolved, () => `Module ${chainArchivistModuleId} not found`);
|
|
1677
1779
|
return assertEx4(asArchivistInstance(mod), () => `Module ${chainArchivistModuleId} is not an archivist`);
|
|
1678
|
-
};
|
|
1780
|
+
}, "getChainArchivistFromBridge");
|
|
1679
1781
|
|
|
1680
1782
|
// src/lib/getChainId.ts
|
|
1681
1783
|
import { toAddress as toAddress2 } from "@xylabs/hex";
|
|
1682
1784
|
var id = toAddress2("ce080bf3043a40c6c8838c7e813c00ab53df1684");
|
|
1683
|
-
var getChainId = () => {
|
|
1785
|
+
var getChainId = /* @__PURE__ */ __name(() => {
|
|
1684
1786
|
return id;
|
|
1685
|
-
};
|
|
1787
|
+
}, "getChainId");
|
|
1686
1788
|
|
|
1687
1789
|
// src/components/chain/render/dynamic/hooks/useRemoteBlockChainRenderProps.ts
|
|
1688
|
-
var useRemoteBlockChainRenderProps = (chainArchivistModuleId, url, blockChainRenderPropsArg) => {
|
|
1790
|
+
var useRemoteBlockChainRenderProps = /* @__PURE__ */ __name((chainArchivistModuleId, url, blockChainRenderPropsArg) => {
|
|
1689
1791
|
const [chainArchivist, chainArchivistError] = usePromise6(async () => {
|
|
1690
1792
|
if (url !== void 0 && chainArchivistModuleId !== void 0) {
|
|
1691
|
-
return await getChainArchivistFromBridge({
|
|
1793
|
+
return await getChainArchivistFromBridge({
|
|
1794
|
+
url,
|
|
1795
|
+
chainArchivistModuleId
|
|
1796
|
+
});
|
|
1692
1797
|
}
|
|
1693
|
-
}, [
|
|
1798
|
+
}, [
|
|
1799
|
+
url,
|
|
1800
|
+
chainArchivistModuleId
|
|
1801
|
+
]);
|
|
1694
1802
|
const blockChainRenderProps = useMemo15(() => ({
|
|
1695
1803
|
...blockChainRenderPropsArg,
|
|
1696
1804
|
chainArchivist,
|
|
1697
1805
|
name: "blockChainRenderProps"
|
|
1698
|
-
}), [
|
|
1806
|
+
}), [
|
|
1807
|
+
blockChainRenderPropsArg,
|
|
1808
|
+
chainArchivist
|
|
1809
|
+
]);
|
|
1699
1810
|
return {
|
|
1700
1811
|
blockChainRenderProps,
|
|
1701
1812
|
error: chainArchivistError
|
|
1702
1813
|
};
|
|
1703
|
-
};
|
|
1814
|
+
}, "useRemoteBlockChainRenderProps");
|
|
1704
1815
|
|
|
1705
1816
|
// src/components/chain/render/dynamic/flexbox/variants/Base.tsx
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1817
|
+
var DynamicListBase = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1818
|
+
const { errors, blockChainRenderComponents, blocksWhilePaused, pollingState, updatePollingState } = useDynamicBlockRenderComponents(BlockHeadingFlexbox, blockChainRenderProps);
|
|
1819
|
+
return /* @__PURE__ */ React35.createElement(FlexCol5, {
|
|
1820
|
+
alignItems: "start",
|
|
1821
|
+
...props
|
|
1822
|
+
}, errors?.map((error) => /* @__PURE__ */ React35.createElement(ErrorRender4, {
|
|
1823
|
+
error,
|
|
1824
|
+
key: error?.name,
|
|
1825
|
+
scope: "DynamicBlockchainRenderFlexboxInner"
|
|
1826
|
+
})), /* @__PURE__ */ React35.createElement(MemoizedPollingControlsFlexbox, {
|
|
1827
|
+
blocksBehind: blocksWhilePaused?.length,
|
|
1712
1828
|
pollingState,
|
|
1713
|
-
updatePollingState
|
|
1714
|
-
}
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
MemoizedPollingControlsFlexbox,
|
|
1719
|
-
{
|
|
1720
|
-
blocksBehind: blocksWhilePaused?.length,
|
|
1721
|
-
pollingState,
|
|
1722
|
-
setPollingState: updatePollingState
|
|
1723
|
-
}
|
|
1724
|
-
),
|
|
1725
|
-
/* @__PURE__ */ jsx35(BlockListAnimated, { blockChainRenderComponents })
|
|
1726
|
-
] });
|
|
1727
|
-
};
|
|
1829
|
+
setPollingState: updatePollingState
|
|
1830
|
+
}), /* @__PURE__ */ React35.createElement(BlockListAnimated, {
|
|
1831
|
+
blockChainRenderComponents
|
|
1832
|
+
}));
|
|
1833
|
+
}, "DynamicListBase");
|
|
1728
1834
|
|
|
1729
1835
|
// src/components/chain/render/dynamic/flexbox/variants/WithAnalysis.tsx
|
|
1730
1836
|
import { isAddress } from "@xylabs/hex";
|
|
1731
1837
|
import { ChainProducersAnalyzer } from "@xyo-network/chain-analyze";
|
|
1732
|
-
import { useMemo as useMemo16 } from "react";
|
|
1733
|
-
|
|
1734
|
-
var WithAnalysis = ({ blockChainRenderProps, ...props }) => {
|
|
1838
|
+
import React36, { useMemo as useMemo16 } from "react";
|
|
1839
|
+
var WithAnalysis = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1735
1840
|
const { chainId } = blockChainRenderProps ?? {};
|
|
1736
1841
|
const analyzers = useMemo16(() => {
|
|
1737
1842
|
if (isAddress(chainId)) {
|
|
1738
|
-
return {
|
|
1843
|
+
return {
|
|
1844
|
+
producers: new ChainProducersAnalyzer()
|
|
1845
|
+
};
|
|
1739
1846
|
}
|
|
1740
|
-
}, [
|
|
1741
|
-
|
|
1742
|
-
|
|
1847
|
+
}, [
|
|
1848
|
+
chainId
|
|
1849
|
+
]);
|
|
1850
|
+
return /* @__PURE__ */ React36.createElement(ChainAnalyzersProvider, {
|
|
1851
|
+
analyzers
|
|
1852
|
+
}, /* @__PURE__ */ React36.createElement(ChainPollingProvider, null, /* @__PURE__ */ React36.createElement(DynamicListBase, {
|
|
1853
|
+
blockChainRenderProps,
|
|
1854
|
+
...props
|
|
1855
|
+
})));
|
|
1856
|
+
}, "WithAnalysis");
|
|
1743
1857
|
|
|
1744
1858
|
// src/components/chain/render/dynamic/flexbox/variants/WithRemote.tsx
|
|
1745
1859
|
import { ErrorRender as ErrorRender5 } from "@xylabs/react-error";
|
|
1746
|
-
import
|
|
1747
|
-
var WithRemote = ({
|
|
1748
|
-
url,
|
|
1749
|
-
chainArchivistModuleId,
|
|
1750
|
-
blockChainRenderProps: blockChainRenderPropsArg,
|
|
1751
|
-
...props
|
|
1752
|
-
}) => {
|
|
1860
|
+
import React37 from "react";
|
|
1861
|
+
var WithRemote = /* @__PURE__ */ __name(({ url, chainArchivistModuleId, blockChainRenderProps: blockChainRenderPropsArg, ...props }) => {
|
|
1753
1862
|
const { error, blockChainRenderProps } = useRemoteBlockChainRenderProps(chainArchivistModuleId, url, blockChainRenderPropsArg);
|
|
1754
|
-
return /* @__PURE__ */
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1863
|
+
return /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement(ErrorRender5, {
|
|
1864
|
+
error,
|
|
1865
|
+
scope: "RemoteChainProviderFlexbox"
|
|
1866
|
+
}), /* @__PURE__ */ React37.createElement(WithAnalysis, {
|
|
1867
|
+
blockChainRenderProps,
|
|
1868
|
+
...props
|
|
1869
|
+
}));
|
|
1870
|
+
}, "WithRemote");
|
|
1759
1871
|
|
|
1760
1872
|
// src/components/chain/render/dynamic/flexbox/Flexbox.tsx
|
|
1761
1873
|
var DynamicBlockchainRenderFlexbox = {
|
|
@@ -1767,154 +1879,155 @@ var DynamicBlockchainRenderFlexbox = {
|
|
|
1767
1879
|
// src/components/chain/render/static/flexbox/variants/Base.tsx
|
|
1768
1880
|
import { ErrorRender as ErrorRender6 } from "@xylabs/react-error";
|
|
1769
1881
|
import { FlexCol as FlexCol6, FlexGrowRow as FlexGrowRow2 } from "@xylabs/react-flexbox";
|
|
1882
|
+
import React38 from "react";
|
|
1770
1883
|
|
|
1771
1884
|
// src/components/chain/render/static/hooks/useStaticBlockRenderComponents.ts
|
|
1772
1885
|
import { exists } from "@xylabs/exists";
|
|
1773
1886
|
import { useMemo as useMemo17 } from "react";
|
|
1774
1887
|
var DEFAULT_PAGE_SIZE = 25;
|
|
1775
|
-
var useStaticBlockRenderComponents = (BlockComponent, blockChainRenderProps) => {
|
|
1888
|
+
var useStaticBlockRenderComponents = /* @__PURE__ */ __name((BlockComponent, blockChainRenderProps) => {
|
|
1776
1889
|
const { maxBlocks } = blockChainRenderProps ?? {};
|
|
1777
1890
|
const pageSize = blockChainRenderProps?.pageSize ?? DEFAULT_PAGE_SIZE;
|
|
1778
|
-
const chainIteratorParams = useMemo17(() => blockChainRenderProps ?? {
|
|
1891
|
+
const chainIteratorParams = useMemo17(() => blockChainRenderProps ?? {
|
|
1892
|
+
name: "unknown"
|
|
1893
|
+
}, [
|
|
1894
|
+
blockChainRenderProps
|
|
1895
|
+
]);
|
|
1779
1896
|
const [params, paramsError] = useChainIteratorParams(chainIteratorParams);
|
|
1780
1897
|
const [blocks, blocksError] = useIterateChain(params, maxBlocks);
|
|
1781
1898
|
const { blockComponents, errors: blockComponentsError } = useStaticBlockComponents(BlockComponent, params, blocks);
|
|
1782
|
-
const {
|
|
1783
|
-
onPageChange,
|
|
1784
|
-
page,
|
|
1785
|
-
paginatedBlockComponents
|
|
1786
|
-
} = useChainPagination(pageSize, blockComponents);
|
|
1899
|
+
const { onPageChange, page, paginatedBlockComponents } = useChainPagination(pageSize, blockComponents);
|
|
1787
1900
|
return {
|
|
1788
1901
|
paginatedBlockComponents,
|
|
1789
1902
|
blockComponents,
|
|
1790
|
-
errors: [
|
|
1903
|
+
errors: [
|
|
1904
|
+
paramsError,
|
|
1905
|
+
blocksError,
|
|
1906
|
+
blockComponentsError
|
|
1907
|
+
].filter(exists),
|
|
1791
1908
|
onPageChange,
|
|
1792
1909
|
page,
|
|
1793
1910
|
pageSize
|
|
1794
1911
|
};
|
|
1795
|
-
};
|
|
1912
|
+
}, "useStaticBlockRenderComponents");
|
|
1796
1913
|
|
|
1797
1914
|
// src/components/chain/render/static/flexbox/variants/Base.tsx
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1915
|
+
var StaticListBase = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1916
|
+
const { blockComponents, errors, paginatedBlockComponents, onPageChange, page, pageSize } = useStaticBlockRenderComponents(BlockHeadingFlexbox, blockChainRenderProps);
|
|
1917
|
+
return /* @__PURE__ */ React38.createElement(FlexCol6, {
|
|
1918
|
+
alignItems: "start",
|
|
1919
|
+
gap: 2,
|
|
1920
|
+
width: "100%",
|
|
1921
|
+
...props
|
|
1922
|
+
}, errors?.map((error) => /* @__PURE__ */ React38.createElement(ErrorRender6, {
|
|
1923
|
+
error,
|
|
1924
|
+
key: error.name,
|
|
1925
|
+
scope: "StaticBlockchainFlexboxInner"
|
|
1926
|
+
})), (paginatedBlockComponents?.length ?? 0) > 0 ? /* @__PURE__ */ React38.createElement(FlexGrowRow2, {
|
|
1927
|
+
justifyContent: "space-between",
|
|
1928
|
+
width: "100%"
|
|
1929
|
+
}, /* @__PURE__ */ React38.createElement(ChainAnalyzerStatsDialogFromContext, null), /* @__PURE__ */ React38.createElement(BlockChainPagination, {
|
|
1930
|
+
count: blockComponents?.length ?? 0,
|
|
1804
1931
|
onPageChange,
|
|
1805
1932
|
page,
|
|
1806
|
-
pageSize
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
/* @__PURE__ */ jsx38(ChainAnalyzerStatsDialogFromContext, {}),
|
|
1812
|
-
/* @__PURE__ */ jsx38(BlockChainPagination, { count: blockComponents?.length ?? 0, onPageChange, page, rowsPerPage: pageSize })
|
|
1813
|
-
] }) : null,
|
|
1814
|
-
/* @__PURE__ */ jsx38(BlockListAnimated, { blockChainRenderComponents: paginatedBlockComponents })
|
|
1815
|
-
] });
|
|
1816
|
-
};
|
|
1933
|
+
rowsPerPage: pageSize
|
|
1934
|
+
})) : null, /* @__PURE__ */ React38.createElement(BlockListAnimated, {
|
|
1935
|
+
blockChainRenderComponents: paginatedBlockComponents
|
|
1936
|
+
}));
|
|
1937
|
+
}, "StaticListBase");
|
|
1817
1938
|
|
|
1818
1939
|
// src/components/chain/render/static/flexbox/variants/WithAnalysis.tsx
|
|
1819
1940
|
import { isAddress as isAddress2 } from "@xylabs/hex";
|
|
1820
1941
|
import { ChainProducersAnalyzer as ChainProducersAnalyzer2 } from "@xyo-network/chain-analyze";
|
|
1821
|
-
import { useMemo as useMemo18 } from "react";
|
|
1822
|
-
|
|
1823
|
-
var WithAnalysis2 = ({ blockChainRenderProps, ...props }) => {
|
|
1942
|
+
import React39, { useMemo as useMemo18 } from "react";
|
|
1943
|
+
var WithAnalysis2 = /* @__PURE__ */ __name(({ blockChainRenderProps, ...props }) => {
|
|
1824
1944
|
const { chainId } = blockChainRenderProps ?? {};
|
|
1825
1945
|
const analyzers = useMemo18(() => {
|
|
1826
1946
|
if (isAddress2(chainId)) {
|
|
1827
|
-
return {
|
|
1947
|
+
return {
|
|
1948
|
+
producers: new ChainProducersAnalyzer2()
|
|
1949
|
+
};
|
|
1828
1950
|
}
|
|
1829
|
-
}, [
|
|
1830
|
-
|
|
1831
|
-
|
|
1951
|
+
}, [
|
|
1952
|
+
chainId
|
|
1953
|
+
]);
|
|
1954
|
+
return /* @__PURE__ */ React39.createElement(ChainAnalyzersProvider, {
|
|
1955
|
+
analyzers
|
|
1956
|
+
}, /* @__PURE__ */ React39.createElement(StaticListBase, {
|
|
1957
|
+
blockChainRenderProps,
|
|
1958
|
+
...props
|
|
1959
|
+
}));
|
|
1960
|
+
}, "WithAnalysis");
|
|
1832
1961
|
|
|
1833
1962
|
// src/components/chain/render/static/flexbox/Flexbox.tsx
|
|
1834
|
-
var StaticBlockchainRenderFlexBox = {
|
|
1963
|
+
var StaticBlockchainRenderFlexBox = {
|
|
1964
|
+
Base: StaticListBase,
|
|
1965
|
+
WithAnalysis: WithAnalysis2
|
|
1966
|
+
};
|
|
1835
1967
|
|
|
1836
1968
|
// src/components/payload/builder/Flexbox.tsx
|
|
1837
1969
|
import { FlexCol as FlexCol7 } from "@xylabs/react-flexbox";
|
|
1838
1970
|
import { JsonViewerEx as JsonViewerEx2 } from "@xyo-network/react-payload-raw-info";
|
|
1839
|
-
import { useState as useState14 } from "react";
|
|
1840
|
-
|
|
1841
|
-
var PayloadBuilderFlexbox = ({
|
|
1842
|
-
BuilderComponent,
|
|
1843
|
-
onBuild,
|
|
1844
|
-
...props
|
|
1845
|
-
}) => {
|
|
1971
|
+
import React40, { useState as useState14 } from "react";
|
|
1972
|
+
var PayloadBuilderFlexbox = /* @__PURE__ */ __name(({ BuilderComponent, onBuild, ...props }) => {
|
|
1846
1973
|
const [payload, setPayload] = useState14();
|
|
1847
|
-
const onBuildLocal = (payload2) => {
|
|
1974
|
+
const onBuildLocal = /* @__PURE__ */ __name((payload2) => {
|
|
1848
1975
|
onBuild?.(payload2);
|
|
1849
1976
|
setPayload(payload2);
|
|
1850
|
-
};
|
|
1851
|
-
return /* @__PURE__ */
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1977
|
+
}, "onBuildLocal");
|
|
1978
|
+
return /* @__PURE__ */ React40.createElement(FlexCol7, {
|
|
1979
|
+
gap: 2,
|
|
1980
|
+
...props
|
|
1981
|
+
}, /* @__PURE__ */ React40.createElement(BuilderComponent, {
|
|
1982
|
+
onBuild: onBuildLocal
|
|
1983
|
+
}), payload && /* @__PURE__ */ React40.createElement(JsonViewerEx2, {
|
|
1984
|
+
value: payload
|
|
1985
|
+
}));
|
|
1986
|
+
}, "PayloadBuilderFlexbox");
|
|
1856
1987
|
|
|
1857
1988
|
// src/components/payload/builder/producer-intent/Form.tsx
|
|
1858
1989
|
import { Button as Button5, FormControl as FormControl5 } from "@mui/material";
|
|
1859
1990
|
import { createProducerChainStakeIntent } from "@xyo-network/chain-protocol";
|
|
1860
|
-
import { useMemo as useMemo20, useState as useState17 } from "react";
|
|
1991
|
+
import React43, { useMemo as useMemo20, useState as useState17 } from "react";
|
|
1861
1992
|
|
|
1862
1993
|
// src/components/payload/fields/BlockNumberTextField.tsx
|
|
1863
|
-
import {
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
TextField as TextField3
|
|
1867
|
-
} from "@mui/material";
|
|
1868
|
-
import { useState as useState15 } from "react";
|
|
1869
|
-
import { jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
1870
|
-
var BlockNumberTextField = ({
|
|
1871
|
-
errorMessage,
|
|
1872
|
-
onBlockNumberChanged,
|
|
1873
|
-
onChange,
|
|
1874
|
-
...props
|
|
1875
|
-
}) => {
|
|
1994
|
+
import { FormControl as FormControl3, FormHelperText as FormHelperText2, TextField as TextField3 } from "@mui/material";
|
|
1995
|
+
import React41, { useState as useState15 } from "react";
|
|
1996
|
+
var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumberChanged, onChange, ...props }) => {
|
|
1876
1997
|
const [blockNumber, setBlockNumber] = useState15();
|
|
1877
|
-
const handleChange = (e) => {
|
|
1998
|
+
const handleChange = /* @__PURE__ */ __name((e) => {
|
|
1878
1999
|
const value = e.target.value.replaceAll(/\D/g, "");
|
|
1879
2000
|
setBlockNumber(value.length > 0 ? Number(value) : void 0);
|
|
1880
2001
|
onBlockNumberChanged?.(Number.parseInt(value));
|
|
1881
2002
|
onChange?.(e);
|
|
1882
|
-
};
|
|
2003
|
+
}, "handleChange");
|
|
1883
2004
|
const errored = errorMessage !== void 0;
|
|
1884
|
-
return /* @__PURE__ */
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
};
|
|
2005
|
+
return /* @__PURE__ */ React41.createElement(FormControl3, {
|
|
2006
|
+
fullWidth: true
|
|
2007
|
+
}, /* @__PURE__ */ React41.createElement(TextField3, {
|
|
2008
|
+
error: errored,
|
|
2009
|
+
onChange: handleChange,
|
|
2010
|
+
type: "number",
|
|
2011
|
+
value: blockNumber ?? "",
|
|
2012
|
+
...props
|
|
2013
|
+
}), errored && /* @__PURE__ */ React41.createElement(FormHelperText2, {
|
|
2014
|
+
sx: {
|
|
2015
|
+
color: "error.main"
|
|
2016
|
+
}
|
|
2017
|
+
}, errorMessage));
|
|
2018
|
+
}, "BlockNumberTextField");
|
|
1898
2019
|
|
|
1899
2020
|
// src/components/payload/fields/XyoAddressTextField.tsx
|
|
1900
|
-
import {
|
|
1901
|
-
FormControl as FormControl4,
|
|
1902
|
-
FormHelperText as FormHelperText3,
|
|
1903
|
-
TextField as TextField4
|
|
1904
|
-
} from "@mui/material";
|
|
2021
|
+
import { FormControl as FormControl4, FormHelperText as FormHelperText3, TextField as TextField4 } from "@mui/material";
|
|
1905
2022
|
import { asAddress, isAddress as isAddress3 } from "@xylabs/hex";
|
|
1906
|
-
import { useMemo as useMemo19, useState as useState16 } from "react";
|
|
1907
|
-
|
|
1908
|
-
var XyoAddressTextField = ({
|
|
1909
|
-
onAddressChanged,
|
|
1910
|
-
onChange,
|
|
1911
|
-
resetValue,
|
|
1912
|
-
...props
|
|
1913
|
-
}) => {
|
|
2023
|
+
import React42, { useMemo as useMemo19, useState as useState16 } from "react";
|
|
2024
|
+
var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange, resetValue, ...props }) => {
|
|
1914
2025
|
const [address, setAddress] = useState16("");
|
|
1915
2026
|
const [addressError, setAddressError] = useState16();
|
|
1916
|
-
useMemo19(() => setAddress(""), [
|
|
1917
|
-
|
|
2027
|
+
useMemo19(() => setAddress(""), [
|
|
2028
|
+
resetValue
|
|
2029
|
+
]);
|
|
2030
|
+
const handleChange = /* @__PURE__ */ __name((event) => {
|
|
1918
2031
|
const { value } = event.target;
|
|
1919
2032
|
onChange?.(event);
|
|
1920
2033
|
const xyoAddress = asAddress(value);
|
|
@@ -1923,32 +2036,31 @@ var XyoAddressTextField = ({
|
|
|
1923
2036
|
}
|
|
1924
2037
|
setAddressError(void 0);
|
|
1925
2038
|
setAddress(value);
|
|
1926
|
-
};
|
|
1927
|
-
const handleBlur = () => {
|
|
2039
|
+
}, "handleChange");
|
|
2040
|
+
const handleBlur = /* @__PURE__ */ __name(() => {
|
|
1928
2041
|
const xyoAddress = asAddress(address);
|
|
1929
2042
|
if (!isAddress3(xyoAddress)) {
|
|
1930
2043
|
setAddressError(new Error("Invalid address"));
|
|
1931
2044
|
onAddressChanged?.();
|
|
1932
2045
|
}
|
|
1933
|
-
};
|
|
1934
|
-
return /* @__PURE__ */
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
};
|
|
2046
|
+
}, "handleBlur");
|
|
2047
|
+
return /* @__PURE__ */ React42.createElement(FormControl4, {
|
|
2048
|
+
fullWidth: true
|
|
2049
|
+
}, /* @__PURE__ */ React42.createElement(TextField4, {
|
|
2050
|
+
error: !!addressError,
|
|
2051
|
+
onBlur: handleBlur,
|
|
2052
|
+
onChange: handleChange,
|
|
2053
|
+
value: address,
|
|
2054
|
+
...props
|
|
2055
|
+
}), addressError && /* @__PURE__ */ React42.createElement(FormHelperText3, {
|
|
2056
|
+
sx: {
|
|
2057
|
+
color: "error.main"
|
|
2058
|
+
}
|
|
2059
|
+
}, addressError.message));
|
|
2060
|
+
}, "XyoAddressTextField");
|
|
1948
2061
|
|
|
1949
2062
|
// src/components/payload/builder/producer-intent/Form.tsx
|
|
1950
|
-
|
|
1951
|
-
var ProducerIntentBuilderForm = ({ onBuild }) => {
|
|
2063
|
+
var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
1952
2064
|
const [delegate, setDelegate] = useState17();
|
|
1953
2065
|
const [exp, setExp] = useState17();
|
|
1954
2066
|
const [nbf, setNbf] = useState17();
|
|
@@ -1965,66 +2077,64 @@ var ProducerIntentBuilderForm = ({ onBuild }) => {
|
|
|
1965
2077
|
}
|
|
1966
2078
|
}
|
|
1967
2079
|
}
|
|
1968
|
-
}, [
|
|
1969
|
-
|
|
2080
|
+
}, [
|
|
2081
|
+
delegate,
|
|
2082
|
+
exp,
|
|
2083
|
+
nbf
|
|
2084
|
+
]);
|
|
2085
|
+
const onBuildLocal = /* @__PURE__ */ __name(() => {
|
|
1970
2086
|
if (onBuild && intentPayload) onBuild?.(intentPayload);
|
|
1971
|
-
};
|
|
1972
|
-
return /* @__PURE__ */
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
}
|
|
2087
|
+
}, "onBuildLocal");
|
|
2088
|
+
return /* @__PURE__ */ React43.createElement(React43.Fragment, null, /* @__PURE__ */ React43.createElement(FormControl5, {
|
|
2089
|
+
fullWidth: true
|
|
2090
|
+
}, /* @__PURE__ */ React43.createElement(XyoAddressTextField, {
|
|
2091
|
+
label: "Delegate",
|
|
2092
|
+
name: "delegate",
|
|
2093
|
+
onAddressChanged: setDelegate,
|
|
2094
|
+
required: true,
|
|
2095
|
+
size: "small"
|
|
2096
|
+
})), /* @__PURE__ */ React43.createElement(FormControl5, {
|
|
2097
|
+
fullWidth: true
|
|
2098
|
+
}, /* @__PURE__ */ React43.createElement(BlockNumberTextField, {
|
|
2099
|
+
errorMessage: blockRangeError?.message,
|
|
2100
|
+
label: "Expires",
|
|
2101
|
+
name: "exp",
|
|
2102
|
+
onBlockNumberChanged: setExp,
|
|
2103
|
+
required: true,
|
|
2104
|
+
size: "small"
|
|
2105
|
+
})), /* @__PURE__ */ React43.createElement(FormControl5, {
|
|
2106
|
+
fullWidth: true
|
|
2107
|
+
}, /* @__PURE__ */ React43.createElement(BlockNumberTextField, {
|
|
2108
|
+
errorMessage: blockRangeError?.message,
|
|
2109
|
+
label: "Not Before",
|
|
2110
|
+
name: "nbf",
|
|
2111
|
+
onBlockNumberChanged: setNbf,
|
|
2112
|
+
required: true,
|
|
2113
|
+
size: "small"
|
|
2114
|
+
})), /* @__PURE__ */ React43.createElement(Button5, {
|
|
2115
|
+
disabled: !intentPayload,
|
|
2116
|
+
variant: "contained",
|
|
2117
|
+
onClick: onBuildLocal
|
|
2118
|
+
}, "Build"));
|
|
2119
|
+
}, "ProducerIntentBuilderForm");
|
|
2120
|
+
|
|
2121
|
+
// src/components/payload/builder/transfer/Flexbox.tsx
|
|
2122
|
+
import React46 from "react";
|
|
1999
2123
|
|
|
2000
2124
|
// src/components/payload/builder/transfer/Form.tsx
|
|
2001
2125
|
import { Button as Button6, FormControl as FormControl7 } from "@mui/material";
|
|
2002
2126
|
import { isAddress as isAddress5 } from "@xylabs/hex";
|
|
2003
2127
|
import { TransferSchema } from "@xyo-network/xl1-protocol";
|
|
2004
|
-
import { useMemo as useMemo22, useState as useState19 } from "react";
|
|
2128
|
+
import React45, { useMemo as useMemo22, useState as useState19 } from "react";
|
|
2005
2129
|
|
|
2006
2130
|
// src/components/payload/builder/transfer/builder/SingleFlexbox.tsx
|
|
2007
2131
|
import { RemoveCircle } from "@mui/icons-material";
|
|
2008
|
-
import {
|
|
2009
|
-
FormControl as FormControl6,
|
|
2010
|
-
Icon as Icon3,
|
|
2011
|
-
IconButton as IconButton5
|
|
2012
|
-
} from "@mui/material";
|
|
2132
|
+
import { FormControl as FormControl6, Icon as Icon3, IconButton as IconButton5 } from "@mui/material";
|
|
2013
2133
|
import { isAddress as isAddress4, toHex as toHex3 } from "@xylabs/hex";
|
|
2014
2134
|
import { FlexRow as FlexRow7 } from "@xylabs/react-flexbox";
|
|
2015
2135
|
import { BigIntInput } from "@xyo-network/react-shared";
|
|
2016
|
-
import {
|
|
2017
|
-
|
|
2018
|
-
useMemo as useMemo21,
|
|
2019
|
-
useState as useState18
|
|
2020
|
-
} from "react";
|
|
2021
|
-
import { jsx as jsx44, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2022
|
-
var SingleTransferBuilderFlexbox = ({
|
|
2023
|
-
onTransferUpdated,
|
|
2024
|
-
onRemoveTransfer,
|
|
2025
|
-
singleTransfer,
|
|
2026
|
-
...props
|
|
2027
|
-
}) => {
|
|
2136
|
+
import React44, { useEffect as useEffect4, useMemo as useMemo21, useState as useState18 } from "react";
|
|
2137
|
+
var SingleTransferBuilderFlexbox = /* @__PURE__ */ __name(({ onTransferUpdated, onRemoveTransfer, singleTransfer, ...props }) => {
|
|
2028
2138
|
const [toAddress3, setToAddress] = useState18();
|
|
2029
2139
|
const [amount, setAmount] = useState18();
|
|
2030
2140
|
const transferAmount = useMemo21(() => {
|
|
@@ -2035,20 +2145,42 @@ var SingleTransferBuilderFlexbox = ({
|
|
|
2035
2145
|
to: toAddress3
|
|
2036
2146
|
};
|
|
2037
2147
|
}
|
|
2038
|
-
}, [
|
|
2148
|
+
}, [
|
|
2149
|
+
toAddress3,
|
|
2150
|
+
amount
|
|
2151
|
+
]);
|
|
2039
2152
|
useEffect4(() => {
|
|
2040
2153
|
if (transferAmount) onTransferUpdated?.(transferAmount);
|
|
2041
|
-
}, [
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2154
|
+
}, [
|
|
2155
|
+
transferAmount
|
|
2156
|
+
]);
|
|
2157
|
+
return /* @__PURE__ */ React44.createElement(FlexRow7, {
|
|
2158
|
+
alignItems: "start",
|
|
2159
|
+
gap: 1,
|
|
2160
|
+
...props
|
|
2161
|
+
}, /* @__PURE__ */ React44.createElement(FormControl6, {
|
|
2162
|
+
fullWidth: true
|
|
2163
|
+
}, /* @__PURE__ */ React44.createElement(XyoAddressTextField, {
|
|
2164
|
+
label: "To",
|
|
2165
|
+
name: "to",
|
|
2166
|
+
onAddressChanged: setToAddress,
|
|
2167
|
+
required: true,
|
|
2168
|
+
size: "small"
|
|
2169
|
+
})), /* @__PURE__ */ React44.createElement(FormControl6, {
|
|
2170
|
+
fullWidth: true
|
|
2171
|
+
}, /* @__PURE__ */ React44.createElement(BigIntInput.TextField, {
|
|
2172
|
+
label: "Amount",
|
|
2173
|
+
name: "amount",
|
|
2174
|
+
onChangeFixedPoint: setAmount,
|
|
2175
|
+
required: true,
|
|
2176
|
+
size: "small"
|
|
2177
|
+
})), /* @__PURE__ */ React44.createElement(IconButton5, {
|
|
2178
|
+
onClick: /* @__PURE__ */ __name(() => onRemoveTransfer?.(singleTransfer.transferId), "onClick")
|
|
2179
|
+
}, /* @__PURE__ */ React44.createElement(Icon3, null, /* @__PURE__ */ React44.createElement(RemoveCircle, null))));
|
|
2180
|
+
}, "SingleTransferBuilderFlexbox");
|
|
2048
2181
|
|
|
2049
2182
|
// src/components/payload/builder/transfer/Form.tsx
|
|
2050
|
-
|
|
2051
|
-
var TransferBuilderForm = ({ onBuild }) => {
|
|
2183
|
+
var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
2052
2184
|
const [fromAddress, setFromAddress] = useState19();
|
|
2053
2185
|
const [transfers, setTransfers] = useState19([]);
|
|
2054
2186
|
const transferPayload = useMemo22(() => {
|
|
@@ -2064,58 +2196,70 @@ var TransferBuilderForm = ({ onBuild }) => {
|
|
|
2064
2196
|
epoch: Date.now()
|
|
2065
2197
|
};
|
|
2066
2198
|
}
|
|
2067
|
-
}, [
|
|
2068
|
-
|
|
2199
|
+
}, [
|
|
2200
|
+
fromAddress,
|
|
2201
|
+
transfers
|
|
2202
|
+
]);
|
|
2203
|
+
const onBuildLocal = /* @__PURE__ */ __name(() => {
|
|
2069
2204
|
if (onBuild && transferPayload) onBuild?.(transferPayload);
|
|
2070
|
-
};
|
|
2071
|
-
const onTransferAdded = () => {
|
|
2205
|
+
}, "onBuildLocal");
|
|
2206
|
+
const onTransferAdded = /* @__PURE__ */ __name(() => {
|
|
2072
2207
|
const transferAmount = {
|
|
2073
2208
|
amount: "",
|
|
2074
2209
|
transferId: Date.now(),
|
|
2075
2210
|
to: ""
|
|
2076
2211
|
};
|
|
2077
|
-
setTransfers((prev) => [
|
|
2078
|
-
|
|
2079
|
-
|
|
2212
|
+
setTransfers((prev) => [
|
|
2213
|
+
...prev,
|
|
2214
|
+
transferAmount
|
|
2215
|
+
]);
|
|
2216
|
+
}, "onTransferAdded");
|
|
2217
|
+
const onTransferRemoved = /* @__PURE__ */ __name((transferId) => {
|
|
2080
2218
|
setTransfers((prev) => prev.filter((transfer) => transfer.transferId !== transferId));
|
|
2081
|
-
};
|
|
2082
|
-
const onTransferUpdated = (singleTransfer) => {
|
|
2219
|
+
}, "onTransferRemoved");
|
|
2220
|
+
const onTransferUpdated = /* @__PURE__ */ __name((singleTransfer) => {
|
|
2083
2221
|
setTransfers((prev) => prev.map((transfer) => {
|
|
2084
2222
|
if (transfer.transferId === singleTransfer.transferId) {
|
|
2085
2223
|
return singleTransfer;
|
|
2086
2224
|
}
|
|
2087
2225
|
return transfer;
|
|
2088
2226
|
}));
|
|
2089
|
-
};
|
|
2090
|
-
return /* @__PURE__ */
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2227
|
+
}, "onTransferUpdated");
|
|
2228
|
+
return /* @__PURE__ */ React45.createElement(React45.Fragment, null, /* @__PURE__ */ React45.createElement(FormControl7, {
|
|
2229
|
+
fullWidth: true
|
|
2230
|
+
}, /* @__PURE__ */ React45.createElement(XyoAddressTextField, {
|
|
2231
|
+
label: "From",
|
|
2232
|
+
name: "from",
|
|
2233
|
+
onAddressChanged: setFromAddress,
|
|
2234
|
+
required: true,
|
|
2235
|
+
size: "small"
|
|
2236
|
+
})), /* @__PURE__ */ React45.createElement(Button6, {
|
|
2237
|
+
onClick: onTransferAdded,
|
|
2238
|
+
size: "small",
|
|
2239
|
+
variant: "contained"
|
|
2240
|
+
}, "Add Transfer"), transfers.map((transfer) => /* @__PURE__ */ React45.createElement(SingleTransferBuilderFlexbox, {
|
|
2241
|
+
key: transfer.transferId,
|
|
2242
|
+
onTransferUpdated,
|
|
2243
|
+
onRemoveTransfer: onTransferRemoved,
|
|
2244
|
+
singleTransfer: transfer,
|
|
2245
|
+
sx: {
|
|
2246
|
+
width: "100%"
|
|
2247
|
+
}
|
|
2248
|
+
})), /* @__PURE__ */ React45.createElement(Button6, {
|
|
2249
|
+
disabled: !transferPayload,
|
|
2250
|
+
variant: "contained",
|
|
2251
|
+
onClick: onBuildLocal
|
|
2252
|
+
}, "Build"));
|
|
2253
|
+
}, "TransferBuilderForm");
|
|
2106
2254
|
|
|
2107
2255
|
// src/components/payload/builder/transfer/Flexbox.tsx
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
onBuild,
|
|
2116
|
-
...props
|
|
2117
|
-
}
|
|
2118
|
-
);
|
|
2256
|
+
var TransferBuilderFlexbox = /* @__PURE__ */ __name(({ onBuild, ...props }) => /* @__PURE__ */ React46.createElement(PayloadBuilderFlexbox, {
|
|
2257
|
+
gap: 4,
|
|
2258
|
+
alignItems: "start",
|
|
2259
|
+
BuilderComponent: TransferBuilderForm,
|
|
2260
|
+
onBuild,
|
|
2261
|
+
...props
|
|
2262
|
+
}), "TransferBuilderFlexbox");
|
|
2119
2263
|
|
|
2120
2264
|
// src/stories/ChainArchivistDecorator.tsx
|
|
2121
2265
|
import { CircularProgress } from "@mui/material";
|
|
@@ -2124,24 +2268,35 @@ import { MemoryArchivist } from "@xyo-network/archivist-memory";
|
|
|
2124
2268
|
import { ArchivistConfigSchema } from "@xyo-network/archivist-model";
|
|
2125
2269
|
import { buildRandomBlockChain } from "@xyo-network/react-chain-shared";
|
|
2126
2270
|
import { flattenHydratedBlocks } from "@xyo-network/xl1-protocol-sdk";
|
|
2127
|
-
import { useEffect as useEffect5 } from "react";
|
|
2128
|
-
|
|
2129
|
-
var ChainArchivistDecorator = (Story, context) => {
|
|
2271
|
+
import React47, { useEffect as useEffect5 } from "react";
|
|
2272
|
+
var ChainArchivistDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
2130
2273
|
const [randomBlockChain] = usePromise7(async () => await buildRandomBlockChain(), []);
|
|
2131
2274
|
const [blockChainRenderProps, blockChainRenderPropsError] = usePromise7(async () => {
|
|
2132
2275
|
if (randomBlockChain) {
|
|
2133
|
-
const chainArchivist = await MemoryArchivist.create({
|
|
2276
|
+
const chainArchivist = await MemoryArchivist.create({
|
|
2277
|
+
config: {
|
|
2278
|
+
schema: ArchivistConfigSchema,
|
|
2279
|
+
name: "ChainArchivist"
|
|
2280
|
+
}
|
|
2281
|
+
});
|
|
2134
2282
|
const flattened = flattenHydratedBlocks(randomBlockChain);
|
|
2135
2283
|
await chainArchivist.insert(flattened);
|
|
2136
2284
|
const chainId = await getChainId();
|
|
2137
|
-
return {
|
|
2285
|
+
return {
|
|
2286
|
+
chainArchivist,
|
|
2287
|
+
chainId
|
|
2288
|
+
};
|
|
2138
2289
|
}
|
|
2139
|
-
}, [
|
|
2290
|
+
}, [
|
|
2291
|
+
randomBlockChain
|
|
2292
|
+
]);
|
|
2140
2293
|
useEffect5(() => {
|
|
2141
2294
|
if (blockChainRenderPropsError) {
|
|
2142
2295
|
console.error(blockChainRenderPropsError);
|
|
2143
2296
|
}
|
|
2144
|
-
}, [
|
|
2297
|
+
}, [
|
|
2298
|
+
blockChainRenderPropsError
|
|
2299
|
+
]);
|
|
2145
2300
|
const props = {
|
|
2146
2301
|
...context,
|
|
2147
2302
|
args: {
|
|
@@ -2153,8 +2308,8 @@ var ChainArchivistDecorator = (Story, context) => {
|
|
|
2153
2308
|
}
|
|
2154
2309
|
}
|
|
2155
2310
|
};
|
|
2156
|
-
return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */
|
|
2157
|
-
};
|
|
2311
|
+
return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */ React47.createElement(Story, props) : /* @__PURE__ */ React47.createElement(CircularProgress, null);
|
|
2312
|
+
}, "ChainArchivistDecorator");
|
|
2158
2313
|
|
|
2159
2314
|
// src/stories/ChainArchivistDelayedInsertDecorator.tsx
|
|
2160
2315
|
import { CircularProgress as CircularProgress2 } from "@mui/material";
|
|
@@ -2164,17 +2319,21 @@ import { MemoryArchivist as MemoryArchivist2 } from "@xyo-network/archivist-memo
|
|
|
2164
2319
|
import { ArchivistConfigSchema as ArchivistConfigSchema2 } from "@xyo-network/archivist-model";
|
|
2165
2320
|
import { buildRandomBlockChain as buildRandomBlockChain2 } from "@xyo-network/react-chain-shared";
|
|
2166
2321
|
import { flattenHydratedBlock } from "@xyo-network/xl1-protocol-sdk";
|
|
2167
|
-
import { useEffect as useEffect6, useState as useState20 } from "react";
|
|
2168
|
-
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
2322
|
+
import React48, { useEffect as useEffect6, useState as useState20 } from "react";
|
|
2169
2323
|
var chainArchivistRef;
|
|
2170
|
-
var ChainArchivistDelayedInsertDecorator = (Story, context) => {
|
|
2324
|
+
var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
2171
2325
|
const [firstBlock, setFirstBlock] = useState20();
|
|
2172
2326
|
const [randomBlockChain] = usePromise8(async () => await buildRandomBlockChain2(), []);
|
|
2173
2327
|
const [chainArchivist] = usePromise8(async () => {
|
|
2174
2328
|
if (chainArchivistRef) {
|
|
2175
2329
|
return chainArchivistRef;
|
|
2176
2330
|
} else {
|
|
2177
|
-
chainArchivistRef = await MemoryArchivist2.create({
|
|
2331
|
+
chainArchivistRef = await MemoryArchivist2.create({
|
|
2332
|
+
config: {
|
|
2333
|
+
schema: ArchivistConfigSchema2,
|
|
2334
|
+
name: "ChainArchivist"
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2178
2337
|
return chainArchivistRef;
|
|
2179
2338
|
}
|
|
2180
2339
|
}, []);
|
|
@@ -2187,16 +2346,26 @@ var ChainArchivistDelayedInsertDecorator = (Story, context) => {
|
|
|
2187
2346
|
await delay(1e3);
|
|
2188
2347
|
}
|
|
2189
2348
|
}
|
|
2190
|
-
}, [
|
|
2349
|
+
}, [
|
|
2350
|
+
chainArchivist,
|
|
2351
|
+
randomBlockChain
|
|
2352
|
+
]);
|
|
2191
2353
|
useEffect6(() => {
|
|
2192
2354
|
if (delayedInsertError) {
|
|
2193
2355
|
console.error(delayedInsertError);
|
|
2194
2356
|
}
|
|
2195
|
-
}, [
|
|
2357
|
+
}, [
|
|
2358
|
+
delayedInsertError
|
|
2359
|
+
]);
|
|
2196
2360
|
const [blockChainRenderProps] = usePromise8(async () => {
|
|
2197
2361
|
const chainId = await getChainId();
|
|
2198
|
-
return {
|
|
2199
|
-
|
|
2362
|
+
return {
|
|
2363
|
+
chainArchivist,
|
|
2364
|
+
chainId
|
|
2365
|
+
};
|
|
2366
|
+
}, [
|
|
2367
|
+
chainArchivist
|
|
2368
|
+
]);
|
|
2200
2369
|
const props = {
|
|
2201
2370
|
...context,
|
|
2202
2371
|
args: {
|
|
@@ -2208,8 +2377,8 @@ var ChainArchivistDelayedInsertDecorator = (Story, context) => {
|
|
|
2208
2377
|
}
|
|
2209
2378
|
}
|
|
2210
2379
|
};
|
|
2211
|
-
return firstBlock ? /* @__PURE__ */
|
|
2212
|
-
};
|
|
2380
|
+
return firstBlock ? /* @__PURE__ */ React48.createElement(Story, props) : /* @__PURE__ */ React48.createElement(CircularProgress2, null);
|
|
2381
|
+
}, "ChainArchivistDelayedInsertDecorator");
|
|
2213
2382
|
|
|
2214
2383
|
// src/stories/ChainInfoContextDecorator.tsx
|
|
2215
2384
|
import { assertEx as assertEx5 } from "@xylabs/assert";
|
|
@@ -2218,12 +2387,12 @@ import { isDefined as isDefined4 } from "@xylabs/typeof";
|
|
|
2218
2387
|
import { ChainBlockNumberIterationService as ChainBlockNumberIterationService3 } from "@xyo-network/chain-services";
|
|
2219
2388
|
import { findFirstMatching } from "@xyo-network/chain-utils";
|
|
2220
2389
|
import { isBlockBoundWitness as isBlockBoundWitness3 } from "@xyo-network/xl1-protocol";
|
|
2221
|
-
import
|
|
2390
|
+
import React49 from "react";
|
|
2222
2391
|
var archivistConfig = {
|
|
2223
2392
|
url: "http://localhost:8080",
|
|
2224
2393
|
chainArchivistModuleId: "XYOPublic:XYOChain:Chain"
|
|
2225
2394
|
};
|
|
2226
|
-
var ChainInfoContextDecorator = (Story, context) => {
|
|
2395
|
+
var ChainInfoContextDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
2227
2396
|
const [chainIdResponse] = usePromise9(async () => {
|
|
2228
2397
|
return await getChainId();
|
|
2229
2398
|
}, []);
|
|
@@ -2235,11 +2404,21 @@ var ChainInfoContextDecorator = (Story, context) => {
|
|
|
2235
2404
|
if (isDefined4(chainArchivist) && isDefined4(chainId)) {
|
|
2236
2405
|
const firstMatch = assertEx5(await findFirstMatching(chainArchivist), () => `No head found in archivist: ${chainArchivist.id} `);
|
|
2237
2406
|
const head = assertEx5(isBlockBoundWitness3(firstMatch) ? firstMatch : void 0, () => `Expected a block bound witness: ${JSON.stringify(firstMatch)}`);
|
|
2238
|
-
return await ChainBlockNumberIterationService3.create({
|
|
2407
|
+
return await ChainBlockNumberIterationService3.create({
|
|
2408
|
+
chainArchivist,
|
|
2409
|
+
head
|
|
2410
|
+
});
|
|
2239
2411
|
}
|
|
2240
|
-
}, [
|
|
2241
|
-
|
|
2242
|
-
|
|
2412
|
+
}, [
|
|
2413
|
+
chainArchivist,
|
|
2414
|
+
chainId
|
|
2415
|
+
]);
|
|
2416
|
+
return /* @__PURE__ */ React49.createElement(ChainInfoProvider, {
|
|
2417
|
+
chainArchivist,
|
|
2418
|
+
chainId,
|
|
2419
|
+
chainIterator
|
|
2420
|
+
}, /* @__PURE__ */ React49.createElement(Story, context));
|
|
2421
|
+
}, "ChainInfoContextDecorator");
|
|
2243
2422
|
export {
|
|
2244
2423
|
BlockChainPagination,
|
|
2245
2424
|
BlockChainTableRow,
|