fix
This commit is contained in:
parent
d9ef5e1d98
commit
4630ce63b1
@ -156,6 +156,14 @@ export default class ChainFetch {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getValidatorListByStatus(status) {
|
||||||
|
return this.get(`/cosmos/staking/v1beta1/validators?status=${status}`).then(data => {
|
||||||
|
const result = commonProcess(data)
|
||||||
|
const vals = result.validators ? result.validators : result
|
||||||
|
return vals.map(i => new Validator().init(i))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
async getValidatorListByHeight(height) {
|
async getValidatorListByHeight(height) {
|
||||||
return this.get(`/validatorsets/${height}`).then(data => commonProcess(data))
|
return this.get(`/validatorsets/${height}`).then(data => commonProcess(data))
|
||||||
}
|
}
|
||||||
|
@ -93,17 +93,18 @@
|
|||||||
no-body
|
no-body
|
||||||
>
|
>
|
||||||
<b-card-header class="d-flex justify-content-between">
|
<b-card-header class="d-flex justify-content-between">
|
||||||
<small class="d-none d-md-block">
|
<b-form-group>
|
||||||
<b-badge variant="danger">
|
<b-form-radio-group
|
||||||
|
id="btn-radios-1"
|
||||||
</b-badge>
|
v-model="selectedStatus"
|
||||||
Top 33%
|
button-variant="outline-primary"
|
||||||
<b-badge variant="warning">
|
:options="statusOptions"
|
||||||
|
buttons
|
||||||
</b-badge>
|
name="radios-btn-default"
|
||||||
Top 67% of Voting Power
|
@change="getValidatorListByStatus"
|
||||||
</small>
|
/>
|
||||||
<b-card-title>
|
</b-form-group>
|
||||||
|
<b-card-title class="d-none d-sm-block">
|
||||||
<span>Validators {{ validators.length }}/{{ stakingParameters.max_validators }} </span>
|
<span>Validators {{ validators.length }}/{{ stakingParameters.max_validators }} </span>
|
||||||
</b-card-title>
|
</b-card-title>
|
||||||
</b-card-header>
|
</b-card-header>
|
||||||
@ -195,6 +196,18 @@
|
|||||||
</template>
|
</template>
|
||||||
</b-table>
|
</b-table>
|
||||||
</b-card-body>
|
</b-card-body>
|
||||||
|
<template #footer>
|
||||||
|
<small class="d-none d-md-block">
|
||||||
|
<b-badge variant="danger">
|
||||||
|
|
||||||
|
</b-badge>
|
||||||
|
Top 33%
|
||||||
|
<b-badge variant="warning">
|
||||||
|
|
||||||
|
</b-badge>
|
||||||
|
Top 67% of Voting Power
|
||||||
|
</small>
|
||||||
|
</template>
|
||||||
</b-card>
|
</b-card>
|
||||||
<operation-delegate-component :validator-address="validator_address" />
|
<operation-delegate-component :validator-address="validator_address" />
|
||||||
</div>
|
</div>
|
||||||
@ -202,10 +215,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
BTable, BMedia, BAvatar, BBadge, BCard, BCardHeader, BCardTitle, VBTooltip, BCardBody, BButton,
|
BTable, BMedia, BAvatar, BBadge, BCard, BCardHeader, BCardTitle, VBTooltip, BCardBody, BButton, BFormRadioGroup, BFormGroup,
|
||||||
} from 'bootstrap-vue'
|
} from 'bootstrap-vue'
|
||||||
import {
|
import {
|
||||||
Validator, percent, StakingParameters, formatToken,
|
percent, StakingParameters, formatToken,
|
||||||
} from '@/libs/utils'
|
} from '@/libs/utils'
|
||||||
import { keybase } from '@/libs/fetch'
|
import { keybase } from '@/libs/fetch'
|
||||||
// import { toHex } from '@cosmjs/encoding'
|
// import { toHex } from '@cosmjs/encoding'
|
||||||
@ -224,6 +237,8 @@ export default {
|
|||||||
BCardBody,
|
BCardBody,
|
||||||
BButton,
|
BButton,
|
||||||
OperationDelegateComponent,
|
OperationDelegateComponent,
|
||||||
|
BFormRadioGroup,
|
||||||
|
BFormGroup,
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
'b-tooltip': VBTooltip,
|
'b-tooltip': VBTooltip,
|
||||||
@ -252,8 +267,8 @@ export default {
|
|||||||
mintInflation: 0,
|
mintInflation: 0,
|
||||||
stakingPool: 1,
|
stakingPool: 1,
|
||||||
stakingParameters: new StakingParameters(),
|
stakingParameters: new StakingParameters(),
|
||||||
validators: [new Validator()],
|
validators: [],
|
||||||
delegations: [new Validator()],
|
delegations: [],
|
||||||
changes: {},
|
changes: {},
|
||||||
validator_fields: [
|
validator_fields: [
|
||||||
{
|
{
|
||||||
@ -288,6 +303,11 @@ export default {
|
|||||||
thClass: 'text-right',
|
thClass: 'text-right',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
statusOptions: [
|
||||||
|
{ text: 'Active', value: ['BOND_STATUS_BONDED'] },
|
||||||
|
{ text: 'Inactive', value: ['BOND_STATUS_UNBONDED', 'BOND_STATUS_UNBONDING'] },
|
||||||
|
],
|
||||||
|
selectedStatus: ['BOND_STATUS_BONDED'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -331,7 +351,16 @@ export default {
|
|||||||
this.$http.getStakingParameters().then(res => {
|
this.$http.getStakingParameters().then(res => {
|
||||||
this.stakingParameters = res
|
this.stakingParameters = res
|
||||||
})
|
})
|
||||||
this.$http.getValidatorList().then(res => {
|
this.getValidatorListByStatus(this.selectedStatus)
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.islive = false
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getValidatorListByStatus(statusList) {
|
||||||
|
this.validators = []
|
||||||
|
statusList.forEach(status => {
|
||||||
|
this.$http.getValidatorListByStatus(status).then(res => {
|
||||||
const identities = []
|
const identities = []
|
||||||
const temp = res
|
const temp = res
|
||||||
let total = 0
|
let total = 0
|
||||||
@ -346,7 +375,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.stakingPool = total
|
this.stakingPool = total
|
||||||
this.validators = temp
|
this.validators.push(...temp)
|
||||||
|
|
||||||
// fetch avatar from keybase
|
// fetch avatar from keybase
|
||||||
let promise = Promise.resolve()
|
let promise = Promise.resolve()
|
||||||
@ -356,11 +385,8 @@ export default {
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
|
||||||
this.islive = false
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
selectValidator(da) {
|
selectValidator(da) {
|
||||||
this.validator_address = da
|
this.validator_address = da
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user