Strengten identicon checks (#1856)
This commit is contained in:
parent
9600d3a563
commit
ce3bb182ad
@ -1,9 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
// Copyright 2017-2019 @polkadot/react-components authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { DeriveStakingValidators } from '@polkadot/api-derive/types';
|
||||
import { AccountId } from '@polkadot/types/interfaces';
|
||||
import { IdentityProps } from '@polkadot/react-identicon/types';
|
||||
import { I18nProps } from './types';
|
||||
@ -41,9 +39,11 @@ function IdentityIcon ({ className, onCopy, prefix, size, style, t, theme, valid
|
||||
const thisTheme = theme || getIdentityTheme(systemName);
|
||||
|
||||
useEffect((): void => {
|
||||
const address = value?.toString();
|
||||
|
||||
setIsValidator(
|
||||
validators
|
||||
? validators.some((validator): boolean => validator.eq(value))
|
||||
? validators.some((validator): boolean => validator.toString() === address)
|
||||
: false
|
||||
);
|
||||
}, [validators, value]);
|
||||
@ -78,7 +78,7 @@ export default withMulti(
|
||||
withCalls<Props>(
|
||||
['derive.staking.validators', {
|
||||
propName: 'validators',
|
||||
transform: ({ validators }): DeriveStakingValidators => validators
|
||||
transform: ({ validators }): AccountId[] => validators
|
||||
}]
|
||||
)
|
||||
);
|
||||
|
||||
@ -37,9 +37,9 @@ function BlockAuthors ({ children }: Props): React.ReactElement<Props> {
|
||||
let lastBlockNumber = '';
|
||||
|
||||
api.derive.chain.subscribeNewHeads((lastHeader): void => {
|
||||
if (lastHeader && lastHeader.number) {
|
||||
if (lastHeader?.number) {
|
||||
const blockNumber = lastHeader.number.unwrap();
|
||||
const thisBlockAuthor = lastHeader.author ? lastHeader.author.toString() : undefined;
|
||||
const thisBlockAuthor = lastHeader.author?.toString();
|
||||
const thisBlockNumber = formatNumber(blockNumber);
|
||||
|
||||
if (thisBlockAuthor) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user