@xyo-network/react-wallet 3.0.1 → 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 +68 -62
- package/src/components/MaxAccounts/MaxAccountsTableRow.tsx +7 -2
- package/src/components/MaxAccounts/OutOfBoundsSnackBar.tsx +6 -2
- package/src/components/SeedPhrase/DefaultSeedPhrase.stories.tsx +6 -8
- package/src/components/SeedPhrase/DefaultSeedPhrase.tsx +7 -3
- package/src/components/SeedPhrase/_shared/SeedPhraseIconButton.tsx +1 -1
- package/src/components/SeedPhrase/dialog/SeedPhraseDialog.stories.tsx +1 -1
- package/src/components/SeedPhrase/dialog/SeedPhraseDialog.tsx +14 -4
- package/src/components/SeedPhrase/dialog/components/DialogActionButtons.tsx +4 -2
- package/src/components/SeedPhrase/dialog/components/fields/NewPhraseTextField.tsx +17 -5
- package/src/components/SeedPhrase/dialog/components/fields/PhraseDialogActions.tsx +3 -1
- package/src/components/SeedPhrase/dialog/components/fields/SavedPhraseTextField.tsx +14 -3
- package/src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx +2 -1
- package/src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx +6 -3
- package/src/components/SeedPhrase/settings/SeedPhraseTableRow.stories.tsx +2 -4
- package/src/components/SeedPhrase/settings/SeedPhraseTableRow.tsx +7 -2
- package/src/components/WalletAccountDetails/WalletAccountDetails.stories.tsx +2 -6
- package/src/components/WalletAccountDetails/WalletAccountDetails.tsx +6 -3
- package/src/components/WalletAccountDetails/WalletAccountDetailsWithProvider.stories.tsx +2 -6
- package/src/components/WalletAccountSelect/Select.tsx +20 -5
- package/src/components/WalletAccountSelect/SelectBar.tsx +2 -1
- package/src/components/WalletAccountSelect/WalletAccountSelect.stories.tsx +5 -7
- package/src/components/WalletAccountSelect/WalletAccountSelectBar.stories.tsx +6 -8
- package/src/components/WalletAccountSelect/WalletAccountSelectWithProvider.stories.tsx +8 -8
- package/src/components/WalletAccountSelect/WalletInfo.tsx +30 -7
- package/src/components/WalletAccountSelect/stories/WalletProviderDecorator.tsx +1 -1
- package/src/contexts/SeedPhrase/Context.ts +1 -1
- package/src/contexts/SeedPhrase/Provider.tsx +8 -4
- package/src/contexts/SeedPhrase/State.ts +2 -2
- package/src/contexts/Wallet/Context.ts +1 -1
- package/src/contexts/Wallet/Provider.tsx +9 -5
- package/src/contexts/Wallet/State.ts +3 -3
- package/src/contexts/Wallet/use.ts +1 -1
- package/src/contexts/Wallet/usePromise.ts +4 -1
- package/src/hooks/useAccount.ts +8 -4
- package/src/hooks/useWallet.ts +4 -2
- package/src/hooks/useWallets.ts +1 -1
- package/src/hooks/useWrapperAccount.ts +4 -3
- package/xy.config.ts +2 -4
package/package.json
CHANGED
|
@@ -1,51 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-wallet",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
|
|
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",
|
|
8
12
|
"bugs": {
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@scure/bip39": "^1.3.0",
|
|
14
|
-
"@xylabs/eth-address": "^4.0.1",
|
|
15
|
-
"@xylabs/react-button": "^4.0.1",
|
|
16
|
-
"@xylabs/react-crypto": "^4.0.1",
|
|
17
|
-
"@xylabs/react-flexbox": "^4.0.1",
|
|
18
|
-
"@xylabs/react-identicon": "^4.0.1",
|
|
19
|
-
"@xylabs/react-number-status": "^4.0.1",
|
|
20
|
-
"@xylabs/react-promise": "^4.0.1",
|
|
21
|
-
"@xylabs/react-quick-tip-button": "^4.0.1",
|
|
22
|
-
"@xylabs/react-select": "^4.0.1",
|
|
23
|
-
"@xylabs/react-shared": "^4.0.1",
|
|
24
|
-
"@xyo-network/account": "^3.0.2",
|
|
25
|
-
"@xyo-network/account-model": "^3.0.2",
|
|
26
|
-
"@xyo-network/react-address-render": "^3.0.1",
|
|
27
|
-
"@xyo-network/react-network": "^3.0.1",
|
|
28
|
-
"@xyo-network/react-shared": "^3.0.1",
|
|
29
|
-
"@xyo-network/wallet-model": "^3.0.2",
|
|
30
|
-
"async-mutex": "^0.5.0"
|
|
13
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues",
|
|
14
|
+
"email": "support@xyo.network"
|
|
31
15
|
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"@mui/styles": "^5",
|
|
36
|
-
"react": "^18",
|
|
37
|
-
"react-dom": "^18"
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
|
38
19
|
},
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"@xyo-network/react-storybook": "^3.0.1",
|
|
45
|
-
"react-router-dom": "^6.26.0",
|
|
46
|
-
"typescript": "^5.5.4"
|
|
20
|
+
"license": "LGPL-3.0-only",
|
|
21
|
+
"author": {
|
|
22
|
+
"name": "XYO Development Team",
|
|
23
|
+
"email": "support@xyo.network",
|
|
24
|
+
"url": "https://xyo.network"
|
|
47
25
|
},
|
|
48
|
-
"
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"type": "module",
|
|
49
28
|
"exports": {
|
|
50
29
|
".": {
|
|
51
30
|
"import": {
|
|
@@ -58,27 +37,54 @@
|
|
|
58
37
|
"./package.json": "./package.json"
|
|
59
38
|
},
|
|
60
39
|
"module": "dist/browser/index.mjs",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"typescript",
|
|
66
|
-
"react"
|
|
67
|
-
],
|
|
68
|
-
"license": "LGPL-3.0-only",
|
|
69
|
-
"publishConfig": {
|
|
70
|
-
"access": "public"
|
|
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 ."
|
|
71
44
|
},
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@scure/bip39": "^1.3.0",
|
|
47
|
+
"@xylabs/eth-address": "^4.0.5",
|
|
48
|
+
"@xylabs/react-button": "^4.0.3",
|
|
49
|
+
"@xylabs/react-crypto": "^4.0.3",
|
|
50
|
+
"@xylabs/react-flexbox": "^4.0.3",
|
|
51
|
+
"@xylabs/react-identicon": "^4.0.3",
|
|
52
|
+
"@xylabs/react-number-status": "^4.0.3",
|
|
53
|
+
"@xylabs/react-promise": "^4.0.3",
|
|
54
|
+
"@xylabs/react-quick-tip-button": "^4.0.3",
|
|
55
|
+
"@xylabs/react-select": "^4.0.3",
|
|
56
|
+
"@xylabs/react-shared": "^4.0.3",
|
|
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",
|
|
63
|
+
"async-mutex": "^0.5.0"
|
|
75
64
|
},
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
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"
|
|
79
78
|
},
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"@mui/icons-material": "^5",
|
|
81
|
+
"@mui/material": "^5",
|
|
82
|
+
"@mui/styles": "^5",
|
|
83
|
+
"react": "^18",
|
|
84
|
+
"react-dom": "^18"
|
|
85
|
+
},
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"access": "public"
|
|
88
|
+
},
|
|
89
|
+
"docs": "dist/docs.json"
|
|
84
90
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TableRowProps } from '@mui/material'
|
|
2
|
+
import {
|
|
3
|
+
ButtonGroup, TableCell, TableRow, Typography,
|
|
4
|
+
} from '@mui/material'
|
|
2
5
|
import { ButtonEx } from '@xylabs/react-button'
|
|
3
6
|
import React, { useState } from 'react'
|
|
4
7
|
|
|
@@ -10,7 +13,9 @@ export interface MaxAccountsTableRow extends TableRowProps {
|
|
|
10
13
|
maxAccounts?: number
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
export const MaxAccountsTableRow: React.FC<MaxAccountsTableRow> = ({
|
|
16
|
+
export const MaxAccountsTableRow: React.FC<MaxAccountsTableRow> = ({
|
|
17
|
+
activeAccountIndex, changeMaxAccounts, maxAccounts,
|
|
18
|
+
}) => {
|
|
14
19
|
const [desiredMaximumAccounts, setDesiredMaximumAccounts] = useState<number | undefined>()
|
|
15
20
|
const [showSnackBar, setShowSnackBar] = useState(false)
|
|
16
21
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { SnackbarProps } from '@mui/material'
|
|
2
|
+
import {
|
|
3
|
+
Alert, AlertTitle, Snackbar,
|
|
4
|
+
} from '@mui/material'
|
|
5
|
+
import type { Dispatch, SetStateAction } from 'react'
|
|
6
|
+
import React from 'react'
|
|
3
7
|
|
|
4
8
|
export interface OutOfBoundsSnackBarProps extends SnackbarProps {
|
|
5
9
|
activeAccountIndex?: number
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
import { DefaultSeedPhrase } from './DefaultSeedPhrase.tsx'
|
|
@@ -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,8 +1,10 @@
|
|
|
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'
|
|
5
|
-
import { WithChildren } from '@xylabs/react-shared'
|
|
7
|
+
import type { WithChildren } from '@xylabs/react-shared'
|
|
6
8
|
import React, { useEffect, useState } from 'react'
|
|
7
9
|
|
|
8
10
|
export interface DefaultSeedPhraseProps extends WithChildren {
|
|
@@ -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,4 +1,5 @@
|
|
|
1
1
|
import { HelpOutline as HelpOutlineIcon } from '@mui/icons-material'
|
|
2
|
+
import type { IconButtonProps } from '@mui/material'
|
|
2
3
|
import {
|
|
3
4
|
Button,
|
|
4
5
|
Dialog,
|
|
@@ -6,7 +7,6 @@ import {
|
|
|
6
7
|
DialogContent,
|
|
7
8
|
DialogTitle,
|
|
8
9
|
IconButton,
|
|
9
|
-
IconButtonProps,
|
|
10
10
|
Link,
|
|
11
11
|
List,
|
|
12
12
|
ListItem,
|
|
@@ -2,7 +2,7 @@ import { Button, Typography } from '@mui/material'
|
|
|
2
2
|
import { generateMnemonic } from '@scure/bip39'
|
|
3
3
|
// eslint-disable-next-line import-x/no-internal-modules
|
|
4
4
|
import { wordlist } from '@scure/bip39/wordlists/english'
|
|
5
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
5
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
6
6
|
import { FlexCol } from '@xylabs/react-flexbox'
|
|
7
7
|
import React, { useState } from 'react'
|
|
8
8
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DialogProps } from '@mui/material'
|
|
2
|
+
import {
|
|
3
|
+
Dialog, DialogContent, DialogTitle, FormLabel,
|
|
4
|
+
} from '@mui/material'
|
|
2
5
|
import React from 'react'
|
|
3
6
|
|
|
4
7
|
import { SeedPhraseProvider, useSeedPhrase } from '../../../contexts/index.ts'
|
|
@@ -17,7 +20,9 @@ export interface SeedPhraseDialogProps extends DialogProps {
|
|
|
17
20
|
seedPhrase?: string
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
export const SeedPhraseDialog: React.FC<SeedPhraseDialogProps> = ({
|
|
23
|
+
export const SeedPhraseDialog: React.FC<SeedPhraseDialogProps> = ({
|
|
24
|
+
changeSeedPhrase, seedPhrase, ...props
|
|
25
|
+
}) => {
|
|
21
26
|
return (
|
|
22
27
|
<SeedPhraseProvider
|
|
23
28
|
seedPhrase={seedPhrase}
|
|
@@ -31,7 +36,9 @@ export const SeedPhraseDialog: React.FC<SeedPhraseDialogProps> = ({ changeSeedPh
|
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
export const SeedPhraseDialogInner: React.FC<SeedPhraseDialogProps> = (props) => {
|
|
34
|
-
const {
|
|
39
|
+
const {
|
|
40
|
+
overwriteWarning, seedPhrase, validPhrase,
|
|
41
|
+
} = useSeedPhrase()
|
|
35
42
|
|
|
36
43
|
return (
|
|
37
44
|
<Dialog aria-labelledby="alert-dialog-title" aria-describedby="alert-dialog-description" fullWidth maxWidth="sm" {...props}>
|
|
@@ -40,7 +47,10 @@ export const SeedPhraseDialogInner: React.FC<SeedPhraseDialogProps> = (props) =>
|
|
|
40
47
|
{' '}
|
|
41
48
|
<SeedPhraseIconButton />
|
|
42
49
|
</DialogTitle>
|
|
43
|
-
<DialogContent sx={{
|
|
50
|
+
<DialogContent sx={{
|
|
51
|
+
display: 'flex', flexDirection: 'column', rowGap: 2,
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
44
54
|
<NewPhraseTextField>
|
|
45
55
|
<FormLabel>
|
|
46
56
|
<PhraseHeaderBox conditional={validPhrase}>New Seed Phrase</PhraseHeaderBox>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { DialogActionsProps, DialogProps } from '@mui/material'
|
|
2
|
+
import { Button, DialogActions } from '@mui/material'
|
|
3
|
+
import type { MouseEvent } from 'react'
|
|
4
|
+
import React from 'react'
|
|
3
5
|
|
|
4
6
|
import { useSeedPhrase } from '../../../../contexts/index.ts'
|
|
5
7
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { StandardTextFieldProps } from '@mui/material'
|
|
2
|
+
import { FormControl, TextField } from '@mui/material'
|
|
3
|
+
import type { ReactNode } from 'react'
|
|
4
|
+
import React from 'react'
|
|
3
5
|
|
|
4
6
|
import { useSeedPhrase } from '../../../../../contexts/index.ts'
|
|
5
7
|
import { colorParser, InvalidPhraseTypography } from './validation-messages/index.ts'
|
|
@@ -9,11 +11,21 @@ export interface NewPhraseTextFieldProps extends StandardTextFieldProps {
|
|
|
9
11
|
disableColor?: boolean
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
export const NewPhraseTextField: React.FC<NewPhraseTextFieldProps> = ({
|
|
13
|
-
|
|
14
|
+
export const NewPhraseTextField: React.FC<NewPhraseTextFieldProps> = ({
|
|
15
|
+
children, disableColor, ...props
|
|
16
|
+
}) => {
|
|
17
|
+
const {
|
|
18
|
+
phrase, setPhrase, validPhrase,
|
|
19
|
+
} = useSeedPhrase()
|
|
14
20
|
return (
|
|
15
21
|
<>
|
|
16
|
-
<FormControl
|
|
22
|
+
<FormControl
|
|
23
|
+
fullWidth
|
|
24
|
+
size="small"
|
|
25
|
+
sx={{
|
|
26
|
+
display: 'flex', flexDirection: 'column', rowGap: 1,
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
17
29
|
{children}
|
|
18
30
|
<TextField
|
|
19
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,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { StandardTextFieldProps } from '@mui/material'
|
|
2
|
+
import {
|
|
3
|
+
Chip, FormControl, FormLabel, TextField,
|
|
4
|
+
} from '@mui/material'
|
|
2
5
|
import React, { useState } from 'react'
|
|
3
6
|
|
|
4
7
|
import { useSeedPhrase } from '../../../../../contexts/index.ts'
|
|
@@ -9,13 +12,21 @@ export interface SavedPhraseTextFieldProps extends StandardTextFieldProps {
|
|
|
9
12
|
showPhraseHeader?: boolean
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
export const SavedPhraseTextField: React.FC<SavedPhraseTextFieldProps> = ({
|
|
15
|
+
export const SavedPhraseTextField: React.FC<SavedPhraseTextFieldProps> = ({
|
|
16
|
+
fullWidth, showPhraseHeader, ...props
|
|
17
|
+
}) => {
|
|
13
18
|
const { validSeedPhrase, seedPhrase } = useSeedPhrase()
|
|
14
19
|
|
|
15
20
|
const [visible, setVisible] = useState(false)
|
|
16
21
|
|
|
17
22
|
return (
|
|
18
|
-
<FormControl
|
|
23
|
+
<FormControl
|
|
24
|
+
fullWidth={fullWidth}
|
|
25
|
+
size="small"
|
|
26
|
+
sx={{
|
|
27
|
+
display: 'flex', flexDirection: 'column', rowGap: 1,
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
19
30
|
<Chip
|
|
20
31
|
label={visible ? 'Hide Saved Seed Phrase' : 'Reveal Saved Seed Phrase'}
|
|
21
32
|
onClick={() => setVisible(!visible)}
|
package/src/components/SeedPhrase/dialog/components/fields/validation-messages/InvalidPhrase.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TypographyProps } from '@mui/material'
|
|
2
|
+
import { Link, Typography } from '@mui/material'
|
|
2
3
|
import React from 'react'
|
|
3
4
|
|
|
4
5
|
export const InvalidPhraseTypography: React.FC<TypographyProps> = props => (
|
package/src/components/SeedPhrase/dialog/components/fields/validation-messages/PhraseHeaderBox.tsx
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { CheckCircleOutline as CheckCircleOutlineIcon, HighlightOff as HighlightOffIcon } from '@mui/icons-material'
|
|
2
|
-
import { FlexBoxProps
|
|
3
|
-
import {
|
|
2
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
3
|
+
import { FlexRow } from '@xylabs/react-flexbox'
|
|
4
|
+
import type { WithChildren } from '@xylabs/react-shared'
|
|
4
5
|
import React, { useMemo } from 'react'
|
|
5
6
|
|
|
6
7
|
interface PhraseHeaderBox extends FlexBoxProps, WithChildren {
|
|
7
8
|
conditional?: boolean | null
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
export const PhraseHeaderBox: React.FC<PhraseHeaderBox> = ({
|
|
11
|
+
export const PhraseHeaderBox: React.FC<PhraseHeaderBox> = ({
|
|
12
|
+
children, conditional, ...props
|
|
13
|
+
}) => {
|
|
11
14
|
const state = useMemo(() => {
|
|
12
15
|
switch (conditional) {
|
|
13
16
|
case true: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Table, TableBody } from '@mui/material'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
5
5
|
import { SeedPhraseTableRow } from './SeedPhraseTableRow.tsx'
|
|
@@ -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,5 +1,8 @@
|
|
|
1
1
|
import { Cancel as CancelIcon, RadioButtonChecked as RadioButtonCheckedIcon } from '@mui/icons-material'
|
|
2
|
-
import {
|
|
2
|
+
import type { TableRowProps } from '@mui/material'
|
|
3
|
+
import {
|
|
4
|
+
Button, ButtonGroup, TableCell, TableRow,
|
|
5
|
+
} from '@mui/material'
|
|
3
6
|
import React, { useState } from 'react'
|
|
4
7
|
|
|
5
8
|
import { SeedPhraseIconButton } from '../_shared/index.ts'
|
|
@@ -10,7 +13,9 @@ export interface SeedPhraseTableRowProps extends TableRowProps {
|
|
|
10
13
|
seedPhrase?: string
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
export const SeedPhraseTableRow: React.FC<SeedPhraseTableRowProps> = ({
|
|
16
|
+
export const SeedPhraseTableRow: React.FC<SeedPhraseTableRowProps> = ({
|
|
17
|
+
changeSeedPhrase, seedPhrase, ...props
|
|
18
|
+
}) => {
|
|
14
19
|
const [open, setOpen] = useState(false)
|
|
15
20
|
|
|
16
21
|
const handleOpen = () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { BrowserRouter } from 'react-router-dom'
|
|
4
4
|
|
|
@@ -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
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { EthAddress } from '@xylabs/eth-address'
|
|
2
2
|
import { EthAccountButton } from '@xylabs/react-crypto'
|
|
3
|
-
import { FlexBoxProps
|
|
3
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
|
4
|
+
import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
|
|
4
5
|
import { NumberStatus } from '@xylabs/react-number-status'
|
|
5
6
|
import { useNetwork } from '@xyo-network/react-network'
|
|
6
|
-
import { WalletInstance } from '@xyo-network/wallet-model'
|
|
7
|
+
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
7
8
|
import React from 'react'
|
|
8
9
|
|
|
9
10
|
import { useAccount } from '../../hooks/index.ts'
|
|
@@ -13,7 +14,9 @@ export interface WalletAccountDetailsProps extends FlexBoxProps {
|
|
|
13
14
|
exploreUrl?: string
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
export const WalletAccountDetails: React.FC<WalletAccountDetailsProps> = ({
|
|
17
|
+
export const WalletAccountDetails: React.FC<WalletAccountDetailsProps> = ({
|
|
18
|
+
exploreUrl = 'https://explore.xyo.network', account, ...props
|
|
19
|
+
}) => {
|
|
17
20
|
const [accountToUse] = useAccount({ account })
|
|
18
21
|
const { network } = useNetwork()
|
|
19
22
|
const exploreAddressUrl = `${exploreUrl}/recent?account=${accountToUse?.address}&network=${network?.name ?? 'main'}`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
2
|
import { DefaultSeedPhrase } from '@xyo-network/react-storybook'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { BrowserRouter } from 'react-router-dom'
|
|
@@ -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
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SelectProps } from '@mui/material'
|
|
2
|
+
import { CircularProgress, MenuItem } from '@mui/material'
|
|
2
3
|
import { SelectEx } from '@xylabs/react-select'
|
|
3
|
-
import {
|
|
4
|
+
import type { AddressRenderRowBoxProps } from '@xyo-network/react-address-render'
|
|
5
|
+
import { AddressRenderRowBox } from '@xyo-network/react-address-render'
|
|
4
6
|
import React from 'react'
|
|
5
7
|
|
|
6
8
|
import { useWalletContext } from '../../contexts/index.ts'
|
|
@@ -30,7 +32,9 @@ export const WalletAccountSelect: React.FC<WalletAccountSelectProps> = ({
|
|
|
30
32
|
variant = 'outlined',
|
|
31
33
|
...props
|
|
32
34
|
}) => {
|
|
33
|
-
const {
|
|
35
|
+
const {
|
|
36
|
+
activeAccountIndex = 0, setActiveAccountIndex, rootWallet,
|
|
37
|
+
} = useWalletContext()
|
|
34
38
|
const disabled = !rootWallet || activeAccountIndex === undefined
|
|
35
39
|
|
|
36
40
|
return (
|
|
@@ -47,7 +51,12 @@ export const WalletAccountSelect: React.FC<WalletAccountSelectProps> = ({
|
|
|
47
51
|
const customName = selectedAccount ? addressNames?.[selectedAccount.address] : undefined
|
|
48
52
|
const favorite = !!selectedAccount && selectedAccount.address in (addressNames ?? {})
|
|
49
53
|
return (
|
|
50
|
-
<MenuItem
|
|
54
|
+
<MenuItem
|
|
55
|
+
value={selectedAccountIndex}
|
|
56
|
+
sx={{
|
|
57
|
+
minHeight: 0, paddingBottom: 0, paddingTop: 0,
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
51
60
|
<AddressRenderRowBox
|
|
52
61
|
disableSharedRef={true}
|
|
53
62
|
flexGrow={1}
|
|
@@ -77,7 +86,13 @@ export const WalletAccountSelect: React.FC<WalletAccountSelectProps> = ({
|
|
|
77
86
|
const customName = account ? addressNames?.[account.address] : undefined
|
|
78
87
|
const favorite = !!account && account.address in (addressNames ?? {})
|
|
79
88
|
return (
|
|
80
|
-
<MenuItem
|
|
89
|
+
<MenuItem
|
|
90
|
+
key={account?.address}
|
|
91
|
+
value={index}
|
|
92
|
+
sx={{
|
|
93
|
+
minHeight: 0, paddingBottom: 0, paddingTop: 0,
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
81
96
|
<AddressRenderRowBox
|
|
82
97
|
disableSharedRef={true}
|
|
83
98
|
flexGrow={1}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { Stack } from '@mui/material'
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
3
3
|
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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react'
|
|
2
|
-
import { WalletInstance } from '@xyo-network/wallet-model'
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
|
2
|
+
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
5
5
|
import { useWallets } from '../../hooks/index.ts'
|
|
@@ -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
|