forked from cerc-io/cosmos-explorer
fix selectedChain
This commit is contained in:
parent
c8f3dcdaaf
commit
a1c9f6e7ca
@ -75,8 +75,9 @@ export default class ChainFetch {
|
|||||||
return this.get('/cosmos/slashing/v1beta1/signing_infos?pagination.limit=500', config)
|
return this.get('/cosmos/slashing/v1beta1/signing_infos?pagination.limit=500', config)
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTxs(hash) {
|
async getTxs(hash, config = null) {
|
||||||
const ver = this.getSelectedConfig() ? this.config.sdk_version : '0.41'
|
const conf = config || this.getSelectedConfig()
|
||||||
|
const ver = conf.sdk_version || '0.41'
|
||||||
// /cosmos/tx/v1beta1/txs/{hash}
|
// /cosmos/tx/v1beta1/txs/{hash}
|
||||||
if (ver && compareVersions(ver, '0.40') < 1) {
|
if (ver && compareVersions(ver, '0.40') < 1) {
|
||||||
return this.get(`/txs/${hash}`).then(data => WrapStdTx.create(data, ver))
|
return this.get(`/txs/${hash}`).then(data => WrapStdTx.create(data, ver))
|
||||||
|
@ -154,14 +154,14 @@
|
|||||||
<b-dropdown-item
|
<b-dropdown-item
|
||||||
v-if="balances[acc.addr]"
|
v-if="balances[acc.addr]"
|
||||||
v-b-modal.operation-modal
|
v-b-modal.operation-modal
|
||||||
@click="transfer('Transfer',acc.addr)"
|
@click="transfer('Transfer',acc.addr,acc.chain)"
|
||||||
>
|
>
|
||||||
<feather-icon icon="SendIcon" /> Transfer
|
<feather-icon icon="SendIcon" /> Transfer
|
||||||
</b-dropdown-item>
|
</b-dropdown-item>
|
||||||
<b-dropdown-item
|
<b-dropdown-item
|
||||||
v-if="balances[acc.addr]"
|
v-if="balances[acc.addr]"
|
||||||
v-b-modal.operation-modal
|
v-b-modal.operation-modal
|
||||||
@click="transfer('IBCTransfer',acc.addr)"
|
@click="transfer('IBCTransfer',acc.addr,acc.chain)"
|
||||||
>
|
>
|
||||||
<feather-icon icon="SendIcon" /> IBC Transfer
|
<feather-icon icon="SendIcon" /> IBC Transfer
|
||||||
</b-dropdown-item>
|
</b-dropdown-item>
|
||||||
@ -268,6 +268,7 @@
|
|||||||
<operation-modal
|
<operation-modal
|
||||||
:type="operationModalType"
|
:type="operationModalType"
|
||||||
:address="selectedAddress"
|
:address="selectedAddress"
|
||||||
|
:selected-chain-name="selectedChainName"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -334,6 +335,7 @@ export default {
|
|||||||
ibcDenom: {},
|
ibcDenom: {},
|
||||||
quotes: {},
|
quotes: {},
|
||||||
operationModalType: '',
|
operationModalType: '',
|
||||||
|
selectedChainName: '',
|
||||||
options: {
|
options: {
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
legend: {
|
legend: {
|
||||||
@ -532,9 +534,11 @@ export default {
|
|||||||
this.currency2 = c
|
this.currency2 = c
|
||||||
this.currency = getUserCurrencySign()
|
this.currency = getUserCurrencySign()
|
||||||
},
|
},
|
||||||
transfer(type, addr) {
|
transfer(type, addr, chain) {
|
||||||
|
console.log(chain)
|
||||||
this.operationModalType = type
|
this.operationModalType = type
|
||||||
this.selectedAddress = addr
|
this.selectedAddress = addr
|
||||||
|
this.selectedChainName = chain
|
||||||
},
|
},
|
||||||
completeAdd() {
|
completeAdd() {
|
||||||
this.init()
|
this.init()
|
||||||
|
@ -100,6 +100,10 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
selectedChain: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -133,7 +137,7 @@ export default {
|
|||||||
trace() {
|
trace() {
|
||||||
if (this.hash) {
|
if (this.hash) {
|
||||||
this.error = null
|
this.error = null
|
||||||
this.$http.getTxs(this.hash).then(res => {
|
this.$http.getTxs(this.hash, this.selectedChain).then(res => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.succeed = true
|
this.succeed = true
|
||||||
clearInterval(this.timer)
|
clearInterval(this.timer)
|
||||||
|
@ -140,6 +140,7 @@
|
|||||||
<TransactionResult
|
<TransactionResult
|
||||||
v-else
|
v-else
|
||||||
:hash="txHash"
|
:hash="txHash"
|
||||||
|
:selected-chain="selectedChain"
|
||||||
/>
|
/>
|
||||||
</b-overlay>
|
</b-overlay>
|
||||||
</b-modal>
|
</b-modal>
|
||||||
@ -236,13 +237,16 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
selectedChainName: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
modalTitle: '',
|
modalTitle: '',
|
||||||
historyName: '',
|
historyName: '',
|
||||||
selectedValidator: null,
|
selectedValidator: null,
|
||||||
selectedChain: null,
|
|
||||||
token: '',
|
token: '',
|
||||||
chainId: '',
|
chainId: '',
|
||||||
balance: [],
|
balance: [],
|
||||||
@ -301,6 +305,14 @@ export default {
|
|||||||
const selectedAddress = this.accounts.address.find(x => x.chain === chain)
|
const selectedAddress = this.accounts.address.find(x => x.chain === chain)
|
||||||
return selectedAddress?.addr
|
return selectedAddress?.addr
|
||||||
},
|
},
|
||||||
|
selectedChain() {
|
||||||
|
let config = null
|
||||||
|
const allChains = localStorage.getItem('chains')
|
||||||
|
if (allChains) {
|
||||||
|
config = JSON.parse(allChains)[this.selectedChainName]
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initialize() {
|
initialize() {
|
||||||
@ -318,7 +330,7 @@ export default {
|
|||||||
this.accountNumber = account.accountNumber
|
this.accountNumber = account.accountNumber
|
||||||
this.sequence = account.sequence
|
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) {
|
if (res && res.length > 0) {
|
||||||
this.balance = res.reverse()
|
this.balance = res.reverse()
|
||||||
const token = this.balance.find(i => !i.denom.startsWith('ibc'))
|
const token = this.balance.find(i => !i.denom.startsWith('ibc'))
|
||||||
|
Loading…
Reference in New Issue
Block a user