From b21008af1a8e1fce500a66e5be54e828a2f6a4d5 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 17 Mar 2020 09:29:34 +0100 Subject: [PATCH] Align comm percentage display (#2402) --- packages/page-staking/src/Overview/Address.tsx | 2 +- packages/page-staking/src/Targets/index.tsx | 2 +- packages/react-components/src/AddressInfo.tsx | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/page-staking/src/Overview/Address.tsx b/packages/page-staking/src/Overview/Address.tsx index e8e542a4e5..bb575f145a 100644 --- a/packages/page-staking/src/Overview/Address.tsx +++ b/packages/page-staking/src/Overview/Address.tsx @@ -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, diff --git a/packages/page-staking/src/Targets/index.tsx b/packages/page-staking/src/Targets/index.tsx index ddcb6969f2..5b8e91abbc 100644 --- a/packages/page-staking/src/Targets/index.tsx +++ b/packages/page-staking/src/Targets/index.tsx @@ -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, diff --git a/packages/react-components/src/AddressInfo.tsx b/packages/react-components/src/AddressInfo.tsx index 9dbe0f9530..cc58e6d547 100644 --- a/packages/react-components/src/AddressInfo.tsx +++ b/packages/react-components/src/AddressInfo.tsx @@ -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 : ( <>