@xyo-network/react-wallet 2.45.2 → 2.45.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/cjs/components/SeedPhrase/DefaultSeedPhrase.js +22 -0
- package/dist/cjs/components/SeedPhrase/DefaultSeedPhrase.js.map +1 -0
- package/dist/cjs/components/SeedPhrase/_shared/SeedPhraseIconButton.js.map +1 -0
- package/dist/cjs/components/SeedPhrase/_shared/index.js +5 -0
- package/dist/cjs/components/SeedPhrase/_shared/index.js.map +1 -0
- package/dist/cjs/components/SeedPhrase/dialog/SeedPhraseDialog.js +2 -2
- package/dist/cjs/components/SeedPhrase/dialog/SeedPhraseDialog.js.map +1 -1
- package/dist/cjs/components/SeedPhrase/index.js +3 -1
- package/dist/cjs/components/SeedPhrase/index.js.map +1 -1
- package/dist/cjs/components/SeedPhrase/settings/SeedPhraseTableRow.js +21 -0
- package/dist/cjs/components/SeedPhrase/settings/SeedPhraseTableRow.js.map +1 -0
- package/dist/cjs/components/SeedPhrase/settings/index.js +5 -0
- package/dist/cjs/components/SeedPhrase/settings/index.js.map +1 -0
- package/dist/docs.json +1496 -1104
- package/dist/esm/components/SeedPhrase/DefaultSeedPhrase.js +18 -0
- package/dist/esm/components/SeedPhrase/DefaultSeedPhrase.js.map +1 -0
- package/dist/esm/components/SeedPhrase/_shared/SeedPhraseIconButton.js.map +1 -0
- package/dist/esm/components/SeedPhrase/_shared/index.js +2 -0
- package/dist/esm/components/SeedPhrase/_shared/index.js.map +1 -0
- package/dist/esm/components/SeedPhrase/dialog/SeedPhraseDialog.js +1 -1
- package/dist/esm/components/SeedPhrase/dialog/SeedPhraseDialog.js.map +1 -1
- package/dist/esm/components/SeedPhrase/index.js +3 -1
- package/dist/esm/components/SeedPhrase/index.js.map +1 -1
- package/dist/esm/components/SeedPhrase/settings/SeedPhraseTableRow.js +15 -0
- package/dist/esm/components/SeedPhrase/settings/SeedPhraseTableRow.js.map +1 -0
- package/dist/esm/components/SeedPhrase/settings/index.js +2 -0
- package/dist/esm/components/SeedPhrase/settings/index.js.map +1 -0
- package/dist/types/components/SeedPhrase/DefaultSeedPhrase.d.ts +8 -0
- package/dist/types/components/SeedPhrase/DefaultSeedPhrase.d.ts.map +1 -0
- package/dist/types/components/SeedPhrase/_shared/SeedPhraseIconButton.d.ts.map +1 -0
- package/dist/types/components/SeedPhrase/_shared/index.d.ts +2 -0
- package/dist/types/components/SeedPhrase/_shared/index.d.ts.map +1 -0
- package/dist/types/components/SeedPhrase/index.d.ts +3 -1
- package/dist/types/components/SeedPhrase/index.d.ts.map +1 -1
- package/dist/types/components/SeedPhrase/settings/SeedPhraseTableRow.d.ts +8 -0
- package/dist/types/components/SeedPhrase/settings/SeedPhraseTableRow.d.ts.map +1 -0
- package/dist/types/components/SeedPhrase/settings/index.d.ts +2 -0
- package/dist/types/components/SeedPhrase/settings/index.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/components/SeedPhrase/DefaultSeedPhrase.stories.tsx +23 -0
- package/src/components/SeedPhrase/DefaultSeedPhrase.tsx +40 -0
- package/src/components/SeedPhrase/_shared/index.ts +1 -0
- package/src/components/SeedPhrase/dialog/SeedPhraseDialog.tsx +1 -1
- package/src/components/SeedPhrase/index.ts +3 -1
- package/src/components/SeedPhrase/settings/SeedPhraseTableRow.stories.tsx +33 -0
- package/src/components/SeedPhrase/settings/SeedPhraseTableRow.tsx +36 -0
- package/src/components/SeedPhrase/settings/index.ts +1 -0
- package/dist/cjs/components/SeedPhrase/SeedPhraseIconButton.js.map +0 -1
- package/dist/esm/components/SeedPhrase/SeedPhraseIconButton.js.map +0 -1
- package/dist/types/components/SeedPhrase/SeedPhraseIconButton.d.ts.map +0 -1
- /package/dist/cjs/components/SeedPhrase/{SeedPhraseIconButton.js → _shared/SeedPhraseIconButton.js} +0 -0
- /package/dist/esm/components/SeedPhrase/{SeedPhraseIconButton.js → _shared/SeedPhraseIconButton.js} +0 -0
- /package/dist/types/components/SeedPhrase/{SeedPhraseIconButton.d.ts → _shared/SeedPhraseIconButton.d.ts} +0 -0
- /package/src/components/SeedPhrase/{SeedPhraseIconButton.tsx → _shared/SeedPhraseIconButton.tsx} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Alert, AlertTitle, Snackbar } from '@mui/material';
|
|
3
|
+
import { generateMnemonic } from '@scure/bip39';
|
|
4
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
5
|
+
import { wordlist } from '@scure/bip39/wordlists/english';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
export const DefaultSeedPhrase = ({ changeSeedPhrase, children, seedPhrase }) => {
|
|
8
|
+
const [showSnackBar, setShowSnackBar] = useState(false);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!seedPhrase) {
|
|
11
|
+
const mnemonic = generateMnemonic(wordlist, 256);
|
|
12
|
+
changeSeedPhrase?.(mnemonic);
|
|
13
|
+
setShowSnackBar(true);
|
|
14
|
+
}
|
|
15
|
+
}, [changeSeedPhrase, seedPhrase]);
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(Snackbar, { open: showSnackBar, autoHideDuration: 5000, onClose: () => setShowSnackBar(false), anchorOrigin: { horizontal: 'center', vertical: 'top' }, children: _jsxs(Alert, { severity: 'success', children: [_jsx(AlertTitle, { children: "Default Seed Phrase Generated" }), "Go to application settings to save it."] }) }), children] }));
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=DefaultSeedPhrase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultSeedPhrase.js","sourceRoot":"","sources":["../../../../src/components/SeedPhrase/DefaultSeedPhrase.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EA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AAI,EACJ,IAAI,EACJ,QAAQ,EACR,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,CAAC,MAAM,oBAAoB,GAA8B,CAAC,KAAK,EAAE,EAAE;IACvE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACvC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACpC,OAAO,CACL,8BACE,KAAC,UAAU,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAM,KAAK,YACjD,KAAC,eAAe,IAAC,QAAQ,EAAC,OAAO,GAAG,GACzB,EACb,MAAC,MAAM,IAAC,IAAI,EAAE,IAAI,aAChB,KAAC,WAAW,iDAA6C,EACzD,MAAC,aAAa,eACZ,MAAC,UAAU,wDAC6B,GAAG,EACzC,KAAC,IAAI,IAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC,gEAAgE,oCAEtF,EAAC,GAAG,qFAEA,EACb,MAAC,IAAI,eACH,KAAC,QAAQ,wDAAiD,EAC1D,KAAC,QAAQ,uDAAgD,EACzD,KAAC,QAAQ,oFAA6E,EACtF,KAAC,QAAQ,oEAA6D,IACjE,IACO,EAChB,KAAC,aAAa,cACZ,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,UAAU,mBAEnC,GACK,IACT,IACR,CACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/SeedPhrase/_shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Dialog, DialogContent, DialogTitle } from '@mui/material';
|
|
3
3
|
import { SeedPhraseProvider, useSeedPhrase } from '../../../contexts';
|
|
4
|
-
import { SeedPhraseIconButton } from '../
|
|
4
|
+
import { SeedPhraseIconButton } from '../_shared';
|
|
5
5
|
import { DialogActionButtons, NewPhraseTextField, OverwriteWarning, SavedPhraseTextField } from './components';
|
|
6
6
|
export const SeedPhraseDialog = ({ changeSeedPhrase, seedPhrase, ...props }) => {
|
|
7
7
|
return (_jsx(SeedPhraseProvider, { seedPhrase: seedPhrase, handleChangeSeedPhrase: changeSeedPhrase, open: props.open, saveCallback: () => props.onClose?.({}, 'escapeKeyDown'), children: _jsx(SeedPhraseDialogInner, { ...props }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SeedPhraseDialog.js","sourceRoot":"","sources":["../../../../../src/components/SeedPhrase/dialog/SeedPhraseDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAe,WAAW,EAAE,MAAM,eAAe,CAAA;AAE/E,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SeedPhraseDialog.js","sourceRoot":"","sources":["../../../../../src/components/SeedPhrase/dialog/SeedPhraseDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAe,WAAW,EAAE,MAAM,eAAe,CAAA;AAE/E,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAO9G,MAAM,CAAC,MAAM,gBAAgB,GAAoC,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC9G,OAAO,CACL,KAAC,kBAAkB,IACjB,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,gBAAgB,EACxC,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,eAAe,CAAC,YAExD,KAAC,qBAAqB,OAAK,KAAK,GAAI,GACjB,CACtB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAoC,CAAC,KAAK,EAAE,EAAE;IAC9E,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,aAAa,EAAE,CAAA;IAExD,OAAO,CACL,MAAC,MAAM,uBAAiB,oBAAoB,sBAAkB,0BAA0B,EAAC,SAAS,QAAC,QAAQ,EAAE,IAAI,KAAM,KAAK,aAC1H,MAAC,WAAW,IAAC,EAAE,EAAC,oBAAoB,yCACV,KAAC,oBAAoB,KAAG,IACpC,EACd,MAAC,aAAa,IAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,aACxE,KAAC,kBAAkB,KAAG,EACrB,UAAU,CAAC,CAAC,CAAC,KAAC,oBAAoB,KAAG,CAAC,CAAC,CAAC,IAAI,EAC5C,gBAAgB,CAAC,CAAC,CAAC,KAAC,gBAAgB,KAAG,CAAC,CAAC,CAAC,IAAI,IACjC,EAChB,KAAC,mBAAmB,IAAC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAI,IACxC,CACV,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/SeedPhrase/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/SeedPhrase/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import CancelIcon from '@mui/icons-material/Cancel';
|
|
3
|
+
import RadioButtonCheckedIcon from '@mui/icons-material/RadioButtonChecked';
|
|
4
|
+
import { Button, ButtonGroup, TableCell, TableRow } from '@mui/material';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { SeedPhraseIconButton } from '../_shared';
|
|
7
|
+
import { SeedPhraseDialog } from '../dialog';
|
|
8
|
+
export const SeedPhraseTableRow = ({ changeSeedPhrase, seedPhrase, ...props }) => {
|
|
9
|
+
const [open, setOpen] = useState(false);
|
|
10
|
+
const handleOpen = () => {
|
|
11
|
+
setOpen(true);
|
|
12
|
+
};
|
|
13
|
+
return (_jsxs(TableRow, { ...props, children: [_jsxs(TableCell, { children: ["Seed Phrase ", _jsx(SeedPhraseIconButton, {})] }), _jsx(TableCell, { align: "center", children: seedPhrase ? _jsx(RadioButtonCheckedIcon, { color: "success" }) : _jsx(CancelIcon, { color: "error" }) }), _jsxs(TableCell, { children: [_jsx(SeedPhraseDialog, { changeSeedPhrase: changeSeedPhrase, open: open, onClose: () => setOpen(false), seedPhrase: seedPhrase }), _jsx(ButtonGroup, { fullWidth: true, children: _jsx(Button, { variant: "contained", size: "small", onClick: handleOpen, children: "Update" }) })] })] }));
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=SeedPhraseTableRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeedPhraseTableRow.js","sourceRoot":"","sources":["../../../../../src/components/SeedPhrase/settings/SeedPhraseTableRow.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,4BAA4B,CAAA;AACnD,OAAO,sBAAsB,M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oot":"","sources":["../../../../../src/components/SeedPhrase/settings/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WithChildren } from '@xylabs/react-shared';
|
|
3
|
+
export interface DefaultSeedPhraseProps extends WithChildren {
|
|
4
|
+
changeSeedPhrase?: (seedPhrase?: string) => void;
|
|
5
|
+
seedPhrase?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const DefaultSeedPhrase: React.FC<DefaultSeedPhraseProps>;
|
|
8
|
+
//# sourceMappingURL=DefaultSeedPhrase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultSeedPhrase.d.ts","sourceRoot":"","sources":["../../../../src/components/SeedPhrase/DefaultSeedPhrase.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGnD,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,gBAAgB,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAChD,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA2B9D,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeedPhraseIconButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/SeedPhrase/_shared/SeedPhraseIconButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAOL,eAAe,EAKhB,MAAM,eAAe,CAAA;AAGtB,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAiC1D,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/SeedPhrase/_shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/SeedPhrase/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/SeedPhrase/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TableRowProps } from '@mui/material';
|
|
3
|
+
export interface SeedPhraseTableRowProps extends TableRowProps {
|
|
4
|
+
changeSeedPhrase?: (seedPhrase?: string) => void;
|
|
5
|
+
seedPhrase?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const SeedPhraseTableRow: React.FC<SeedPhraseTableRowProps>;
|
|
8
|
+
//# sourceMappingURL=SeedPhraseTableRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeedPhraseTableRow.d.ts","sourceRoot":"","sources":["../../../../../src/components/SeedPhrase/settings/SeedPhraseTableRow.tsx"],"names":[],"mappings":";AAEA,OAAO,EAA4C,aAAa,EAAE,MAAM,eAAe,CAAA;AAMvF,MAAM,WAAW,uBAAwB,SAAQ,aAAa;IAC5D,gBAAgB,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAChD,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAsBhE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/SeedPhrase/settings/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
package/package.json
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"@xylabs/react-shared": "^2.16.11",
|
|
21
21
|
"@xyo-network/account": "^2.51.9",
|
|
22
22
|
"@xyo-network/account-model": "^2.51.9",
|
|
23
|
-
"@xyo-network/react-network": "^2.45.
|
|
24
|
-
"@xyo-network/react-shared": "^2.45.
|
|
23
|
+
"@xyo-network/react-network": "^2.45.4",
|
|
24
|
+
"@xyo-network/react-shared": "^2.45.4"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@mui/icons-material": "^5",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@storybook/react": "^6.5.16",
|
|
38
38
|
"@xylabs/ts-scripts-yarn3": "^2.16.1",
|
|
39
39
|
"@xylabs/tsconfig-react": "^2.16.1",
|
|
40
|
-
"@xyo-network/react-storybook": "^2.45.
|
|
40
|
+
"@xyo-network/react-storybook": "^2.45.4",
|
|
41
41
|
"require-from-string": "^2.0.2",
|
|
42
42
|
"typescript": "^4.9.5"
|
|
43
43
|
},
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
},
|
|
84
84
|
"sideEffects": false,
|
|
85
85
|
"types": "dist/types/index.d.ts",
|
|
86
|
-
"version": "2.45.
|
|
86
|
+
"version": "2.45.4"
|
|
87
87
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentStory, Meta } from '@storybook/react'
|
|
2
|
+
|
|
3
|
+
import { DefaultSeedPhrase } from './DefaultSeedPhrase'
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line import/no-default-export
|
|
6
|
+
export default {
|
|
7
|
+
component: DefaultSeedPhrase,
|
|
8
|
+
title: 'Wallet/DefaultSeedPhrase',
|
|
9
|
+
} as Meta
|
|
10
|
+
|
|
11
|
+
const Template: ComponentStory<typeof DefaultSeedPhrase> = (props) => <DefaultSeedPhrase {...props} />
|
|
12
|
+
|
|
13
|
+
const Default = Template.bind({})
|
|
14
|
+
Default.args = {
|
|
15
|
+
seedPhrase: 'test me',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const WithoutDefaultSeedPhrase = Template.bind({})
|
|
19
|
+
WithoutDefaultSeedPhrase.args = {
|
|
20
|
+
changeSeedPhrase: (mnemonic?: string) => alert(`Generated Default Seed Phrase: ${mnemonic}`),
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { Default, WithoutDefaultSeedPhrase }
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Alert, AlertTitle, Snackbar } from '@mui/material'
|
|
2
|
+
import { generateMnemonic } from '@scure/bip39'
|
|
3
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
4
|
+
import { wordlist } from '@scure/bip39/wordlists/english'
|
|
5
|
+
import { WithChildren } from '@xylabs/react-shared'
|
|
6
|
+
import { useEffect, useState } from 'react'
|
|
7
|
+
|
|
8
|
+
export interface DefaultSeedPhraseProps extends WithChildren {
|
|
9
|
+
changeSeedPhrase?: (seedPhrase?: string) => void
|
|
10
|
+
seedPhrase?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const DefaultSeedPhrase: React.FC<DefaultSeedPhraseProps> = ({ changeSeedPhrase, children, seedPhrase }) => {
|
|
14
|
+
const [showSnackBar, setShowSnackBar] = useState(false)
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!seedPhrase) {
|
|
18
|
+
const mnemonic = generateMnemonic(wordlist, 256)
|
|
19
|
+
changeSeedPhrase?.(mnemonic)
|
|
20
|
+
setShowSnackBar(true)
|
|
21
|
+
}
|
|
22
|
+
}, [changeSeedPhrase, seedPhrase])
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<Snackbar
|
|
27
|
+
open={showSnackBar}
|
|
28
|
+
autoHideDuration={5000}
|
|
29
|
+
onClose={() => setShowSnackBar(false)}
|
|
30
|
+
anchorOrigin={{ horizontal: 'center', vertical: 'top' }}
|
|
31
|
+
>
|
|
32
|
+
<Alert severity={'success'}>
|
|
33
|
+
<AlertTitle>Default Seed Phrase Generated</AlertTitle>
|
|
34
|
+
Go to application settings to save it.
|
|
35
|
+
</Alert>
|
|
36
|
+
</Snackbar>
|
|
37
|
+
{children}
|
|
38
|
+
</>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SeedPhraseIconButton'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dialog, DialogContent, DialogProps, DialogTitle } from '@mui/material'
|
|
2
2
|
|
|
3
3
|
import { SeedPhraseProvider, useSeedPhrase } from '../../../contexts'
|
|
4
|
-
import { SeedPhraseIconButton } from '../
|
|
4
|
+
import { SeedPhraseIconButton } from '../_shared'
|
|
5
5
|
import { DialogActionButtons, NewPhraseTextField, OverwriteWarning, SavedPhraseTextField } from './components'
|
|
6
6
|
|
|
7
7
|
export interface SeedPhraseDialogProps extends DialogProps {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Table, TableBody } from '@mui/material'
|
|
2
|
+
import { ComponentStory, Meta } from '@storybook/react'
|
|
3
|
+
|
|
4
|
+
import { SeedPhraseTableRow } from './SeedPhraseTableRow'
|
|
5
|
+
|
|
6
|
+
const changeSeedPhrase = (phrase?: string) => alert(`Changed Seed Phrase to: ${phrase}`)
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line import/no-default-export
|
|
9
|
+
export default {
|
|
10
|
+
component: SeedPhraseTableRow,
|
|
11
|
+
title: 'Wallet/SeedPhraseTableRow',
|
|
12
|
+
} as Meta
|
|
13
|
+
|
|
14
|
+
const Template: ComponentStory<typeof SeedPhraseTableRow> = (props) => (
|
|
15
|
+
<Table>
|
|
16
|
+
<TableBody>
|
|
17
|
+
<SeedPhraseTableRow {...props} />
|
|
18
|
+
</TableBody>
|
|
19
|
+
</Table>
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const Default = Template.bind({})
|
|
23
|
+
Default.args = {
|
|
24
|
+
changeSeedPhrase,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const WithSeedPhrase = Template.bind({})
|
|
28
|
+
WithSeedPhrase.args = {
|
|
29
|
+
changeSeedPhrase,
|
|
30
|
+
seedPhrase: 'test me',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { Default, WithSeedPhrase }
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import CancelIcon from '@mui/icons-material/Cancel'
|
|
2
|
+
import RadioButtonCheckedIcon from '@mui/icons-material/RadioButtonChecked'
|
|
3
|
+
import { Button, ButtonGroup, TableCell, TableRow, TableRowProps } from '@mui/material'
|
|
4
|
+
import { useState } from 'react'
|
|
5
|
+
|
|
6
|
+
import { SeedPhraseIconButton } from '../_shared'
|
|
7
|
+
import { SeedPhraseDialog } from '../dialog'
|
|
8
|
+
|
|
9
|
+
export interface SeedPhraseTableRowProps extends TableRowProps {
|
|
10
|
+
changeSeedPhrase?: (seedPhrase?: string) => void
|
|
11
|
+
seedPhrase?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const SeedPhraseTableRow: React.FC<SeedPhraseTableRowProps> = ({ changeSeedPhrase, seedPhrase, ...props }) => {
|
|
15
|
+
const [open, setOpen] = useState(false)
|
|
16
|
+
|
|
17
|
+
const handleOpen = () => {
|
|
18
|
+
setOpen(true)
|
|
19
|
+
}
|
|
20
|
+
return (
|
|
21
|
+
<TableRow {...props}>
|
|
22
|
+
<TableCell>
|
|
23
|
+
Seed Phrase <SeedPhraseIconButton />
|
|
24
|
+
</TableCell>
|
|
25
|
+
<TableCell align="center">{seedPhrase ? <RadioButtonCheckedIcon color="success" /> : <CancelIcon color="error" />}</TableCell>
|
|
26
|
+
<TableCell>
|
|
27
|
+
<SeedPhraseDialog changeSeedPhrase={changeSeedPhrase} open={open} onClose={() => setOpen(false)} seedPhrase={seedPhrase} />
|
|
28
|
+
<ButtonGroup fullWidth>
|
|
29
|
+
<Button variant="contained" size="small" onClick={handleOpen}>
|
|
30
|
+
Update
|
|
31
|
+
</Button>
|
|
32
|
+
</ButtonGroup>
|
|
33
|
+
</TableCell>
|
|
34
|
+
</TableRow>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SeedPhraseTableRow'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SeedPhraseIconButton.js","sourceRoot":"","sources":["../../../../src/components/SeedPhrase/SeedPhraseIconButton.tsx"],"names":[],"mappings":";;;;;AAAA,0FAA6D;AAC7D,4CAYsB;AACtB,iCAAgC;AAEzB,MAAM,oBAAoB,GAA8B,CAAC,KAAK,EAAE,EAAE;IACvE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAA;IACvC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACpC,OAAO,CACL,6DACE,uBAAC,qBAAU,kBAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAM,KAAK,cACjD,uBAAC,qBAAe,IAAC,QAAQ,EAAC,OAAO,GAAG,IACzB,EACb,wBAAC,iBAAM,kBAAC,IAAI,EAAE,IAAI,iBAChB,uBAAC,sBAAW,iDAA6C,EACzD,wBAAC,wBAAa,eACZ,wBAAC,qBAAU,wDAC6B,GAAG,EACzC,uBAAC,eAAI,kBAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC,gEAAgE,yCAEtF,EAAC,GAAG,qFAEA,EACb,wBAAC,eAAI,eACH,uBAAC,mBAAQ,wDAAiD,EAC1D,uBAAC,mBAAQ,uDAAgD,EACzD,uBAAC,mBAAQ,oFAA6E,EACtF,uBAAC,mBAAQ,oEAA6D,IACjE,IACO,EAChB,uBAAC,wBAAa,cACZ,uBAAC,iBAAM,kBAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,UAAU,wBAEnC,GACK,KACT,IACR,CACJ,CAAA;AACH,CAAC,CAAA;AAjCY,QAAA,oBAAoB,wBAiChC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SeedPhraseIconButton.js","sourceRoot":"","sources":["../../../../src/components/SeedPhrase/SeedPhraseIconButton.tsx"],"names":[],"mappings":";AAAA,OAAO,eAAe,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EACL,MAAM,EACN,MAAM,EACN,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EAEV,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,UAAU,GACX,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,MAAM,CAAC,MAAM,oBAAoB,GAA8B,CAAC,KAAK,EAAE,EAAE;IACvE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACvC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACpC,OAAO,CACL,8BACE,KAAC,UAAU,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAM,KAAK,YACjD,KAAC,eAAe,IAAC,QAAQ,EAAC,OAAO,GAAG,GACzB,EACb,MAAC,MAAM,IAAC,IAAI,EAAE,IAAI,aAChB,KAAC,WAAW,iDAA6C,EACzD,MAAC,aAAa,eACZ,MAAC,UAAU,wDAC6B,GAAG,EACzC,KAAC,IAAI,IAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC,gEAAgE,oCAEtF,EAAC,GAAG,qFAEA,EACb,MAAC,IAAI,eACH,KAAC,QAAQ,wDAAiD,EAC1D,KAAC,QAAQ,uDAAgD,EACzD,KAAC,QAAQ,oFAA6E,EACtF,KAAC,QAAQ,oEAA6D,IACjE,IACO,EAChB,KAAC,aAAa,cACZ,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,UAAU,mBAEnC,GACK,IACT,IACR,CACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SeedPhraseIconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/SeedPhrase/SeedPhraseIconButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAOL,eAAe,EAKhB,MAAM,eAAe,CAAA;AAGtB,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAiC1D,CAAA"}
|
/package/dist/cjs/components/SeedPhrase/{SeedPhraseIconButton.js → _shared/SeedPhraseIconButton.js}
RENAMED
|
File without changes
|
/package/dist/esm/components/SeedPhrase/{SeedPhraseIconButton.js → _shared/SeedPhraseIconButton.js}
RENAMED
|
File without changes
|
|
File without changes
|
/package/src/components/SeedPhrase/{SeedPhraseIconButton.tsx → _shared/SeedPhraseIconButton.tsx}
RENAMED
|
File without changes
|