Display derive errors (#4326)
This commit is contained in:
parent
6da62c2de0
commit
36832470b5
@ -33,6 +33,10 @@ interface LockState {
|
||||
}
|
||||
|
||||
function deriveValidate (suri: string, pairType: KeypairType): string | null {
|
||||
if (suri.includes('///')) {
|
||||
return 'Password paths are not supported on keys derived from others';
|
||||
}
|
||||
|
||||
try {
|
||||
const { path } = keyExtractPath(suri);
|
||||
|
||||
@ -41,6 +45,8 @@ function deriveValidate (suri: string, pairType: KeypairType): string | null {
|
||||
return 'Soft derivation paths are not allowed on ed25519';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
return (error as Error).message;
|
||||
}
|
||||
|
||||
@ -216,11 +222,14 @@ function Derive ({ className = '', from, onClose }: Props): React.ReactElement {
|
||||
{sourceStatic}
|
||||
<Input
|
||||
autoFocus
|
||||
help={t<string>('You can set a custom derivation path for this account using the following syntax "/<soft-key>//<hard-key>///<password>". The "/<soft-key>" and "//<hard-key>" may be repeated and mixed`. The "///password" is optional and should only occur once.')}
|
||||
help={t<string>('You can set a custom derivation path for this account using the following syntax "/<soft-key>//<hard-key>///<password>". The "/<soft-key>" and "//<hard-key>" may be repeated and mixed`.')}
|
||||
label={t<string>('derivation path')}
|
||||
onChange={setSuri}
|
||||
placeholder={t<string>('//hard/soft')}
|
||||
/>
|
||||
{deriveError && (
|
||||
<article className='error'>{deriveError}</article>
|
||||
)}
|
||||
<Input
|
||||
className='full'
|
||||
help={t<string>('Name given to this account. You can edit it. To use the account to validate or nominate, it is a good practice to append the function of the account in the name, e.g "name_you_want - stash".')}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user