read tx fee from config

This commit is contained in:
liangping 2022-01-12 18:58:32 +08:00
parent feea9009cb
commit 4f398739fe
11 changed files with 75 additions and 76 deletions

View File

@ -4,7 +4,7 @@
"api": "https://api.genesisl1.org",
"sdk_version": "0.42.4",
"coin_type": "118",
"min_tx_fee": "800",
"min_tx_fee": "300000000000000",
"addr_prefix": "genesis",
"logo": "/logos/genesisl1.png",
"assets": [{

View File

@ -125,6 +125,22 @@ export function chartColors() {
return Object.values($themeColors).concat(colors)
}
export function extractAccountNumberAndSequence(ret) {
let account = ret.value
if (ret.value && ret.value.base_vesting_account) { // vesting account
account = ret.value.base_vesting_account?.base_account
} else if (ret.value && ret.value.base_account) { // evmos based account
account = ret.value.base_account
}
const accountNumber = account.account_number
const sequence = account?.sequence || 0
return {
accountNumber,
sequence,
}
}
export function getUserCurrencySign() {
let s = ''
switch (getUserCurrency()) {

View File

@ -285,7 +285,7 @@ import {
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
} from '@validations'
import {
abbrAddress, formatToken, formatTokenDenom, getLocalAccounts, getUnitAmount, setLocalTxHistory, sign, timeIn,
abbrAddress, extractAccountNumberAndSequence, formatToken, formatTokenDenom, getLocalAccounts, getUnitAmount, setLocalTxHistory, sign, timeIn,
} from '@/libs/utils'
import vSelect from 'vue-select'
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
@ -343,7 +343,7 @@ export default {
delegations: [],
IBCDenom: {},
memo: '',
fee: '800',
fee: '900',
feeDenom: '',
wallet: 'ledgerUSB',
error: null,
@ -408,15 +408,12 @@ export default {
}
})
this.$http.getAuthAccount(this.selectedAddress).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
const account = extractAccountNumberAndSequence(ret)
this.accountNumber = account.accountNumber
this.sequence = account.sequence
})
this.fee = this.$store.state.chains.selected?.min_tx_fee || '1000'
this.feeDenom = this.$store.state.chains.selected?.assets[0]?.base || ''
}
// this.$http.getStakingDelegations(this.selectedAddress).then(res => {
// this.delegations = res.delegation_responses

View File

