forked from cerc-io/cosmos-explorer
Fixed improper use of the asset array
I did not implement the chain config correctly with the assets part being an array. To test I removed the `|| '6'` and then added it to look in `assets[0]`. It returned the proper decimal for the chain config.
This commit is contained in:
parent
03a2f3e4ef
commit
b966213ace
@ -581,7 +581,7 @@ export default {
|
||||
return this.delegations.map(x => {
|
||||
const rewards = this.rewards.find(r => r.validator_address === x.delegation.validator_address)
|
||||
const conf = this.$http.getSelectedConfig()
|
||||
const decimal = conf.assets.exponent || '6'
|
||||
const decimal = conf.assets[0].exponent || '6'
|
||||
return {
|
||||
valAddress: x.delegation.validator_address,
|
||||
validator: getStakingValidatorOperator(this.$store.state.chains.selected.chain_name, x.delegation.validator_address),
|
||||
@ -700,7 +700,7 @@ export default {
|
||||
},
|
||||
fetchAccount(address) {
|
||||
const conf = this.$http.getSelectedConfig()
|
||||
const decimal = conf.assets.exponent || '6'
|
||||
const decimal = conf.assets[0].exponent || '6'
|
||||
this.address = address
|
||||
this.$http.getBankAccountBalance(address).then(bal => {
|
||||
this.walletBalances = this.formatToken(bal)
|
||||
|
@ -622,7 +622,7 @@ export default {
|
||||
deleTable() {
|
||||
const re = []
|
||||
const conf = this.$http.getSelectedConfig()
|
||||
const decimal = conf.assets.exponent || '6'
|
||||
const decimal = conf.assets[0].exponent || '6'
|
||||
if (this.reward.rewards && this.delegations && this.delegations.length > 0) {
|
||||
this.delegations.forEach(e => {
|
||||
const reward = this.reward.rewards.find(r => r.validator_address === e.delegation.validator_address)
|
||||
|
@ -120,7 +120,7 @@ export default {
|
||||
computed: {
|
||||
formatedDelegations() {
|
||||
const conf = this.$http.getSelectedConfig()
|
||||
const decimal = conf.assets.exponent || '6'
|
||||
const decimal = conf.assets[0].exponent || '6'
|
||||
return this.delegations.map(x => ({
|
||||
validator: {
|
||||
logo: x.chain.logo,
|
||||
@ -138,7 +138,7 @@ export default {
|
||||
groupedDelegations() {
|
||||
const group = {}
|
||||
const conf = this.$http.getSelectedConfig()
|
||||
const decimal = conf.assets.exponent || '6'
|
||||
const decimal = conf.assets[0].exponent || '6'
|
||||
this.delegations.forEach(x => {
|
||||
const d = {
|
||||
validator: {
|
||||
|
@ -236,7 +236,7 @@ export default {
|
||||
},
|
||||
format(v) {
|
||||
const conf = this.$http.getSelectedConfig()
|
||||
const decimal = conf.assets.exponent || '6'
|
||||
const decimal = conf.assets[0].exponent || '6'
|
||||
return formatToken(v, this.IBCDenom, decimal)
|
||||
},
|
||||
},
|
||||
|
@ -180,7 +180,7 @@ export default {
|
||||
},
|
||||
tokenOptions() {
|
||||
const conf = this.$http.getSelectedConfig()
|
||||
const decimal = conf.assets.exponent || '6'
|
||||
const decimal = conf.assets[0].exponent || '6'
|
||||
if (!this.delegations) return []
|
||||
return this.delegations.filter(x => x.delegation.validator_address === this.validatorAddress).map(x => ({ value: x.balance.denom, label: formatToken(x.balance, {}, decimal) }))
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user