forked from cerc-io/cosmos-explorer
select the default address
This commit is contained in:
parent
d5c0f26666
commit
ae9bf25abf
@ -222,7 +222,6 @@ export default {
|
||||
return {
|
||||
modalTitle: '',
|
||||
historyName: '',
|
||||
selectedAddress: this.address,
|
||||
selectedValidator: null,
|
||||
selectedChain: null,
|
||||
token: '',
|
||||
@ -238,7 +237,7 @@ export default {
|
||||
wallet: 'ledgerUSB',
|
||||
gas: '200000',
|
||||
memo: '',
|
||||
blockingMsg: 'No available account found.',
|
||||
blockingMsg: this.address ? 'You are not the owner' : 'No available account found.',
|
||||
actionName: 'Send',
|
||||
|
||||
required,
|
||||
@ -259,22 +258,27 @@ export default {
|
||||
if (!this.balance) return []
|
||||
return this.balance.filter(item => !item.denom.startsWith('ibc'))
|
||||
},
|
||||
isOwner() {
|
||||
accounts() {
|
||||
const accounts = getLocalAccounts()
|
||||
const selectedWallet = this.$store.state.chains.defaultWallet
|
||||
if (!this.address) {
|
||||
const chain = this.$store.state.chains.selected.chain_name
|
||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||
this.selectedAddress = accounts[selectedWallet].address.find(x => x.chain === chain)
|
||||
}
|
||||
|
||||
if (accounts && accounts[selectedWallet]) {
|
||||
if (accounts[selectedWallet].address.findIndex(x => x.addr === this.selectedAddress) > -1) {
|
||||
return accounts[selectedWallet]
|
||||
},
|
||||
isOwner() {
|
||||
if (this.accounts) {
|
||||
if (this.accounts.address.findIndex(x => x.addr === this.selectedAddress) > -1) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
},
|
||||
selectedAddress() {
|
||||
if (this.address) {
|
||||
return this.address
|
||||
}
|
||||
const chain = this.$store.state.chains.selected.chain_name
|
||||
const selectedAddress = this.accounts.address.find(x => x.chain === chain)
|
||||
return selectedAddress?.addr
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
initialize() {
|
||||
|
Loading…
Reference in New Issue
Block a user