Fixed uptime issue for band, odin

This commit is contained in:
liangping 2021-12-14 13:47:30 +08:00
parent 878e92ec92
commit 06fff024d7
2 changed files with 9 additions and 3 deletions

View File

@ -49,6 +49,7 @@
"prismjs": "1.24.0", "prismjs": "1.24.0",
"protobufjs-cli-dbx": "^7.0.7", "protobufjs-cli-dbx": "^7.0.7",
"protobufjs-dbx": "^7.0.0", "protobufjs-dbx": "^7.0.0",
"ripemd160": "^2.0.2",
"swiper": "6.5.1", "swiper": "6.5.1",
"trading-vue-js": "^1.0.2", "trading-vue-js": "^1.0.2",
"uuid": "8.3.2", "uuid": "8.3.2",

View File

@ -12,6 +12,7 @@ import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration' import duration from 'dayjs/plugin/duration'
import relativeTime from 'dayjs/plugin/relativeTime' import relativeTime from 'dayjs/plugin/relativeTime'
import utc from 'dayjs/plugin/utc' import utc from 'dayjs/plugin/utc'
import RIPEMD160 from 'ripemd160'
import localeData from 'dayjs/plugin/localeData' import localeData from 'dayjs/plugin/localeData'
import { $themeColors } from '@themeConfig' import { $themeColors } from '@themeConfig'
// import { SigningStargateClient } from '@cosmjs/stargate' // import { SigningStargateClient } from '@cosmjs/stargate'
@ -118,11 +119,15 @@ export function getUserCurrencySign() {
export function consensusPubkeyToHexAddress(consensusPubkey) { export function consensusPubkeyToHexAddress(consensusPubkey) {
let raw = null let raw = null
if (typeof consensusPubkey === 'object') { if (typeof consensusPubkey === 'object') {
raw = toHex(fromBase64(consensusPubkey.value)) if (consensusPubkey.type === 'tendermint/PubKeySecp256k1') {
raw = new RIPEMD160().update(Buffer.from(sha256(fromBase64(consensusPubkey.value)))).digest('hex').toUpperCase()
return raw
}
raw = sha256(fromBase64(consensusPubkey.value))
} else { } else {
raw = toHex(Bech32.decode(consensusPubkey).data).toUpperCase().replace('1624DE6420', '') raw = sha256(fromHex(toHex(Bech32.decode(consensusPubkey).data).toUpperCase().replace('1624DE6420', '')))
} }
const address = toHex(sha256(fromHex(raw))).slice(0, 40).toUpperCase() const address = toHex(raw).slice(0, 40).toUpperCase()
return address return address
} }