Cater for Ledger 25 word mnemonics (#6380)
This commit is contained in:
parent
d17c92caf3
commit
ba974c720c
16
package.json
16
package.json
@ -14,15 +14,15 @@
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^6.4.3-7",
|
||||
"@polkadot/api-contract": "^6.4.3-7",
|
||||
"@polkadot/hw-ledger": "^7.5.1",
|
||||
"@polkadot/keyring": "^7.5.1",
|
||||
"@polkadot/networks": "^7.5.1",
|
||||
"@polkadot/phishing": "^0.6.365",
|
||||
"@polkadot/hw-ledger": "^7.6.1",
|
||||
"@polkadot/keyring": "^7.6.1",
|
||||
"@polkadot/networks": "^7.6.1",
|
||||
"@polkadot/phishing": "^0.6.374",
|
||||
"@polkadot/types": "^6.4.3-7",
|
||||
"@polkadot/types-known": "^6.4.3-7",
|
||||
"@polkadot/types-support": "^6.4.3-7",
|
||||
"@polkadot/util": "^7.5.1",
|
||||
"@polkadot/util-crypto": "^7.5.1",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/util-crypto": "^7.6.1",
|
||||
"@polkadot/wasm-crypto": "^4.2.1",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"styled-components": "^5.3.1",
|
||||
@ -73,8 +73,8 @@
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@crustio/crust-pin": "^1.0.0",
|
||||
"@pinata/sdk": "^1.1.23",
|
||||
"@polkadot/dev": "^0.63.5",
|
||||
"@polkadot/ts": "^0.4.9",
|
||||
"@polkadot/dev": "^0.63.6",
|
||||
"@polkadot/ts": "^0.4.10",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"@types/chart.js": "^2.9.34",
|
||||
"@types/file-saver": "^2.0.3",
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
"@metaverse-network-sdk/type-definitions": "^0.0.1-6",
|
||||
"@parallel-finance/type-definitions": "1.3.4",
|
||||
"@phala/typedefs": "0.2.29",
|
||||
"@polkadot/networks": "^7.5.1",
|
||||
"@polkadot/networks": "^7.6.1",
|
||||
"@polymathnetwork/polymesh-types": "0.0.2",
|
||||
"@snowfork/snowbridge-types": "0.2.6",
|
||||
"@sora-substrate/type-definitions": "1.6.14",
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.15.8",
|
||||
"@babel/polyfill": "^7.12.1",
|
||||
"@polkadot/dev": "^0.63.5",
|
||||
"@polkadot/dev": "^0.63.6",
|
||||
"@polkadot/react-components": "^0.97.2-17",
|
||||
"electron-log": "^4.4.1",
|
||||
"electron-updater": "^4.6.1"
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/apps-config": "^0.97.2-17",
|
||||
"@polkadot/apps-routing": "^0.97.2-17",
|
||||
"@polkadot/dev": "^0.63.5",
|
||||
"@polkadot/dev": "^0.63.6",
|
||||
"@polkadot/react-api": "^0.97.2-17",
|
||||
"@polkadot/react-components": "^0.97.2-17",
|
||||
"@polkadot/react-hooks": "^0.97.2-17",
|
||||
|
||||
@ -6,9 +6,9 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@polkadot/phishing": "^0.6.365",
|
||||
"@polkadot/phishing": "^0.6.374",
|
||||
"@polkadot/react-components": "^0.97.2-17",
|
||||
"@polkadot/vanitygen": "^0.47.4",
|
||||
"@polkadot/vanitygen": "^0.47.5-0",
|
||||
"detect-browser": "^5.2.1",
|
||||
"file-saver": "^2.0.5"
|
||||
},
|
||||
|
||||
@ -107,9 +107,21 @@ function generateSeed (_seed: string | undefined | null, derivePath: string, see
|
||||
function updateAddress (seed: string, derivePath: string, seedType: SeedType, pairType: PairType): AddressState {
|
||||
let address: string | null = null;
|
||||
let deriveValidation: DeriveValidationOutput = deriveValidate(seed, seedType, derivePath, pairType);
|
||||
let isSeedValid = seedType === 'raw'
|
||||
? rawValidate(seed)
|
||||
: mnemonicValidate(seed);
|
||||
let isSeedValid = false;
|
||||
|
||||
if (seedType === 'raw') {
|
||||
isSeedValid = rawValidate(seed);
|
||||
} else {
|
||||
const words = seed.split(' ');
|
||||
|
||||
if (pairType === 'ed25519-ledger' && words.length === 25) {
|
||||
words.pop();
|
||||
|
||||
isSeedValid = mnemonicValidate(words.join(' '));
|
||||
} else {
|
||||
isSeedValid = mnemonicValidate(seed);
|
||||
}
|
||||
}
|
||||
|
||||
if (!deriveValidation?.error && isSeedValid) {
|
||||
try {
|
||||
@ -151,8 +163,8 @@ function Create ({ className = '', onClose, onStatusChange, seed: propsSeed, typ
|
||||
const [isMnemonicSaved, setIsMnemonicSaved] = useState<boolean>(false);
|
||||
const [step, nextStep, prevStep] = useStepper();
|
||||
const [isBusy, setIsBusy] = useState(false);
|
||||
const [{ isNameValid, name }, setName] = useState({ isNameValid: false, name: '' });
|
||||
const [{ isPasswordValid, password }, setPassword] = useState({ isPasswordValid: false, password: '' });
|
||||
const [{ isNameValid, name }, setName] = useState(() => ({ isNameValid: false, name: '' }));
|
||||
const [{ isPasswordValid, password }, setPassword] = useState(() => ({ isPasswordValid: false, password: '' }));
|
||||
const isFirstStepValid = !!address && isMnemonicSaved && !deriveValidation?.error && isSeedValid;
|
||||
const isSecondStepValid = isNameValid && isPasswordValid;
|
||||
const isValid = isFirstStepValid && isSecondStepValid;
|
||||
|
||||
@ -9,15 +9,15 @@
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.36",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.15.4",
|
||||
"@fortawesome/react-fontawesome": "^0.1.16",
|
||||
"@polkadot/keyring": "^7.5.1",
|
||||
"@polkadot/keyring": "^7.6.1",
|
||||
"@polkadot/react-api": "^0.97.2-17",
|
||||
"@polkadot/react-identicon": "^0.86.2-1",
|
||||
"@polkadot/react-qr": "^0.86.2-1",
|
||||
"@polkadot/react-query": "^0.97.2-17",
|
||||
"@polkadot/ui-keyring": "^0.86.2-1",
|
||||
"@polkadot/ui-settings": "^0.86.2-1",
|
||||
"@polkadot/util": "^7.5.1",
|
||||
"@polkadot/util-crypto": "^7.5.1",
|
||||
"@polkadot/util": "^7.6.1",
|
||||
"@polkadot/util-crypto": "^7.6.1",
|
||||
"chart.js": "^2.9.4",
|
||||
"codeflask": "^1.4.1",
|
||||
"i18next": "^19.9.2",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user