(Fix) Optimization for new smart contracts
This commit is contained in:
parent
5a370b8eac
commit
61dc67ce2b
|
@ -2,7 +2,6 @@ import React from "react";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { observable, action, computed } from "mobx";
|
import { observable, action, computed } from "mobx";
|
||||||
import { inject, observer } from "mobx-react";
|
import { inject, observer } from "mobx-react";
|
||||||
import { toAscii } from "../helpers";
|
|
||||||
import { messages } from "../messages";
|
import { messages } from "../messages";
|
||||||
import swal from "sweetalert2";
|
import swal from "sweetalert2";
|
||||||
|
|
||||||
|
@ -33,6 +32,7 @@ export class BallotCard extends React.Component {
|
||||||
@observable progress;
|
@observable progress;
|
||||||
@observable totalVoters;
|
@observable totalVoters;
|
||||||
@observable isFinalized;
|
@observable isFinalized;
|
||||||
|
@observable canBeFinalized;
|
||||||
@observable hasAlreadyVoted;
|
@observable hasAlreadyVoted;
|
||||||
@observable memo;
|
@observable memo;
|
||||||
|
|
||||||
|
@ -188,8 +188,16 @@ export class BallotCard extends React.Component {
|
||||||
}
|
}
|
||||||
// getIsFinalized
|
// getIsFinalized
|
||||||
this.isFinalized = votingState.isFinalized;
|
this.isFinalized = votingState.isFinalized;
|
||||||
|
// canBeFinalizedNow
|
||||||
|
this.canBeFinalized = votingState.hasOwnProperty('canBeFinalizedNow') ? votingState.canBeFinalizedNow : null;
|
||||||
// getMemo
|
// getMemo
|
||||||
this.memo = votingState.memo;
|
this.memo = votingState.memo;
|
||||||
|
// hasAlreadyVoted
|
||||||
|
if (votingState.hasOwnProperty('hasAlreadyVoted')) {
|
||||||
|
this.hasAlreadyVoted = votingState.hasAlreadyVoted;
|
||||||
|
} else {
|
||||||
|
this.getHasAlreadyVoted();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.getTimes();
|
this.getTimes();
|
||||||
const creator = await this.repeatGetProperty(contractsStore, votingType, id, "getCreator", 0);
|
const creator = await this.repeatGetProperty(contractsStore, votingType, id, "getCreator", 0);
|
||||||
|
@ -199,7 +207,9 @@ export class BallotCard extends React.Component {
|
||||||
this.getTotalVoters();
|
this.getTotalVoters();
|
||||||
this.getProgress();
|
this.getProgress();
|
||||||
this.getIsFinalized();
|
this.getIsFinalized();
|
||||||
|
this.canBeFinalizedNow();
|
||||||
this.getMemo();
|
this.getMemo();
|
||||||
|
this.getHasAlreadyVoted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,12 +241,10 @@ export class BallotCard extends React.Component {
|
||||||
@action("Get validator full name")
|
@action("Get validator full name")
|
||||||
getValidatorFullname = async (_miningKey) => {
|
getValidatorFullname = async (_miningKey) => {
|
||||||
const { contractsStore } = this.props;
|
const { contractsStore } = this.props;
|
||||||
let validator = await this.repeatGetProperty(contractsStore, "validatorMetadata", _miningKey, "validators", 0);
|
const miningKeyLowerCase = _miningKey.toLowerCase();
|
||||||
let firstName, lastName, fullName
|
let fullName;
|
||||||
if (validator) {
|
if (contractsStore.validatorsMetadata.hasOwnProperty(miningKeyLowerCase)) {
|
||||||
firstName = toAscii(validator.firstName);
|
fullName = contractsStore.validatorsMetadata[miningKeyLowerCase].fullName;
|
||||||
lastName = toAscii(validator.lastName);
|
|
||||||
fullName = `${firstName} ${lastName}`;
|
|
||||||
}
|
}
|
||||||
this.creatorMiningKey = _miningKey;
|
this.creatorMiningKey = _miningKey;
|
||||||
this.creator = fullName ? fullName : _miningKey;
|
this.creator = fullName ? fullName : _miningKey;
|
||||||
|
@ -274,7 +282,7 @@ export class BallotCard extends React.Component {
|
||||||
canBeFinalizedNow = async () => {
|
canBeFinalizedNow = async () => {
|
||||||
const { contractsStore, id, votingType } = this.props;
|
const { contractsStore, id, votingType } = this.props;
|
||||||
let _canBeFinalizedNow = await this.repeatGetProperty(contractsStore, votingType, id, "canBeFinalizedNow", 0);
|
let _canBeFinalizedNow = await this.repeatGetProperty(contractsStore, votingType, id, "canBeFinalizedNow", 0);
|
||||||
return _canBeFinalizedNow;
|
this.canBeFinalized = _canBeFinalizedNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
getMemo = async () => {
|
getMemo = async () => {
|
||||||
|
@ -335,12 +343,13 @@ export class BallotCard extends React.Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
commonStore.showLoading();
|
commonStore.showLoading();
|
||||||
let canBeFinalized = await this.canBeFinalizedNow();
|
await this.canBeFinalizedNow();
|
||||||
if (canBeFinalized === null) {
|
let _canBeFinalized = this.canBeFinalized;
|
||||||
|
if (_canBeFinalized === null) {
|
||||||
console.log('canBeFinalizedNow is not existed');
|
console.log('canBeFinalizedNow is not existed');
|
||||||
canBeFinalized = !(await this.isActive());
|
_canBeFinalized = !(await this.isActive());
|
||||||
}
|
}
|
||||||
if (!canBeFinalized) {
|
if (!_canBeFinalized) {
|
||||||
commonStore.hideLoading();
|
commonStore.hideLoading();
|
||||||
swal("Warning!", messages.INVALID_FINALIZE_MSG, "warning");
|
swal("Warning!", messages.INVALID_FINALIZE_MSG, "warning");
|
||||||
return;
|
return;
|
||||||
|
@ -411,7 +420,6 @@ export class BallotCard extends React.Component {
|
||||||
this.isFinalized = false;
|
this.isFinalized = false;
|
||||||
this.hasAlreadyVoted = false;
|
this.hasAlreadyVoted = false;
|
||||||
this.getVotingState();
|
this.getVotingState();
|
||||||
this.getHasAlreadyVoted();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
@ -426,7 +434,7 @@ export class BallotCard extends React.Component {
|
||||||
|
|
||||||
showCard = () => {
|
showCard = () => {
|
||||||
let { commonStore } = this.props;
|
let { commonStore } = this.props;
|
||||||
let checkToFinalizeFilter = commonStore.isToFinalizeFilter ? !this.isFinalized && this.timeToFinish.val == 0 && this.timeToStart.val == 0 : true;
|
let checkToFinalizeFilter = commonStore.isToFinalizeFilter ? !this.isFinalized && (this.timeToFinish.val == 0 || this.canBeFinalized) && this.timeToStart.val == 0 : true;
|
||||||
let show = commonStore.isActiveFilter ? !this.isFinalized : checkToFinalizeFilter;
|
let show = commonStore.isActiveFilter ? !this.isFinalized : checkToFinalizeFilter;
|
||||||
return show;
|
return show;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,18 +52,30 @@ export class BallotKeysCard extends React.Component {
|
||||||
this.miningKey = votingState.miningKey;
|
this.miningKey = votingState.miningKey;
|
||||||
|
|
||||||
if (this.miningKey && this.miningKey !== '0x0000000000000000000000000000000000000000') {
|
if (this.miningKey && this.miningKey !== '0x0000000000000000000000000000000000000000') {
|
||||||
for (let i = 0; i < contractsStore.validatorsMetadata.length; i++) {
|
const miningKeyLowerCase = this.miningKey.toLowerCase();
|
||||||
if (contractsStore.validatorsMetadata[i].value.toLowerCase() === this.miningKey.toLowerCase()) {
|
if (contractsStore.validatorsMetadata.hasOwnProperty(miningKeyLowerCase)) {
|
||||||
this.miningKey = contractsStore.validatorsMetadata[i].labelInvers;
|
this.miningKey = contractsStore.validatorsMetadata[miningKeyLowerCase].lastNameAndKey;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (votingState.hasOwnProperty('newVotingKey')) {
|
||||||
|
this.newVotingKey = votingState.newVotingKey;
|
||||||
|
} else {
|
||||||
|
this.getNewVotingKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (votingState.hasOwnProperty('newPayoutKey')) {
|
||||||
|
this.newPayoutKey = votingState.newPayoutKey;
|
||||||
|
} else {
|
||||||
|
this.getNewPayoutKey();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.getAffectedKey();
|
this.getAffectedKey();
|
||||||
this.getAffectedKeyType();
|
this.getAffectedKeyType();
|
||||||
this.getBallotType();
|
this.getBallotType();
|
||||||
this.getMiningKey();
|
this.getMiningKey();
|
||||||
|
this.getNewVotingKey();
|
||||||
|
this.getNewPayoutKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,12 +156,10 @@ export class BallotKeysCard extends React.Component {
|
||||||
console.log(e.message);
|
console.log(e.message);
|
||||||
}
|
}
|
||||||
if (miningKey && miningKey !== '0x0000000000000000000000000000000000000000') {
|
if (miningKey && miningKey !== '0x0000000000000000000000000000000000000000') {
|
||||||
|
const miningKeyLowerCase = this.miningKey.toLowerCase();
|
||||||
this.miningKey = miningKey;
|
this.miningKey = miningKey;
|
||||||
for (let i = 0; i < contractsStore.validatorsMetadata.length; i++) {
|
if (contractsStore.validatorsMetadata.hasOwnProperty(miningKeyLowerCase)) {
|
||||||
if (contractsStore.validatorsMetadata[i].value.toLowerCase() === this.miningKey.toLowerCase()) {
|
this.miningKey = contractsStore.validatorsMetadata[miningKeyLowerCase].lastNameAndKey;
|
||||||
this.miningKey = contractsStore.validatorsMetadata[i].labelInvers;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,8 +167,6 @@ export class BallotKeysCard extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.getVotingState();
|
this.getVotingState();
|
||||||
this.getNewVotingKey();
|
|
||||||
this.getNewPayoutKey();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAffectedKeyTypeDisplayName = () => {
|
getAffectedKeyTypeDisplayName = () => {
|
||||||
|
|
|
@ -8,7 +8,12 @@ import "react-select/dist/react-select.css";
|
||||||
export class BallotKeysMetadata extends React.Component {
|
export class BallotKeysMetadata extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const { ballotStore, contractsStore } = this.props;
|
const { ballotStore, contractsStore } = this.props;
|
||||||
const options = contractsStore.validatorsMetadata.slice();
|
let options = [];
|
||||||
|
for (var key in contractsStore.validatorsMetadata) {
|
||||||
|
if (contractsStore.validatorsMetadata.hasOwnProperty(key)) {
|
||||||
|
options.push(contractsStore.validatorsMetadata[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
let newVotingPayoutKeys = '';
|
let newVotingPayoutKeys = '';
|
||||||
if (ballotStore.isNewValidatorPersonalData && contractsStore.votingToChangeKeys.doesMethodExist('createBallotToAddNewValidator')) {
|
if (ballotStore.isNewValidatorPersonalData && contractsStore.votingToChangeKeys.doesMethodExist('createBallotToAddNewValidator')) {
|
||||||
newVotingPayoutKeys = <div>
|
newVotingPayoutKeys = <div>
|
||||||
|
|
|
@ -14,6 +14,8 @@ constants.ABIsSources = {
|
||||||
};
|
};
|
||||||
constants.NEW_MINING_KEY = {
|
constants.NEW_MINING_KEY = {
|
||||||
label: "New Mining Key",
|
label: "New Mining Key",
|
||||||
|
lastNameAndKey: "",
|
||||||
|
fullName: "",
|
||||||
value: "0x0000000000000000000000000000000000000000"
|
value: "0x0000000000000000000000000000000000000000"
|
||||||
};
|
};
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import Web3 from 'web3';
|
import Web3 from 'web3';
|
||||||
import moment from 'moment';
|
|
||||||
import { networkAddresses } from './addresses';
|
import { networkAddresses } from './addresses';
|
||||||
import helpers from "./helpers";
|
import helpers from "./helpers";
|
||||||
import { toAscii } from "../helpers";
|
import { toAscii } from "../helpers";
|
||||||
|
@ -17,35 +16,21 @@ export default class ValidatorMetadata {
|
||||||
this.metadataInstance = new web3_10.eth.Contract(MetadataAbi, METADATA_ADDRESS);
|
this.metadataInstance = new web3_10.eth.Contract(MetadataAbi, METADATA_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getValidatorData({votingKey, miningKey}){
|
async getValidatorFullName({votingKey, miningKey}){
|
||||||
miningKey = miningKey || await this.getMiningByVoting(votingKey);
|
miningKey = miningKey || await this.getMiningByVoting(votingKey);
|
||||||
let validatorData = await this.metadataInstance.methods.validators(miningKey).call();
|
let validator;
|
||||||
let createdDate = validatorData.createdDate > 0 ? moment.unix(validatorData.createdDate).format('YYYY-MM-DD') : ''
|
if (this.metadataInstance.methods.getValidatorName) {
|
||||||
let updatedDate = validatorData.updatedDate > 0 ? moment.unix(validatorData.updatedDate).format('YYYY-MM-DD') : ''
|
validator = await this.metadataInstance.methods.getValidatorName(miningKey).call();
|
||||||
let expirationDate = validatorData.expirationDate > 0 ? moment.unix(validatorData.expirationDate).format('YYYY-MM-DD') : ''
|
} else {
|
||||||
|
validator = await this.metadataInstance.methods.validators(miningKey).call();
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
firstName: toAscii(validatorData.firstName),
|
firstName: toAscii(validator.firstName),
|
||||||
lastName: toAscii(validatorData.lastName),
|
lastName: toAscii(validator.lastName)
|
||||||
fullAddress: validatorData.fullAddress,
|
|
||||||
createdDate,
|
|
||||||
updatedDate,
|
|
||||||
expirationDate,
|
|
||||||
licenseId: toAscii(validatorData.licenseId),
|
|
||||||
us_state: toAscii(validatorData.state),
|
|
||||||
postal_code: toAscii(validatorData.zipcode),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMiningByVoting(votingKey){
|
async getMiningByVoting(votingKey){
|
||||||
return await this.metadataInstance.methods.getMiningByVotingKey(votingKey).call();
|
return await this.metadataInstance.methods.getMiningByVotingKey(votingKey).call();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMinThreshold({miningKey}) {
|
|
||||||
let validatorData = await this.metadataInstance.methods.validators(miningKey).call();
|
|
||||||
return validatorData.minThreshold;
|
|
||||||
}
|
|
||||||
|
|
||||||
validators(_miningKey) {
|
|
||||||
return this.metadataInstance.methods.validators(_miningKey).call();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,13 @@ export default class VotingToChangeKeys {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBallotInfo(_id, _votingKey) {
|
||||||
|
if (this.doesMethodExist('getBallotInfo')) {
|
||||||
|
return this.votingToChangeKeysInstance.methods.getBallotInfo(_id).call();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
getCreator(_id) {
|
getCreator(_id) {
|
||||||
if (this.doesMethodExist('getCreator')) {
|
if (this.doesMethodExist('getCreator')) {
|
||||||
return this.votingToChangeKeysInstance.methods.getCreator(_id).call();
|
return this.votingToChangeKeysInstance.methods.getCreator(_id).call();
|
||||||
|
|
|
@ -62,6 +62,13 @@ export default class VotingToChangeMinThreshold {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBallotInfo(_id, _votingKey) {
|
||||||
|
if (this.doesMethodExist('getBallotInfo')) {
|
||||||
|
return this.votingToChangeMinThresholdInstance.methods.getBallotInfo(_id, _votingKey).call();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
getCreator(_id) {
|
getCreator(_id) {
|
||||||
if (this.doesMethodExist('getCreator')) {
|
if (this.doesMethodExist('getCreator')) {
|
||||||
return this.votingToChangeMinThresholdInstance.methods.getCreator(_id).call();
|
return this.votingToChangeMinThresholdInstance.methods.getCreator(_id).call();
|
||||||
|
|
|
@ -62,6 +62,13 @@ export default class VotingToChangeProxy {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBallotInfo(_id, _votingKey) {
|
||||||
|
if (this.doesMethodExist('getBallotInfo')) {
|
||||||
|
return this.votingToChangeProxyInstance.methods.getBallotInfo(_id, _votingKey).call();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
getCreator(_id) {
|
getCreator(_id) {
|
||||||
if (this.doesMethodExist('getCreator')) {
|
if (this.doesMethodExist('getCreator')) {
|
||||||
return this.votingToChangeProxyInstance.methods.getCreator(_id).call();
|
return this.votingToChangeProxyInstance.methods.getCreator(_id).call();
|
||||||
|
|
|
@ -39,7 +39,7 @@ class ContractsStore {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.votingKey = null;
|
this.votingKey = null;
|
||||||
this.miningKey = null;
|
this.miningKey = null;
|
||||||
this.validatorsMetadata = [];
|
this.validatorsMetadata = {};
|
||||||
this.validatorLimits = {keys: null, minThreshold: null, proxy: null};
|
this.validatorLimits = {keys: null, minThreshold: null, proxy: null};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,57 +178,58 @@ class ContractsStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
getCards = async (nextBallotId, contractType) => {
|
getCards = async (nextBallotId, contractType) => {
|
||||||
if (nextBallotId) {
|
for (let id = nextBallotId - 1; id >= 0; id--) {
|
||||||
for (let id = nextBallotId - 1; id >= 0; id--) {
|
let startTime = 0;
|
||||||
let startTime = 0;
|
let votingState;
|
||||||
let votingState;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
votingState = await this[contractType].getBallotInfo(id, this.votingKey);
|
||||||
|
if (!votingState) {
|
||||||
votingState = await this[contractType].votingState(id);
|
votingState = await this[contractType].votingState(id);
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (votingState) {
|
||||||
|
startTime = votingState.startTime;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
startTime = await this[contractType].getStartTime(id);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log(e.message);
|
console.log(e.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (votingState) {
|
|
||||||
startTime = votingState.startTime;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
startTime = await this[contractType].getStartTime(id);
|
|
||||||
} catch(e) {
|
|
||||||
console.log(e.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let card;
|
|
||||||
switch(contractType) {
|
|
||||||
case "votingToChangeKeys":
|
|
||||||
card = <BallotKeysCard
|
|
||||||
id={id}
|
|
||||||
type={ballotStore.BallotType.keys}
|
|
||||||
key={ballotsStore.ballotCards.length}
|
|
||||||
votingState={votingState}
|
|
||||||
startTime={startTime}/>
|
|
||||||
break;
|
|
||||||
case "votingToChangeMinThreshold":
|
|
||||||
card = <BallotMinThresholdCard
|
|
||||||
id={id}
|
|
||||||
type={ballotStore.BallotType.minThreshold}
|
|
||||||
key={ballotsStore.ballotCards.length}
|
|
||||||
votingState={votingState}
|
|
||||||
startTime={startTime}/>
|
|
||||||
break;
|
|
||||||
case "votingToChangeProxy":
|
|
||||||
card = <BallotProxyCard
|
|
||||||
id={id}
|
|
||||||
type={ballotStore.BallotType.proxy}
|
|
||||||
key={ballotsStore.ballotCards.length}
|
|
||||||
votingState={votingState}
|
|
||||||
startTime={startTime}/>
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ballotsStore.ballotCards.push(card);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let card;
|
||||||
|
switch(contractType) {
|
||||||
|
case "votingToChangeKeys":
|
||||||
|
card = <BallotKeysCard
|
||||||
|
id={id}
|
||||||
|
type={ballotStore.BallotType.keys}
|
||||||
|
key={ballotsStore.ballotCards.length}
|
||||||
|
votingState={votingState}
|
||||||
|
startTime={startTime}/>
|
||||||
|
break;
|
||||||
|
case "votingToChangeMinThreshold":
|
||||||
|
card = <BallotMinThresholdCard
|
||||||
|
id={id}
|
||||||
|
type={ballotStore.BallotType.minThreshold}
|
||||||
|
key={ballotsStore.ballotCards.length}
|
||||||
|
votingState={votingState}
|
||||||
|
startTime={startTime}/>
|
||||||
|
break;
|
||||||
|
case "votingToChangeProxy":
|
||||||
|
card = <BallotProxyCard
|
||||||
|
id={id}
|
||||||
|
type={ballotStore.BallotType.proxy}
|
||||||
|
key={ballotsStore.ballotCards.length}
|
||||||
|
votingState={votingState}
|
||||||
|
startTime={startTime}/>
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ballotsStore.ballotCards.push(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,16 +265,25 @@ class ContractsStore {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async getAllValidatorMetadata() {
|
async getAllValidatorMetadata() {
|
||||||
this.validatorsMetadata.push(constants.NEW_MINING_KEY);
|
//this.validatorsMetadata.push(constants.NEW_MINING_KEY);
|
||||||
|
this.validatorsMetadata[constants.NEW_MINING_KEY.value] = constants.NEW_MINING_KEY;
|
||||||
|
|
||||||
const keys = await this.poaConsensus.getValidators();
|
const keys = await this.poaConsensus.getValidators();
|
||||||
this.validatorsLength = keys.length;
|
this.validatorsLength = keys.length;
|
||||||
keys.forEach(async (key) => {
|
keys.forEach(async (key) => {
|
||||||
const metadata = await this.validatorMetadata.getValidatorData({miningKey: key})
|
const metadata = await this.validatorMetadata.getValidatorFullName({miningKey: key})
|
||||||
this.validatorsMetadata.push({
|
//this.validatorsMetadata.push({
|
||||||
|
// label: `${key} ${metadata.lastName}`,
|
||||||
|
// lastNameAndKey: `${metadata.lastName} ${key}`,
|
||||||
|
// fullName: `${metadata.firstName} ${metadata.lastName}`,
|
||||||
|
// value: key
|
||||||
|
//})
|
||||||
|
this.validatorsMetadata[key.toLowerCase()] = {
|
||||||
label: `${key} ${metadata.lastName}`,
|
label: `${key} ${metadata.lastName}`,
|
||||||
labelInvers: `${metadata.lastName} ${key}`,
|
lastNameAndKey: `${metadata.lastName} ${key}`,
|
||||||
|
fullName: `${metadata.firstName} ${metadata.lastName}`,
|
||||||
value: key
|
value: key
|
||||||
})
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue