From a1091721fe8987fa5e4e669f2b42dd8c92f0b924 Mon Sep 17 00:00:00 2001 From: shrpne Date: Mon, 30 Aug 2021 16:48:37 +0300 Subject: [PATCH] use validatorMetaList --- components/StakeDelegateForm.vue | 2 +- components/TransactionLatestList.vue | 4 ++-- components/common/FieldDomain.vue | 2 +- pages/delegation/index.vue | 2 +- pages/wallet/index.vue | 2 +- store/actions.js | 8 ++++---- store/mutations.js | 4 ++-- store/state.js | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/StakeDelegateForm.vue b/components/StakeDelegateForm.vue index 6305410f..afb0a01d 100644 --- a/components/StakeDelegateForm.vue +++ b/components/StakeDelegateForm.vue @@ -67,7 +67,7 @@ if (this.$v.form.publicKey.$invalid) { return null; } - const validator = this.$store.state.validatorList.find((item) => item.publicKey === this.form.publicKey); + const validator = this.$store.state.validatorMetaList.find((item) => item.publicKey === this.form.publicKey); return validator?.name; }, validatorFullName() { diff --git a/components/TransactionLatestList.vue b/components/TransactionLatestList.vue index 6785e7e5..53919234 100644 --- a/components/TransactionLatestList.vue +++ b/components/TransactionLatestList.vue @@ -176,8 +176,8 @@ if (!tx.data.pubKey) { return; } - const validator = this.$store.state.validatorList.find((validatorItem) => validatorItem.publicKey === tx.data.pubKey); - return validator && validator.meta && validator.meta.name; + const validator = this.$store.state.validatorMetaList.find((validatorItem) => validatorItem.publicKey === tx.data.pubKey); + return validator?.name; }, fromBase64, getExplorerBlockUrl, diff --git a/components/common/FieldDomain.vue b/components/common/FieldDomain.vue index 73dcfc1c..88fab58e 100644 --- a/components/common/FieldDomain.vue +++ b/components/common/FieldDomain.vue @@ -78,7 +78,7 @@ return; } - return this.$store.state.validatorList.map((item) => { + return this.$store.state.validatorMetaList.map((item) => { return {name: item.name || '', value: item.publicKey}; }); }, diff --git a/pages/delegation/index.vue b/pages/delegation/index.vue index 9644314f..8624f9b0 100644 --- a/pages/delegation/index.vue +++ b/pages/delegation/index.vue @@ -23,7 +23,7 @@ if (store.getters.isOfflineMode) { return; } - store.dispatch('FETCH_VALIDATOR_LIST'); + store.dispatch('FETCH_VALIDATOR_META_LIST'); return store.dispatch('FETCH_STAKE_LIST'); }, head() { diff --git a/pages/wallet/index.vue b/pages/wallet/index.vue index 8773902b..c434d938 100644 --- a/pages/wallet/index.vue +++ b/pages/wallet/index.vue @@ -36,7 +36,7 @@ if (store.getters.isOfflineMode) { return; } - store.dispatch('FETCH_VALIDATOR_LIST'); + store.dispatch('FETCH_VALIDATOR_META_LIST'); }, asyncData({ store }) { if (store.getters.isOfflineMode) { diff --git a/store/actions.js b/store/actions.js index 28e1d50e..534ed820 100644 --- a/store/actions.js +++ b/store/actions.js @@ -1,5 +1,5 @@ // import {getProfile, getProfileAddressEncrypted} from "~/api"; -import {getBalance, getAddressStakeList, getValidatorList} from "~/api/explorer.js"; +import {getBalance, getAddressStakeList, getValidatorMetaList} from "~/api/explorer.js"; export default { // FETCH_PROFILE: ({ state, commit }) => { @@ -75,10 +75,10 @@ export default { return stakeList; }); }, - FETCH_VALIDATOR_LIST({ commit }) { - return getValidatorList() + FETCH_VALIDATOR_META_LIST({ commit }) { + return getValidatorMetaList() .then((validatorList) => { - commit('SET_VALIDATOR_LIST', validatorList); + commit('SET_VALIDATOR_META_LIST', validatorList); return validatorList; }); }, diff --git a/store/mutations.js b/store/mutations.js index f88c5ee9..17fa8d54 100644 --- a/store/mutations.js +++ b/store/mutations.js @@ -39,8 +39,8 @@ export default { SET_STAKE_LIST: (state, stakeList) => { state.stakeList = stakeList; }, - SET_VALIDATOR_LIST(state, validatorList) { - state.validatorList = validatorList; + SET_VALIDATOR_META_LIST(state, validatorList) { + state.validatorMetaList = validatorList; }, // PUSH_HISTORY: (state, historyItem) => { // state.history.push(historyItem); diff --git a/store/state.js b/store/state.js index 90640cf3..ac2d51d4 100644 --- a/store/state.js +++ b/store/state.js @@ -10,8 +10,8 @@ export default function() { balance: [], /** @type Array */ stakeList: [], - /** @type Array */ - validatorList: [], + /** @type Array */ + validatorMetaList: [], lastUpdateTime: 9999999999999, // transactionListInfo: { // data: [],