@xyo-network/xl1-react-transaction 1.23.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.mjs +205 -155
- package/dist/browser/index.mjs.map +7 -1
- package/package.json +66 -66
package/dist/browser/index.mjs
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/confirmation/components/TransactionStackProgress.tsx
|
|
5
2
|
import { LinearProgress, Stack as Stack3 } from "@mui/material";
|
|
6
3
|
import { isDefined as isDefined7 } from "@xylabs/sdk-js";
|
|
7
|
-
import
|
|
4
|
+
import {
|
|
5
|
+
useLayoutEffect,
|
|
6
|
+
useMemo as useMemo2,
|
|
7
|
+
useRef,
|
|
8
|
+
useState
|
|
9
|
+
} from "react";
|
|
8
10
|
|
|
9
11
|
// src/confirmation/helpers/BlockFormatters.ts
|
|
10
12
|
import { isDefined } from "@xylabs/sdk-js";
|
|
11
13
|
var BlockFormatters = class {
|
|
12
|
-
static {
|
|
13
|
-
__name(this, "BlockFormatters");
|
|
14
|
-
}
|
|
15
14
|
params;
|
|
16
15
|
constructor(params) {
|
|
17
16
|
this.params = params;
|
|
@@ -53,7 +52,7 @@ var BlockFormatters = class {
|
|
|
53
52
|
|
|
54
53
|
// src/confirmation/helpers/blockProgressColor.ts
|
|
55
54
|
import { isDefined as isDefined2 } from "@xylabs/sdk-js";
|
|
56
|
-
var blockProgressColor =
|
|
55
|
+
var blockProgressColor = (confirmedInBlock, isExpired) => {
|
|
57
56
|
if (isDefined2(confirmedInBlock)) {
|
|
58
57
|
return "success";
|
|
59
58
|
}
|
|
@@ -61,11 +60,11 @@ var blockProgressColor = /* @__PURE__ */ __name((confirmedInBlock, isExpired) =>
|
|
|
61
60
|
return "error";
|
|
62
61
|
}
|
|
63
62
|
return "primary";
|
|
64
|
-
}
|
|
63
|
+
};
|
|
65
64
|
|
|
66
65
|
// src/confirmation/helpers/createFilledRange.ts
|
|
67
66
|
import { isUndefined } from "@xylabs/sdk-js";
|
|
68
|
-
var createFilledRange =
|
|
67
|
+
var createFilledRange = (range) => {
|
|
69
68
|
if (isUndefined(range)) {
|
|
70
69
|
return [];
|
|
71
70
|
}
|
|
@@ -79,11 +78,11 @@ var createFilledRange = /* @__PURE__ */ __name((range) => {
|
|
|
79
78
|
result.push(i);
|
|
80
79
|
}
|
|
81
80
|
return result;
|
|
82
|
-
}
|
|
81
|
+
};
|
|
83
82
|
|
|
84
83
|
// src/confirmation/helpers/getBlockProgress.ts
|
|
85
84
|
import { isUndefined as isUndefined2, isUndefinedOrNull } from "@xylabs/sdk-js";
|
|
86
|
-
var getBlockProgress =
|
|
85
|
+
var getBlockProgress = (currentBlockNumber, currentBlockRef, progressElementRef) => {
|
|
87
86
|
if (isUndefined2(currentBlockNumber) || isUndefinedOrNull(currentBlockRef) || isUndefinedOrNull(progressElementRef)) {
|
|
88
87
|
return 0;
|
|
89
88
|
}
|
|
@@ -95,47 +94,36 @@ var getBlockProgress = /* @__PURE__ */ __name((currentBlockNumber, currentBlockR
|
|
|
95
94
|
const relativePosition = currentBlockCenterOffsetLeft - parentOffsetLeft;
|
|
96
95
|
const progress = relativePosition / parentWidth * 100;
|
|
97
96
|
return Math.min(Math.max(progress, 0), 100);
|
|
98
|
-
}
|
|
97
|
+
};
|
|
99
98
|
|
|
100
99
|
// src/confirmation/helpers/isCurrentBlockPassedRange.ts
|
|
101
100
|
import { isDefined as isDefined3 } from "@xylabs/sdk-js";
|
|
102
|
-
var isCurrentBlockPassedRange =
|
|
101
|
+
var isCurrentBlockPassedRange = (blockRange, currentBlockNumber) => {
|
|
103
102
|
if (!isDefined3(blockRange) || !isDefined3(currentBlockNumber)) {
|
|
104
103
|
return false;
|
|
105
104
|
}
|
|
106
105
|
const [, end] = blockRange;
|
|
107
106
|
return currentBlockNumber > end;
|
|
108
|
-
}
|
|
107
|
+
};
|
|
109
108
|
|
|
110
109
|
// src/confirmation/helpers/passedBlocksInRange.ts
|
|
111
110
|
import { isDefined as isDefined4 } from "@xylabs/sdk-js";
|
|
112
|
-
var passedBlocksInRange =
|
|
111
|
+
var passedBlocksInRange = (range, currentBlockNumber) => {
|
|
113
112
|
if (!isDefined4(currentBlockNumber) || !isDefined4(range)) {
|
|
114
113
|
return [];
|
|
115
114
|
}
|
|
116
115
|
const [start] = range;
|
|
117
116
|
return range.filter((block) => block < currentBlockNumber && block >= start);
|
|
118
|
-
}
|
|
117
|
+
};
|
|
119
118
|
|
|
120
119
|
// src/confirmation/hooks/useBlockRangeState.ts
|
|
121
120
|
import { isDefined as isDefined5 } from "@xylabs/sdk-js";
|
|
122
121
|
import { useMemo } from "react";
|
|
123
|
-
var useBlockRangeState =
|
|
124
|
-
const range = useMemo(() => createFilledRange(blockRange), [
|
|
125
|
-
|
|
126
|
-
]);
|
|
127
|
-
const
|
|
128
|
-
blockRange,
|
|
129
|
-
currentBlockNumber
|
|
130
|
-
]);
|
|
131
|
-
const passedBlocks = useMemo(() => passedBlocksInRange(range, currentBlockNumber), [
|
|
132
|
-
currentBlockNumber,
|
|
133
|
-
range
|
|
134
|
-
]);
|
|
135
|
-
const progressColor = useMemo(() => blockProgressColor(confirmedInBlock, isExpired), [
|
|
136
|
-
confirmedInBlock,
|
|
137
|
-
isExpired
|
|
138
|
-
]);
|
|
122
|
+
var useBlockRangeState = (blockRange, confirmedInBlock, currentBlockNumber) => {
|
|
123
|
+
const range = useMemo(() => createFilledRange(blockRange), [blockRange]);
|
|
124
|
+
const isExpired = useMemo(() => isCurrentBlockPassedRange(blockRange, currentBlockNumber), [blockRange, currentBlockNumber]);
|
|
125
|
+
const passedBlocks = useMemo(() => passedBlocksInRange(range, currentBlockNumber), [currentBlockNumber, range]);
|
|
126
|
+
const progressColor = useMemo(() => blockProgressColor(confirmedInBlock, isExpired), [confirmedInBlock, isExpired]);
|
|
139
127
|
const isConfirmed = isDefined5(confirmedInBlock);
|
|
140
128
|
return {
|
|
141
129
|
isConfirmed,
|
|
@@ -144,82 +132,127 @@ var useBlockRangeState = /* @__PURE__ */ __name((blockRange, confirmedInBlock, c
|
|
|
144
132
|
progressColor,
|
|
145
133
|
range
|
|
146
134
|
};
|
|
147
|
-
}
|
|
135
|
+
};
|
|
148
136
|
|
|
149
137
|
// src/confirmation/components/support/BlockConfirmationStats.tsx
|
|
150
138
|
import { CheckCircleOutlined } from "@mui/icons-material";
|
|
151
|
-
import {
|
|
139
|
+
import {
|
|
140
|
+
Grow,
|
|
141
|
+
Stack,
|
|
142
|
+
Typography
|
|
143
|
+
} from "@mui/material";
|
|
152
144
|
import { isDefined as isDefined6 } from "@xylabs/sdk-js";
|
|
153
|
-
import
|
|
154
|
-
var BlockConfirmationStats =
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
145
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
146
|
+
var BlockConfirmationStats = ({
|
|
147
|
+
confirmed,
|
|
148
|
+
currentBlockColor,
|
|
149
|
+
currentBlockNumberValue,
|
|
150
|
+
passedBlocks
|
|
151
|
+
}) => {
|
|
152
|
+
return /* @__PURE__ */ jsxs(Stack, { children: [
|
|
153
|
+
/* @__PURE__ */ jsxs(
|
|
154
|
+
Typography,
|
|
155
|
+
{
|
|
156
|
+
variant: "caption",
|
|
157
|
+
color: currentBlockColor,
|
|
158
|
+
sx: {
|
|
159
|
+
display: "inline-flex",
|
|
160
|
+
alignItems: "center",
|
|
161
|
+
gap: 0.5
|
|
162
|
+
},
|
|
163
|
+
children: [
|
|
164
|
+
"Current Block:",
|
|
165
|
+
" ",
|
|
166
|
+
currentBlockNumberValue,
|
|
167
|
+
" ",
|
|
168
|
+
/* @__PURE__ */ jsx(Grow, { in: confirmed, children: /* @__PURE__ */ jsx(CheckCircleOutlined, { sx: { width: "0.8em", height: "0.8em" }, color: "success" }) })
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ jsxs(
|
|
173
|
+
Typography,
|
|
174
|
+
{
|
|
175
|
+
variant: "caption",
|
|
176
|
+
sx: {
|
|
177
|
+
color: "warning.light",
|
|
178
|
+
opacity: 0.75
|
|
179
|
+
},
|
|
180
|
+
children: [
|
|
181
|
+
"Passed Blocks:",
|
|
182
|
+
" ",
|
|
183
|
+
isDefined6(passedBlocks) && passedBlocks.length > 0 ? passedBlocks.map((block) => new Intl.NumberFormat().format(block)).join(", ") : "N/A"
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] });
|
|
188
|
+
};
|
|
179
189
|
|
|
180
190
|
// src/confirmation/components/support/BlockRangeEntryStack.tsx
|
|
181
|
-
import {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
191
|
+
import {
|
|
192
|
+
Box,
|
|
193
|
+
Stack as Stack2,
|
|
194
|
+
styled,
|
|
195
|
+
Tooltip,
|
|
196
|
+
Typography as Typography2
|
|
197
|
+
} from "@mui/material";
|
|
198
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
199
|
+
var BlockRangeEntryStack = ({
|
|
200
|
+
block,
|
|
201
|
+
blockColor,
|
|
202
|
+
blockStatus,
|
|
203
|
+
formattedBlockNumber,
|
|
204
|
+
updateBlockPositionRefs,
|
|
205
|
+
sx,
|
|
206
|
+
...props
|
|
207
|
+
}) => {
|
|
208
|
+
return /* @__PURE__ */ jsxs2(
|
|
209
|
+
Stack2,
|
|
210
|
+
{
|
|
211
|
+
ref: (ref) => {
|
|
212
|
+
if (updateBlockPositionRefs) updateBlockPositionRefs(block, ref);
|
|
213
|
+
},
|
|
214
|
+
sx: { position: "relative", ...sx },
|
|
215
|
+
...props,
|
|
216
|
+
children: [
|
|
217
|
+
/* @__PURE__ */ jsx2(
|
|
218
|
+
Box,
|
|
219
|
+
{
|
|
220
|
+
component: "span",
|
|
221
|
+
sx: {
|
|
222
|
+
display: "flex",
|
|
223
|
+
position: "relative",
|
|
224
|
+
width: "100%",
|
|
225
|
+
height: 5
|
|
226
|
+
},
|
|
227
|
+
children: /* @__PURE__ */ jsx2(StyledBlockNumberIndicator, { component: "span", sx: { backgroundColor: blockColor } })
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ jsx2(
|
|
231
|
+
Tooltip,
|
|
232
|
+
{
|
|
233
|
+
title: `Block: ${new Intl.NumberFormat().format(block)} (${blockStatus})`,
|
|
234
|
+
placement: "top",
|
|
235
|
+
arrow: true,
|
|
236
|
+
children: /* @__PURE__ */ jsx2(
|
|
237
|
+
Typography2,
|
|
238
|
+
{
|
|
239
|
+
variant: "caption",
|
|
240
|
+
sx: {
|
|
241
|
+
color: blockColor,
|
|
242
|
+
cursor: "pointer",
|
|
243
|
+
opacity: blockStatus === "missed" ? 0.75 : 1
|
|
244
|
+
},
|
|
245
|
+
children: formattedBlockNumber
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
]
|
|
192
251
|
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
display: "flex",
|
|
198
|
-
position: "relative",
|
|
199
|
-
width: "100%",
|
|
200
|
-
height: 5
|
|
201
|
-
}
|
|
202
|
-
}, /* @__PURE__ */ React2.createElement(StyledBlockNumberIndicator, {
|
|
203
|
-
component: "span",
|
|
204
|
-
sx: {
|
|
205
|
-
backgroundColor: blockColor
|
|
206
|
-
}
|
|
207
|
-
})), /* @__PURE__ */ React2.createElement(Tooltip, {
|
|
208
|
-
title: `Block: ${new Intl.NumberFormat().format(block)} (${blockStatus})`,
|
|
209
|
-
placement: "top",
|
|
210
|
-
arrow: true
|
|
211
|
-
}, /* @__PURE__ */ React2.createElement(Typography2, {
|
|
212
|
-
variant: "caption",
|
|
213
|
-
sx: {
|
|
214
|
-
color: blockColor,
|
|
215
|
-
cursor: "pointer",
|
|
216
|
-
opacity: blockStatus === "missed" ? 0.75 : 1
|
|
217
|
-
}
|
|
218
|
-
}, formattedBlockNumber)));
|
|
219
|
-
}, "BlockRangeEntryStack");
|
|
220
|
-
var StyledBlockNumberIndicator = styled(Box, {
|
|
221
|
-
name: "StyledBlockNumberIndicator"
|
|
222
|
-
})(({ theme }) => {
|
|
252
|
+
block
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
var StyledBlockNumberIndicator = styled(Box, { name: "StyledBlockNumberIndicator" })(({ theme }) => {
|
|
223
256
|
return theme.unstable_sx({
|
|
224
257
|
position: "absolute",
|
|
225
258
|
left: "calc(50% - 1px)",
|
|
@@ -231,20 +264,26 @@ var StyledBlockNumberIndicator = styled(Box, {
|
|
|
231
264
|
});
|
|
232
265
|
|
|
233
266
|
// src/confirmation/components/TransactionStackProgress.tsx
|
|
234
|
-
|
|
267
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
268
|
+
var TransactionStackProgress = ({
|
|
269
|
+
blockRange,
|
|
270
|
+
confirmedInBlock,
|
|
271
|
+
currentBlockNumber,
|
|
272
|
+
...props
|
|
273
|
+
}) => {
|
|
235
274
|
const blockPositionsRef = useRef({});
|
|
236
|
-
const updateBlockPositionRefs =
|
|
275
|
+
const updateBlockPositionRefs = (blockNumber, ref) => {
|
|
237
276
|
blockPositionsRef.current[blockNumber] = ref;
|
|
238
|
-
}
|
|
277
|
+
};
|
|
239
278
|
const progressElementRef = useRef(null);
|
|
240
|
-
const {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
]);
|
|
279
|
+
const {
|
|
280
|
+
passedBlocks,
|
|
281
|
+
progressColor,
|
|
282
|
+
range,
|
|
283
|
+
isConfirmed,
|
|
284
|
+
isExpired
|
|
285
|
+
} = useBlockRangeState(blockRange, confirmedInBlock, currentBlockNumber);
|
|
286
|
+
const blockFormatters = useMemo2(() => new BlockFormatters({ confirmedInBlock, currentBlockNumber }), [confirmedInBlock, currentBlockNumber]);
|
|
248
287
|
const [progressValue, setProgressValue] = useState(0);
|
|
249
288
|
useLayoutEffect(() => {
|
|
250
289
|
if (isDefined7(currentBlockNumber) && isDefined7(confirmedInBlock) && currentBlockNumber > confirmedInBlock) {
|
|
@@ -252,48 +291,59 @@ var TransactionStackProgress = /* @__PURE__ */ __name(({ blockRange, confirmedIn
|
|
|
252
291
|
}
|
|
253
292
|
const currentBlockNumberElement = isDefined7(currentBlockNumber) ? blockPositionsRef.current[currentBlockNumber] : null;
|
|
254
293
|
const progressElement = progressElementRef.current;
|
|
255
|
-
setProgressValue(getBlockProgress(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
294
|
+
setProgressValue(getBlockProgress(
|
|
295
|
+
currentBlockNumber,
|
|
296
|
+
currentBlockNumberElement,
|
|
297
|
+
progressElement
|
|
298
|
+
));
|
|
299
|
+
}, [confirmedInBlock, currentBlockNumber]);
|
|
300
|
+
return /* @__PURE__ */ jsx3(Stack3, { direction: "row", ...props, children: /* @__PURE__ */ jsxs3(
|
|
301
|
+
Stack3,
|
|
302
|
+
{
|
|
303
|
+
sx: {
|
|
304
|
+
width: "100%",
|
|
305
|
+
gap: 1
|
|
306
|
+
},
|
|
307
|
+
children: [
|
|
308
|
+
/* @__PURE__ */ jsxs3(Stack3, { children: [
|
|
309
|
+
/* @__PURE__ */ jsx3(LinearProgress, { ref: progressElementRef, variant: "determinate", value: isExpired ? 100 : progressValue, color: progressColor }),
|
|
310
|
+
/* @__PURE__ */ jsx3(
|
|
311
|
+
Stack3,
|
|
312
|
+
{
|
|
313
|
+
direction: "row",
|
|
314
|
+
sx: { justifyContent: "space-between" },
|
|
315
|
+
children: range.map((block) => {
|
|
316
|
+
const blockColor = blockFormatters.color(block);
|
|
317
|
+
const blockStatus = blockFormatters.confirmationStatus(block);
|
|
318
|
+
const formattedBlockNumber = blockFormatters.formatNumber(block);
|
|
319
|
+
return /* @__PURE__ */ jsx3(
|
|
320
|
+
BlockRangeEntryStack,
|
|
321
|
+
{
|
|
322
|
+
block,
|
|
323
|
+
blockColor,
|
|
324
|
+
blockStatus,
|
|
325
|
+
formattedBlockNumber,
|
|
326
|
+
updateBlockPositionRefs
|
|
327
|
+
},
|
|
328
|
+
block
|
|
329
|
+
);
|
|
330
|
+
})
|
|
331
|
+
}
|
|
332
|
+
)
|
|
333
|
+
] }),
|
|
334
|
+
/* @__PURE__ */ jsx3(
|
|
335
|
+
BlockConfirmationStats,
|
|
336
|
+
{
|
|
337
|
+
confirmed: isConfirmed,
|
|
338
|
+
currentBlockColor: isDefined7(currentBlockNumber) ? blockFormatters.color(currentBlockNumber) : "text.secondary",
|
|
339
|
+
currentBlockNumberValue: isDefined7(currentBlockNumber) ? new Intl.NumberFormat().format(currentBlockNumber) : "N/A",
|
|
340
|
+
passedBlocks
|
|
341
|
+
}
|
|
342
|
+
)
|
|
343
|
+
]
|
|
277
344
|
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
const blockStatus = blockFormatters.confirmationStatus(block);
|
|
281
|
-
const formattedBlockNumber = blockFormatters.formatNumber(block);
|
|
282
|
-
return /* @__PURE__ */ React3.createElement(BlockRangeEntryStack, {
|
|
283
|
-
key: block,
|
|
284
|
-
block,
|
|
285
|
-
blockColor,
|
|
286
|
-
blockStatus,
|
|
287
|
-
formattedBlockNumber,
|
|
288
|
-
updateBlockPositionRefs
|
|
289
|
-
});
|
|
290
|
-
}))), /* @__PURE__ */ React3.createElement(BlockConfirmationStats, {
|
|
291
|
-
confirmed: isConfirmed,
|
|
292
|
-
currentBlockColor: isDefined7(currentBlockNumber) ? blockFormatters.color(currentBlockNumber) : "text.secondary",
|
|
293
|
-
currentBlockNumberValue: isDefined7(currentBlockNumber) ? new Intl.NumberFormat().format(currentBlockNumber) : "N/A",
|
|
294
|
-
passedBlocks
|
|
295
|
-
})));
|
|
296
|
-
}, "TransactionStackProgress");
|
|
345
|
+
) });
|
|
346
|
+
};
|
|
297
347
|
export {
|
|
298
348
|
BlockFormatters,
|
|
299
349
|
TransactionStackProgress,
|
|
@@ -304,4 +354,4 @@ export {
|
|
|
304
354
|
passedBlocksInRange,
|
|
305
355
|
useBlockRangeState
|
|
306
356
|
};
|
|
307
|
-
//# sourceMappingURL=index.mjs.map
|
|
357
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/confirmation/components/TransactionStackProgress.tsx","../../src/confirmation/helpers/BlockFormatters.ts","../../src/confirmation/helpers/blockProgressColor.ts","../../src/confirmation/helpers/createFilledRange.ts","../../src/confirmation/helpers/getBlockProgress.ts","../../src/confirmation/helpers/isCurrentBlockPassedRange.ts","../../src/confirmation/helpers/passedBlocksInRange.ts","../../src/confirmation/hooks/useBlockRangeState.ts","../../src/confirmation/components/support/BlockConfirmationStats.tsx","../../src/confirmation/components/support/BlockRangeEntryStack.tsx"],"sourcesContent":["import type { StackProps } from '@mui/material'\nimport { LinearProgress, Stack } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport { type BlockRange } from '@xyo-network/xl1-sdk'\nimport React, {\n useLayoutEffect,\n useMemo,\n useRef, useState,\n} from 'react'\n\nimport { BlockFormatters, getBlockProgress } from '../helpers/index.ts'\nimport { useBlockRangeState } from '../hooks/index.ts'\nimport { BlockConfirmationStats, BlockRangeEntryStack } from './support/index.ts'\n\nexport interface TransactionStackProgressProps extends StackProps {\n blockRange?: BlockRange\n confirmedInBlock?: number\n currentBlockNumber?: number\n}\n\nexport const TransactionStackProgress: React.FC<TransactionStackProgressProps> = ({\n blockRange, confirmedInBlock, currentBlockNumber, ...props\n}) => {\n const blockPositionsRef = useRef<Record<number, HTMLSpanElement | null>>({})\n const updateBlockPositionRefs = (blockNumber: number, ref: HTMLSpanElement | null) => {\n blockPositionsRef.current[blockNumber] = ref\n }\n\n const progressElementRef = useRef<HTMLDivElement | null>(null)\n\n const {\n passedBlocks, progressColor, range, isConfirmed, isExpired,\n } = useBlockRangeState(blockRange, confirmedInBlock, currentBlockNumber)\n\n const blockFormatters = useMemo(() => new BlockFormatters({ confirmedInBlock, currentBlockNumber }), [confirmedInBlock, currentBlockNumber])\n\n const [progressValue, setProgressValue] = useState(0)\n\n useLayoutEffect(() => {\n // prevent updates if the current block is past the confirmed block\n if (isDefined(currentBlockNumber) && isDefined(confirmedInBlock) && currentBlockNumber > confirmedInBlock) {\n return\n }\n const currentBlockNumberElement = isDefined(currentBlockNumber) ? blockPositionsRef.current[currentBlockNumber] : null\n const progressElement = progressElementRef.current\n // since we are relying on htmlElements, we have to use layout effect\n setProgressValue(getBlockProgress(\n currentBlockNumber,\n currentBlockNumberElement,\n progressElement,\n ))\n }, [confirmedInBlock, currentBlockNumber])\n\n return (\n <Stack direction=\"row\" {...props}>\n <Stack\n sx={{\n width: '100%',\n gap: 1,\n }}\n >\n <Stack>\n <LinearProgress ref={progressElementRef} variant=\"determinate\" value={isExpired ? 100 : progressValue} color={progressColor} />\n <Stack\n direction=\"row\"\n sx={{ justifyContent: 'space-between' }}\n >\n {range.map((block) => {\n const blockColor = blockFormatters.color(block)\n const blockStatus = blockFormatters.confirmationStatus(block)\n const formattedBlockNumber = blockFormatters.formatNumber(block)\n return (\n <BlockRangeEntryStack\n key={block}\n block={block}\n blockColor={blockColor}\n blockStatus={blockStatus}\n formattedBlockNumber={formattedBlockNumber}\n updateBlockPositionRefs={updateBlockPositionRefs}\n />\n )\n })}\n </Stack>\n </Stack>\n <BlockConfirmationStats\n confirmed={isConfirmed}\n currentBlockColor={isDefined(currentBlockNumber) ? blockFormatters.color(currentBlockNumber) : 'text.secondary'}\n currentBlockNumberValue={isDefined(currentBlockNumber) ? new Intl.NumberFormat().format(currentBlockNumber) : 'N/A'}\n passedBlocks={passedBlocks}\n />\n </Stack>\n </Stack>\n )\n}\n","import { isDefined } from '@xylabs/sdk-js'\n\nexport type BlockConfirmationStatus = 'confirmed' | 'missed' | 'pending'\n\ninterface BlockFormattersParams {\n confirmedInBlock: number | undefined\n currentBlockNumber: number | undefined\n}\n\nexport class BlockFormatters {\n private readonly params: BlockFormattersParams\n\n constructor(params: BlockFormattersParams) {\n this.params = params\n }\n\n color(blockNumber: number): string {\n const { currentBlockNumber, confirmedInBlock } = this.params\n if (blockNumber === currentBlockNumber) {\n return isDefined(confirmedInBlock) && confirmedInBlock === blockNumber ? 'success.dark' : 'text'\n }\n const status = this.confirmationStatus(blockNumber)\n switch (status) {\n case 'confirmed': {\n return 'success.dark'\n }\n case 'missed': {\n return 'warning.light'\n }\n case 'pending': {\n return 'text.secondary'\n }\n default: {\n return 'text.secondary'\n }\n }\n }\n\n confirmationStatus(blockNumber: number): BlockConfirmationStatus | undefined {\n const { currentBlockNumber, confirmedInBlock } = this.params\n if (isDefined(currentBlockNumber)) {\n if (isDefined(confirmedInBlock) && blockNumber === confirmedInBlock) {\n return 'confirmed'\n }\n return currentBlockNumber > blockNumber ? 'missed' : 'pending'\n }\n }\n\n formatNumber(blockNumber: number) {\n return blockNumber.toString().length <= 5 ? new Intl.NumberFormat().format(blockNumber) : `${blockNumber.toString().slice(-2)}`\n }\n}\n","import type { LinearProgressProps } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\n\nexport const blockProgressColor = (\n confirmedInBlock: number | undefined,\n isExpired: boolean | undefined,\n): LinearProgressProps['color'] => {\n if (isDefined(confirmedInBlock)) {\n return 'success'\n }\n if (isExpired) {\n return 'error'\n }\n return 'primary'\n}\n","import { isUndefined } from '@xylabs/sdk-js'\n\nexport const createFilledRange = (range?: [number, number]): number[] => {\n if (isUndefined(range)) {\n return []\n }\n const [start, end] = range\n if (end < start) {\n console.warn('Invalid range: end is less than start')\n return []\n }\n\n const result: number[] = []\n\n for (let i = start; i <= end; i++) {\n result.push(i)\n }\n\n return result\n}\n","import { isUndefined, isUndefinedOrNull } from '@xylabs/sdk-js'\n\nexport const getBlockProgress = (\n currentBlockNumber: number | undefined,\n currentBlockRef: HTMLSpanElement | null,\n progressElementRef: HTMLDivElement | null,\n) => {\n if (isUndefined(currentBlockNumber) || isUndefinedOrNull(currentBlockRef) || isUndefinedOrNull(progressElementRef)) {\n return 0\n }\n\n const currentBlockOffsetLeft = currentBlockRef.offsetLeft\n const currentBlockOffsetWidth = currentBlockRef.clientWidth / 2\n const currentBlockCenterOffsetLeft = currentBlockOffsetLeft + currentBlockOffsetWidth\n const parentOffsetLeft = progressElementRef.offsetLeft\n const parentWidth = progressElementRef.clientWidth\n\n const relativePosition = currentBlockCenterOffsetLeft - parentOffsetLeft\n const progress = (relativePosition / parentWidth) * 100\n\n return Math.min(Math.max(progress, 0), 100)\n}\n","import { isDefined } from '@xylabs/sdk-js'\nimport type { BlockRange } from '@xyo-network/xl1-sdk'\n\nexport const isCurrentBlockPassedRange = (\n blockRange: BlockRange | undefined,\n currentBlockNumber: number | undefined,\n) => {\n if (!isDefined(blockRange) || !isDefined(currentBlockNumber)) {\n return false\n }\n const [, end] = blockRange\n return currentBlockNumber > end\n}\n","import { isDefined } from '@xylabs/sdk-js'\n\nexport const passedBlocksInRange = (\n range: number[] | undefined,\n currentBlockNumber: number | undefined,\n) => {\n if (!isDefined(currentBlockNumber) || !isDefined(range)) {\n return []\n }\n const [start] = range\n return range.filter(block => block < currentBlockNumber && block >= start)\n}\n","import type { LinearProgressProps } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport type { BlockRange } from '@xyo-network/xl1-sdk'\nimport { useMemo } from 'react'\n\nimport {\n blockProgressColor, createFilledRange, isCurrentBlockPassedRange, passedBlocksInRange,\n} from '../helpers/index.ts'\n\ninterface BlockRangeState {\n isConfirmed: boolean\n isExpired: boolean\n passedBlocks: number[]\n progressColor: LinearProgressProps['color']\n range: number[]\n}\n\nexport const useBlockRangeState = (\n blockRange: BlockRange | undefined,\n confirmedInBlock: number | undefined,\n currentBlockNumber?: number | undefined,\n): BlockRangeState => {\n const range = useMemo(() => createFilledRange((blockRange)), [blockRange])\n\n const isExpired = useMemo(() => isCurrentBlockPassedRange(blockRange, currentBlockNumber), [blockRange, currentBlockNumber])\n\n const passedBlocks = useMemo(() => passedBlocksInRange(range, currentBlockNumber), [currentBlockNumber, range])\n\n const progressColor = useMemo(() => blockProgressColor(confirmedInBlock, isExpired), [confirmedInBlock, isExpired])\n\n const isConfirmed = isDefined(confirmedInBlock)\n\n return {\n isConfirmed, isExpired, passedBlocks, progressColor, range,\n }\n}\n","import { CheckCircleOutlined } from '@mui/icons-material'\nimport {\n Grow, Stack, Typography,\n} from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport React from 'react'\n\nexport interface BlockConfirmationStatsProps {\n confirmed?: boolean\n currentBlockColor?: string\n currentBlockNumberValue?: string\n passedBlocks?: number[]\n}\n\nexport const BlockConfirmationStats: React.FC<BlockConfirmationStatsProps> = ({\n confirmed, currentBlockColor, currentBlockNumberValue, passedBlocks,\n}) => {\n return (\n <Stack>\n <Typography\n variant=\"caption\"\n color={currentBlockColor}\n sx={{\n display: 'inline-flex', alignItems: 'center', gap: 0.5,\n }}\n >\n Current Block:\n {' '}\n {currentBlockNumberValue}\n {' '}\n <Grow in={confirmed}>\n <CheckCircleOutlined sx={{ width: '0.8em', height: '0.8em' }} color=\"success\" />\n </Grow>\n </Typography>\n <Typography\n variant=\"caption\"\n sx={{\n color: 'warning.light',\n opacity: 0.75,\n }}\n >\n Passed Blocks:\n {' '}\n {isDefined(passedBlocks) && passedBlocks.length > 0 ? passedBlocks.map(block => new Intl.NumberFormat().format(block)).join(', ') : 'N/A'}\n </Typography>\n </Stack>\n )\n}\n","import type { BoxProps, StackProps } from '@mui/material'\nimport {\n Box, Stack, styled, Tooltip, Typography,\n} from '@mui/material'\nimport React from 'react'\n\nimport type { BlockConfirmationStatus } from '../../helpers/index.ts'\n\nexport interface BlockRangeEntryStackProps extends StackProps {\n block: number\n blockColor: string\n blockStatus: BlockConfirmationStatus | undefined\n formattedBlockNumber: string\n updateBlockPositionRefs?: (blockNumber: number, ref: HTMLSpanElement | null) => void\n}\n\nexport const BlockRangeEntryStack: React.FC<BlockRangeEntryStackProps> = ({\n block, blockColor, blockStatus, formattedBlockNumber, updateBlockPositionRefs, sx, ...props\n}) => {\n return (\n <Stack\n ref={(ref) => { if (updateBlockPositionRefs) updateBlockPositionRefs(block, ref) }}\n key={block}\n sx={{ position: 'relative', ...sx }}\n {...props}\n >\n <Box\n component=\"span\"\n sx={{\n display: 'flex', position: 'relative', width: '100%', height: 5,\n }}\n >\n <StyledBlockNumberIndicator component=\"span\" sx={{ backgroundColor: blockColor }} />\n </Box>\n <Tooltip\n title={`Block: ${new Intl.NumberFormat().format(block)} (${blockStatus})`}\n placement=\"top\"\n arrow\n >\n <Typography\n variant=\"caption\"\n sx={{\n color: blockColor,\n cursor: 'pointer',\n opacity: blockStatus === 'missed' ? 0.75 : 1,\n }}\n >\n {formattedBlockNumber}\n </Typography>\n </Tooltip>\n </Stack>\n )\n}\n\nconst StyledBlockNumberIndicator = styled(Box, { name: 'StyledBlockNumberIndicator' })<BoxProps>(({ theme }) => {\n return theme.unstable_sx({\n position: 'absolute',\n left: 'calc(50% - 1px)',\n transform: 'calc(translateX(-50%) - 1px)',\n height: 3,\n width: '1px',\n backgroundColor: 'primary.main',\n })\n})\n"],"mappings":";;;;AACA,SAASA,gBAAgBC,SAAAA,cAAa;AACtC,SAASC,aAAAA,kBAAiB;AAE1B,OAAOC,UACLC,iBACAC,WAAAA,UACAC,QAAQC,gBACH;;;ACRP,SAASC,iBAAiB;AASnB,IAAMC,kBAAN,MAAMA;EATb,OASaA;;;EACMC;EAEjB,YAAYA,QAA+B;AACzC,SAAKA,SAASA;EAChB;EAEAC,MAAMC,aAA6B;AACjC,UAAM,EAAEC,oBAAoBC,iBAAgB,IAAK,KAAKJ;AACtD,QAAIE,gBAAgBC,oBAAoB;AACtC,aAAOE,UAAUD,gBAAAA,KAAqBA,qBAAqBF,cAAc,iBAAiB;IAC5F;AACA,UAAMI,SAAS,KAAKC,mBAAmBL,WAAAA;AACvC,YAAQI,QAAAA;MACN,KAAK,aAAa;AAChB,eAAO;MACT;MACA,KAAK,UAAU;AACb,eAAO;MACT;MACA,KAAK,WAAW;AACd,eAAO;MACT;MACA,SAAS;AACP,eAAO;MACT;IACF;EACF;EAEAC,mBAAmBL,aAA0D;AAC3E,UAAM,EAAEC,oBAAoBC,iBAAgB,IAAK,KAAKJ;AACtD,QAAIK,UAAUF,kBAAAA,GAAqB;AACjC,UAAIE,UAAUD,gBAAAA,KAAqBF,gBAAgBE,kBAAkB;AACnE,eAAO;MACT;AACA,aAAOD,qBAAqBD,cAAc,WAAW;IACvD;EACF;EAEAM,aAAaN,aAAqB;AAChC,WAAOA,YAAYO,SAAQ,EAAGC,UAAU,IAAI,IAAIC,KAAKC,aAAY,EAAGC,OAAOX,WAAAA,IAAe,GAAGA,YAAYO,SAAQ,EAAGK,MAAM,EAAC,CAAA;EAC7H;AACF;;;AClDA,SAASC,aAAAA,kBAAiB;AAEnB,IAAMC,qBAAqB,wBAChCC,kBACAC,cAAAA;AAEA,MAAIC,WAAUF,gBA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A,gBAAAL,OAAA,cAACC,QAAAA,MACC,gBAAAD,OAAA,cAACM,gBAAAA;IAAe1B,KAAKE;IAAoByB,SAAQ;IAAcC,OAAOrB,YAAY,MAAMK;IAAeiB,OAAOzB;MAC9G,gBAAAgB,OAAA,cAACC,QAAAA;IACCC,WAAU;IACVC,IAAI;MAAEO,gBAAgB;IAAgB;KAErCzB,MAAM0B,IAAI,CAACC,UAAAA;AACV,UAAMC,aAAaxB,gBAAgBoB,MAAMG,KAAAA;AACzC,UAAME,cAAczB,gBAAgB0B,mBAAmBH,KAAAA;AACvD,UAAMI,uBAAuB3B,gBAAgB4B,aAAaL,KAAAA;AAC1D,WACE,gBAAAZ,OAAA,cAACkB,sBAAAA;MACCC,KAAKP;MACLA;MACAC;MACAC;MACAE;MACAtC;;EAGN,CAAA,CAAA,CAAA,GAGJ,gBAAAsB,OAAA,cAACoB,wBAAAA;IACCC,WAAWnC;IACXoC,mBAAmB1B,WAAUtB,kBAAAA,IAAsBe,gBAAgBoB,MAAMnC,kBAAAA,IAAsB;IAC/FiD,yBAAyB3B,WAAUtB,kBAAAA,IAAsB,IAAIkD,KAAKC,aAAY,EAAGC,OAAOpD,kBAAAA,IAAsB;IAC9GS;;AAKV,GAzEiF;","names":["LinearProgress","Stack","isDefined","React","useLayoutEffect","useMemo","useRef","useState","isDefined","BlockFormatters","params","color","blockNumber","currentBlockNumber","confirmedInBlock","isDefined","status","confirmationStatus","formatNumber","toString","length","Intl","NumberFormat","format","slice","isDefined","blockProgressColor","confirmedInBlock","isExpired","isDefined","isUndefined","createFilledRange","range","isUndefined","start","end","console","warn","result","i","push","isUndefined","isUndefinedOrNull","getBlockProgress","currentBlockNumber","currentBlockRef","progressElementRef","isUndefined","isUndefinedOrNull","currentBlockOffsetLeft","offsetLeft","currentBlockOffsetWidth","clientWidth","currentBlockCenterOffsetLeft","parentOffsetLeft","parentWidth","relativePosition","progress","Math","min","max","isDefined","isCurrentBlockPassedRange","blockRange","currentBlockNumber","isDefined","end","isDefined","passedBlocksInRange","range","currentBlockNumber","isDefined","start","filter","block","isDefined","useMemo","useBlockRangeState","blockRange","confirmedInBlock","currentBlockNumber","range","useMemo","createFilledRange","isExpired","isCurrentBlockPassedRange","passedBlocks","passedBlocksInRange","progressColor","blockProgressColor","isConfirmed","isDefined","CheckCircleOutlined","Grow","Stack","Typography","isDefined","React","BlockConfirmationStats","confirmed","currentBlockColor","currentBlockNumberValue","passedBlocks","Stack","Typography","variant","color","sx","display","alignItems","gap","Grow","in","CheckCircleOutlined","width","height","opacity","isDefined","length","map","block","Intl","NumberFormat","format","join","Box","Stack","styled","Tooltip","Typography","React","BlockRangeEntryStack","block","blockColor","blockStatus","formattedBlockNumber","updateBlockPositionRefs","sx","props","React","Stack","ref","key","position","Box","component","display","width","height","StyledBlockNumberIndicator","backgroundColor","Tooltip","title","Intl","NumberFormat","format","placement","arrow","Typography","variant","color","cursor","opacity","styled","name","theme","unstable_sx","left","transform","TransactionStackProgress","blockRange","confirmedInBlock","currentBlockNumber","props","blockPositionsRef","useRef","updateBlockPositionRefs","blockNumber","ref","current","progressElementRef","passedBlocks","progressColor","range","isConfirmed","isExpired","useBlockRangeState","blockFormatters","useMemo","BlockFormatters","progressValue","setProgressValue","useState","useLayoutEffect","isDefined","currentBlockNumberElement","progressElement","getBlockProgress","React","Stack","direction","sx","width","gap","LinearProgress","variant","value","color","justifyContent","map","block","blockColor","blockStatus","confirmationStatus","formattedBlockNumber","formatNumber","BlockRangeEntryStack","key","BlockConfirmationStats","confirmed","currentBlockColor","currentBlockNumberValue","Intl","NumberFormat","format"]}
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/confirmation/components/TransactionStackProgress.tsx", "../../src/confirmation/helpers/BlockFormatters.ts", "../../src/confirmation/helpers/blockProgressColor.ts", "../../src/confirmation/helpers/createFilledRange.ts", "../../src/confirmation/helpers/getBlockProgress.ts", "../../src/confirmation/helpers/isCurrentBlockPassedRange.ts", "../../src/confirmation/helpers/passedBlocksInRange.ts", "../../src/confirmation/hooks/useBlockRangeState.ts", "../../src/confirmation/components/support/BlockConfirmationStats.tsx", "../../src/confirmation/components/support/BlockRangeEntryStack.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { StackProps } from '@mui/material'\nimport { LinearProgress, Stack } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport { type BlockRange } from '@xyo-network/xl1-sdk'\nimport React, {\n useLayoutEffect,\n useMemo,\n useRef, useState,\n} from 'react'\n\nimport { BlockFormatters, getBlockProgress } from '../helpers/index.ts'\nimport { useBlockRangeState } from '../hooks/index.ts'\nimport { BlockConfirmationStats, BlockRangeEntryStack } from './support/index.ts'\n\nexport interface TransactionStackProgressProps extends StackProps {\n blockRange?: BlockRange\n confirmedInBlock?: number\n currentBlockNumber?: number\n}\n\nexport const TransactionStackProgress: React.FC<TransactionStackProgressProps> = ({\n blockRange, confirmedInBlock, currentBlockNumber, ...props\n}) => {\n const blockPositionsRef = useRef<Record<number, HTMLSpanElement | null>>({})\n const updateBlockPositionRefs = (blockNumber: number, ref: HTMLSpanElement | null) => {\n blockPositionsRef.current[blockNumber] = ref\n }\n\n const progressElementRef = useRef<HTMLDivElement | null>(null)\n\n const {\n passedBlocks, progressColor, range, isConfirmed, isExpired,\n } = useBlockRangeState(blockRange, confirmedInBlock, currentBlockNumber)\n\n const blockFormatters = useMemo(() => new BlockFormatters({ confirmedInBlock, currentBlockNumber }), [confirmedInBlock, currentBlockNumber])\n\n const [progressValue, setProgressValue] = useState(0)\n\n useLayoutEffect(() => {\n // prevent updates if the current block is past the confirmed block\n if (isDefined(currentBlockNumber) && isDefined(confirmedInBlock) && currentBlockNumber > confirmedInBlock) {\n return\n }\n const currentBlockNumberElement = isDefined(currentBlockNumber) ? blockPositionsRef.current[currentBlockNumber] : null\n const progressElement = progressElementRef.current\n // since we are relying on htmlElements, we have to use layout effect\n setProgressValue(getBlockProgress(\n currentBlockNumber,\n currentBlockNumberElement,\n progressElement,\n ))\n }, [confirmedInBlock, currentBlockNumber])\n\n return (\n <Stack direction=\"row\" {...props}>\n <Stack\n sx={{\n width: '100%',\n gap: 1,\n }}\n >\n <Stack>\n <LinearProgress ref={progressElementRef} variant=\"determinate\" value={isExpired ? 100 : progressValue} color={progressColor} />\n <Stack\n direction=\"row\"\n sx={{ justifyContent: 'space-between' }}\n >\n {range.map((block) => {\n const blockColor = blockFormatters.color(block)\n const blockStatus = blockFormatters.confirmationStatus(block)\n const formattedBlockNumber = blockFormatters.formatNumber(block)\n return (\n <BlockRangeEntryStack\n key={block}\n block={block}\n blockColor={blockColor}\n blockStatus={blockStatus}\n formattedBlockNumber={formattedBlockNumber}\n updateBlockPositionRefs={updateBlockPositionRefs}\n />\n )\n })}\n </Stack>\n </Stack>\n <BlockConfirmationStats\n confirmed={isConfirmed}\n currentBlockColor={isDefined(currentBlockNumber) ? blockFormatters.color(currentBlockNumber) : 'text.secondary'}\n currentBlockNumberValue={isDefined(currentBlockNumber) ? new Intl.NumberFormat().format(currentBlockNumber) : 'N/A'}\n passedBlocks={passedBlocks}\n />\n </Stack>\n </Stack>\n )\n}\n", "import { isDefined } from '@xylabs/sdk-js'\n\nexport type BlockConfirmationStatus = 'confirmed' | 'missed' | 'pending'\n\ninterface BlockFormattersParams {\n confirmedInBlock: number | undefined\n currentBlockNumber: number | undefined\n}\n\nexport class BlockFormatters {\n private readonly params: BlockFormattersParams\n\n constructor(params: BlockFormattersParams) {\n this.params = params\n }\n\n color(blockNumber: number): string {\n const { currentBlockNumber, confirmedInBlock } = this.params\n if (blockNumber === currentBlockNumber) {\n return isDefined(confirmedInBlock) && confirmedInBlock === blockNumber ? 'success.dark' : 'text'\n }\n const status = this.confirmationStatus(blockNumber)\n switch (status) {\n case 'confirmed': {\n return 'success.dark'\n }\n case 'missed': {\n return 'warning.light'\n }\n case 'pending': {\n return 'text.secondary'\n }\n default: {\n return 'text.secondary'\n }\n }\n }\n\n confirmationStatus(blockNumber: number): BlockConfirmationStatus | undefined {\n const { currentBlockNumber, confirmedInBlock } = this.params\n if (isDefined(currentBlockNumber)) {\n if (isDefined(confirmedInBlock) && blockNumber === confirmedInBlock) {\n return 'confirmed'\n }\n return currentBlockNumber > blockNumber ? 'missed' : 'pending'\n }\n }\n\n formatNumber(blockNumber: number) {\n return blockNumber.toString().length <= 5 ? new Intl.NumberFormat().format(blockNumber) : `${blockNumber.toString().slice(-2)}`\n }\n}\n", "import type { LinearProgressProps } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\n\nexport const blockProgressColor = (\n confirmedInBlock: number | undefined,\n isExpired: boolean | undefined,\n): LinearProgressProps['color'] => {\n if (isDefined(confirmedInBlock)) {\n return 'success'\n }\n if (isExpired) {\n return 'error'\n }\n return 'primary'\n}\n", "import { isUndefined } from '@xylabs/sdk-js'\n\nexport const createFilledRange = (range?: [number, number]): number[] => {\n if (isUndefined(range)) {\n return []\n }\n const [start, end] = range\n if (end < start) {\n console.warn('Invalid range: end is less than start')\n return []\n }\n\n const result: number[] = []\n\n for (let i = start; i <= end; i++) {\n result.push(i)\n }\n\n return result\n}\n", "import { isUndefined, isUndefinedOrNull } from '@xylabs/sdk-js'\n\nexport const getBlockProgress = (\n currentBlockNumber: number | undefined,\n currentBlockRef: HTMLSpanElement | null,\n progressElementRef: HTMLDivElement | null,\n) => {\n if (isUndefined(currentBlockNumber) || isUndefinedOrNull(currentBlockRef) || isUndefinedOrNull(progressElementRef)) {\n return 0\n }\n\n const currentBlockOffsetLeft = currentBlockRef.offsetLeft\n const currentBlockOffsetWidth = currentBlockRef.clientWidth / 2\n const currentBlockCenterOffsetLeft = currentBlockOffsetLeft + currentBlockOffsetWidth\n const parentOffsetLeft = progressElementRef.offsetLeft\n const parentWidth = progressElementRef.clientWidth\n\n const relativePosition = currentBlockCenterOffsetLeft - parentOffsetLeft\n const progress = (relativePosition / parentWidth) * 100\n\n return Math.min(Math.max(progress, 0), 100)\n}\n", "import { isDefined } from '@xylabs/sdk-js'\nimport type { BlockRange } from '@xyo-network/xl1-sdk'\n\nexport const isCurrentBlockPassedRange = (\n blockRange: BlockRange | undefined,\n currentBlockNumber: number | undefined,\n) => {\n if (!isDefined(blockRange) || !isDefined(currentBlockNumber)) {\n return false\n }\n const [, end] = blockRange\n return currentBlockNumber > end\n}\n", "import { isDefined } from '@xylabs/sdk-js'\n\nexport const passedBlocksInRange = (\n range: number[] | undefined,\n currentBlockNumber: number | undefined,\n) => {\n if (!isDefined(currentBlockNumber) || !isDefined(range)) {\n return []\n }\n const [start] = range\n return range.filter(block => block < currentBlockNumber && block >= start)\n}\n", "import type { LinearProgressProps } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport type { BlockRange } from '@xyo-network/xl1-sdk'\nimport { useMemo } from 'react'\n\nimport {\n blockProgressColor, createFilledRange, isCurrentBlockPassedRange, passedBlocksInRange,\n} from '../helpers/index.ts'\n\ninterface BlockRangeState {\n isConfirmed: boolean\n isExpired: boolean\n passedBlocks: number[]\n progressColor: LinearProgressProps['color']\n range: number[]\n}\n\nexport const useBlockRangeState = (\n blockRange: BlockRange | undefined,\n confirmedInBlock: number | undefined,\n currentBlockNumber?: number | undefined,\n): BlockRangeState => {\n const range = useMemo(() => createFilledRange((blockRange)), [blockRange])\n\n const isExpired = useMemo(() => isCurrentBlockPassedRange(blockRange, currentBlockNumber), [blockRange, currentBlockNumber])\n\n const passedBlocks = useMemo(() => passedBlocksInRange(range, currentBlockNumber), [currentBlockNumber, range])\n\n const progressColor = useMemo(() => blockProgressColor(confirmedInBlock, isExpired), [confirmedInBlock, isExpired])\n\n const isConfirmed = isDefined(confirmedInBlock)\n\n return {\n isConfirmed, isExpired, passedBlocks, progressColor, range,\n }\n}\n", "import { CheckCircleOutlined } from '@mui/icons-material'\nimport {\n Grow, Stack, Typography,\n} from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport React from 'react'\n\nexport interface BlockConfirmationStatsProps {\n confirmed?: boolean\n currentBlockColor?: string\n currentBlockNumberValue?: string\n passedBlocks?: number[]\n}\n\nexport const BlockConfirmationStats: React.FC<BlockConfirmationStatsProps> = ({\n confirmed, currentBlockColor, currentBlockNumberValue, passedBlocks,\n}) => {\n return (\n <Stack>\n <Typography\n variant=\"caption\"\n color={currentBlockColor}\n sx={{\n display: 'inline-flex', alignItems: 'center', gap: 0.5,\n }}\n >\n Current Block:\n {' '}\n {currentBlockNumberValue}\n {' '}\n <Grow in={confirmed}>\n <CheckCircleOutlined sx={{ width: '0.8em', height: '0.8em' }} color=\"success\" />\n </Grow>\n </Typography>\n <Typography\n variant=\"caption\"\n sx={{\n color: 'warning.light',\n opacity: 0.75,\n }}\n >\n Passed Blocks:\n {' '}\n {isDefined(passedBlocks) && passedBlocks.length > 0 ? passedBlocks.map(block => new Intl.NumberFormat().format(block)).join(', ') : 'N/A'}\n </Typography>\n </Stack>\n )\n}\n", "import type { BoxProps, StackProps } from '@mui/material'\nimport {\n Box, Stack, styled, Tooltip, Typography,\n} from '@mui/material'\nimport React from 'react'\n\nimport type { BlockConfirmationStatus } from '../../helpers/index.ts'\n\nexport interface BlockRangeEntryStackProps extends StackProps {\n block: number\n blockColor: string\n blockStatus: BlockConfirmationStatus | undefined\n formattedBlockNumber: string\n updateBlockPositionRefs?: (blockNumber: number, ref: HTMLSpanElement | null) => void\n}\n\nexport const BlockRangeEntryStack: React.FC<BlockRangeEntryStackProps> = ({\n block, blockColor, blockStatus, formattedBlockNumber, updateBlockPositionRefs, sx, ...props\n}) => {\n return (\n <Stack\n ref={(ref) => { if (updateBlockPositionRefs) updateBlockPositionRefs(block, ref) }}\n key={block}\n sx={{ position: 'relative', ...sx }}\n {...props}\n >\n <Box\n component=\"span\"\n sx={{\n display: 'flex', position: 'relative', width: '100%', height: 5,\n }}\n >\n <StyledBlockNumberIndicator component=\"span\" sx={{ backgroundColor: blockColor }} />\n </Box>\n <Tooltip\n title={`Block: ${new Intl.NumberFormat().format(block)} (${blockStatus})`}\n placement=\"top\"\n arrow\n >\n <Typography\n variant=\"caption\"\n sx={{\n color: blockColor,\n cursor: 'pointer',\n opacity: blockStatus === 'missed' ? 0.75 : 1,\n }}\n >\n {formattedBlockNumber}\n </Typography>\n </Tooltip>\n </Stack>\n )\n}\n\nconst StyledBlockNumberIndicator = styled(Box, { name: 'StyledBlockNumberIndicator' })<BoxProps>(({ theme }) => {\n return theme.unstable_sx({\n position: 'absolute',\n left: 'calc(50% - 1px)',\n transform: 'calc(translateX(-50%) - 1px)',\n height: 3,\n width: '1px',\n backgroundColor: 'primary.main',\n })\n})\n"],
|
|
5
|
+
"mappings": ";AACA,SAAS,gBAAgB,SAAAA,cAAa;AACtC,SAAS,aAAAC,kBAAiB;AAE1B;AAAA,EACE;AAAA,EACA,WAAAC;AAAA,EACA;AAAA,EAAQ;AAAA,OACH;;;ACRP,SAAS,iBAAiB;AASnB,IAAM,kBAAN,MAAsB;AAAA,EACV;AAAA,EAEjB,YAAY,QAA+B;AACzC,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAM,aAA6B;AACjC,UAAM,EAAE,oBAAoB,iBAAiB,IAAI,KAAK;AACtD,QAAI,gBAAgB,oBAAoB;AACtC,aAAO,UAAU,gBAAgB,KAAK,qBAAqB,cAAc,iBAAiB;AAAA,IAC5F;AACA,UAAM,SAAS,KAAK,mBAAmB,WAAW;AAClD,YAAQ,QAAQ;AAAA,MACd,KAAK,aAAa;AAChB,eAAO;AAAA,MACT;AAAA,MACA,KAAK,UAAU;AACb,eAAO;AAAA,MACT;AAAA,MACA,KAAK,WAAW;AACd,eAAO;AAAA,MACT;AAAA,MACA,SAAS;AACP,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAAA,EAEA,mBAAmB,aAA0D;AAC3E,UAAM,EAAE,oBAAoB,iBAAiB,IAAI,KAAK;AACtD,QAAI,UAAU,kBAAkB,GAAG;AACjC,UAAI,UAAU,gBAAgB,KAAK,gBAAgB,kBAAkB;AACnE,eAAO;AAAA,MACT;AACA,aAAO,qBAAqB,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,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,YACX,mBAAmBG,WAAU,kBAAkB,IAAI,gBAAgB,MAAM,kBAAkB,IAAI;AAAA,YAC/F,yBAAyBA,WAAU,kBAAkB,IAAI,IAAI,KAAK,aAAa,EAAE,OAAO,kBAAkB,IAAI;AAAA,YAC9G;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;",
|
|
6
|
+
"names": ["Stack", "isDefined", "useMemo", "isDefined", "isUndefined", "isDefined", "isDefined", "isDefined", "isDefined", "isDefined", "Stack", "Typography", "jsx", "jsxs", "jsx", "jsxs", "useMemo", "isDefined", "Stack"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/xl1-react-transaction",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"description": "XYO Layer One API",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -42,43 +42,43 @@
|
|
|
42
42
|
"@bitauth/libauth": "~3.0.0",
|
|
43
43
|
"@metamask/json-rpc-engine": "^10.5.0",
|
|
44
44
|
"@metamask/providers": "^22.1.1",
|
|
45
|
-
"@metamask/utils": "
|
|
46
|
-
"@mui/icons-material": "~9.0",
|
|
47
|
-
"@mui/material": "~9.0",
|
|
45
|
+
"@metamask/utils": "^11.11.0",
|
|
46
|
+
"@mui/icons-material": "~9.0.1",
|
|
47
|
+
"@mui/material": "~9.0.1",
|
|
48
48
|
"@opentelemetry/api": "^1.9.1",
|
|
49
49
|
"@opentelemetry/sdk-trace-base": "^2.7.1",
|
|
50
50
|
"@scure/base": "~2.2.0",
|
|
51
51
|
"@scure/bip39": "~2.2.0",
|
|
52
|
-
"@storybook/react-vite": "^10.
|
|
53
|
-
"@types/react": "^19.2.
|
|
54
|
-
"@xylabs/fetch": "~
|
|
55
|
-
"@xylabs/geo": "
|
|
56
|
-
"@xylabs/sdk-js": "^
|
|
57
|
-
"@xylabs/threads": "~
|
|
58
|
-
"@xylabs/toolchain": "~
|
|
59
|
-
"@xylabs/tsconfig": "~
|
|
60
|
-
"@xylabs/tsconfig-dom": "~
|
|
61
|
-
"@xylabs/tsconfig-react": "~
|
|
62
|
-
"@xyo-network/account": "~
|
|
63
|
-
"@xyo-network/account-model": "~
|
|
64
|
-
"@xyo-network/api": "~
|
|
65
|
-
"@xyo-network/api-models": "~
|
|
66
|
-
"@xyo-network/boundwitness-builder": "~
|
|
67
|
-
"@xyo-network/boundwitness-model": "~
|
|
68
|
-
"@xyo-network/boundwitness-wrapper": "~
|
|
69
|
-
"@xyo-network/config-payload-plugin": "~
|
|
70
|
-
"@xyo-network/huri": "~
|
|
71
|
-
"@xyo-network/manifest-model": "~
|
|
72
|
-
"@xyo-network/payload-builder": "~
|
|
73
|
-
"@xyo-network/payload-model": "~
|
|
74
|
-
"@xyo-network/payload-plugin": "~
|
|
75
|
-
"@xyo-network/payload-wrapper": "~
|
|
76
|
-
"@xyo-network/query-payload-plugin": "~
|
|
77
|
-
"@xyo-network/sdk-js": "
|
|
78
|
-
"@xyo-network/sdk-protocol-js": "~
|
|
79
|
-
"@xyo-network/wallet": "~
|
|
80
|
-
"@xyo-network/wallet-model": "^
|
|
81
|
-
"@xyo-network/xl1-sdk": "
|
|
52
|
+
"@storybook/react-vite": "^10.4.0",
|
|
53
|
+
"@types/react": "^19.2.15",
|
|
54
|
+
"@xylabs/fetch": "~6.0.2",
|
|
55
|
+
"@xylabs/geo": "~6.0.2",
|
|
56
|
+
"@xylabs/sdk-js": "^6.0.2",
|
|
57
|
+
"@xylabs/threads": "~6.0.2",
|
|
58
|
+
"@xylabs/toolchain": "~8.1.1",
|
|
59
|
+
"@xylabs/tsconfig": "~8.1.1",
|
|
60
|
+
"@xylabs/tsconfig-dom": "~8.1.1",
|
|
61
|
+
"@xylabs/tsconfig-react": "~8.1.1",
|
|
62
|
+
"@xyo-network/account": "~6.0.0",
|
|
63
|
+
"@xyo-network/account-model": "~6.0.0",
|
|
64
|
+
"@xyo-network/api": "~6.0",
|
|
65
|
+
"@xyo-network/api-models": "~6.0",
|
|
66
|
+
"@xyo-network/boundwitness-builder": "~6.0.0",
|
|
67
|
+
"@xyo-network/boundwitness-model": "~6.0.0",
|
|
68
|
+
"@xyo-network/boundwitness-wrapper": "~6.0.0",
|
|
69
|
+
"@xyo-network/config-payload-plugin": "~6.0.0",
|
|
70
|
+
"@xyo-network/huri": "~6.0",
|
|
71
|
+
"@xyo-network/manifest-model": "~6.0.0",
|
|
72
|
+
"@xyo-network/payload-builder": "~6.0.0",
|
|
73
|
+
"@xyo-network/payload-model": "~6.0.0",
|
|
74
|
+
"@xyo-network/payload-plugin": "~6.0",
|
|
75
|
+
"@xyo-network/payload-wrapper": "~6.0.0",
|
|
76
|
+
"@xyo-network/query-payload-plugin": "~6.0.0",
|
|
77
|
+
"@xyo-network/sdk-js": "~6.0",
|
|
78
|
+
"@xyo-network/sdk-protocol-js": "~6.0",
|
|
79
|
+
"@xyo-network/wallet": "~6.0",
|
|
80
|
+
"@xyo-network/wallet-model": "^6.0.0",
|
|
81
|
+
"@xyo-network/xl1-sdk": "~2.0",
|
|
82
82
|
"ajv": "^8.20.0",
|
|
83
83
|
"async-mutex": "^0.5.0",
|
|
84
84
|
"bn.js": "^5.2.3",
|
|
@@ -87,22 +87,22 @@
|
|
|
87
87
|
"cosmiconfig": "^9.0.1",
|
|
88
88
|
"debug": "~4.4.3",
|
|
89
89
|
"dotenv": "~17.4.2",
|
|
90
|
-
"eslint": "^10.
|
|
90
|
+
"eslint": "^10.4.0",
|
|
91
91
|
"ethers": "^6.16.0",
|
|
92
92
|
"hash-wasm": "~4.12.0",
|
|
93
93
|
"idb": "^8.0.3",
|
|
94
|
-
"lru-cache": "^11.
|
|
95
|
-
"mapbox-gl": "^3.
|
|
94
|
+
"lru-cache": "^11.5.0",
|
|
95
|
+
"mapbox-gl": "^3.24.0",
|
|
96
96
|
"observable-fns": "~0.6.1",
|
|
97
97
|
"pako": "^2.1.0",
|
|
98
98
|
"react": "^19.2.6",
|
|
99
99
|
"react-dom": "^19.2.6",
|
|
100
100
|
"store2": "~2.14.4",
|
|
101
|
-
"storybook": "^10.
|
|
102
|
-
"typescript": "~
|
|
101
|
+
"storybook": "^10.4.0",
|
|
102
|
+
"typescript": "~6.0.3",
|
|
103
103
|
"uuid": "~14.0.0",
|
|
104
|
-
"vite": "^8.0.
|
|
105
|
-
"vitest": "^4.1.
|
|
104
|
+
"vite": "^8.0.13",
|
|
105
|
+
"vitest": "^4.1.7",
|
|
106
106
|
"wasm-feature-detect": "~1.8.0",
|
|
107
107
|
"webextension-polyfill": "^0.12.0",
|
|
108
108
|
"zod": "~4.4.3"
|
|
@@ -111,37 +111,37 @@
|
|
|
111
111
|
"@bitauth/libauth": "~3.0",
|
|
112
112
|
"@metamask/json-rpc-engine": "^10.3",
|
|
113
113
|
"@metamask/providers": "^22.1",
|
|
114
|
-
"@metamask/utils": "
|
|
114
|
+
"@metamask/utils": "^11.11",
|
|
115
115
|
"@mui/icons-material": "~9.0",
|
|
116
116
|
"@mui/material": "~9.0",
|
|
117
117
|
"@opentelemetry/api": "^1.9",
|
|
118
118
|
"@opentelemetry/sdk-trace-base": "^2.7",
|
|
119
119
|
"@scure/base": "~2.2",
|
|
120
120
|
"@scure/bip39": "~2.2",
|
|
121
|
-
"@xylabs/fetch": "
|
|
122
|
-
"@xylabs/geo": "^
|
|
123
|
-
"@xylabs/sdk-js": "^
|
|
124
|
-
"@xylabs/threads": "~
|
|
125
|
-
"@xyo-network/account": "~
|
|
126
|
-
"@xyo-network/account-model": "~
|
|
127
|
-
"@xyo-network/api": "~
|
|
128
|
-
"@xyo-network/api-models": "~
|
|
129
|
-
"@xyo-network/boundwitness-builder": "~
|
|
130
|
-
"@xyo-network/boundwitness-model": "~
|
|
131
|
-
"@xyo-network/boundwitness-wrapper": "~
|
|
132
|
-
"@xyo-network/config-payload-plugin": "~
|
|
133
|
-
"@xyo-network/huri": "~
|
|
134
|
-
"@xyo-network/manifest-model": "~
|
|
135
|
-
"@xyo-network/payload-builder": "~
|
|
136
|
-
"@xyo-network/payload-model": "~
|
|
137
|
-
"@xyo-network/payload-plugin": "~
|
|
138
|
-
"@xyo-network/payload-wrapper": "~
|
|
139
|
-
"@xyo-network/query-payload-plugin": "~
|
|
140
|
-
"@xyo-network/sdk-js": "^
|
|
141
|
-
"@xyo-network/sdk-protocol-js": "~
|
|
142
|
-
"@xyo-network/wallet": "~
|
|
143
|
-
"@xyo-network/wallet-model": "^
|
|
144
|
-
"@xyo-network/xl1-sdk": "^
|
|
121
|
+
"@xylabs/fetch": "^6.0",
|
|
122
|
+
"@xylabs/geo": "^6.0",
|
|
123
|
+
"@xylabs/sdk-js": "^6.0",
|
|
124
|
+
"@xylabs/threads": "~6.0",
|
|
125
|
+
"@xyo-network/account": "~6.0",
|
|
126
|
+
"@xyo-network/account-model": "~6.0",
|
|
127
|
+
"@xyo-network/api": "~6.0",
|
|
128
|
+
"@xyo-network/api-models": "~6.0",
|
|
129
|
+
"@xyo-network/boundwitness-builder": "~6.0",
|
|
130
|
+
"@xyo-network/boundwitness-model": "~6.0",
|
|
131
|
+
"@xyo-network/boundwitness-wrapper": "~6.0",
|
|
132
|
+
"@xyo-network/config-payload-plugin": "~6.0",
|
|
133
|
+
"@xyo-network/huri": "~6.0",
|
|
134
|
+
"@xyo-network/manifest-model": "~6.0",
|
|
135
|
+
"@xyo-network/payload-builder": "~6.0",
|
|
136
|
+
"@xyo-network/payload-model": "~6.0",
|
|
137
|
+
"@xyo-network/payload-plugin": "~6.0",
|
|
138
|
+
"@xyo-network/payload-wrapper": "~6.0",
|
|
139
|
+
"@xyo-network/query-payload-plugin": "~6.0",
|
|
140
|
+
"@xyo-network/sdk-js": "^6.0",
|
|
141
|
+
"@xyo-network/sdk-protocol-js": "~6.0",
|
|
142
|
+
"@xyo-network/wallet": "~6.0",
|
|
143
|
+
"@xyo-network/wallet-model": "^6.0",
|
|
144
|
+
"@xyo-network/xl1-sdk": "^2.0",
|
|
145
145
|
"ajv": "^8.20",
|
|
146
146
|
"async-mutex": "^0.5",
|
|
147
147
|
"bn.js": "^5.2",
|