@xyo-network/react-chain-blockchain 1.17.7 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/components/block/hooks/index.d.ts +0 -2
- package/dist/browser/components/block/hooks/index.d.ts.map +1 -1
- package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts +6 -3
- package/dist/browser/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
- package/dist/browser/hooks/index.d.ts +0 -1
- package/dist/browser/hooks/index.d.ts.map +1 -1
- package/dist/browser/index.mjs +329 -556
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/stories/index.d.ts +0 -1
- package/dist/browser/stories/index.d.ts.map +1 -1
- package/package.json +18 -20
- package/src/components/block/hooks/index.ts +0 -2
- package/src/hooks/index.ts +0 -1
- package/src/stories/index.ts +0 -1
- package/dist/browser/components/block/hooks/useDynamicBlockComponents.d.ts +0 -9
- package/dist/browser/components/block/hooks/useDynamicBlockComponents.d.ts.map +0 -1
- package/dist/browser/components/block/hooks/useStaticBlockComponents.d.ts +0 -9
- package/dist/browser/components/block/hooks/useStaticBlockComponents.d.ts.map +0 -1
- package/dist/browser/hooks/useIterateChain.d.ts +0 -24
- package/dist/browser/hooks/useIterateChain.d.ts.map +0 -1
- package/dist/browser/stories/ChainInfoContextDecorator.d.ts +0 -3
- package/dist/browser/stories/ChainInfoContextDecorator.d.ts.map +0 -1
- package/src/components/block/hooks/useDynamicBlockComponents.ts +0 -42
- package/src/components/block/hooks/useStaticBlockComponents.ts +0 -34
- package/src/hooks/useIterateChain.ts +0 -59
- package/src/stories/ChainInfoContextDecorator.tsx +0 -48
package/dist/browser/index.mjs
CHANGED
|
@@ -4,11 +4,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
4
4
|
// src/components/account/BalanceHistoryFlexbox.tsx
|
|
5
5
|
import { Typography as Typography7 } from "@mui/material";
|
|
6
6
|
import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
|
|
7
|
-
import { isDefined as
|
|
7
|
+
import { isDefined as isDefined6 } from "@xylabs/sdk-js";
|
|
8
8
|
import { useAccountBalanceHistory } from "@xyo-network/react-chain-provider";
|
|
9
9
|
import { ErrorRender as ErrorRender3 } from "@xyo-network/react-error";
|
|
10
10
|
import { AttoXL1 } from "@xyo-network/xl1-protocol";
|
|
11
|
-
import
|
|
11
|
+
import React29 from "react";
|
|
12
12
|
|
|
13
13
|
// src/components/account/helpers/formatBalanceMagnitude.ts
|
|
14
14
|
import { XL1Amount } from "@xyo-network/xl1-protocol";
|
|
@@ -30,20 +30,20 @@ var formatBalance = /* @__PURE__ */ __name((balance) => {
|
|
|
30
30
|
|
|
31
31
|
// src/components/account/table/BalanceHistoryTableEx.tsx
|
|
32
32
|
import { TableBody as TableBody2, TableCell as TableCell14, TableHead as TableHead2, TableRow as TableRow4 } from "@mui/material";
|
|
33
|
-
import { isDefined as
|
|
33
|
+
import { isDefined as isDefined5 } from "@xylabs/sdk-js";
|
|
34
34
|
import { TableEx as TableEx2 } from "@xyo-network/react-table";
|
|
35
|
-
import
|
|
35
|
+
import React28 from "react";
|
|
36
36
|
|
|
37
37
|
// src/components/account/table/BalanceHistoryTableRow.tsx
|
|
38
38
|
import { TableCell as TableCell13, TableRow as TableRow3 } from "@mui/material";
|
|
39
39
|
import { RawInfoIconButton } from "@xyo-network/react-payload-raw-info";
|
|
40
|
-
import
|
|
40
|
+
import React27, { useMemo as useMemo8 } from "react";
|
|
41
41
|
|
|
42
42
|
// src/components/block/BlockHeadingFlexbox.tsx
|
|
43
43
|
import { FlexCol as FlexCol2, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
44
44
|
import { BWVerification, HashHeadingPaper } from "@xyo-network/react-boundwitness-plugin";
|
|
45
45
|
import { usePayloadHash } from "@xyo-network/react-shared";
|
|
46
|
-
import
|
|
46
|
+
import React11 from "react";
|
|
47
47
|
|
|
48
48
|
// src/context/analyzer/context.ts
|
|
49
49
|
import { createContextEx } from "@xylabs/react-shared";
|
|
@@ -53,64 +53,9 @@ var ChainAnalyzersContext = createContextEx();
|
|
|
53
53
|
import { useContextEx } from "@xylabs/react-shared";
|
|
54
54
|
var useChainAnalyzersContext = /* @__PURE__ */ __name((required = false) => useContextEx(ChainAnalyzersContext, "ChainAnalyzers", required), "useChainAnalyzersContext");
|
|
55
55
|
|
|
56
|
-
// src/context/chain/Context.ts
|
|
57
|
-
import { createContextEx as createContextEx2 } from "@xylabs/react-shared";
|
|
58
|
-
var ChainInfoContext = createContextEx2();
|
|
59
|
-
|
|
60
|
-
// src/context/chain/Provider.tsx
|
|
61
|
-
import React, { useMemo, useState } from "react";
|
|
62
|
-
var ChainInfoProvider = /* @__PURE__ */ __name(({ children, chainArchivist: chainArchivistProp, chainId: chainIdProp, chainIterator: chainIteratorProp }) => {
|
|
63
|
-
const [chainArchivist, setChainArchivist] = useState(chainArchivistProp);
|
|
64
|
-
const [chainId, setChainId] = useState(chainIdProp);
|
|
65
|
-
const [chainIterator, setChainIterator] = useState(chainIteratorProp);
|
|
66
|
-
const updateChainArchivist = /* @__PURE__ */ __name((chainArchivist2) => {
|
|
67
|
-
setChainArchivist(chainArchivist2);
|
|
68
|
-
}, "updateChainArchivist");
|
|
69
|
-
const updateChainId = /* @__PURE__ */ __name((chainId2) => {
|
|
70
|
-
setChainId(chainId2);
|
|
71
|
-
}, "updateChainId");
|
|
72
|
-
const updateChainIterator = /* @__PURE__ */ __name((chainIterator2) => {
|
|
73
|
-
setChainIterator(chainIterator2);
|
|
74
|
-
}, "updateChainIterator");
|
|
75
|
-
useMemo(() => {
|
|
76
|
-
updateChainArchivist(chainArchivistProp);
|
|
77
|
-
}, [
|
|
78
|
-
chainArchivistProp
|
|
79
|
-
]);
|
|
80
|
-
useMemo(() => {
|
|
81
|
-
updateChainId(chainIdProp);
|
|
82
|
-
}, [
|
|
83
|
-
chainIdProp
|
|
84
|
-
]);
|
|
85
|
-
useMemo(() => {
|
|
86
|
-
updateChainIterator(chainIteratorProp);
|
|
87
|
-
}, [
|
|
88
|
-
chainIteratorProp
|
|
89
|
-
]);
|
|
90
|
-
const chainState = useMemo(() => ({
|
|
91
|
-
chainArchivist,
|
|
92
|
-
chainId,
|
|
93
|
-
chainIterator,
|
|
94
|
-
updateChainArchivist,
|
|
95
|
-
updateChainId,
|
|
96
|
-
updateChainIterator,
|
|
97
|
-
provided: true
|
|
98
|
-
}), [
|
|
99
|
-
chainArchivist,
|
|
100
|
-
chainId,
|
|
101
|
-
chainIterator,
|
|
102
|
-
updateChainArchivist,
|
|
103
|
-
updateChainId,
|
|
104
|
-
updateChainIterator
|
|
105
|
-
]);
|
|
106
|
-
return /* @__PURE__ */ React.createElement(ChainInfoContext, {
|
|
107
|
-
value: chainState
|
|
108
|
-
}, children);
|
|
109
|
-
}, "ChainInfoProvider");
|
|
110
|
-
|
|
111
56
|
// src/context/polling/context.ts
|
|
112
|
-
import { createContextEx as
|
|
113
|
-
var ChainPollingContext =
|
|
57
|
+
import { createContextEx as createContextEx2 } from "@xylabs/react-shared";
|
|
58
|
+
var ChainPollingContext = createContextEx2();
|
|
114
59
|
|
|
115
60
|
// src/context/polling/use.ts
|
|
116
61
|
import { useContextEx as useContextEx2 } from "@xylabs/react-shared";
|
|
@@ -121,7 +66,7 @@ import { Button, FormControl, TextField } from "@mui/material";
|
|
|
121
66
|
import { FlexCol } from "@xylabs/react-flexbox";
|
|
122
67
|
import { toHex } from "@xylabs/sdk-js";
|
|
123
68
|
import { defaultTransactionFees, toXL1BlockNumber } from "@xyo-network/xl1-protocol";
|
|
124
|
-
import
|
|
69
|
+
import React from "react";
|
|
125
70
|
var ChainTransactionBuilder = /* @__PURE__ */ __name(({ onSubmitTx }) => {
|
|
126
71
|
const handleSubmit = /* @__PURE__ */ __name(async (event) => {
|
|
127
72
|
event.preventDefault();
|
|
@@ -139,38 +84,38 @@ var ChainTransactionBuilder = /* @__PURE__ */ __name(({ onSubmitTx }) => {
|
|
|
139
84
|
};
|
|
140
85
|
await onSubmitTx?.(chainTx);
|
|
141
86
|
}, "handleSubmit");
|
|
142
|
-
return /* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ React.createElement("form", {
|
|
143
88
|
onSubmit: /* @__PURE__ */ __name((event) => void handleSubmit(event), "onSubmit"),
|
|
144
89
|
style: {
|
|
145
90
|
width: "100%"
|
|
146
91
|
}
|
|
147
|
-
}, /* @__PURE__ */
|
|
92
|
+
}, /* @__PURE__ */ React.createElement(FlexCol, {
|
|
148
93
|
gap: 2
|
|
149
|
-
}, /* @__PURE__ */
|
|
94
|
+
}, /* @__PURE__ */ React.createElement(FormControl, {
|
|
150
95
|
fullWidth: true
|
|
151
|
-
}, /* @__PURE__ */
|
|
96
|
+
}, /* @__PURE__ */ React.createElement(TextField, {
|
|
152
97
|
label: "Chain Address",
|
|
153
98
|
name: "chain",
|
|
154
99
|
required: true
|
|
155
|
-
})), /* @__PURE__ */
|
|
100
|
+
})), /* @__PURE__ */ React.createElement(FormControl, {
|
|
156
101
|
fullWidth: true
|
|
157
|
-
}, /* @__PURE__ */
|
|
102
|
+
}, /* @__PURE__ */ React.createElement(TextField, {
|
|
158
103
|
label: "Gas",
|
|
159
104
|
name: "gas",
|
|
160
105
|
required: true
|
|
161
|
-
})), /* @__PURE__ */
|
|
106
|
+
})), /* @__PURE__ */ React.createElement(FormControl, {
|
|
162
107
|
fullWidth: true
|
|
163
|
-
}, /* @__PURE__ */
|
|
108
|
+
}, /* @__PURE__ */ React.createElement(TextField, {
|
|
164
109
|
label: "Not Before Block",
|
|
165
110
|
name: "nbf",
|
|
166
111
|
required: true
|
|
167
|
-
})), /* @__PURE__ */
|
|
112
|
+
})), /* @__PURE__ */ React.createElement(FormControl, {
|
|
168
113
|
fullWidth: true
|
|
169
|
-
}, /* @__PURE__ */
|
|
114
|
+
}, /* @__PURE__ */ React.createElement(TextField, {
|
|
170
115
|
label: "Not After Block",
|
|
171
116
|
name: "exp",
|
|
172
117
|
required: true
|
|
173
|
-
})), /* @__PURE__ */
|
|
118
|
+
})), /* @__PURE__ */ React.createElement(Button, {
|
|
174
119
|
type: "submit",
|
|
175
120
|
variant: "contained"
|
|
176
121
|
}, "Submit")));
|
|
@@ -178,9 +123,9 @@ var ChainTransactionBuilder = /* @__PURE__ */ __name(({ onSubmitTx }) => {
|
|
|
178
123
|
|
|
179
124
|
// src/components/transactions/submit/Network.tsx
|
|
180
125
|
import { FormControl as FormControl2, FormHelperText, TextField as TextField2 } from "@mui/material";
|
|
181
|
-
import
|
|
126
|
+
import React2, { useState } from "react";
|
|
182
127
|
var ChainTransactionNetwork = /* @__PURE__ */ __name(({ network, onNetworkChange, ...props }) => {
|
|
183
|
-
const [error, setError] =
|
|
128
|
+
const [error, setError] = useState();
|
|
184
129
|
const handleChange = /* @__PURE__ */ __name((event) => {
|
|
185
130
|
try {
|
|
186
131
|
const url = new URL(event.target.value);
|
|
@@ -191,16 +136,16 @@ var ChainTransactionNetwork = /* @__PURE__ */ __name(({ network, onNetworkChange
|
|
|
191
136
|
setError(error2);
|
|
192
137
|
}
|
|
193
138
|
}, "handleChange");
|
|
194
|
-
return /* @__PURE__ */
|
|
139
|
+
return /* @__PURE__ */ React2.createElement(FormControl2, {
|
|
195
140
|
fullWidth: true
|
|
196
|
-
}, /* @__PURE__ */
|
|
141
|
+
}, /* @__PURE__ */ React2.createElement(TextField2, {
|
|
197
142
|
label: "Network",
|
|
198
143
|
name: "network",
|
|
199
144
|
onChange: handleChange,
|
|
200
145
|
required: true,
|
|
201
146
|
value: network,
|
|
202
147
|
...props
|
|
203
|
-
}), /* @__PURE__ */
|
|
148
|
+
}), /* @__PURE__ */ React2.createElement(FormHelperText, {
|
|
204
149
|
sx: {
|
|
205
150
|
color: error ? "red" : void 0
|
|
206
151
|
}
|
|
@@ -218,13 +163,13 @@ import { QueryBoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
|
218
163
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
219
164
|
import { buildTransaction } from "@xyo-network/xl1-protocol-sdk";
|
|
220
165
|
import { Axios } from "axios";
|
|
221
|
-
import
|
|
166
|
+
import React3, { useState as useState2 } from "react";
|
|
222
167
|
var BETA_PENDING_TRANSACTIONS_ARCHIVIST = "https://beta.api.chain.xyo.network/8050fee682a2762f504d5449d8269a6f17f0b693";
|
|
223
168
|
var defaultNetwork = new URL(BETA_PENDING_TRANSACTIONS_ARCHIVIST);
|
|
224
169
|
var SubmitChainTransaction = /* @__PURE__ */ __name(() => {
|
|
225
|
-
const [network, setNetwork] =
|
|
226
|
-
const [result, setResult] =
|
|
227
|
-
const [error, setError] =
|
|
170
|
+
const [network, setNetwork] = useState2(defaultNetwork);
|
|
171
|
+
const [result, setResult] = useState2();
|
|
172
|
+
const [error, setError] = useState2();
|
|
228
173
|
const onSubmitTx = /* @__PURE__ */ __name(async (chainTx) => {
|
|
229
174
|
if (network) {
|
|
230
175
|
const randomAccount = await Account.random();
|
|
@@ -253,46 +198,46 @@ var SubmitChainTransaction = /* @__PURE__ */ __name(() => {
|
|
|
253
198
|
const onNetworkChange = /* @__PURE__ */ __name((url) => {
|
|
254
199
|
setNetwork(url);
|
|
255
200
|
}, "onNetworkChange");
|
|
256
|
-
return /* @__PURE__ */
|
|
201
|
+
return /* @__PURE__ */ React3.createElement(Grid, {
|
|
257
202
|
container: true
|
|
258
|
-
}, /* @__PURE__ */
|
|
203
|
+
}, /* @__PURE__ */ React3.createElement(Grid, {
|
|
259
204
|
size: {
|
|
260
205
|
xs: 12,
|
|
261
206
|
sm: 6,
|
|
262
207
|
md: 4
|
|
263
208
|
}
|
|
264
|
-
}, /* @__PURE__ */
|
|
209
|
+
}, /* @__PURE__ */ React3.createElement(FlexGrowCol, {
|
|
265
210
|
alignItems: "start",
|
|
266
211
|
gap: 2
|
|
267
|
-
}, /* @__PURE__ */
|
|
212
|
+
}, /* @__PURE__ */ React3.createElement(ChainTransactionNetwork, {
|
|
268
213
|
network,
|
|
269
214
|
onNetworkChange
|
|
270
|
-
}), network ? /* @__PURE__ */
|
|
215
|
+
}), network ? /* @__PURE__ */ React3.createElement(ChainTransactionBuilder, {
|
|
271
216
|
onSubmitTx
|
|
272
|
-
}) : null, result?.[2].length === 0 ? /* @__PURE__ */
|
|
217
|
+
}) : null, result?.[2].length === 0 ? /* @__PURE__ */ React3.createElement(Alert, {
|
|
273
218
|
severity: "success"
|
|
274
|
-
}, "Success") : null, error ? /* @__PURE__ */
|
|
219
|
+
}, "Success") : null, error ? /* @__PURE__ */ React3.createElement(ErrorRender, {
|
|
275
220
|
error
|
|
276
|
-
}) : null, result?.[2] && result?.[2].length > 0 ? /* @__PURE__ */
|
|
221
|
+
}) : null, result?.[2] && result?.[2].length > 0 ? /* @__PURE__ */ React3.createElement(ErrorRender, {
|
|
277
222
|
error: new Error("Failed insert...see result below")
|
|
278
|
-
}) : null, result ? /* @__PURE__ */
|
|
223
|
+
}) : null, result ? /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(Typography, {
|
|
279
224
|
variant: "h6"
|
|
280
|
-
}, "Result:"), /* @__PURE__ */
|
|
225
|
+
}, "Result:"), /* @__PURE__ */ React3.createElement("pre", null, JSON.stringify(result, null, 2))) : null)));
|
|
281
226
|
}, "SubmitChainTransaction");
|
|
282
227
|
|
|
283
228
|
// src/components/transactions/TransactionCountChip.tsx
|
|
284
229
|
import CompareArrowsIcon from "@mui/icons-material/CompareArrows";
|
|
285
230
|
import { Chip, Icon } from "@mui/material";
|
|
286
|
-
import
|
|
231
|
+
import React4, { useMemo } from "react";
|
|
287
232
|
var TransactionCountChip = /* @__PURE__ */ __name(({ transactions, sx, ...props }) => {
|
|
288
|
-
const label =
|
|
233
|
+
const label = useMemo(() => {
|
|
289
234
|
if (!transactions) return "0";
|
|
290
235
|
return transactions?.length > 10 ? "+10" : transactions.length;
|
|
291
236
|
}, [
|
|
292
237
|
transactions
|
|
293
238
|
]);
|
|
294
|
-
return /* @__PURE__ */
|
|
295
|
-
avatar: /* @__PURE__ */
|
|
239
|
+
return /* @__PURE__ */ React4.createElement(Chip, {
|
|
240
|
+
avatar: /* @__PURE__ */ React4.createElement(Icon, null, /* @__PURE__ */ React4.createElement(CompareArrowsIcon, null)),
|
|
296
241
|
label,
|
|
297
242
|
title: transactions ? `Block contains ${transactions.length} transactions` : void 0,
|
|
298
243
|
sx: {
|
|
@@ -311,7 +256,7 @@ import { Alert as Alert2, AlertTitle, Collapse, Snackbar, Typography as Typograp
|
|
|
311
256
|
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
312
257
|
import { FlexGrowCol as FlexGrowCol2, FlexGrowRow, FlexRow } from "@xylabs/react-flexbox";
|
|
313
258
|
import { QuickTipButton } from "@xylabs/react-quick-tip-button";
|
|
314
|
-
import
|
|
259
|
+
import React5, { Fragment, useMemo as useMemo2, useState as useState3 } from "react";
|
|
315
260
|
|
|
316
261
|
// src/hooks/chain-iterator/useChainIteratorParams.ts
|
|
317
262
|
import { usePromise } from "@xylabs/react-promise";
|
|
@@ -354,68 +299,22 @@ var useChainIteratorParams = /* @__PURE__ */ __name(({ chainMap, chainId, head,
|
|
|
354
299
|
]);
|
|
355
300
|
}, "useChainIteratorParams");
|
|
356
301
|
|
|
357
|
-
// src/hooks/useIterateChain.ts
|
|
358
|
-
import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
359
|
-
import { assertEx as assertEx2 } from "@xylabs/sdk-js";
|
|
360
|
-
import { ChainBlockNumberIterationService } from "@xyo-network/chain-services";
|
|
361
|
-
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
362
|
-
import { isBlockBoundWitness as isBlockBoundWitness2 } from "@xyo-network/xl1-protocol";
|
|
363
|
-
import { hydrateBlock } from "@xyo-network/xl1-protocol-sdk";
|
|
364
|
-
var getHydratedBlock = /* @__PURE__ */ __name(async (chainMap, head) => {
|
|
365
|
-
const headHash = await PayloadBuilder2.hash(head);
|
|
366
|
-
return await hydrateBlock({
|
|
367
|
-
chainMap
|
|
368
|
-
}, headHash);
|
|
369
|
-
}, "getHydratedBlock");
|
|
370
|
-
var iterateChain = /* @__PURE__ */ __name(async (chainIteratorParams, maxDepth) => {
|
|
371
|
-
const { chainMap, head } = chainIteratorParams ?? {};
|
|
372
|
-
const headPayload = assertEx2(isBlockBoundWitness2(head) ? head : null, () => "Head is not a Block Bound Witness");
|
|
373
|
-
const headBlockBoundWitness = assertEx2(isBlockBoundWitness2(headPayload) ? headPayload : null, () => "Invalid head block");
|
|
374
|
-
const chainIterator = await ChainBlockNumberIterationService.create({
|
|
375
|
-
head: headBlockBoundWitness,
|
|
376
|
-
chainMap
|
|
377
|
-
});
|
|
378
|
-
const chainHead = await chainIterator.head();
|
|
379
|
-
let block = await getHydratedBlock(chainMap, chainHead);
|
|
380
|
-
const blocks = [
|
|
381
|
-
block
|
|
382
|
-
];
|
|
383
|
-
let depth = 1;
|
|
384
|
-
while (true) {
|
|
385
|
-
const [, next] = await chainIterator.previous(block[0].block, 2);
|
|
386
|
-
const nextHydratedBlock = await getHydratedBlock(chainMap, next);
|
|
387
|
-
blocks.push(nextHydratedBlock);
|
|
388
|
-
block = nextHydratedBlock;
|
|
389
|
-
depth++;
|
|
390
|
-
if (maxDepth !== void 0 && depth >= maxDepth || block?.[0].block === 0) break;
|
|
391
|
-
}
|
|
392
|
-
return blocks;
|
|
393
|
-
}, "iterateChain");
|
|
394
|
-
var useIterateChain = /* @__PURE__ */ __name((chainIteratorParams, maxDepth) => {
|
|
395
|
-
return usePromise2(async () => {
|
|
396
|
-
return await iterateChain(chainIteratorParams, maxDepth);
|
|
397
|
-
}, [
|
|
398
|
-
chainIteratorParams,
|
|
399
|
-
maxDepth
|
|
400
|
-
]);
|
|
401
|
-
}, "useIterateChain");
|
|
402
|
-
|
|
403
302
|
// src/hooks/useTxsFromBlock.ts
|
|
404
|
-
import { usePromise as
|
|
303
|
+
import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
405
304
|
|
|
406
305
|
// src/helpers/txsFromBlock.ts
|
|
407
306
|
import { HydratedBlockWrapper } from "@xyo-network/chain-wrappers";
|
|
408
|
-
import { PayloadBuilder as
|
|
307
|
+
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
409
308
|
var txsFromBlock = /* @__PURE__ */ __name(async (block) => {
|
|
410
309
|
const wrapper = await HydratedBlockWrapper.parse(block);
|
|
411
310
|
const txs = wrapper.transactions;
|
|
412
311
|
const txPayloads = txs.map((tx) => tx.boundWitness);
|
|
413
|
-
return await
|
|
312
|
+
return await PayloadBuilder2.hashPairs(txPayloads);
|
|
414
313
|
}, "txsFromBlock");
|
|
415
314
|
|
|
416
315
|
// src/hooks/useTxsFromBlock.ts
|
|
417
316
|
var useTxsFromBlock = /* @__PURE__ */ __name((block) => {
|
|
418
|
-
return
|
|
317
|
+
return usePromise2(async () => {
|
|
419
318
|
if (block) {
|
|
420
319
|
return await txsFromBlock(block);
|
|
421
320
|
}
|
|
@@ -427,9 +326,9 @@ var useTxsFromBlock = /* @__PURE__ */ __name((block) => {
|
|
|
427
326
|
// src/components/transactions/TransactionsQuickTipButton.tsx
|
|
428
327
|
var TransactionsQuickTipButton = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
429
328
|
const [transactions, transactionsError] = useTxsFromBlock(block);
|
|
430
|
-
const [copied, setCopied] =
|
|
431
|
-
const [showError, setShowError] =
|
|
432
|
-
|
|
329
|
+
const [copied, setCopied] = useState3(false);
|
|
330
|
+
const [showError, setShowError] = useState3(false);
|
|
331
|
+
useMemo2(() => transactionsError ? setShowError(true) : setShowError(false), [
|
|
433
332
|
transactionsError
|
|
434
333
|
]);
|
|
435
334
|
const onCopy = /* @__PURE__ */ __name(async (transactionHash) => {
|
|
@@ -439,7 +338,7 @@ var TransactionsQuickTipButton = /* @__PURE__ */ __name(({ block, ...props }) =>
|
|
|
439
338
|
setCopied(false);
|
|
440
339
|
}, 5e3);
|
|
441
340
|
}, "onCopy");
|
|
442
|
-
return /* @__PURE__ */
|
|
341
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(QuickTipButton, {
|
|
443
342
|
Icon: Paid,
|
|
444
343
|
disabled: transactions?.length === 0,
|
|
445
344
|
hoverText: `Transaction Count: ${transactions?.length ?? 0}`,
|
|
@@ -449,41 +348,41 @@ var TransactionsQuickTipButton = /* @__PURE__ */ __name(({ block, ...props }) =>
|
|
|
449
348
|
maxWidth: "md"
|
|
450
349
|
},
|
|
451
350
|
...props
|
|
452
|
-
}, transactions?.length === 0 ? null : /* @__PURE__ */
|
|
351
|
+
}, transactions?.length === 0 ? null : /* @__PURE__ */ React5.createElement(FlexGrowCol2, {
|
|
453
352
|
gap: 1,
|
|
454
353
|
alignItems: "stretch"
|
|
455
|
-
}, transactions?.map(([transaction, hash]) => /* @__PURE__ */
|
|
354
|
+
}, transactions?.map(([transaction, hash]) => /* @__PURE__ */ React5.createElement(Fragment, {
|
|
456
355
|
key: hash
|
|
457
|
-
}, /* @__PURE__ */
|
|
356
|
+
}, /* @__PURE__ */ React5.createElement(FlexGrowRow, {
|
|
458
357
|
gap: 2,
|
|
459
358
|
justifyContent: "start"
|
|
460
|
-
}, /* @__PURE__ */
|
|
359
|
+
}, /* @__PURE__ */ React5.createElement(ContentCopyIcon, {
|
|
461
360
|
sx: {
|
|
462
361
|
cursor: "pointer"
|
|
463
362
|
},
|
|
464
363
|
onClick: /* @__PURE__ */ __name(() => void onCopy(hash), "onClick")
|
|
465
|
-
}), /* @__PURE__ */
|
|
364
|
+
}), /* @__PURE__ */ React5.createElement(Typography2, {
|
|
466
365
|
sx: {
|
|
467
366
|
overflow: "hidden",
|
|
468
367
|
textOverflow: "ellipsis",
|
|
469
368
|
whiteSpace: "nowrap"
|
|
470
369
|
}
|
|
471
|
-
}, hash)), /* @__PURE__ */
|
|
370
|
+
}, hash)), /* @__PURE__ */ React5.createElement(FlexRow, null, /* @__PURE__ */ React5.createElement(Collapse, {
|
|
472
371
|
in: copied,
|
|
473
372
|
unmountOnExit: true
|
|
474
|
-
}, /* @__PURE__ */
|
|
373
|
+
}, /* @__PURE__ */ React5.createElement(Alert2, null, /* @__PURE__ */ React5.createElement(AlertTitle, null, "Previous hash copied to clipboard")))))))), /* @__PURE__ */ React5.createElement(Snackbar, {
|
|
475
374
|
open: showError,
|
|
476
375
|
onClose: /* @__PURE__ */ __name(() => setShowError(false), "onClose")
|
|
477
|
-
}, /* @__PURE__ */
|
|
376
|
+
}, /* @__PURE__ */ React5.createElement(ErrorRender2, {
|
|
478
377
|
error: transactionsError,
|
|
479
378
|
scope: "TransactionsQuickTipButton"
|
|
480
379
|
})));
|
|
481
380
|
}, "TransactionsQuickTipButton");
|
|
482
381
|
|
|
483
382
|
// src/components/block/hooks/useAnchorElement.ts
|
|
484
|
-
import { useRef, useState as
|
|
383
|
+
import { useRef, useState as useState4 } from "react";
|
|
485
384
|
var useAnchorElement = /* @__PURE__ */ __name(() => {
|
|
486
|
-
const [anchorEl, setAnchorEl] =
|
|
385
|
+
const [anchorEl, setAnchorEl] = useState4(null);
|
|
487
386
|
const anchorRef = useRef(null);
|
|
488
387
|
const open = Boolean(anchorEl);
|
|
489
388
|
const handleClick = /* @__PURE__ */ __name((event) => {
|
|
@@ -508,9 +407,9 @@ var useBlockHeadingEvents = /* @__PURE__ */ __name((...args) => {
|
|
|
508
407
|
}, "useBlockHeadingEvents");
|
|
509
408
|
|
|
510
409
|
// src/components/block/hooks/useBlockProducer.ts
|
|
511
|
-
import { useMemo as
|
|
410
|
+
import { useMemo as useMemo3 } from "react";
|
|
512
411
|
var useBlockProducer = /* @__PURE__ */ __name((block) => {
|
|
513
|
-
return
|
|
412
|
+
return useMemo3(() => {
|
|
514
413
|
if (block) {
|
|
515
414
|
const producer = block[0].addresses[0];
|
|
516
415
|
return producer;
|
|
@@ -520,8 +419,8 @@ var useBlockProducer = /* @__PURE__ */ __name((block) => {
|
|
|
520
419
|
]);
|
|
521
420
|
}, "useBlockProducer");
|
|
522
421
|
|
|
523
|
-
// src/components/block/hooks/
|
|
524
|
-
import {
|
|
422
|
+
// src/components/block/hooks/usePayloadCountsFromBlock.ts
|
|
423
|
+
import { useMemo as useMemo4 } from "react";
|
|
525
424
|
|
|
526
425
|
// src/components/block/helpers/blockProducer.ts
|
|
527
426
|
var blockProducer = /* @__PURE__ */ __name((block) => {
|
|
@@ -529,13 +428,13 @@ var blockProducer = /* @__PURE__ */ __name((block) => {
|
|
|
529
428
|
}, "blockProducer");
|
|
530
429
|
|
|
531
430
|
// src/components/block/helpers/buildBlockChainRenderComponent.tsx
|
|
532
|
-
import
|
|
431
|
+
import React6 from "react";
|
|
533
432
|
var buildBlockChainRenderComponent = /* @__PURE__ */ __name(async (BlockComponent, blockComponentProps) => {
|
|
534
433
|
const { block, ...remainingProps } = blockComponentProps;
|
|
535
434
|
const blockTxs = await txsFromBlock(block);
|
|
536
435
|
const txHashes = blockTxs.map(([_, hash]) => hash);
|
|
537
436
|
const item = {
|
|
538
|
-
child: /* @__PURE__ */
|
|
437
|
+
child: /* @__PURE__ */ React6.createElement(BlockComponent, {
|
|
539
438
|
block,
|
|
540
439
|
transactions: txHashes,
|
|
541
440
|
...remainingProps
|
|
@@ -559,41 +458,9 @@ var payloadCountsFromBlock = /* @__PURE__ */ __name(([block, payloads]) => {
|
|
|
559
458
|
];
|
|
560
459
|
}, "payloadCountsFromBlock");
|
|
561
460
|
|
|
562
|
-
// src/components/block/hooks/useDynamicBlockComponents.ts
|
|
563
|
-
var useDynamicBlockComponents = /* @__PURE__ */ __name((BlockComponent, params, maxBlocks) => {
|
|
564
|
-
const { chainMap } = params ?? {};
|
|
565
|
-
const [blockChainRenderComponents, setBlockChainRenderComponents] = useState6([]);
|
|
566
|
-
const { onBlock } = useChainAnalyzersContext();
|
|
567
|
-
const onAddBlock = /* @__PURE__ */ __name(async (block) => {
|
|
568
|
-
if (!block || !chainMap) return;
|
|
569
|
-
const blockComponentProps = {
|
|
570
|
-
block
|
|
571
|
-
};
|
|
572
|
-
const newBlockComponent = await buildBlockChainRenderComponent(BlockComponent, blockComponentProps);
|
|
573
|
-
if (block?.[0].block !== blockChainRenderComponents[0]?.block?.[0].block) {
|
|
574
|
-
void onBlock?.(block);
|
|
575
|
-
setBlockChainRenderComponents((blockComponents) => {
|
|
576
|
-
const newBlockComponents = [
|
|
577
|
-
newBlockComponent,
|
|
578
|
-
...blockComponents
|
|
579
|
-
];
|
|
580
|
-
if (maxBlocks !== void 0 && newBlockComponents.length > maxBlocks) {
|
|
581
|
-
newBlockComponents.pop();
|
|
582
|
-
}
|
|
583
|
-
return newBlockComponents;
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
}, "onAddBlock");
|
|
587
|
-
return {
|
|
588
|
-
blockChainRenderComponents,
|
|
589
|
-
onAddBlock
|
|
590
|
-
};
|
|
591
|
-
}, "useDynamicBlockComponents");
|
|
592
|
-
|
|
593
461
|
// src/components/block/hooks/usePayloadCountsFromBlock.ts
|
|
594
|
-
import { useMemo as useMemo5 } from "react";
|
|
595
462
|
var usePayloadCountsFromBlock = /* @__PURE__ */ __name((block) => {
|
|
596
|
-
return
|
|
463
|
+
return useMemo4(() => {
|
|
597
464
|
if (block) {
|
|
598
465
|
return [
|
|
599
466
|
...payloadCountsFromBlock(block),
|
|
@@ -610,40 +477,11 @@ var usePayloadCountsFromBlock = /* @__PURE__ */ __name((block) => {
|
|
|
610
477
|
]);
|
|
611
478
|
}, "usePayloadCountsFromBlock");
|
|
612
479
|
|
|
613
|
-
// src/components/block/hooks/useStaticBlockComponents.ts
|
|
614
|
-
import { usePromise as usePromise4 } from "@xylabs/react-promise";
|
|
615
|
-
import { isDefined as isDefined2 } from "@xylabs/sdk-js";
|
|
616
|
-
var useStaticBlockComponents = /* @__PURE__ */ __name((BlockComponent, params, blocks) => {
|
|
617
|
-
const { onBlock } = useChainAnalyzersContext();
|
|
618
|
-
const [blockComponents, blockComponentsError] = usePromise4(async () => {
|
|
619
|
-
const resolvedBlockWithStorage = blocks ?? [];
|
|
620
|
-
if (!params?.chainMap) return [];
|
|
621
|
-
return await Promise.all(resolvedBlockWithStorage?.map(async (block) => {
|
|
622
|
-
if (isDefined2(onBlock)) {
|
|
623
|
-
await onBlock(block);
|
|
624
|
-
}
|
|
625
|
-
const blockComponentProps = {
|
|
626
|
-
block,
|
|
627
|
-
defaultExpanded: true
|
|
628
|
-
};
|
|
629
|
-
return await buildBlockChainRenderComponent(BlockComponent, blockComponentProps);
|
|
630
|
-
}));
|
|
631
|
-
}, [
|
|
632
|
-
blocks,
|
|
633
|
-
params,
|
|
634
|
-
BlockComponent
|
|
635
|
-
]);
|
|
636
|
-
return {
|
|
637
|
-
blockComponents,
|
|
638
|
-
errors: blockComponentsError
|
|
639
|
-
};
|
|
640
|
-
}, "useStaticBlockComponents");
|
|
641
|
-
|
|
642
480
|
// src/components/block/LinkedDivider.tsx
|
|
643
481
|
import { Divider, Stack } from "@mui/material";
|
|
644
|
-
import
|
|
482
|
+
import React7 from "react";
|
|
645
483
|
var LinkedDivider = /* @__PURE__ */ __name(() => {
|
|
646
|
-
return /* @__PURE__ */
|
|
484
|
+
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Stack, {
|
|
647
485
|
className: "divider-spacer",
|
|
648
486
|
justifyContent: "end",
|
|
649
487
|
sx: {
|
|
@@ -651,7 +489,7 @@ var LinkedDivider = /* @__PURE__ */ __name(() => {
|
|
|
651
489
|
height: 24,
|
|
652
490
|
justifyContent: "end"
|
|
653
491
|
}
|
|
654
|
-
}, /* @__PURE__ */
|
|
492
|
+
}, /* @__PURE__ */ React7.createElement(Divider, {
|
|
655
493
|
className: "divider",
|
|
656
494
|
orientation: "vertical",
|
|
657
495
|
flexItem: true,
|
|
@@ -667,16 +505,16 @@ var LinkedDivider = /* @__PURE__ */ __name(() => {
|
|
|
667
505
|
import { MoreVert } from "@mui/icons-material";
|
|
668
506
|
import { IconButton, Menu } from "@mui/material";
|
|
669
507
|
import { BWJsonMenuItem, BWPreviousHashMenuItem } from "@xyo-network/react-boundwitness-plugin";
|
|
670
|
-
import
|
|
508
|
+
import React8 from "react";
|
|
671
509
|
var BlockMenuExpanded = /* @__PURE__ */ __name(({ block }) => {
|
|
672
510
|
const { anchorEl, anchorRef, open, handleClick, handleClose } = useAnchorElement();
|
|
673
|
-
return /* @__PURE__ */
|
|
511
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(IconButton, {
|
|
674
512
|
ref: anchorRef,
|
|
675
513
|
size: "small",
|
|
676
514
|
onClick: handleClick
|
|
677
|
-
}, /* @__PURE__ */
|
|
515
|
+
}, /* @__PURE__ */ React8.createElement(MoreVert, {
|
|
678
516
|
fontSize: "inherit"
|
|
679
|
-
})), /* @__PURE__ */
|
|
517
|
+
})), /* @__PURE__ */ React8.createElement(Menu, {
|
|
680
518
|
open,
|
|
681
519
|
anchorEl,
|
|
682
520
|
anchorOrigin: {
|
|
@@ -684,11 +522,11 @@ var BlockMenuExpanded = /* @__PURE__ */ __name(({ block }) => {
|
|
|
684
522
|
vertical: "bottom"
|
|
685
523
|
},
|
|
686
524
|
onClose: handleClose
|
|
687
|
-
}, /* @__PURE__ */
|
|
525
|
+
}, /* @__PURE__ */ React8.createElement(BWPreviousHashMenuItem, {
|
|
688
526
|
boundwitness: block?.[0],
|
|
689
527
|
dense: true,
|
|
690
528
|
onDialogClose: handleClose
|
|
691
|
-
}), /* @__PURE__ */
|
|
529
|
+
}), /* @__PURE__ */ React8.createElement(BWJsonMenuItem, {
|
|
692
530
|
boundwitness: block?.[0],
|
|
693
531
|
dense: true,
|
|
694
532
|
onDialogClose: handleClose
|
|
@@ -699,13 +537,13 @@ var BlockMenuExpanded = /* @__PURE__ */ __name(({ block }) => {
|
|
|
699
537
|
import { Chip as Chip2 } from "@mui/material";
|
|
700
538
|
import { EthAddressWrapper, isString, isUndefined, toAddress } from "@xylabs/sdk-js";
|
|
701
539
|
import { BlockiesAvatar } from "@xyo-network/react-chain-blockies";
|
|
702
|
-
import
|
|
540
|
+
import React10, { useMemo as useMemo5 } from "react";
|
|
703
541
|
|
|
704
542
|
// src/components/block/ChipSkeleton.tsx
|
|
705
543
|
import { Skeleton } from "@mui/material";
|
|
706
|
-
import
|
|
544
|
+
import React9 from "react";
|
|
707
545
|
var ChipSkeleton = /* @__PURE__ */ __name((props) => {
|
|
708
|
-
return /* @__PURE__ */
|
|
546
|
+
return /* @__PURE__ */ React9.createElement(Skeleton, {
|
|
709
547
|
width: 100,
|
|
710
548
|
...props
|
|
711
549
|
});
|
|
@@ -719,7 +557,7 @@ var formatProducerAddress = /* @__PURE__ */ __name((address) => {
|
|
|
719
557
|
}, "formatProducerAddress");
|
|
720
558
|
var BlockProducerChip = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
721
559
|
const blockProducer2 = block?.[0].addresses[0];
|
|
722
|
-
return /* @__PURE__ */
|
|
560
|
+
return /* @__PURE__ */ React10.createElement(BlockAddressChip, {
|
|
723
561
|
address: blockProducer2,
|
|
724
562
|
toolTipTitle: `Block producer: ${blockProducer2}`,
|
|
725
563
|
...props
|
|
@@ -727,16 +565,16 @@ var BlockProducerChip = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
|
727
565
|
}, "BlockProducerChip");
|
|
728
566
|
var BlockAddressChip = /* @__PURE__ */ __name(({ address, sx, toolTipTitle, ...props }) => {
|
|
729
567
|
const shortedBlockProducer = address === void 0 ? null : formatProducerAddress(address);
|
|
730
|
-
const avatar =
|
|
568
|
+
const avatar = useMemo5(() => address === "" ? void 0 : /* @__PURE__ */ React10.createElement(BlockiesAvatar, {
|
|
731
569
|
blockiesOptions: {
|
|
732
570
|
seed: address
|
|
733
571
|
}
|
|
734
572
|
}), [
|
|
735
573
|
address
|
|
736
574
|
]);
|
|
737
|
-
return /* @__PURE__ */
|
|
575
|
+
return /* @__PURE__ */ React10.createElement(Chip2, {
|
|
738
576
|
avatar,
|
|
739
|
-
label: shortedBlockProducer ?? /* @__PURE__ */
|
|
577
|
+
label: shortedBlockProducer ?? /* @__PURE__ */ React10.createElement(ChipSkeleton, {
|
|
740
578
|
width: 115
|
|
741
579
|
}),
|
|
742
580
|
title: toolTipTitle,
|
|
@@ -759,12 +597,12 @@ var BlockHeadingFlexbox = /* @__PURE__ */ __name(({ block, defaultExpanded, tran
|
|
|
759
597
|
event.stopPropagation();
|
|
760
598
|
blockHeadingListener("transaction-count", "click", JSON.stringify(transactions2));
|
|
761
599
|
}, "handleTransactionCountClick");
|
|
762
|
-
return /* @__PURE__ */
|
|
600
|
+
return /* @__PURE__ */ React11.createElement(FlexCol2, {
|
|
763
601
|
className: "block-heading-flexbox",
|
|
764
602
|
alignItems: "stretch",
|
|
765
603
|
ref: blockHeadingRef,
|
|
766
604
|
onClick: /* @__PURE__ */ __name(() => blockHeadingListener("block-hash", "click", hash), "onClick")
|
|
767
|
-
}, /* @__PURE__ */
|
|
605
|
+
}, /* @__PURE__ */ React11.createElement(LinkedDivider, null), /* @__PURE__ */ React11.createElement(HashHeadingPaper, {
|
|
768
606
|
hash,
|
|
769
607
|
heading: block?.[0].block === void 0 ? "" : block?.[0].block.toString(),
|
|
770
608
|
paperProps: {
|
|
@@ -773,24 +611,24 @@ var BlockHeadingFlexbox = /* @__PURE__ */ __name(({ block, defaultExpanded, tran
|
|
|
773
611
|
width: "100%"
|
|
774
612
|
}
|
|
775
613
|
},
|
|
776
|
-
AdornmentEnd: /* @__PURE__ */
|
|
614
|
+
AdornmentEnd: /* @__PURE__ */ React11.createElement(FlexRow2, {
|
|
777
615
|
gap: 1
|
|
778
|
-
}, /* @__PURE__ */
|
|
616
|
+
}, /* @__PURE__ */ React11.createElement(BlockProducerChip, {
|
|
779
617
|
block
|
|
780
|
-
}), /* @__PURE__ */
|
|
618
|
+
}), /* @__PURE__ */ React11.createElement(TransactionCountChip, {
|
|
781
619
|
onClick: /* @__PURE__ */ __name((e) => handleTransactionCountClick(e, transactions ?? []), "onClick"),
|
|
782
620
|
transactions
|
|
783
|
-
}), /* @__PURE__ */
|
|
621
|
+
}), /* @__PURE__ */ React11.createElement(BWVerification, {
|
|
784
622
|
iconColors: true,
|
|
785
623
|
boundwitness: block?.[0]
|
|
786
|
-
}), /* @__PURE__ */
|
|
624
|
+
}), /* @__PURE__ */ React11.createElement("span", {
|
|
787
625
|
style: {
|
|
788
626
|
// maxWidth is required for css animation to work and 28px is the width of the icon button
|
|
789
627
|
display: "flex",
|
|
790
628
|
transition: "max-width .5s",
|
|
791
629
|
maxWidth: expanded ? "28px" : 0
|
|
792
630
|
}
|
|
793
|
-
}, /* @__PURE__ */
|
|
631
|
+
}, /* @__PURE__ */ React11.createElement(BlockMenuExpanded, {
|
|
794
632
|
block
|
|
795
633
|
}))),
|
|
796
634
|
identiconProps: {
|
|
@@ -803,10 +641,10 @@ var BlockHeadingFlexbox = /* @__PURE__ */ __name(({ block, defaultExpanded, tran
|
|
|
803
641
|
// src/components/block/table/cell/BlockNumber.tsx
|
|
804
642
|
import { Link, TableCell, Tooltip, Typography as Typography3 } from "@mui/material";
|
|
805
643
|
import { useEvent as useEvent2 } from "@xyo-network/react-event";
|
|
806
|
-
import
|
|
644
|
+
import React12 from "react";
|
|
807
645
|
var BlockNumberTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
808
646
|
const blockNumber = block?.[0].block;
|
|
809
|
-
return /* @__PURE__ */
|
|
647
|
+
return /* @__PURE__ */ React12.createElement(BlockNumberTableCellInner, {
|
|
810
648
|
blockNumber,
|
|
811
649
|
linked,
|
|
812
650
|
...props
|
|
@@ -815,15 +653,15 @@ var BlockNumberTableCell = /* @__PURE__ */ __name(({ block, linked, ...props })
|
|
|
815
653
|
var BlockNumberTableCellInner = /* @__PURE__ */ __name(({ blockNumber, linked, ...props }) => {
|
|
816
654
|
const [ref, dispatch] = useEvent2();
|
|
817
655
|
const handleClick = /* @__PURE__ */ __name(() => dispatch("block-number", "click", blockNumber?.toString() ?? ""), "handleClick");
|
|
818
|
-
return /* @__PURE__ */
|
|
656
|
+
return /* @__PURE__ */ React12.createElement(TableCell, {
|
|
819
657
|
ref,
|
|
820
658
|
...props
|
|
821
|
-
}, /* @__PURE__ */
|
|
659
|
+
}, /* @__PURE__ */ React12.createElement(Tooltip, {
|
|
822
660
|
title: `Block Number: ${blockNumber}`
|
|
823
|
-
}, /* @__PURE__ */
|
|
661
|
+
}, /* @__PURE__ */ React12.createElement(Typography3, {
|
|
824
662
|
component: "span",
|
|
825
663
|
variant: "body1"
|
|
826
|
-
}, linked ? /* @__PURE__ */
|
|
664
|
+
}, linked ? /* @__PURE__ */ React12.createElement(Link, {
|
|
827
665
|
onClick: handleClick,
|
|
828
666
|
sx: {
|
|
829
667
|
cursor: "pointer"
|
|
@@ -833,8 +671,8 @@ var BlockNumberTableCellInner = /* @__PURE__ */ __name(({ blockNumber, linked, .
|
|
|
833
671
|
|
|
834
672
|
// src/components/block/table/cell/Epoch.tsx
|
|
835
673
|
import { Skeleton as Skeleton2, TableCell as TableCell2, Tooltip as Tooltip2, Typography as Typography4 } from "@mui/material";
|
|
836
|
-
import { isDefined as
|
|
837
|
-
import
|
|
674
|
+
import { isDefined as isDefined2 } from "@xylabs/sdk-js";
|
|
675
|
+
import React13 from "react";
|
|
838
676
|
|
|
839
677
|
// src/components/block/table/cell/lib/timeFunctions.ts
|
|
840
678
|
var dateFormat = Intl.DateTimeFormat(globalThis.navigator.language ?? "en-US", {
|
|
@@ -899,25 +737,25 @@ var timeAgo = /* @__PURE__ */ __name((epoch, locale = navigator.language ?? "en-
|
|
|
899
737
|
var BlockEpochTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
900
738
|
const epoch = block?.[0]?.$epoch;
|
|
901
739
|
const dateTime = dateFormat.format(epoch);
|
|
902
|
-
const age =
|
|
903
|
-
return /* @__PURE__ */
|
|
740
|
+
const age = isDefined2(epoch) ? timeAgo(epoch) : void 0;
|
|
741
|
+
return /* @__PURE__ */ React13.createElement(TableCell2, props, /* @__PURE__ */ React13.createElement(Tooltip2, {
|
|
904
742
|
title: `Block Epoch: ${dateTime}`
|
|
905
|
-
}, /* @__PURE__ */
|
|
743
|
+
}, /* @__PURE__ */ React13.createElement(Typography4, {
|
|
906
744
|
component: "span",
|
|
907
745
|
variant: "body1"
|
|
908
|
-
}, age ?? /* @__PURE__ */
|
|
746
|
+
}, age ?? /* @__PURE__ */ React13.createElement(Skeleton2, {
|
|
909
747
|
width: 115
|
|
910
748
|
}))));
|
|
911
749
|
}, "BlockEpochTableCell");
|
|
912
750
|
var BlockEpochTableCellInner = /* @__PURE__ */ __name(({ epoch, linked, ...props }) => {
|
|
913
751
|
const dateTime = dateFormat.format(epoch);
|
|
914
|
-
const age =
|
|
915
|
-
return /* @__PURE__ */
|
|
752
|
+
const age = isDefined2(epoch) ? timeAgo(epoch) : void 0;
|
|
753
|
+
return /* @__PURE__ */ React13.createElement(TableCell2, props, /* @__PURE__ */ React13.createElement(Tooltip2, {
|
|
916
754
|
title: `Block Epoch: ${dateTime}`
|
|
917
|
-
}, /* @__PURE__ */
|
|
755
|
+
}, /* @__PURE__ */ React13.createElement(Typography4, {
|
|
918
756
|
component: "span",
|
|
919
757
|
variant: "body1"
|
|
920
|
-
}, age ?? /* @__PURE__ */
|
|
758
|
+
}, age ?? /* @__PURE__ */ React13.createElement(Skeleton2, {
|
|
921
759
|
width: 115
|
|
922
760
|
}))));
|
|
923
761
|
}, "BlockEpochTableCellInner");
|
|
@@ -926,12 +764,12 @@ var BlockEpochTableCellInner = /* @__PURE__ */ __name(({ epoch, linked, ...props
|
|
|
926
764
|
import { Link as Link2, TableCell as TableCell3, Tooltip as Tooltip3 } from "@mui/material";
|
|
927
765
|
import { isHash as isHash2 } from "@xylabs/sdk-js";
|
|
928
766
|
import { usePayloadRootHash } from "@xyo-network/react-shared";
|
|
929
|
-
import
|
|
767
|
+
import React15, { useState as useState5 } from "react";
|
|
930
768
|
|
|
931
769
|
// src/components/FeatureNotAvailable.tsx
|
|
932
770
|
import { Button as Button2, Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
|
|
933
|
-
import
|
|
934
|
-
var FeatureNotAvailable = /* @__PURE__ */ __name(({ featureName = "Feature", ...props }) => /* @__PURE__ */
|
|
771
|
+
import React14 from "react";
|
|
772
|
+
var FeatureNotAvailable = /* @__PURE__ */ __name(({ featureName = "Feature", ...props }) => /* @__PURE__ */ React14.createElement(Dialog, props, /* @__PURE__ */ React14.createElement(DialogTitle, null, `${featureName} Not Available`), /* @__PURE__ */ React14.createElement(DialogContent, null, "This feature is not currently available. Either you do not have access to it or it is currently undergoing maintenance."), /* @__PURE__ */ React14.createElement(DialogActions, null, /* @__PURE__ */ React14.createElement(Button2, {
|
|
935
773
|
onClick: /* @__PURE__ */ __name((e) => props.onClose?.(e, "backdropClick"), "onClick")
|
|
936
774
|
}, "Close"))), "FeatureNotAvailable");
|
|
937
775
|
|
|
@@ -962,19 +800,19 @@ var useLinkedBlockItem = /* @__PURE__ */ __name((noun, data) => {
|
|
|
962
800
|
var BlockHashTableCell = /* @__PURE__ */ __name(({ block, notAvailableDialog, linked, ...props }) => {
|
|
963
801
|
const hash = usePayloadRootHash(block?.[0]);
|
|
964
802
|
const [ref, handleClick] = useLinkedBlockItem("block-hash", hash);
|
|
965
|
-
const [notAvailable, setNotAvailable] =
|
|
803
|
+
const [notAvailable, setNotAvailable] = useState5(false);
|
|
966
804
|
const shortenedHash = isHash2(hash) ? `${hash.slice(0, 4)}...${hash.slice(-5, -1)}` : void 0;
|
|
967
|
-
return /* @__PURE__ */
|
|
805
|
+
return /* @__PURE__ */ React15.createElement(TableCell3, {
|
|
968
806
|
ref,
|
|
969
807
|
...props
|
|
970
|
-
}, /* @__PURE__ */
|
|
808
|
+
}, /* @__PURE__ */ React15.createElement(Tooltip3, {
|
|
971
809
|
title: `Block Hash: ${hash}`
|
|
972
|
-
}, linked ? /* @__PURE__ */
|
|
810
|
+
}, linked ? /* @__PURE__ */ React15.createElement(Link2, {
|
|
973
811
|
sx: {
|
|
974
812
|
cursor: "pointer"
|
|
975
813
|
},
|
|
976
814
|
onClick: linked ? handleClick : () => setNotAvailable(true)
|
|
977
|
-
}, shortenedHash ?? /* @__PURE__ */
|
|
815
|
+
}, shortenedHash ?? /* @__PURE__ */ React15.createElement(ChipSkeleton, null)) : /* @__PURE__ */ React15.createElement("span", null, shortenedHash ?? /* @__PURE__ */ React15.createElement(ChipSkeleton, null))), notAvailableDialog && notAvailable ? /* @__PURE__ */ React15.createElement(FeatureNotAvailable, {
|
|
978
816
|
featureName: "Block Details",
|
|
979
817
|
open: notAvailable,
|
|
980
818
|
onClick: /* @__PURE__ */ __name(() => setNotAvailable(false), "onClick")
|
|
@@ -988,31 +826,31 @@ import { FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
|
|
|
988
826
|
import { ellipsize, isHash as isHash3 } from "@xylabs/sdk-js";
|
|
989
827
|
import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
|
|
990
828
|
import { usePayloadRootHash as usePayloadRootHash2 } from "@xyo-network/react-shared";
|
|
991
|
-
import
|
|
829
|
+
import React16, { useState as useState6 } from "react";
|
|
992
830
|
var BlockJsonViewTableCell = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
993
|
-
const [open, setOpen] =
|
|
831
|
+
const [open, setOpen] = useState6(false);
|
|
994
832
|
const onClose = /* @__PURE__ */ __name(() => setOpen(false), "onClose");
|
|
995
833
|
const hash = usePayloadRootHash2(block?.[0]);
|
|
996
834
|
const title = isHash3(hash) ? `JSON for ${ellipsize(hash, 5)}` : "JSON";
|
|
997
|
-
return /* @__PURE__ */
|
|
835
|
+
return /* @__PURE__ */ React16.createElement(TableCell4, props, /* @__PURE__ */ React16.createElement(FlexRow3, {
|
|
998
836
|
onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick"),
|
|
999
837
|
sx: {
|
|
1000
838
|
width: "100%"
|
|
1001
839
|
}
|
|
1002
|
-
}, /* @__PURE__ */
|
|
840
|
+
}, /* @__PURE__ */ React16.createElement(IconButton2, {
|
|
1003
841
|
onClick: /* @__PURE__ */ __name(() => setOpen(true), "onClick")
|
|
1004
|
-
}, /* @__PURE__ */
|
|
842
|
+
}, /* @__PURE__ */ React16.createElement(DataObject, null)), /* @__PURE__ */ React16.createElement(Dialog2, {
|
|
1005
843
|
open,
|
|
1006
844
|
onClose
|
|
1007
|
-
}, /* @__PURE__ */
|
|
845
|
+
}, /* @__PURE__ */ React16.createElement(DialogTitle2, null, title), /* @__PURE__ */ React16.createElement(DialogContent2, null, /* @__PURE__ */ React16.createElement(JsonViewerEx, {
|
|
1008
846
|
value: block
|
|
1009
|
-
})), /* @__PURE__ */
|
|
847
|
+
})), /* @__PURE__ */ React16.createElement(DialogActions2, {
|
|
1010
848
|
sx: {
|
|
1011
849
|
display: "flex",
|
|
1012
850
|
flexDirection: "row",
|
|
1013
851
|
justifyContent: "end"
|
|
1014
852
|
}
|
|
1015
|
-
}, /* @__PURE__ */
|
|
853
|
+
}, /* @__PURE__ */ React16.createElement(Button3, {
|
|
1016
854
|
variant: "contained",
|
|
1017
855
|
onClick: onClose
|
|
1018
856
|
}, "Close")))));
|
|
@@ -1021,7 +859,7 @@ var BlockJsonViewTableCell = /* @__PURE__ */ __name(({ block, ...props }) => {
|
|
|
1021
859
|
// src/components/block/table/cell/PayloadCounts.tsx
|
|
1022
860
|
import { Error as Error2 } from "@mui/icons-material";
|
|
1023
861
|
import { Link as Link3, TableCell as TableCell5, Tooltip as Tooltip4 } from "@mui/material";
|
|
1024
|
-
import
|
|
862
|
+
import React17 from "react";
|
|
1025
863
|
var BlockPayloadCountsTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
1026
864
|
const [publicPayloads, privatePayloads, error] = usePayloadCountsFromBlock(block);
|
|
1027
865
|
const data = block && privatePayloads !== void 0 && publicPayloads !== void 0 ? {
|
|
@@ -1031,32 +869,32 @@ var BlockPayloadCountsTableCell = /* @__PURE__ */ __name(({ block, linked, ...pr
|
|
|
1031
869
|
} : void 0;
|
|
1032
870
|
const payloadCount = (publicPayloads ?? 0) + (privatePayloads ?? 0);
|
|
1033
871
|
const [ref, handleClick] = useLinkedBlockItem("payload-counts", data);
|
|
1034
|
-
return /* @__PURE__ */
|
|
872
|
+
return /* @__PURE__ */ React17.createElement(TableCell5, {
|
|
1035
873
|
ref,
|
|
1036
874
|
...props
|
|
1037
|
-
}, /* @__PURE__ */
|
|
875
|
+
}, /* @__PURE__ */ React17.createElement("span", null, error ? /* @__PURE__ */ React17.createElement(Tooltip4, {
|
|
1038
876
|
title: error.message
|
|
1039
|
-
}, /* @__PURE__ */
|
|
877
|
+
}, /* @__PURE__ */ React17.createElement(Error2, {
|
|
1040
878
|
color: "error"
|
|
1041
|
-
})) : null, linked ? /* @__PURE__ */
|
|
879
|
+
})) : null, linked ? /* @__PURE__ */ React17.createElement(Tooltip4, {
|
|
1042
880
|
title: `Public Payloads: ${publicPayloads ?? "--"} Private Payloads: ${privatePayloads ?? "--"}`
|
|
1043
|
-
}, /* @__PURE__ */
|
|
881
|
+
}, /* @__PURE__ */ React17.createElement(Link3, {
|
|
1044
882
|
onClick: handleClick,
|
|
1045
883
|
sx: {
|
|
1046
884
|
cursor: "pointer"
|
|
1047
885
|
}
|
|
1048
|
-
}, payloadCount)) : /* @__PURE__ */
|
|
886
|
+
}, payloadCount)) : /* @__PURE__ */ React17.createElement(Tooltip4, {
|
|
1049
887
|
title: `Public Payloads: ${publicPayloads ?? "--"} Private Payloads: ${privatePayloads ?? "--"}`
|
|
1050
|
-
}, /* @__PURE__ */
|
|
888
|
+
}, /* @__PURE__ */ React17.createElement("span", null, payloadCount))));
|
|
1051
889
|
}, "BlockPayloadCountsTableCell");
|
|
1052
890
|
|
|
1053
891
|
// src/components/block/table/cell/Producer.tsx
|
|
1054
892
|
import { TableCell as TableCell6, Tooltip as Tooltip5 } from "@mui/material";
|
|
1055
|
-
import
|
|
893
|
+
import React18, { useState as useState7 } from "react";
|
|
1056
894
|
var BlockProducerTableCell = /* @__PURE__ */ __name(({ block, linked, notAvailableDialog, producerChipProps, ...props }) => {
|
|
1057
895
|
const [ref, handleClick] = useLinkedBlockItem("block-producer", JSON.stringify(block));
|
|
1058
896
|
const producer = useBlockProducer(block);
|
|
1059
|
-
return /* @__PURE__ */
|
|
897
|
+
return /* @__PURE__ */ React18.createElement(BlockProducerTableCellInner, {
|
|
1060
898
|
address: producer,
|
|
1061
899
|
handleClick,
|
|
1062
900
|
linked,
|
|
@@ -1067,10 +905,10 @@ var BlockProducerTableCell = /* @__PURE__ */ __name(({ block, linked, notAvailab
|
|
|
1067
905
|
});
|
|
1068
906
|
}, "BlockProducerTableCell");
|
|
1069
907
|
var BlockProducerTableCellInner = /* @__PURE__ */ __name(({ address, handleClick, linked, notAvailableDialog, producerChipProps, ...props }) => {
|
|
1070
|
-
const [notAvailable, setNotAvailable] =
|
|
1071
|
-
return /* @__PURE__ */
|
|
908
|
+
const [notAvailable, setNotAvailable] = useState7(false);
|
|
909
|
+
return /* @__PURE__ */ React18.createElement(TableCell6, props, /* @__PURE__ */ React18.createElement(Tooltip5, {
|
|
1072
910
|
title: `Block Producer: ${address}`
|
|
1073
|
-
}, /* @__PURE__ */
|
|
911
|
+
}, /* @__PURE__ */ React18.createElement(BlockAddressChip, {
|
|
1074
912
|
sx: {
|
|
1075
913
|
cursor: "pointer"
|
|
1076
914
|
},
|
|
@@ -1078,7 +916,7 @@ var BlockProducerTableCellInner = /* @__PURE__ */ __name(({ address, handleClick
|
|
|
1078
916
|
address,
|
|
1079
917
|
toolTipTitle: `Block Producer: ${address}`,
|
|
1080
918
|
...producerChipProps
|
|
1081
|
-
})), notAvailableDialog && notAvailable ? /* @__PURE__ */
|
|
919
|
+
})), notAvailableDialog && notAvailable ? /* @__PURE__ */ React18.createElement(FeatureNotAvailable, {
|
|
1082
920
|
featureName: "Producer Details",
|
|
1083
921
|
open: notAvailable,
|
|
1084
922
|
onClick: /* @__PURE__ */ __name(() => setNotAvailable(false), "onClick")
|
|
@@ -1088,10 +926,10 @@ var BlockProducerTableCellInner = /* @__PURE__ */ __name(({ address, handleClick
|
|
|
1088
926
|
// src/components/block/table/cell/TransactionCount.tsx
|
|
1089
927
|
import { Error as Error3 } from "@mui/icons-material";
|
|
1090
928
|
import { Link as Link4, TableCell as TableCell7, Tooltip as Tooltip6 } from "@mui/material";
|
|
1091
|
-
import
|
|
929
|
+
import React19, { useMemo as useMemo6 } from "react";
|
|
1092
930
|
var BlockTransactionCountTableCell = /* @__PURE__ */ __name(({ block, linked, ...props }) => {
|
|
1093
931
|
const [transactions, error] = useTxsFromBlock(block);
|
|
1094
|
-
const txHashes =
|
|
932
|
+
const txHashes = useMemo6(() => transactions?.map(([, hash]) => hash), [
|
|
1095
933
|
transactions
|
|
1096
934
|
]);
|
|
1097
935
|
const data = block && transactions !== void 0 ? {
|
|
@@ -1099,14 +937,14 @@ var BlockTransactionCountTableCell = /* @__PURE__ */ __name(({ block, linked, ..
|
|
|
1099
937
|
block: block[0]._hash
|
|
1100
938
|
} : void 0;
|
|
1101
939
|
const [ref, handleClick] = useLinkedBlockItem("transaction-count", data);
|
|
1102
|
-
return /* @__PURE__ */
|
|
940
|
+
return /* @__PURE__ */ React19.createElement(TableCell7, {
|
|
1103
941
|
ref,
|
|
1104
942
|
...props
|
|
1105
|
-
}, /* @__PURE__ */
|
|
943
|
+
}, /* @__PURE__ */ React19.createElement("span", null, error ? /* @__PURE__ */ React19.createElement(Tooltip6, {
|
|
1106
944
|
title: error.message
|
|
1107
|
-
}, /* @__PURE__ */
|
|
945
|
+
}, /* @__PURE__ */ React19.createElement(Error3, {
|
|
1108
946
|
color: "error"
|
|
1109
|
-
})) : null, linked ? /* @__PURE__ */
|
|
947
|
+
})) : null, linked ? /* @__PURE__ */ React19.createElement(Link4, {
|
|
1110
948
|
onClick: handleClick,
|
|
1111
949
|
sx: {
|
|
1112
950
|
cursor: "pointer"
|
|
@@ -1119,17 +957,17 @@ import { CheckCircleOutlineRounded } from "@mui/icons-material";
|
|
|
1119
957
|
import { TableCell as TableCell8 } from "@mui/material";
|
|
1120
958
|
import { FlexRow as FlexRow4 } from "@xylabs/react-flexbox";
|
|
1121
959
|
import { BWVerification as BWVerification2 } from "@xyo-network/react-boundwitness-plugin";
|
|
1122
|
-
import
|
|
960
|
+
import React20 from "react";
|
|
1123
961
|
var BlockVerificationTableCell = /* @__PURE__ */ __name(({ block, linked, deepValidation, ...props }) => {
|
|
1124
|
-
return /* @__PURE__ */
|
|
962
|
+
return /* @__PURE__ */ React20.createElement(TableCell8, props, /* @__PURE__ */ React20.createElement(FlexRow4, {
|
|
1125
963
|
onClick: /* @__PURE__ */ __name((e) => e.stopPropagation(), "onClick"),
|
|
1126
964
|
sx: {
|
|
1127
965
|
width: "100%"
|
|
1128
966
|
}
|
|
1129
|
-
}, deepValidation ? /* @__PURE__ */
|
|
967
|
+
}, deepValidation ? /* @__PURE__ */ React20.createElement(BWVerification2, {
|
|
1130
968
|
iconColors: true,
|
|
1131
969
|
boundwitness: block?.[0]
|
|
1132
|
-
}) : /* @__PURE__ */
|
|
970
|
+
}) : /* @__PURE__ */ React20.createElement(CheckCircleOutlineRounded, {
|
|
1133
971
|
color: "success"
|
|
1134
972
|
})));
|
|
1135
973
|
}, "BlockVerificationTableCell");
|
|
@@ -1137,57 +975,57 @@ var BlockVerificationTableCell = /* @__PURE__ */ __name(({ block, linked, deepVa
|
|
|
1137
975
|
// src/components/block/table/Ex.tsx
|
|
1138
976
|
import { TableBody } from "@mui/material";
|
|
1139
977
|
import { TableEx } from "@xyo-network/react-table";
|
|
1140
|
-
import
|
|
978
|
+
import React22 from "react";
|
|
1141
979
|
|
|
1142
980
|
// src/components/block/table/head/TableHead.tsx
|
|
1143
981
|
import { InfoOutline } from "@mui/icons-material";
|
|
1144
982
|
import { TableCell as TableCell9, TableHead, TableRow, Tooltip as Tooltip7, Typography as Typography5 } from "@mui/material";
|
|
1145
983
|
import { FlexRow as FlexRow5 } from "@xylabs/react-flexbox";
|
|
1146
|
-
import
|
|
984
|
+
import React21 from "react";
|
|
1147
985
|
var ToolTipTableCell = /* @__PURE__ */ __name(({ children, align, title, ...props }) => {
|
|
1148
|
-
return /* @__PURE__ */
|
|
986
|
+
return /* @__PURE__ */ React21.createElement(TableCell9, {
|
|
1149
987
|
title,
|
|
1150
988
|
...props
|
|
1151
|
-
}, /* @__PURE__ */
|
|
989
|
+
}, /* @__PURE__ */ React21.createElement(FlexRow5, {
|
|
1152
990
|
justifyContent: align
|
|
1153
|
-
}, /* @__PURE__ */
|
|
991
|
+
}, /* @__PURE__ */ React21.createElement(Typography5, {
|
|
1154
992
|
variant: "body2"
|
|
1155
|
-
}, children), "\xA0", /* @__PURE__ */
|
|
993
|
+
}, children), "\xA0", /* @__PURE__ */ React21.createElement(Tooltip7, {
|
|
1156
994
|
title
|
|
1157
|
-
}, /* @__PURE__ */
|
|
995
|
+
}, /* @__PURE__ */ React21.createElement(InfoOutline, {
|
|
1158
996
|
fontSize: "small"
|
|
1159
997
|
}))));
|
|
1160
998
|
}, "ToolTipTableCell");
|
|
1161
999
|
var BlockchainTableHead = /* @__PURE__ */ __name(() => {
|
|
1162
|
-
return /* @__PURE__ */
|
|
1000
|
+
return /* @__PURE__ */ React21.createElement(TableHead, null, /* @__PURE__ */ React21.createElement(TableRow, null, /* @__PURE__ */ React21.createElement(ToolTipTableCell, {
|
|
1163
1001
|
align: "left",
|
|
1164
1002
|
title: "The block number that is included in the block"
|
|
1165
|
-
}, "Block"), /* @__PURE__ */
|
|
1003
|
+
}, "Block"), /* @__PURE__ */ React21.createElement(ToolTipTableCell, {
|
|
1166
1004
|
title: "The hash of the block",
|
|
1167
1005
|
sx: {
|
|
1168
1006
|
width: "20%"
|
|
1169
1007
|
}
|
|
1170
|
-
}, "Hash"), /* @__PURE__ */
|
|
1008
|
+
}, "Hash"), /* @__PURE__ */ React21.createElement(ToolTipTableCell, {
|
|
1171
1009
|
title: "The epoch of the block",
|
|
1172
1010
|
sx: {
|
|
1173
1011
|
width: "20%"
|
|
1174
1012
|
}
|
|
1175
|
-
}, "Epoch"), /* @__PURE__ */
|
|
1013
|
+
}, "Epoch"), /* @__PURE__ */ React21.createElement(ToolTipTableCell, {
|
|
1176
1014
|
align: "left",
|
|
1177
1015
|
title: "The address of the block producer that produced the block",
|
|
1178
1016
|
sx: {
|
|
1179
1017
|
width: "20%"
|
|
1180
1018
|
}
|
|
1181
|
-
}, "Block Producer"), /* @__PURE__ */
|
|
1019
|
+
}, "Block Producer"), /* @__PURE__ */ React21.createElement(ToolTipTableCell, {
|
|
1182
1020
|
align: "left",
|
|
1183
1021
|
title: "Count of transactions that are included in the block"
|
|
1184
|
-
}, "Transactions"), /* @__PURE__ */
|
|
1022
|
+
}, "Transactions"), /* @__PURE__ */ React21.createElement(ToolTipTableCell, {
|
|
1185
1023
|
align: "left",
|
|
1186
1024
|
title: "Count of public and private payload counts for the block"
|
|
1187
|
-
}, "Payloads"), /* @__PURE__ */
|
|
1025
|
+
}, "Payloads"), /* @__PURE__ */ React21.createElement(ToolTipTableCell, {
|
|
1188
1026
|
align: "center",
|
|
1189
1027
|
title: "The result of the local validation check for the block"
|
|
1190
|
-
}, "Valid"), /* @__PURE__ */
|
|
1028
|
+
}, "Valid"), /* @__PURE__ */ React21.createElement(ToolTipTableCell, {
|
|
1191
1029
|
align: "center",
|
|
1192
1030
|
title: "Link to display the raw JSON of the block"
|
|
1193
1031
|
}, "JSON")));
|
|
@@ -1195,10 +1033,10 @@ var BlockchainTableHead = /* @__PURE__ */ __name(() => {
|
|
|
1195
1033
|
|
|
1196
1034
|
// src/components/block/table/Ex.tsx
|
|
1197
1035
|
var BlockchainTableEx = /* @__PURE__ */ __name(({ ref, children, ...props }) => {
|
|
1198
|
-
return /* @__PURE__ */
|
|
1036
|
+
return /* @__PURE__ */ React22.createElement(TableEx, {
|
|
1199
1037
|
ref,
|
|
1200
1038
|
...props
|
|
1201
|
-
}, /* @__PURE__ */
|
|
1039
|
+
}, /* @__PURE__ */ React22.createElement(BlockchainTableHead, null), /* @__PURE__ */ React22.createElement(TableBody, null, children));
|
|
1202
1040
|
}, "BlockchainTableEx");
|
|
1203
1041
|
BlockchainTableEx.displayName = "BlockchainTableEx";
|
|
1204
1042
|
|
|
@@ -1206,16 +1044,16 @@ BlockchainTableEx.displayName = "BlockchainTableEx";
|
|
|
1206
1044
|
import { TableRow as TableRow2, useTheme } from "@mui/material";
|
|
1207
1045
|
import { alphaCss } from "@xylabs/react-theme";
|
|
1208
1046
|
import { usePayloadRootHash as usePayloadRootHash3 } from "@xyo-network/react-shared";
|
|
1209
|
-
import
|
|
1047
|
+
import React23, { useMemo as useMemo7 } from "react";
|
|
1210
1048
|
var BlockChainTableRow = /* @__PURE__ */ __name(({ block, deepValidation, defaultExpanded, linked, sx, ...props }) => {
|
|
1211
|
-
const linkedTableCellProps =
|
|
1049
|
+
const linkedTableCellProps = useMemo7(() => ({
|
|
1212
1050
|
block,
|
|
1213
1051
|
linked
|
|
1214
1052
|
}), [
|
|
1215
1053
|
block,
|
|
1216
1054
|
linked
|
|
1217
1055
|
]);
|
|
1218
|
-
const defaultTableCellProps =
|
|
1056
|
+
const defaultTableCellProps = useMemo7(() => ({
|
|
1219
1057
|
block
|
|
1220
1058
|
}), [
|
|
1221
1059
|
block
|
|
@@ -1223,7 +1061,7 @@ var BlockChainTableRow = /* @__PURE__ */ __name(({ block, deepValidation, defaul
|
|
|
1223
1061
|
const hash = usePayloadRootHash3(block?.[0]);
|
|
1224
1062
|
const [ref, handleClick] = useLinkedBlockItem("block-hash", hash);
|
|
1225
1063
|
const theme = useTheme();
|
|
1226
|
-
return /* @__PURE__ */
|
|
1064
|
+
return /* @__PURE__ */ React23.createElement(TableRow2, {
|
|
1227
1065
|
onClick: linked ? handleClick : void 0,
|
|
1228
1066
|
ref,
|
|
1229
1067
|
sx: {
|
|
@@ -1235,47 +1073,47 @@ var BlockChainTableRow = /* @__PURE__ */ __name(({ block, deepValidation, defaul
|
|
|
1235
1073
|
...sx
|
|
1236
1074
|
},
|
|
1237
1075
|
...props
|
|
1238
|
-
}, /* @__PURE__ */
|
|
1076
|
+
}, /* @__PURE__ */ React23.createElement(BlockNumberTableCell, {
|
|
1239
1077
|
align: "left",
|
|
1240
1078
|
...linkedTableCellProps
|
|
1241
|
-
}), /* @__PURE__ */
|
|
1079
|
+
}), /* @__PURE__ */ React23.createElement(BlockHashTableCell, {
|
|
1242
1080
|
align: "left",
|
|
1243
1081
|
...linkedTableCellProps
|
|
1244
|
-
}), /* @__PURE__ */
|
|
1082
|
+
}), /* @__PURE__ */ React23.createElement(BlockEpochTableCell, {
|
|
1245
1083
|
align: "left",
|
|
1246
1084
|
...linkedTableCellProps
|
|
1247
|
-
}), /* @__PURE__ */
|
|
1085
|
+
}), /* @__PURE__ */ React23.createElement(BlockProducerTableCell, {
|
|
1248
1086
|
align: "left",
|
|
1249
1087
|
...linkedTableCellProps
|
|
1250
|
-
}), /* @__PURE__ */
|
|
1088
|
+
}), /* @__PURE__ */ React23.createElement(BlockTransactionCountTableCell, {
|
|
1251
1089
|
align: "left",
|
|
1252
1090
|
...linkedTableCellProps
|
|
1253
|
-
}), /* @__PURE__ */
|
|
1091
|
+
}), /* @__PURE__ */ React23.createElement(BlockPayloadCountsTableCell, {
|
|
1254
1092
|
align: "left",
|
|
1255
1093
|
...linkedTableCellProps
|
|
1256
|
-
}), /* @__PURE__ */
|
|
1094
|
+
}), /* @__PURE__ */ React23.createElement(BlockVerificationTableCell, {
|
|
1257
1095
|
deepValidation,
|
|
1258
1096
|
...defaultTableCellProps
|
|
1259
|
-
}), /* @__PURE__ */
|
|
1097
|
+
}), /* @__PURE__ */ React23.createElement(BlockJsonViewTableCell, defaultTableCellProps));
|
|
1260
1098
|
}, "BlockChainTableRow");
|
|
1261
1099
|
|
|
1262
1100
|
// src/components/account/table/cell/AddressTableCell.tsx
|
|
1263
1101
|
import { TableCell as TableCell10, Tooltip as Tooltip8 } from "@mui/material";
|
|
1264
1102
|
import { useEvent as useEvent4 } from "@xyo-network/react-event";
|
|
1265
|
-
import
|
|
1103
|
+
import React24 from "react";
|
|
1266
1104
|
var AddressTableCell = /* @__PURE__ */ __name(({ address, linked, toolTipTitle, sx, ...props }) => {
|
|
1267
1105
|
const [ref, dispatch] = useEvent4();
|
|
1268
1106
|
const handleClick = /* @__PURE__ */ __name(() => dispatch("address", "click", address), "handleClick");
|
|
1269
|
-
return /* @__PURE__ */
|
|
1107
|
+
return /* @__PURE__ */ React24.createElement(TableCell10, {
|
|
1270
1108
|
ref,
|
|
1271
1109
|
sx: {
|
|
1272
1110
|
cursor: linked ? "pointer" : "default",
|
|
1273
1111
|
...sx
|
|
1274
1112
|
},
|
|
1275
1113
|
...props
|
|
1276
|
-
}, /* @__PURE__ */
|
|
1114
|
+
}, /* @__PURE__ */ React24.createElement(Tooltip8, {
|
|
1277
1115
|
title: toolTipTitle
|
|
1278
|
-
}, /* @__PURE__ */
|
|
1116
|
+
}, /* @__PURE__ */ React24.createElement(BlockAddressChip, {
|
|
1279
1117
|
address,
|
|
1280
1118
|
onClick: handleClick
|
|
1281
1119
|
})));
|
|
@@ -1283,22 +1121,22 @@ var AddressTableCell = /* @__PURE__ */ __name(({ address, linked, toolTipTitle,
|
|
|
1283
1121
|
|
|
1284
1122
|
// src/components/account/table/cell/HashTableCell.tsx
|
|
1285
1123
|
import { Link as Link5, TableCell as TableCell11, Tooltip as Tooltip9, Typography as Typography6 } from "@mui/material";
|
|
1286
|
-
import { ellipsize as ellipsize2, isDefined as
|
|
1124
|
+
import { ellipsize as ellipsize2, isDefined as isDefined3 } from "@xylabs/sdk-js";
|
|
1287
1125
|
import { useEvent as useEvent5 } from "@xyo-network/react-event";
|
|
1288
|
-
import
|
|
1126
|
+
import React25 from "react";
|
|
1289
1127
|
var HashTableCell = /* @__PURE__ */ __name(({ hash, linked, toolTipTitle, sx, ...props }) => {
|
|
1290
1128
|
const [ref, dispatch] = useEvent5();
|
|
1291
1129
|
const handleClick = /* @__PURE__ */ __name(() => dispatch("tx-hash", "click", hash), "handleClick");
|
|
1292
|
-
const shortenedHash =
|
|
1293
|
-
return /* @__PURE__ */
|
|
1130
|
+
const shortenedHash = isDefined3(hash) ? ellipsize2(hash, 6) : "N/A";
|
|
1131
|
+
return /* @__PURE__ */ React25.createElement(TableCell11, {
|
|
1294
1132
|
ref,
|
|
1295
1133
|
...props
|
|
1296
|
-
}, hash ? /* @__PURE__ */
|
|
1134
|
+
}, hash ? /* @__PURE__ */ React25.createElement(Tooltip9, {
|
|
1297
1135
|
title: toolTipTitle
|
|
1298
|
-
}, /* @__PURE__ */
|
|
1136
|
+
}, /* @__PURE__ */ React25.createElement(Typography6, {
|
|
1299
1137
|
component: "span",
|
|
1300
1138
|
variant: "body1"
|
|
1301
|
-
}, linked ? /* @__PURE__ */
|
|
1139
|
+
}, linked ? /* @__PURE__ */ React25.createElement(Link5, {
|
|
1302
1140
|
onClick: handleClick,
|
|
1303
1141
|
sx: {
|
|
1304
1142
|
cursor: "pointer"
|
|
@@ -1308,15 +1146,15 @@ var HashTableCell = /* @__PURE__ */ __name(({ hash, linked, toolTipTitle, sx, ..
|
|
|
1308
1146
|
|
|
1309
1147
|
// src/components/account/table/RawAmountTableCell.tsx
|
|
1310
1148
|
import { Link as Link6, TableCell as TableCell12, Tooltip as Tooltip10 } from "@mui/material";
|
|
1311
|
-
import { isDefined as
|
|
1149
|
+
import { isDefined as isDefined4, toHex as toHex2 } from "@xylabs/sdk-js";
|
|
1312
1150
|
import { useEvent as useEvent6 } from "@xyo-network/react-event";
|
|
1313
1151
|
import { XL1Amount as XL1Amount2 } from "@xyo-network/xl1-protocol";
|
|
1314
|
-
import
|
|
1152
|
+
import React26 from "react";
|
|
1315
1153
|
var RawAmountTableCell = /* @__PURE__ */ __name(({ amount, linked, sx, type, ...props }) => {
|
|
1316
1154
|
const [ref, dispatch] = useEvent6();
|
|
1317
|
-
const handleClick = /* @__PURE__ */ __name(() => dispatch("amount", "click",
|
|
1155
|
+
const handleClick = /* @__PURE__ */ __name(() => dispatch("amount", "click", isDefined4(amount) ? toHex2(amount) : ""), "handleClick");
|
|
1318
1156
|
const formatAmount = /* @__PURE__ */ __name((amount2) => {
|
|
1319
|
-
if (!
|
|
1157
|
+
if (!isDefined4(amount2)) {
|
|
1320
1158
|
return "N/A";
|
|
1321
1159
|
}
|
|
1322
1160
|
const xl1Amount = new XL1Amount2(amount2);
|
|
@@ -1328,52 +1166,52 @@ var RawAmountTableCell = /* @__PURE__ */ __name(({ amount, linked, sx, type, ...
|
|
|
1328
1166
|
locale: navigator.language
|
|
1329
1167
|
});
|
|
1330
1168
|
}, "formatAmount");
|
|
1331
|
-
return /* @__PURE__ */
|
|
1169
|
+
return /* @__PURE__ */ React26.createElement(TableCell12, {
|
|
1332
1170
|
ref,
|
|
1333
1171
|
...props
|
|
1334
|
-
}, /* @__PURE__ */
|
|
1172
|
+
}, /* @__PURE__ */ React26.createElement(Tooltip10, {
|
|
1335
1173
|
title: `Raw Amount: ${amount}`
|
|
1336
|
-
}, linked ? /* @__PURE__ */
|
|
1174
|
+
}, linked ? /* @__PURE__ */ React26.createElement(Link6, {
|
|
1337
1175
|
onClick: handleClick,
|
|
1338
1176
|
sx: {
|
|
1339
1177
|
cursor: "pointer"
|
|
1340
1178
|
}
|
|
1341
|
-
}, type === "send" ? "-" : "", formatAmount(amount)) : /* @__PURE__ */
|
|
1179
|
+
}, type === "send" ? "-" : "", formatAmount(amount)) : /* @__PURE__ */ React26.createElement("span", null, type === "send" ? "-" : "", formatAmount(amount))));
|
|
1342
1180
|
}, "RawAmountTableCell");
|
|
1343
1181
|
|
|
1344
1182
|
// src/components/account/table/BalanceHistoryTableRow.tsx
|
|
1345
1183
|
var BalanceHistoryTableRow = /* @__PURE__ */ __name(({ linked, row, ...props }) => {
|
|
1346
1184
|
const { amount, blockNumber, debug, from, key, timestamp, to, type, txHash } = row ?? {};
|
|
1347
|
-
const linkedTableCallProps =
|
|
1185
|
+
const linkedTableCallProps = useMemo8(() => ({
|
|
1348
1186
|
linked
|
|
1349
1187
|
}), [
|
|
1350
1188
|
linked
|
|
1351
1189
|
]);
|
|
1352
|
-
return /* @__PURE__ */
|
|
1190
|
+
return /* @__PURE__ */ React27.createElement(TableRow3, {
|
|
1353
1191
|
key,
|
|
1354
1192
|
...props
|
|
1355
|
-
}, /* @__PURE__ */
|
|
1193
|
+
}, /* @__PURE__ */ React27.createElement(HashTableCell, {
|
|
1356
1194
|
hash: txHash,
|
|
1357
1195
|
toolTipTitle: `Transaction Hash: ${txHash}`,
|
|
1358
1196
|
...linkedTableCallProps
|
|
1359
|
-
}), /* @__PURE__ */
|
|
1197
|
+
}), /* @__PURE__ */ React27.createElement(BlockNumberTableCellInner, {
|
|
1360
1198
|
blockNumber,
|
|
1361
1199
|
...linkedTableCallProps
|
|
1362
|
-
}), /* @__PURE__ */
|
|
1200
|
+
}), /* @__PURE__ */ React27.createElement(BlockEpochTableCellInner, {
|
|
1363
1201
|
epoch: timestamp,
|
|
1364
1202
|
...linkedTableCallProps
|
|
1365
|
-
}), /* @__PURE__ */
|
|
1203
|
+
}), /* @__PURE__ */ React27.createElement(AddressTableCell, {
|
|
1366
1204
|
address: from,
|
|
1367
1205
|
toolTipTitle: `From Address: ${from}`,
|
|
1368
1206
|
...linkedTableCallProps
|
|
1369
|
-
}), /* @__PURE__ */
|
|
1207
|
+
}), /* @__PURE__ */ React27.createElement(AddressTableCell, {
|
|
1370
1208
|
address: to,
|
|
1371
1209
|
toolTipTitle: `To Address: ${to}`,
|
|
1372
1210
|
...linkedTableCallProps
|
|
1373
|
-
}), /* @__PURE__ */
|
|
1211
|
+
}), /* @__PURE__ */ React27.createElement(RawAmountTableCell, {
|
|
1374
1212
|
amount,
|
|
1375
1213
|
type
|
|
1376
|
-
}), /* @__PURE__ */
|
|
1214
|
+
}), /* @__PURE__ */ React27.createElement(TableCell13, null, /* @__PURE__ */ React27.createElement(RawInfoIconButton, {
|
|
1377
1215
|
rawValue: debug
|
|
1378
1216
|
})));
|
|
1379
1217
|
}, "BalanceHistoryTableRow");
|
|
@@ -1391,9 +1229,9 @@ var TableHeadingLabels = [
|
|
|
1391
1229
|
|
|
1392
1230
|
// src/components/account/table/BalanceHistoryTableEx.tsx
|
|
1393
1231
|
var AccountBalanceHistoryTableEx = /* @__PURE__ */ __name(({ history, linked, ...props }) => {
|
|
1394
|
-
return
|
|
1232
|
+
return isDefined5(history) ? /* @__PURE__ */ React28.createElement(TableEx2, props, /* @__PURE__ */ React28.createElement(TableHead2, null, /* @__PURE__ */ React28.createElement(TableRow4, null, TableHeadingLabels.map((heading) => /* @__PURE__ */ React28.createElement(TableCell14, {
|
|
1395
1233
|
key: heading
|
|
1396
|
-
}, heading)))), /* @__PURE__ */
|
|
1234
|
+
}, heading)))), /* @__PURE__ */ React28.createElement(TableBody2, null, history?.map((row) => /* @__PURE__ */ React28.createElement(BalanceHistoryTableRow, {
|
|
1397
1235
|
key: row.key,
|
|
1398
1236
|
linked,
|
|
1399
1237
|
row
|
|
@@ -1410,31 +1248,31 @@ var AccountBalanceHistoryFlexBox = /* @__PURE__ */ __name(({ address, refresh, v
|
|
|
1410
1248
|
],
|
|
1411
1249
|
history: void 0
|
|
1412
1250
|
};
|
|
1413
|
-
return
|
|
1251
|
+
return isDefined6(history) && isDefined6(address) ? /* @__PURE__ */ React29.createElement(FlexCol3, props, /* @__PURE__ */ React29.createElement(ErrorRender3, {
|
|
1414
1252
|
error,
|
|
1415
1253
|
scope: "AccountBalanceHistoryTable"
|
|
1416
|
-
}), /* @__PURE__ */
|
|
1254
|
+
}), /* @__PURE__ */ React29.createElement(Typography7, {
|
|
1417
1255
|
variant: "h6",
|
|
1418
1256
|
gutterBottom: true
|
|
1419
|
-
}, formatBalanceMagnitude(balance)), truncated ? /* @__PURE__ */
|
|
1257
|
+
}, formatBalanceMagnitude(balance)), truncated ? /* @__PURE__ */ React29.createElement(Typography7, {
|
|
1420
1258
|
variant: "caption",
|
|
1421
1259
|
gutterBottom: true
|
|
1422
|
-
}, "Ranged Balance from", " ", history.at(-1).blockNumber, " ", "-", " ", history[0].blockNumber) : null, /* @__PURE__ */
|
|
1260
|
+
}, "Ranged Balance from", " ", history.at(-1).blockNumber, " ", "-", " ", history[0].blockNumber) : null, /* @__PURE__ */ React29.createElement(AccountBalanceHistoryTableEx, {
|
|
1423
1261
|
history
|
|
1424
1262
|
})) : null;
|
|
1425
1263
|
}, "AccountBalanceHistoryFlexBox");
|
|
1426
1264
|
|
|
1427
1265
|
// src/components/account/hooks/usePagedAccountBalanceHistory.ts
|
|
1428
|
-
import { isDefined as
|
|
1266
|
+
import { isDefined as isDefined7 } from "@xylabs/sdk-js";
|
|
1429
1267
|
import { useAccountBalanceHistory as useAccountBalanceHistory2 } from "@xyo-network/react-chain-provider";
|
|
1430
|
-
import { useCallback, useMemo as
|
|
1268
|
+
import { useCallback, useMemo as useMemo9, useState as useState8 } from "react";
|
|
1431
1269
|
var usePagedAccountBalanceHistory = /* @__PURE__ */ __name((address, viewer, maxPage = 1) => {
|
|
1432
|
-
const [updatedBlockRange, setUpdatedBlockRange] =
|
|
1433
|
-
const [pagedHistory, setPagedHistory] =
|
|
1270
|
+
const [updatedBlockRange, setUpdatedBlockRange] = useState8();
|
|
1271
|
+
const [pagedHistory, setPagedHistory] = useState8();
|
|
1434
1272
|
const [results, error, loading] = useAccountBalanceHistory2(address, viewer, maxPage, updatedBlockRange);
|
|
1435
1273
|
const { history, truncated } = results || {};
|
|
1436
|
-
|
|
1437
|
-
if (
|
|
1274
|
+
useMemo9(() => {
|
|
1275
|
+
if (isDefined7(history)) {
|
|
1438
1276
|
setPagedHistory((pagedHistory2) => {
|
|
1439
1277
|
return [
|
|
1440
1278
|
...pagedHistory2 ?? [],
|
|
@@ -1445,11 +1283,11 @@ var usePagedAccountBalanceHistory = /* @__PURE__ */ __name((address, viewer, max
|
|
|
1445
1283
|
}, [
|
|
1446
1284
|
history
|
|
1447
1285
|
]);
|
|
1448
|
-
const firstBlock =
|
|
1449
|
-
const lastBlock =
|
|
1450
|
-
const historyComplete =
|
|
1286
|
+
const firstBlock = isDefined7(history) ? history.at(0)?.blockNumber : void 0;
|
|
1287
|
+
const lastBlock = isDefined7(history) ? history.at(-1)?.blockNumber : void 0;
|
|
1288
|
+
const historyComplete = isDefined7(history) && history.length === 0;
|
|
1451
1289
|
const updateRange = useCallback(() => {
|
|
1452
|
-
if (
|
|
1290
|
+
if (isDefined7(lastBlock) && lastBlock > 0 && truncated) {
|
|
1453
1291
|
const newEndBlock = lastBlock - 1;
|
|
1454
1292
|
setUpdatedBlockRange([
|
|
1455
1293
|
0,
|
|
@@ -1474,29 +1312,29 @@ var usePagedAccountBalanceHistory = /* @__PURE__ */ __name((address, viewer, max
|
|
|
1474
1312
|
import { Autorenew, Pause } from "@mui/icons-material";
|
|
1475
1313
|
import { Alert as Alert3, AlertTitle as AlertTitle2, Grow, Icon as Icon2, IconButton as IconButton4, Tooltip as Tooltip11 } from "@mui/material";
|
|
1476
1314
|
import { FlexRow as FlexRow6 } from "@xylabs/react-flexbox";
|
|
1477
|
-
import
|
|
1315
|
+
import React34, { memo } from "react";
|
|
1478
1316
|
|
|
1479
1317
|
// src/components/chain/stats/Dialog.tsx
|
|
1480
1318
|
import { QueryStats } from "@mui/icons-material";
|
|
1481
1319
|
import { Dialog as Dialog3, DialogContent as DialogContent3, DialogTitle as DialogTitle3, IconButton as IconButton3 } from "@mui/material";
|
|
1482
|
-
import
|
|
1320
|
+
import React32, { useState as useState9 } from "react";
|
|
1483
1321
|
|
|
1484
1322
|
// src/components/chain/stats/producer/ProducerFlexbox.tsx
|
|
1485
1323
|
import { ListItem, styled, Typography as Typography8 } from "@mui/material";
|
|
1486
1324
|
import { ErrorRender as ErrorRender4 } from "@xylabs/react-error";
|
|
1487
1325
|
import { FlexCol as FlexCol4 } from "@xylabs/react-flexbox";
|
|
1488
1326
|
import { isChainSummaryProducers } from "@xyo-network/chain-analyze";
|
|
1489
|
-
import
|
|
1327
|
+
import React31, { useMemo as useMemo10 } from "react";
|
|
1490
1328
|
|
|
1491
1329
|
// src/components/chain/stats/producer/Table.tsx
|
|
1492
1330
|
import { Table, TableBody as TableBody3, TableCell as TableCell15, TableHead as TableHead3, TableRow as TableRow5, useTheme as useTheme2 } from "@mui/material";
|
|
1493
1331
|
import { BlockiesAvatar as BlockiesAvatar2 } from "@xyo-network/react-chain-blockies";
|
|
1494
|
-
import
|
|
1332
|
+
import React30 from "react";
|
|
1495
1333
|
var ChainProducerStatsTable = /* @__PURE__ */ __name(({ producers, ...props }) => {
|
|
1496
1334
|
const theme = useTheme2();
|
|
1497
|
-
return /* @__PURE__ */
|
|
1335
|
+
return /* @__PURE__ */ React30.createElement(Table, props, /* @__PURE__ */ React30.createElement(TableHead3, null, /* @__PURE__ */ React30.createElement(TableRow5, null, /* @__PURE__ */ React30.createElement(TableCell15, null, "Address"), /* @__PURE__ */ React30.createElement(TableCell15, null, "Blocks Produced"), /* @__PURE__ */ React30.createElement(TableCell15, null, "Rewards Earned Produced"))), /* @__PURE__ */ React30.createElement(TableBody3, null, producers?.map((producer) => /* @__PURE__ */ React30.createElement(TableRow5, {
|
|
1498
1336
|
key: producer.address
|
|
1499
|
-
}, /* @__PURE__ */
|
|
1337
|
+
}, /* @__PURE__ */ React30.createElement(TableCell15, null, /* @__PURE__ */ React30.createElement(BlockiesAvatar2, {
|
|
1500
1338
|
blockiesOptions: {
|
|
1501
1339
|
seed: producer.address
|
|
1502
1340
|
},
|
|
@@ -1504,12 +1342,12 @@ var ChainProducerStatsTable = /* @__PURE__ */ __name(({ producers, ...props }) =
|
|
|
1504
1342
|
height: theme.spacing(2.75),
|
|
1505
1343
|
width: theme.spacing(2.75)
|
|
1506
1344
|
}
|
|
1507
|
-
})), /* @__PURE__ */
|
|
1345
|
+
})), /* @__PURE__ */ React30.createElement(TableCell15, null, producer.blocksProduced.toString()), /* @__PURE__ */ React30.createElement(TableCell15, null, producer.rewardsEarned.toString())))));
|
|
1508
1346
|
}, "ChainProducerStatsTable");
|
|
1509
1347
|
|
|
1510
1348
|
// src/components/chain/stats/producer/ProducerFlexbox.tsx
|
|
1511
1349
|
var BlockProducerStatsFlexbox = /* @__PURE__ */ __name(({ payload, ...props }) => {
|
|
1512
|
-
const [producer, producerError] =
|
|
1350
|
+
const [producer, producerError] = useMemo10(() => {
|
|
1513
1351
|
if (payload) {
|
|
1514
1352
|
return isChainSummaryProducers(payload) ? [
|
|
1515
1353
|
payload
|
|
@@ -1523,19 +1361,19 @@ var BlockProducerStatsFlexbox = /* @__PURE__ */ __name(({ payload, ...props }) =
|
|
|
1523
1361
|
}, [
|
|
1524
1362
|
payload
|
|
1525
1363
|
]);
|
|
1526
|
-
const producersArray =
|
|
1364
|
+
const producersArray = useMemo10(() => Object.values(producer?.producers ?? {}), [
|
|
1527
1365
|
producer
|
|
1528
1366
|
]);
|
|
1529
|
-
return /* @__PURE__ */
|
|
1367
|
+
return /* @__PURE__ */ React31.createElement(FlexCol4, {
|
|
1530
1368
|
alignItems: "start",
|
|
1531
1369
|
gap: 1,
|
|
1532
1370
|
...props
|
|
1533
|
-
}, /* @__PURE__ */
|
|
1371
|
+
}, /* @__PURE__ */ React31.createElement(ErrorRender4, {
|
|
1534
1372
|
error: producerError,
|
|
1535
1373
|
scope: "BlockProducerStatsFlexbox"
|
|
1536
|
-
}), /* @__PURE__ */
|
|
1374
|
+
}), /* @__PURE__ */ React31.createElement(Typography8, {
|
|
1537
1375
|
fontSize: "1rem"
|
|
1538
|
-
}, "Block Producers"), /* @__PURE__ */
|
|
1376
|
+
}, "Block Producers"), /* @__PURE__ */ React31.createElement(ChainProducerStatsTable, {
|
|
1539
1377
|
producers: producersArray
|
|
1540
1378
|
}));
|
|
1541
1379
|
}, "BlockProducerStatsFlexbox");
|
|
@@ -1547,18 +1385,18 @@ var StyledListItem = styled(ListItem)(() => ({
|
|
|
1547
1385
|
// src/components/chain/stats/Dialog.tsx
|
|
1548
1386
|
var ChainAnalyzerStatsDialog = /* @__PURE__ */ __name((props) => {
|
|
1549
1387
|
const { analyzers, statsUpdated } = useChainAnalyzersContext();
|
|
1550
|
-
return /* @__PURE__ */
|
|
1388
|
+
return /* @__PURE__ */ React32.createElement(Dialog3, props, /* @__PURE__ */ React32.createElement(DialogTitle3, null, "Chain Analysis"), /* @__PURE__ */ React32.createElement(DialogContent3, null, statsUpdated > 0 ? Object.entries(analyzers).map(([id2, analyzer]) => /* @__PURE__ */ React32.createElement("div", {
|
|
1551
1389
|
key: id2
|
|
1552
|
-
}, id2 === "producers" ? /* @__PURE__ */
|
|
1390
|
+
}, id2 === "producers" ? /* @__PURE__ */ React32.createElement(BlockProducerStatsFlexbox, {
|
|
1553
1391
|
payload: analyzer.result()
|
|
1554
1392
|
}) : null)) : null));
|
|
1555
1393
|
}, "ChainAnalyzerStatsDialog");
|
|
1556
1394
|
var ChainAnalyzerStatsDialogFromContext = /* @__PURE__ */ __name((props) => {
|
|
1557
|
-
const [open, setOpen] =
|
|
1395
|
+
const [open, setOpen] = useState9(false);
|
|
1558
1396
|
const handleClose = /* @__PURE__ */ __name(() => setOpen(false), "handleClose");
|
|
1559
|
-
return /* @__PURE__ */
|
|
1397
|
+
return /* @__PURE__ */ React32.createElement(React32.Fragment, null, /* @__PURE__ */ React32.createElement(IconButton3, {
|
|
1560
1398
|
onClick: /* @__PURE__ */ __name(() => setOpen(true), "onClick")
|
|
1561
|
-
}, /* @__PURE__ */
|
|
1399
|
+
}, /* @__PURE__ */ React32.createElement(QueryStats, null)), /* @__PURE__ */ React32.createElement(ChainAnalyzerStatsDialog, {
|
|
1562
1400
|
onClose: handleClose,
|
|
1563
1401
|
open,
|
|
1564
1402
|
...props
|
|
@@ -1567,19 +1405,19 @@ var ChainAnalyzerStatsDialogFromContext = /* @__PURE__ */ __name((props) => {
|
|
|
1567
1405
|
|
|
1568
1406
|
// src/components/chain/controls/PulseSvgIcon.tsx
|
|
1569
1407
|
import { createSvgIcon, keyframes, styled as styled2 } from "@mui/material";
|
|
1570
|
-
import
|
|
1571
|
-
var PulseSvgIcon = createSvgIcon(/* @__PURE__ */
|
|
1408
|
+
import React33 from "react";
|
|
1409
|
+
var PulseSvgIcon = createSvgIcon(/* @__PURE__ */ React33.createElement("svg", {
|
|
1572
1410
|
viewBox: "0 0 80 80",
|
|
1573
1411
|
version: "1.1",
|
|
1574
1412
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1575
|
-
}, /* @__PURE__ */
|
|
1413
|
+
}, /* @__PURE__ */ React33.createElement("g", {
|
|
1576
1414
|
transform: "translate(34,34)"
|
|
1577
|
-
}, /* @__PURE__ */
|
|
1415
|
+
}, /* @__PURE__ */ React33.createElement("circle", {
|
|
1578
1416
|
className: "core",
|
|
1579
1417
|
cx: "0",
|
|
1580
1418
|
cy: "0",
|
|
1581
1419
|
r: "6"
|
|
1582
|
-
}), /* @__PURE__ */
|
|
1420
|
+
}), /* @__PURE__ */ React33.createElement("circle", {
|
|
1583
1421
|
className: "radar",
|
|
1584
1422
|
cx: "0",
|
|
1585
1423
|
cy: "0",
|
|
@@ -1643,24 +1481,24 @@ var StyledPulseSvgIcon = styled2(PulseSvgIcon)(({ theme }) => {
|
|
|
1643
1481
|
var PollingControlsFlexbox = /* @__PURE__ */ __name(({ blocksBehind, pollingState, setPollingState }) => {
|
|
1644
1482
|
const paused = pollingState === "paused";
|
|
1645
1483
|
const running = pollingState === "running";
|
|
1646
|
-
return /* @__PURE__ */
|
|
1484
|
+
return /* @__PURE__ */ React34.createElement(FlexRow6, {
|
|
1647
1485
|
justifyContent: "space-between",
|
|
1648
1486
|
width: "100%"
|
|
1649
|
-
}, /* @__PURE__ */
|
|
1487
|
+
}, /* @__PURE__ */ React34.createElement(FlexRow6, {
|
|
1650
1488
|
gap: 2
|
|
1651
|
-
}, running ? /* @__PURE__ */
|
|
1489
|
+
}, running ? /* @__PURE__ */ React34.createElement(IconButton4, {
|
|
1652
1490
|
onClick: /* @__PURE__ */ __name(() => setPollingState?.("paused"), "onClick"),
|
|
1653
1491
|
title: "Pause Block Stream"
|
|
1654
|
-
}, /* @__PURE__ */
|
|
1492
|
+
}, /* @__PURE__ */ React34.createElement(Pause, null)) : null, paused ? /* @__PURE__ */ React34.createElement(IconButton4, {
|
|
1655
1493
|
onClick: /* @__PURE__ */ __name(() => setPollingState?.("running"), "onClick"),
|
|
1656
1494
|
title: "Re-Sync Block Stream"
|
|
1657
|
-
}, /* @__PURE__ */
|
|
1495
|
+
}, /* @__PURE__ */ React34.createElement(Autorenew, null)) : null, /* @__PURE__ */ React34.createElement(ChainAnalyzerStatsDialogFromContext, null)), /* @__PURE__ */ React34.createElement(FlexRow6, {
|
|
1658
1496
|
gap: 2
|
|
1659
|
-
}, /* @__PURE__ */
|
|
1497
|
+
}, /* @__PURE__ */ React34.createElement(Grow, {
|
|
1660
1498
|
in: (blocksBehind ?? 0) > 0
|
|
1661
|
-
}, /* @__PURE__ */
|
|
1499
|
+
}, /* @__PURE__ */ React34.createElement(Tooltip11, {
|
|
1662
1500
|
title: "Click to Re-Sync"
|
|
1663
|
-
}, /* @__PURE__ */
|
|
1501
|
+
}, /* @__PURE__ */ React34.createElement(Alert3, {
|
|
1664
1502
|
sx: {
|
|
1665
1503
|
py: 0,
|
|
1666
1504
|
px: 1,
|
|
@@ -1668,11 +1506,11 @@ var PollingControlsFlexbox = /* @__PURE__ */ __name(({ blocksBehind, pollingStat
|
|
|
1668
1506
|
},
|
|
1669
1507
|
severity: "warning",
|
|
1670
1508
|
onClick: /* @__PURE__ */ __name(() => setPollingState?.("running"), "onClick")
|
|
1671
|
-
}, /* @__PURE__ */
|
|
1509
|
+
}, /* @__PURE__ */ React34.createElement(AlertTitle2, {
|
|
1672
1510
|
sx: {
|
|
1673
1511
|
mb: 0
|
|
1674
1512
|
}
|
|
1675
|
-
}, "Behind:", " ", blocksBehind)))), /* @__PURE__ */
|
|
1513
|
+
}, "Behind:", " ", blocksBehind)))), /* @__PURE__ */ React34.createElement(Icon2, null, /* @__PURE__ */ React34.createElement(StyledPulseSvgIcon, {
|
|
1676
1514
|
className: running ? "" : "paused"
|
|
1677
1515
|
}))));
|
|
1678
1516
|
}, "PollingControlsFlexbox");
|
|
@@ -1680,12 +1518,12 @@ var MemoizedPollingControlsFlexbox = /* @__PURE__ */ memo(PollingControlsFlexbox
|
|
|
1680
1518
|
|
|
1681
1519
|
// src/components/chain/dialog/Dialog.tsx
|
|
1682
1520
|
import { Button as Button4, Dialog as Dialog4, DialogActions as DialogActions3, DialogContent as DialogContent4 } from "@mui/material";
|
|
1683
|
-
import
|
|
1521
|
+
import React35 from "react";
|
|
1684
1522
|
var TransactionsDialog = /* @__PURE__ */ __name(({ onClose, ...props }) => {
|
|
1685
|
-
return /* @__PURE__ */
|
|
1523
|
+
return /* @__PURE__ */ React35.createElement(Dialog4, {
|
|
1686
1524
|
onClose,
|
|
1687
1525
|
...props
|
|
1688
|
-
}, /* @__PURE__ */
|
|
1526
|
+
}, /* @__PURE__ */ React35.createElement(DialogContent4, null, "Transactions Dialog"), /* @__PURE__ */ React35.createElement(DialogActions3, null, /* @__PURE__ */ React35.createElement(Button4, {
|
|
1689
1527
|
variant: "outlined",
|
|
1690
1528
|
onClick: /* @__PURE__ */ __name((e) => onClose?.(e, "escapeKeyDown"), "onClick")
|
|
1691
1529
|
}, "Close")));
|
|
@@ -1725,9 +1563,9 @@ var useOnBlock = /* @__PURE__ */ __name((initialHeadNumber, onAddBlock, liveHead
|
|
|
1725
1563
|
|
|
1726
1564
|
// src/components/chain/pagination/BlockChainPagination.tsx
|
|
1727
1565
|
import { TablePaginationActions } from "@xyo-network/react-payload-table";
|
|
1728
|
-
import
|
|
1566
|
+
import React36 from "react";
|
|
1729
1567
|
var BlockChainPagination = /* @__PURE__ */ __name(({ count = 0, onPageChange, page, rowsPerPage = 10 }) => {
|
|
1730
|
-
return /* @__PURE__ */
|
|
1568
|
+
return /* @__PURE__ */ React36.createElement(TablePaginationActions, {
|
|
1731
1569
|
count,
|
|
1732
1570
|
onPageChange,
|
|
1733
1571
|
page,
|
|
@@ -1736,10 +1574,10 @@ var BlockChainPagination = /* @__PURE__ */ __name(({ count = 0, onPageChange, pa
|
|
|
1736
1574
|
}, "BlockChainPagination");
|
|
1737
1575
|
|
|
1738
1576
|
// src/components/chain/pagination/hooks/usePagination.tsx
|
|
1739
|
-
import { useMemo as
|
|
1577
|
+
import { useMemo as useMemo11, useState as useState10 } from "react";
|
|
1740
1578
|
var useChainPagination = /* @__PURE__ */ __name((pageSize, blockComponents) => {
|
|
1741
|
-
const [page, setPage] =
|
|
1742
|
-
const paginatedBlockComponents =
|
|
1579
|
+
const [page, setPage] = useState10(0);
|
|
1580
|
+
const paginatedBlockComponents = useMemo11(() => {
|
|
1743
1581
|
const startIndex = page * pageSize;
|
|
1744
1582
|
const endIndex = startIndex + pageSize;
|
|
1745
1583
|
return blockComponents?.slice(startIndex, endIndex);
|
|
@@ -1778,35 +1616,35 @@ var BlockListWrapperFlexBox = styled3(FlexCol5, {
|
|
|
1778
1616
|
// src/components/payload/builder/Flexbox.tsx
|
|
1779
1617
|
import { FlexCol as FlexCol6 } from "@xylabs/react-flexbox";
|
|
1780
1618
|
import { JsonViewerEx as JsonViewerEx2 } from "@xyo-network/react-payload-raw-info";
|
|
1781
|
-
import
|
|
1619
|
+
import React37, { useState as useState11 } from "react";
|
|
1782
1620
|
var PayloadBuilderFlexbox = /* @__PURE__ */ __name(({ BuilderComponent, onBuild, ...props }) => {
|
|
1783
|
-
const [payload, setPayload] =
|
|
1621
|
+
const [payload, setPayload] = useState11();
|
|
1784
1622
|
const onBuildLocal = /* @__PURE__ */ __name((payload2) => {
|
|
1785
1623
|
onBuild?.(payload2);
|
|
1786
1624
|
setPayload(payload2);
|
|
1787
1625
|
}, "onBuildLocal");
|
|
1788
|
-
return /* @__PURE__ */
|
|
1626
|
+
return /* @__PURE__ */ React37.createElement(FlexCol6, {
|
|
1789
1627
|
gap: 2,
|
|
1790
1628
|
...props
|
|
1791
|
-
}, /* @__PURE__ */
|
|
1629
|
+
}, /* @__PURE__ */ React37.createElement(BuilderComponent, {
|
|
1792
1630
|
onBuild: onBuildLocal
|
|
1793
|
-
}), payload ? /* @__PURE__ */
|
|
1631
|
+
}), payload ? /* @__PURE__ */ React37.createElement(JsonViewerEx2, {
|
|
1794
1632
|
value: payload
|
|
1795
1633
|
}) : null);
|
|
1796
1634
|
}, "PayloadBuilderFlexbox");
|
|
1797
1635
|
|
|
1798
1636
|
// src/components/payload/builder/producer-intent/Form.tsx
|
|
1799
1637
|
import { Button as Button5, FormControl as FormControl5 } from "@mui/material";
|
|
1800
|
-
import { usePromise as
|
|
1638
|
+
import { usePromise as usePromise3 } from "@xylabs/react-promise";
|
|
1801
1639
|
import { createProducerChainStakeIntent } from "@xyo-network/chain-protocol";
|
|
1802
|
-
import
|
|
1640
|
+
import React40, { useState as useState14 } from "react";
|
|
1803
1641
|
|
|
1804
1642
|
// src/components/payload/fields/BlockNumberTextField.tsx
|
|
1805
1643
|
import { FormControl as FormControl3, FormHelperText as FormHelperText2, TextField as TextField3 } from "@mui/material";
|
|
1806
1644
|
import { toXL1BlockNumber as toXL1BlockNumber2 } from "@xyo-network/xl1-protocol";
|
|
1807
|
-
import
|
|
1645
|
+
import React38, { useState as useState12 } from "react";
|
|
1808
1646
|
var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumberChanged, onChange, ...props }) => {
|
|
1809
|
-
const [blockNumber, setBlockNumber] =
|
|
1647
|
+
const [blockNumber, setBlockNumber] = useState12();
|
|
1810
1648
|
const handleChange = /* @__PURE__ */ __name((e) => {
|
|
1811
1649
|
const value = e.target.value.replaceAll(/\D/g, "");
|
|
1812
1650
|
setBlockNumber(value.length > 0 ? Number(value) : void 0);
|
|
@@ -1814,15 +1652,15 @@ var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumber
|
|
|
1814
1652
|
onChange?.(e);
|
|
1815
1653
|
}, "handleChange");
|
|
1816
1654
|
const errored = errorMessage !== void 0;
|
|
1817
|
-
return /* @__PURE__ */
|
|
1655
|
+
return /* @__PURE__ */ React38.createElement(FormControl3, {
|
|
1818
1656
|
fullWidth: true
|
|
1819
|
-
}, /* @__PURE__ */
|
|
1657
|
+
}, /* @__PURE__ */ React38.createElement(TextField3, {
|
|
1820
1658
|
error: errored,
|
|
1821
1659
|
onChange: handleChange,
|
|
1822
1660
|
type: "number",
|
|
1823
1661
|
value: blockNumber ?? "",
|
|
1824
1662
|
...props
|
|
1825
|
-
}), errored ? /* @__PURE__ */
|
|
1663
|
+
}), errored ? /* @__PURE__ */ React38.createElement(FormHelperText2, {
|
|
1826
1664
|
sx: {
|
|
1827
1665
|
color: "error.main"
|
|
1828
1666
|
}
|
|
@@ -1832,11 +1670,11 @@ var BlockNumberTextField = /* @__PURE__ */ __name(({ errorMessage, onBlockNumber
|
|
|
1832
1670
|
// src/components/payload/fields/XyoAddressTextField.tsx
|
|
1833
1671
|
import { FormControl as FormControl4, FormHelperText as FormHelperText3, TextField as TextField4 } from "@mui/material";
|
|
1834
1672
|
import { asAddress, isAddress } from "@xylabs/sdk-js";
|
|
1835
|
-
import
|
|
1673
|
+
import React39, { useMemo as useMemo12, useState as useState13 } from "react";
|
|
1836
1674
|
var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange, resetValue, ...props }) => {
|
|
1837
|
-
const [address, setAddress] =
|
|
1838
|
-
const [addressError, setAddressError] =
|
|
1839
|
-
|
|
1675
|
+
const [address, setAddress] = useState13("");
|
|
1676
|
+
const [addressError, setAddressError] = useState13();
|
|
1677
|
+
useMemo12(() => setAddress(""), [
|
|
1840
1678
|
resetValue
|
|
1841
1679
|
]);
|
|
1842
1680
|
const handleChange = /* @__PURE__ */ __name((event) => {
|
|
@@ -1856,15 +1694,15 @@ var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange,
|
|
|
1856
1694
|
onAddressChanged?.();
|
|
1857
1695
|
}
|
|
1858
1696
|
}, "handleBlur");
|
|
1859
|
-
return /* @__PURE__ */
|
|
1697
|
+
return /* @__PURE__ */ React39.createElement(FormControl4, {
|
|
1860
1698
|
fullWidth: true
|
|
1861
|
-
}, /* @__PURE__ */
|
|
1699
|
+
}, /* @__PURE__ */ React39.createElement(TextField4, {
|
|
1862
1700
|
error: !!addressError,
|
|
1863
1701
|
onBlur: handleBlur,
|
|
1864
1702
|
onChange: handleChange,
|
|
1865
1703
|
value: address,
|
|
1866
1704
|
...props
|
|
1867
|
-
}), addressError ? /* @__PURE__ */
|
|
1705
|
+
}), addressError ? /* @__PURE__ */ React39.createElement(FormHelperText3, {
|
|
1868
1706
|
sx: {
|
|
1869
1707
|
color: "error.main"
|
|
1870
1708
|
}
|
|
@@ -1873,11 +1711,11 @@ var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange,
|
|
|
1873
1711
|
|
|
1874
1712
|
// src/components/payload/builder/producer-intent/Form.tsx
|
|
1875
1713
|
var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
1876
|
-
const [delegate, setDelegate] =
|
|
1877
|
-
const [exp, setExp] =
|
|
1878
|
-
const [nbf, setNbf] =
|
|
1879
|
-
const [blockRangeError, setBlockRangeError] =
|
|
1880
|
-
const [intentPayload] =
|
|
1714
|
+
const [delegate, setDelegate] = useState14();
|
|
1715
|
+
const [exp, setExp] = useState14();
|
|
1716
|
+
const [nbf, setNbf] = useState14();
|
|
1717
|
+
const [blockRangeError, setBlockRangeError] = useState14();
|
|
1718
|
+
const [intentPayload] = usePromise3(async () => {
|
|
1881
1719
|
if (exp !== void 0 && nbf !== void 0) {
|
|
1882
1720
|
if (exp <= nbf) {
|
|
1883
1721
|
setBlockRangeError(new Error("Expires must be greater than Not Before"));
|
|
@@ -1897,33 +1735,33 @@ var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1897
1735
|
const onBuildLocal = /* @__PURE__ */ __name(() => {
|
|
1898
1736
|
if (onBuild && intentPayload) onBuild?.(intentPayload);
|
|
1899
1737
|
}, "onBuildLocal");
|
|
1900
|
-
return /* @__PURE__ */
|
|
1738
|
+
return /* @__PURE__ */ React40.createElement(React40.Fragment, null, /* @__PURE__ */ React40.createElement(FormControl5, {
|
|
1901
1739
|
fullWidth: true
|
|
1902
|
-
}, /* @__PURE__ */
|
|
1740
|
+
}, /* @__PURE__ */ React40.createElement(XyoAddressTextField, {
|
|
1903
1741
|
label: "Delegate",
|
|
1904
1742
|
name: "delegate",
|
|
1905
1743
|
onAddressChanged: setDelegate,
|
|
1906
1744
|
required: true,
|
|
1907
1745
|
size: "small"
|
|
1908
|
-
})), /* @__PURE__ */
|
|
1746
|
+
})), /* @__PURE__ */ React40.createElement(FormControl5, {
|
|
1909
1747
|
fullWidth: true
|
|
1910
|
-
}, /* @__PURE__ */
|
|
1748
|
+
}, /* @__PURE__ */ React40.createElement(BlockNumberTextField, {
|
|
1911
1749
|
errorMessage: blockRangeError?.message,
|
|
1912
1750
|
label: "Expires",
|
|
1913
1751
|
name: "exp",
|
|
1914
1752
|
onBlockNumberChanged: setExp,
|
|
1915
1753
|
required: true,
|
|
1916
1754
|
size: "small"
|
|
1917
|
-
})), /* @__PURE__ */
|
|
1755
|
+
})), /* @__PURE__ */ React40.createElement(FormControl5, {
|
|
1918
1756
|
fullWidth: true
|
|
1919
|
-
}, /* @__PURE__ */
|
|
1757
|
+
}, /* @__PURE__ */ React40.createElement(BlockNumberTextField, {
|
|
1920
1758
|
errorMessage: blockRangeError?.message,
|
|
1921
1759
|
label: "Not Before",
|
|
1922
1760
|
name: "nbf",
|
|
1923
1761
|
onBlockNumberChanged: setNbf,
|
|
1924
1762
|
required: true,
|
|
1925
1763
|
size: "small"
|
|
1926
|
-
})), /* @__PURE__ */
|
|
1764
|
+
})), /* @__PURE__ */ React40.createElement(Button5, {
|
|
1927
1765
|
disabled: !intentPayload,
|
|
1928
1766
|
variant: "contained",
|
|
1929
1767
|
onClick: onBuildLocal
|
|
@@ -1931,13 +1769,13 @@ var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1931
1769
|
}, "ProducerIntentBuilderForm");
|
|
1932
1770
|
|
|
1933
1771
|
// src/components/payload/builder/transfer/Flexbox.tsx
|
|
1934
|
-
import
|
|
1772
|
+
import React43 from "react";
|
|
1935
1773
|
|
|
1936
1774
|
// src/components/payload/builder/transfer/Form.tsx
|
|
1937
1775
|
import { Button as Button6, FormControl as FormControl7 } from "@mui/material";
|
|
1938
1776
|
import { isAddress as isAddress3 } from "@xylabs/sdk-js";
|
|
1939
1777
|
import { TransferSchema } from "@xyo-network/xl1-protocol";
|
|
1940
|
-
import
|
|
1778
|
+
import React42, { useMemo as useMemo14, useState as useState16 } from "react";
|
|
1941
1779
|
|
|
1942
1780
|
// src/components/payload/builder/transfer/builder/SingleFlexbox.tsx
|
|
1943
1781
|
import { RemoveCircle } from "@mui/icons-material";
|
|
@@ -1945,11 +1783,11 @@ import { FormControl as FormControl6, Icon as Icon3, IconButton as IconButton5 }
|
|
|
1945
1783
|
import { FlexRow as FlexRow7 } from "@xylabs/react-flexbox";
|
|
1946
1784
|
import { isAddress as isAddress2, toHex as toHex3 } from "@xylabs/sdk-js";
|
|
1947
1785
|
import { BigIntInput } from "@xyo-network/react-shared";
|
|
1948
|
-
import
|
|
1786
|
+
import React41, { useEffect as useEffect2, useMemo as useMemo13, useState as useState15 } from "react";
|
|
1949
1787
|
var SingleTransferBuilderFlexbox = /* @__PURE__ */ __name(({ onTransferUpdated, onRemoveTransfer, singleTransfer, ...props }) => {
|
|
1950
|
-
const [toAddress3, setToAddress] =
|
|
1951
|
-
const [amount, setAmount] =
|
|
1952
|
-
const transferAmount =
|
|
1788
|
+
const [toAddress3, setToAddress] = useState15();
|
|
1789
|
+
const [amount, setAmount] = useState15();
|
|
1790
|
+
const transferAmount = useMemo13(() => {
|
|
1953
1791
|
if (isAddress2(toAddress3) && amount !== void 0) {
|
|
1954
1792
|
return {
|
|
1955
1793
|
...singleTransfer,
|
|
@@ -1966,36 +1804,36 @@ var SingleTransferBuilderFlexbox = /* @__PURE__ */ __name(({ onTransferUpdated,
|
|
|
1966
1804
|
}, [
|
|
1967
1805
|
transferAmount
|
|
1968
1806
|
]);
|
|
1969
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ React41.createElement(FlexRow7, {
|
|
1970
1808
|
alignItems: "start",
|
|
1971
1809
|
gap: 1,
|
|
1972
1810
|
...props
|
|
1973
|
-
}, /* @__PURE__ */
|
|
1811
|
+
}, /* @__PURE__ */ React41.createElement(FormControl6, {
|
|
1974
1812
|
fullWidth: true
|
|
1975
|
-
}, /* @__PURE__ */
|
|
1813
|
+
}, /* @__PURE__ */ React41.createElement(XyoAddressTextField, {
|
|
1976
1814
|
label: "To",
|
|
1977
1815
|
name: "to",
|
|
1978
1816
|
onAddressChanged: setToAddress,
|
|
1979
1817
|
required: true,
|
|
1980
1818
|
size: "small"
|
|
1981
|
-
})), /* @__PURE__ */
|
|
1819
|
+
})), /* @__PURE__ */ React41.createElement(FormControl6, {
|
|
1982
1820
|
fullWidth: true
|
|
1983
|
-
}, /* @__PURE__ */
|
|
1821
|
+
}, /* @__PURE__ */ React41.createElement(BigIntInput.TextField, {
|
|
1984
1822
|
label: "Amount",
|
|
1985
1823
|
name: "amount",
|
|
1986
1824
|
onChangeFixedPoint: setAmount,
|
|
1987
1825
|
required: true,
|
|
1988
1826
|
size: "small"
|
|
1989
|
-
})), /* @__PURE__ */
|
|
1827
|
+
})), /* @__PURE__ */ React41.createElement(IconButton5, {
|
|
1990
1828
|
onClick: /* @__PURE__ */ __name(() => onRemoveTransfer?.(singleTransfer.transferId), "onClick")
|
|
1991
|
-
}, /* @__PURE__ */
|
|
1829
|
+
}, /* @__PURE__ */ React41.createElement(Icon3, null, /* @__PURE__ */ React41.createElement(RemoveCircle, null))));
|
|
1992
1830
|
}, "SingleTransferBuilderFlexbox");
|
|
1993
1831
|
|
|
1994
1832
|
// src/components/payload/builder/transfer/Form.tsx
|
|
1995
1833
|
var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
1996
|
-
const [fromAddress, setFromAddress] =
|
|
1997
|
-
const [transfers, setTransfers] =
|
|
1998
|
-
const transferPayload =
|
|
1834
|
+
const [fromAddress, setFromAddress] = useState16();
|
|
1835
|
+
const [transfers, setTransfers] = useState16([]);
|
|
1836
|
+
const transferPayload = useMemo14(() => {
|
|
1999
1837
|
if (isAddress3(fromAddress) && transfers.length > 0) {
|
|
2000
1838
|
const transfersRecord = {};
|
|
2001
1839
|
for (const transfer of transfers) {
|
|
@@ -2037,19 +1875,19 @@ var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
2037
1875
|
return transfer;
|
|
2038
1876
|
}));
|
|
2039
1877
|
}, "onTransferUpdated");
|
|
2040
|
-
return /* @__PURE__ */
|
|
1878
|
+
return /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(FormControl7, {
|
|
2041
1879
|
fullWidth: true
|
|
2042
|
-
}, /* @__PURE__ */
|
|
1880
|
+
}, /* @__PURE__ */ React42.createElement(XyoAddressTextField, {
|
|
2043
1881
|
label: "From",
|
|
2044
1882
|
name: "from",
|
|
2045
1883
|
onAddressChanged: setFromAddress,
|
|
2046
1884
|
required: true,
|
|
2047
1885
|
size: "small"
|
|
2048
|
-
})), /* @__PURE__ */
|
|
1886
|
+
})), /* @__PURE__ */ React42.createElement(Button6, {
|
|
2049
1887
|
onClick: onTransferAdded,
|
|
2050
1888
|
size: "small",
|
|
2051
1889
|
variant: "contained"
|
|
2052
|
-
}, "Add Transfer"), transfers.map((transfer) => /* @__PURE__ */
|
|
1890
|
+
}, "Add Transfer"), transfers.map((transfer) => /* @__PURE__ */ React42.createElement(SingleTransferBuilderFlexbox, {
|
|
2053
1891
|
key: transfer.transferId,
|
|
2054
1892
|
onTransferUpdated,
|
|
2055
1893
|
onRemoveTransfer: onTransferRemoved,
|
|
@@ -2057,7 +1895,7 @@ var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
2057
1895
|
sx: {
|
|
2058
1896
|
width: "100%"
|
|
2059
1897
|
}
|
|
2060
|
-
})), /* @__PURE__ */
|
|
1898
|
+
})), /* @__PURE__ */ React42.createElement(Button6, {
|
|
2061
1899
|
disabled: !transferPayload,
|
|
2062
1900
|
variant: "contained",
|
|
2063
1901
|
onClick: onBuildLocal
|
|
@@ -2065,7 +1903,7 @@ var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
2065
1903
|
}, "TransferBuilderForm");
|
|
2066
1904
|
|
|
2067
1905
|
// src/components/payload/builder/transfer/Flexbox.tsx
|
|
2068
|
-
var TransferBuilderFlexbox = /* @__PURE__ */ __name(({ onBuild, ...props }) => /* @__PURE__ */
|
|
1906
|
+
var TransferBuilderFlexbox = /* @__PURE__ */ __name(({ onBuild, ...props }) => /* @__PURE__ */ React43.createElement(PayloadBuilderFlexbox, {
|
|
2069
1907
|
gap: 4,
|
|
2070
1908
|
alignItems: "start",
|
|
2071
1909
|
BuilderComponent: TransferBuilderForm,
|
|
@@ -2075,32 +1913,12 @@ var TransferBuilderFlexbox = /* @__PURE__ */ __name(({ onBuild, ...props }) => /
|
|
|
2075
1913
|
|
|
2076
1914
|
// src/stories/ChainArchivistDecorator.tsx
|
|
2077
1915
|
import { CircularProgress } from "@mui/material";
|
|
2078
|
-
import { usePromise as
|
|
1916
|
+
import { usePromise as usePromise4 } from "@xylabs/react-promise";
|
|
2079
1917
|
import { MemoryArchivist } from "@xyo-network/archivist-memory";
|
|
2080
1918
|
import { ArchivistConfigSchema } from "@xyo-network/archivist-model";
|
|
2081
1919
|
import { buildRandomBlockChain } from "@xyo-network/react-chain-shared";
|
|
2082
1920
|
import { flattenHydratedBlocks } from "@xyo-network/xl1-protocol-sdk";
|
|
2083
|
-
import
|
|
2084
|
-
|
|
2085
|
-
// src/lib/getChainArchivist.ts
|
|
2086
|
-
import { assertEx as assertEx3 } from "@xylabs/sdk-js";
|
|
2087
|
-
import { asArchivistInstance } from "@xyo-network/archivist-model";
|
|
2088
|
-
import { HttpBridge, HttpBridgeConfigSchema } from "@xyo-network/bridge-http";
|
|
2089
|
-
var getChainArchivistFromBridge = /* @__PURE__ */ __name(async (params) => {
|
|
2090
|
-
const { url, chainArchivistModuleId } = params;
|
|
2091
|
-
const config = {
|
|
2092
|
-
schema: HttpBridgeConfigSchema,
|
|
2093
|
-
client: {
|
|
2094
|
-
url
|
|
2095
|
-
}
|
|
2096
|
-
};
|
|
2097
|
-
const bridge = await HttpBridge.create({
|
|
2098
|
-
config
|
|
2099
|
-
});
|
|
2100
|
-
const resolved = await bridge.resolve(chainArchivistModuleId);
|
|
2101
|
-
const mod = assertEx3(resolved, () => `Module ${chainArchivistModuleId} not found`);
|
|
2102
|
-
return assertEx3(asArchivistInstance(mod), () => `Module ${chainArchivistModuleId} is not an archivist`);
|
|
2103
|
-
}, "getChainArchivistFromBridge");
|
|
1921
|
+
import React44, { useEffect as useEffect3 } from "react";
|
|
2104
1922
|
|
|
2105
1923
|
// src/lib/getChainId.ts
|
|
2106
1924
|
import { toAddress as toAddress2 } from "@xylabs/sdk-js";
|
|
@@ -2111,8 +1929,8 @@ var getChainId = /* @__PURE__ */ __name(() => {
|
|
|
2111
1929
|
|
|
2112
1930
|
// src/stories/ChainArchivistDecorator.tsx
|
|
2113
1931
|
var ChainArchivistDecorator = /* @__PURE__ */ __name((Story, { args, ...context }) => {
|
|
2114
|
-
const [randomBlockChain] =
|
|
2115
|
-
const [blockChainRenderProps, blockChainRenderPropsError] =
|
|
1932
|
+
const [randomBlockChain] = usePromise4(async () => await buildRandomBlockChain(), []);
|
|
1933
|
+
const [blockChainRenderProps, blockChainRenderPropsError] = usePromise4(async () => {
|
|
2116
1934
|
if (randomBlockChain) {
|
|
2117
1935
|
const chainArchivist = await MemoryArchivist.create({
|
|
2118
1936
|
config: {
|
|
@@ -2149,23 +1967,23 @@ var ChainArchivistDecorator = /* @__PURE__ */ __name((Story, { args, ...context
|
|
|
2149
1967
|
}
|
|
2150
1968
|
}
|
|
2151
1969
|
};
|
|
2152
|
-
return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */
|
|
1970
|
+
return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */ React44.createElement(Story, props) : /* @__PURE__ */ React44.createElement(CircularProgress, null);
|
|
2153
1971
|
}, "ChainArchivistDecorator");
|
|
2154
1972
|
|
|
2155
1973
|
// src/stories/ChainArchivistDelayedInsertDecorator.tsx
|
|
2156
1974
|
import { CircularProgress as CircularProgress2 } from "@mui/material";
|
|
2157
|
-
import { usePromise as
|
|
1975
|
+
import { usePromise as usePromise5 } from "@xylabs/react-promise";
|
|
2158
1976
|
import { delay } from "@xylabs/sdk-js";
|
|
2159
1977
|
import { MemoryArchivist as MemoryArchivist2 } from "@xyo-network/archivist-memory";
|
|
2160
1978
|
import { ArchivistConfigSchema as ArchivistConfigSchema2 } from "@xyo-network/archivist-model";
|
|
2161
1979
|
import { buildRandomBlockChain as buildRandomBlockChain2 } from "@xyo-network/react-chain-shared";
|
|
2162
1980
|
import { flattenHydratedBlock } from "@xyo-network/xl1-protocol-sdk";
|
|
2163
|
-
import
|
|
1981
|
+
import React45, { useEffect as useEffect4, useState as useState17 } from "react";
|
|
2164
1982
|
var chainArchivistRef;
|
|
2165
1983
|
var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
2166
|
-
const [firstBlock, setFirstBlock] =
|
|
2167
|
-
const [randomBlockChain] =
|
|
2168
|
-
const [chainArchivist] =
|
|
1984
|
+
const [firstBlock, setFirstBlock] = useState17();
|
|
1985
|
+
const [randomBlockChain] = usePromise5(async () => await buildRandomBlockChain2(), []);
|
|
1986
|
+
const [chainArchivist] = usePromise5(async () => {
|
|
2169
1987
|
if (chainArchivistRef) {
|
|
2170
1988
|
return chainArchivistRef;
|
|
2171
1989
|
} else {
|
|
@@ -2178,7 +1996,7 @@ var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, contex
|
|
|
2178
1996
|
return chainArchivistRef;
|
|
2179
1997
|
}
|
|
2180
1998
|
}, []);
|
|
2181
|
-
const [, delayedInsertError] =
|
|
1999
|
+
const [, delayedInsertError] = usePromise5(async () => {
|
|
2182
2000
|
if (chainArchivist && randomBlockChain) {
|
|
2183
2001
|
for (const hydratedBlock of randomBlockChain) {
|
|
2184
2002
|
const flattened = flattenHydratedBlock(hydratedBlock);
|
|
@@ -2198,7 +2016,7 @@ var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, contex
|
|
|
2198
2016
|
}, [
|
|
2199
2017
|
delayedInsertError
|
|
2200
2018
|
]);
|
|
2201
|
-
const [blockChainRenderProps] =
|
|
2019
|
+
const [blockChainRenderProps] = usePromise5(async () => {
|
|
2202
2020
|
const chainId = await getChainId();
|
|
2203
2021
|
return {
|
|
2204
2022
|
chainArchivist,
|
|
@@ -2219,49 +2037,8 @@ var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, contex
|
|
|
2219
2037
|
}
|
|
2220
2038
|
}
|
|
2221
2039
|
};
|
|
2222
|
-
return firstBlock ? /* @__PURE__ */
|
|
2040
|
+
return firstBlock ? /* @__PURE__ */ React45.createElement(Story, props) : /* @__PURE__ */ React45.createElement(CircularProgress2, null);
|
|
2223
2041
|
}, "ChainArchivistDelayedInsertDecorator");
|
|
2224
|
-
|
|
2225
|
-
// src/stories/ChainInfoContextDecorator.tsx
|
|
2226
|
-
import { usePromise as usePromise8 } from "@xylabs/react-promise";
|
|
2227
|
-
import { assertEx as assertEx4, isDefined as isDefined9 } from "@xylabs/sdk-js";
|
|
2228
|
-
import { ChainBlockNumberIterationService as ChainBlockNumberIterationService2 } from "@xyo-network/chain-services";
|
|
2229
|
-
import { findFirstMatching } from "@xyo-network/chain-utils";
|
|
2230
|
-
import { isBlockBoundWitness as isBlockBoundWitness3 } from "@xyo-network/xl1-protocol";
|
|
2231
|
-
import { readPayloadMapFromStore } from "@xyo-network/xl1-protocol-sdk";
|
|
2232
|
-
import React47 from "react";
|
|
2233
|
-
var archivistConfig = {
|
|
2234
|
-
url: "http://localhost:8080",
|
|
2235
|
-
chainArchivistModuleId: "XYOPublic:XYOChain:Chain"
|
|
2236
|
-
};
|
|
2237
|
-
var ChainInfoContextDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
2238
|
-
const [chainIdResponse] = usePromise8(async () => {
|
|
2239
|
-
return await getChainId();
|
|
2240
|
-
}, []);
|
|
2241
|
-
const chainId = chainIdResponse;
|
|
2242
|
-
const [chainArchivist] = usePromise8(async () => {
|
|
2243
|
-
return await getChainArchivistFromBridge(archivistConfig);
|
|
2244
|
-
}, []);
|
|
2245
|
-
const [chainIterator] = usePromise8(async () => {
|
|
2246
|
-
if (isDefined9(chainArchivist) && isDefined9(chainId)) {
|
|
2247
|
-
const firstMatch = assertEx4(await findFirstMatching(chainArchivist), () => `No head found in archivist: ${chainArchivist.id} `);
|
|
2248
|
-
const head = assertEx4(isBlockBoundWitness3(firstMatch) ? firstMatch : void 0, () => `Expected a block bound witness: ${JSON.stringify(firstMatch)}`);
|
|
2249
|
-
const chainMap = readPayloadMapFromStore(chainArchivist);
|
|
2250
|
-
return await ChainBlockNumberIterationService2.create({
|
|
2251
|
-
chainMap,
|
|
2252
|
-
head
|
|
2253
|
-
});
|
|
2254
|
-
}
|
|
2255
|
-
}, [
|
|
2256
|
-
chainArchivist,
|
|
2257
|
-
chainId
|
|
2258
|
-
]);
|
|
2259
|
-
return /* @__PURE__ */ React47.createElement(ChainInfoProvider, {
|
|
2260
|
-
chainArchivist,
|
|
2261
|
-
chainId,
|
|
2262
|
-
chainIterator
|
|
2263
|
-
}, /* @__PURE__ */ React47.createElement(Story, context));
|
|
2264
|
-
}, "ChainInfoContextDecorator");
|
|
2265
2042
|
export {
|
|
2266
2043
|
AccountBalanceHistoryFlexBox,
|
|
2267
2044
|
AccountBalanceHistoryTableEx,
|
|
@@ -2291,7 +2068,6 @@ export {
|
|
|
2291
2068
|
ChainAnalyzerStatsDialogFromContext,
|
|
2292
2069
|
ChainArchivistDecorator,
|
|
2293
2070
|
ChainArchivistDelayedInsertDecorator,
|
|
2294
|
-
ChainInfoContextDecorator,
|
|
2295
2071
|
ChainTransactionBuilder,
|
|
2296
2072
|
ChainTransactionNetwork,
|
|
2297
2073
|
ChipSkeleton,
|
|
@@ -2321,12 +2097,9 @@ export {
|
|
|
2321
2097
|
useBlockProducer,
|
|
2322
2098
|
useChainIteratorParams,
|
|
2323
2099
|
useChainPagination,
|
|
2324
|
-
useDynamicBlockComponents,
|
|
2325
|
-
useIterateChain,
|
|
2326
2100
|
useOnBlock,
|
|
2327
2101
|
usePagedAccountBalanceHistory,
|
|
2328
2102
|
usePayloadCountsFromBlock,
|
|
2329
|
-
useStaticBlockComponents,
|
|
2330
2103
|
useTxsFromBlock
|
|
2331
2104
|
};
|
|
2332
2105
|
//# sourceMappingURL=index.mjs.map
|