@xyo-network/react-chain-blockchain 1.23.0 → 1.23.2
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/index.mjs +1497 -1461
- package/dist/browser/index.mjs.map +7 -1
- package/dist/browser/stories/ChainArchivistDecorator.d.ts +3 -0
- package/dist/browser/stories/ChainArchivistDecorator.d.ts.map +1 -0
- package/dist/browser/stories/ChainArchivistDelayedInsertDecorator.d.ts +3 -0
- package/dist/browser/stories/ChainArchivistDelayedInsertDecorator.d.ts.map +1 -0
- package/dist/browser/stories/index.d.ts +3 -0
- package/dist/browser/stories/index.d.ts.map +1 -0
- package/package.json +37 -37
package/dist/browser/index.mjs
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/components/account/BalanceHistoryFlexbox.tsx
|
|
5
2
|
import { Typography as Typography8 } from "@mui/material";
|
|
6
3
|
import { FlexCol as FlexCol3 } from "@xylabs/react-flexbox";
|
|
@@ -8,16 +5,15 @@ import { isDefined as isDefined8 } from "@xylabs/sdk-js";
|
|
|
8
5
|
import { useAccountBalanceHistory } from "@xyo-network/react-chain-provider";
|
|
9
6
|
import { ErrorRender as ErrorRender3 } from "@xyo-network/react-error";
|
|
10
7
|
import { AttoXL1 } from "@xyo-network/xl1-sdk";
|
|
11
|
-
import React31 from "react";
|
|
12
8
|
|
|
13
9
|
// src/components/account/helpers/formatBalanceMagnitude.ts
|
|
14
10
|
import { XL1Amount } from "@xyo-network/xl1-sdk";
|
|
15
|
-
var formatBalanceMagnitude =
|
|
11
|
+
var formatBalanceMagnitude = (set) => {
|
|
16
12
|
const [received, sent] = set;
|
|
17
13
|
const netBalance = received - sent;
|
|
18
14
|
return netBalance < 0n ? `-${formatBalance(sent - received)}` : formatBalance(netBalance);
|
|
19
|
-
}
|
|
20
|
-
var formatBalance =
|
|
15
|
+
};
|
|
16
|
+
var formatBalance = (balance) => {
|
|
21
17
|
const xl1Amount = new XL1Amount(balance);
|
|
22
18
|
return xl1Amount.toString(void 0, {
|
|
23
19
|
places: 18,
|
|
@@ -26,25 +22,30 @@ var formatBalance = /* @__PURE__ */ __name((balance) => {
|
|
|
26
22
|
minDecimals: 1,
|
|
27
23
|
locale: navigator.language
|
|
28
24
|
});
|
|
29
|
-
}
|
|
25
|
+
};
|
|
30
26
|
|
|
31
27
|
// src/components/account/table/BalanceHistoryTableEx.tsx
|
|
32
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
TableBody as TableBody2,
|
|
30
|
+
TableCell as TableCell15,
|
|
31
|
+
TableHead as TableHead2,
|
|
32
|
+
TableRow as TableRow3
|
|
33
|
+
} from "@mui/material";
|
|
33
34
|
import { isDefined as isDefined7 } from "@xylabs/sdk-js";
|
|
34
35
|
import { TableEx as TableEx2 } from "@xyo-network/react-table";
|
|
35
|
-
import React30 from "react";
|
|
36
36
|
|
|
37
37
|
// src/components/account/table/BalanceHistoryTableRow.tsx
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
TableCell as TableCell14
|
|
40
|
+
} from "@mui/material";
|
|
39
41
|
import { isDefined as isDefined6 } from "@xylabs/sdk-js";
|
|
40
42
|
import { RawInfoIconButton } from "@xyo-network/react-payload-raw-info";
|
|
41
|
-
import
|
|
43
|
+
import { useMemo as useMemo7 } from "react";
|
|
42
44
|
|
|
43
45
|
// src/components/block/BlockHeadingFlexbox.tsx
|
|
44
46
|
import { FlexCol as FlexCol2, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
45
47
|
import { BWVerification, HashHeadingPaper } from "@xyo-network/react-boundwitness-plugin";
|
|
46
48
|
import { usePayloadHash } from "@xyo-network/react-shared";
|
|
47
|
-
import React12 from "react";
|
|
48
49
|
|
|
49
50
|
// src/context/analyzer/context.ts
|
|
50
51
|
import { createContextEx } from "@xylabs/react-shared";
|
|
@@ -52,7 +53,7 @@ var ChainAnalyzersContext = createContextEx();
|
|
|
52
53
|
|
|
53
54
|
// src/context/analyzer/use.ts
|
|
54
55
|
import { useContextEx } from "@xylabs/react-shared";
|
|
55
|
-
var useChainAnalyzersContext =
|
|
56
|
+
var useChainAnalyzersContext = (required = false) => useContextEx(ChainAnalyzersContext, "ChainAnalyzers", required);
|
|
56
57
|
|
|
57
58
|
// src/context/polling/context.ts
|
|
58
59
|
import { createContextEx as createContextEx2 } from "@xylabs/react-shared";
|
|
@@ -60,16 +61,20 @@ var ChainPollingContext = createContextEx2();
|
|
|
60
61
|
|
|
61
62
|
// src/context/polling/use.ts
|
|
62
63
|
import { useContextEx as useContextEx2 } from "@xylabs/react-shared";
|
|
63
|
-
var useChainPollingContext =
|
|
64
|
+
var useChainPollingContext = (required = false) => useContextEx2(ChainPollingContext, "ChainPolling", required);
|
|
64
65
|
|
|
65
66
|
// src/components/transactions/submit/Builder.tsx
|
|
66
|
-
import {
|
|
67
|
+
import {
|
|
68
|
+
Button,
|
|
69
|
+
FormControl,
|
|
70
|
+
TextField
|
|
71
|
+
} from "@mui/material";
|
|
67
72
|
import { FlexCol } from "@xylabs/react-flexbox";
|
|
68
73
|
import { toHex } from "@xylabs/sdk-js";
|
|
69
74
|
import { defaultTransactionFees, toXL1BlockNumber } from "@xyo-network/xl1-sdk";
|
|
70
|
-
import
|
|
71
|
-
var ChainTransactionBuilder =
|
|
72
|
-
const handleSubmit =
|
|
75
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
76
|
+
var ChainTransactionBuilder = ({ onSubmitTx }) => {
|
|
77
|
+
const handleSubmit = async (event) => {
|
|
73
78
|
event.preventDefault();
|
|
74
79
|
const formData = new FormData(event.currentTarget);
|
|
75
80
|
const chainTx = {
|
|
@@ -84,52 +89,31 @@ var ChainTransactionBuilder = /* @__PURE__ */ __name(({ onSubmitTx }) => {
|
|
|
84
89
|
}
|
|
85
90
|
};
|
|
86
91
|
await onSubmitTx?.(chainTx);
|
|
87
|
-
}
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
}, /* @__PURE__ */ React2.createElement(FormControl, {
|
|
98
|
-
fullWidth: true
|
|
99
|
-
}, /* @__PURE__ */ React2.createElement(TextField, {
|
|
100
|
-
label: "Chain Address",
|
|
101
|
-
name: "chain",
|
|
102
|
-
required: true
|
|
103
|
-
})), /* @__PURE__ */ React2.createElement(FormControl, {
|
|
104
|
-
fullWidth: true
|
|
105
|
-
}, /* @__PURE__ */ React2.createElement(TextField, {
|
|
106
|
-
label: "Gas",
|
|
107
|
-
name: "gas",
|
|
108
|
-
required: true
|
|
109
|
-
})), /* @__PURE__ */ React2.createElement(FormControl, {
|
|
110
|
-
fullWidth: true
|
|
111
|
-
}, /* @__PURE__ */ React2.createElement(TextField, {
|
|
112
|
-
label: "Not Before Block",
|
|
113
|
-
name: "nbf",
|
|
114
|
-
required: true
|
|
115
|
-
})), /* @__PURE__ */ React2.createElement(FormControl, {
|
|
116
|
-
fullWidth: true
|
|
117
|
-
}, /* @__PURE__ */ React2.createElement(TextField, {
|
|
118
|
-
label: "Not After Block",
|
|
119
|
-
name: "exp",
|
|
120
|
-
required: true
|
|
121
|
-
})), /* @__PURE__ */ React2.createElement(Button, {
|
|
122
|
-
type: "submit",
|
|
123
|
-
variant: "contained"
|
|
124
|
-
}, "Submit")));
|
|
125
|
-
}, "ChainTransactionBuilder");
|
|
92
|
+
};
|
|
93
|
+
return /* @__PURE__ */ jsx("form", { onSubmit: (event) => void handleSubmit(event), style: { width: "100%" }, children: /* @__PURE__ */ jsxs(FlexCol, { sx: { gap: 2 }, children: [
|
|
94
|
+
/* @__PURE__ */ jsx(FormControl, { fullWidth: true, children: /* @__PURE__ */ jsx(TextField, { label: "Chain Address", name: "chain", required: true }) }),
|
|
95
|
+
/* @__PURE__ */ jsx(FormControl, { fullWidth: true, children: /* @__PURE__ */ jsx(TextField, { label: "Gas", name: "gas", required: true }) }),
|
|
96
|
+
/* @__PURE__ */ jsx(FormControl, { fullWidth: true, children: /* @__PURE__ */ jsx(TextField, { label: "Not Before Block", name: "nbf", required: true }) }),
|
|
97
|
+
/* @__PURE__ */ jsx(FormControl, { fullWidth: true, children: /* @__PURE__ */ jsx(TextField, { label: "Not After Block", name: "exp", required: true }) }),
|
|
98
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", variant: "contained", children: "Submit" })
|
|
99
|
+
] }) });
|
|
100
|
+
};
|
|
126
101
|
|
|
127
102
|
// src/components/transactions/submit/Network.tsx
|
|
128
|
-
import {
|
|
129
|
-
|
|
130
|
-
|
|
103
|
+
import {
|
|
104
|
+
FormControl as FormControl2,
|
|
105
|
+
FormHelperText,
|
|
106
|
+
TextField as TextField2
|
|
107
|
+
} from "@mui/material";
|
|
108
|
+
import { useState } from "react";
|
|
109
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
110
|
+
var ChainTransactionNetwork = ({
|
|
111
|
+
network,
|
|
112
|
+
onNetworkChange,
|
|
113
|
+
...props
|
|
114
|
+
}) => {
|
|
131
115
|
const [error, setError] = useState();
|
|
132
|
-
const handleChange =
|
|
116
|
+
const handleChange = (event) => {
|
|
133
117
|
try {
|
|
134
118
|
const url = new URL(event.target.value);
|
|
135
119
|
setError(void 0);
|
|
@@ -138,55 +122,54 @@ var ChainTransactionNetwork = /* @__PURE__ */ __name(({ network, onNetworkChange
|
|
|
138
122
|
console.error(error2);
|
|
139
123
|
setError(error2);
|
|
140
124
|
}
|
|
141
|
-
}
|
|
142
|
-
return /* @__PURE__ */
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
onChange: handleChange,
|
|
148
|
-
required: true,
|
|
149
|
-
value: network,
|
|
150
|
-
...props
|
|
151
|
-
}), /* @__PURE__ */ React3.createElement(FormHelperText, {
|
|
152
|
-
sx: {
|
|
153
|
-
color: error ? "red" : void 0
|
|
154
|
-
}
|
|
155
|
-
}, error ? "Not a valid url" : "Enter full url of archivist"));
|
|
156
|
-
}, "ChainTransactionNetwork");
|
|
125
|
+
};
|
|
126
|
+
return /* @__PURE__ */ jsxs2(FormControl2, { fullWidth: true, children: [
|
|
127
|
+
/* @__PURE__ */ jsx2(TextField2, { label: "Network", name: "network", onChange: handleChange, required: true, value: network, ...props }),
|
|
128
|
+
/* @__PURE__ */ jsx2(FormHelperText, { sx: { color: error ? "red" : void 0 }, children: error ? "Not a valid url" : "Enter full url of archivist" })
|
|
129
|
+
] });
|
|
130
|
+
};
|
|
157
131
|
|
|
158
132
|
// src/components/transactions/submit/SubmitChain.tsx
|
|
159
|
-
import {
|
|
133
|
+
import {
|
|
134
|
+
Alert,
|
|
135
|
+
Grid,
|
|
136
|
+
Typography
|
|
137
|
+
} from "@mui/material";
|
|
160
138
|
import { ErrorRender } from "@xylabs/react-error";
|
|
161
139
|
import { FlexGrowCol } from "@xylabs/react-flexbox";
|
|
162
140
|
import { FetchJsonClient } from "@xylabs/sdk-js";
|
|
163
|
-
import {
|
|
141
|
+
import {
|
|
142
|
+
Account,
|
|
143
|
+
ArchivistInsertQuerySchema,
|
|
144
|
+
PayloadBuilder,
|
|
145
|
+
QueryBoundWitnessBuilder
|
|
146
|
+
} from "@xyo-network/sdk-js";
|
|
164
147
|
import { buildTransaction } from "@xyo-network/xl1-sdk";
|
|
165
|
-
import
|
|
148
|
+
import { useState as useState2 } from "react";
|
|
149
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
166
150
|
var BETA_PENDING_TRANSACTIONS_ARCHIVIST = "https://beta.api.chain.xyo.network/8050fee682a2762f504d5449d8269a6f17f0b693";
|
|
167
151
|
var defaultNetwork = new URL(BETA_PENDING_TRANSACTIONS_ARCHIVIST);
|
|
168
|
-
var SubmitChainTransaction =
|
|
152
|
+
var SubmitChainTransaction = () => {
|
|
169
153
|
const [network, setNetwork] = useState2(defaultNetwork);
|
|
170
154
|
const [result, setResult] = useState2();
|
|
171
155
|
const [error, setError] = useState2();
|
|
172
|
-
const onSubmitTx =
|
|
156
|
+
const onSubmitTx = async (chainTx) => {
|
|
173
157
|
if (network) {
|
|
174
158
|
const randomAccount = await Account.random();
|
|
175
|
-
const [transactionBoundWitness] = await buildTransaction(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
]);
|
|
159
|
+
const [transactionBoundWitness] = await buildTransaction(
|
|
160
|
+
chainTx.chain,
|
|
161
|
+
[],
|
|
162
|
+
[],
|
|
163
|
+
randomAccount,
|
|
164
|
+
chainTx.nbf,
|
|
165
|
+
chainTx.exp
|
|
166
|
+
);
|
|
167
|
+
const insertQuery = new PayloadBuilder({ schema: ArchivistInsertQuerySchema }).build();
|
|
168
|
+
const [queryBoundWitness] = await new QueryBoundWitnessBuilder().payloads([transactionBoundWitness]).query(insertQuery).signer(randomAccount).build();
|
|
169
|
+
const response = await new FetchJsonClient().post(
|
|
170
|
+
network.href,
|
|
171
|
+
[queryBoundWitness, [insertQuery, transactionBoundWitness, chainTx]]
|
|
172
|
+
);
|
|
190
173
|
const envelope = response.data;
|
|
191
174
|
if (!envelope) {
|
|
192
175
|
setError(new Error("Empty response from archivist"));
|
|
@@ -196,72 +179,91 @@ var SubmitChainTransaction = /* @__PURE__ */ __name(() => {
|
|
|
196
179
|
setResult(envelope.data);
|
|
197
180
|
}
|
|
198
181
|
}
|
|
199
|
-
}
|
|
200
|
-
const onNetworkChange =
|
|
182
|
+
};
|
|
183
|
+
const onNetworkChange = (url) => {
|
|
201
184
|
setNetwork(url);
|
|
202
|
-
}
|
|
203
|
-
return /* @__PURE__ */
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
185
|
+
};
|
|
186
|
+
return /* @__PURE__ */ jsx3(Grid, { container: true, children: /* @__PURE__ */ jsx3(
|
|
187
|
+
Grid,
|
|
188
|
+
{
|
|
189
|
+
size: {
|
|
190
|
+
xs: 12,
|
|
191
|
+
sm: 6,
|
|
192
|
+
md: 4
|
|
193
|
+
},
|
|
194
|
+
children: /* @__PURE__ */ jsxs3(
|
|
195
|
+
FlexGrowCol,
|
|
196
|
+
{
|
|
197
|
+
sx: {
|
|
198
|
+
alignItems: "start",
|
|
199
|
+
gap: 2
|
|
200
|
+
},
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ jsx3(ChainTransactionNetwork, { network, onNetworkChange }),
|
|
203
|
+
network ? /* @__PURE__ */ jsx3(ChainTransactionBuilder, { onSubmitTx }) : null,
|
|
204
|
+
result?.[2].length === 0 ? /* @__PURE__ */ jsx3(Alert, { severity: "success", children: "Success" }) : null,
|
|
205
|
+
error ? /* @__PURE__ */ jsx3(ErrorRender, { error }) : null,
|
|
206
|
+
result?.[2] && result?.[2].length > 0 ? /* @__PURE__ */ jsx3(ErrorRender, { error: new Error("Failed insert...see result below") }) : null,
|
|
207
|
+
result ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
208
|
+
/* @__PURE__ */ jsx3(Typography, { variant: "h6", children: "Result:" }),
|
|
209
|
+
/* @__PURE__ */ jsx3("pre", { children: JSON.stringify(result, null, 2) })
|
|
210
|
+
] }) : null
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
)
|
|
215
214
|
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
onNetworkChange
|
|
219
|
-
}), network ? /* @__PURE__ */ React4.createElement(ChainTransactionBuilder, {
|
|
220
|
-
onSubmitTx
|
|
221
|
-
}) : null, result?.[2].length === 0 ? /* @__PURE__ */ React4.createElement(Alert, {
|
|
222
|
-
severity: "success"
|
|
223
|
-
}, "Success") : null, error ? /* @__PURE__ */ React4.createElement(ErrorRender, {
|
|
224
|
-
error
|
|
225
|
-
}) : null, result?.[2] && result?.[2].length > 0 ? /* @__PURE__ */ React4.createElement(ErrorRender, {
|
|
226
|
-
error: new Error("Failed insert...see result below")
|
|
227
|
-
}) : null, result ? /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(Typography, {
|
|
228
|
-
variant: "h6"
|
|
229
|
-
}, "Result:"), /* @__PURE__ */ React4.createElement("pre", null, JSON.stringify(result, null, 2))) : null)));
|
|
230
|
-
}, "SubmitChainTransaction");
|
|
215
|
+
) });
|
|
216
|
+
};
|
|
231
217
|
|
|
232
218
|
// src/components/transactions/TransactionCountChip.tsx
|
|
233
219
|
import CompareArrowsIcon from "@mui/icons-material/CompareArrows";
|
|
234
220
|
import { Chip, Icon } from "@mui/material";
|
|
235
|
-
import
|
|
236
|
-
|
|
221
|
+
import { useMemo } from "react";
|
|
222
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
223
|
+
var TransactionCountChip = ({
|
|
224
|
+
transactions,
|
|
225
|
+
sx,
|
|
226
|
+
...props
|
|
227
|
+
}) => {
|
|
237
228
|
const label = useMemo(() => {
|
|
238
229
|
if (!transactions) return "0";
|
|
239
230
|
return transactions?.length > 10 ? "+10" : transactions.length;
|
|
240
|
-
}, [
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
231
|
+
}, [transactions]);
|
|
232
|
+
return /* @__PURE__ */ jsx4(
|
|
233
|
+
Chip,
|
|
234
|
+
{
|
|
235
|
+
avatar: /* @__PURE__ */ jsx4(Icon, { children: /* @__PURE__ */ jsx4(CompareArrowsIcon, {}) }),
|
|
236
|
+
label,
|
|
237
|
+
title: transactions ? `Block contains ${transactions.length} transactions` : void 0,
|
|
238
|
+
sx: {
|
|
239
|
+
display: "inline-flex",
|
|
240
|
+
alignItems: "center",
|
|
241
|
+
justifyContent: "center",
|
|
242
|
+
...sx
|
|
243
|
+
},
|
|
244
|
+
...props
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
};
|
|
256
248
|
|
|
257
249
|
// src/components/transactions/TransactionsQuickTipButton.tsx
|
|
258
250
|
import { ContentCopy as ContentCopyIcon, Paid } from "@mui/icons-material";
|
|
259
|
-
import {
|
|
251
|
+
import {
|
|
252
|
+
Alert as Alert2,
|
|
253
|
+
AlertTitle,
|
|
254
|
+
Collapse,
|
|
255
|
+
Snackbar,
|
|
256
|
+
Typography as Typography2
|
|
257
|
+
} from "@mui/material";
|
|
260
258
|
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
261
|
-
import {
|
|
259
|
+
import {
|
|
260
|
+
FlexGrowCol as FlexGrowCol2,
|
|
261
|
+
FlexGrowRow,
|
|
262
|
+
FlexRow
|
|
263
|
+
} from "@xylabs/react-flexbox";
|
|
262
264
|
import { QuickTipButton } from "@xylabs/react-quick-tip-button";
|
|
263
265
|
import { isDefined as isDefined2 } from "@xylabs/sdk-js";
|
|
264
|
-
import
|
|
266
|
+
import { Fragment as Fragment2, useState as useState4 } from "react";
|
|
265
267
|
|
|
266
268
|
// src/hooks/chain-iterator/useChainIteratorParams.ts
|
|
267
269
|
import { usePromise } from "@xylabs/react-promise";
|
|
@@ -269,23 +271,29 @@ import { isHash } from "@xylabs/sdk-js";
|
|
|
269
271
|
import { assertEx, isDefined } from "@xylabs/sdk-js";
|
|
270
272
|
import { BoundWitnessBuilder } from "@xyo-network/sdk-js";
|
|
271
273
|
import { ConfigZod, isBlockBoundWitness } from "@xyo-network/xl1-sdk";
|
|
272
|
-
var resolveDefinedHead =
|
|
273
|
-
const [headPayload] = await chainArchivist.get([
|
|
274
|
-
head
|
|
275
|
-
]);
|
|
274
|
+
var resolveDefinedHead = async (head, chainArchivist) => {
|
|
275
|
+
const [headPayload] = await chainArchivist.get([head]);
|
|
276
276
|
if (headPayload === void 0) {
|
|
277
277
|
const [currentHead] = await new BoundWitnessBuilder().build();
|
|
278
278
|
return currentHead;
|
|
279
279
|
} else {
|
|
280
280
|
return assertEx(isBlockBoundWitness(headPayload) ? headPayload : void 0, () => `Expected a block bound witness: ${JSON.stringify(headPayload)}`);
|
|
281
281
|
}
|
|
282
|
-
}
|
|
283
|
-
var useChainIteratorParams =
|
|
282
|
+
};
|
|
283
|
+
var useChainIteratorParams = ({
|
|
284
|
+
chainMap,
|
|
285
|
+
chainId,
|
|
286
|
+
head,
|
|
287
|
+
name
|
|
288
|
+
}) => {
|
|
284
289
|
return usePromise(async () => {
|
|
285
290
|
if (isDefined(chainMap) && isDefined(chainId) && isHash(head)) {
|
|
286
291
|
const result = await chainMap.get(head);
|
|
287
292
|
const foundResult = assertEx(result, () => `Head not found: ${head}`);
|
|
288
|
-
const resolvedHead = assertEx(
|
|
293
|
+
const resolvedHead = assertEx(
|
|
294
|
+
isBlockBoundWitness(foundResult) ? foundResult : void 0,
|
|
295
|
+
() => `Head is not a boundwitness: ${JSON.stringify(foundResult)}`
|
|
296
|
+
);
|
|
289
297
|
const config = ConfigZod.parse({});
|
|
290
298
|
config.chain.id = chainId;
|
|
291
299
|
return {
|
|
@@ -296,22 +304,15 @@ var useChainIteratorParams = /* @__PURE__ */ __name(({ chainMap, chainId, head,
|
|
|
296
304
|
name
|
|
297
305
|
};
|
|
298
306
|
}
|
|
299
|
-
}, [
|
|
300
|
-
|
|
301
|
-
chainId,
|
|
302
|
-
head
|
|
303
|
-
]);
|
|
304
|
-
}, "useChainIteratorParams");
|
|
307
|
+
}, [chainMap, chainId, head]);
|
|
308
|
+
};
|
|
305
309
|
|
|
306
310
|
// src/hooks/useBaseContext.ts
|
|
307
311
|
import { useState as useState3 } from "react";
|
|
308
|
-
var useBaseContext =
|
|
309
|
-
const [context] = useState3({
|
|
310
|
-
caches: {},
|
|
311
|
-
singletons: {}
|
|
312
|
-
});
|
|
312
|
+
var useBaseContext = () => {
|
|
313
|
+
const [context] = useState3({ caches: {}, singletons: {} });
|
|
313
314
|
return context;
|
|
314
|
-
}
|
|
315
|
+
};
|
|
315
316
|
|
|
316
317
|
// src/hooks/useTxsFromBlock.ts
|
|
317
318
|
import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
@@ -319,26 +320,25 @@ import { usePromise as usePromise2 } from "@xylabs/react-promise";
|
|
|
319
320
|
// src/helpers/txsFromBlock.ts
|
|
320
321
|
import { HydratedBlockWrapper } from "@xyo-network/chain-wrappers";
|
|
321
322
|
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/sdk-js";
|
|
322
|
-
var txsFromBlock =
|
|
323
|
+
var txsFromBlock = async (block) => {
|
|
323
324
|
const wrapper = await HydratedBlockWrapper.parse(block);
|
|
324
325
|
const txs = wrapper.transactions;
|
|
325
326
|
const txPayloads = txs.map((tx) => tx.boundWitness);
|
|
326
327
|
return await PayloadBuilder2.hashPairs(txPayloads);
|
|
327
|
-
}
|
|
328
|
+
};
|
|
328
329
|
|
|
329
330
|
// src/hooks/useTxsFromBlock.ts
|
|
330
|
-
var useTxsFromBlock =
|
|
331
|
+
var useTxsFromBlock = (block) => {
|
|
331
332
|
return usePromise2(async () => {
|
|
332
333
|
if (block) {
|
|
333
334
|
return await txsFromBlock(block);
|
|
334
335
|
}
|
|
335
|
-
}, [
|
|
336
|
-
|
|
337
|
-
]);
|
|
338
|
-
}, "useTxsFromBlock");
|
|
336
|
+
}, [block]);
|
|
337
|
+
};
|
|
339
338
|
|
|
340
339
|
// src/components/transactions/TransactionsQuickTipButton.tsx
|
|
341
|
-
|
|
340
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
341
|
+
var TransactionsQuickTipButton = ({ block, ...props }) => {
|
|
342
342
|
const [transactions, transactionsError] = useTxsFromBlock(block);
|
|
343
343
|
const [copied, setCopied] = useState4(false);
|
|
344
344
|
const [closeDialog, setCloseDialog] = useState4(false);
|
|
@@ -348,70 +348,76 @@ var TransactionsQuickTipButton = /* @__PURE__ */ __name(({ block, ...props }) =>
|
|
|
348
348
|
setPreviousTransactionError(transactionsError);
|
|
349
349
|
setCloseDialog(false);
|
|
350
350
|
}
|
|
351
|
-
const onCopy =
|
|
351
|
+
const onCopy = async (transactionHash) => {
|
|
352
352
|
await navigator.clipboard.writeText(transactionHash);
|
|
353
353
|
setCopied(true);
|
|
354
354
|
setTimeout(() => {
|
|
355
355
|
setCopied(false);
|
|
356
356
|
}, 5e3);
|
|
357
|
-
}
|
|
358
|
-
return /* @__PURE__ */
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
357
|
+
};
|
|
358
|
+
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
359
|
+
/* @__PURE__ */ jsx5(
|
|
360
|
+
QuickTipButton,
|
|
361
|
+
{
|
|
362
|
+
Icon: Paid,
|
|
363
|
+
disabled: transactions?.length === 0,
|
|
364
|
+
hoverText: `Transaction Count: ${transactions?.length ?? 0}`,
|
|
365
|
+
disableDialog: transactions?.length === 0,
|
|
366
|
+
dialogProps: { fullWidth: true, maxWidth: "md" },
|
|
367
|
+
...props,
|
|
368
|
+
children: transactions?.length === 0 ? null : /* @__PURE__ */ jsx5(
|
|
369
|
+
FlexGrowCol2,
|
|
370
|
+
{
|
|
371
|
+
sx: {
|
|
372
|
+
gap: 1,
|
|
373
|
+
alignItems: "stretch"
|
|
374
|
+
},
|
|
375
|
+
children: transactions?.map(([_transaction, hash]) => /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
376
|
+
/* @__PURE__ */ jsxs4(
|
|
377
|
+
FlexGrowRow,
|
|
378
|
+
{
|
|
379
|
+
sx: {
|
|
380
|
+
gap: 2,
|
|
381
|
+
justifyContent: "start"
|
|
382
|
+
},
|
|
383
|
+
children: [
|
|
384
|
+
/* @__PURE__ */ jsx5(ContentCopyIcon, { sx: { cursor: "pointer" }, onClick: () => void onCopy(hash) }),
|
|
385
|
+
/* @__PURE__ */ jsx5(
|
|
386
|
+
Typography2,
|
|
387
|
+
{
|
|
388
|
+
sx: {
|
|
389
|
+
overflow: "hidden",
|
|
390
|
+
textOverflow: "ellipsis",
|
|
391
|
+
whiteSpace: "nowrap"
|
|
392
|
+
},
|
|
393
|
+
children: hash
|
|
394
|
+
}
|
|
395
|
+
)
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ jsx5(FlexRow, { children: /* @__PURE__ */ jsx5(Collapse, { in: copied, unmountOnExit: true, children: /* @__PURE__ */ jsx5(Alert2, { children: /* @__PURE__ */ jsx5(AlertTitle, { children: "Previous hash copied to clipboard" }) }) }) })
|
|
400
|
+
] }, hash))
|
|
401
|
+
}
|
|
402
|
+
)
|
|
403
|
+
}
|
|
404
|
+
),
|
|
405
|
+
/* @__PURE__ */ jsx5(Snackbar, { open: open && closeDialog === false, onClose: () => setCloseDialog(true), children: /* @__PURE__ */ jsx5(ErrorRender2, { error: transactionsError, scope: "TransactionsQuickTipButton" }) })
|
|
406
|
+
] });
|
|
407
|
+
};
|
|
402
408
|
|
|
403
409
|
// src/components/block/hooks/useAnchorElement.ts
|
|
404
410
|
import { useRef, useState as useState5 } from "react";
|
|
405
|
-
var useAnchorElement =
|
|
411
|
+
var useAnchorElement = () => {
|
|
406
412
|
const [anchorEl, setAnchorEl] = useState5(null);
|
|
407
413
|
const anchorRef = useRef(null);
|
|
408
414
|
const open = Boolean(anchorEl);
|
|
409
|
-
const handleClick =
|
|
415
|
+
const handleClick = (event) => {
|
|
410
416
|
setAnchorEl(event.currentTarget);
|
|
411
|
-
}
|
|
412
|
-
const handleClose =
|
|
417
|
+
};
|
|
418
|
+
const handleClose = () => {
|
|
413
419
|
setAnchorEl(null);
|
|
414
|
-
}
|
|
420
|
+
};
|
|
415
421
|
return {
|
|
416
422
|
anchorEl,
|
|
417
423
|
anchorRef,
|
|
@@ -419,260 +425,262 @@ var useAnchorElement = /* @__PURE__ */ __name(() => {
|
|
|
419
425
|
handleClick,
|
|
420
426
|
handleClose
|
|
421
427
|
};
|
|
422
|
-
}
|
|
428
|
+
};
|
|
423
429
|
|
|
424
430
|
// src/components/block/hooks/useBlockHeadingEvents.ts
|
|
425
431
|
import { useEvent } from "@xyo-network/react-event";
|
|
426
|
-
var useBlockHeadingEvents =
|
|
432
|
+
var useBlockHeadingEvents = (...args) => {
|
|
427
433
|
return useEvent(...args);
|
|
428
|
-
}
|
|
434
|
+
};
|
|
429
435
|
|
|
430
436
|
// src/components/block/hooks/useBlockProducer.ts
|
|
431
437
|
import { useMemo as useMemo2 } from "react";
|
|
432
|
-
var useBlockProducer =
|
|
438
|
+
var useBlockProducer = (block) => {
|
|
433
439
|
return useMemo2(() => {
|
|
434
440
|
if (block) {
|
|
435
441
|
const producer = block[0].addresses[0];
|
|
436
442
|
return producer;
|
|
437
443
|
}
|
|
438
|
-
}, [
|
|
439
|
-
|
|
440
|
-
]);
|
|
441
|
-
}, "useBlockProducer");
|
|
444
|
+
}, [block]);
|
|
445
|
+
};
|
|
442
446
|
|
|
443
447
|
// src/components/block/hooks/usePayloadCountsFromBlock.ts
|
|
444
448
|
import { useMemo as useMemo3 } from "react";
|
|
445
449
|
|
|
446
450
|
// src/components/block/helpers/blockProducer.ts
|
|
447
|
-
var blockProducer =
|
|
451
|
+
var blockProducer = (block) => {
|
|
448
452
|
return block.addresses[0];
|
|
449
|
-
}
|
|
453
|
+
};
|
|
450
454
|
|
|
451
455
|
// src/components/block/helpers/buildBlockChainRenderComponent.tsx
|
|
452
|
-
import
|
|
453
|
-
var buildBlockChainRenderComponent =
|
|
456
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
457
|
+
var buildBlockChainRenderComponent = async (context, BlockComponent, blockComponentProps) => {
|
|
454
458
|
const { block, ...remainingProps } = blockComponentProps;
|
|
455
459
|
const blockTxs = await txsFromBlock(block);
|
|
456
460
|
const txHashes = blockTxs.map(([_, hash]) => hash);
|
|
457
461
|
const item = {
|
|
458
|
-
child: /* @__PURE__ */
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
462
|
+
child: /* @__PURE__ */ jsx6(
|
|
463
|
+
BlockComponent,
|
|
464
|
+
{
|
|
465
|
+
block,
|
|
466
|
+
transactions: txHashes,
|
|
467
|
+
...remainingProps
|
|
468
|
+
}
|
|
469
|
+
),
|
|
463
470
|
key: block[0].block.toString(),
|
|
464
471
|
block
|
|
465
472
|
};
|
|
466
473
|
return item;
|
|
467
|
-
}
|
|
474
|
+
};
|
|
468
475
|
|
|
469
476
|
// src/components/block/helpers/payloadCountsFromBlock.ts
|
|
470
477
|
import { BoundWitnessSchema } from "@xyo-network/boundwitness-model";
|
|
471
478
|
import { isTransactionBoundWitness } from "@xyo-network/xl1-sdk";
|
|
472
|
-
var payloadCountsFromBlock =
|
|
479
|
+
var payloadCountsFromBlock = ([block, payloads]) => {
|
|
473
480
|
const publicPayloads = block.payload_schemas.filter((schema) => schema !== BoundWitnessSchema);
|
|
474
481
|
const transactionHashes = payloads.filter((payload) => isTransactionBoundWitness(payload)).flatMap((payload) => payload.payload_hashes);
|
|
475
482
|
const privateHashes = transactionHashes.filter((hash) => !payloads.some((payload) => payload._hash === hash));
|
|
476
|
-
return [
|
|
477
|
-
|
|
478
|
-
privateHashes.length
|
|
479
|
-
];
|
|
480
|
-
}, "payloadCountsFromBlock");
|
|
483
|
+
return [publicPayloads.length, privateHashes.length];
|
|
484
|
+
};
|
|
481
485
|
|
|
482
486
|
// src/components/block/hooks/usePayloadCountsFromBlock.ts
|
|
483
|
-
var usePayloadCountsFromBlock =
|
|
487
|
+
var usePayloadCountsFromBlock = (block) => {
|
|
484
488
|
return useMemo3(() => {
|
|
485
489
|
if (block) {
|
|
486
|
-
return [
|
|
487
|
-
...payloadCountsFromBlock(block),
|
|
488
|
-
void 0
|
|
489
|
-
];
|
|
490
|
+
return [...payloadCountsFromBlock(block), void 0];
|
|
490
491
|
}
|
|
491
|
-
return [
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
void 0
|
|
495
|
-
];
|
|
496
|
-
}, [
|
|
497
|
-
block
|
|
498
|
-
]);
|
|
499
|
-
}, "usePayloadCountsFromBlock");
|
|
492
|
+
return [void 0, void 0, void 0];
|
|
493
|
+
}, [block]);
|
|
494
|
+
};
|
|
500
495
|
|
|
501
496
|
// src/components/block/LinkedDivider.tsx
|
|
502
497
|
import { Divider, Stack } from "@mui/material";
|
|
503
|
-
import
|
|
504
|
-
var LinkedDivider =
|
|
505
|
-
return /* @__PURE__ */
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
498
|
+
import { Fragment as Fragment4, jsx as jsx7 } from "react/jsx-runtime";
|
|
499
|
+
var LinkedDivider = () => {
|
|
500
|
+
return /* @__PURE__ */ jsx7(Fragment4, { children: /* @__PURE__ */ jsx7(
|
|
501
|
+
Stack,
|
|
502
|
+
{
|
|
503
|
+
className: "divider-spacer",
|
|
504
|
+
sx: {
|
|
505
|
+
justifyContent: "end",
|
|
506
|
+
width: "50%",
|
|
507
|
+
height: 24
|
|
508
|
+
},
|
|
509
|
+
children: /* @__PURE__ */ jsx7(
|
|
510
|
+
Divider,
|
|
511
|
+
{
|
|
512
|
+
className: "divider",
|
|
513
|
+
orientation: "vertical",
|
|
514
|
+
flexItem: true,
|
|
515
|
+
sx: {
|
|
516
|
+
borderRightWidth: 2,
|
|
517
|
+
height: 24,
|
|
518
|
+
transition: "height 1s"
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
)
|
|
520
522
|
}
|
|
521
|
-
})
|
|
522
|
-
}
|
|
523
|
+
) });
|
|
524
|
+
};
|
|
523
525
|
|
|
524
526
|
// src/components/block/menu/Expanded.tsx
|
|
525
527
|
import { MoreVert } from "@mui/icons-material";
|
|
526
528
|
import { IconButton, Menu } from "@mui/material";
|
|
527
529
|
import { BWJsonMenuItem, BWPreviousHashMenuItem } from "@xyo-network/react-boundwitness-plugin";
|
|
528
|
-
import
|
|
529
|
-
var BlockMenuExpanded =
|
|
530
|
-
const {
|
|
531
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(IconButton, {
|
|
532
|
-
ref: anchorRef,
|
|
533
|
-
size: "small",
|
|
534
|
-
onClick: handleClick
|
|
535
|
-
}, /* @__PURE__ */ React9.createElement(MoreVert, {
|
|
536
|
-
fontSize: "inherit"
|
|
537
|
-
})), /* @__PURE__ */ React9.createElement(Menu, {
|
|
538
|
-
open,
|
|
530
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
531
|
+
var BlockMenuExpanded = ({ block }) => {
|
|
532
|
+
const {
|
|
539
533
|
anchorEl,
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
534
|
+
anchorRef,
|
|
535
|
+
open,
|
|
536
|
+
handleClick,
|
|
537
|
+
handleClose
|
|
538
|
+
} = useAnchorElement();
|
|
539
|
+
return /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
540
|
+
/* @__PURE__ */ jsx8(IconButton, { ref: anchorRef, size: "small", onClick: handleClick, children: /* @__PURE__ */ jsx8(MoreVert, { fontSize: "inherit" }) }),
|
|
541
|
+
/* @__PURE__ */ jsxs5(
|
|
542
|
+
Menu,
|
|
543
|
+
{
|
|
544
|
+
open,
|
|
545
|
+
anchorEl,
|
|
546
|
+
anchorOrigin: { horizontal: "left", vertical: "bottom" },
|
|
547
|
+
onClose: handleClose,
|
|
548
|
+
children: [
|
|
549
|
+
/* @__PURE__ */ jsx8(BWPreviousHashMenuItem, { boundwitness: block?.[0], dense: true, onDialogClose: handleClose }),
|
|
550
|
+
/* @__PURE__ */ jsx8(BWJsonMenuItem, { boundwitness: block?.[0], dense: true, onDialogClose: handleClose })
|
|
551
|
+
]
|
|
552
|
+
}
|
|
553
|
+
)
|
|
554
|
+
] });
|
|
555
|
+
};
|
|
555
556
|
|
|
556
557
|
// src/components/block/ProducerChip.tsx
|
|
557
558
|
import { Chip as Chip2 } from "@mui/material";
|
|
558
|
-
import {
|
|
559
|
+
import {
|
|
560
|
+
EthAddressWrapper,
|
|
561
|
+
isString,
|
|
562
|
+
isUndefined,
|
|
563
|
+
toAddress
|
|
564
|
+
} from "@xylabs/sdk-js";
|
|
559
565
|
import { BlockiesAvatar } from "@xyo-network/xl1-blockies";
|
|
560
|
-
import
|
|
566
|
+
import { useMemo as useMemo4 } from "react";
|
|
561
567
|
|
|
562
568
|
// src/components/block/ChipSkeleton.tsx
|
|
563
569
|
import { Skeleton } from "@mui/material";
|
|
564
|
-
import
|
|
565
|
-
var ChipSkeleton =
|
|
566
|
-
return /* @__PURE__ */
|
|
567
|
-
|
|
568
|
-
...props
|
|
569
|
-
});
|
|
570
|
-
}, "ChipSkeleton");
|
|
570
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
571
|
+
var ChipSkeleton = (props) => {
|
|
572
|
+
return /* @__PURE__ */ jsx9(Skeleton, { width: 100, ...props });
|
|
573
|
+
};
|
|
571
574
|
|
|
572
575
|
// src/components/block/ProducerChip.tsx
|
|
573
|
-
|
|
576
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
577
|
+
var formatProducerAddress = (address) => {
|
|
574
578
|
if (isUndefined(address) || !isString(address)) return void 0;
|
|
575
579
|
const formattedAddress = toAddress(address);
|
|
576
580
|
return EthAddressWrapper.parse(formattedAddress)?.toShortString(4);
|
|
577
|
-
}
|
|
578
|
-
var BlockProducerChip =
|
|
581
|
+
};
|
|
582
|
+
var BlockProducerChip = ({ block, ...props }) => {
|
|
579
583
|
const blockProducer2 = block?.[0].addresses[0];
|
|
580
|
-
return /* @__PURE__ */
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
584
|
+
return /* @__PURE__ */ jsx10(BlockAddressChip, { address: blockProducer2, toolTipTitle: `Block producer: ${blockProducer2}`, ...props });
|
|
585
|
+
};
|
|
586
|
+
var BlockAddressChip = ({
|
|
587
|
+
address,
|
|
588
|
+
sx,
|
|
589
|
+
toolTipTitle,
|
|
590
|
+
...props
|
|
591
|
+
}) => {
|
|
587
592
|
const shortedBlockProducer = address === void 0 ? null : formatProducerAddress(address);
|
|
588
|
-
const avatar = useMemo4(() => address === "" ? void 0 : /* @__PURE__ */
|
|
589
|
-
|
|
590
|
-
|
|
593
|
+
const avatar = useMemo4(() => address === "" ? void 0 : /* @__PURE__ */ jsx10(BlockiesAvatar, { blockiesOptions: { seed: address } }), [address]);
|
|
594
|
+
return /* @__PURE__ */ jsx10(
|
|
595
|
+
Chip2,
|
|
596
|
+
{
|
|
597
|
+
avatar,
|
|
598
|
+
label: shortedBlockProducer ?? /* @__PURE__ */ jsx10(ChipSkeleton, { width: 115 }),
|
|
599
|
+
title: toolTipTitle,
|
|
600
|
+
sx: {
|
|
601
|
+
fontFamily: "monospace",
|
|
602
|
+
cursor: "pointer",
|
|
603
|
+
...sx
|
|
604
|
+
},
|
|
605
|
+
...props
|
|
591
606
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
]);
|
|
595
|
-
return /* @__PURE__ */ React11.createElement(Chip2, {
|
|
596
|
-
avatar,
|
|
597
|
-
label: shortedBlockProducer ?? /* @__PURE__ */ React11.createElement(ChipSkeleton, {
|
|
598
|
-
width: 115
|
|
599
|
-
}),
|
|
600
|
-
title: toolTipTitle,
|
|
601
|
-
sx: {
|
|
602
|
-
fontFamily: "monospace",
|
|
603
|
-
cursor: "pointer",
|
|
604
|
-
...sx
|
|
605
|
-
},
|
|
606
|
-
...props
|
|
607
|
-
});
|
|
608
|
-
}, "BlockAddressChip");
|
|
607
|
+
);
|
|
608
|
+
};
|
|
609
609
|
|
|
610
610
|
// src/components/block/BlockHeadingFlexbox.tsx
|
|
611
|
-
|
|
611
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
612
|
+
var BlockHeadingFlexbox = ({
|
|
613
|
+
block,
|
|
614
|
+
defaultExpanded,
|
|
615
|
+
transactions
|
|
616
|
+
}) => {
|
|
612
617
|
const hash = usePayloadHash(block?.[0]);
|
|
613
618
|
const [blockHeadingRef, blockHeadingListener] = useBlockHeadingEvents();
|
|
614
619
|
const { pollingState } = useChainPollingContext();
|
|
615
620
|
const expanded = pollingState === "paused" || defaultExpanded;
|
|
616
|
-
const handleTransactionCountClick =
|
|
621
|
+
const handleTransactionCountClick = (event, transactions2) => {
|
|
617
622
|
event.stopPropagation();
|
|
618
623
|
blockHeadingListener("transaction-count", "click", JSON.stringify(transactions2), event.nativeEvent);
|
|
619
|
-
}
|
|
620
|
-
return /* @__PURE__ */
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
size: 18
|
|
624
|
+
};
|
|
625
|
+
return /* @__PURE__ */ jsxs6(
|
|
626
|
+
FlexCol2,
|
|
627
|
+
{
|
|
628
|
+
className: "block-heading-flexbox",
|
|
629
|
+
ref: blockHeadingRef,
|
|
630
|
+
onClick: () => blockHeadingListener("block-hash", "click", hash),
|
|
631
|
+
sx: { alignItems: "stretch" },
|
|
632
|
+
children: [
|
|
633
|
+
/* @__PURE__ */ jsx11(LinkedDivider, {}),
|
|
634
|
+
/* @__PURE__ */ jsx11(
|
|
635
|
+
HashHeadingPaper,
|
|
636
|
+
{
|
|
637
|
+
hash,
|
|
638
|
+
heading: block?.[0].block === void 0 ? "" : block?.[0].block.toString(),
|
|
639
|
+
paperProps: { sx: { p: 1, width: "100%" } },
|
|
640
|
+
AdornmentEnd: /* @__PURE__ */ jsxs6(FlexRow2, { sx: { gap: 1 }, children: [
|
|
641
|
+
/* @__PURE__ */ jsx11(BlockProducerChip, { block }),
|
|
642
|
+
/* @__PURE__ */ jsx11(
|
|
643
|
+
TransactionCountChip,
|
|
644
|
+
{
|
|
645
|
+
onClick: (e) => handleTransactionCountClick(e, transactions ?? []),
|
|
646
|
+
transactions
|
|
647
|
+
}
|
|
648
|
+
),
|
|
649
|
+
/* @__PURE__ */ jsx11(BWVerification, { iconColors: true, boundwitness: block?.[0] }),
|
|
650
|
+
/* @__PURE__ */ jsx11(
|
|
651
|
+
"span",
|
|
652
|
+
{
|
|
653
|
+
style: {
|
|
654
|
+
// maxWidth is required for css animation to work and 28px is the width of the icon button
|
|
655
|
+
display: "flex",
|
|
656
|
+
transition: "max-width .5s",
|
|
657
|
+
maxWidth: expanded ? "28px" : 0
|
|
658
|
+
},
|
|
659
|
+
children: /* @__PURE__ */ jsx11(BlockMenuExpanded, { block })
|
|
660
|
+
}
|
|
661
|
+
)
|
|
662
|
+
] }),
|
|
663
|
+
identiconProps: { sx: { p: 0.75 }, size: 18 }
|
|
664
|
+
}
|
|
665
|
+
)
|
|
666
|
+
]
|
|
663
667
|
}
|
|
664
|
-
|
|
665
|
-
}
|
|
668
|
+
);
|
|
669
|
+
};
|
|
666
670
|
|
|
667
671
|
// src/components/block/table/cell/BlockNumber.tsx
|
|
668
|
-
import {
|
|
669
|
-
|
|
672
|
+
import {
|
|
673
|
+
Link,
|
|
674
|
+
TableCell,
|
|
675
|
+
Tooltip,
|
|
676
|
+
Typography as Typography3
|
|
677
|
+
} from "@mui/material";
|
|
670
678
|
|
|
671
679
|
// src/components/block/table/cell/hooks/useLinkedBlockItem.tsx
|
|
672
680
|
import { useEvent as useEvent2 } from "@xyo-network/react-event";
|
|
673
|
-
var useLinkedBlockItem =
|
|
681
|
+
var useLinkedBlockItem = (noun, data) => {
|
|
674
682
|
const [ref, dispatch] = useEvent2();
|
|
675
|
-
const handleClick =
|
|
683
|
+
const handleClick = (event) => {
|
|
676
684
|
event.preventDefault();
|
|
677
685
|
event.stopPropagation();
|
|
678
686
|
if (noun === void 0) {
|
|
@@ -684,45 +692,39 @@ var useLinkedBlockItem = /* @__PURE__ */ __name((noun, data) => {
|
|
|
684
692
|
if (!isTextSelected) {
|
|
685
693
|
dispatch(noun, "click", data, event.nativeEvent);
|
|
686
694
|
}
|
|
687
|
-
}
|
|
688
|
-
return [
|
|
689
|
-
|
|
690
|
-
handleClick
|
|
691
|
-
];
|
|
692
|
-
}, "useLinkedBlockItem");
|
|
695
|
+
};
|
|
696
|
+
return [ref, handleClick];
|
|
697
|
+
};
|
|
693
698
|
|
|
694
699
|
// src/components/block/table/cell/BlockNumber.tsx
|
|
695
|
-
|
|
700
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
701
|
+
var BlockNumberTableCell = ({
|
|
702
|
+
block,
|
|
703
|
+
eventNoun = "block-number",
|
|
704
|
+
linked,
|
|
705
|
+
...props
|
|
706
|
+
}) => {
|
|
696
707
|
const blockNumber = block?.[0].block;
|
|
697
|
-
return /* @__PURE__ */
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
708
|
+
return /* @__PURE__ */ jsx12(BlockNumberTableCellInner, { blockNumber, eventNoun, linked, ...props });
|
|
709
|
+
};
|
|
710
|
+
var BlockNumberTableCellInner = ({
|
|
711
|
+
blockNumber,
|
|
712
|
+
eventNoun = "block-number",
|
|
713
|
+
linked,
|
|
714
|
+
...props
|
|
715
|
+
}) => {
|
|
705
716
|
const [ref, handleClick] = useLinkedBlockItem(eventNoun, blockNumber?.toLocaleString());
|
|
706
|
-
return /* @__PURE__ */
|
|
707
|
-
|
|
708
|
-
...props
|
|
709
|
-
}, /* @__PURE__ */ React13.createElement(Tooltip, {
|
|
710
|
-
title: `Block Number: ${blockNumber}`
|
|
711
|
-
}, /* @__PURE__ */ React13.createElement(Typography3, {
|
|
712
|
-
component: "span",
|
|
713
|
-
variant: "body1"
|
|
714
|
-
}, linked ? /* @__PURE__ */ React13.createElement(Link, {
|
|
715
|
-
onClick: handleClick,
|
|
716
|
-
sx: {
|
|
717
|
-
cursor: "pointer"
|
|
718
|
-
}
|
|
719
|
-
}, blockNumber) : blockNumber)));
|
|
720
|
-
}, "BlockNumberTableCellInner");
|
|
717
|
+
return /* @__PURE__ */ jsx12(TableCell, { ref, ...props, children: /* @__PURE__ */ jsx12(Tooltip, { title: `Block Number: ${blockNumber}`, children: /* @__PURE__ */ jsx12(Typography3, { component: "span", variant: "body1", children: linked ? /* @__PURE__ */ jsx12(Link, { onClick: handleClick, sx: { cursor: "pointer" }, children: blockNumber }) : blockNumber }) }) });
|
|
718
|
+
};
|
|
721
719
|
|
|
722
720
|
// src/components/block/table/cell/Epoch.tsx
|
|
723
|
-
import {
|
|
721
|
+
import {
|
|
722
|
+
Skeleton as Skeleton2,
|
|
723
|
+
TableCell as TableCell2,
|
|
724
|
+
Tooltip as Tooltip2,
|
|
725
|
+
Typography as Typography4
|
|
726
|
+
} from "@mui/material";
|
|
724
727
|
import { isDefined as isDefined3 } from "@xylabs/sdk-js";
|
|
725
|
-
import React14 from "react";
|
|
726
728
|
|
|
727
729
|
// src/components/block/table/cell/helpers/timeFunctions.ts
|
|
728
730
|
var dateFormat = Intl.DateTimeFormat(globalThis.navigator.language ?? "en-US", {
|
|
@@ -733,7 +735,7 @@ var dateFormat = Intl.DateTimeFormat(globalThis.navigator.language ?? "en-US", {
|
|
|
733
735
|
minute: "2-digit",
|
|
734
736
|
second: "2-digit"
|
|
735
737
|
});
|
|
736
|
-
var timeAgo =
|
|
738
|
+
var timeAgo = (epoch, locale = navigator.language ?? "en-US") => {
|
|
737
739
|
const now = Date.now();
|
|
738
740
|
const diffInSeconds = Math.floor((now - epoch) / 1e3);
|
|
739
741
|
const units = [
|
|
@@ -776,118 +778,138 @@ var timeAgo = /* @__PURE__ */ __name((epoch, locale = navigator.language ?? "en-
|
|
|
776
778
|
for (const unit of units) {
|
|
777
779
|
if (Math.abs(diffInSeconds) < unit.max) {
|
|
778
780
|
const value = Math.round(diffInSeconds / unit.value);
|
|
779
|
-
return new Intl.RelativeTimeFormat(locale, {
|
|
780
|
-
numeric: "auto"
|
|
781
|
-
}).format(-value, unit.name);
|
|
781
|
+
return new Intl.RelativeTimeFormat(locale, { numeric: "auto" }).format(-value, unit.name);
|
|
782
782
|
}
|
|
783
783
|
}
|
|
784
|
-
}
|
|
784
|
+
};
|
|
785
785
|
|
|
786
786
|
// src/components/block/table/cell/Epoch.tsx
|
|
787
|
-
|
|
787
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
788
|
+
var BlockEpochTableCell = ({
|
|
789
|
+
block,
|
|
790
|
+
linked,
|
|
791
|
+
...props
|
|
792
|
+
}) => {
|
|
788
793
|
const epoch = block?.[0]?.$epoch;
|
|
789
794
|
const dateTime = dateFormat.format(epoch);
|
|
790
795
|
const age = isDefined3(epoch) ? timeAgo(epoch) : void 0;
|
|
791
|
-
return /* @__PURE__ */
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
}))));
|
|
799
|
-
}, "BlockEpochTableCell");
|
|
800
|
-
var BlockEpochTableCellInner = /* @__PURE__ */ __name(({ epoch, linked, ...props }) => {
|
|
796
|
+
return /* @__PURE__ */ jsx13(TableCell2, { ...props, children: /* @__PURE__ */ jsx13(Tooltip2, { title: `Block Epoch: ${dateTime}`, children: /* @__PURE__ */ jsx13(Typography4, { component: "span", variant: "body1", children: age ?? /* @__PURE__ */ jsx13(Skeleton2, { width: 115 }) }) }) });
|
|
797
|
+
};
|
|
798
|
+
var BlockEpochTableCellInner = ({
|
|
799
|
+
epoch,
|
|
800
|
+
linked,
|
|
801
|
+
...props
|
|
802
|
+
}) => {
|
|
801
803
|
const dateTime = dateFormat.format(epoch);
|
|
802
804
|
const age = isDefined3(epoch) ? timeAgo(epoch) : void 0;
|
|
803
|
-
return /* @__PURE__ */
|
|
804
|
-
|
|
805
|
-
}, /* @__PURE__ */ React14.createElement(Typography4, {
|
|
806
|
-
component: "span",
|
|
807
|
-
variant: "body1"
|
|
808
|
-
}, age ?? /* @__PURE__ */ React14.createElement(Skeleton2, {
|
|
809
|
-
width: 115
|
|
810
|
-
}))));
|
|
811
|
-
}, "BlockEpochTableCellInner");
|
|
805
|
+
return /* @__PURE__ */ jsx13(TableCell2, { ...props, children: /* @__PURE__ */ jsx13(Tooltip2, { title: `Block Epoch: ${dateTime}`, children: /* @__PURE__ */ jsx13(Typography4, { component: "span", variant: "body1", children: age ?? /* @__PURE__ */ jsx13(Skeleton2, { width: 115 }) }) }) });
|
|
806
|
+
};
|
|
812
807
|
|
|
813
808
|
// src/components/block/table/cell/Hash.tsx
|
|
814
|
-
import {
|
|
809
|
+
import {
|
|
810
|
+
Link as Link2,
|
|
811
|
+
TableCell as TableCell3,
|
|
812
|
+
Tooltip as Tooltip3
|
|
813
|
+
} from "@mui/material";
|
|
815
814
|
import { isHash as isHash2 } from "@xylabs/sdk-js";
|
|
816
815
|
import { usePayloadRootHash } from "@xyo-network/react-shared";
|
|
817
|
-
import
|
|
816
|
+
import { useState as useState6 } from "react";
|
|
818
817
|
|
|
819
818
|
// src/components/FeatureNotAvailable.tsx
|
|
820
|
-
import {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
819
|
+
import {
|
|
820
|
+
Button as Button2,
|
|
821
|
+
Dialog,
|
|
822
|
+
DialogActions,
|
|
823
|
+
DialogContent,
|
|
824
|
+
DialogTitle
|
|
825
|
+
} from "@mui/material";
|
|
826
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
827
|
+
var FeatureNotAvailable = ({ featureName = "Feature", ...props }) => /* @__PURE__ */ jsxs7(Dialog, { ...props, children: [
|
|
828
|
+
/* @__PURE__ */ jsx14(DialogTitle, { children: `${featureName} Not Available` }),
|
|
829
|
+
/* @__PURE__ */ jsx14(DialogContent, { children: "This feature is not currently available. Either you do not have access to it or it is currently undergoing maintenance." }),
|
|
830
|
+
/* @__PURE__ */ jsx14(DialogActions, { children: /* @__PURE__ */ jsx14(Button2, { onClick: (e) => props.onClose?.(e, "backdropClick"), children: "Close" }) })
|
|
831
|
+
] });
|
|
825
832
|
|
|
826
833
|
// src/components/block/table/cell/Hash.tsx
|
|
827
|
-
|
|
834
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
835
|
+
var BlockHashTableCell = ({
|
|
836
|
+
block,
|
|
837
|
+
notAvailableDialog,
|
|
838
|
+
linked,
|
|
839
|
+
...props
|
|
840
|
+
}) => {
|
|
828
841
|
const hash = usePayloadRootHash(block?.[0]);
|
|
829
842
|
const [ref, handleClick] = useLinkedBlockItem("block-hash", hash);
|
|
830
843
|
const [notAvailable, setNotAvailable] = useState6(false);
|
|
831
844
|
const shortenedHash = isHash2(hash) ? `${hash.slice(0, 4)}...${hash.slice(-5, -1)}` : void 0;
|
|
832
|
-
return /* @__PURE__ */
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
},
|
|
841
|
-
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
open: notAvailable,
|
|
845
|
-
onClick: /* @__PURE__ */ __name(() => setNotAvailable(false), "onClick")
|
|
846
|
-
}) : null);
|
|
847
|
-
}, "BlockHashTableCell");
|
|
845
|
+
return /* @__PURE__ */ jsxs8(TableCell3, { ref, ...props, children: [
|
|
846
|
+
/* @__PURE__ */ jsx15(Tooltip3, { title: `Block Hash: ${hash}`, children: linked ? /* @__PURE__ */ jsx15(
|
|
847
|
+
Link2,
|
|
848
|
+
{
|
|
849
|
+
sx: { cursor: "pointer" },
|
|
850
|
+
onClick: linked ? handleClick : () => setNotAvailable(true),
|
|
851
|
+
children: shortenedHash ?? /* @__PURE__ */ jsx15(ChipSkeleton, {})
|
|
852
|
+
}
|
|
853
|
+
) : /* @__PURE__ */ jsx15("span", { children: shortenedHash ?? /* @__PURE__ */ jsx15(ChipSkeleton, {}) }) }),
|
|
854
|
+
notAvailableDialog && notAvailable ? /* @__PURE__ */ jsx15(FeatureNotAvailable, { featureName: "Block Details", open: notAvailable, onClick: () => setNotAvailable(false) }) : null
|
|
855
|
+
] });
|
|
856
|
+
};
|
|
848
857
|
|
|
849
858
|
// src/components/block/table/cell/JsonView.tsx
|
|
850
859
|
import { DataObject } from "@mui/icons-material";
|
|
851
|
-
import {
|
|
860
|
+
import {
|
|
861
|
+
Button as Button3,
|
|
862
|
+
Dialog as Dialog2,
|
|
863
|
+
DialogActions as DialogActions2,
|
|
864
|
+
DialogContent as DialogContent2,
|
|
865
|
+
DialogTitle as DialogTitle2,
|
|
866
|
+
IconButton as IconButton2,
|
|
867
|
+
TableCell as TableCell4
|
|
868
|
+
} from "@mui/material";
|
|
852
869
|
import { FlexRow as FlexRow3 } from "@xylabs/react-flexbox";
|
|
853
870
|
import { ellipsize, isHash as isHash3 } from "@xylabs/sdk-js";
|
|
854
871
|
import { JsonViewerEx } from "@xyo-network/react-payload-raw-info";
|
|
855
872
|
import { usePayloadRootHash as usePayloadRootHash2 } from "@xyo-network/react-shared";
|
|
856
|
-
import
|
|
857
|
-
|
|
873
|
+
import { useState as useState7 } from "react";
|
|
874
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
875
|
+
var BlockJsonViewTableCell = ({ block, ...props }) => {
|
|
858
876
|
const [open, setOpen] = useState7(false);
|
|
859
|
-
const onClose =
|
|
877
|
+
const onClose = () => setOpen(false);
|
|
860
878
|
const hash = usePayloadRootHash2(block?.[0]);
|
|
861
879
|
const title = isHash3(hash) ? `JSON for ${ellipsize(hash, 5)}` : "JSON";
|
|
862
|
-
return /* @__PURE__ */
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
variant: "contained",
|
|
882
|
-
onClick: onClose
|
|
883
|
-
}, "Close")))));
|
|
884
|
-
}, "BlockJsonViewTableCell");
|
|
880
|
+
return /* @__PURE__ */ jsx16(TableCell4, { ...props, children: /* @__PURE__ */ jsxs9(FlexRow3, { onClick: (e) => e.stopPropagation(), sx: { width: "100%" }, children: [
|
|
881
|
+
/* @__PURE__ */ jsx16(IconButton2, { onClick: () => setOpen(true), children: /* @__PURE__ */ jsx16(DataObject, {}) }),
|
|
882
|
+
/* @__PURE__ */ jsxs9(Dialog2, { open, onClose, children: [
|
|
883
|
+
/* @__PURE__ */ jsx16(DialogTitle2, { children: title }),
|
|
884
|
+
/* @__PURE__ */ jsx16(DialogContent2, { children: /* @__PURE__ */ jsx16(JsonViewerEx, { value: block }) }),
|
|
885
|
+
/* @__PURE__ */ jsx16(
|
|
886
|
+
DialogActions2,
|
|
887
|
+
{
|
|
888
|
+
sx: {
|
|
889
|
+
display: "flex",
|
|
890
|
+
flexDirection: "row",
|
|
891
|
+
justifyContent: "end"
|
|
892
|
+
},
|
|
893
|
+
children: /* @__PURE__ */ jsx16(Button3, { variant: "contained", onClick: onClose, children: "Close" })
|
|
894
|
+
}
|
|
895
|
+
)
|
|
896
|
+
] })
|
|
897
|
+
] }) });
|
|
898
|
+
};
|
|
885
899
|
|
|
886
900
|
// src/components/block/table/cell/PayloadCounts.tsx
|
|
887
901
|
import { Error as Error2 } from "@mui/icons-material";
|
|
888
|
-
import {
|
|
889
|
-
|
|
890
|
-
|
|
902
|
+
import {
|
|
903
|
+
Link as Link3,
|
|
904
|
+
TableCell as TableCell5,
|
|
905
|
+
Tooltip as Tooltip4
|
|
906
|
+
} from "@mui/material";
|
|
907
|
+
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
908
|
+
var BlockPayloadCountsTableCell = ({
|
|
909
|
+
block,
|
|
910
|
+
linked,
|
|
911
|
+
...props
|
|
912
|
+
}) => {
|
|
891
913
|
const [publicPayloads, privatePayloads, error] = usePayloadCountsFromBlock(block);
|
|
892
914
|
const data = block && privatePayloads !== void 0 && publicPayloads !== void 0 ? {
|
|
893
915
|
publicPayloads,
|
|
@@ -896,256 +918,228 @@ var BlockPayloadCountsTableCell = /* @__PURE__ */ __name(({ block, linked, ...pr
|
|
|
896
918
|
} : void 0;
|
|
897
919
|
const payloadCount = (publicPayloads ?? 0) + (privatePayloads ?? 0);
|
|
898
920
|
const [ref, handleClick] = useLinkedBlockItem("payload-counts", data);
|
|
899
|
-
return /* @__PURE__ */
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
onClick: handleClick,
|
|
912
|
-
sx: {
|
|
913
|
-
cursor: "pointer"
|
|
914
|
-
}
|
|
915
|
-
}, payloadCount)) : /* @__PURE__ */ React18.createElement(Tooltip4, {
|
|
916
|
-
title: `Public Payloads: ${publicPayloads ?? "--"} Private Payloads: ${privatePayloads ?? "--"}`
|
|
917
|
-
}, /* @__PURE__ */ React18.createElement("span", null, payloadCount))));
|
|
918
|
-
}, "BlockPayloadCountsTableCell");
|
|
921
|
+
return /* @__PURE__ */ jsx17(TableCell5, { ref, ...props, children: /* @__PURE__ */ jsxs10("span", { children: [
|
|
922
|
+
error ? /* @__PURE__ */ jsx17(Tooltip4, { title: error.message, children: /* @__PURE__ */ jsx17(Error2, { sx: { color: "error" } }) }) : null,
|
|
923
|
+
linked ? /* @__PURE__ */ jsx17(Tooltip4, { title: `Public Payloads: ${publicPayloads ?? "--"} Private Payloads: ${privatePayloads ?? "--"}`, children: /* @__PURE__ */ jsx17(
|
|
924
|
+
Link3,
|
|
925
|
+
{
|
|
926
|
+
onClick: handleClick,
|
|
927
|
+
sx: { cursor: "pointer" },
|
|
928
|
+
children: payloadCount
|
|
929
|
+
}
|
|
930
|
+
) }) : /* @__PURE__ */ jsx17(Tooltip4, { title: `Public Payloads: ${publicPayloads ?? "--"} Private Payloads: ${privatePayloads ?? "--"}`, children: /* @__PURE__ */ jsx17("span", { children: payloadCount }) })
|
|
931
|
+
] }) });
|
|
932
|
+
};
|
|
919
933
|
|
|
920
934
|
// src/components/block/table/cell/Producer.tsx
|
|
921
935
|
import { TableCell as TableCell6, Tooltip as Tooltip5 } from "@mui/material";
|
|
922
|
-
import
|
|
923
|
-
|
|
936
|
+
import { useState as useState8 } from "react";
|
|
937
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
938
|
+
var BlockProducerTableCell = ({
|
|
939
|
+
block,
|
|
940
|
+
linked,
|
|
941
|
+
notAvailableDialog,
|
|
942
|
+
producerChipProps,
|
|
943
|
+
...props
|
|
944
|
+
}) => {
|
|
924
945
|
const [ref, handleClick] = useLinkedBlockItem("block-producer", JSON.stringify(block));
|
|
925
946
|
const producer = useBlockProducer(block);
|
|
926
|
-
return /* @__PURE__ */
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
947
|
+
return /* @__PURE__ */ jsx18(
|
|
948
|
+
BlockProducerTableCellInner,
|
|
949
|
+
{
|
|
950
|
+
address: producer,
|
|
951
|
+
handleClick,
|
|
952
|
+
linked,
|
|
953
|
+
notAvailableDialog,
|
|
954
|
+
producerChipProps,
|
|
955
|
+
...props,
|
|
956
|
+
ref
|
|
957
|
+
}
|
|
958
|
+
);
|
|
959
|
+
};
|
|
960
|
+
var BlockProducerTableCellInner = ({
|
|
961
|
+
address,
|
|
962
|
+
handleClick,
|
|
963
|
+
linked,
|
|
964
|
+
notAvailableDialog,
|
|
965
|
+
producerChipProps,
|
|
966
|
+
...props
|
|
967
|
+
}) => {
|
|
937
968
|
const [notAvailable, setNotAvailable] = useState8(false);
|
|
938
|
-
return /* @__PURE__ */
|
|
939
|
-
title: `Block Producer: ${address}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
featureName: "Producer Details",
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
}) : null);
|
|
953
|
-
}, "BlockProducerTableCellInner");
|
|
969
|
+
return /* @__PURE__ */ jsxs11(TableCell6, { ...props, children: [
|
|
970
|
+
/* @__PURE__ */ jsx18(Tooltip5, { title: `Block Producer: ${address}`, children: /* @__PURE__ */ jsx18(
|
|
971
|
+
BlockAddressChip,
|
|
972
|
+
{
|
|
973
|
+
sx: { cursor: "pointer" },
|
|
974
|
+
onClick: linked ? handleClick : () => setNotAvailable(true),
|
|
975
|
+
address,
|
|
976
|
+
toolTipTitle: `Block Producer: ${address}`,
|
|
977
|
+
...producerChipProps
|
|
978
|
+
}
|
|
979
|
+
) }),
|
|
980
|
+
notAvailableDialog && notAvailable ? /* @__PURE__ */ jsx18(FeatureNotAvailable, { featureName: "Producer Details", open: notAvailable, onClick: () => setNotAvailable(false) }) : null
|
|
981
|
+
] });
|
|
982
|
+
};
|
|
954
983
|
|
|
955
984
|
// src/components/block/table/cell/TransactionCount.tsx
|
|
956
985
|
import { Error as Error3 } from "@mui/icons-material";
|
|
957
|
-
import {
|
|
958
|
-
|
|
959
|
-
|
|
986
|
+
import {
|
|
987
|
+
Link as Link4,
|
|
988
|
+
TableCell as TableCell7,
|
|
989
|
+
Tooltip as Tooltip6
|
|
990
|
+
} from "@mui/material";
|
|
991
|
+
import { useMemo as useMemo5 } from "react";
|
|
992
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
993
|
+
var BlockTransactionCountTableCell = ({
|
|
994
|
+
block,
|
|
995
|
+
linked,
|
|
996
|
+
...props
|
|
997
|
+
}) => {
|
|
960
998
|
const [transactions, error] = useTxsFromBlock(block);
|
|
961
|
-
const txHashes = useMemo5(() => transactions?.map(([, hash]) => hash), [
|
|
962
|
-
transactions
|
|
963
|
-
]);
|
|
999
|
+
const txHashes = useMemo5(() => transactions?.map(([, hash]) => hash), [transactions]);
|
|
964
1000
|
const data = block && transactions !== void 0 ? {
|
|
965
1001
|
transactions: transactions.length,
|
|
966
1002
|
block: block[0]._hash
|
|
967
1003
|
} : void 0;
|
|
968
1004
|
const [ref, handleClick] = useLinkedBlockItem("transaction-count", data);
|
|
969
|
-
return /* @__PURE__ */
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
}, /* @__PURE__ */ React20.createElement(Error3, {
|
|
975
|
-
sx: {
|
|
976
|
-
color: "error"
|
|
977
|
-
}
|
|
978
|
-
})) : null, linked ? /* @__PURE__ */ React20.createElement(Link4, {
|
|
979
|
-
onClick: handleClick,
|
|
980
|
-
sx: {
|
|
981
|
-
cursor: "pointer"
|
|
982
|
-
}
|
|
983
|
-
}, txHashes?.length) : txHashes?.length));
|
|
984
|
-
}, "BlockTransactionCountTableCell");
|
|
1005
|
+
return /* @__PURE__ */ jsx19(TableCell7, { ref, ...props, children: /* @__PURE__ */ jsxs12("span", { children: [
|
|
1006
|
+
error ? /* @__PURE__ */ jsx19(Tooltip6, { title: error.message, children: /* @__PURE__ */ jsx19(Error3, { sx: { color: "error" } }) }) : null,
|
|
1007
|
+
linked ? /* @__PURE__ */ jsx19(Link4, { onClick: handleClick, sx: { cursor: "pointer" }, children: txHashes?.length }) : txHashes?.length
|
|
1008
|
+
] }) });
|
|
1009
|
+
};
|
|
985
1010
|
|
|
986
1011
|
// src/components/block/table/cell/Verification.tsx
|
|
987
1012
|
import { CheckCircleOutlineRounded } from "@mui/icons-material";
|
|
988
1013
|
import { TableCell as TableCell8 } from "@mui/material";
|
|
989
1014
|
import { FlexRow as FlexRow4 } from "@xylabs/react-flexbox";
|
|
990
1015
|
import { BWVerification as BWVerification2 } from "@xyo-network/react-boundwitness-plugin";
|
|
991
|
-
import
|
|
992
|
-
var BlockVerificationTableCell =
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
}, deepValidation ? /* @__PURE__ */
|
|
999
|
-
|
|
1000
|
-
boundwitness: block?.[0]
|
|
1001
|
-
}) : /* @__PURE__ */ React21.createElement(CheckCircleOutlineRounded, {
|
|
1002
|
-
color: "success"
|
|
1003
|
-
})));
|
|
1004
|
-
}, "BlockVerificationTableCell");
|
|
1016
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1017
|
+
var BlockVerificationTableCell = ({
|
|
1018
|
+
block,
|
|
1019
|
+
linked,
|
|
1020
|
+
deepValidation,
|
|
1021
|
+
...props
|
|
1022
|
+
}) => {
|
|
1023
|
+
return /* @__PURE__ */ jsx20(TableCell8, { ...props, children: /* @__PURE__ */ jsx20(FlexRow4, { onClick: (e) => e.stopPropagation(), sx: { width: "100%" }, children: deepValidation ? /* @__PURE__ */ jsx20(BWVerification2, { iconColors: true, boundwitness: block?.[0] }) : /* @__PURE__ */ jsx20(CheckCircleOutlineRounded, { color: "success" }) }) });
|
|
1024
|
+
};
|
|
1005
1025
|
|
|
1006
1026
|
// src/components/block/table/Ex.tsx
|
|
1007
1027
|
import { TableBody } from "@mui/material";
|
|
1008
1028
|
import { TableEx } from "@xyo-network/react-table";
|
|
1009
|
-
import React23 from "react";
|
|
1010
1029
|
|
|
1011
1030
|
// src/components/block/table/head/TableHead.tsx
|
|
1012
1031
|
import { InfoOutlined } from "@mui/icons-material";
|
|
1013
|
-
import {
|
|
1032
|
+
import {
|
|
1033
|
+
TableCell as TableCell9,
|
|
1034
|
+
TableHead,
|
|
1035
|
+
TableRow,
|
|
1036
|
+
Tooltip as Tooltip7,
|
|
1037
|
+
Typography as Typography5
|
|
1038
|
+
} from "@mui/material";
|
|
1014
1039
|
import { FlexRow as FlexRow5 } from "@xylabs/react-flexbox";
|
|
1015
|
-
import
|
|
1016
|
-
var ToolTipTableCell =
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
title: "The
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
}, "Epoch"), /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
1049
|
-
align: "left",
|
|
1050
|
-
title: "The address of the block producer that produced the block",
|
|
1051
|
-
sx: {
|
|
1052
|
-
width: "20%"
|
|
1053
|
-
}
|
|
1054
|
-
}, "Block Producer"), /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
1055
|
-
align: "left",
|
|
1056
|
-
title: "Count of transactions that are included in the block"
|
|
1057
|
-
}, "Transactions"), /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
1058
|
-
align: "left",
|
|
1059
|
-
title: "Count of public and private payload counts for the block"
|
|
1060
|
-
}, "Payloads"), /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
1061
|
-
align: "center",
|
|
1062
|
-
title: "The result of the local validation check for the block"
|
|
1063
|
-
}, "Valid"), /* @__PURE__ */ React22.createElement(ToolTipTableCell, {
|
|
1064
|
-
align: "center",
|
|
1065
|
-
title: "Link to display the raw JSON of the block"
|
|
1066
|
-
}, "JSON")));
|
|
1067
|
-
}, "BlockchainTableHead");
|
|
1040
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1041
|
+
var ToolTipTableCell = ({
|
|
1042
|
+
children,
|
|
1043
|
+
align,
|
|
1044
|
+
title,
|
|
1045
|
+
...props
|
|
1046
|
+
}) => {
|
|
1047
|
+
return /* @__PURE__ */ jsx21(TableCell9, { title, ...props, children: /* @__PURE__ */ jsxs13(FlexRow5, { sx: { justifyContent: align }, children: [
|
|
1048
|
+
/* @__PURE__ */ jsx21(Typography5, { variant: "body2", children }),
|
|
1049
|
+
"\xA0",
|
|
1050
|
+
/* @__PURE__ */ jsx21(Tooltip7, { title, children: /* @__PURE__ */ jsx21(InfoOutlined, { sx: { fontSize: "small" } }) })
|
|
1051
|
+
] }) });
|
|
1052
|
+
};
|
|
1053
|
+
var BlockchainTableHead = () => {
|
|
1054
|
+
return /* @__PURE__ */ jsx21(TableHead, { children: /* @__PURE__ */ jsxs13(TableRow, { children: [
|
|
1055
|
+
/* @__PURE__ */ jsx21(ToolTipTableCell, { align: "left", title: "The block number that is included in the block", children: "Block" }),
|
|
1056
|
+
/* @__PURE__ */ jsx21(ToolTipTableCell, { title: "The hash of the block", sx: { width: "20%" }, children: "Hash" }),
|
|
1057
|
+
/* @__PURE__ */ jsx21(ToolTipTableCell, { title: "The epoch of the block", sx: { width: "20%" }, children: "Epoch" }),
|
|
1058
|
+
/* @__PURE__ */ jsx21(
|
|
1059
|
+
ToolTipTableCell,
|
|
1060
|
+
{
|
|
1061
|
+
align: "left",
|
|
1062
|
+
title: "The address of the block producer that produced the block",
|
|
1063
|
+
sx: { width: "20%" },
|
|
1064
|
+
children: "Block Producer"
|
|
1065
|
+
}
|
|
1066
|
+
),
|
|
1067
|
+
/* @__PURE__ */ jsx21(ToolTipTableCell, { align: "left", title: "Count of transactions that are included in the block", children: "Transactions" }),
|
|
1068
|
+
/* @__PURE__ */ jsx21(ToolTipTableCell, { align: "left", title: "Count of public and private payload counts for the block", children: "Payloads" }),
|
|
1069
|
+
/* @__PURE__ */ jsx21(ToolTipTableCell, { align: "center", title: "The result of the local validation check for the block", children: "Valid" }),
|
|
1070
|
+
/* @__PURE__ */ jsx21(ToolTipTableCell, { align: "center", title: "Link to display the raw JSON of the block", children: "JSON" })
|
|
1071
|
+
] }) });
|
|
1072
|
+
};
|
|
1068
1073
|
|
|
1069
1074
|
// src/components/block/table/Ex.tsx
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
}
|
|
1075
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1076
|
+
var BlockchainTableEx = ({
|
|
1077
|
+
ref,
|
|
1078
|
+
children,
|
|
1079
|
+
...props
|
|
1080
|
+
}) => {
|
|
1081
|
+
return /* @__PURE__ */ jsxs14(TableEx, { ref, ...props, children: [
|
|
1082
|
+
/* @__PURE__ */ jsx22(BlockchainTableHead, {}),
|
|
1083
|
+
/* @__PURE__ */ jsx22(TableBody, { children })
|
|
1084
|
+
] });
|
|
1085
|
+
};
|
|
1076
1086
|
BlockchainTableEx.displayName = "BlockchainTableEx";
|
|
1077
1087
|
|
|
1078
1088
|
// src/components/block/table/row/TableRow.tsx
|
|
1079
1089
|
import { usePayloadRootHash as usePayloadRootHash3 } from "@xyo-network/react-shared";
|
|
1080
|
-
import
|
|
1090
|
+
import { useMemo as useMemo6 } from "react";
|
|
1081
1091
|
|
|
1082
1092
|
// src/components/table/StyledLinkableTableRow.tsx
|
|
1083
1093
|
import { styled, TableRow as TableRow2 } from "@mui/material";
|
|
1084
1094
|
import { alphaCss } from "@xylabs/react-theme";
|
|
1085
|
-
var StyledLinkableTableRow = styled(TableRow2, {
|
|
1086
|
-
shouldForwardProp: /* @__PURE__ */ __name((prop) => prop !== "linked", "shouldForwardProp")
|
|
1087
|
-
})(({ theme, linked }) => ({
|
|
1095
|
+
var StyledLinkableTableRow = styled(TableRow2, { shouldForwardProp: (prop) => prop !== "linked" })(({ theme, linked }) => ({
|
|
1088
1096
|
"cursor": linked ? "pointer" : "default",
|
|
1089
1097
|
"overflowY": "scroll",
|
|
1090
|
-
"&:hover": {
|
|
1091
|
-
backgroundColor: alphaCss(theme.vars.palette.secondary.light, 0.15)
|
|
1092
|
-
}
|
|
1098
|
+
"&:hover": { backgroundColor: alphaCss(theme.vars.palette.secondary.light, 0.15) }
|
|
1093
1099
|
}));
|
|
1094
1100
|
|
|
1095
1101
|
// src/components/block/table/row/TableRow.tsx
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
const
|
|
1105
|
-
|
|
1106
|
-
}), [
|
|
1107
|
-
block
|
|
1108
|
-
]);
|
|
1102
|
+
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1103
|
+
var BlockChainTableRow = ({
|
|
1104
|
+
block,
|
|
1105
|
+
deepValidation,
|
|
1106
|
+
defaultExpanded,
|
|
1107
|
+
linked,
|
|
1108
|
+
...props
|
|
1109
|
+
}) => {
|
|
1110
|
+
const linkedTableCellProps = useMemo6(() => ({ block, linked }), [block, linked]);
|
|
1111
|
+
const defaultTableCellProps = useMemo6(() => ({ block }), [block]);
|
|
1109
1112
|
const hash = usePayloadRootHash3(block?.[0]);
|
|
1110
1113
|
const [ref, handleClick] = useLinkedBlockItem("block-hash", hash);
|
|
1111
|
-
return /* @__PURE__ */
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
}), /* @__PURE__ */ React24.createElement(BlockPayloadCountsTableCell, {
|
|
1132
|
-
align: "left",
|
|
1133
|
-
...linkedTableCellProps
|
|
1134
|
-
}), /* @__PURE__ */ React24.createElement(BlockVerificationTableCell, {
|
|
1135
|
-
deepValidation,
|
|
1136
|
-
...defaultTableCellProps
|
|
1137
|
-
}), /* @__PURE__ */ React24.createElement(BlockJsonViewTableCell, defaultTableCellProps));
|
|
1138
|
-
}, "BlockChainTableRow");
|
|
1114
|
+
return /* @__PURE__ */ jsxs15(
|
|
1115
|
+
StyledLinkableTableRow,
|
|
1116
|
+
{
|
|
1117
|
+
onClick: linked ? handleClick : void 0,
|
|
1118
|
+
ref,
|
|
1119
|
+
linked,
|
|
1120
|
+
...props,
|
|
1121
|
+
children: [
|
|
1122
|
+
/* @__PURE__ */ jsx23(BlockNumberTableCell, { align: "left", ...linkedTableCellProps }),
|
|
1123
|
+
/* @__PURE__ */ jsx23(BlockHashTableCell, { align: "left", ...linkedTableCellProps }),
|
|
1124
|
+
/* @__PURE__ */ jsx23(BlockEpochTableCell, { align: "left", ...linkedTableCellProps }),
|
|
1125
|
+
/* @__PURE__ */ jsx23(BlockProducerTableCell, { align: "left", ...linkedTableCellProps }),
|
|
1126
|
+
/* @__PURE__ */ jsx23(BlockTransactionCountTableCell, { align: "left", ...linkedTableCellProps }),
|
|
1127
|
+
/* @__PURE__ */ jsx23(BlockPayloadCountsTableCell, { align: "left", ...linkedTableCellProps }),
|
|
1128
|
+
/* @__PURE__ */ jsx23(BlockVerificationTableCell, { deepValidation, ...defaultTableCellProps }),
|
|
1129
|
+
/* @__PURE__ */ jsx23(BlockJsonViewTableCell, { ...defaultTableCellProps })
|
|
1130
|
+
]
|
|
1131
|
+
}
|
|
1132
|
+
);
|
|
1133
|
+
};
|
|
1139
1134
|
|
|
1140
1135
|
// src/components/account/table/cell/AddressTableCell.tsx
|
|
1141
1136
|
import { TableCell as TableCell10, Tooltip as Tooltip8 } from "@mui/material";
|
|
1142
|
-
import React25 from "react";
|
|
1143
1137
|
|
|
1144
1138
|
// src/components/account/table/hooks/useLinkedBalanceHistoryItem.tsx
|
|
1145
1139
|
import { useEvent as useEvent3 } from "@xyo-network/react-event";
|
|
1146
|
-
var useLinkedBalanceHistoryItem =
|
|
1140
|
+
var useLinkedBalanceHistoryItem = () => {
|
|
1147
1141
|
const [ref, dispatch] = useEvent3();
|
|
1148
|
-
const handleClick =
|
|
1142
|
+
const handleClick = (event, noun, data) => {
|
|
1149
1143
|
event.preventDefault();
|
|
1150
1144
|
event.stopPropagation();
|
|
1151
1145
|
if (noun === void 0) {
|
|
@@ -1157,92 +1151,96 @@ var useLinkedBalanceHistoryItem = /* @__PURE__ */ __name(() => {
|
|
|
1157
1151
|
if (!isTextSelected) {
|
|
1158
1152
|
dispatch(noun, "click", data, event.nativeEvent);
|
|
1159
1153
|
}
|
|
1160
|
-
}
|
|
1161
|
-
return [
|
|
1162
|
-
|
|
1163
|
-
handleClick
|
|
1164
|
-
];
|
|
1165
|
-
}, "useLinkedBalanceHistoryItem");
|
|
1154
|
+
};
|
|
1155
|
+
return [ref, handleClick];
|
|
1156
|
+
};
|
|
1166
1157
|
|
|
1167
1158
|
// src/components/account/table/cell/AddressTableCell.tsx
|
|
1168
|
-
|
|
1159
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1160
|
+
var AddressTableCell = ({
|
|
1161
|
+
address,
|
|
1162
|
+
eventNoun,
|
|
1163
|
+
linked,
|
|
1164
|
+
toolTipTitle,
|
|
1165
|
+
sx,
|
|
1166
|
+
...props
|
|
1167
|
+
}) => {
|
|
1169
1168
|
const [ref, handleClick] = useLinkedBalanceHistoryItem();
|
|
1170
|
-
return /* @__PURE__ */
|
|
1171
|
-
|
|
1172
|
-
sx: {
|
|
1173
|
-
cursor: linked ? "pointer" : "default",
|
|
1174
|
-
...sx
|
|
1175
|
-
},
|
|
1176
|
-
...props
|
|
1177
|
-
}, /* @__PURE__ */ React25.createElement(Tooltip8, {
|
|
1178
|
-
title: toolTipTitle
|
|
1179
|
-
}, /* @__PURE__ */ React25.createElement(BlockAddressChip, {
|
|
1180
|
-
address,
|
|
1181
|
-
onClick: linked ? (e) => handleClick(e, eventNoun, address) : void 0
|
|
1182
|
-
})));
|
|
1183
|
-
}, "AddressTableCell");
|
|
1169
|
+
return /* @__PURE__ */ jsx24(TableCell10, { ref, sx: { cursor: linked ? "pointer" : "default", ...sx }, ...props, children: /* @__PURE__ */ jsx24(Tooltip8, { title: toolTipTitle, children: /* @__PURE__ */ jsx24(BlockAddressChip, { address, onClick: linked ? (e) => handleClick(e, eventNoun, address) : void 0 }) }) });
|
|
1170
|
+
};
|
|
1184
1171
|
|
|
1185
1172
|
// src/components/account/table/cell/BlockNumber.tsx
|
|
1186
|
-
import {
|
|
1187
|
-
|
|
1188
|
-
|
|
1173
|
+
import {
|
|
1174
|
+
Link as Link5,
|
|
1175
|
+
TableCell as TableCell11,
|
|
1176
|
+
Tooltip as Tooltip9,
|
|
1177
|
+
Typography as Typography6
|
|
1178
|
+
} from "@mui/material";
|
|
1179
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1180
|
+
var BalanceHistoryBlockNumberTableCell = ({
|
|
1181
|
+
block,
|
|
1182
|
+
eventNoun = "block-number",
|
|
1183
|
+
linked,
|
|
1184
|
+
...props
|
|
1185
|
+
}) => {
|
|
1189
1186
|
const blockNumber = block?.[0].block;
|
|
1190
|
-
return /* @__PURE__ */
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1187
|
+
return /* @__PURE__ */ jsx25(BalanceHistoryBlockNumberTableCellInner, { blockNumber, eventNoun, linked, ...props });
|
|
1188
|
+
};
|
|
1189
|
+
var BalanceHistoryBlockNumberTableCellInner = ({
|
|
1190
|
+
blockNumber,
|
|
1191
|
+
eventNoun = "block-number",
|
|
1192
|
+
linked,
|
|
1193
|
+
...props
|
|
1194
|
+
}) => {
|
|
1198
1195
|
const [ref, handleClick] = useLinkedBalanceHistoryItem();
|
|
1199
|
-
return /* @__PURE__ */
|
|
1200
|
-
|
|
1201
|
-
...props
|
|
1202
|
-
}, /* @__PURE__ */ React26.createElement(Tooltip9, {
|
|
1203
|
-
title: `Block Number: ${blockNumber}`
|
|
1204
|
-
}, /* @__PURE__ */ React26.createElement(Typography6, {
|
|
1205
|
-
component: "span",
|
|
1206
|
-
variant: "body1"
|
|
1207
|
-
}, linked ? /* @__PURE__ */ React26.createElement(Link5, {
|
|
1208
|
-
onClick: /* @__PURE__ */ __name((e) => handleClick(e, eventNoun, blockNumber?.toString() ?? ""), "onClick"),
|
|
1209
|
-
sx: {
|
|
1210
|
-
cursor: "pointer"
|
|
1211
|
-
}
|
|
1212
|
-
}, blockNumber) : blockNumber)));
|
|
1213
|
-
}, "BalanceHistoryBlockNumberTableCellInner");
|
|
1196
|
+
return /* @__PURE__ */ jsx25(TableCell11, { ref, ...props, children: /* @__PURE__ */ jsx25(Tooltip9, { title: `Block Number: ${blockNumber}`, children: /* @__PURE__ */ jsx25(Typography6, { component: "span", variant: "body1", children: linked ? /* @__PURE__ */ jsx25(Link5, { onClick: (e) => handleClick(e, eventNoun, blockNumber?.toString() ?? ""), sx: { cursor: "pointer" }, children: blockNumber }) : blockNumber }) }) });
|
|
1197
|
+
};
|
|
1214
1198
|
|
|
1215
1199
|
// src/components/account/table/cell/HashTableCell.tsx
|
|
1216
|
-
import {
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1200
|
+
import {
|
|
1201
|
+
Link as Link6,
|
|
1202
|
+
TableCell as TableCell12,
|
|
1203
|
+
Tooltip as Tooltip10,
|
|
1204
|
+
Typography as Typography7
|
|
1205
|
+
} from "@mui/material";
|
|
1206
|
+
import {
|
|
1207
|
+
ellipsize as ellipsize2,
|
|
1208
|
+
isDefined as isDefined4
|
|
1209
|
+
} from "@xylabs/sdk-js";
|
|
1210
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1211
|
+
var HashTableCell = ({
|
|
1212
|
+
eventData,
|
|
1213
|
+
eventNoun = "tx-hash",
|
|
1214
|
+
hash,
|
|
1215
|
+
linked,
|
|
1216
|
+
toolTipTitle,
|
|
1217
|
+
sx,
|
|
1218
|
+
...props
|
|
1219
|
+
}) => {
|
|
1220
1220
|
const [ref, handleClick] = useLinkedBalanceHistoryItem();
|
|
1221
1221
|
const shortenedHash = isDefined4(hash) ? ellipsize2(hash, 6) : "N/A";
|
|
1222
|
-
return /* @__PURE__ */
|
|
1223
|
-
|
|
1224
|
-
...props
|
|
1225
|
-
}, hash ? /* @__PURE__ */ React27.createElement(Tooltip10, {
|
|
1226
|
-
title: toolTipTitle
|
|
1227
|
-
}, /* @__PURE__ */ React27.createElement(Typography7, {
|
|
1228
|
-
component: "span",
|
|
1229
|
-
variant: "body1"
|
|
1230
|
-
}, linked ? /* @__PURE__ */ React27.createElement(Link6, {
|
|
1231
|
-
onClick: /* @__PURE__ */ __name((e) => handleClick(e, eventNoun, eventData), "onClick"),
|
|
1232
|
-
sx: {
|
|
1233
|
-
cursor: "pointer"
|
|
1234
|
-
}
|
|
1235
|
-
}, shortenedHash) : shortenedHash)) : "N/A");
|
|
1236
|
-
}, "HashTableCell");
|
|
1222
|
+
return /* @__PURE__ */ jsx26(TableCell12, { ref, ...props, children: hash ? /* @__PURE__ */ jsx26(Tooltip10, { title: toolTipTitle, children: /* @__PURE__ */ jsx26(Typography7, { component: "span", variant: "body1", children: linked ? /* @__PURE__ */ jsx26(Link6, { onClick: (e) => handleClick(e, eventNoun, eventData), sx: { cursor: "pointer" }, children: shortenedHash }) : shortenedHash }) }) : "N/A" });
|
|
1223
|
+
};
|
|
1237
1224
|
|
|
1238
1225
|
// src/components/account/table/RawAmountTableCell.tsx
|
|
1239
|
-
import {
|
|
1226
|
+
import {
|
|
1227
|
+
Link as Link7,
|
|
1228
|
+
TableCell as TableCell13,
|
|
1229
|
+
Tooltip as Tooltip11
|
|
1230
|
+
} from "@mui/material";
|
|
1240
1231
|
import { isDefined as isDefined5, toHex as toHex2 } from "@xylabs/sdk-js";
|
|
1241
1232
|
import { XL1Amount as XL1Amount2 } from "@xyo-network/xl1-sdk";
|
|
1242
|
-
import
|
|
1243
|
-
var RawAmountTableCell =
|
|
1233
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1234
|
+
var RawAmountTableCell = ({
|
|
1235
|
+
amount,
|
|
1236
|
+
eventNoun = "amount",
|
|
1237
|
+
linked,
|
|
1238
|
+
sx,
|
|
1239
|
+
type,
|
|
1240
|
+
...props
|
|
1241
|
+
}) => {
|
|
1244
1242
|
const [ref, handleClick] = useLinkedBalanceHistoryItem();
|
|
1245
|
-
const formatAmount =
|
|
1243
|
+
const formatAmount = (amount2) => {
|
|
1246
1244
|
if (!isDefined5(amount2)) {
|
|
1247
1245
|
return "N/A";
|
|
1248
1246
|
}
|
|
@@ -1254,73 +1252,61 @@ var RawAmountTableCell = /* @__PURE__ */ __name(({ amount, eventNoun = "amount",
|
|
|
1254
1252
|
minDecimals: 1,
|
|
1255
1253
|
locale: navigator.language
|
|
1256
1254
|
});
|
|
1257
|
-
}
|
|
1258
|
-
return /* @__PURE__ */
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
cursor: "pointer"
|
|
1267
|
-
}
|
|
1268
|
-
}, type === "send" ? "-" : "", formatAmount(amount)) : /* @__PURE__ */ React28.createElement("span", null, type === "send" ? "-" : "", formatAmount(amount))));
|
|
1269
|
-
}, "RawAmountTableCell");
|
|
1255
|
+
};
|
|
1256
|
+
return /* @__PURE__ */ jsx27(TableCell13, { ref, ...props, children: /* @__PURE__ */ jsx27(Tooltip11, { title: `Raw Amount: ${amount}`, children: linked ? /* @__PURE__ */ jsxs16(Link7, { onClick: (e) => handleClick(e, eventNoun, isDefined5(amount) ? toHex2(amount) : ""), sx: { cursor: "pointer" }, children: [
|
|
1257
|
+
type === "send" ? "-" : "",
|
|
1258
|
+
formatAmount(amount)
|
|
1259
|
+
] }) : /* @__PURE__ */ jsxs16("span", { children: [
|
|
1260
|
+
type === "send" ? "-" : "",
|
|
1261
|
+
formatAmount(amount)
|
|
1262
|
+
] }) }) });
|
|
1263
|
+
};
|
|
1270
1264
|
|
|
1271
1265
|
// src/components/account/table/BalanceHistoryTableRow.tsx
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1266
|
+
import { jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1267
|
+
var BalanceHistoryTableRow = ({
|
|
1268
|
+
linked,
|
|
1269
|
+
row,
|
|
1270
|
+
...props
|
|
1271
|
+
}) => {
|
|
1272
|
+
const {
|
|
1273
|
+
amount,
|
|
1274
|
+
blockHash,
|
|
1275
|
+
blockNumber,
|
|
1276
|
+
debug,
|
|
1277
|
+
from,
|
|
1278
|
+
key,
|
|
1279
|
+
timestamp,
|
|
1280
|
+
to,
|
|
1281
|
+
type,
|
|
1282
|
+
txHash,
|
|
1283
|
+
transferHash
|
|
1284
|
+
} = row ?? {};
|
|
1285
|
+
const linkedTableCallProps = useMemo7(() => ({ linked }), [linked]);
|
|
1279
1286
|
const [ref, handleClick] = useLinkedBalanceHistoryItem();
|
|
1280
1287
|
const noun = isDefined6(txHash) ? "tx-hash|transfer-hash" : "block-hash|transfer-hash";
|
|
1281
1288
|
const data = isDefined6(txHash) ? `${txHash}|${transferHash}` : `${blockHash}|${transferHash}`;
|
|
1282
|
-
return /* @__PURE__ */
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
eventNoun: "from-address",
|
|
1304
|
-
...linkedTableCallProps
|
|
1305
|
-
}), /* @__PURE__ */ React29.createElement(AddressTableCell, {
|
|
1306
|
-
address: to,
|
|
1307
|
-
toolTipTitle: `To Address: ${to}`,
|
|
1308
|
-
eventNoun: "to-address",
|
|
1309
|
-
...linkedTableCallProps
|
|
1310
|
-
}), /* @__PURE__ */ React29.createElement(RawAmountTableCell, {
|
|
1311
|
-
amount,
|
|
1312
|
-
type,
|
|
1313
|
-
eventNoun: "amount"
|
|
1314
|
-
}), /* @__PURE__ */ React29.createElement(HashTableCell, {
|
|
1315
|
-
hash: transferHash,
|
|
1316
|
-
toolTipTitle: `Transfer Hash: ${transferHash}`,
|
|
1317
|
-
eventNoun: noun,
|
|
1318
|
-
eventData: data,
|
|
1319
|
-
...linkedTableCallProps
|
|
1320
|
-
}), /* @__PURE__ */ React29.createElement(TableCell14, null, /* @__PURE__ */ React29.createElement(RawInfoIconButton, {
|
|
1321
|
-
rawValue: debug
|
|
1322
|
-
})));
|
|
1323
|
-
}, "BalanceHistoryTableRow");
|
|
1289
|
+
return /* @__PURE__ */ jsxs17(
|
|
1290
|
+
StyledLinkableTableRow,
|
|
1291
|
+
{
|
|
1292
|
+
linked,
|
|
1293
|
+
onClick: linked ? (e) => handleClick(e, noun, data) : void 0,
|
|
1294
|
+
ref,
|
|
1295
|
+
...props,
|
|
1296
|
+
children: [
|
|
1297
|
+
/* @__PURE__ */ jsx28(HashTableCell, { hash: txHash, toolTipTitle: `Transaction Hash: ${txHash}`, eventNoun: "tx-hash", ...linkedTableCallProps }),
|
|
1298
|
+
/* @__PURE__ */ jsx28(BalanceHistoryBlockNumberTableCellInner, { blockNumber, eventNoun: "block-number", ...linkedTableCallProps }),
|
|
1299
|
+
/* @__PURE__ */ jsx28(BlockEpochTableCellInner, { epoch: timestamp, ...linkedTableCallProps }),
|
|
1300
|
+
/* @__PURE__ */ jsx28(AddressTableCell, { address: from, toolTipTitle: `From Address: ${from}`, eventNoun: "from-address", ...linkedTableCallProps }),
|
|
1301
|
+
/* @__PURE__ */ jsx28(AddressTableCell, { address: to, toolTipTitle: `To Address: ${to}`, eventNoun: "to-address", ...linkedTableCallProps }),
|
|
1302
|
+
/* @__PURE__ */ jsx28(RawAmountTableCell, { amount, type, eventNoun: "amount" }),
|
|
1303
|
+
/* @__PURE__ */ jsx28(HashTableCell, { hash: transferHash, toolTipTitle: `Transfer Hash: ${transferHash}`, eventNoun: noun, eventData: data, ...linkedTableCallProps }),
|
|
1304
|
+
/* @__PURE__ */ jsx28(TableCell14, { children: /* @__PURE__ */ jsx28(RawInfoIconButton, { rawValue: debug }) })
|
|
1305
|
+
]
|
|
1306
|
+
},
|
|
1307
|
+
key
|
|
1308
|
+
);
|
|
1309
|
+
};
|
|
1324
1310
|
|
|
1325
1311
|
// src/components/account/table/types/index.ts
|
|
1326
1312
|
var TableHeadingLabels = [
|
|
@@ -1335,55 +1321,60 @@ var TableHeadingLabels = [
|
|
|
1335
1321
|
];
|
|
1336
1322
|
|
|
1337
1323
|
// src/components/account/table/BalanceHistoryTableEx.tsx
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
},
|
|
1324
|
+
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1325
|
+
var AccountBalanceHistoryTableEx = ({
|
|
1326
|
+
history,
|
|
1327
|
+
linked,
|
|
1328
|
+
...props
|
|
1329
|
+
}) => {
|
|
1330
|
+
return isDefined7(history) ? /* @__PURE__ */ jsxs18(TableEx2, { ...props, children: [
|
|
1331
|
+
/* @__PURE__ */ jsx29(TableHead2, { children: /* @__PURE__ */ jsx29(TableRow3, { children: TableHeadingLabels.map((heading) => /* @__PURE__ */ jsx29(TableCell15, { children: heading }, heading)) }) }),
|
|
1332
|
+
/* @__PURE__ */ jsx29(TableBody2, { children: history?.map((row) => /* @__PURE__ */ jsx29(BalanceHistoryTableRow, { linked, row }, row.key)) })
|
|
1333
|
+
] }) : null;
|
|
1334
|
+
};
|
|
1347
1335
|
|
|
1348
1336
|
// src/components/account/BalanceHistoryFlexbox.tsx
|
|
1349
|
-
|
|
1337
|
+
import { jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1338
|
+
var AccountBalanceHistoryFlexBox = ({
|
|
1339
|
+
address,
|
|
1340
|
+
refresh,
|
|
1341
|
+
viewer,
|
|
1342
|
+
...props
|
|
1343
|
+
}) => {
|
|
1350
1344
|
const [results, error] = useAccountBalanceHistory(address, viewer, void 0, void 0, refresh);
|
|
1351
|
-
const {
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
history
|
|
1369
|
-
})
|
|
1370
|
-
}
|
|
1345
|
+
const {
|
|
1346
|
+
history,
|
|
1347
|
+
balance,
|
|
1348
|
+
truncated
|
|
1349
|
+
} = results || { balance: [AttoXL1(0n), AttoXL1(0n)], history: void 0 };
|
|
1350
|
+
return isDefined8(history) && isDefined8(address) ? /* @__PURE__ */ jsxs19(FlexCol3, { ...props, children: [
|
|
1351
|
+
/* @__PURE__ */ jsx30(ErrorRender3, { error, scope: "AccountBalanceHistoryTable" }),
|
|
1352
|
+
/* @__PURE__ */ jsx30(Typography8, { variant: "h6", gutterBottom: true, children: formatBalanceMagnitude(balance) }),
|
|
1353
|
+
truncated ? /* @__PURE__ */ jsxs19(Typography8, { variant: "caption", gutterBottom: true, children: [
|
|
1354
|
+
"Ranged Balance from",
|
|
1355
|
+
" ",
|
|
1356
|
+
history.at(-1).blockNumber,
|
|
1357
|
+
" ",
|
|
1358
|
+
"-",
|
|
1359
|
+
" ",
|
|
1360
|
+
history[0].blockNumber
|
|
1361
|
+
] }) : null,
|
|
1362
|
+
/* @__PURE__ */ jsx30(AccountBalanceHistoryTableEx, { history })
|
|
1363
|
+
] }) : null;
|
|
1364
|
+
};
|
|
1371
1365
|
|
|
1372
1366
|
// src/components/account/hooks/usePagedAccountBalanceHistory.ts
|
|
1373
1367
|
import { isDefined as isDefined9 } from "@xylabs/sdk-js";
|
|
1374
1368
|
import { useAccountBalanceHistory as useAccountBalanceHistory2 } from "@xyo-network/react-chain-provider";
|
|
1375
1369
|
import { useCallback, useState as useState9 } from "react";
|
|
1376
|
-
var usePagedAccountBalanceHistory =
|
|
1370
|
+
var usePagedAccountBalanceHistory = (address, viewer, maxPage = 1) => {
|
|
1377
1371
|
const [updatedBlockRange, setUpdatedBlockRange] = useState9();
|
|
1378
1372
|
const [pagedHistory, setPagedHistory] = useState9();
|
|
1379
1373
|
const [results, error, loading] = useAccountBalanceHistory2(address, viewer, maxPage, updatedBlockRange);
|
|
1380
1374
|
const { history, truncated } = results || {};
|
|
1381
1375
|
const [previousHistory, setPreviousHistory] = useState9(history);
|
|
1382
1376
|
if (isDefined9(history) && history !== previousHistory) {
|
|
1383
|
-
setPagedHistory([
|
|
1384
|
-
...pagedHistory ?? [],
|
|
1385
|
-
...history
|
|
1386
|
-
]);
|
|
1377
|
+
setPagedHistory([...pagedHistory ?? [], ...history]);
|
|
1387
1378
|
setPreviousHistory(history);
|
|
1388
1379
|
}
|
|
1389
1380
|
const lastBlock = isDefined9(history) ? history.at(-1)?.blockNumber : void 0;
|
|
@@ -1391,15 +1382,9 @@ var usePagedAccountBalanceHistory = /* @__PURE__ */ __name((address, viewer, max
|
|
|
1391
1382
|
const updateRange = useCallback(() => {
|
|
1392
1383
|
if (isDefined9(lastBlock) && lastBlock > 0 && truncated) {
|
|
1393
1384
|
const newEndBlock = lastBlock - 1;
|
|
1394
|
-
setUpdatedBlockRange([
|
|
1395
|
-
0,
|
|
1396
|
-
newEndBlock
|
|
1397
|
-
]);
|
|
1385
|
+
setUpdatedBlockRange([0, newEndBlock]);
|
|
1398
1386
|
}
|
|
1399
|
-
}, [
|
|
1400
|
-
lastBlock,
|
|
1401
|
-
truncated
|
|
1402
|
-
]);
|
|
1387
|
+
}, [lastBlock, truncated]);
|
|
1403
1388
|
return {
|
|
1404
1389
|
pagedHistory,
|
|
1405
1390
|
historyComplete,
|
|
@@ -1407,123 +1392,125 @@ var usePagedAccountBalanceHistory = /* @__PURE__ */ __name((address, viewer, max
|
|
|
1407
1392
|
error,
|
|
1408
1393
|
loading
|
|
1409
1394
|
};
|
|
1410
|
-
}
|
|
1395
|
+
};
|
|
1411
1396
|
|
|
1412
1397
|
// src/components/chain/controls/PollingControlsFlexbox.tsx
|
|
1413
|
-
import {
|
|
1414
|
-
|
|
1398
|
+
import {
|
|
1399
|
+
Autorenew,
|
|
1400
|
+
Pause
|
|
1401
|
+
} from "@mui/icons-material";
|
|
1402
|
+
import {
|
|
1403
|
+
Alert as Alert3,
|
|
1404
|
+
AlertTitle as AlertTitle2,
|
|
1405
|
+
Grow,
|
|
1406
|
+
Icon as Icon2,
|
|
1407
|
+
IconButton as IconButton4,
|
|
1408
|
+
Tooltip as Tooltip12
|
|
1409
|
+
} from "@mui/material";
|
|
1415
1410
|
import { FlexRow as FlexRow6 } from "@xylabs/react-flexbox";
|
|
1416
|
-
import
|
|
1411
|
+
import { memo } from "react";
|
|
1417
1412
|
|
|
1418
1413
|
// src/components/chain/stats/Dialog.tsx
|
|
1419
1414
|
import { QueryStats } from "@mui/icons-material";
|
|
1420
|
-
import {
|
|
1421
|
-
|
|
1415
|
+
import {
|
|
1416
|
+
Dialog as Dialog3,
|
|
1417
|
+
DialogContent as DialogContent3,
|
|
1418
|
+
DialogTitle as DialogTitle3,
|
|
1419
|
+
IconButton as IconButton3
|
|
1420
|
+
} from "@mui/material";
|
|
1421
|
+
import { useState as useState10 } from "react";
|
|
1422
1422
|
|
|
1423
1423
|
// src/components/chain/stats/producer/ProducerFlexbox.tsx
|
|
1424
1424
|
import { Typography as Typography9 } from "@mui/material";
|
|
1425
1425
|
import { ErrorRender as ErrorRender4 } from "@xylabs/react-error";
|
|
1426
1426
|
import { FlexCol as FlexCol4 } from "@xylabs/react-flexbox";
|
|
1427
1427
|
import { isChainSummaryProducers } from "@xyo-network/chain-analyze";
|
|
1428
|
-
import
|
|
1428
|
+
import { useMemo as useMemo8 } from "react";
|
|
1429
1429
|
|
|
1430
1430
|
// src/components/chain/stats/producer/Table.tsx
|
|
1431
|
-
import {
|
|
1431
|
+
import {
|
|
1432
|
+
Table,
|
|
1433
|
+
TableBody as TableBody3,
|
|
1434
|
+
TableCell as TableCell16,
|
|
1435
|
+
TableHead as TableHead3,
|
|
1436
|
+
TableRow as TableRow4,
|
|
1437
|
+
useTheme
|
|
1438
|
+
} from "@mui/material";
|
|
1432
1439
|
import { BlockiesAvatar as BlockiesAvatar2 } from "@xyo-network/xl1-blockies";
|
|
1433
|
-
import
|
|
1434
|
-
var ChainProducerStatsTable =
|
|
1440
|
+
import { jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1441
|
+
var ChainProducerStatsTable = ({ producers, ...props }) => {
|
|
1435
1442
|
const theme = useTheme();
|
|
1436
|
-
return /* @__PURE__ */
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
},
|
|
1442
|
-
|
|
1443
|
-
height: theme.spacing(2.75),
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
}
|
|
1443
|
+
return /* @__PURE__ */ jsxs20(Table, { ...props, children: [
|
|
1444
|
+
/* @__PURE__ */ jsx31(TableHead3, { children: /* @__PURE__ */ jsxs20(TableRow4, { children: [
|
|
1445
|
+
/* @__PURE__ */ jsx31(TableCell16, { children: "Address" }),
|
|
1446
|
+
/* @__PURE__ */ jsx31(TableCell16, { children: "Blocks Produced" }),
|
|
1447
|
+
/* @__PURE__ */ jsx31(TableCell16, { children: "Rewards Earned Produced" })
|
|
1448
|
+
] }) }),
|
|
1449
|
+
/* @__PURE__ */ jsx31(TableBody3, { children: producers?.map((producer) => /* @__PURE__ */ jsxs20(TableRow4, { children: [
|
|
1450
|
+
/* @__PURE__ */ jsx31(TableCell16, { children: /* @__PURE__ */ jsx31(BlockiesAvatar2, { blockiesOptions: { seed: producer.address }, sx: { height: theme.spacing(2.75), width: theme.spacing(2.75) } }) }),
|
|
1451
|
+
/* @__PURE__ */ jsx31(TableCell16, { children: producer.blocksProduced.toString() }),
|
|
1452
|
+
/* @__PURE__ */ jsx31(TableCell16, { children: producer.rewardsEarned.toString() })
|
|
1453
|
+
] }, producer.address)) })
|
|
1454
|
+
] });
|
|
1455
|
+
};
|
|
1448
1456
|
|
|
1449
1457
|
// src/components/chain/stats/producer/ProducerFlexbox.tsx
|
|
1450
|
-
|
|
1458
|
+
import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1459
|
+
var BlockProducerStatsFlexbox = ({ payload, ...props }) => {
|
|
1451
1460
|
const [producer, producerError] = useMemo8(() => {
|
|
1452
1461
|
if (payload) {
|
|
1453
|
-
return isChainSummaryProducers(payload) ? [
|
|
1454
|
-
payload
|
|
1455
|
-
] : [
|
|
1456
|
-
void 0,
|
|
1457
|
-
new Error("Payload is not a Chain Producer")
|
|
1458
|
-
];
|
|
1462
|
+
return isChainSummaryProducers(payload) ? [payload] : [void 0, new Error("Payload is not a Chain Producer")];
|
|
1459
1463
|
} else {
|
|
1460
1464
|
return [];
|
|
1461
1465
|
}
|
|
1462
|
-
}, [
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
}, /* @__PURE__ */ React33.createElement(ErrorRender4, {
|
|
1475
|
-
error: producerError,
|
|
1476
|
-
scope: "BlockProducerStatsFlexbox"
|
|
1477
|
-
}), /* @__PURE__ */ React33.createElement(Typography9, {
|
|
1478
|
-
sx: {
|
|
1479
|
-
fontSize: "1rem"
|
|
1466
|
+
}, [payload]);
|
|
1467
|
+
const producersArray = useMemo8(() => Object.values(producer?.producers ?? {}), [producer]);
|
|
1468
|
+
return /* @__PURE__ */ jsxs21(
|
|
1469
|
+
FlexCol4,
|
|
1470
|
+
{
|
|
1471
|
+
...props,
|
|
1472
|
+
sx: { alignItems: "start", gap: 1 },
|
|
1473
|
+
children: [
|
|
1474
|
+
/* @__PURE__ */ jsx32(ErrorRender4, { error: producerError, scope: "BlockProducerStatsFlexbox" }),
|
|
1475
|
+
/* @__PURE__ */ jsx32(Typography9, { sx: { fontSize: "1rem" }, children: "Block Producers" }),
|
|
1476
|
+
/* @__PURE__ */ jsx32(ChainProducerStatsTable, { producers: producersArray })
|
|
1477
|
+
]
|
|
1480
1478
|
}
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
}));
|
|
1484
|
-
}, "BlockProducerStatsFlexbox");
|
|
1479
|
+
);
|
|
1480
|
+
};
|
|
1485
1481
|
|
|
1486
1482
|
// src/components/chain/stats/Dialog.tsx
|
|
1487
|
-
|
|
1483
|
+
import { Fragment as Fragment6, jsx as jsx33, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1484
|
+
var ChainAnalyzerStatsDialog = (props) => {
|
|
1488
1485
|
const { analyzers, statsUpdated } = useChainAnalyzersContext();
|
|
1489
|
-
return /* @__PURE__ */
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
var ChainAnalyzerStatsDialogFromContext = /* @__PURE__ */ __name((props) => {
|
|
1486
|
+
return /* @__PURE__ */ jsxs22(Dialog3, { ...props, children: [
|
|
1487
|
+
/* @__PURE__ */ jsx33(DialogTitle3, { children: "Chain Analysis" }),
|
|
1488
|
+
/* @__PURE__ */ jsx33(DialogContent3, { children: statsUpdated > 0 ? Object.entries(analyzers).map(([id2, analyzer]) => /* @__PURE__ */ jsx33("div", { children: id2 === "producers" ? /* @__PURE__ */ jsx33(BlockProducerStatsFlexbox, { payload: analyzer.result() }) : null }, id2)) : null })
|
|
1489
|
+
] });
|
|
1490
|
+
};
|
|
1491
|
+
var ChainAnalyzerStatsDialogFromContext = (props) => {
|
|
1496
1492
|
const [open, setOpen] = useState10(false);
|
|
1497
|
-
const handleClose =
|
|
1498
|
-
return /* @__PURE__ */
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
...props
|
|
1504
|
-
}));
|
|
1505
|
-
}, "ChainAnalyzerStatsDialogFromContext");
|
|
1493
|
+
const handleClose = () => setOpen(false);
|
|
1494
|
+
return /* @__PURE__ */ jsxs22(Fragment6, { children: [
|
|
1495
|
+
/* @__PURE__ */ jsx33(IconButton3, { onClick: () => setOpen(true), children: /* @__PURE__ */ jsx33(QueryStats, {}) }),
|
|
1496
|
+
/* @__PURE__ */ jsx33(ChainAnalyzerStatsDialog, { onClose: handleClose, open, ...props })
|
|
1497
|
+
] });
|
|
1498
|
+
};
|
|
1506
1499
|
|
|
1507
1500
|
// src/components/chain/controls/PulseSvgIcon.tsx
|
|
1508
|
-
import {
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
transform: "translate(34,34)"
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
}), /* @__PURE__ */ React35.createElement("circle", {
|
|
1522
|
-
className: "radar",
|
|
1523
|
-
cx: "0",
|
|
1524
|
-
cy: "0",
|
|
1525
|
-
r: "6"
|
|
1526
|
-
}))), "PulseSvgIcon");
|
|
1501
|
+
import {
|
|
1502
|
+
createSvgIcon,
|
|
1503
|
+
keyframes,
|
|
1504
|
+
styled as styled2
|
|
1505
|
+
} from "@mui/material";
|
|
1506
|
+
import { jsx as jsx34, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1507
|
+
var PulseSvgIcon = createSvgIcon(
|
|
1508
|
+
/* @__PURE__ */ jsx34("svg", { viewBox: "0 0 80 80", version: "1.1", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxs23("g", { transform: "translate(34,34)", children: [
|
|
1509
|
+
/* @__PURE__ */ jsx34("circle", { className: "core", cx: "0", cy: "0", r: "6" }),
|
|
1510
|
+
/* @__PURE__ */ jsx34("circle", { className: "radar", cx: "0", cy: "0", r: "6" })
|
|
1511
|
+
] }) }),
|
|
1512
|
+
"PulseSvgIcon"
|
|
1513
|
+
);
|
|
1527
1514
|
var pulse1 = keyframes`
|
|
1528
1515
|
0% {
|
|
1529
1516
|
opacity: 0;
|
|
@@ -1579,66 +1566,71 @@ var StyledPulseSvgIcon = styled2(PulseSvgIcon)(({ theme }) => {
|
|
|
1579
1566
|
});
|
|
1580
1567
|
|
|
1581
1568
|
// src/components/chain/controls/PollingControlsFlexbox.tsx
|
|
1582
|
-
|
|
1569
|
+
import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1570
|
+
var PollingControlsFlexbox = ({
|
|
1571
|
+
blocksBehind,
|
|
1572
|
+
pollingState,
|
|
1573
|
+
setPollingState
|
|
1574
|
+
}) => {
|
|
1583
1575
|
const paused = pollingState === "paused";
|
|
1584
1576
|
const running = pollingState === "running";
|
|
1585
|
-
return /* @__PURE__ */
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1577
|
+
return /* @__PURE__ */ jsxs24(
|
|
1578
|
+
FlexRow6,
|
|
1579
|
+
{
|
|
1580
|
+
sx: {
|
|
1581
|
+
justifyContent: "space-between",
|
|
1582
|
+
width: "100%"
|
|
1583
|
+
},
|
|
1584
|
+
children: [
|
|
1585
|
+
/* @__PURE__ */ jsxs24(FlexRow6, { sx: { gap: 2 }, children: [
|
|
1586
|
+
running ? /* @__PURE__ */ jsx35(IconButton4, { onClick: () => setPollingState?.("paused"), title: "Pause Block Stream", children: /* @__PURE__ */ jsx35(Pause, {}) }) : null,
|
|
1587
|
+
paused ? /* @__PURE__ */ jsx35(IconButton4, { onClick: () => setPollingState?.("running"), title: "Re-Sync Block Stream", children: /* @__PURE__ */ jsx35(Autorenew, {}) }) : null,
|
|
1588
|
+
/* @__PURE__ */ jsx35(ChainAnalyzerStatsDialogFromContext, {})
|
|
1589
|
+
] }),
|
|
1590
|
+
/* @__PURE__ */ jsxs24(FlexRow6, { sx: { gap: 2 }, children: [
|
|
1591
|
+
/* @__PURE__ */ jsx35(Grow, { in: (blocksBehind ?? 0) > 0, children: /* @__PURE__ */ jsx35(Tooltip12, { title: "Click to Re-Sync", children: /* @__PURE__ */ jsx35(
|
|
1592
|
+
Alert3,
|
|
1593
|
+
{
|
|
1594
|
+
sx: {
|
|
1595
|
+
py: 0,
|
|
1596
|
+
px: 1,
|
|
1597
|
+
cursor: "pointer"
|
|
1598
|
+
},
|
|
1599
|
+
severity: "warning",
|
|
1600
|
+
onClick: () => setPollingState?.("running"),
|
|
1601
|
+
children: /* @__PURE__ */ jsxs24(AlertTitle2, { sx: { mb: 0 }, children: [
|
|
1602
|
+
"Behind:",
|
|
1603
|
+
" ",
|
|
1604
|
+
blocksBehind
|
|
1605
|
+
] })
|
|
1606
|
+
}
|
|
1607
|
+
) }) }),
|
|
1608
|
+
/* @__PURE__ */ jsx35(Icon2, { children: /* @__PURE__ */ jsx35(StyledPulseSvgIcon, { className: running ? "" : "paused" }) })
|
|
1609
|
+
] })
|
|
1610
|
+
]
|
|
1619
1611
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
}, "PollingControlsFlexbox");
|
|
1624
|
-
var MemoizedPollingControlsFlexbox = /* @__PURE__ */ memo(PollingControlsFlexbox);
|
|
1612
|
+
);
|
|
1613
|
+
};
|
|
1614
|
+
var MemoizedPollingControlsFlexbox = memo(PollingControlsFlexbox);
|
|
1625
1615
|
|
|
1626
1616
|
// src/components/chain/dialog/Dialog.tsx
|
|
1627
|
-
import {
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1617
|
+
import {
|
|
1618
|
+
Button as Button4,
|
|
1619
|
+
Dialog as Dialog4,
|
|
1620
|
+
DialogActions as DialogActions3,
|
|
1621
|
+
DialogContent as DialogContent4
|
|
1622
|
+
} from "@mui/material";
|
|
1623
|
+
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
1624
|
+
var TransactionsDialog = ({ onClose, ...props }) => {
|
|
1625
|
+
return /* @__PURE__ */ jsxs25(Dialog4, { onClose, ...props, children: [
|
|
1626
|
+
/* @__PURE__ */ jsx36(DialogContent4, { children: "Transactions Dialog" }),
|
|
1627
|
+
/* @__PURE__ */ jsx36(DialogActions3, { children: /* @__PURE__ */ jsx36(Button4, { variant: "outlined", onClick: (e) => onClose?.(e, "escapeKeyDown"), children: "Close" }) })
|
|
1628
|
+
] });
|
|
1629
|
+
};
|
|
1638
1630
|
|
|
1639
1631
|
// src/components/chain/hooks/useOnBlock.ts
|
|
1640
1632
|
import { useEffect, useRef as useRef2 } from "react";
|
|
1641
|
-
var useOnBlock =
|
|
1633
|
+
var useOnBlock = (initialHeadNumber, onAddBlock, liveHead, pollingState) => {
|
|
1642
1634
|
const blocksWhilePausedRef = useRef2([]);
|
|
1643
1635
|
const lastLiveHeadRef = useRef2(liveHead);
|
|
1644
1636
|
useEffect(() => {
|
|
@@ -1661,56 +1653,45 @@ var useOnBlock = /* @__PURE__ */ __name((initialHeadNumber, onAddBlock, liveHead
|
|
|
1661
1653
|
void onAddBlock(liveHead);
|
|
1662
1654
|
}
|
|
1663
1655
|
}
|
|
1664
|
-
}, [
|
|
1665
|
-
initialHeadNumber,
|
|
1666
|
-
liveHead,
|
|
1667
|
-
onAddBlock,
|
|
1668
|
-
pollingState
|
|
1669
|
-
]);
|
|
1656
|
+
}, [initialHeadNumber, liveHead, onAddBlock, pollingState]);
|
|
1670
1657
|
return blocksWhilePausedRef;
|
|
1671
|
-
}
|
|
1658
|
+
};
|
|
1672
1659
|
|
|
1673
1660
|
// src/components/chain/pagination/BlockChainPagination.tsx
|
|
1674
1661
|
import { TablePaginationActions } from "@xyo-network/react-payload-table";
|
|
1675
|
-
import
|
|
1676
|
-
var BlockChainPagination =
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
});
|
|
1683
|
-
}
|
|
1662
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
1663
|
+
var BlockChainPagination = ({
|
|
1664
|
+
count = 0,
|
|
1665
|
+
onPageChange,
|
|
1666
|
+
page,
|
|
1667
|
+
rowsPerPage = 10
|
|
1668
|
+
}) => {
|
|
1669
|
+
return /* @__PURE__ */ jsx37(TablePaginationActions, { count, onPageChange, page, rowsPerPage });
|
|
1670
|
+
};
|
|
1684
1671
|
|
|
1685
1672
|
// src/components/chain/pagination/hooks/usePagination.tsx
|
|
1686
1673
|
import { useMemo as useMemo9, useState as useState11 } from "react";
|
|
1687
|
-
var useChainPagination =
|
|
1674
|
+
var useChainPagination = (pageSize, blockComponents) => {
|
|
1688
1675
|
const [page, setPage] = useState11(0);
|
|
1689
1676
|
const paginatedBlockComponents = useMemo9(() => {
|
|
1690
1677
|
const startIndex = page * pageSize;
|
|
1691
1678
|
const endIndex = startIndex + pageSize;
|
|
1692
1679
|
return blockComponents?.slice(startIndex, endIndex);
|
|
1693
|
-
}, [
|
|
1694
|
-
|
|
1695
|
-
page,
|
|
1696
|
-
pageSize
|
|
1697
|
-
]);
|
|
1698
|
-
const onPageChange = /* @__PURE__ */ __name((_event, newPage) => {
|
|
1680
|
+
}, [blockComponents, page, pageSize]);
|
|
1681
|
+
const onPageChange = (_event, newPage) => {
|
|
1699
1682
|
setPage(newPage);
|
|
1700
|
-
}
|
|
1683
|
+
};
|
|
1701
1684
|
return {
|
|
1702
1685
|
onPageChange,
|
|
1703
1686
|
page,
|
|
1704
1687
|
paginatedBlockComponents
|
|
1705
1688
|
};
|
|
1706
|
-
}
|
|
1689
|
+
};
|
|
1707
1690
|
|
|
1708
1691
|
// src/components/chain/styled/BlockListWrapperFlexbox.tsx
|
|
1709
1692
|
import { styled as styled3 } from "@mui/material";
|
|
1710
1693
|
import { FlexCol as FlexCol5 } from "@xylabs/react-flexbox";
|
|
1711
|
-
var BlockListWrapperFlexBox = styled3(FlexCol5, {
|
|
1712
|
-
name: "BlockListWrapperFlexbox"
|
|
1713
|
-
})(() => ({
|
|
1694
|
+
var BlockListWrapperFlexBox = styled3(FlexCol5, { name: "BlockListWrapperFlexbox" })(() => ({
|
|
1714
1695
|
"& > div:nth-of-type(2) .block-heading-flexbox .divider-spacer": {
|
|
1715
1696
|
// hide the spacer for the first element
|
|
1716
1697
|
visibility: "hidden"
|
|
@@ -1725,69 +1706,94 @@ var BlockListWrapperFlexBox = styled3(FlexCol5, {
|
|
|
1725
1706
|
// src/components/payload/builder/Flexbox.tsx
|
|
1726
1707
|
import { FlexCol as FlexCol6 } from "@xylabs/react-flexbox";
|
|
1727
1708
|
import { JsonViewerEx as JsonViewerEx2 } from "@xyo-network/react-payload-raw-info";
|
|
1728
|
-
import
|
|
1729
|
-
|
|
1709
|
+
import { useState as useState12 } from "react";
|
|
1710
|
+
import { jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
1711
|
+
var PayloadBuilderFlexbox = ({
|
|
1712
|
+
BuilderComponent,
|
|
1713
|
+
onBuild,
|
|
1714
|
+
...props
|
|
1715
|
+
}) => {
|
|
1730
1716
|
const [payload, setPayload] = useState12();
|
|
1731
|
-
const onBuildLocal =
|
|
1717
|
+
const onBuildLocal = (payload2) => {
|
|
1732
1718
|
onBuild?.(payload2);
|
|
1733
1719
|
setPayload(payload2);
|
|
1734
|
-
}
|
|
1735
|
-
return /* @__PURE__ */
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1720
|
+
};
|
|
1721
|
+
return /* @__PURE__ */ jsxs26(
|
|
1722
|
+
FlexCol6,
|
|
1723
|
+
{
|
|
1724
|
+
...props,
|
|
1725
|
+
sx: [{ gap: 2 }, ...Array.isArray(props.sx) ? props.sx : [props.sx]],
|
|
1726
|
+
children: [
|
|
1727
|
+
/* @__PURE__ */ jsx38(BuilderComponent, { onBuild: onBuildLocal }),
|
|
1728
|
+
payload ? /* @__PURE__ */ jsx38(JsonViewerEx2, { value: payload }) : null
|
|
1743
1729
|
]
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
}), payload ? /* @__PURE__ */ React39.createElement(JsonViewerEx2, {
|
|
1748
|
-
value: payload
|
|
1749
|
-
}) : null);
|
|
1750
|
-
}, "PayloadBuilderFlexbox");
|
|
1730
|
+
}
|
|
1731
|
+
);
|
|
1732
|
+
};
|
|
1751
1733
|
|
|
1752
1734
|
// src/components/payload/builder/producer-intent/Form.tsx
|
|
1753
1735
|
import { Button as Button5, FormControl as FormControl5 } from "@mui/material";
|
|
1754
1736
|
import { usePromise as usePromise3 } from "@xylabs/react-promise";
|
|
1755
1737
|
import { createProducerChainStakeIntent } from "@xyo-network/chain-protocol";
|
|
1756
|
-
import
|
|
1738
|
+
import { useState as useState15 } from "react";
|
|
1757
1739
|
|
|
1758
1740
|
// src/components/payload/fields/BlockNumberTextField.tsx
|
|
1759
|
-
import {
|
|
1741
|
+
import {
|
|
1742
|
+
FormControl as FormControl3,
|
|
1743
|
+
FormHelperText as FormHelperText2,
|
|
1744
|
+
TextField as TextField3
|
|
1745
|
+
} from "@mui/material";
|
|
1760
1746
|
import { toXL1BlockNumber as toXL1BlockNumber2 } from "@xyo-network/xl1-sdk";
|
|
1761
|
-
import
|
|
1762
|
-
|
|
1747
|
+
import { useState as useState13 } from "react";
|
|
1748
|
+
import { jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
1749
|
+
var BlockNumberTextField = ({
|
|
1750
|
+
errorMessage,
|
|
1751
|
+
onBlockNumberChanged,
|
|
1752
|
+
onChange,
|
|
1753
|
+
...props
|
|
1754
|
+
}) => {
|
|
1763
1755
|
const [blockNumber, setBlockNumber] = useState13();
|
|
1764
|
-
const handleChange =
|
|
1756
|
+
const handleChange = (e) => {
|
|
1765
1757
|
const value = e.target.value.replaceAll(/\D/g, "");
|
|
1766
1758
|
setBlockNumber(value.length > 0 ? Number(value) : void 0);
|
|
1767
1759
|
onBlockNumberChanged?.(toXL1BlockNumber2(value));
|
|
1768
1760
|
onChange?.(e);
|
|
1769
|
-
}
|
|
1761
|
+
};
|
|
1770
1762
|
const errored = errorMessage !== void 0;
|
|
1771
|
-
return /* @__PURE__ */
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1763
|
+
return /* @__PURE__ */ jsxs27(FormControl3, { fullWidth: true, children: [
|
|
1764
|
+
/* @__PURE__ */ jsx39(
|
|
1765
|
+
TextField3,
|
|
1766
|
+
{
|
|
1767
|
+
error: errored,
|
|
1768
|
+
onChange: handleChange,
|
|
1769
|
+
type: "number",
|
|
1770
|
+
value: blockNumber ?? "",
|
|
1771
|
+
...props
|
|
1772
|
+
}
|
|
1773
|
+
),
|
|
1774
|
+
errored ? /* @__PURE__ */ jsx39(FormHelperText2, { sx: { color: "error.main" }, children: errorMessage }) : null
|
|
1775
|
+
] });
|
|
1776
|
+
};
|
|
1785
1777
|
|
|
1786
1778
|
// src/components/payload/fields/XyoAddressTextField.tsx
|
|
1787
|
-
import {
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1779
|
+
import {
|
|
1780
|
+
FormControl as FormControl4,
|
|
1781
|
+
FormHelperText as FormHelperText3,
|
|
1782
|
+
TextField as TextField4
|
|
1783
|
+
} from "@mui/material";
|
|
1784
|
+
import {
|
|
1785
|
+
asAddress,
|
|
1786
|
+
isAddress,
|
|
1787
|
+
isDefined as isDefined10
|
|
1788
|
+
} from "@xylabs/sdk-js";
|
|
1789
|
+
import { useState as useState14 } from "react";
|
|
1790
|
+
import { jsx as jsx40, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
1791
|
+
var XyoAddressTextField = ({
|
|
1792
|
+
onAddressChanged,
|
|
1793
|
+
onChange,
|
|
1794
|
+
resetValue,
|
|
1795
|
+
...props
|
|
1796
|
+
}) => {
|
|
1791
1797
|
const [address, setAddress] = useState14("");
|
|
1792
1798
|
const [addressError, setAddressError] = useState14();
|
|
1793
1799
|
const [previousResetValue, setPreviousResetValue] = useState14(resetValue);
|
|
@@ -1795,7 +1801,7 @@ var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange,
|
|
|
1795
1801
|
setPreviousResetValue(resetValue);
|
|
1796
1802
|
setAddress("");
|
|
1797
1803
|
}
|
|
1798
|
-
const handleChange =
|
|
1804
|
+
const handleChange = (event) => {
|
|
1799
1805
|
const { value } = event.target;
|
|
1800
1806
|
onChange?.(event);
|
|
1801
1807
|
const xyoAddress = asAddress(value);
|
|
@@ -1808,31 +1814,32 @@ var XyoAddressTextField = /* @__PURE__ */ __name(({ onAddressChanged, onChange,
|
|
|
1808
1814
|
setAddressError(new Error("Invalid address"));
|
|
1809
1815
|
}
|
|
1810
1816
|
setAddress(value);
|
|
1811
|
-
}
|
|
1812
|
-
const handleBlur =
|
|
1817
|
+
};
|
|
1818
|
+
const handleBlur = () => {
|
|
1813
1819
|
const xyoAddress = asAddress(address);
|
|
1814
1820
|
if (!isAddress(xyoAddress)) {
|
|
1815
1821
|
setAddressError(new Error("Invalid address"));
|
|
1816
1822
|
onAddressChanged?.();
|
|
1817
1823
|
}
|
|
1818
|
-
}
|
|
1819
|
-
return /* @__PURE__ */
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1824
|
+
};
|
|
1825
|
+
return /* @__PURE__ */ jsxs28(FormControl4, { fullWidth: true, children: [
|
|
1826
|
+
/* @__PURE__ */ jsx40(
|
|
1827
|
+
TextField4,
|
|
1828
|
+
{
|
|
1829
|
+
error: !!addressError,
|
|
1830
|
+
onBlur: handleBlur,
|
|
1831
|
+
onChange: handleChange,
|
|
1832
|
+
value: address,
|
|
1833
|
+
...props
|
|
1834
|
+
}
|
|
1835
|
+
),
|
|
1836
|
+
addressError ? /* @__PURE__ */ jsx40(FormHelperText3, { sx: { color: "error.main" }, children: addressError.message }) : null
|
|
1837
|
+
] });
|
|
1838
|
+
};
|
|
1833
1839
|
|
|
1834
1840
|
// src/components/payload/builder/producer-intent/Form.tsx
|
|
1835
|
-
|
|
1841
|
+
import { Fragment as Fragment7, jsx as jsx41, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
1842
|
+
var ProducerIntentBuilderForm = ({ onBuild }) => {
|
|
1836
1843
|
const [delegate, setDelegate] = useState15();
|
|
1837
1844
|
const [exp, setExp] = useState15();
|
|
1838
1845
|
const [nbf, setNbf] = useState15();
|
|
@@ -1849,64 +1856,66 @@ var ProducerIntentBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1849
1856
|
}
|
|
1850
1857
|
}
|
|
1851
1858
|
}
|
|
1852
|
-
}, [
|
|
1853
|
-
|
|
1854
|
-
exp,
|
|
1855
|
-
nbf
|
|
1856
|
-
]);
|
|
1857
|
-
const onBuildLocal = /* @__PURE__ */ __name(() => {
|
|
1859
|
+
}, [delegate, exp, nbf]);
|
|
1860
|
+
const onBuildLocal = () => {
|
|
1858
1861
|
if (onBuild && intentPayload) onBuild?.(intentPayload);
|
|
1859
|
-
}
|
|
1860
|
-
return /* @__PURE__ */
|
|
1861
|
-
fullWidth: true
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
disabled: !intentPayload,
|
|
1888
|
-
variant: "contained",
|
|
1889
|
-
onClick: onBuildLocal
|
|
1890
|
-
}, "Build"));
|
|
1891
|
-
}, "ProducerIntentBuilderForm");
|
|
1892
|
-
|
|
1893
|
-
// src/components/payload/builder/transfer/Flexbox.tsx
|
|
1894
|
-
import React45 from "react";
|
|
1862
|
+
};
|
|
1863
|
+
return /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
1864
|
+
/* @__PURE__ */ jsx41(FormControl5, { fullWidth: true, children: /* @__PURE__ */ jsx41(XyoAddressTextField, { label: "Delegate", name: "delegate", onAddressChanged: setDelegate, required: true, size: "small" }) }),
|
|
1865
|
+
/* @__PURE__ */ jsx41(FormControl5, { fullWidth: true, children: /* @__PURE__ */ jsx41(
|
|
1866
|
+
BlockNumberTextField,
|
|
1867
|
+
{
|
|
1868
|
+
errorMessage: blockRangeError?.message,
|
|
1869
|
+
label: "Expires",
|
|
1870
|
+
name: "exp",
|
|
1871
|
+
onBlockNumberChanged: setExp,
|
|
1872
|
+
required: true,
|
|
1873
|
+
size: "small"
|
|
1874
|
+
}
|
|
1875
|
+
) }),
|
|
1876
|
+
/* @__PURE__ */ jsx41(FormControl5, { fullWidth: true, children: /* @__PURE__ */ jsx41(
|
|
1877
|
+
BlockNumberTextField,
|
|
1878
|
+
{
|
|
1879
|
+
errorMessage: blockRangeError?.message,
|
|
1880
|
+
label: "Not Before",
|
|
1881
|
+
name: "nbf",
|
|
1882
|
+
onBlockNumberChanged: setNbf,
|
|
1883
|
+
required: true,
|
|
1884
|
+
size: "small"
|
|
1885
|
+
}
|
|
1886
|
+
) }),
|
|
1887
|
+
/* @__PURE__ */ jsx41(Button5, { disabled: !intentPayload, variant: "contained", onClick: onBuildLocal, children: "Build" })
|
|
1888
|
+
] });
|
|
1889
|
+
};
|
|
1895
1890
|
|
|
1896
1891
|
// src/components/payload/builder/transfer/Form.tsx
|
|
1897
1892
|
import { Button as Button6, FormControl as FormControl7 } from "@mui/material";
|
|
1898
1893
|
import { isAddress as isAddress3 } from "@xylabs/sdk-js";
|
|
1899
1894
|
import { TransferSchema } from "@xyo-network/xl1-sdk";
|
|
1900
|
-
import
|
|
1895
|
+
import { useMemo as useMemo10, useState as useState17 } from "react";
|
|
1901
1896
|
|
|
1902
1897
|
// src/components/payload/builder/transfer/builder/SingleFlexbox.tsx
|
|
1903
1898
|
import { RemoveCircle } from "@mui/icons-material";
|
|
1904
|
-
import {
|
|
1899
|
+
import {
|
|
1900
|
+
FormControl as FormControl6,
|
|
1901
|
+
Icon as Icon3,
|
|
1902
|
+
IconButton as IconButton5
|
|
1903
|
+
} from "@mui/material";
|
|
1905
1904
|
import { FlexRow as FlexRow7 } from "@xylabs/react-flexbox";
|
|
1906
|
-
import {
|
|
1905
|
+
import {
|
|
1906
|
+
isAddress as isAddress2,
|
|
1907
|
+
isDefinedNotNull,
|
|
1908
|
+
toHex as toHex3
|
|
1909
|
+
} from "@xylabs/sdk-js";
|
|
1907
1910
|
import { BigIntInput } from "@xyo-network/react-shared";
|
|
1908
|
-
import
|
|
1909
|
-
|
|
1911
|
+
import { useEffect as useEffect2, useState as useState16 } from "react";
|
|
1912
|
+
import { jsx as jsx42, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
1913
|
+
var SingleTransferBuilderFlexbox = ({
|
|
1914
|
+
onTransferUpdated,
|
|
1915
|
+
onRemoveTransfer,
|
|
1916
|
+
singleTransfer,
|
|
1917
|
+
...props
|
|
1918
|
+
}) => {
|
|
1910
1919
|
const [toAddress3, setToAddress] = useState16();
|
|
1911
1920
|
const [amount, setAmount] = useState16();
|
|
1912
1921
|
useEffect2(() => {
|
|
@@ -1916,46 +1925,27 @@ var SingleTransferBuilderFlexbox = /* @__PURE__ */ __name(({ onTransferUpdated,
|
|
|
1916
1925
|
to: toAddress3
|
|
1917
1926
|
} : void 0;
|
|
1918
1927
|
if (transferAmount) onTransferUpdated?.(transferAmount);
|
|
1919
|
-
}, [
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
return /* @__PURE__ */ React43.createElement(FlexRow7, {
|
|
1926
|
-
...props,
|
|
1927
|
-
sx: [
|
|
1928
|
-
{
|
|
1928
|
+
}, [amount, onTransferUpdated, singleTransfer, toAddress3]);
|
|
1929
|
+
return /* @__PURE__ */ jsxs30(
|
|
1930
|
+
FlexRow7,
|
|
1931
|
+
{
|
|
1932
|
+
...props,
|
|
1933
|
+
sx: [{
|
|
1929
1934
|
alignItems: "start",
|
|
1930
1935
|
gap: 1
|
|
1931
|
-
},
|
|
1932
|
-
|
|
1933
|
-
|
|
1936
|
+
}, ...Array.isArray(props.sx) ? props.sx : [props.sx]],
|
|
1937
|
+
children: [
|
|
1938
|
+
/* @__PURE__ */ jsx42(FormControl6, { fullWidth: true, children: /* @__PURE__ */ jsx42(XyoAddressTextField, { label: "To", name: "to", onAddressChanged: setToAddress, required: true, size: "small" }) }),
|
|
1939
|
+
/* @__PURE__ */ jsx42(FormControl6, { fullWidth: true, children: /* @__PURE__ */ jsx42(BigIntInput.TextField, { label: "Amount", name: "amount", onChangeFixedPoint: setAmount, required: true, size: "small" }) }),
|
|
1940
|
+
/* @__PURE__ */ jsx42(IconButton5, { onClick: () => onRemoveTransfer?.(singleTransfer.transferId), children: /* @__PURE__ */ jsx42(Icon3, { children: /* @__PURE__ */ jsx42(RemoveCircle, {}) }) })
|
|
1934
1941
|
]
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
}, /* @__PURE__ */ React43.createElement(XyoAddressTextField, {
|
|
1939
|
-
label: "To",
|
|
1940
|
-
name: "to",
|
|
1941
|
-
onAddressChanged: setToAddress,
|
|
1942
|
-
required: true,
|
|
1943
|
-
size: "small"
|
|
1944
|
-
})), /* @__PURE__ */ React43.createElement(FormControl6, {
|
|
1945
|
-
fullWidth: true
|
|
1946
|
-
}, /* @__PURE__ */ React43.createElement(BigIntInput.TextField, {
|
|
1947
|
-
label: "Amount",
|
|
1948
|
-
name: "amount",
|
|
1949
|
-
onChangeFixedPoint: setAmount,
|
|
1950
|
-
required: true,
|
|
1951
|
-
size: "small"
|
|
1952
|
-
})), /* @__PURE__ */ React43.createElement(IconButton5, {
|
|
1953
|
-
onClick: /* @__PURE__ */ __name(() => onRemoveTransfer?.(singleTransfer.transferId), "onClick")
|
|
1954
|
-
}, /* @__PURE__ */ React43.createElement(Icon3, null, /* @__PURE__ */ React43.createElement(RemoveCircle, null))));
|
|
1955
|
-
}, "SingleTransferBuilderFlexbox");
|
|
1942
|
+
}
|
|
1943
|
+
);
|
|
1944
|
+
};
|
|
1956
1945
|
|
|
1957
1946
|
// src/components/payload/builder/transfer/Form.tsx
|
|
1958
|
-
|
|
1947
|
+
import { Fragment as Fragment8, jsx as jsx43, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
1948
|
+
var TransferBuilderForm = ({ onBuild }) => {
|
|
1959
1949
|
const [fromAddress, setFromAddress] = useState17();
|
|
1960
1950
|
const [transfers, setTransfers] = useState17([]);
|
|
1961
1951
|
const [epoch] = useState17(() => Date.now());
|
|
@@ -1972,80 +1962,64 @@ var TransferBuilderForm = /* @__PURE__ */ __name(({ onBuild }) => {
|
|
|
1972
1962
|
epoch
|
|
1973
1963
|
};
|
|
1974
1964
|
}
|
|
1975
|
-
}, [
|
|
1976
|
-
|
|
1977
|
-
transfers,
|
|
1978
|
-
epoch
|
|
1979
|
-
]);
|
|
1980
|
-
const onBuildLocal = /* @__PURE__ */ __name(() => {
|
|
1965
|
+
}, [fromAddress, transfers, epoch]);
|
|
1966
|
+
const onBuildLocal = () => {
|
|
1981
1967
|
if (onBuild && transferPayload) onBuild?.(transferPayload);
|
|
1982
|
-
}
|
|
1983
|
-
const onTransferAdded =
|
|
1968
|
+
};
|
|
1969
|
+
const onTransferAdded = () => {
|
|
1984
1970
|
const transferAmount = {
|
|
1985
1971
|
amount: "",
|
|
1986
1972
|
transferId: Date.now(),
|
|
1987
1973
|
to: ""
|
|
1988
1974
|
};
|
|
1989
|
-
setTransfers((prev) => [
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
]);
|
|
1993
|
-
}, "onTransferAdded");
|
|
1994
|
-
const onTransferRemoved = /* @__PURE__ */ __name((transferId) => {
|
|
1975
|
+
setTransfers((prev) => [...prev, transferAmount]);
|
|
1976
|
+
};
|
|
1977
|
+
const onTransferRemoved = (transferId) => {
|
|
1995
1978
|
setTransfers((prev) => prev.filter((transfer) => transfer.transferId !== transferId));
|
|
1996
|
-
}
|
|
1997
|
-
const onTransferUpdated =
|
|
1979
|
+
};
|
|
1980
|
+
const onTransferUpdated = (singleTransfer) => {
|
|
1998
1981
|
setTransfers((prev) => prev.map((transfer) => {
|
|
1999
1982
|
if (transfer.transferId === singleTransfer.transferId) {
|
|
2000
1983
|
return singleTransfer;
|
|
2001
1984
|
}
|
|
2002
1985
|
return transfer;
|
|
2003
1986
|
}));
|
|
2004
|
-
}
|
|
2005
|
-
return /* @__PURE__ */
|
|
2006
|
-
fullWidth: true
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
singleTransfer: transfer,
|
|
2022
|
-
sx: {
|
|
2023
|
-
width: "100%"
|
|
2024
|
-
}
|
|
2025
|
-
})), /* @__PURE__ */ React44.createElement(Button6, {
|
|
2026
|
-
disabled: !transferPayload,
|
|
2027
|
-
variant: "contained",
|
|
2028
|
-
onClick: onBuildLocal
|
|
2029
|
-
}, "Build"));
|
|
2030
|
-
}, "TransferBuilderForm");
|
|
1987
|
+
};
|
|
1988
|
+
return /* @__PURE__ */ jsxs31(Fragment8, { children: [
|
|
1989
|
+
/* @__PURE__ */ jsx43(FormControl7, { fullWidth: true, children: /* @__PURE__ */ jsx43(XyoAddressTextField, { label: "From", name: "from", onAddressChanged: setFromAddress, required: true, size: "small" }) }),
|
|
1990
|
+
/* @__PURE__ */ jsx43(Button6, { onClick: onTransferAdded, size: "small", variant: "contained", children: "Add Transfer" }),
|
|
1991
|
+
transfers.map((transfer) => /* @__PURE__ */ jsx43(
|
|
1992
|
+
SingleTransferBuilderFlexbox,
|
|
1993
|
+
{
|
|
1994
|
+
onTransferUpdated,
|
|
1995
|
+
onRemoveTransfer: onTransferRemoved,
|
|
1996
|
+
singleTransfer: transfer,
|
|
1997
|
+
sx: { width: "100%" }
|
|
1998
|
+
},
|
|
1999
|
+
transfer.transferId
|
|
2000
|
+
)),
|
|
2001
|
+
/* @__PURE__ */ jsx43(Button6, { disabled: !transferPayload, variant: "contained", onClick: onBuildLocal, children: "Build" })
|
|
2002
|
+
] });
|
|
2003
|
+
};
|
|
2031
2004
|
|
|
2032
2005
|
// src/components/payload/builder/transfer/Flexbox.tsx
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2006
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
2007
|
+
var TransferBuilderFlexbox = ({ onBuild, ...props }) => /* @__PURE__ */ jsx44(
|
|
2008
|
+
PayloadBuilderFlexbox,
|
|
2009
|
+
{
|
|
2010
|
+
BuilderComponent: TransferBuilderForm,
|
|
2011
|
+
onBuild,
|
|
2012
|
+
...props,
|
|
2013
|
+
sx: { gap: 4, alignItems: "start" }
|
|
2040
2014
|
}
|
|
2041
|
-
|
|
2015
|
+
);
|
|
2042
2016
|
|
|
2043
2017
|
// src/components/rate/flexbox/FlexBox.tsx
|
|
2044
2018
|
import { FlexCol as FlexCol7 } from "@xylabs/react-flexbox";
|
|
2045
2019
|
import { isDefined as isDefined11 } from "@xylabs/sdk-js";
|
|
2046
2020
|
|
|
2047
2021
|
// src/helpers/rate/rateUnitToLabel.ts
|
|
2048
|
-
var rateUnitToLabel =
|
|
2022
|
+
var rateUnitToLabel = (rateUnit) => {
|
|
2049
2023
|
switch (rateUnit) {
|
|
2050
2024
|
case "millis": {
|
|
2051
2025
|
return "b/ms";
|
|
@@ -2069,7 +2043,7 @@ var rateUnitToLabel = /* @__PURE__ */ __name((rateUnit) => {
|
|
|
2069
2043
|
return rateUnit;
|
|
2070
2044
|
}
|
|
2071
2045
|
}
|
|
2072
|
-
}
|
|
2046
|
+
};
|
|
2073
2047
|
|
|
2074
2048
|
// src/components/rate/SpanTypography.tsx
|
|
2075
2049
|
import { ViewAgendaOutlined } from "@mui/icons-material";
|
|
@@ -2079,7 +2053,16 @@ import { Tooltip as Tooltip13 } from "@mui/material";
|
|
|
2079
2053
|
import { Icon as Icon4, Typography as Typography10 } from "@mui/material";
|
|
2080
2054
|
import { isUndefined as isUndefined2 } from "@xylabs/sdk-js";
|
|
2081
2055
|
import { useEffect as useEffect3, useState as useState18 } from "react";
|
|
2082
|
-
|
|
2056
|
+
import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2057
|
+
var MetricTypography = ({
|
|
2058
|
+
animationDurationMs = 1e3,
|
|
2059
|
+
disableAnimation,
|
|
2060
|
+
icon,
|
|
2061
|
+
label,
|
|
2062
|
+
metric,
|
|
2063
|
+
sx,
|
|
2064
|
+
...props
|
|
2065
|
+
}) => {
|
|
2083
2066
|
const [displayValue, setDisplayValue] = useState18(0);
|
|
2084
2067
|
if (isUndefined2(metric) && displayValue !== 0) {
|
|
2085
2068
|
setDisplayValue(0);
|
|
@@ -2090,7 +2073,7 @@ var MetricTypography = /* @__PURE__ */ __name(({ animationDurationMs = 1e3, disa
|
|
|
2090
2073
|
const startTime = Date.now();
|
|
2091
2074
|
const startValue = 0;
|
|
2092
2075
|
const endValue = metric;
|
|
2093
|
-
const animate =
|
|
2076
|
+
const animate = () => {
|
|
2094
2077
|
const now = Date.now();
|
|
2095
2078
|
const elapsed = now - startTime;
|
|
2096
2079
|
const progress = Math.min(elapsed / duration, 1);
|
|
@@ -2100,187 +2083,222 @@ var MetricTypography = /* @__PURE__ */ __name(({ animationDurationMs = 1e3, disa
|
|
|
2100
2083
|
if (progress < 1) {
|
|
2101
2084
|
requestAnimationFrame(animate);
|
|
2102
2085
|
}
|
|
2103
|
-
}
|
|
2086
|
+
};
|
|
2104
2087
|
globalThis.requestAnimationFrame(animate);
|
|
2105
|
-
}, [
|
|
2106
|
-
animationDurationMs,
|
|
2107
|
-
metric
|
|
2108
|
-
]);
|
|
2088
|
+
}, [animationDurationMs, metric]);
|
|
2109
2089
|
const isWholeNumber = metric !== void 0 && Number.isInteger(metric);
|
|
2110
2090
|
const formattedValue = disableAnimation ? metric : displayValue.toLocaleString(navigator.language, {
|
|
2111
2091
|
minimumFractionDigits: 0,
|
|
2112
2092
|
maximumFractionDigits: isWholeNumber ? 0 : 2
|
|
2113
2093
|
});
|
|
2114
|
-
return /* @__PURE__ */
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2094
|
+
return /* @__PURE__ */ jsxs32(
|
|
2095
|
+
Typography10,
|
|
2096
|
+
{
|
|
2097
|
+
variant: "h4",
|
|
2098
|
+
...props,
|
|
2099
|
+
sx: [{
|
|
2119
2100
|
mb: 1,
|
|
2120
2101
|
display: "flex",
|
|
2121
2102
|
alignItems: "end",
|
|
2122
2103
|
gap: 0.5
|
|
2123
|
-
},
|
|
2124
|
-
|
|
2125
|
-
sx
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2104
|
+
}, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
|
|
2105
|
+
children: [
|
|
2106
|
+
/* @__PURE__ */ jsx45(Icon4, { sx: { fontSize: "large" }, children: icon }),
|
|
2107
|
+
formattedValue,
|
|
2108
|
+
" ",
|
|
2109
|
+
/* @__PURE__ */ jsx45(
|
|
2110
|
+
Typography10,
|
|
2111
|
+
{
|
|
2112
|
+
component: "span",
|
|
2113
|
+
variant: "caption",
|
|
2114
|
+
sx: { lineHeight: 1.86 },
|
|
2115
|
+
children: label
|
|
2116
|
+
}
|
|
2117
|
+
)
|
|
2118
|
+
]
|
|
2137
2119
|
}
|
|
2138
|
-
|
|
2139
|
-
}
|
|
2120
|
+
);
|
|
2121
|
+
};
|
|
2140
2122
|
|
|
2141
2123
|
// src/components/rate/SpanTypography.tsx
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
...props
|
|
2152
|
-
}));
|
|
2153
|
-
}, "BlockRateSpanTypography");
|
|
2124
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
2125
|
+
var BlockRateSpanTypography = ({
|
|
2126
|
+
range,
|
|
2127
|
+
span,
|
|
2128
|
+
sx,
|
|
2129
|
+
...props
|
|
2130
|
+
}) => {
|
|
2131
|
+
return /* @__PURE__ */ jsx46(Tooltip13, { title: `Block Range: ${range?.join(" - ")}`, children: /* @__PURE__ */ jsx46(MetricTypography, { icon: /* @__PURE__ */ jsx46(ViewAgendaOutlined, { fontSize: "large" }), metric: span, label: "blocks", ...props }) });
|
|
2132
|
+
};
|
|
2154
2133
|
|
|
2155
2134
|
// src/components/rate/SpeedTypography.tsx
|
|
2156
2135
|
import { SpeedOutlined } from "@mui/icons-material";
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
});
|
|
2166
|
-
}, "BlockRateSpeedTypography");
|
|
2136
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
2137
|
+
var BlockRateSpeedTypography = ({
|
|
2138
|
+
rate,
|
|
2139
|
+
rateUnitLabel,
|
|
2140
|
+
...props
|
|
2141
|
+
}) => {
|
|
2142
|
+
return /* @__PURE__ */ jsx47(MetricTypography, { icon: /* @__PURE__ */ jsx47(SpeedOutlined, { fontSize: "large" }), metric: rate, label: rateUnitLabel, ...props });
|
|
2143
|
+
};
|
|
2167
2144
|
|
|
2168
2145
|
// src/components/rate/TimeTypography.tsx
|
|
2169
2146
|
import { TimelapseOutlined } from "@mui/icons-material";
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
}, "BlockRateTimeTypography");
|
|
2147
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
2148
|
+
var BlockRateTimeTypography = ({
|
|
2149
|
+
timeUnit,
|
|
2150
|
+
timeDifference,
|
|
2151
|
+
sx,
|
|
2152
|
+
...props
|
|
2153
|
+
}) => {
|
|
2154
|
+
return /* @__PURE__ */ jsx48(MetricTypography, { icon: /* @__PURE__ */ jsx48(TimelapseOutlined, { fontSize: "large" }), metric: timeDifference, label: timeUnit, ...props });
|
|
2155
|
+
};
|
|
2180
2156
|
|
|
2181
2157
|
// src/components/rate/flexbox/FlexBox.tsx
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
{
|
|
2189
|
-
alignItems: "start"
|
|
2190
|
-
},
|
|
2191
|
-
...Array.isArray(flexBoxProps.sx) ? flexBoxProps.sx : [
|
|
2192
|
-
flexBoxProps.sx
|
|
2193
|
-
]
|
|
2194
|
-
]
|
|
2195
|
-
}, /* @__PURE__ */ React.createElement(BlockRateSpeedTypography, {
|
|
2196
|
-
rate,
|
|
2197
|
-
rateUnitLabel
|
|
2198
|
-
}), /* @__PURE__ */ React.createElement(BlockRateSpanTypography, {
|
|
2158
|
+
import { jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2159
|
+
var BlockRateFlexBox = ({
|
|
2160
|
+
blockRate,
|
|
2161
|
+
...flexBoxProps
|
|
2162
|
+
}) => {
|
|
2163
|
+
const {
|
|
2199
2164
|
range,
|
|
2200
|
-
span
|
|
2201
|
-
|
|
2165
|
+
span,
|
|
2166
|
+
rate,
|
|
2202
2167
|
timeUnit,
|
|
2203
2168
|
timeDifference
|
|
2204
|
-
}
|
|
2205
|
-
|
|
2169
|
+
} = blockRate ?? {};
|
|
2170
|
+
const rateUnitLabel = isDefined11(timeUnit) ? rateUnitToLabel(timeUnit) : "";
|
|
2171
|
+
return /* @__PURE__ */ jsxs33(
|
|
2172
|
+
FlexCol7,
|
|
2173
|
+
{
|
|
2174
|
+
...flexBoxProps,
|
|
2175
|
+
sx: [{ alignItems: "start" }, ...Array.isArray(flexBoxProps.sx) ? flexBoxProps.sx : [flexBoxProps.sx]],
|
|
2176
|
+
children: [
|
|
2177
|
+
/* @__PURE__ */ jsx49(BlockRateSpeedTypography, { rate, rateUnitLabel }),
|
|
2178
|
+
/* @__PURE__ */ jsx49(BlockRateSpanTypography, { range, span }),
|
|
2179
|
+
/* @__PURE__ */ jsx49(BlockRateTimeTypography, { timeUnit, timeDifference })
|
|
2180
|
+
]
|
|
2181
|
+
}
|
|
2182
|
+
);
|
|
2183
|
+
};
|
|
2206
2184
|
|
|
2207
2185
|
// src/components/rate/gauge/Container.tsx
|
|
2208
|
-
import {
|
|
2186
|
+
import {
|
|
2187
|
+
GaugeContainer,
|
|
2188
|
+
GaugeReferenceArc,
|
|
2189
|
+
GaugeValueArc
|
|
2190
|
+
} from "@mui/x-charts";
|
|
2209
2191
|
|
|
2210
2192
|
// src/components/rate/gauge/helpers/blockRateConversions.ts
|
|
2211
2193
|
import { isDefined as isDefined12, isUndefined as isUndefined3 } from "@xylabs/sdk-js";
|
|
2212
|
-
var toBlocksPerMillisecond =
|
|
2194
|
+
var toBlocksPerMillisecond = (rateValue, unit) => {
|
|
2213
2195
|
if (isUndefined3(unit)) return rateValue;
|
|
2214
2196
|
const conversions = {
|
|
2215
2197
|
millis: 1,
|
|
2198
|
+
// already in milliseconds
|
|
2216
2199
|
seconds: 1e3,
|
|
2200
|
+
// 1 second = 1000 milliseconds
|
|
2217
2201
|
minutes: 6e4,
|
|
2202
|
+
// 1 minute = 60000 milliseconds
|
|
2218
2203
|
hours: 36e5,
|
|
2204
|
+
// 1 hour = 3600000 milliseconds
|
|
2219
2205
|
days: 864e5,
|
|
2206
|
+
// 1 day = 86400000 milliseconds
|
|
2220
2207
|
weeks: 6048e5
|
|
2208
|
+
// 1 week = 604800000 milliseconds
|
|
2221
2209
|
};
|
|
2222
2210
|
return rateValue * (isDefined12(conversions[unit]) ? conversions[unit] : 1);
|
|
2223
|
-
}
|
|
2224
|
-
var toBlocksPerSecond =
|
|
2211
|
+
};
|
|
2212
|
+
var toBlocksPerSecond = (rateValue, unit) => {
|
|
2225
2213
|
if (isUndefined3(unit)) return rateValue;
|
|
2226
2214
|
const conversions = {
|
|
2227
2215
|
millis: 1e-3,
|
|
2216
|
+
// 1 millisecond = 0.001 seconds
|
|
2228
2217
|
seconds: 1,
|
|
2218
|
+
// already in seconds
|
|
2229
2219
|
minutes: 60,
|
|
2220
|
+
// 1 minute = 60 seconds
|
|
2230
2221
|
hours: 3600,
|
|
2222
|
+
// 1 hour = 3600 seconds
|
|
2231
2223
|
days: 86400,
|
|
2224
|
+
// 1 day = 86400 seconds
|
|
2232
2225
|
weeks: 604800
|
|
2226
|
+
// 1 week = 604800 seconds
|
|
2233
2227
|
};
|
|
2234
2228
|
return rateValue * (isDefined12(conversions[unit]) ? conversions[unit] : 1);
|
|
2235
|
-
}
|
|
2236
|
-
var toBlocksPerMinute =
|
|
2229
|
+
};
|
|
2230
|
+
var toBlocksPerMinute = (rateValue, unit) => {
|
|
2237
2231
|
if (isUndefined3(unit)) return rateValue;
|
|
2238
2232
|
const conversions = {
|
|
2239
2233
|
millis: 6e4,
|
|
2234
|
+
// 1 minute = 60000 milliseconds
|
|
2240
2235
|
seconds: 60,
|
|
2236
|
+
// 1 minute = 60 seconds
|
|
2241
2237
|
minutes: 1,
|
|
2238
|
+
// already in minutes
|
|
2242
2239
|
hours: 1 / 60,
|
|
2240
|
+
// 1 hour = 60 minutes
|
|
2243
2241
|
days: 1 / 1440,
|
|
2242
|
+
// 1 day = 1440 minutes
|
|
2244
2243
|
weeks: 1 / 10080
|
|
2244
|
+
// 1 week = 10080 minutes
|
|
2245
2245
|
};
|
|
2246
2246
|
return rateValue * (isDefined12(conversions[unit]) ? conversions[unit] : 1);
|
|
2247
|
-
}
|
|
2248
|
-
var toBlocksPerHour =
|
|
2247
|
+
};
|
|
2248
|
+
var toBlocksPerHour = (rateValue, unit) => {
|
|
2249
2249
|
if (isUndefined3(unit)) return rateValue;
|
|
2250
2250
|
const conversions = {
|
|
2251
2251
|
millis: 36e5,
|
|
2252
|
+
// 1 hour = 3600000 milliseconds
|
|
2252
2253
|
seconds: 3600,
|
|
2254
|
+
// 1 hour = 3600 seconds
|
|
2253
2255
|
minutes: 60,
|
|
2256
|
+
// 1 hour = 60 minutes
|
|
2254
2257
|
hours: 1,
|
|
2258
|
+
// already in hours
|
|
2255
2259
|
days: 1 / 24,
|
|
2260
|
+
// 1 day = 24 hours
|
|
2256
2261
|
weeks: 1 / 168
|
|
2262
|
+
// 1 week = 168 hours
|
|
2257
2263
|
};
|
|
2258
2264
|
return rateValue * (isDefined12(conversions[unit]) ? conversions[unit] : 1);
|
|
2259
|
-
}
|
|
2260
|
-
var toBlocksPerDay =
|
|
2265
|
+
};
|
|
2266
|
+
var toBlocksPerDay = (rateValue, unit) => {
|
|
2261
2267
|
if (isUndefined3(unit)) return rateValue;
|
|
2262
2268
|
const conversions = {
|
|
2263
2269
|
millis: 864e5,
|
|
2270
|
+
// 1 day = 86400000 milliseconds
|
|
2264
2271
|
seconds: 86400,
|
|
2272
|
+
// 1 day = 86400 seconds
|
|
2265
2273
|
minutes: 1440,
|
|
2274
|
+
// 1 day = 1440 minutes
|
|
2266
2275
|
hours: 24,
|
|
2276
|
+
// 1 day = 24 hours
|
|
2267
2277
|
days: 1,
|
|
2278
|
+
// already in days
|
|
2268
2279
|
weeks: 1 / 7
|
|
2280
|
+
// 1 week = 7 days
|
|
2269
2281
|
};
|
|
2270
2282
|
return rateValue * (isDefined12(conversions[unit]) ? conversions[unit] : 1);
|
|
2271
|
-
}
|
|
2272
|
-
var toBlocksPerWeek =
|
|
2283
|
+
};
|
|
2284
|
+
var toBlocksPerWeek = (rateValue, unit) => {
|
|
2273
2285
|
if (isUndefined3(unit)) return rateValue;
|
|
2274
2286
|
const conversions = {
|
|
2275
2287
|
millis: 6048e5,
|
|
2288
|
+
// 1 week = 604800000 milliseconds
|
|
2276
2289
|
seconds: 604800,
|
|
2290
|
+
// 1 week = 604800 seconds
|
|
2277
2291
|
minutes: 10080,
|
|
2292
|
+
// 1 week = 10080 minutes
|
|
2278
2293
|
hours: 168,
|
|
2294
|
+
// 1 week = 168 hours
|
|
2279
2295
|
days: 7,
|
|
2296
|
+
// 1 week = 7 days
|
|
2280
2297
|
weeks: 1
|
|
2298
|
+
// already in weeks
|
|
2281
2299
|
};
|
|
2282
2300
|
return rateValue * (isDefined12(conversions[unit]) ? conversions[unit] : 1);
|
|
2283
|
-
}
|
|
2301
|
+
};
|
|
2284
2302
|
var BlockRateConversions = {
|
|
2285
2303
|
millis: toBlocksPerMillisecond,
|
|
2286
2304
|
seconds: toBlocksPerSecond,
|
|
@@ -2295,10 +2313,16 @@ import { useTheme as useTheme2 } from "@mui/material";
|
|
|
2295
2313
|
import { useGaugeState } from "@mui/x-charts/Gauge";
|
|
2296
2314
|
import { isDefined as isDefined13 } from "@xylabs/sdk-js";
|
|
2297
2315
|
import { useEffect as useEffect4, useState as useState19 } from "react";
|
|
2298
|
-
|
|
2316
|
+
import { jsx as jsx50, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
2317
|
+
var GaugePointer = ({ pointerColor, startAngle = 0 }) => {
|
|
2299
2318
|
const theme = useTheme2();
|
|
2300
2319
|
const strokeColor = isDefined13(pointerColor) ? pointerColor : theme.palette.error.dark;
|
|
2301
|
-
const {
|
|
2320
|
+
const {
|
|
2321
|
+
valueAngle,
|
|
2322
|
+
outerRadius,
|
|
2323
|
+
cx,
|
|
2324
|
+
cy
|
|
2325
|
+
} = useGaugeState();
|
|
2302
2326
|
const [currentAngle, setCurrentAngle] = useState19(startAngle);
|
|
2303
2327
|
useEffect4(() => {
|
|
2304
2328
|
if (valueAngle === null) return;
|
|
@@ -2306,7 +2330,7 @@ var GaugePointer = /* @__PURE__ */ __name(({ pointerColor, startAngle = 0 }) =>
|
|
|
2306
2330
|
const startTime = Date.now();
|
|
2307
2331
|
const animationStartAngle = currentAngle;
|
|
2308
2332
|
const endAngle = valueAngle;
|
|
2309
|
-
const animate =
|
|
2333
|
+
const animate = () => {
|
|
2310
2334
|
const now = Date.now();
|
|
2311
2335
|
const elapsed = now - startTime;
|
|
2312
2336
|
const progress = Math.min(elapsed / duration, 1);
|
|
@@ -2316,12 +2340,9 @@ var GaugePointer = /* @__PURE__ */ __name(({ pointerColor, startAngle = 0 }) =>
|
|
|
2316
2340
|
if (progress < 1) {
|
|
2317
2341
|
globalThis.requestAnimationFrame(animate);
|
|
2318
2342
|
}
|
|
2319
|
-
}
|
|
2343
|
+
};
|
|
2320
2344
|
globalThis.requestAnimationFrame(animate);
|
|
2321
|
-
}, [
|
|
2322
|
-
currentAngle,
|
|
2323
|
-
valueAngle
|
|
2324
|
-
]);
|
|
2345
|
+
}, [currentAngle, valueAngle]);
|
|
2325
2346
|
if (valueAngle === null) {
|
|
2326
2347
|
return null;
|
|
2327
2348
|
}
|
|
@@ -2329,27 +2350,41 @@ var GaugePointer = /* @__PURE__ */ __name(({ pointerColor, startAngle = 0 }) =>
|
|
|
2329
2350
|
x: cx + outerRadius * Math.sin(currentAngle),
|
|
2330
2351
|
y: cy - outerRadius * Math.cos(currentAngle)
|
|
2331
2352
|
};
|
|
2332
|
-
return /* @__PURE__ */
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
}, "GaugePointer");
|
|
2353
|
+
return /* @__PURE__ */ jsxs34("g", { className: "GaugePointer", children: [
|
|
2354
|
+
/* @__PURE__ */ jsx50("circle", { cx, cy, r: 5, fill: strokeColor }),
|
|
2355
|
+
/* @__PURE__ */ jsx50(
|
|
2356
|
+
"path",
|
|
2357
|
+
{
|
|
2358
|
+
d: `M ${cx} ${cy} L ${target.x} ${target.y}`,
|
|
2359
|
+
stroke: strokeColor,
|
|
2360
|
+
strokeWidth: 3
|
|
2361
|
+
}
|
|
2362
|
+
)
|
|
2363
|
+
] });
|
|
2364
|
+
};
|
|
2345
2365
|
|
|
2346
2366
|
// src/components/rate/gauge/Ticks.tsx
|
|
2347
2367
|
import { useTheme as useTheme3 } from "@mui/material";
|
|
2348
2368
|
import { useGaugeState as useGaugeState2 } from "@mui/x-charts/Gauge";
|
|
2349
2369
|
import { isDefined as isDefined14 } from "@xylabs/sdk-js";
|
|
2350
|
-
|
|
2370
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
2371
|
+
var GaugeTicks = ({
|
|
2372
|
+
numTicks = 11,
|
|
2373
|
+
minorTicksPerMajor = 4,
|
|
2374
|
+
majorTickLength = 0.2,
|
|
2375
|
+
minorTickLength = 0.15,
|
|
2376
|
+
majorTickWidth = 2,
|
|
2377
|
+
minorTickWidth = 1,
|
|
2378
|
+
tickColor
|
|
2379
|
+
}) => {
|
|
2351
2380
|
const theme = useTheme3();
|
|
2352
|
-
const {
|
|
2381
|
+
const {
|
|
2382
|
+
startAngle,
|
|
2383
|
+
endAngle,
|
|
2384
|
+
outerRadius,
|
|
2385
|
+
cx,
|
|
2386
|
+
cy
|
|
2387
|
+
} = useGaugeState2();
|
|
2353
2388
|
const color = isDefined14(tickColor) ? tickColor : theme.vars.palette.text.secondary;
|
|
2354
2389
|
if (startAngle === null || endAngle === null) {
|
|
2355
2390
|
return null;
|
|
@@ -2365,16 +2400,21 @@ var GaugeTicks = /* @__PURE__ */ __name(({ numTicks = 11, minorTicksPerMajor = 4
|
|
|
2365
2400
|
const y1 = cy - tickStart * Math.cos(angle);
|
|
2366
2401
|
const x2 = cx + innerRadius * Math.sin(angle);
|
|
2367
2402
|
const y2 = cy - innerRadius * Math.cos(angle);
|
|
2368
|
-
ticks.push(
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2403
|
+
ticks.push(
|
|
2404
|
+
/* @__PURE__ */ jsx51(
|
|
2405
|
+
"line",
|
|
2406
|
+
{
|
|
2407
|
+
className: `GaugeTick-major-${i}`,
|
|
2408
|
+
x1,
|
|
2409
|
+
y1,
|
|
2410
|
+
x2,
|
|
2411
|
+
y2,
|
|
2412
|
+
stroke: color,
|
|
2413
|
+
strokeWidth: majorTickWidth
|
|
2414
|
+
},
|
|
2415
|
+
`major-${i}`
|
|
2416
|
+
)
|
|
2417
|
+
);
|
|
2378
2418
|
if (i < numTicks - 1) {
|
|
2379
2419
|
const angleStep = totalAngle / (numTicks - 1) / (minorTicksPerMajor + 1);
|
|
2380
2420
|
for (let j = 1; j <= minorTicksPerMajor; j++) {
|
|
@@ -2386,61 +2426,82 @@ var GaugeTicks = /* @__PURE__ */ __name(({ numTicks = 11, minorTicksPerMajor = 4
|
|
|
2386
2426
|
const my1 = cy - minorTickStart * Math.cos(minorAngle);
|
|
2387
2427
|
const mx2 = cx + minorInnerRadius * Math.sin(minorAngle);
|
|
2388
2428
|
const my2 = cy - minorInnerRadius * Math.cos(minorAngle);
|
|
2389
|
-
ticks.push(
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2429
|
+
ticks.push(
|
|
2430
|
+
/* @__PURE__ */ jsx51(
|
|
2431
|
+
"line",
|
|
2432
|
+
{
|
|
2433
|
+
x1: mx1,
|
|
2434
|
+
y1: my1,
|
|
2435
|
+
x2: mx2,
|
|
2436
|
+
y2: my2,
|
|
2437
|
+
stroke: color,
|
|
2438
|
+
strokeWidth: minorTickWidth
|
|
2439
|
+
},
|
|
2440
|
+
`minor-${i}-${j}`
|
|
2441
|
+
)
|
|
2442
|
+
);
|
|
2398
2443
|
}
|
|
2399
2444
|
}
|
|
2400
2445
|
}
|
|
2401
|
-
return /* @__PURE__ */
|
|
2402
|
-
|
|
2403
|
-
}, ticks);
|
|
2404
|
-
}, "GaugeTicks");
|
|
2446
|
+
return /* @__PURE__ */ jsx51("g", { className: "GaugeTicks", children: ticks });
|
|
2447
|
+
};
|
|
2405
2448
|
|
|
2406
2449
|
// src/components/rate/gauge/Container.tsx
|
|
2407
|
-
|
|
2450
|
+
import { jsx as jsx52, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
2451
|
+
var BlockRateSpeedGaugeContainer = ({
|
|
2452
|
+
blockRate,
|
|
2453
|
+
children,
|
|
2454
|
+
gaugeConfig,
|
|
2455
|
+
startAngle = -110,
|
|
2456
|
+
endAngle = 110,
|
|
2457
|
+
width = 200,
|
|
2458
|
+
height = 150,
|
|
2459
|
+
...props
|
|
2460
|
+
}) => {
|
|
2408
2461
|
const { rate, timeUnit } = blockRate || {};
|
|
2409
|
-
const {
|
|
2462
|
+
const {
|
|
2463
|
+
targetBlockRate = 5,
|
|
2464
|
+
targetBlockRateUnit = "minutes",
|
|
2465
|
+
targetPosition = 75,
|
|
2466
|
+
showTicks = true
|
|
2467
|
+
} = gaugeConfig || {};
|
|
2410
2468
|
const converter = BlockRateConversions[targetBlockRateUnit];
|
|
2411
2469
|
const maxGaugeValue = endAngle;
|
|
2412
2470
|
const blocksPerMinute = rate === void 0 ? 0 : converter(rate, timeUnit);
|
|
2413
2471
|
const normalizedValue = Math.min(blocksPerMinute / targetBlockRate * targetPosition, maxGaugeValue);
|
|
2414
|
-
return /* @__PURE__ */
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
height
|
|
2472
|
+
return /* @__PURE__ */ jsxs35(
|
|
2473
|
+
GaugeContainer,
|
|
2474
|
+
{
|
|
2475
|
+
startAngle,
|
|
2476
|
+
endAngle,
|
|
2477
|
+
value: normalizedValue,
|
|
2478
|
+
valueMax: endAngle,
|
|
2479
|
+
innerRadius: "95%",
|
|
2480
|
+
outerRadius: "100%",
|
|
2481
|
+
...props,
|
|
2482
|
+
sx: { width, height },
|
|
2483
|
+
children: [
|
|
2484
|
+
showTicks && /* @__PURE__ */ jsx52(GaugeTicks, {}),
|
|
2485
|
+
/* @__PURE__ */ jsx52(GaugeReferenceArc, {}),
|
|
2486
|
+
/* @__PURE__ */ jsx52(GaugeValueArc, {}),
|
|
2487
|
+
/* @__PURE__ */ jsx52(GaugePointer, { startAngle: -2 }),
|
|
2488
|
+
children
|
|
2489
|
+
]
|
|
2425
2490
|
}
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
}), children);
|
|
2429
|
-
}, "BlockRateSpeedGaugeContainer");
|
|
2491
|
+
);
|
|
2492
|
+
};
|
|
2430
2493
|
|
|
2431
2494
|
// src/components/rate/gauge/WithLabel.tsx
|
|
2432
2495
|
import { FlexCol as FlexCol8 } from "@xylabs/react-flexbox";
|
|
2433
2496
|
import { isDefined as isDefined15 } from "@xylabs/sdk-js";
|
|
2434
|
-
|
|
2497
|
+
import { jsx as jsx53, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
2498
|
+
var BlockRateSpeedGaugeWithLabel = ({ blockRate, ...props }) => {
|
|
2435
2499
|
const rateUnitLabel = isDefined15(blockRate?.rate) ? rateUnitToLabel(blockRate?.timeUnit) : "";
|
|
2436
|
-
return /* @__PURE__ */
|
|
2437
|
-
blockRate,
|
|
2438
|
-
|
|
2439
|
-
})
|
|
2440
|
-
|
|
2441
|
-
rateUnitLabel
|
|
2442
|
-
}));
|
|
2443
|
-
}, "BlockRateSpeedGaugeWithLabel");
|
|
2500
|
+
return /* @__PURE__ */ jsxs36(FlexCol8, { children: [
|
|
2501
|
+
/* @__PURE__ */ jsx53(BlockRateSpeedGaugeContainer, { blockRate, ...props }),
|
|
2502
|
+
/* @__PURE__ */ jsx53(BlockRateSpeedTypography, { rate: blockRate?.rate, rateUnitLabel })
|
|
2503
|
+
] });
|
|
2504
|
+
};
|
|
2444
2505
|
|
|
2445
2506
|
// src/stories/ChainArchivistDecorator.tsx
|
|
2446
2507
|
import { CircularProgress } from "@mui/material";
|
|
@@ -2448,44 +2509,33 @@ import { usePromise as usePromise4 } from "@xylabs/react-promise";
|
|
|
2448
2509
|
import { buildRandomBlockChain } from "@xyo-network/react-chain-shared";
|
|
2449
2510
|
import { ArchivistConfigSchema, MemoryArchivist } from "@xyo-network/sdk-js";
|
|
2450
2511
|
import { flattenHydratedBlocks } from "@xyo-network/xl1-sdk";
|
|
2451
|
-
import
|
|
2512
|
+
import { useEffect as useEffect5 } from "react";
|
|
2452
2513
|
|
|
2453
2514
|
// src/lib/getChainId.ts
|
|
2454
2515
|
import { toAddress as toAddress2 } from "@xylabs/sdk-js";
|
|
2455
2516
|
var id = toAddress2("ce080bf3043a40c6c8838c7e813c00ab53df1684");
|
|
2456
|
-
var getChainId =
|
|
2517
|
+
var getChainId = () => {
|
|
2457
2518
|
return id;
|
|
2458
|
-
}
|
|
2519
|
+
};
|
|
2459
2520
|
|
|
2460
2521
|
// src/stories/ChainArchivistDecorator.tsx
|
|
2461
|
-
|
|
2522
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
2523
|
+
var ChainArchivistDecorator = (Story, { args, ...context }) => {
|
|
2462
2524
|
const [randomBlockChain] = usePromise4(async () => await buildRandomBlockChain(), []);
|
|
2463
2525
|
const [blockChainRenderProps, blockChainRenderPropsError] = usePromise4(async () => {
|
|
2464
2526
|
if (randomBlockChain) {
|
|
2465
|
-
const chainArchivist = await MemoryArchivist.create({
|
|
2466
|
-
config: {
|
|
2467
|
-
schema: ArchivistConfigSchema,
|
|
2468
|
-
name: "ChainArchivist"
|
|
2469
|
-
}
|
|
2470
|
-
});
|
|
2527
|
+
const chainArchivist = await MemoryArchivist.create({ config: { schema: ArchivistConfigSchema, name: "ChainArchivist" } });
|
|
2471
2528
|
const flattened = flattenHydratedBlocks(randomBlockChain);
|
|
2472
2529
|
await chainArchivist.insert(flattened);
|
|
2473
2530
|
const chainId = await getChainId();
|
|
2474
|
-
return {
|
|
2475
|
-
chainArchivist,
|
|
2476
|
-
chainId
|
|
2477
|
-
};
|
|
2531
|
+
return { chainArchivist, chainId };
|
|
2478
2532
|
}
|
|
2479
|
-
}, [
|
|
2480
|
-
randomBlockChain
|
|
2481
|
-
]);
|
|
2533
|
+
}, [randomBlockChain]);
|
|
2482
2534
|
useEffect5(() => {
|
|
2483
2535
|
if (blockChainRenderPropsError) {
|
|
2484
2536
|
console.error(blockChainRenderPropsError);
|
|
2485
2537
|
}
|
|
2486
|
-
}, [
|
|
2487
|
-
blockChainRenderPropsError
|
|
2488
|
-
]);
|
|
2538
|
+
}, [blockChainRenderPropsError]);
|
|
2489
2539
|
const props = {
|
|
2490
2540
|
...context,
|
|
2491
2541
|
args: {
|
|
@@ -2497,8 +2547,8 @@ var ChainArchivistDecorator = /* @__PURE__ */ __name((Story, { args, ...context
|
|
|
2497
2547
|
}
|
|
2498
2548
|
}
|
|
2499
2549
|
};
|
|
2500
|
-
return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */
|
|
2501
|
-
}
|
|
2550
|
+
return blockChainRenderProps?.chainArchivist ? /* @__PURE__ */ jsx54(Story, { ...props }) : /* @__PURE__ */ jsx54(CircularProgress, {});
|
|
2551
|
+
};
|
|
2502
2552
|
|
|
2503
2553
|
// src/stories/ChainArchivistDelayedInsertDecorator.tsx
|
|
2504
2554
|
import { CircularProgress as CircularProgress2 } from "@mui/material";
|
|
@@ -2507,21 +2557,17 @@ import { delay } from "@xylabs/sdk-js";
|
|
|
2507
2557
|
import { buildRandomBlockChain as buildRandomBlockChain2 } from "@xyo-network/react-chain-shared";
|
|
2508
2558
|
import { ArchivistConfigSchema as ArchivistConfigSchema2, MemoryArchivist as MemoryArchivist2 } from "@xyo-network/sdk-js";
|
|
2509
2559
|
import { flattenHydratedBlock } from "@xyo-network/xl1-sdk";
|
|
2510
|
-
import
|
|
2560
|
+
import { useEffect as useEffect6, useState as useState20 } from "react";
|
|
2561
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
2511
2562
|
var chainArchivistRef;
|
|
2512
|
-
var ChainArchivistDelayedInsertDecorator =
|
|
2563
|
+
var ChainArchivistDelayedInsertDecorator = (Story, context) => {
|
|
2513
2564
|
const [firstBlock, setFirstBlock] = useState20();
|
|
2514
2565
|
const [randomBlockChain] = usePromise5(async () => await buildRandomBlockChain2(), []);
|
|
2515
2566
|
const [chainArchivist] = usePromise5(async () => {
|
|
2516
2567
|
if (chainArchivistRef) {
|
|
2517
2568
|
return chainArchivistRef;
|
|
2518
2569
|
} else {
|
|
2519
|
-
chainArchivistRef = await MemoryArchivist2.create({
|
|
2520
|
-
config: {
|
|
2521
|
-
schema: ArchivistConfigSchema2,
|
|
2522
|
-
name: "ChainArchivist"
|
|
2523
|
-
}
|
|
2524
|
-
});
|
|
2570
|
+
chainArchivistRef = await MemoryArchivist2.create({ config: { schema: ArchivistConfigSchema2, name: "ChainArchivist" } });
|
|
2525
2571
|
return chainArchivistRef;
|
|
2526
2572
|
}
|
|
2527
2573
|
}, []);
|
|
@@ -2534,26 +2580,16 @@ var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, contex
|
|
|
2534
2580
|
await delay(1e3);
|
|
2535
2581
|
}
|
|
2536
2582
|
}
|
|
2537
|
-
}, [
|
|
2538
|
-
chainArchivist,
|
|
2539
|
-
randomBlockChain
|
|
2540
|
-
]);
|
|
2583
|
+
}, [chainArchivist, randomBlockChain]);
|
|
2541
2584
|
useEffect6(() => {
|
|
2542
2585
|
if (delayedInsertError) {
|
|
2543
2586
|
console.error(delayedInsertError);
|
|
2544
2587
|
}
|
|
2545
|
-
}, [
|
|
2546
|
-
delayedInsertError
|
|
2547
|
-
]);
|
|
2588
|
+
}, [delayedInsertError]);
|
|
2548
2589
|
const [blockChainRenderProps] = usePromise5(async () => {
|
|
2549
2590
|
const chainId = await getChainId();
|
|
2550
|
-
return {
|
|
2551
|
-
|
|
2552
|
-
chainId
|
|
2553
|
-
};
|
|
2554
|
-
}, [
|
|
2555
|
-
chainArchivist
|
|
2556
|
-
]);
|
|
2591
|
+
return { chainArchivist, chainId };
|
|
2592
|
+
}, [chainArchivist]);
|
|
2557
2593
|
const { args } = context;
|
|
2558
2594
|
const props = {
|
|
2559
2595
|
...context,
|
|
@@ -2566,8 +2602,8 @@ var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, contex
|
|
|
2566
2602
|
}
|
|
2567
2603
|
}
|
|
2568
2604
|
};
|
|
2569
|
-
return firstBlock ? /* @__PURE__ */
|
|
2570
|
-
}
|
|
2605
|
+
return firstBlock ? /* @__PURE__ */ jsx55(Story, { ...props }) : /* @__PURE__ */ jsx55(CircularProgress2, {});
|
|
2606
|
+
};
|
|
2571
2607
|
export {
|
|
2572
2608
|
AccountBalanceHistoryFlexBox,
|
|
2573
2609
|
AccountBalanceHistoryTableEx,
|
|
@@ -2644,4 +2680,4 @@ export {
|
|
|
2644
2680
|
usePayloadCountsFromBlock,
|
|
2645
2681
|
useTxsFromBlock
|
|
2646
2682
|
};
|
|
2647
|
-
//# sourceMappingURL=index.mjs.map
|
|
2683
|
+
//# sourceMappingURL=index.mjs.map
|