Fix bonding errors

This commit is contained in:
Jaco Greeff 2020-05-15 20:41:34 +02:00
parent 483aade2e8
commit 1171fe6dfb
2 changed files with 5 additions and 2 deletions

View File

@ -40,15 +40,16 @@ function ValidateController ({ accountId, controllerId, defaultController, onErr
// this applies when changing controller
if (defaultController !== controllerId) {
let newError: string | null = null;
let isFatal = true;
let isFatal = false;
if (bondedId) {
isFatal = true;
newError = t('A controller account should not map to another stash. This selected controller is a stash, controlled by {{bondedId}}', { replace: { bondedId } });
} else if (stashId) {
isFatal = true;
newError = t('A controller account should not be set to manages multiple stashes. The selected controller is already controlling {{stashId}}', { replace: { stashId } });
} else if (controllerId === accountId) {
newError = t('Distinct stash and controller accounts are recommended to ensure fund security. You will be allowed to make the transaction, but take care to not tie up all funds, only use a portion of the available funds during this period.');
isFatal = false;
}
onError(newError, isFatal);

View File

@ -49,8 +49,10 @@ function Bond ({ className, onChange }: Props): React.ReactElement<Props> {
stashId
}
: {
bondOwnTx: null,
bondTx: null,
controllerId: null,
controllerTx: null,
stashId: null
}
);