Merge pull request #105 from donne1226/master

fix selectedChain
This commit is contained in:
ping 2022-04-05 14:18:28 +08:00 committed by GitHub
commit 197d4a3fef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 6 deletions

View File

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

View File

@ -231,6 +231,7 @@
<operation-modal
:type="operationModalType"
:address="selectedAddress"
:selected-chain-name="selectedChainName"
/>
</div>
</template>
@ -295,6 +296,7 @@ export default {
ibcDenom: {},
quotes: {},
operationModalType: '',
selectedChainName: '',
options: {
maintainAspectRatio: false,
legend: {
@ -485,9 +487,10 @@ export default {
this.currency2 = c
this.currency = getUserCurrencySign()
},
transfer(type, addr) {
transfer(type, addr, chain) {
this.operationModalType = type
this.selectedAddress = addr
this.selectedChainName = chain
},
completeAdd() {
this.init()

View File

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

View File

@ -140,6 +140,7 @@
<TransactionResult
v-else
:hash="txHash"
:selected-chain="selectedChain"
/>
</b-overlay>
</b-modal>
@ -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 && this.selectedChainName) {
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'))