Merge pull request #565 from freak12techno/format-validator-events-tokens
Format validator events tokens
This commit is contained in:
commit
b416755f02
@ -15,6 +15,7 @@
|
||||
"@chenfengyuan/vue-countdown": "2",
|
||||
"@cosmjs/crypto": "^0.29.5",
|
||||
"@cosmjs/encoding": "^0.29.5",
|
||||
"@cosmjs/stargate": "^0.32.3",
|
||||
"@iconify/vue": "^4.1.0",
|
||||
"@intlify/unplugin-vue-i18n": "^0.8.2",
|
||||
"@leapwallet/cosmos-snap-provider": "^0.1.20",
|
||||
|
@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { parseCoins } from '@cosmjs/stargate';
|
||||
import {
|
||||
useBlockchain,
|
||||
useFormatter,
|
||||
@ -222,24 +223,29 @@ pagePowerEvents(1)
|
||||
|
||||
function mapEvents(events: {type: string, attributes: {key: string, value: string}[]}[]) {
|
||||
const attributes = events
|
||||
.filter(x => x.type=== selectedEventType.value)
|
||||
.filter(x => x.type === selectedEventType.value)
|
||||
.filter(x => x.attributes.findIndex(attr => attr.value === validator || attr.value === toBase64(stringToUint8Array(validator))) > -1)
|
||||
.map(x => {
|
||||
// check if attributes need to decode
|
||||
const output = {} as {[key: string]: string }
|
||||
|
||||
if(x.attributes.findIndex(a => a.key === `amount`) > -1) {
|
||||
if (x.attributes.findIndex(a => a.key === `amount`) > -1) {
|
||||
x.attributes.forEach(attr => {
|
||||
output[attr.key] = attr.value
|
||||
})
|
||||
} else x.attributes.forEach(attr => {
|
||||
} else {
|
||||
x.attributes.forEach(attr => {
|
||||
output[uint8ArrayToString(fromBase64(attr.key))] = uint8ArrayToString(fromBase64(attr.value))
|
||||
})
|
||||
return output
|
||||
})
|
||||
};
|
||||
|
||||
return attributes
|
||||
return output;
|
||||
});
|
||||
|
||||
const coinsAsString = attributes.map((x: any) => x.amount).join(',');
|
||||
const coins = parseCoins(coinsAsString);
|
||||
|
||||
return coins.map(coin => format.formatToken(coin)).join(', ');
|
||||
}
|
||||
|
||||
function mapDelegators(messages: any[]) {
|
||||
@ -678,7 +684,7 @@ function mapDelegators(messages: any[]) {
|
||||
<RouterLink :to="`/${props.chain}/tx/${item.txhash}`">
|
||||
<span class="mr-2">
|
||||
{{ (selectedEventType === EventType.Delegate ? '+' : '-')}} {{
|
||||
mapEvents(item.events).map((x: any) => x.amount).join(", ")
|
||||
mapEvents(item.events)
|
||||
}}</span>
|
||||
</RouterLink>
|
||||
<Icon
|
||||
|
132
yarn.lock
132
yarn.lock
@ -1418,6 +1418,16 @@
|
||||
"@cosmjs/math" "^0.31.1"
|
||||
"@cosmjs/utils" "^0.31.1"
|
||||
|
||||
"@cosmjs/amino@^0.32.3":
|
||||
version "0.32.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/amino/-/amino-0.32.3.tgz#b81d4a2b8d61568431a1afcd871e1344a19d97ff"
|
||||
integrity sha512-G4zXl+dJbqrz1sSJ56H/25l5NJEk/pAPIr8piAHgbXYw88OdAOlpA26PQvk2IbSN/rRgVbvlLTNgX2tzz1dyUA==
|
||||
dependencies:
|
||||
"@cosmjs/crypto" "^0.32.3"
|
||||
"@cosmjs/encoding" "^0.32.3"
|
||||
"@cosmjs/math" "^0.32.3"
|
||||
"@cosmjs/utils" "^0.32.3"
|
||||
|
||||
"@cosmjs/cosmwasm-stargate@0.30.0":
|
||||
version "0.30.0"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/cosmwasm-stargate/-/cosmwasm-stargate-0.30.0.tgz#b03c6c1383ef658695fcb02e6e1f4df2ddbd4710"
|
||||
@ -1474,6 +1484,19 @@
|
||||
elliptic "^6.5.4"
|
||||
libsodium-wrappers-sumo "^0.7.11"
|
||||
|
||||
"@cosmjs/crypto@^0.32.3":
|
||||
version "0.32.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.32.3.tgz#787f8e659709678722068ee1ddf379f65051a25e"
|
||||
integrity sha512-niQOWJHUtlJm2GG4F00yGT7sGPKxfUwz+2qQ30uO/E3p58gOusTcH2qjiJNVxb8vScYJhFYFqpm/OA/mVqoUGQ==
|
||||
dependencies:
|
||||
"@cosmjs/encoding" "^0.32.3"
|
||||
"@cosmjs/math" "^0.32.3"
|
||||
"@cosmjs/utils" "^0.32.3"
|
||||
"@noble/hashes" "^1"
|
||||
bn.js "^5.2.0"
|
||||
elliptic "^6.5.4"
|
||||
libsodium-wrappers-sumo "^0.7.11"
|
||||
|
||||
"@cosmjs/encoding@^0.29.3", "@cosmjs/encoding@^0.29.5":
|
||||
version "0.29.5"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.29.5.tgz#009a4b1c596cdfd326f30ccfa79f5e56daa264f2"
|
||||
@ -1501,6 +1524,15 @@
|
||||
bech32 "^1.1.4"
|
||||
readonly-date "^1.0.0"
|
||||
|
||||
"@cosmjs/encoding@^0.32.3":
|
||||
version "0.32.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.32.3.tgz#e245ff511fe4a0df7ba427b5187aab69e3468e5b"
|
||||
integrity sha512-p4KF7hhv8jBQX3MkB3Defuhz/W0l3PwWVYU2vkVuBJ13bJcXyhU9nJjiMkaIv+XP+W2QgRceqNNgFUC5chNR7w==
|
||||
dependencies:
|
||||
base64-js "^1.3.0"
|
||||
bech32 "^1.1.4"
|
||||
readonly-date "^1.0.0"
|
||||
|
||||
"@cosmjs/json-rpc@^0.29.5":
|
||||
version "0.29.5"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.29.5.tgz#5e483a9bd98a6270f935adf0dfd8a1e7eb777fe4"
|
||||
@ -1517,6 +1549,14 @@
|
||||
"@cosmjs/stream" "^0.30.1"
|
||||
xstream "^11.14.0"
|
||||
|
||||
"@cosmjs/json-rpc@^0.32.3":
|
||||
version "0.32.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/json-rpc/-/json-rpc-0.32.3.tgz#ccffdd7f722cecfab6daaa7463843b92f5d25355"
|
||||
integrity sha512-JwFRWZa+Y95KrAG8CuEbPVOSnXO2uMSEBcaAB/FBU3Mo4jQnDoUjXvt3vwtFWxfAytrWCn1I4YDFaOAinnEG/Q==
|
||||
dependencies:
|
||||
"@cosmjs/stream" "^0.32.3"
|
||||
xstream "^11.14.0"
|
||||
|
||||
"@cosmjs/math@^0.29.3", "@cosmjs/math@^0.29.5":
|
||||
version "0.29.5"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.29.5.tgz#722c96e080d6c2b62215ce9f4c70da7625b241b6"
|
||||
@ -1538,6 +1578,13 @@
|
||||
dependencies:
|
||||
bn.js "^5.2.0"
|
||||
|
||||
"@cosmjs/math@^0.32.3":
|
||||
version "0.32.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.32.3.tgz#16e4256f4da507b9352327da12ae64056a2ba6c9"
|
||||
integrity sha512-amumUtZs8hCCnV+lSBaJIiZkGabQm22QGg/IotYrhcmoOEOjt82n7hMNlNXRs7V6WLMidGrGYcswB5zcmp0Meg==
|
||||
dependencies:
|
||||
bn.js "^5.2.0"
|
||||
|
||||
"@cosmjs/proto-signing@0.29.3":
|
||||
version "0.29.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.29.3.tgz#fa5ed609ed2a0007d8d5eacbeb1f5a89ba1b77ff"
|
||||
@ -1590,6 +1637,18 @@
|
||||
cosmjs-types "^0.8.0"
|
||||
long "^4.0.0"
|
||||
|
||||
"@cosmjs/proto-signing@^0.32.3":
|
||||
version "0.32.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.32.3.tgz#91ae149b747d18666a6ccc924165b306431f7c0d"
|
||||
integrity sha512-kSZ0ZUY0DwcRT0NcIn2HkadH4NKlwjfZgbLj1ABwh/4l0RgeT84QCscZCu63tJYq3K6auwqTiZSZERwlO4/nbg==
|
||||
dependencies:
|
||||
"@cosmjs/amino" "^0.32.3"
|
||||
"@cosmjs/crypto" "^0.32.3"
|
||||
"@cosmjs/encoding" "^0.32.3"
|
||||
"@cosmjs/math" "^0.32.3"
|
||||
"@cosmjs/utils" "^0.32.3"
|
||||
cosmjs-types "^0.9.0"
|
||||
|
||||
"@cosmjs/socket@^0.29.5":
|
||||
version "0.29.5"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.29.5.tgz#a48df6b4c45dc6a6ef8e47232725dd4aa556ac2d"
|
||||
@ -1610,6 +1669,16 @@
|
||||
ws "^7"
|
||||
xstream "^11.14.0"
|
||||
|
||||
"@cosmjs/socket@^0.32.3":
|
||||
version "0.32.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/socket/-/socket-0.32.3.tgz#fa5c36bf58e87c0ad865d6318ecb0f8d9c89a28a"
|
||||
integrity sha512-F2WwNmaUPdZ4SsH6Uyreq3wQk7jpaEkb3wfOP951f5Jt6HCW/PxbxhKzHkAAf6+Sqks6SPhkbWoE8XaZpjL2KA==
|
||||
dependencies:
|
||||
"@cosmjs/stream" "^0.32.3"
|
||||
isomorphic-ws "^4.0.1"
|
||||
ws "^7"
|
||||
xstream "^11.14.0"
|
||||
|
||||
"@cosmjs/stargate@0.29.3":
|
||||
version "0.29.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.29.3.tgz#9bd303bfd32a7399a233e662864e7cc32e2607af"
|
||||
@ -1646,6 +1715,22 @@
|
||||
protobufjs "~6.11.3"
|
||||
xstream "^11.14.0"
|
||||
|
||||
"@cosmjs/stargate@^0.32.3":
|
||||
version "0.32.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/stargate/-/stargate-0.32.3.tgz#5a92b222ada960ebecea72cc9f366370763f4b66"
|
||||
integrity sha512-OQWzO9YWKerUinPIxrO1MARbe84XkeXJAW0lyMIjXIEikajuXZ+PwftiKA5yA+8OyditVmHVLtPud6Pjna2s5w==
|
||||
dependencies:
|
||||
"@confio/ics23" "^0.6.8"
|
||||
"@cosmjs/amino" "^0.32.3"
|
||||
"@cosmjs/encoding" "^0.32.3"
|
||||
"@cosmjs/math" "^0.32.3"
|
||||
"@cosmjs/proto-signing" "^0.32.3"
|
||||
"@cosmjs/stream" "^0.32.3"
|
||||
"@cosmjs/tendermint-rpc" "^0.32.3"
|
||||
"@cosmjs/utils" "^0.32.3"
|
||||
cosmjs-types "^0.9.0"
|
||||
xstream "^11.14.0"
|
||||
|
||||
"@cosmjs/stream@^0.29.3", "@cosmjs/stream@^0.29.5":
|
||||
version "0.29.5"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.29.5.tgz#350981cac496d04939b92ee793b9b19f44bc1d4e"
|
||||
@ -1660,6 +1745,13 @@
|
||||
dependencies:
|
||||
xstream "^11.14.0"
|
||||
|
||||
"@cosmjs/stream@^0.32.3":
|
||||
version "0.32.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.32.3.tgz#7522579aaf18025d322c2f33d6fb7573220395d6"
|
||||
integrity sha512-J2zVWDojkynYifAUcRmVczzmp6STEpyiAARq0rSsviqjreGIfspfuws/8rmkPa6qQBZvpQOBQCm2HyZZwYplIw==
|
||||
dependencies:
|
||||
xstream "^11.14.0"
|
||||
|
||||
"@cosmjs/tendermint-rpc@^0.29.3":
|
||||
version "0.29.5"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.29.5.tgz#f205c10464212bdf843f91bb2e4a093b618cb5c2"
|
||||
@ -1692,6 +1784,22 @@
|
||||
readonly-date "^1.0.0"
|
||||
xstream "^11.14.0"
|
||||
|
||||
"@cosmjs/tendermint-rpc@^0.32.3":
|
||||
version "0.32.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.32.3.tgz#f0406b9f0233e588fb924dca8c614972f9038aff"
|
||||
integrity sha512-xeprW+VR9xKGstqZg0H/KBZoUp8/FfFyS9ljIUTLM/UINjP2MhiwncANPS2KScfJVepGufUKk0/phHUeIBSEkw==
|
||||
dependencies:
|
||||
"@cosmjs/crypto" "^0.32.3"
|
||||
"@cosmjs/encoding" "^0.32.3"
|
||||
"@cosmjs/json-rpc" "^0.32.3"
|
||||
"@cosmjs/math" "^0.32.3"
|
||||
"@cosmjs/socket" "^0.32.3"
|
||||
"@cosmjs/stream" "^0.32.3"
|
||||
"@cosmjs/utils" "^0.32.3"
|
||||
axios "^1.6.0"
|
||||
readonly-date "^1.0.0"
|
||||
xstream "^11.14.0"
|
||||
|
||||
"@cosmjs/utils@^0.29.3", "@cosmjs/utils@^0.29.5":
|
||||
version "0.29.5"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.29.5.tgz#3fed1b3528ae8c5f1eb5d29b68755bebfd3294ee"
|
||||
@ -1707,6 +1815,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.31.1.tgz#e6055cd7d722fa72df9cbd0d39cd1f7a9ac80483"
|
||||
integrity sha512-n4Se1wu4GnKwztQHNFfJvUeWcpvx3o8cWhSbNs9JQShEuB3nv3R5lqFBtDCgHZF/emFQAP+ZjF8bTfCs9UBGhA==
|
||||
|
||||
"@cosmjs/utils@^0.32.3":
|
||||
version "0.32.3"
|
||||
resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.32.3.tgz#5dcaee6dd7cc846cdc073e9a7a7f63242f5f7e31"
|
||||
integrity sha512-WCZK4yksj2hBDz4w7xFZQTRZQ/RJhBX26uFHmmQFIcNUUVAihrLO+RerqJgk0dZqC42wstM9pEUQGtPmLcIYvg==
|
||||
|
||||
"@cosmwasm/ts-codegen@0.21.1":
|
||||
version "0.21.1"
|
||||
resolved "https://registry.yarnpkg.com/@cosmwasm/ts-codegen/-/ts-codegen-0.21.1.tgz#abbb15fdb8f1c966079de49e0da0f847fa5045fe"
|
||||
@ -3115,6 +3228,15 @@ axios@^1.3.2:
|
||||
form-data "^4.0.0"
|
||||
proxy-from-env "^1.1.0"
|
||||
|
||||
axios@^1.6.0:
|
||||
version "1.6.8"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.8.tgz#66d294951f5d988a00e87a0ffb955316a619ea66"
|
||||
integrity sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==
|
||||
dependencies:
|
||||
follow-redirects "^1.15.6"
|
||||
form-data "^4.0.0"
|
||||
proxy-from-env "^1.1.0"
|
||||
|
||||
babel-plugin-istanbul@^6.1.1:
|
||||
version "6.1.1"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73"
|
||||
@ -3586,6 +3708,11 @@ cosmjs-types@^0.8.0:
|
||||
long "^4.0.0"
|
||||
protobufjs "~6.11.2"
|
||||
|
||||
cosmjs-types@^0.9.0:
|
||||
version "0.9.0"
|
||||
resolved "https://registry.yarnpkg.com/cosmjs-types/-/cosmjs-types-0.9.0.tgz#c3bc482d28c7dfa25d1445093fdb2d9da1f6cfcc"
|
||||
integrity sha512-MN/yUe6mkJwHnCFfsNPeCfXVhyxHYW6c/xDUzrSbBycYzw++XvWDMJArXp2pLdgD6FQ8DW79vkPjeNKVrXaHeQ==
|
||||
|
||||
cross-fetch@^3.1.5:
|
||||
version "3.1.8"
|
||||
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82"
|
||||
@ -4276,6 +4403,11 @@ follow-redirects@^1.14.0, follow-redirects@^1.14.9, follow-redirects@^1.15.0:
|
||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
|
||||
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
|
||||
|
||||
follow-redirects@^1.15.6:
|
||||
version "1.15.6"
|
||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
|
||||
integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==
|
||||
|
||||
for-each@^0.3.3:
|
||||
version "0.3.3"
|
||||
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"
|
||||
|
Loading…
Reference in New Issue
Block a user