From f99f0093b9b35aa817ae3d9ae33a176112525df3 Mon Sep 17 00:00:00 2001 From: donne1226 <503124742@qq.com> Date: Wed, 30 Mar 2022 21:50:49 +0800 Subject: [PATCH] fix redelegate --- .../OperationModal/components/Redelegate.vue | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/views/components/OperationModal/components/Redelegate.vue b/src/views/components/OperationModal/components/Redelegate.vue index fd70b536..0795f5cb 100644 --- a/src/views/components/OperationModal/components/Redelegate.vue +++ b/src/views/components/OperationModal/components/Redelegate.vue @@ -147,13 +147,7 @@ export default { toValidator: null, token: '', amount: null, - balance: [], delegations: [], - feeDenom: '', - error: null, - sequence: 1, - accountNumber: 0, - account: [], required, password, @@ -170,9 +164,18 @@ export default { }, computed: { valOptions() { + let options = [] const vals = this.validators.map(x => ({ value: x.operator_address, label: `${x.description.moniker} (${Number(x.commission.rate) * 100}%)` })) + if (vals.length > 0) { + options.push({ value: null, label: '=== ACTIVE VALIDATORS ===' }) + options = options.concat(vals) + } const unbunded = this.unbundValidators.map(x => ({ value: x.operator_address, label: `* ${x.description.moniker} (${Number(x.commission.rate) * 100}%)` })) - return vals.concat(unbunded) + if (unbunded.length > 0) { + options.push({ value: null, label: '=== INACTIVE VALIDATORS ===', disabled: true }) + options = options.concat(unbunded) + } + return options }, tokenOptions() { if (!this.delegations) return [] @@ -198,24 +201,16 @@ export default { modalTitle: 'Redelegate Token', historyName: 'redelegate', }) - this.loadBalance() + this.loadData() }, methods: { - printDenom() { - return formatTokenDenom(this.token) - }, - loadBalance() { + loadData() { this.$http.getValidatorList().then(v => { this.validators = v }) this.$http.getValidatorUnbondedList().then(v => { this.unbundValidators = v }) - this.$http.getBankBalances(this.address).then(res => { - if (res && res.length > 0) { - this.balance = res.reverse() - } - }) this.$http.getStakingDelegations(this.address).then(res => { this.delegations = res.delegation_responses console.log(res) @@ -233,7 +228,9 @@ export default { format(v) { return formatToken(v) }, - + printDenom() { + return formatTokenDenom(this.token) + }, }, }