From 9fc2328ab6d96e8c35835a2dc608200f01868672 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 6 Oct 2022 08:40:33 +0800 Subject: [PATCH] fixed issue: display moniker on blocks --- src/libs/utils.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libs/utils.js b/src/libs/utils.js index bc7ed928..ea88ee11 100644 --- a/src/libs/utils.js +++ b/src/libs/utils.js @@ -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) {