(Update) "Contract Type" drop down list and getCreator method

Add ValidatorMetadata and ProxyStorage to drop down list and getCreator method to VotingToChange* contracts
This commit is contained in:
Vadim Arasev 2018-05-08 11:49:56 +03:00
parent 9ff2e5cbf0
commit 619c6c8ff4
6 changed files with 46 additions and 7 deletions

View File

@ -147,9 +147,14 @@ export class BallotCard extends React.Component {
@action("Get creator")
getCreator = async () => {
const { contractsStore, id, votingType } = this.props;
let votingState = await this.repeatGetProperty(contractsStore, votingType, id, "votingState", 0);
if (votingState) {
this.getValidatorFullname(votingState.creator);
let creator = await this.repeatGetProperty(contractsStore, votingType, id, "getCreator", 0);
if (creator) {
this.getValidatorFullname(creator);
} else {
let votingState = await this.repeatGetProperty(contractsStore, votingType, id, "votingState", 0);
if (votingState) {
this.getValidatorFullname(votingState.creator);
}
}
}

View File

@ -35,6 +35,8 @@ export class BallotProxyMetadata extends React.Component {
{ value: '3', label: ballotStore.ProxyBallotType[3] },
{ value: '4', label: ballotStore.ProxyBallotType[4] },
{ value: '5', label: ballotStore.ProxyBallotType[5] },
{ value: '7', label: ballotStore.ProxyBallotType[7] },
{ value: '8', label: ballotStore.ProxyBallotType[8] },
]}
>
</Select>

View File

@ -43,7 +43,17 @@ export default class VotingToChangeKeys {
}
votingState(_id) {
return this.votingToChangeKeysInstance.methods.votingState(_id).call();
if (this.votingToChangeKeysInstance.methods.votingState) {
return this.votingToChangeKeysInstance.methods.votingState(_id).call();
}
return null;
}
getCreator(_id) {
if (this.votingToChangeKeysInstance.methods.getCreator) {
return this.votingToChangeKeysInstance.methods.getCreator(_id).call();
}
return null;
}
getTotalVoters(_id) {

View File

@ -39,7 +39,17 @@ export default class VotingToChangeMinThreshold {
}
votingState(_id) {
return this.votingToChangeMinThresholdInstance.methods.votingState(_id).call();
if (this.votingToChangeMinThresholdInstance.methods.votingState) {
return this.votingToChangeMinThresholdInstance.methods.votingState(_id).call();
}
return null;
}
getCreator(_id) {
if (this.votingToChangeMinThresholdInstance.methods.getCreator) {
return this.votingToChangeMinThresholdInstance.methods.getCreator(_id).call();
}
return null;
}
getTotalVoters(_id) {

View File

@ -39,7 +39,17 @@ export default class VotingToChangeProxy {
}
votingState(_id) {
return this.votingToChangeProxyInstance.methods.votingState(_id).call();
if (this.votingToChangeProxyInstance.methods.votingState) {
return this.votingToChangeProxyInstance.methods.votingState(_id).call();
}
return null;
}
getCreator(_id) {
if (this.votingToChangeProxyInstance.methods.getCreator) {
return this.votingToChangeProxyInstance.methods.getCreator(_id).call();
}
return null;
}
getTotalVoters(_id) {

View File

@ -22,7 +22,9 @@ class BallotStore {
2: 'VotingToChangeKeys',
3: 'VotingToChangeMinThreshold',
4: 'VotingToChangeProxy',
5: 'BallotsStorage'
5: 'BallotsStorage',
7: 'ValidatorMetadata',
8: 'ProxyStorage'
}
@observable ballotType;
@observable keysBallotType;