@xyo-network/react-wallet 3.0.2 → 3.0.3
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/MaxAccounts/MaxAccountsTableRow.d.ts +9 -0
- package/dist/browser/components/MaxAccounts/MaxAccountsTableRow.d.ts.map +1 -0
- package/dist/browser/components/MaxAccounts/OutOfBoundsSnackBar.d.ts +11 -0
- package/dist/browser/components/MaxAccounts/OutOfBoundsSnackBar.d.ts.map +1 -0
- package/dist/browser/components/MaxAccounts/index.d.ts +2 -0
- package/dist/browser/components/MaxAccounts/index.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/DefaultSeedPhrase.d.ts +9 -0
- package/dist/browser/components/SeedPhrase/DefaultSeedPhrase.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/_shared/SeedPhraseIconButton.d.ts +4 -0
- package/dist/browser/components/SeedPhrase/_shared/SeedPhraseIconButton.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/_shared/index.d.ts +2 -0
- package/dist/browser/components/SeedPhrase/_shared/index.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/SeedPhraseDialog.d.ts +9 -0
- package/dist/browser/components/SeedPhrase/dialog/SeedPhraseDialog.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/DialogActionButtons.d.ts +8 -0
- package/dist/browser/components/SeedPhrase/dialog/components/DialogActionButtons.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/OverwriteWarning.d.ts +2 -0
- package/dist/browser/components/SeedPhrase/dialog/components/OverwriteWarning.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.ts +9 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.d.ts.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/SavedPhraseTextField.d.ts +8 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/index.d.ts +5 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/index.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.d.ts +4 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.d.ts +9 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.d.ts +2 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/colorParser.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/index.d.ts +4 -0
- package/dist/browser/components/SeedPhrase/dialog/components/fields/validation-messages/index.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/components/index.d.ts +4 -0
- package/dist/browser/components/SeedPhrase/dialog/components/index.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/dialog/index.d.ts +3 -0
- package/dist/browser/components/SeedPhrase/dialog/index.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/index.d.ts +5 -0
- package/dist/browser/components/SeedPhrase/index.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/settings/SeedPhraseTableRow.d.ts +8 -0
- package/dist/browser/components/SeedPhrase/settings/SeedPhraseTableRow.d.ts.map +1 -0
- package/dist/browser/components/SeedPhrase/settings/index.d.ts +2 -0
- package/dist/browser/components/SeedPhrase/settings/index.d.ts.map +1 -0
- package/dist/browser/components/WalletAccountDetails/WalletAccountDetails.d.ts +9 -0
- package/dist/browser/components/WalletAccountDetails/WalletAccountDetails.d.ts.map +1 -0
- package/dist/browser/components/WalletAccountDetails/index.d.ts +2 -0
- package/dist/browser/components/WalletAccountDetails/index.d.ts.map +1 -0
- package/dist/browser/components/WalletAccountSelect/Select.d.ts +11 -0
- package/dist/browser/components/WalletAccountSelect/Select.d.ts.map +1 -0
- package/dist/browser/components/WalletAccountSelect/SelectBar.d.ts +13 -0
- package/dist/browser/components/WalletAccountSelect/SelectBar.d.ts.map +1 -0
- package/dist/browser/components/WalletAccountSelect/WalletInfo.d.ts +17 -0
- package/dist/browser/components/WalletAccountSelect/WalletInfo.d.ts.map +1 -0
- package/dist/browser/components/WalletAccountSelect/index.d.ts +3 -0
- package/dist/browser/components/WalletAccountSelect/index.d.ts.map +1 -0
- package/dist/browser/components/WalletAccountSelect/stories/WalletProviderDecorator.d.ts +3 -0
- package/dist/browser/components/WalletAccountSelect/stories/WalletProviderDecorator.d.ts.map +1 -0
- package/dist/browser/components/WalletAccountSelect/stories/index.d.ts +2 -0
- package/dist/browser/components/WalletAccountSelect/stories/index.d.ts.map +1 -0
- package/dist/browser/components/index.d.ts +5 -0
- package/dist/browser/components/index.d.ts.map +1 -0
- package/dist/browser/contexts/SeedPhrase/Context.d.ts +3 -0
- package/dist/browser/contexts/SeedPhrase/Context.d.ts.map +1 -0
- package/dist/browser/contexts/SeedPhrase/Provider.d.ts +11 -0
- package/dist/browser/contexts/SeedPhrase/Provider.d.ts.map +1 -0
- package/dist/browser/contexts/SeedPhrase/State.d.ts +18 -0
- package/dist/browser/contexts/SeedPhrase/State.d.ts.map +1 -0
- package/dist/browser/contexts/SeedPhrase/index.d.ts +5 -0
- package/dist/browser/contexts/SeedPhrase/index.d.ts.map +1 -0
- package/dist/browser/contexts/SeedPhrase/use.d.ts +2 -0
- package/dist/browser/contexts/SeedPhrase/use.d.ts.map +1 -0
- package/dist/browser/contexts/Wallet/Context.d.ts +3 -0
- package/dist/browser/contexts/Wallet/Context.d.ts.map +1 -0
- package/dist/browser/contexts/Wallet/Provider.d.ts +9 -0
- package/dist/browser/contexts/Wallet/Provider.d.ts.map +1 -0
- package/dist/browser/contexts/Wallet/State.d.ts +10 -0
- package/dist/browser/contexts/Wallet/State.d.ts.map +1 -0
- package/dist/browser/contexts/Wallet/index.d.ts +5 -0
- package/dist/browser/contexts/Wallet/index.d.ts.map +1 -0
- package/dist/browser/contexts/Wallet/use.d.ts +7 -0
- package/dist/browser/contexts/Wallet/use.d.ts.map +1 -0
- package/dist/browser/contexts/Wallet/usePromise.d.ts +8 -0
- package/dist/browser/contexts/Wallet/usePromise.d.ts.map +1 -0
- package/dist/browser/contexts/index.d.ts +3 -0
- package/dist/browser/contexts/index.d.ts.map +1 -0
- package/dist/browser/hooks/index.d.ts +5 -0
- package/dist/browser/hooks/index.d.ts.map +1 -0
- package/dist/browser/hooks/useAccount.d.ts +10 -0
- package/dist/browser/hooks/useAccount.d.ts.map +1 -0
- package/dist/browser/hooks/useWallet.d.ts +10 -0
- package/dist/browser/hooks/useWallet.d.ts.map +1 -0
- package/dist/browser/hooks/useWallets.d.ts +7 -0
- package/dist/browser/hooks/useWallets.d.ts.map +1 -0
- package/dist/browser/hooks/useWrapperAccount.d.ts +4 -0
- package/dist/browser/hooks/useWrapperAccount.d.ts.map +1 -0
- package/dist/browser/index.d.ts +4 -172
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +59 -53
- package/src/components/MaxAccounts/MaxAccountsTableRow.tsx +6 -2
- package/src/components/MaxAccounts/OutOfBoundsSnackBar.tsx +3 -1
- package/src/components/SeedPhrase/DefaultSeedPhrase.stories.tsx +5 -7
- package/src/components/SeedPhrase/DefaultSeedPhrase.tsx +6 -2
- package/src/components/SeedPhrase/_shared/SeedPhraseIconButton.tsx +1 -2
- package/src/components/SeedPhrase/dialog/SeedPhraseDialog.tsx +13 -4
- package/src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx +13 -3
- package/src/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.tsx +3 -1
- package/src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx +13 -3
- package/src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx +3 -1
- package/src/components/SeedPhrase/settings/SeedPhraseTableRow.stories.tsx +1 -3
- package/src/components/SeedPhrase/settings/SeedPhraseTableRow.tsx +6 -2
- package/src/components/WalletAccountDetails/WalletAccountDetails.stories.tsx +1 -5
- package/src/components/WalletAccountDetails/WalletAccountDetails.tsx +3 -1
- package/src/components/WalletAccountDetails/WalletAccountDetailsWithProvider.stories.tsx +1 -5
- package/src/components/WalletAccountSelect/Select.tsx +16 -3
- package/src/components/WalletAccountSelect/WalletAccountSelect.stories.tsx +4 -6
- package/src/components/WalletAccountSelect/WalletAccountSelectBar.stories.tsx +4 -6
- package/src/components/WalletAccountSelect/WalletAccountSelectWithProvider.stories.tsx +7 -7
- package/src/components/WalletAccountSelect/WalletInfo.tsx +27 -5
- package/src/contexts/SeedPhrase/Provider.tsx +7 -3
- package/src/contexts/Wallet/Provider.tsx +7 -3
- package/src/contexts/Wallet/usePromise.ts +3 -1
- package/src/hooks/useAccount.ts +6 -2
- package/src/hooks/useWallet.ts +3 -1
- package/xy.config.ts +1 -3
package/package.json
CHANGED
|
@@ -1,17 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-wallet",
|
|
3
|
+
"version": "3.0.3",
|
|
4
|
+
"description": "Common React library for all XYO projects that use React",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"xyo",
|
|
7
|
+
"utility",
|
|
8
|
+
"typescript",
|
|
9
|
+
"react"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://xyo.network",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues",
|
|
14
|
+
"email": "support@xyo.network"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "LGPL-3.0-only",
|
|
3
21
|
"author": {
|
|
4
|
-
"email": "support@xyo.network",
|
|
5
22
|
"name": "XYO Development Team",
|
|
23
|
+
"email": "support@xyo.network",
|
|
6
24
|
"url": "https://xyo.network"
|
|
7
25
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"type": "module",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/browser/index.d.ts",
|
|
32
|
+
"default": "./dist/browser/index.mjs"
|
|
33
|
+
},
|
|
34
|
+
"types": "./dist/browser/index.d.ts",
|
|
35
|
+
"default": "./dist/browser/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"module": "dist/browser/index.mjs",
|
|
40
|
+
"types": "dist/browser/index.d.ts",
|
|
41
|
+
"scripts": {
|
|
42
|
+
"license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\"",
|
|
43
|
+
"lint-pkg": "npmPkgJsonLint ."
|
|
11
44
|
},
|
|
12
45
|
"dependencies": {
|
|
13
46
|
"@scure/bip39": "^1.3.0",
|
|
14
|
-
"@xylabs/eth-address": "^4.0.
|
|
47
|
+
"@xylabs/eth-address": "^4.0.5",
|
|
15
48
|
"@xylabs/react-button": "^4.0.3",
|
|
16
49
|
"@xylabs/react-crypto": "^4.0.3",
|
|
17
50
|
"@xylabs/react-flexbox": "^4.0.3",
|
|
@@ -21,14 +54,28 @@
|
|
|
21
54
|
"@xylabs/react-quick-tip-button": "^4.0.3",
|
|
22
55
|
"@xylabs/react-select": "^4.0.3",
|
|
23
56
|
"@xylabs/react-shared": "^4.0.3",
|
|
24
|
-
"@xyo-network/account": "^3.0.
|
|
25
|
-
"@xyo-network/account-model": "^3.0.
|
|
26
|
-
"@xyo-network/react-address-render": "^3.0.
|
|
27
|
-
"@xyo-network/react-network": "^3.0.
|
|
28
|
-
"@xyo-network/react-shared": "^3.0.
|
|
29
|
-
"@xyo-network/wallet-model": "^3.0.
|
|
57
|
+
"@xyo-network/account": "^3.0.15",
|
|
58
|
+
"@xyo-network/account-model": "^3.0.15",
|
|
59
|
+
"@xyo-network/react-address-render": "^3.0.3",
|
|
60
|
+
"@xyo-network/react-network": "^3.0.3",
|
|
61
|
+
"@xyo-network/react-shared": "^3.0.3",
|
|
62
|
+
"@xyo-network/wallet-model": "^3.0.15",
|
|
30
63
|
"async-mutex": "^0.5.0"
|
|
31
64
|
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@mui/icons-material": "^5.16.7",
|
|
67
|
+
"@mui/material": "^5.16.7",
|
|
68
|
+
"@mui/styles": "^5.16.7",
|
|
69
|
+
"@storybook/react": "^8.2.9",
|
|
70
|
+
"@xylabs/ts-scripts-yarn3": "^4.0.7",
|
|
71
|
+
"@xylabs/tsconfig-react": "^4.0.7",
|
|
72
|
+
"@xyo-network/react-storybook": "^3.0.3",
|
|
73
|
+
"react": "^18.3.1",
|
|
74
|
+
"react-dom": "^18.3.1",
|
|
75
|
+
"react-router-dom": "^6.26.1",
|
|
76
|
+
"storybook": "^8.2.9",
|
|
77
|
+
"typescript": "^5.5.4"
|
|
78
|
+
},
|
|
32
79
|
"peerDependencies": {
|
|
33
80
|
"@mui/icons-material": "^5",
|
|
34
81
|
"@mui/material": "^5",
|
|
@@ -36,49 +83,8 @@
|
|
|
36
83
|
"react": "^18",
|
|
37
84
|
"react-dom": "^18"
|
|
38
85
|
},
|
|
39
|
-
"description": "Common React library for all XYO projects that use React",
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@storybook/react": "^8.2.9",
|
|
42
|
-
"@xylabs/ts-scripts-yarn3": "^4.0.0-rc.20",
|
|
43
|
-
"@xylabs/tsconfig-react": "^4.0.0-rc.20",
|
|
44
|
-
"@xyo-network/react-storybook": "^3.0.2",
|
|
45
|
-
"react-router-dom": "^6.26.1",
|
|
46
|
-
"typescript": "^5.5.4"
|
|
47
|
-
},
|
|
48
|
-
"docs": "dist/docs.json",
|
|
49
|
-
"exports": {
|
|
50
|
-
".": {
|
|
51
|
-
"import": {
|
|
52
|
-
"types": "./dist/browser/index.d.ts",
|
|
53
|
-
"default": "./dist/browser/index.mjs"
|
|
54
|
-
},
|
|
55
|
-
"types": "./dist/browser/index.d.ts",
|
|
56
|
-
"default": "./dist/browser/index.mjs"
|
|
57
|
-
},
|
|
58
|
-
"./package.json": "./package.json"
|
|
59
|
-
},
|
|
60
|
-
"module": "dist/browser/index.mjs",
|
|
61
|
-
"homepage": "https://xyo.network",
|
|
62
|
-
"keywords": [
|
|
63
|
-
"xyo",
|
|
64
|
-
"utility",
|
|
65
|
-
"typescript",
|
|
66
|
-
"react"
|
|
67
|
-
],
|
|
68
|
-
"license": "LGPL-3.0-only",
|
|
69
86
|
"publishConfig": {
|
|
70
87
|
"access": "public"
|
|
71
88
|
},
|
|
72
|
-
"
|
|
73
|
-
"type": "git",
|
|
74
|
-
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
|
75
|
-
},
|
|
76
|
-
"scripts": {
|
|
77
|
-
"lint-pkg": "npmPkgJsonLint .",
|
|
78
|
-
"license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\""
|
|
79
|
-
},
|
|
80
|
-
"sideEffects": false,
|
|
81
|
-
"types": "dist/browser/index.d.ts",
|
|
82
|
-
"version": "3.0.2",
|
|
83
|
-
"type": "module"
|
|
89
|
+
"docs": "dist/docs.json"
|
|
84
90
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { TableRowProps } from '@mui/material'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ButtonGroup, TableCell, TableRow, Typography,
|
|
4
|
+
} from '@mui/material'
|
|
3
5
|
import { ButtonEx } from '@xylabs/react-button'
|
|
4
6
|
import React, { useState } from 'react'
|
|
5
7
|
|
|
@@ -11,7 +13,9 @@ export interface MaxAccountsTableRow extends TableRowProps {
|
|
|
11
13
|
maxAccounts?: number
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
export const MaxAccountsTableRow: React.FC<MaxAccountsTableRow> = ({
|
|
16
|
+
export const MaxAccountsTableRow: React.FC<MaxAccountsTableRow> = ({
|
|
17
|
+
activeAccountIndex, changeMaxAccounts, maxAccounts,
|
|
18
|
+
}) => {
|
|
15
19
|
const [desiredMaximumAccounts, setDesiredMaximumAccounts] = useState<number | undefined>()
|
|
16
20
|
const [showSnackBar, setShowSnackBar] = useState(false)
|
|
17
21
|
|
|
@@ -11,14 +11,10 @@ export default {
|
|
|
11
11
|
const Template: StoryFn<typeof DefaultSeedPhrase> = props => <DefaultSeedPhrase {...props} />
|
|
12
12
|
|
|
13
13
|
const Default = Template.bind({})
|
|
14
|
-
Default.args = {
|
|
15
|
-
seedPhrase: 'test me',
|
|
16
|
-
}
|
|
14
|
+
Default.args = { seedPhrase: 'test me' }
|
|
17
15
|
|
|
18
16
|
const WithoutDefaultSeedPhrase = Template.bind({})
|
|
19
|
-
WithoutDefaultSeedPhrase.args = {
|
|
20
|
-
changeSeedPhrase: (mnemonic?: string) => alert(`Generated Default Seed Phrase: ${mnemonic}`),
|
|
21
|
-
}
|
|
17
|
+
WithoutDefaultSeedPhrase.args = { changeSeedPhrase: (mnemonic?: string) => alert(`Generated Default Seed Phrase: ${mnemonic}`) }
|
|
22
18
|
|
|
23
19
|
const WithHiddenDefaultSeedPhrase = Template.bind({})
|
|
24
20
|
WithHiddenDefaultSeedPhrase.args = {
|
|
@@ -26,4 +22,6 @@ WithHiddenDefaultSeedPhrase.args = {
|
|
|
26
22
|
...WithoutDefaultSeedPhrase.args,
|
|
27
23
|
}
|
|
28
24
|
|
|
29
|
-
export {
|
|
25
|
+
export {
|
|
26
|
+
Default, WithHiddenDefaultSeedPhrase, WithoutDefaultSeedPhrase,
|
|
27
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Alert, AlertTitle, Snackbar,
|
|
3
|
+
} from '@mui/material'
|
|
2
4
|
import { generateMnemonic } from '@scure/bip39'
|
|
3
5
|
// eslint-disable-next-line import-x/no-internal-modules
|
|
4
6
|
import { wordlist } from '@scure/bip39/wordlists/english'
|
|
@@ -11,7 +13,9 @@ export interface DefaultSeedPhraseProps extends WithChildren {
|
|
|
11
13
|
seedPhrase?: string
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
export const DefaultSeedPhrase: React.FC<DefaultSeedPhraseProps> = ({
|
|
16
|
+
export const DefaultSeedPhrase: React.FC<DefaultSeedPhraseProps> = ({
|
|
17
|
+
changeSeedPhrase, children, hideDefaultSeedPhraseMessage, seedPhrase,
|
|
18
|
+
}) => {
|
|
15
19
|
const [showSnackBar, setShowSnackBar] = useState(false)
|
|
16
20
|
|
|
17
21
|
useEffect(() => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { DialogProps } from '@mui/material'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Dialog, DialogContent, DialogTitle, FormLabel,
|
|
4
|
+
} from '@mui/material'
|
|
3
5
|
import React from 'react'
|
|
4
6
|
|
|
5
7
|
import { SeedPhraseProvider, useSeedPhrase } from '../../../contexts/index.ts'
|
|
@@ -18,7 +20,9 @@ export interface SeedPhraseDialogProps extends DialogProps {
|
|
|
18
20
|
seedPhrase?: string
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
export const SeedPhraseDialog: React.FC<SeedPhraseDialogProps> = ({
|
|
23
|
+
export const SeedPhraseDialog: React.FC<SeedPhraseDialogProps> = ({
|
|
24
|
+
changeSeedPhrase, seedPhrase, ...props
|
|
25
|
+
}) => {
|
|
22
26
|
return (
|
|
23
27
|
<SeedPhraseProvider
|
|
24
28
|
seedPhrase={seedPhrase}
|
|
@@ -32,7 +36,9 @@ export const SeedPhraseDialog: React.FC<SeedPhraseDialogProps> = ({ changeSeedPh
|
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
export const SeedPhraseDialogInner: React.FC<SeedPhraseDialogProps> = (props) => {
|
|
35
|
-
const {
|
|
39
|
+
const {
|
|
40
|
+
overwriteWarning, seedPhrase, validPhrase,
|
|
41
|
+
} = useSeedPhrase()
|
|
36
42
|
|
|
37
43
|
return (
|
|
38
44
|
<Dialog aria-labelledby="alert-dialog-title" aria-describedby="alert-dialog-description" fullWidth maxWidth="sm" {...props}>
|
|
@@ -41,7 +47,10 @@ export const SeedPhraseDialogInner: React.FC<SeedPhraseDialogProps> = (props) =>
|
|
|
41
47
|
{' '}
|
|
42
48
|
<SeedPhraseIconButton />
|
|
43
49
|
</DialogTitle>
|
|
44
|
-
<DialogContent sx={{
|
|
50
|
+
<DialogContent sx={{
|
|
51
|
+
display: 'flex', flexDirection: 'column', rowGap: 2,
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
45
54
|
<NewPhraseTextField>
|
|
46
55
|
<FormLabel>
|
|
47
56
|
<PhraseHeaderBox conditional={validPhrase}>New Seed Phrase</PhraseHeaderBox>
|
|
@@ -11,11 +11,21 @@ export interface NewPhraseTextFieldProps extends StandardTextFieldProps {
|
|
|
11
11
|
disableColor?: boolean
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const NewPhraseTextField: React.FC<NewPhraseTextFieldProps> = ({
|
|
15
|
-
|
|
14
|
+
export const NewPhraseTextField: React.FC<NewPhraseTextFieldProps> = ({
|
|
15
|
+
children, disableColor, ...props
|
|
16
|
+
}) => {
|
|
17
|
+
const {
|
|
18
|
+
phrase, setPhrase, validPhrase,
|
|
19
|
+
} = useSeedPhrase()
|
|
16
20
|
return (
|
|
17
21
|
<>
|
|
18
|
-
<FormControl
|
|
22
|
+
<FormControl
|
|
23
|
+
fullWidth
|
|
24
|
+
size="small"
|
|
25
|
+
sx={{
|
|
26
|
+
display: 'flex', flexDirection: 'column', rowGap: 1,
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
19
29
|
{children}
|
|
20
30
|
<TextField
|
|
21
31
|
focused
|
|
@@ -4,7 +4,9 @@ import React from 'react'
|
|
|
4
4
|
import { useSeedPhrase } from '../../../../../contexts/index.ts'
|
|
5
5
|
|
|
6
6
|
export const PhraseDialogActions = () => {
|
|
7
|
-
const {
|
|
7
|
+
const {
|
|
8
|
+
handleClear, handleGenerate, overwriteWarning,
|
|
9
|
+
} = useSeedPhrase()
|
|
8
10
|
return (
|
|
9
11
|
<DialogActions sx={{ justifyContent: 'center' }}>
|
|
10
12
|
<Button disabled={overwriteWarning} variant="outlined" onClick={handleGenerate}>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { StandardTextFieldProps } from '@mui/material'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Chip, FormControl, FormLabel, TextField,
|
|
4
|
+
} from '@mui/material'
|
|
3
5
|
import React, { useState } from 'react'
|
|
4
6
|
|
|
5
7
|
import { useSeedPhrase } from '../../../../../contexts/index.ts'
|
|
@@ -10,13 +12,21 @@ export interface SavedPhraseTextFieldProps extends StandardTextFieldProps {
|
|
|
10
12
|
showPhraseHeader?: boolean
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
export const SavedPhraseTextField: React.FC<SavedPhraseTextFieldProps> = ({
|
|
15
|
+
export const SavedPhraseTextField: React.FC<SavedPhraseTextFieldProps> = ({
|
|
16
|
+
fullWidth, showPhraseHeader, ...props
|
|
17
|
+
}) => {
|
|
14
18
|
const { validSeedPhrase, seedPhrase } = useSeedPhrase()
|
|
15
19
|
|
|
16
20
|
const [visible, setVisible] = useState(false)
|
|
17
21
|
|
|
18
22
|
return (
|
|
19
|
-
<FormControl
|
|
23
|
+
<FormControl
|
|
24
|
+
fullWidth={fullWidth}
|
|
25
|
+
size="small"
|
|
26
|
+
sx={{
|
|
27
|
+
display: 'flex', flexDirection: 'column', rowGap: 1,
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
20
30
|
<Chip
|
|
21
31
|
label={visible ? 'Hide Saved Seed Phrase' : 'Reveal Saved Seed Phrase'}
|
|
22
32
|
onClick={() => setVisible(!visible)}
|
package/src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx
CHANGED
|
@@ -8,7 +8,9 @@ interface PhraseHeaderBox extends FlexBoxProps, WithChildren {
|
|
|
8
8
|
conditional?: boolean | null
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const PhraseHeaderBox: React.FC<PhraseHeaderBox> = ({
|
|
11
|
+
export const PhraseHeaderBox: React.FC<PhraseHeaderBox> = ({
|
|
12
|
+
children, conditional, ...props
|
|
13
|
+
}) => {
|
|
12
14
|
const state = useMemo(() => {
|
|
13
15
|
switch (conditional) {
|
|
14
16
|
case true: {
|
|
@@ -20,9 +20,7 @@ const Template: StoryFn<typeof SeedPhraseTableRow> = props => (
|
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
const Default = Template.bind({})
|
|
23
|
-
Default.args = {
|
|
24
|
-
changeSeedPhrase,
|
|
25
|
-
}
|
|
23
|
+
Default.args = { changeSeedPhrase }
|
|
26
24
|
|
|
27
25
|
const WithSeedPhrase = Template.bind({})
|
|
28
26
|
WithSeedPhrase.args = {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Cancel as CancelIcon, RadioButtonChecked as RadioButtonCheckedIcon } from '@mui/icons-material'
|
|
2
2
|
import type { TableRowProps } from '@mui/material'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Button, ButtonGroup, TableCell, TableRow,
|
|
5
|
+
} from '@mui/material'
|
|
4
6
|
import React, { useState } from 'react'
|
|
5
7
|
|
|
6
8
|
import { SeedPhraseIconButton } from '../_shared/index.ts'
|
|
@@ -11,7 +13,9 @@ export interface SeedPhraseTableRowProps extends TableRowProps {
|
|
|
11
13
|
seedPhrase?: string
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
export const SeedPhraseTableRow: React.FC<SeedPhraseTableRowProps> = ({
|
|
16
|
+
export const SeedPhraseTableRow: React.FC<SeedPhraseTableRowProps> = ({
|
|
17
|
+
changeSeedPhrase, seedPhrase, ...props
|
|
18
|
+
}) => {
|
|
15
19
|
const [open, setOpen] = useState(false)
|
|
16
20
|
|
|
17
21
|
const handleOpen = () => {
|
|
@@ -7,11 +7,7 @@ import { WalletAccountDetails } from './WalletAccountDetails.tsx'
|
|
|
7
7
|
const StorybookEntry = {
|
|
8
8
|
argTypes: {},
|
|
9
9
|
component: WalletAccountDetails,
|
|
10
|
-
parameters: {
|
|
11
|
-
docs: {
|
|
12
|
-
page: null,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
10
|
+
parameters: { docs: { page: null } },
|
|
15
11
|
title: 'wallet/WalletAccountDetails',
|
|
16
12
|
} as Meta<typeof WalletAccountDetails>
|
|
17
13
|
|
|
@@ -14,7 +14,9 @@ export interface WalletAccountDetailsProps extends FlexBoxProps {
|
|
|
14
14
|
exploreUrl?: string
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export const WalletAccountDetails: React.FC<WalletAccountDetailsProps> = ({
|
|
17
|
+
export const WalletAccountDetails: React.FC<WalletAccountDetailsProps> = ({
|
|
18
|
+
exploreUrl = 'https://explore.xyo.network', account, ...props
|
|
19
|
+
}) => {
|
|
18
20
|
const [accountToUse] = useAccount({ account })
|
|
19
21
|
const { network } = useNetwork()
|
|
20
22
|
const exploreAddressUrl = `${exploreUrl}/recent?account=${accountToUse?.address}&network=${network?.name ?? 'main'}`
|
|
@@ -10,11 +10,7 @@ import { WalletAccountDetails } from './WalletAccountDetails.tsx'
|
|
|
10
10
|
const StorybookEntry = {
|
|
11
11
|
argTypes: {},
|
|
12
12
|
component: WalletAccountDetails,
|
|
13
|
-
parameters: {
|
|
14
|
-
docs: {
|
|
15
|
-
page: null,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
13
|
+
parameters: { docs: { page: null } },
|
|
18
14
|
title: 'wallet/WalletAccountDetailsWithProvider',
|
|
19
15
|
} as Meta<typeof WalletAccountDetails>
|
|
20
16
|
|
|
@@ -32,7 +32,9 @@ export const WalletAccountSelect: React.FC<WalletAccountSelectProps> = ({
|
|
|
32
32
|
variant = 'outlined',
|
|
33
33
|
...props
|
|
34
34
|
}) => {
|
|
35
|
-
const {
|
|
35
|
+
const {
|
|
36
|
+
activeAccountIndex = 0, setActiveAccountIndex, rootWallet,
|
|
37
|
+
} = useWalletContext()
|
|
36
38
|
const disabled = !rootWallet || activeAccountIndex === undefined
|
|
37
39
|
|
|
38
40
|
return (
|
|
@@ -49,7 +51,12 @@ export const WalletAccountSelect: React.FC<WalletAccountSelectProps> = ({
|
|
|
49
51
|
const customName = selectedAccount ? addressNames?.[selectedAccount.address] : undefined
|
|
50
52
|
const favorite = !!selectedAccount && selectedAccount.address in (addressNames ?? {})
|
|
51
53
|
return (
|
|
52
|
-
<MenuItem
|
|
54
|
+
<MenuItem
|
|
55
|
+
value={selectedAccountIndex}
|
|
56
|
+
sx={{
|
|
57
|
+
minHeight: 0, paddingBottom: 0, paddingTop: 0,
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
53
60
|
<AddressRenderRowBox
|
|
54
61
|
disableSharedRef={true}
|
|
55
62
|
flexGrow={1}
|
|
@@ -79,7 +86,13 @@ export const WalletAccountSelect: React.FC<WalletAccountSelectProps> = ({
|
|
|
79
86
|
const customName = account ? addressNames?.[account.address] : undefined
|
|
80
87
|
const favorite = !!account && account.address in (addressNames ?? {})
|
|
81
88
|
return (
|
|
82
|
-
<MenuItem
|
|
89
|
+
<MenuItem
|
|
90
|
+
key={account?.address}
|
|
91
|
+
value={index}
|
|
92
|
+
sx={{
|
|
93
|
+
minHeight: 0, paddingBottom: 0, paddingTop: 0,
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
83
96
|
<AddressRenderRowBox
|
|
84
97
|
disableSharedRef={true}
|
|
85
98
|
flexGrow={1}
|
|
@@ -4,17 +4,15 @@ import React from 'react'
|
|
|
4
4
|
|
|
5
5
|
import { WalletAccountSelect } from './Select.tsx'
|
|
6
6
|
import { WalletProviderDecorator } from './stories/index.ts'
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
AccountInfo, RootWalletInfo, SelectedWalletInfo, WalletInfo,
|
|
9
|
+
} from './WalletInfo.tsx'
|
|
8
10
|
|
|
9
11
|
const StorybookEntry = {
|
|
10
12
|
argTypes: {},
|
|
11
13
|
component: WalletAccountSelect,
|
|
12
14
|
decorators: [WalletProviderDecorator],
|
|
13
|
-
parameters: {
|
|
14
|
-
docs: {
|
|
15
|
-
page: null,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
15
|
+
parameters: { docs: { page: null } },
|
|
18
16
|
title: 'wallet/WalletAccountSelect',
|
|
19
17
|
} as Meta<typeof WalletAccountSelect>
|
|
20
18
|
|
|
@@ -12,11 +12,7 @@ const StorybookEntry = {
|
|
|
12
12
|
argTypes: {},
|
|
13
13
|
component: WalletAccountSelectBar,
|
|
14
14
|
decorators: [WalletProviderDecorator],
|
|
15
|
-
parameters: {
|
|
16
|
-
docs: {
|
|
17
|
-
page: null,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
15
|
+
parameters: { docs: { page: null } },
|
|
20
16
|
title: 'wallet/WalletAccountSelectBar',
|
|
21
17
|
} as Meta<typeof WalletAccountSelectBar>
|
|
22
18
|
|
|
@@ -60,6 +56,8 @@ WithAdditionalAccounts.args = { icons: true, maxAccounts: 10 }
|
|
|
60
56
|
|
|
61
57
|
const WithAccountFavorites = WithFavoritesTemplate.bind({})
|
|
62
58
|
|
|
63
|
-
export {
|
|
59
|
+
export {
|
|
60
|
+
Default, WithAccountFavorites, WithAdditionalAccounts, WithWallet, WithWalletIcon,
|
|
61
|
+
}
|
|
64
62
|
|
|
65
63
|
export default StorybookEntry
|
|
@@ -8,11 +8,7 @@ const StorybookEntry = {
|
|
|
8
8
|
argTypes: {},
|
|
9
9
|
component: WalletAccountSelect,
|
|
10
10
|
decorators: [WalletProviderDecorator],
|
|
11
|
-
parameters: {
|
|
12
|
-
docs: {
|
|
13
|
-
page: null,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
11
|
+
parameters: { docs: { page: null } },
|
|
16
12
|
title: 'wallet/WalletAccountSelectWithProvider',
|
|
17
13
|
} as Meta<typeof WalletAccountSelect>
|
|
18
14
|
|
|
@@ -36,8 +32,12 @@ const IconsOnly = Template.bind({})
|
|
|
36
32
|
IconsOnly.args = { iconOnly: true, icons: true }
|
|
37
33
|
|
|
38
34
|
const IconsOnlySmall = Template.bind({})
|
|
39
|
-
IconsOnlySmall.args = {
|
|
35
|
+
IconsOnlySmall.args = {
|
|
36
|
+
iconOnly: true, icons: true, size: 'small',
|
|
37
|
+
}
|
|
40
38
|
|
|
41
|
-
export {
|
|
39
|
+
export {
|
|
40
|
+
Default, DefaultIcons, DefaultSmall, DefaultSmallIcon, IconsOnly, IconsOnlySmall,
|
|
41
|
+
}
|
|
42
42
|
|
|
43
43
|
export default StorybookEntry
|
|
@@ -17,10 +17,15 @@ export const WalletError: React.FC<WalletErrorProps> = ({ error }) => {
|
|
|
17
17
|
return error
|
|
18
18
|
? (
|
|
19
19
|
<div>
|
|
20
|
-
<ErrorIcon
|
|
20
|
+
<ErrorIcon
|
|
21
|
+
style={{ fontSize: '12px', position: 'absolute' }}
|
|
22
|
+
color="error"
|
|
23
|
+
/>
|
|
21
24
|
<QuickTipButton
|
|
22
25
|
size="small"
|
|
23
|
-
style={{
|
|
26
|
+
style={{
|
|
27
|
+
color: '#ffffff00', fontSize: '12px', padding: 0, position: 'absolute',
|
|
28
|
+
}}
|
|
24
29
|
hoverText={error.message}
|
|
25
30
|
disableDialog
|
|
26
31
|
/>
|
|
@@ -38,11 +43,28 @@ export const WalletIdenticon: React.FC<WalletIdenticonProps> = ({ account, name
|
|
|
38
43
|
return (
|
|
39
44
|
<div style={{ width: 20 }}>
|
|
40
45
|
{account
|
|
41
|
-
?
|
|
42
|
-
|
|
46
|
+
? (
|
|
47
|
+
<Identicon
|
|
48
|
+
size={8}
|
|
49
|
+
value={account.address}
|
|
50
|
+
style={{
|
|
51
|
+
position: 'absolute', right: 2, top: 2,
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
)
|
|
55
|
+
: (
|
|
56
|
+
<LoadingIcon
|
|
57
|
+
style={{
|
|
58
|
+
fontSize: '10px', padding: 0, position: 'absolute', right: 2, top: 2,
|
|
59
|
+
}}
|
|
60
|
+
color="disabled"
|
|
61
|
+
/>
|
|
62
|
+
)}
|
|
43
63
|
<QuickTipButton
|
|
44
64
|
size="small"
|
|
45
|
-
style={{
|
|
65
|
+
style={{
|
|
66
|
+
color: '#ffffff00', fontSize: '12px', padding: 0, position: 'absolute',
|
|
67
|
+
}}
|
|
46
68
|
hoverText={`${name ?? ''}: ${account?.address ?? 'no address'}`}
|
|
47
69
|
disableDialog
|
|
48
70
|
/>
|
|
@@ -2,7 +2,9 @@ import { generateMnemonic, validateMnemonic } from '@scure/bip39'
|
|
|
2
2
|
// eslint-disable-next-line import-x/no-internal-modules
|
|
3
3
|
import { wordlist } from '@scure/bip39/wordlists/english'
|
|
4
4
|
import type { WithChildren } from '@xylabs/react-shared'
|
|
5
|
-
import React, {
|
|
5
|
+
import React, {
|
|
6
|
+
useCallback, useEffect, useMemo, useState,
|
|
7
|
+
} from 'react'
|
|
6
8
|
|
|
7
9
|
import { SeedPhraseContext } from './Context.ts'
|
|
8
10
|
|
|
@@ -75,7 +77,8 @@ export const SeedPhraseProvider: React.FC<SeedPhraseProviderProps> = ({
|
|
|
75
77
|
const validSeedPhrase = useMemo(() => validate?.(seedPhrase), [seedPhrase])
|
|
76
78
|
const validPhrase = useMemo(() => validate?.(phrase), [phrase])
|
|
77
79
|
|
|
78
|
-
const value = useMemo(() => ({
|
|
80
|
+
const value = useMemo(() => ({
|
|
81
|
+
handleCancelOverwrite,
|
|
79
82
|
handleChangeSeedPhrase,
|
|
80
83
|
handleClear,
|
|
81
84
|
handleGenerate,
|
|
@@ -88,7 +91,8 @@ export const SeedPhraseProvider: React.FC<SeedPhraseProviderProps> = ({
|
|
|
88
91
|
setPhrase,
|
|
89
92
|
validPhrase,
|
|
90
93
|
validSeedPhrase,
|
|
91
|
-
validate
|
|
94
|
+
validate,
|
|
95
|
+
}), [handleCancelOverwrite,
|
|
92
96
|
handleChangeSeedPhrase,
|
|
93
97
|
handleClear,
|
|
94
98
|
handleGenerate,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { usePromise } from '@xylabs/react-promise'
|
|
2
2
|
import type { WithChildren } from '@xylabs/react-shared'
|
|
3
3
|
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
4
|
-
import React, {
|
|
4
|
+
import React, {
|
|
5
|
+
useEffect, useMemo, useState,
|
|
6
|
+
} from 'react'
|
|
5
7
|
|
|
6
8
|
import { WalletContext } from './Context.ts'
|
|
7
9
|
|
|
@@ -26,11 +28,13 @@ export const WalletProvider: React.FC<WithChildren<WalletProviderProps>> = ({
|
|
|
26
28
|
|
|
27
29
|
const [activeAccount = null] = usePromise(async () => await rootWallet?.derivePath(activeAccountIndex.toString()), [activeAccountIndex, rootWallet])
|
|
28
30
|
|
|
29
|
-
const value = useMemo(() => ({
|
|
31
|
+
const value = useMemo(() => ({
|
|
32
|
+
activeAccount,
|
|
30
33
|
activeAccountIndex,
|
|
31
34
|
provided: true,
|
|
32
35
|
rootWallet,
|
|
33
|
-
setActiveAccountIndex
|
|
36
|
+
setActiveAccountIndex,
|
|
37
|
+
}), [activeAccount,
|
|
34
38
|
activeAccountIndex,
|
|
35
39
|
rootWallet,
|
|
36
40
|
setActiveAccountIndex])
|