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