diff --git a/src/chains/mainnet/genesisl1.json b/src/chains/mainnet/genesisl1.json index a498c83e..545467ca 100644 --- a/src/chains/mainnet/genesisl1.json +++ b/src/chains/mainnet/genesisl1.json @@ -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": [{ diff --git a/src/libs/utils.js b/src/libs/utils.js index 2e63adde..371f8bd1 100644 --- a/src/libs/utils.js +++ b/src/libs/utils.js @@ -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()) { diff --git a/src/views/OperationDelegateComponent.vue b/src/views/OperationDelegateComponent.vue index 16b0df1e..891cb62f 100644 --- a/src/views/OperationDelegateComponent.vue +++ b/src/views/OperationDelegateComponent.vue @@ -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 diff --git a/src/views/OperationGovDepositComponent.vue b/src/views/OperationGovDepositComponent.vue index 30b5a83d..0c29564f 100644 --- a/src/views/OperationGovDepositComponent.vue +++ b/src/views/OperationGovDepositComponent.vue @@ -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() { diff --git a/src/views/OperationRedelegateComponent.vue b/src/views/OperationRedelegateComponent.vue index fcab083d..aa9bc1b1 100644 --- a/src/views/OperationRedelegateComponent.vue +++ b/src/views/OperationRedelegateComponent.vue @@ -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 => { diff --git a/src/views/OperationTransfer2Component.vue b/src/views/OperationTransfer2Component.vue index 561ab88d..cb1acc2b 100644 --- a/src/views/OperationTransfer2Component.vue +++ b/src/views/OperationTransfer2Component.vue @@ -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) { diff --git a/src/views/OperationTransferComponent.vue b/src/views/OperationTransferComponent.vue index 0b526fc4..b62a8a0c 100644 --- a/src/views/OperationTransferComponent.vue +++ b/src/views/OperationTransferComponent.vue @@ -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) { diff --git a/src/views/OperationUnbondComponent.vue b/src/views/OperationUnbondComponent.vue index b453d715..41d5c197 100644 --- a/src/views/OperationUnbondComponent.vue +++ b/src/views/OperationUnbondComponent.vue @@ -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 => { diff --git a/src/views/OperationVoteComponent.vue b/src/views/OperationVoteComponent.vue index 2144cb17..3c38671f 100644 --- a/src/views/OperationVoteComponent.vue +++ b/src/views/OperationVoteComponent.vue @@ -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() { diff --git a/src/views/OperationWithdrawCommissionComponent.vue b/src/views/OperationWithdrawCommissionComponent.vue index f0689b25..4536f17b 100644 --- a/src/views/OperationWithdrawCommissionComponent.vue +++ b/src/views/OperationWithdrawCommissionComponent.vue @@ -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') diff --git a/src/views/OperationWithdrawComponent.vue b/src/views/OperationWithdrawComponent.vue index abf88d69..264f815b 100644 --- a/src/views/OperationWithdrawComponent.vue +++ b/src/views/OperationWithdrawComponent.vue @@ -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