Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Commit

Permalink
fix: yarn lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry authored and sunnygleason committed Jul 19, 2019
1 parent ff24235 commit 1cf7921
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
20 changes: 15 additions & 5 deletions api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ app.get('/cluster-info', (req, res) => {

async function fetchValidatorAvatars(keybaseUsernames) {
const avatarMap = new Map();
let batch = keybaseUsernames.splice(0, MAX_KEYBASE_USER_LOOKUP)
let batch = keybaseUsernames.splice(0, MAX_KEYBASE_USER_LOOKUP);
while (batch.length > 0) {
const usernames = batch.join(',');
const keybaseApiUrl = `https://keybase.io/_/api/1.0/user/lookup.json?usernames=${usernames}&fields=pictures,basics`;
Expand All @@ -577,12 +577,18 @@ async function fetchValidatorAvatars(keybaseUsernames) {
const keybaseData = await keybaseResponse.json();
if (keybaseData && keybaseData.them) {
for (const {basics, pictures} of keybaseData.them) {
if (basics && basics.username && pictures && pictures.primary && pictures.primary.url) {
if (
basics &&
basics.username &&
pictures &&
pictures.primary &&
pictures.primary.url
) {
avatarMap.set(basics.username, pictures.primary.url);
}
}
}
} catch(err) {
} catch (err) {
// Skip failed batch
}
// Prepare next batch
Expand All @@ -601,7 +607,9 @@ async function fetchValidatorIdentities(keys) {
accounts.map(async account => {
let validatorInfo;
try {
validatorInfo = solanaWeb3.ValidatorInfo.fromConfigData(account[1].data);
validatorInfo = solanaWeb3.ValidatorInfo.fromConfigData(
account[1].data,
);
} catch (err) {
return;
}
Expand All @@ -628,7 +636,9 @@ async function fetchValidatorIdentities(keys) {
);

identities = identities.filter(r => r);
const keybaseUsernames = identities.map(i => i.keybaseUsername).filter(u => u);
const keybaseUsernames = identities
.map(i => i.keybaseUsername)
.filter(u => u);
const avatarMap = await fetchValidatorAvatars(keybaseUsernames);
for (const identity of identities) {
if (identity.keybaseUsername) {
Expand Down
14 changes: 8 additions & 6 deletions src/v2/Bx2ValidatorIdentity.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import PropTypes from 'prop-types';
import Link from '@material-ui/core/Link';

class Bx2ValidatorIdentity extends Component {

renderAvatar() {
let {avatarUrl, name} = this.props.identity;

Expand All @@ -25,17 +24,18 @@ class Bx2ValidatorIdentity extends Component {
};

if (!avatarUrl) {
const initials = name.split(' ').map(word => word[0]).join('');
const initials = name
.split(' ')
.map(word => word[0])
.join('');
return (
<Avatar alt="initials" style={avatarStyle}>
{initials}
</Avatar>
);
}

return (
<Avatar alt="avatar" src={avatarUrl} style={avatarStyle} />
)
return <Avatar alt="avatar" src={avatarUrl} style={avatarStyle} />;
}

renderVerified() {
Expand Down Expand Up @@ -106,7 +106,9 @@ class Bx2ValidatorIdentity extends Component {
Missing Info
</Typography>
<Link
href={'https://solana-labs.github.io/book/testnet-participation.html#publishing-validator-info'}
href={
'https://solana-labs.github.io/book/testnet-participation.html#publishing-validator-info'
}
title={'Click to learn how validator info is published'}
target="_new"
>
Expand Down

0 comments on commit 1cf7921

Please sign in to comment.