diff --git a/packages/app-staking/src/Actions/Account/Validate.tsx b/packages/app-staking/src/Actions/Account/Validate.tsx index 8464975ae73c..a05be2d8cf87 100644 --- a/packages/app-staking/src/Actions/Account/Validate.tsx +++ b/packages/app-staking/src/Actions/Account/Validate.tsx @@ -35,34 +35,35 @@ class Validate extends TxComponent { validatorPayment: new BN(0) }; + // FIXME Borken with new InputBalance // inject the preferences returned via RPC once into the state (from this // point forward it will be entirely managed by the actual inputs) - public static getDerivedStateFromProps ({ isSubstrateV2, validatorPrefs }: Props, state: State): Pick | null { - if (state.unstakeThreshold && state.validatorPayment) { - return null; - } - - if (validatorPrefs) { - // 1.x, it has both values - if (isSubstrateV2) { - const { validatorPayment } = validatorPrefs as ValidatorPrefs; - - return { - validatorPayment: validatorPayment.toBn() - }; - } else { - const { unstakeThreshold, validatorPayment } = validatorPrefs as ValidatorPrefs0to145; - - return { - unstakeThreshold: unstakeThreshold.toBn(), - unstakeThresholdError: null, - validatorPayment: validatorPayment.toBn() - }; - } - } - - return null; - } + // public static getDerivedStateFromProps ({ isSubstrateV2, validatorPrefs }: Props, state: State): Pick | null { + // if (state.unstakeThreshold && state.validatorPayment) { + // return null; + // } + + // if (validatorPrefs) { + // // 1.x, it has both values + // if (isSubstrateV2) { + // const { validatorPayment } = validatorPrefs as ValidatorPrefs; + + // return { + // validatorPayment: validatorPayment.toBn() + // }; + // } else { + // const { unstakeThreshold, validatorPayment } = validatorPrefs as ValidatorPrefs0to145; + + // return { + // unstakeThreshold: unstakeThreshold.toBn(), + // unstakeThresholdError: null, + // validatorPayment: validatorPayment.toBn() + // }; + // } + // } + + // return null; + // } public render (): React.ReactNode { const { isOpen } = this.props; @@ -120,7 +121,7 @@ class Validate extends TxComponent { private renderContent (): React.ReactNode { const { controllerId, isSubstrateV2, stashId, t, validatorPrefs } = this.props; - const { unstakeThreshold, unstakeThresholdError, validatorPayment } = this.state; + const { unstakeThreshold, unstakeThresholdError } = this.state; const defaultThreshold = validatorPrefs && (validatorPrefs as ValidatorPrefs0to145).unstakeThreshold && (validatorPrefs as ValidatorPrefs0to145).unstakeThreshold.toBn(); return ( @@ -153,11 +154,6 @@ class Validate extends TxComponent { label={t('automatic unstake threshold')} onChange={this.onChangeThreshold} onEnter={this.sendTx} - value={ - unstakeThreshold - ? unstakeThreshold.toString() - : '3' - } /> { )}