Skip to content

Commit

Permalink
use validatorMetaList
Browse files Browse the repository at this point in the history
  • Loading branch information
shrpne committed Aug 30, 2021
1 parent fc1f20a commit a109172
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion components/StakeDelegateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions components/TransactionLatestList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion components/common/FieldDomain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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};
});
},
Expand Down
2 changes: 1 addition & 1 deletion pages/delegation/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion pages/wallet/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions store/actions.js
Original file line number Diff line number Diff line change
@@ -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 }) => {
Expand Down Expand Up @@ -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;
});
},
Expand Down
4 changes: 2 additions & 2 deletions store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions store/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export default function() {
balance: [],
/** @type Array<StakeItem> */
stakeList: [],
/** @type Array<Validator> */
validatorList: [],
/** @type Array<ValidatorMeta> */
validatorMetaList: [],
lastUpdateTime: 9999999999999,
// transactionListInfo: {
// data: [],
Expand Down

0 comments on commit a109172

Please sign in to comment.