Remove stray log (#4270)
* Remove stray log * Display numbers as available
This commit is contained in:
parent
e093e2f277
commit
e6eaaec27d
@ -52,7 +52,7 @@ function expandInfo ({ exposure, validatorPrefs }: ValidatorInfo): StakingState
|
||||
let stakeOther: BN | undefined;
|
||||
let stakeOwn: BN | undefined;
|
||||
|
||||
if (exposure) {
|
||||
if (exposure && exposure.total) {
|
||||
nominators = exposure.others.map(({ value, who }) => ({ nominatorId: who.toString(), value: value.unwrap() }));
|
||||
stakeTotal = exposure.total.unwrap();
|
||||
stakeOwn = exposure.own.unwrap();
|
||||
|
||||
@ -49,7 +49,7 @@ function Summary ({ className = '', isVisible, stakingOverview, targets: { infla
|
||||
{nominators.length}
|
||||
</CardSummary>
|
||||
)}
|
||||
{(inflation > 0) && (
|
||||
{(inflation > 0) && Number.isFinite(inflation) && (
|
||||
<CardSummary
|
||||
className='media--1200'
|
||||
label={t<string>('inflation')}
|
||||
|
||||
@ -86,7 +86,7 @@ function Summary ({ avgStaked, lowStaked, numNominators, numValidators, stakedRe
|
||||
/>
|
||||
</div>
|
||||
</CardSummary>
|
||||
{(stakedReturn > 0) && (
|
||||
{(stakedReturn > 0) && Number.isFinite(stakedReturn) && (
|
||||
<CardSummary
|
||||
className='media--1200'
|
||||
label={t<string>('returns')}
|
||||
@ -97,7 +97,7 @@ function Summary ({ avgStaked, lowStaked, numNominators, numValidators, stakedRe
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
{avgStaked && lowStaked && (
|
||||
{avgStaked?.gtn(0) && lowStaked?.gtn(0) && (
|
||||
<CardSummary
|
||||
className='media--1000'
|
||||
label={`${t<string>('lowest / avg staked')}`}
|
||||
|
||||
@ -46,9 +46,9 @@ interface ValidatorInfoRank {
|
||||
export interface ValidatorInfo extends ValidatorInfoRank {
|
||||
accountId: AccountId;
|
||||
bondOther: BN;
|
||||
bondOwn: Balance;
|
||||
bondOwn: BN;
|
||||
bondShare: number;
|
||||
bondTotal: Balance;
|
||||
bondTotal: BN;
|
||||
commissionPer: number;
|
||||
exposure: Exposure;
|
||||
isActive: boolean;
|
||||
|
||||
@ -84,9 +84,10 @@ function extractSingle (api: ApiPromise, allAccounts: string[], derive: DeriveSt
|
||||
const emptyExposure = api.createType('Exposure');
|
||||
const earliestEra = historyDepth && lastEra.sub(historyDepth).addn(1);
|
||||
const list = derive.info.map(({ accountId, exposure = emptyExposure, stakingLedger, validatorPrefs }): ValidatorInfo => {
|
||||
// some overrides (e.g. Darwinia Crab) does not have the own field in Exposure
|
||||
let bondOwn = exposure.own?.unwrap() || BN_ZERO;
|
||||
let bondTotal = exposure.total?.unwrap() || BN_ZERO;
|
||||
// some overrides (e.g. Darwinia Crab) does not have the own/total field in Exposure
|
||||
let [bondOwn, bondTotal] = exposure.total
|
||||
? [exposure.own.unwrap(), exposure.total.unwrap()]
|
||||
: [BN_ZERO, BN_ZERO];
|
||||
const skipRewards = bondTotal.isZero();
|
||||
|
||||
if (bondTotal.isZero()) {
|
||||
@ -182,8 +183,6 @@ function extractInfo (api: ApiPromise, allAccounts: string[], electedDerive: Der
|
||||
const waitingIds = waiting.map(({ key }) => key);
|
||||
const validatorIds = arrayFlatten([electedIds, waitingIds]);
|
||||
|
||||
console.log(JSON.stringify(validators.filter(({ isElected }) => !isElected), null, 2));
|
||||
|
||||
return {
|
||||
avgStaked,
|
||||
inflation,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user