Align comm percentage display (#2402)

This commit is contained in:
Jaco Greeff 2020-03-17 09:29:34 +01:00 committed by GitHub
parent f4867ee7f3
commit b21008af1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 5 deletions

View File

@ -56,7 +56,7 @@ function expandInfo ({ controllerId, exposure, nextSessionIds, validatorPrefs }:
return {
commission: commission
? `${(commission.toNumber() / 10000000).toFixed(2)}%`
? `${(commission.toNumber() / 10_000_000).toFixed(2)}%`
: undefined,
controllerId: controllerId?.toString(),
nominators,

View File

@ -135,7 +135,7 @@ function extractInfo (allAccounts: string[], amount: BN = new BN(0), electedInfo
isFavorite: favorites.includes(key),
isNominating,
key,
commissionPer: (((prefs as ValidatorPrefs).commission?.unwrap() || new BN(0)).muln(10000).div(PERBILL).toNumber() / 100),
commissionPer: (((prefs as ValidatorPrefs).commission?.unwrap() || new BN(0)).toNumber() / 10_000_000),
numNominators: exposure.others.length,
rankBondOther: 0,
rankBondOwn: 0,

View File

@ -42,8 +42,6 @@ export interface ValidatorPrefsType {
validatorPayment?: boolean;
}
const PERBILL = new BN(1000000000);
interface Props extends BareProps {
address: string;
balancesAll?: DerivedBalancesAll;
@ -229,7 +227,7 @@ function renderValidatorPrefs ({ stakingInfo, withValidatorPrefs = false }: Prop
: (
<>
<Label label={t('commission')} />
<span>{(stakingInfo.validatorPrefs.commission.unwrap().muln(10000).div(PERBILL).toNumber() / 100).toFixed(2)}%</span>
<span>{(stakingInfo.validatorPrefs.commission.unwrap().toNumber() / 10_000_000).toFixed(2)}%</span>
</>
)
)}