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:
Erialos 2022-11-10 09:05:11 -07:00
parent 03a2f3e4ef
commit b966213ace
5 changed files with 7 additions and 7 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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: {

View File

@ -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)
},
},

View File

@ -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) }))
},