diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 83457768..8ea2bfa2 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -75,8 +75,9 @@ export default class ChainFetch { return this.get('/cosmos/slashing/v1beta1/signing_infos?pagination.limit=500', config) } - async getTxs(hash) { - const ver = this.getSelectedConfig() ? this.config.sdk_version : '0.41' + async getTxs(hash, config = null) { + const conf = config || this.getSelectedConfig() + const ver = conf.sdk_version || '0.41' // /cosmos/tx/v1beta1/txs/{hash} if (ver && compareVersions(ver, '0.40') < 1) { return this.get(`/txs/${hash}`).then(data => WrapStdTx.create(data, ver)) diff --git a/src/views/WalletAccounts.vue b/src/views/WalletAccounts.vue index 8bd37b63..0d1735fb 100644 --- a/src/views/WalletAccounts.vue +++ b/src/views/WalletAccounts.vue @@ -154,14 +154,14 @@ Transfer IBC Transfer @@ -268,6 +268,7 @@ @@ -334,6 +335,7 @@ export default { ibcDenom: {}, quotes: {}, operationModalType: '', + selectedChainName: '', options: { maintainAspectRatio: false, legend: { @@ -532,9 +534,11 @@ export default { this.currency2 = c this.currency = getUserCurrencySign() }, - transfer(type, addr) { + transfer(type, addr, chain) { + console.log(chain) this.operationModalType = type this.selectedAddress = addr + this.selectedChainName = chain }, completeAdd() { this.init() diff --git a/src/views/components/OperationModal/TransactionResult.vue b/src/views/components/OperationModal/TransactionResult.vue index 12c2fa27..6b8b88b9 100644 --- a/src/views/components/OperationModal/TransactionResult.vue +++ b/src/views/components/OperationModal/TransactionResult.vue @@ -100,6 +100,10 @@ export default { type: String, default: null, }, + selectedChain: { + type: Object, + default: null, + }, }, data() { return { @@ -133,7 +137,7 @@ export default { trace() { if (this.hash) { this.error = null - this.$http.getTxs(this.hash).then(res => { + this.$http.getTxs(this.hash, this.selectedChain).then(res => { if (res.code === 0) { this.succeed = true clearInterval(this.timer) diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index 356308da..3f2e6303 100644 --- a/src/views/components/OperationModal/index.vue +++ b/src/views/components/OperationModal/index.vue @@ -140,6 +140,7 @@ @@ -236,13 +237,16 @@ export default { type: String, default: null, }, + selectedChainName: { + type: String, + default: null, + }, }, data() { return { modalTitle: '', historyName: '', selectedValidator: null, - selectedChain: null, token: '', chainId: '', balance: [], @@ -301,6 +305,14 @@ export default { const selectedAddress = this.accounts.address.find(x => x.chain === chain) return selectedAddress?.addr }, + selectedChain() { + let config = null + const allChains = localStorage.getItem('chains') + if (allChains) { + config = JSON.parse(allChains)[this.selectedChainName] + } + return config + }, }, methods: { initialize() { @@ -318,7 +330,7 @@ export default { this.accountNumber = account.accountNumber this.sequence = account.sequence }) - this.$http.getBankBalances(this.selectedAddress).then(res => { + this.$http.getBankBalances(this.selectedAddress, this.selectedChain).then(res => { if (res && res.length > 0) { this.balance = res.reverse() const token = this.balance.find(i => !i.denom.startsWith('ibc'))