@ -254,6 +254,7 @@ import {
} from '@validations'
import {
abbrAddress,
extractAccountNumberAndSequence,
formatToken, formatTokenDenom, getLocalAccounts, getUnitAmount, setLocalTxHistory, sign, timeIn,
} from '@/libs/utils'
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
@ -349,6 +350,8 @@ export default {
return array
},
onChange() {
this.fee = this.$store.state.chains.selected?.min_tx_fee || '1000'
this.feeDenom = this.$store.state.chains.selected?.assets[0]?.base || ''
if (this.voter) {
this.$http.getBankBalances(this.voter).then(res => {
if (res && res.length > 0) {
@ -370,15 +373,12 @@ export default {
}
})
this.$http.getAuthAccount(this.voter).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
const account = extractAccountNumberAndSequence(ret)
this.accountNumber = account.accountNumber
this.sequence = account.sequence
})
this.fee = this.$store.state.chains.selected?.min_tx_fee || '1000'
this.feeDenom = this.$store.state.chains.selected?.assets[0]?.base || ''
}
},
loadBalance() {

View File

@ -253,6 +253,7 @@ import {
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
} from '@validations'
import {
extractAccountNumberAndSequence,
formatToken, formatTokenDenom, getUnitAmount, setLocalTxHistory, sign, timeIn,
} from '@/libs/utils'
import vSelect from 'vue-select'
@ -364,16 +365,14 @@ export default {
this.error = null
}
})
this.$http.getAuthAccount(this.address).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
const account = extractAccountNumberAndSequence(ret)
this.accountNumber = account.accountNumber
this.sequence = account.sequence
})
this.fee = this.$store.state.chains.selected?.min_tx_fee || '1000'
this.feeDenom = this.$store.state.chains.selected?.assets[0]?.base || ''
this.$http.getStakingDelegations(this.address).then(res => {
this.delegations = res.delegation_responses
this.delegations.forEach(x => {

View File

@ -300,6 +300,7 @@ import {
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
} from '@validations'
import {
extractAccountNumberAndSequence,
formatToken, formatTokenDenom, getLocalAccounts, getLocalChains, getUnitAmount, setLocalTxHistory, sign, timeIn,
} from '@/libs/utils'
import { Cosmos } from '@cosmostation/cosmosjs'
@ -456,15 +457,12 @@ export default {
}
})
this.$http.getAuthAccount(this.address, this.selectedChain).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
const account = extractAccountNumberAndSequence(ret)
this.accountNumber = account.accountNumber
this.sequence = account.sequence
})
this.fee = this.selectedChain?.min_tx_fee || '1000'
this.feeDenom = this.selectedChain?.assets[0]?.base || ''
const channels = this.$store.state.chains.ibcChannels[this.selectedChain.chain_name]
if (!channels) {

View File

@ -256,6 +256,7 @@ import {
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
} from '@validations'
import {
extractAccountNumberAndSequence,
formatToken, formatTokenDenom, getLocalAccounts, getLocalChains, getUnitAmount, setLocalTxHistory, sign, timeIn,
} from '@/libs/utils'
import { Cosmos } from '@cosmostation/cosmosjs'
@ -383,15 +384,12 @@ export default {
}
})
this.$http.getAuthAccount(this.address, this.selectedChain).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
const account = extractAccountNumberAndSequence(ret)
this.accountNumber = account.accountNumber
this.sequence = account.sequence
})
this.fee = this.selectedChain?.min_tx_fee || '1000'
this.feeDenom = this.selectedChain?.assets[0]?.base || ''
}
},
handleOk(bvModalEvt) {

View File

@ -231,6 +231,7 @@ import {
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
} from '@validations'
import {
extractAccountNumberAndSequence,
formatToken, formatTokenDenom, getUnitAmount, setLocalTxHistory, sign, timeIn,
} from '@/libs/utils'
import vSelect from 'vue-select'
@ -344,15 +345,12 @@ export default {
}
})
this.$http.getAuthAccount(this.address).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
const account = extractAccountNumberAndSequence(ret)
this.accountNumber = account.accountNumber
this.sequence = account.sequence
})
this.fee = this.$store.state.chains.selected?.min_tx_fee || '1000'
this.feeDenom = this.$store.state.chains.selected?.assets[0]?.base || ''
this.$http.getStakingDelegations(this.address).then(res => {
this.delegations = res.delegation_responses
this.delegations.forEach(x => {

View File

@ -243,6 +243,7 @@ import {
} from '@validations'
import {
abbrAddress,
extractAccountNumberAndSequence,
formatToken, getLocalAccounts, setLocalTxHistory, sign, timeIn,
} from '@/libs/utils'
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
@ -350,15 +351,12 @@ export default {
}
})
this.$http.getAuthAccount(this.voter).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
const account = extractAccountNumberAndSequence(ret)
this.accountNumber = account.accountNumber
this.sequence = account.sequence
})
this.fee = this.$store.state.chains.selected?.min_tx_fee || '1000'
this.feeDenom = this.$store.state.chains.selected?.assets[0]?.base || ''
}
},
loadBalance() {

View File

@ -168,6 +168,7 @@ import {
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
} from '@validations'
import {
extractAccountNumberAndSequence,
formatToken, setLocalTxHistory, sign, timeIn,
} from '@/libs/utils'
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
@ -259,15 +260,12 @@ export default {
}
})
this.$http.getAuthAccount(this.address).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
const account = extractAccountNumberAndSequence(ret)
this.accountNumber = account.accountNumber
this.sequence = account.sequence
})
this.fee = this.$store.state.chains.selected?.min_tx_fee || '1000'
this.feeDenom = this.$store.state.chains.selected?.assets[0]?.base || ''
},
handleOk(bvModalEvt) {
// console.log('send')

View File

@ -176,7 +176,7 @@ import {
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
} from '@validations'
import {
formatToken, getLocalAccounts, getLocalChains, sign, timeIn, setLocalTxHistory,
formatToken, getLocalAccounts, getLocalChains, sign, timeIn, setLocalTxHistory, extractAccountNumberAndSequence,
} from '@/libs/utils'
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
@ -284,15 +284,12 @@ export default {
}
})
this.$http.getAuthAccount(this.address).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
const account = extractAccountNumberAndSequence(ret)
this.accountNumber = account.accountNumber
this.sequence = account.sequence
})
this.fee = this.$store.state.chains.selected?.min_tx_fee || '1000'
this.feeDenom = this.$store.state.chains.selected?.assets[0]?.base || ''
}
this.$http.getStakingDelegations(this.address).then(res => {
this.delegations = res.delegation_responses