diff --git a/src/lang/locales/en.json b/src/lang/locales/en.json index 08cca931..2b7d579b 100644 --- a/src/lang/locales/en.json +++ b/src/lang/locales/en.json @@ -23,6 +23,7 @@ "summary": "Summary", "blocks": "Blocks", "blockchains": "Blockchains", + "uptime": "Uptime", "proposal_id": "Proposal ID", "proposal_type": "Proposal Type", diff --git a/src/libs/data/data.js b/src/libs/data/data.js index deea84ef..fb02d95e 100644 --- a/src/libs/data/data.js +++ b/src/libs/data/data.js @@ -189,7 +189,10 @@ export function abbrMessage(msg) { if (Array.isArray(msg)) { return msg.map(x => abbrMessage(x)).join(', ') } - return msg.typeUrl.substring(msg.typeUrl.lastIndexOf('.') + 1).replace('Msg', '') + if (msg.typeUrl) { + return msg.typeUrl.substring(msg.typeUrl.lastIndexOf('.') + 1).replace('Msg', '') + } + return msg.type.substring(msg.type.lastIndexOf('/') + 1).replace('Msg', '') } export function abbrAddress(address, length = 10) { diff --git a/src/libs/fetch.js b/src/libs/fetch.js index eb305eea..15de8ed6 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -51,6 +51,10 @@ const chainAPI = class ChainFetch { return this.get(`/blocks/${height}`).then(data => Block.create(data)) } + async getSlashingSigningInfo() { + return this.get('/cosmos/slashing/v1beta1/signing_infos') + } + async getTxs(hash) { const ver = this.getSelectedConfig() ? this.config.sdk_version : '0.41' // /cosmos/tx/v1beta1/txs/{hash} @@ -60,6 +64,18 @@ const chainAPI = class ChainFetch { return this.get(`/cosmos/tx/v1beta1/txs/${hash}`).then(data => WrapStdTx.create(data, ver)) } + async getTxsBySender(sender, page = 1) { + return this.get(`/txs?message.sender=${sender}&page=${page}&limit=20`) + } + + async getTxsByRecipient(recipient) { + return this.get(`/txs?message.recipient=${recipient}`) + } + + async getTxsByHeight(height) { + return this.get(`/txs?tx.height=${height}`) + } + async getValidatorDistribution(address) { return this.get(`/distribution/validators/${address}`).then(data => { const ret = ValidatorDistribution.create(commonProcess(data)) diff --git a/src/navigation/vertical/index.js b/src/navigation/vertical/index.js index 7f6217fa..900d0cb1 100644 --- a/src/navigation/vertical/index.js +++ b/src/navigation/vertical/index.js @@ -21,6 +21,11 @@ const modules = [ title: 'governance', route: 'governance', }, + { + scope: 'normal', + title: 'uptime', + route: 'uptime', + }, ] function processMenu() { diff --git a/src/router/index.js b/src/router/index.js index eb077ea5..6492c190 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -112,6 +112,20 @@ const router = new VueRouter({ ], }, }, + { + path: '/:chain/uptime', + name: 'uptime', + component: () => import('@/views/Uptime.vue'), + meta: { + pageTitle: 'Uptime', + breadcrumb: [ + { + text: 'Uptime', + active: true, + }, + ], + }, + }, { path: '/:chain/account/:address', name: 'chain-account', diff --git a/src/views/StakingValidator.vue b/src/views/StakingValidator.vue index 4b83f212..211e8790 100644 --- a/src/views/StakingValidator.vue +++ b/src/views/StakingValidator.vue @@ -236,28 +236,34 @@ - - -   - - - - - {{ $t('btn_back_list') }} - - - + + + + + + @@ -268,11 +274,11 @@ + + diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index 81200e56..6aee59da 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -189,6 +189,37 @@ + + + + + + + + + import { BCard, BAvatar, BPopover, BTable, BRow, BCol, BTableSimple, BTr, BTd, BTbody, BCardHeader, BCardTitle, BButton, BCardBody, VBModal, - BButtonGroup, VBTooltip, + BButtonGroup, VBTooltip, BPagination, } from 'bootstrap-vue' import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' @@ -332,7 +363,7 @@ import Ripple from 'vue-ripple-directive' import VueQr from 'vue-qr' import chainAPI from '@/libs/fetch' import { - formatToken, formatTokenAmount, formatTokenDenom, getStakingValidatorOperator, percent, tokenFormatter, toDay, toDuration, + formatToken, formatTokenAmount, formatTokenDenom, getStakingValidatorOperator, percent, tokenFormatter, toDay, toDuration, abbrMessage, abbrAddress, } from '@/libs/data' import { $themeColors } from '@themeConfig' import ObjectFieldComponent from './ObjectFieldComponent.vue' @@ -363,6 +394,7 @@ export default { BButtonGroup, BTr, BTd, + BPagination, // eslint-disable-next-line vue/no-unused-components ToastificationContent, ObjectFieldComponent, @@ -393,6 +425,7 @@ export default { redelegations: [], unbonding: [], quotes: {}, + transactions: [], doughnutChart: { options: { responsive: true, @@ -435,6 +468,17 @@ export default { } return 'Profile' }, + txs() { + if (this.transactions.txs) { + return this.transactions.txs.map(x => ({ + height: Number(x.height), + txhash: x.txhash, + msgs: abbrMessage(x.tx.value.msg), + time: toDay(x.timestamp), + })) + } + return [] + }, assetTable() { let total = [] let sum = 0 @@ -606,14 +650,24 @@ export default { this.$http.getStakingUnbonding(this.address).then(res => { this.unbonding = res.unbonding_responses }) + this.$http.getTxsBySender(this.address).then(res => { + this.transactions = res + }) + // this.$http.getStakingValidators(this.address).then(res => { // console.log(res) // }) }, methods: { + pageload(v) { + this.$http.getTxsBySender(this.address, v).then(res => { + this.transactions = res + }) + }, selectValue(v) { this.selectedValidator = v }, + formatHash: abbrAddress, formatDenom(v) { return formatTokenDenom(this.denoms[v] ? this.denoms[v] : v) },