-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RFC201/205]: EVM-613-Change validator info command (#1421)
* Change validator info command * Lint fix
- Loading branch information
1 parent
8585cf5
commit 5b8b458
Showing
7 changed files
with
117 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package validators | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
|
||
"github.com/0xPolygon/polygon-edge/command/helper" | ||
sidechainHelper "github.com/0xPolygon/polygon-edge/command/sidechain" | ||
) | ||
|
||
type validatorInfoParams struct { | ||
accountDir string | ||
accountConfig string | ||
jsonRPC string | ||
supernetManagerAddress string | ||
} | ||
|
||
func (v *validatorInfoParams) validateFlags() error { | ||
return sidechainHelper.ValidateSecretFlags(v.accountDir, v.accountConfig) | ||
} | ||
|
||
type validatorsInfoResult struct { | ||
address string | ||
stake uint64 | ||
active bool | ||
whitelisted bool | ||
} | ||
|
||
func (vr validatorsInfoResult) GetOutput() string { | ||
var buffer bytes.Buffer | ||
|
||
buffer.WriteString("\n[VALIDATOR INFO]\n") | ||
|
||
vals := make([]string, 4) | ||
vals[0] = fmt.Sprintf("Validator Address|%s", vr.address) | ||
vals[1] = fmt.Sprintf("Stake|%v", vr.stake) | ||
vals[2] = fmt.Sprintf("Is Whitelisted|%v", vr.whitelisted) | ||
vals[3] = fmt.Sprintf("Is Active|%v", vr.active) | ||
|
||
buffer.WriteString(helper.FormatKV(vals)) | ||
buffer.WriteString("\n") | ||
|
||
return buffer.String() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters