fix
This commit is contained in:
parent
3e6dccff77
commit
a592e0ed16
@ -11,15 +11,7 @@
|
|||||||
rules="required"
|
rules="required"
|
||||||
name="Delegator"
|
name="Delegator"
|
||||||
>
|
>
|
||||||
<b-form-select
|
|
||||||
v-if="account.length > 0"
|
|
||||||
v-model="selectedAddress"
|
|
||||||
:options="account"
|
|
||||||
text-field="label"
|
|
||||||
@change="onChange"
|
|
||||||
/>
|
|
||||||
<b-form-input
|
<b-form-input
|
||||||
v-else
|
|
||||||
v-model="selectedAddress"
|
v-model="selectedAddress"
|
||||||
readonly
|
readonly
|
||||||
/>
|
/>
|
||||||
@ -176,7 +168,6 @@ export default {
|
|||||||
digits,
|
digits,
|
||||||
length,
|
length,
|
||||||
alphaDash,
|
alphaDash,
|
||||||
account: [],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -7,16 +7,8 @@
|
|||||||
label-for="Account"
|
label-for="Account"
|
||||||
>
|
>
|
||||||
<b-input-group class="mb-25">
|
<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
|
<b-form-input
|
||||||
:value="account?account.addr:address"
|
:value="address"
|
||||||
readonly
|
readonly
|
||||||
/>
|
/>
|
||||||
</b-input-group>
|
</b-input-group>
|
||||||
@ -28,15 +20,11 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
BRow, BCol, BInputGroup, BFormInput, BAvatar, BFormGroup,
|
BRow, BCol, BInputGroup, BFormInput, BFormGroup,
|
||||||
BInputGroupPrepend,
|
|
||||||
} from 'bootstrap-vue'
|
} from 'bootstrap-vue'
|
||||||
import {
|
import {
|
||||||
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
||||||
} from '@validations'
|
} from '@validations'
|
||||||
import {
|
|
||||||
getLocalAccounts, getLocalChains,
|
|
||||||
} from '@/libs/utils'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'WithdrawDialogue',
|
name: 'WithdrawDialogue',
|
||||||
@ -44,9 +32,7 @@ export default {
|
|||||||
BRow,
|
BRow,
|
||||||
BCol,
|
BCol,
|
||||||
BInputGroup,
|
BInputGroup,
|
||||||
BInputGroupPrepend,
|
|
||||||
BFormInput,
|
BFormInput,
|
||||||
BAvatar,
|
|
||||||
BFormGroup,
|
BFormGroup,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@ -96,45 +82,16 @@ export default {
|
|||||||
modalTitle: 'Withdraw Rewards',
|
modalTitle: 'Withdraw Rewards',
|
||||||
historyName: 'withdraw',
|
historyName: 'withdraw',
|
||||||
})
|
})
|
||||||
this.loadBalance()
|
this.loadData()
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
loadBalance() {
|
loadData() {
|
||||||
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
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.$http.getStakingDelegations(this.address).then(res => {
|
this.$http.getStakingDelegations(this.address).then(res => {
|
||||||
|
console.log(res)
|
||||||
this.delegations = res.delegation_responses
|
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>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user