load threshold for each ballot
This commit is contained in:
parent
795472ec57
commit
6b0b54f670
|
@ -610,21 +610,6 @@ export class BallotCard extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
getThreshold(contractsStore, votingType) {
|
||||
switch (votingType) {
|
||||
case 'votingToChangeKeys':
|
||||
return contractsStore.keysBallotThreshold
|
||||
case 'votingToChangeMinThreshold':
|
||||
return contractsStore.minThresholdBallotThreshold
|
||||
case 'votingToChangeProxy':
|
||||
return contractsStore.proxyBallotThreshold
|
||||
case 'votingToManageEmissionFunds':
|
||||
return contractsStore.emissionFundsBallotThreshold
|
||||
default:
|
||||
return contractsStore.keysBallotThreshold
|
||||
}
|
||||
}
|
||||
|
||||
getMinBallotDuration(contractsStore, votingType) {
|
||||
switch (votingType) {
|
||||
case 'votingToChangeKeys':
|
||||
|
@ -682,10 +667,9 @@ export class BallotCard extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
let { contractsStore, votingType, children } = this.props
|
||||
let { contractsStore, votingType, children, votingState } = this.props
|
||||
let votes
|
||||
|
||||
const threshold = this.getThreshold(contractsStore, votingType)
|
||||
const networkBranch = this.getVotingNetworkBranch()
|
||||
|
||||
if (votingType === 'votingToManageEmissionFunds') {
|
||||
|
@ -747,7 +731,7 @@ export class BallotCard extends React.Component {
|
|||
<BallotInfoContainer
|
||||
memo={this.memo}
|
||||
networkBranch={networkBranch}
|
||||
threshold={threshold}
|
||||
threshold={votingState.threshold}
|
||||
validatorsLength={contractsStore.validatorsLength}
|
||||
/>
|
||||
<BallotFooter
|
||||
|
|
|
@ -330,8 +330,12 @@ class ContractsStore {
|
|||
getCard = async (id, contractType) => {
|
||||
let votingState
|
||||
try {
|
||||
votingState = await this[contractType].getBallotInfo(id, this.votingKey)
|
||||
votingState = this.fillCardVotingState(votingState, contractType)
|
||||
const data = await Promise.all([
|
||||
this[contractType].getBallotInfo(id, this.votingKey),
|
||||
this[contractType].instance.methods.getMinThresholdOfVoters(id).call()
|
||||
])
|
||||
votingState = this.fillCardVotingState(data[0], contractType)
|
||||
votingState.threshold = data[1]
|
||||
} catch (e) {
|
||||
console.log(e.message)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue