diff --git a/api/api.js b/api/api.js index 91dd694a..29601a89 100644 --- a/api/api.js +++ b/api/api.js @@ -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`; @@ -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 @@ -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; } @@ -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) { diff --git a/src/v2/Bx2ValidatorIdentity.jsx b/src/v2/Bx2ValidatorIdentity.jsx index d9d8beb1..111c7afe 100644 --- a/src/v2/Bx2ValidatorIdentity.jsx +++ b/src/v2/Bx2ValidatorIdentity.jsx @@ -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; @@ -25,7 +24,10 @@ 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 ( {initials} @@ -33,9 +35,7 @@ class Bx2ValidatorIdentity extends Component { ); } - return ( - - ) + return ; } renderVerified() { @@ -106,7 +106,9 @@ class Bx2ValidatorIdentity extends Component { Missing Info