fixed issue: display moniker on blocks

This commit is contained in:
liangping 2022-10-06 08:40:33 +08:00
parent 12fde18e75
commit 9fc2328ab6

View File

@ -491,19 +491,21 @@ export function getCachedValidators(chainName) {
}
export function isHexAddress(v) {
const re = /^[A-Z\d]{40}$/
return re.test(v)
// const re = /^[A-Z\d]{40}$/
// return re.test(v)
return v.length === 28
}
export function getStakingValidatorByHex(chainName, hex) {
export function getStakingValidatorByHex(chainName, textBase64) {
const locals = localStorage.getItem(`validators-${chainName}`)
if (locals) {
const val = JSON.parse(locals).find(x => consensusPubkeyToHexAddress(x.consensus_pubkey) === hex)
const val = JSON.parse(locals)
.find(x => toBase64(fromHex(consensusPubkeyToHexAddress(x.consensus_pubkey))) === textBase64)
if (val) {
return val.description.moniker
}
}
return abbr(hex)
return abbr(textBase64)
}
export function getStakingValidatorByAccount(chainName, addr) {