@xyo-network/react-wallet 2.69.3 → 2.69.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/components/SeedPhrase/dialog/SeedPhraseDialog.d.cts.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/SeedPhraseDialog.d.mts.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/SeedPhraseDialog.d.ts.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.cts +6 -2
- package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.cts.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.mts +6 -2
- package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.mts.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.ts +6 -2
- package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.ts.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.cts +2 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.cts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.mts +2 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.mts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.ts +2 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/index.d.cts +2 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/index.d.cts.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/index.d.mts +2 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/index.d.mts.map +1 -1
- package/dist/browser/components/SeedPhrase/dialog/components/fields/index.d.ts +2 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/index.d.ts.map +1 -1
- package/dist/browser/index.cjs +104 -94
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +101 -91
- package/dist/browser/index.js.map +1 -1
- package/dist/node/components/SeedPhrase/dialog/SeedPhraseDialog.d.cts.map +1 -1
- package/dist/node/components/SeedPhrase/dialog/SeedPhraseDialog.d.mts.map +1 -1
- package/dist/node/components/SeedPhrase/dialog/SeedPhraseDialog.d.ts.map +1 -1
- package/dist/node/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.cts +6 -2
- package/dist/node/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.cts.map +1 -1
- package/dist/node/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.mts +6 -2
- package/dist/node/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.mts.map +1 -1
- package/dist/node/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.ts +6 -2
- package/dist/node/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.ts.map +1 -1
- package/dist/node/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.cts +2 -0
- package/dist/node/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.cts.map +1 -0
- package/dist/node/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.mts +2 -0
- package/dist/node/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.mts.map +1 -0
- package/dist/node/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.ts +2 -0
- package/dist/node/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.d.ts.map +1 -0
- package/dist/node/components/SeedPhrase/dialog/components/fields/index.d.cts +2 -0
- package/dist/node/components/SeedPhrase/dialog/components/fields/index.d.cts.map +1 -1
- package/dist/node/components/SeedPhrase/dialog/components/fields/index.d.mts +2 -0
- package/dist/node/components/SeedPhrase/dialog/components/fields/index.d.mts.map +1 -1
- package/dist/node/components/SeedPhrase/dialog/components/fields/index.d.ts +2 -0
- package/dist/node/components/SeedPhrase/dialog/components/fields/index.d.ts.map +1 -1
- package/dist/node/index.cjs +108 -94
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +101 -91
- package/dist/node/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/SeedPhrase/dialog/SeedPhraseDialog.tsx +9 -4
- package/src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx +12 -16
- package/src/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.tsx +17 -0
- package/src/components/SeedPhrase/dialog/components/fields/index.ts +2 -0
- package/src/contexts/SeedPhrase/Provider.tsx +15 -15
package/dist/node/index.js
CHANGED
|
@@ -170,7 +170,7 @@ var SeedPhraseContext = createContextEx();
|
|
|
170
170
|
// src/contexts/SeedPhrase/Provider.tsx
|
|
171
171
|
import { generateMnemonic as generateMnemonic2, validateMnemonic } from "@scure/bip39";
|
|
172
172
|
import { wordlist as wordlist2 } from "@scure/bip39/wordlists/english";
|
|
173
|
-
import { useEffect as useEffect2, useMemo, useState as useState4 } from "react";
|
|
173
|
+
import { useCallback, useEffect as useEffect2, useMemo, useState as useState4 } from "react";
|
|
174
174
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
175
175
|
var validate = (passedPhrase) => {
|
|
176
176
|
if (!passedPhrase) {
|
|
@@ -191,36 +191,36 @@ var SeedPhraseProvider = ({
|
|
|
191
191
|
useEffect2(() => {
|
|
192
192
|
setPhrase(defaultPhrase);
|
|
193
193
|
}, [defaultPhrase]);
|
|
194
|
-
useEffect2(() => {
|
|
195
|
-
if (!open) {
|
|
196
|
-
handleCancelOverwrite();
|
|
197
|
-
}
|
|
198
|
-
}, [open]);
|
|
199
194
|
useEffect2(() => {
|
|
200
195
|
if (seedPhrase || open) {
|
|
201
196
|
setPhrase == null ? void 0 : setPhrase(seedPhrase ?? "");
|
|
202
197
|
}
|
|
203
198
|
}, [seedPhrase, open, setPhrase]);
|
|
204
|
-
const handleGenerate = () => {
|
|
199
|
+
const handleGenerate = useCallback(() => {
|
|
205
200
|
const mnemonic = generateMnemonic2(wordlist2, 256);
|
|
206
201
|
setPhrase == null ? void 0 : setPhrase(mnemonic);
|
|
207
202
|
setOverwriteWarning == null ? void 0 : setOverwriteWarning(false);
|
|
208
|
-
};
|
|
209
|
-
const handleCancelOverwrite = () => {
|
|
203
|
+
}, []);
|
|
204
|
+
const handleCancelOverwrite = useCallback(() => {
|
|
210
205
|
setOverwriteWarning == null ? void 0 : setOverwriteWarning(false);
|
|
211
|
-
};
|
|
212
|
-
const handleClear = () => {
|
|
206
|
+
}, []);
|
|
207
|
+
const handleClear = useCallback(() => {
|
|
213
208
|
setPhrase == null ? void 0 : setPhrase("");
|
|
214
209
|
setOverwriteWarning == null ? void 0 : setOverwriteWarning(false);
|
|
215
|
-
};
|
|
216
|
-
const handleSave = () => {
|
|
210
|
+
}, []);
|
|
211
|
+
const handleSave = useCallback(() => {
|
|
217
212
|
if (!overwriteWarning && seedPhrase && seedPhrase !== phrase) {
|
|
218
213
|
setOverwriteWarning == null ? void 0 : setOverwriteWarning(true);
|
|
219
214
|
} else {
|
|
220
215
|
handleChangeSeedPhrase == null ? void 0 : handleChangeSeedPhrase(phrase ?? "");
|
|
221
216
|
saveCallback == null ? void 0 : saveCallback();
|
|
222
217
|
}
|
|
223
|
-
};
|
|
218
|
+
}, [handleChangeSeedPhrase, overwriteWarning, phrase, saveCallback, seedPhrase]);
|
|
219
|
+
useEffect2(() => {
|
|
220
|
+
if (!open) {
|
|
221
|
+
handleCancelOverwrite();
|
|
222
|
+
}
|
|
223
|
+
}, [handleCancelOverwrite, open]);
|
|
224
224
|
const validSeedPhrase = useMemo(() => validate == null ? void 0 : validate(seedPhrase), [seedPhrase]);
|
|
225
225
|
const validPhrase = useMemo(() => validate == null ? void 0 : validate(phrase), [phrase]);
|
|
226
226
|
return /* @__PURE__ */ jsx5(
|
|
@@ -369,7 +369,7 @@ var DialogActionButtons = ({ onClose, ...props }) => {
|
|
|
369
369
|
};
|
|
370
370
|
|
|
371
371
|
// src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx
|
|
372
|
-
import {
|
|
372
|
+
import { FormControl, TextField } from "@mui/material";
|
|
373
373
|
|
|
374
374
|
// src/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.ts
|
|
375
375
|
var colorParser = (conditional) => {
|
|
@@ -435,52 +435,57 @@ var PhraseHeaderBox = ({ children, conditional, ...props }) => {
|
|
|
435
435
|
|
|
436
436
|
// src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx
|
|
437
437
|
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
438
|
-
var NewPhraseTextField = (props) => {
|
|
439
|
-
const {
|
|
440
|
-
return /* @__PURE__ */
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
438
|
+
var NewPhraseTextField = ({ children, disableColor, ...props }) => {
|
|
439
|
+
const { phrase, setPhrase, validPhrase } = useSeedPhrase();
|
|
440
|
+
return /* @__PURE__ */ jsx10(Fragment3, { children: /* @__PURE__ */ jsxs8(FormControl, { fullWidth: true, size: "small", sx: { display: "flex", flexDirection: "column", rowGap: 1 }, children: [
|
|
441
|
+
children,
|
|
442
|
+
/* @__PURE__ */ jsx10(
|
|
443
|
+
TextField,
|
|
444
|
+
{
|
|
445
|
+
focused: true,
|
|
446
|
+
color: disableColor ? void 0 : colorParser(validPhrase),
|
|
447
|
+
error: validPhrase === false,
|
|
448
|
+
helperText: validPhrase === false ? /* @__PURE__ */ jsx10(InvalidPhraseTypography, {}) : null,
|
|
449
|
+
fullWidth: true,
|
|
450
|
+
maxRows: Number.POSITIVE_INFINITY,
|
|
451
|
+
multiline: true,
|
|
452
|
+
onChange: (e) => setPhrase == null ? void 0 : setPhrase(e.target.value),
|
|
453
|
+
value: phrase,
|
|
454
|
+
...props
|
|
455
|
+
}
|
|
456
|
+
)
|
|
457
|
+
] }) });
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
// src/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.tsx
|
|
461
|
+
import { Button as Button3, DialogActions as DialogActions3 } from "@mui/material";
|
|
462
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
463
|
+
var PhraseDialogActions = () => {
|
|
464
|
+
const { handleClear, handleGenerate, overwriteWarning } = useSeedPhrase();
|
|
465
|
+
return /* @__PURE__ */ jsxs9(DialogActions3, { sx: { justifyContent: "center" }, children: [
|
|
466
|
+
/* @__PURE__ */ jsx11(Button3, { disabled: overwriteWarning, variant: "outlined", onClick: handleGenerate, children: "Generate" }),
|
|
467
|
+
/* @__PURE__ */ jsx11(Button3, { variant: "outlined", onClick: handleClear, children: "Clear" })
|
|
463
468
|
] });
|
|
464
469
|
};
|
|
465
470
|
|
|
466
471
|
// src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx
|
|
467
|
-
import { Chip, FormControl as FormControl2, FormLabel
|
|
472
|
+
import { Chip, FormControl as FormControl2, FormLabel, TextField as TextField2 } from "@mui/material";
|
|
468
473
|
import { useState as useState6 } from "react";
|
|
469
|
-
import { Fragment as Fragment4, jsx as
|
|
474
|
+
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
470
475
|
var SavedPhraseTextField = (props) => {
|
|
471
476
|
const { validSeedPhrase, seedPhrase } = useSeedPhrase();
|
|
472
477
|
const [visible, setVisible] = useState6(false);
|
|
473
|
-
return /* @__PURE__ */
|
|
474
|
-
/* @__PURE__ */
|
|
475
|
-
visible ? /* @__PURE__ */
|
|
476
|
-
/* @__PURE__ */
|
|
477
|
-
/* @__PURE__ */
|
|
478
|
+
return /* @__PURE__ */ jsxs10(FormControl2, { fullWidth: true, size: "small", sx: { display: "flex", flexDirection: "column", rowGap: 1 }, children: [
|
|
479
|
+
/* @__PURE__ */ jsx12(Chip, { label: visible ? "Hide Saved Seed Phrase" : "Reveal Saved Seed Phrase", onClick: () => setVisible(!visible) }),
|
|
480
|
+
visible ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
481
|
+
/* @__PURE__ */ jsx12(FormLabel, { children: /* @__PURE__ */ jsx12(PhraseHeaderBox, { conditional: validSeedPhrase, children: "Saved Seed Phrase" }) }),
|
|
482
|
+
/* @__PURE__ */ jsx12(
|
|
478
483
|
TextField2,
|
|
479
484
|
{
|
|
480
485
|
defaultValue: seedPhrase,
|
|
481
486
|
disabled: true,
|
|
482
487
|
error: validSeedPhrase === false,
|
|
483
|
-
helperText: validSeedPhrase === false ? /* @__PURE__ */
|
|
488
|
+
helperText: validSeedPhrase === false ? /* @__PURE__ */ jsx12(InvalidPhraseTypography, {}) : null,
|
|
484
489
|
fullWidth: true,
|
|
485
490
|
maxRows: Number.POSITIVE_INFINITY,
|
|
486
491
|
multiline: true,
|
|
@@ -494,17 +499,17 @@ var SavedPhraseTextField = (props) => {
|
|
|
494
499
|
// src/components/SeedPhrase/dialog/components/OverwriteWarning.tsx
|
|
495
500
|
import { Alert as Alert3, Button as Button4 } from "@mui/material";
|
|
496
501
|
import { FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
497
|
-
import { jsx as
|
|
502
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
498
503
|
var OverwriteWarning = () => {
|
|
499
504
|
const { handleCancelOverwrite, handleSave } = useSeedPhrase();
|
|
500
|
-
return /* @__PURE__ */
|
|
505
|
+
return /* @__PURE__ */ jsx13(
|
|
501
506
|
Alert3,
|
|
502
507
|
{
|
|
503
508
|
variant: "outlined",
|
|
504
509
|
severity: "warning",
|
|
505
|
-
action: /* @__PURE__ */
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
510
|
+
action: /* @__PURE__ */ jsxs11(FlexRow2, { sx: { columnGap: 1 }, children: [
|
|
511
|
+
/* @__PURE__ */ jsx13(Button4, { variant: "outlined", color: "inherit", size: "small", onClick: handleSave, children: "Overwrite" }),
|
|
512
|
+
/* @__PURE__ */ jsx13(Button4, { variant: "outlined", color: "inherit", size: "small", onClick: handleCancelOverwrite, children: "Cancel" })
|
|
508
513
|
] }),
|
|
509
514
|
children: "Are you sure you want to overwrite existing seed phrase? This action cannot be undone."
|
|
510
515
|
}
|
|
@@ -512,10 +517,10 @@ var OverwriteWarning = () => {
|
|
|
512
517
|
};
|
|
513
518
|
|
|
514
519
|
// src/components/SeedPhrase/dialog/SeedPhraseDialog.tsx
|
|
515
|
-
import { Dialog as Dialog2, DialogContent as DialogContent2, DialogTitle as DialogTitle2 } from "@mui/material";
|
|
516
|
-
import { jsx as
|
|
520
|
+
import { Dialog as Dialog2, DialogContent as DialogContent2, DialogTitle as DialogTitle2, FormLabel as FormLabel2 } from "@mui/material";
|
|
521
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
517
522
|
var SeedPhraseDialog = ({ changeSeedPhrase, seedPhrase, ...props }) => {
|
|
518
|
-
return /* @__PURE__ */
|
|
523
|
+
return /* @__PURE__ */ jsx14(
|
|
519
524
|
SeedPhraseProvider,
|
|
520
525
|
{
|
|
521
526
|
seedPhrase,
|
|
@@ -525,23 +530,24 @@ var SeedPhraseDialog = ({ changeSeedPhrase, seedPhrase, ...props }) => {
|
|
|
525
530
|
var _a;
|
|
526
531
|
return (_a = props.onClose) == null ? void 0 : _a.call(props, {}, "escapeKeyDown");
|
|
527
532
|
},
|
|
528
|
-
children: /* @__PURE__ */
|
|
533
|
+
children: /* @__PURE__ */ jsx14(SeedPhraseDialogInner, { ...props })
|
|
529
534
|
}
|
|
530
535
|
);
|
|
531
536
|
};
|
|
532
537
|
var SeedPhraseDialogInner = (props) => {
|
|
533
|
-
const { overwriteWarning, seedPhrase } = useSeedPhrase();
|
|
534
|
-
return /* @__PURE__ */
|
|
535
|
-
/* @__PURE__ */
|
|
538
|
+
const { overwriteWarning, seedPhrase, validPhrase } = useSeedPhrase();
|
|
539
|
+
return /* @__PURE__ */ jsxs12(Dialog2, { "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description", fullWidth: true, maxWidth: "sm", ...props, children: [
|
|
540
|
+
/* @__PURE__ */ jsxs12(DialogTitle2, { id: "alert-dialog-title", children: [
|
|
536
541
|
"Update Your Seed Phrase ",
|
|
537
|
-
/* @__PURE__ */
|
|
542
|
+
/* @__PURE__ */ jsx14(SeedPhraseIconButton, {})
|
|
538
543
|
] }),
|
|
539
|
-
/* @__PURE__ */
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
|
|
542
|
-
|
|
544
|
+
/* @__PURE__ */ jsxs12(DialogContent2, { sx: { display: "flex", flexDirection: "column", rowGap: 2 }, children: [
|
|
545
|
+
/* @__PURE__ */ jsx14(NewPhraseTextField, { children: /* @__PURE__ */ jsx14(FormLabel2, { children: /* @__PURE__ */ jsx14(PhraseHeaderBox, { conditional: validPhrase, children: "New Seed Phrase" }) }) }),
|
|
546
|
+
/* @__PURE__ */ jsx14(PhraseDialogActions, {}),
|
|
547
|
+
seedPhrase ? /* @__PURE__ */ jsx14(SavedPhraseTextField, {}) : null,
|
|
548
|
+
overwriteWarning ? /* @__PURE__ */ jsx14(OverwriteWarning, {}) : null
|
|
543
549
|
] }),
|
|
544
|
-
/* @__PURE__ */
|
|
550
|
+
/* @__PURE__ */ jsx14(DialogActionButtons, { onClose: props.onClose })
|
|
545
551
|
] });
|
|
546
552
|
};
|
|
547
553
|
|
|
@@ -549,21 +555,21 @@ var SeedPhraseDialogInner = (props) => {
|
|
|
549
555
|
import { Cancel as CancelIcon, RadioButtonChecked as RadioButtonCheckedIcon } from "@mui/icons-material";
|
|
550
556
|
import { Button as Button5, ButtonGroup as ButtonGroup2, TableCell as TableCell2, TableRow as TableRow2 } from "@mui/material";
|
|
551
557
|
import { useState as useState7 } from "react";
|
|
552
|
-
import { jsx as
|
|
558
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
553
559
|
var SeedPhraseTableRow = ({ changeSeedPhrase, seedPhrase, ...props }) => {
|
|
554
560
|
const [open, setOpen] = useState7(false);
|
|
555
561
|
const handleOpen = () => {
|
|
556
562
|
setOpen(true);
|
|
557
563
|
};
|
|
558
|
-
return /* @__PURE__ */
|
|
559
|
-
/* @__PURE__ */
|
|
564
|
+
return /* @__PURE__ */ jsxs13(TableRow2, { ...props, children: [
|
|
565
|
+
/* @__PURE__ */ jsxs13(TableCell2, { children: [
|
|
560
566
|
"Seed Phrase ",
|
|
561
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ jsx15(SeedPhraseIconButton, {})
|
|
562
568
|
] }),
|
|
563
|
-
/* @__PURE__ */
|
|
564
|
-
/* @__PURE__ */
|
|
565
|
-
/* @__PURE__ */
|
|
566
|
-
/* @__PURE__ */
|
|
569
|
+
/* @__PURE__ */ jsx15(TableCell2, { align: "center", children: seedPhrase ? /* @__PURE__ */ jsx15(RadioButtonCheckedIcon, { color: "success" }) : /* @__PURE__ */ jsx15(CancelIcon, { color: "error" }) }),
|
|
570
|
+
/* @__PURE__ */ jsxs13(TableCell2, { children: [
|
|
571
|
+
/* @__PURE__ */ jsx15(SeedPhraseDialog, { changeSeedPhrase, open, onClose: () => setOpen(false), seedPhrase }),
|
|
572
|
+
/* @__PURE__ */ jsx15(ButtonGroup2, { fullWidth: true, children: /* @__PURE__ */ jsx15(Button5, { variant: "contained", size: "small", onClick: handleOpen, children: "Update" }) })
|
|
567
573
|
] })
|
|
568
574
|
] });
|
|
569
575
|
};
|
|
@@ -685,18 +691,18 @@ var useWrapperAccount = (account) => {
|
|
|
685
691
|
};
|
|
686
692
|
|
|
687
693
|
// src/components/WalletAccountDetails/WalletAccountDetails.tsx
|
|
688
|
-
import { jsx as
|
|
694
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
689
695
|
var WalletAccountDetails = ({ exploreUrl = "https://explore.xyo.network", account, ...props }) => {
|
|
690
696
|
const [accountToUse] = useAccount({ account });
|
|
691
697
|
const { network } = useNetwork();
|
|
692
698
|
const exploreAddressUrl = `${exploreUrl}/recent?account=${accountToUse == null ? void 0 : accountToUse.address}&network=${(network == null ? void 0 : network.name) ?? "main"}`;
|
|
693
|
-
return /* @__PURE__ */
|
|
694
|
-
/* @__PURE__ */
|
|
695
|
-
/* @__PURE__ */
|
|
696
|
-
/* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */
|
|
699
|
+
return /* @__PURE__ */ jsxs14(FlexCol, { ...props, children: [
|
|
700
|
+
/* @__PURE__ */ jsx16(EthAccountButton, { address: EthAddress.fromString(accountToUse == null ? void 0 : accountToUse.address) }),
|
|
701
|
+
/* @__PURE__ */ jsxs14(FlexRow3, { gap: 1, children: [
|
|
702
|
+
/* @__PURE__ */ jsx16(NumberStatus, { rounded: true, title: "Tokens", value: 0, to: `${exploreAddressUrl}&schema=network.xyo.account.tokens`, target: "_blank" }),
|
|
703
|
+
/* @__PURE__ */ jsx16(NumberStatus, { rounded: true, title: "NFTs", value: 0, to: `${exploreAddressUrl}&schema=network.xyo.account.nfts`, target: "_blank" }),
|
|
704
|
+
/* @__PURE__ */ jsx16(NumberStatus, { rounded: true, title: "Signatures", value: 0, to: `${exploreAddressUrl}&schema=network.xyo.account.signatures`, target: "_blank" }),
|
|
705
|
+
/* @__PURE__ */ jsx16(NumberStatus, { rounded: true, title: "Signins", value: 0, to: `${exploreAddressUrl}&schema=network.xyo.account.signins`, target: "_blank" })
|
|
700
706
|
] })
|
|
701
707
|
] });
|
|
702
708
|
};
|
|
@@ -705,7 +711,7 @@ var WalletAccountDetails = ({ exploreUrl = "https://explore.xyo.network", accoun
|
|
|
705
711
|
import { CircularProgress, MenuItem } from "@mui/material";
|
|
706
712
|
import { SelectEx } from "@xylabs/react-select";
|
|
707
713
|
import { AddressRenderRowBox } from "@xyo-network/react-address-render";
|
|
708
|
-
import { Fragment as Fragment5, jsx as
|
|
714
|
+
import { Fragment as Fragment5, jsx as jsx17 } from "react/jsx-runtime";
|
|
709
715
|
var arrayRange = (length, start = 0) => {
|
|
710
716
|
return [...Array.from({ length }).keys()].map((x) => x + start);
|
|
711
717
|
};
|
|
@@ -722,7 +728,7 @@ var WalletAccountSelect = ({
|
|
|
722
728
|
}) => {
|
|
723
729
|
const { activeAccountIndex = 0, setActiveAccountIndex, coinTypeWallet } = useWalletContext();
|
|
724
730
|
const disabled = !coinTypeWallet || activeAccountIndex === void 0;
|
|
725
|
-
return /* @__PURE__ */
|
|
731
|
+
return /* @__PURE__ */ jsx17(Fragment5, { children: coinTypeWallet ? /* @__PURE__ */ jsx17(
|
|
726
732
|
SelectEx,
|
|
727
733
|
{
|
|
728
734
|
margin: "dense",
|
|
@@ -732,7 +738,7 @@ var WalletAccountSelect = ({
|
|
|
732
738
|
const [selectedAccount] = useWallet({ path: selectedAccountIndex.toString(), wallet: coinTypeWallet });
|
|
733
739
|
const customName = selectedAccount ? addressNames[selectedAccount.address] : void 0;
|
|
734
740
|
const favorite = !!selectedAccount && selectedAccount.address in addressNames;
|
|
735
|
-
return /* @__PURE__ */
|
|
741
|
+
return /* @__PURE__ */ jsx17(MenuItem, { value: selectedAccountIndex, sx: { minHeight: 0, paddingBottom: 0, paddingTop: 0 }, children: /* @__PURE__ */ jsx17(
|
|
736
742
|
AddressRenderRowBox,
|
|
737
743
|
{
|
|
738
744
|
disableSharedRef: true,
|
|
@@ -747,7 +753,7 @@ var WalletAccountSelect = ({
|
|
|
747
753
|
}
|
|
748
754
|
) });
|
|
749
755
|
};
|
|
750
|
-
return /* @__PURE__ */
|
|
756
|
+
return /* @__PURE__ */ jsx17(Item, {});
|
|
751
757
|
},
|
|
752
758
|
value: activeAccountIndex,
|
|
753
759
|
onChange: (event) => setActiveAccountIndex == null ? void 0 : setActiveAccountIndex(Number.parseInt(`${event.target.value}`)),
|
|
@@ -759,7 +765,7 @@ var WalletAccountSelect = ({
|
|
|
759
765
|
const [account] = useWallet({ path: index.toString(), wallet: coinTypeWallet });
|
|
760
766
|
const customName = account ? addressNames[account.address] : void 0;
|
|
761
767
|
const favorite = !!account && account.address in addressNames;
|
|
762
|
-
return /* @__PURE__ */
|
|
768
|
+
return /* @__PURE__ */ jsx17(MenuItem, { value: index, sx: { minHeight: 0, paddingBottom: 0, paddingTop: 0 }, children: /* @__PURE__ */ jsx17(
|
|
763
769
|
AddressRenderRowBox,
|
|
764
770
|
{
|
|
765
771
|
disableSharedRef: true,
|
|
@@ -774,15 +780,15 @@ var WalletAccountSelect = ({
|
|
|
774
780
|
}
|
|
775
781
|
) }, account == null ? void 0 : account.address);
|
|
776
782
|
};
|
|
777
|
-
return /* @__PURE__ */
|
|
783
|
+
return /* @__PURE__ */ jsx17(Item, {}, index);
|
|
778
784
|
})
|
|
779
785
|
}
|
|
780
|
-
) : /* @__PURE__ */
|
|
786
|
+
) : /* @__PURE__ */ jsx17(CircularProgress, { size: 24 }) });
|
|
781
787
|
};
|
|
782
788
|
|
|
783
789
|
// src/components/WalletAccountSelect/SelectBar.tsx
|
|
784
790
|
import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
|
|
785
|
-
import { jsx as
|
|
791
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
786
792
|
var WalletAccountSelectBar = ({
|
|
787
793
|
addressNames = {},
|
|
788
794
|
iconOnly,
|
|
@@ -793,7 +799,7 @@ var WalletAccountSelectBar = ({
|
|
|
793
799
|
size = "small",
|
|
794
800
|
...props
|
|
795
801
|
}) => {
|
|
796
|
-
return /* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ jsx18(FlexCol2, { alignItems: "stretch", ...props, children: /* @__PURE__ */ jsx18(
|
|
797
803
|
WalletAccountSelect,
|
|
798
804
|
{
|
|
799
805
|
addressNames,
|
|
@@ -812,9 +818,12 @@ export {
|
|
|
812
818
|
Bip44,
|
|
813
819
|
DefaultSeedPhrase,
|
|
814
820
|
DialogActionButtons,
|
|
821
|
+
InvalidPhraseTypography,
|
|
815
822
|
MaxAccountsTableRow,
|
|
816
823
|
NewPhraseTextField,
|
|
817
824
|
OverwriteWarning,
|
|
825
|
+
PhraseDialogActions,
|
|
826
|
+
PhraseHeaderBox,
|
|
818
827
|
SavedPhraseTextField,
|
|
819
828
|
SeedPhraseContext,
|
|
820
829
|
SeedPhraseDialog,
|
|
@@ -828,6 +837,7 @@ export {
|
|
|
828
837
|
WalletContext,
|
|
829
838
|
WalletProvider,
|
|
830
839
|
WalletRootPath,
|
|
840
|
+
colorParser,
|
|
831
841
|
ethereumAccountPath,
|
|
832
842
|
useAccount,
|
|
833
843
|
useCoinTypeWallet,
|