Pass small commission (1 PerBill) (#2815)

* Pass small commission (1 unit)

* Bump API
This commit is contained in:
Jaco Greeff 2020-05-26 15:45:06 +02:00 committed by GitHub
parent f73edae4a8
commit 11d54e734a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,9 +28,18 @@ function Validate ({ className = '', controllerId, onChange, stashId, withSender
const { api } = useApi();
const _setCommission = useCallback(
(commission?: BN) => onChange({
validateTx: api.tx.staking.validate({ commission: (commission || ZERO).mul(COMM_MUL) })
}),
(value?: BN): void => {
const commission = (value || ZERO).mul(COMM_MUL);
onChange({
validateTx: api.tx.staking.validate({
commission: commission.isZero()
// small non-zero set to avoid isEmpty
? 1
: commission
})
});
},
[api, onChange]
);