forked from cerc-io/cosmos-explorer
fix
This commit is contained in:
parent
3e6dccff77
commit
a592e0ed16
@ -11,15 +11,7 @@
|
||||
rules="required"
|
||||
name="Delegator"
|
||||
>
|
||||
<b-form-select
|
||||
v-if="account.length > 0"
|
||||
v-model="selectedAddress"
|
||||
:options="account"
|
||||
text-field="label"
|
||||
@change="onChange"
|
||||
/>
|
||||
<b-form-input
|
||||
v-else
|
||||
v-model="selectedAddress"
|
||||
readonly
|
||||
/>
|
||||
@ -176,7 +168,6 @@ export default {
|
||||
digits,
|
||||
length,
|
||||
alphaDash,
|
||||
account: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -7,16 +7,8 @@
|
||||
label-for="Account"
|
||||
>
|
||||
<b-input-group class="mb-25">
|
||||
<b-input-group-prepend is-text>
|
||||
<b-avatar
|
||||
:src="account?account.logo:''"
|
||||
size="18"
|
||||
variant="light-primary"
|
||||
rounded
|
||||
/>
|
||||
</b-input-group-prepend>
|
||||
<b-form-input
|
||||
:value="account?account.addr:address"
|
||||
:value="address"
|
||||
readonly
|
||||
/>
|
||||
</b-input-group>
|
||||
@ -28,15 +20,11 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
BRow, BCol, BInputGroup, BFormInput, BAvatar, BFormGroup,
|
||||
BInputGroupPrepend,
|
||||
BRow, BCol, BInputGroup, BFormInput, BFormGroup,
|
||||
} from 'bootstrap-vue'
|
||||
import {
|
||||
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
||||
} from '@validations'
|
||||
import {
|
||||
getLocalAccounts, getLocalChains,
|
||||
} from '@/libs/utils'
|
||||
|
||||
export default {
|
||||
name: 'WithdrawDialogue',
|
||||
@ -44,9 +32,7 @@ export default {
|
||||
BRow,
|
||||
BCol,
|
||||
BInputGroup,
|
||||
BInputGroupPrepend,
|
||||
BFormInput,
|
||||
BAvatar,
|
||||
BFormGroup,
|
||||
},
|
||||
props: {
|
||||
@ -96,45 +82,16 @@ export default {
|
||||
modalTitle: 'Withdraw Rewards',
|
||||
historyName: 'withdraw',
|
||||
})
|
||||
this.loadBalance()
|
||||
this.loadData()
|
||||
},
|
||||
|
||||
methods: {
|
||||
loadBalance() {
|
||||
this.account = this.computeAccount()
|
||||
if (this.account && this.account.length > 0) this.address = this.account[0].addr
|
||||
if (this.address) {
|
||||
this.$http.getBankBalances(this.address).then(res => {
|
||||
if (res && res.length > 0) {
|
||||
this.balance = res.reverse()
|
||||
const token = this.balance.find(i => !i.denom.startsWith('ibc'))
|
||||
if (token) this.feeDenom = token.denom
|
||||
}
|
||||
})
|
||||
}
|
||||
loadData() {
|
||||
this.$http.getStakingDelegations(this.address).then(res => {
|
||||
console.log(res)
|
||||
this.delegations = res.delegation_responses
|
||||
})
|
||||
},
|
||||
computeAccount() {
|
||||
const accounts = getLocalAccounts()
|
||||
const chains = getLocalChains()
|
||||
if (accounts) {
|
||||
const values = Object.values(accounts)
|
||||
for (let i = 0; i < values.length; i += 1) {
|
||||
const addr = values[i].address.find(x => x.addr === this.address)
|
||||
if (addr) {
|
||||
this.selectedChain = chains[addr.chain]
|
||||
this.$emit('update', {
|
||||
selectedChain: chains[addr.chain],
|
||||
})
|
||||
return addr
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user