-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added validator state * added my-validator endpoint * added route * more fixes
- Loading branch information
Showing
15 changed files
with
293 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[workspace] | ||
resolver = "2" | ||
|
||
members = ["chain", "shared", "rewards", "orm", "pos", "governance", "webserver", "seeder", "parameters"] | ||
members = ["chain", "shared", "rewards", "orm", "pos", "governance", "webserver", "seeder"] | ||
|
||
[workspace.package] | ||
authors = ["Heliax <[email protected]>"] | ||
|
@@ -46,6 +46,7 @@ namada_governance = { git = "https://github.com/anoma/namada", tag = "v0.38.1" } | |
namada_ibc = { git = "https://github.com/anoma/namada", tag = "v0.38.1" } | ||
namada_token = { git = "https://github.com/anoma/namada", tag = "v0.38.1" } | ||
namada_parameters = { git = "https://github.com/anoma/namada", tag = "v0.38.1" } | ||
namada_proof_of_stake = { git = "https://github.com/anoma/namada", tag = "v0.38.1" } | ||
tendermint = "0.36.0" | ||
tendermint-config = "0.36.0" | ||
tendermint-rpc = { version = "0.36.0", features = ["http-client"] } | ||
|
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
-- This file should undo anything in `up.sql` | ||
DROP TYPE VALIDATOR_STATE; | ||
|
||
DROP TABLE IF EXISTS validators; |
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
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
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
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 |
---|---|---|
@@ -1,8 +1,44 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use validator::Validate; | ||
|
||
#[derive(Clone, Serialize, Deserialize)] | ||
pub enum ValidatorStateDto { | ||
Consensus, | ||
BelowCapacity, | ||
BelowThreshold, | ||
Inactive, | ||
Jailed, | ||
Unknown, | ||
} | ||
|
||
impl ValidatorStateDto { | ||
pub fn all() -> Vec<Self> { | ||
[ | ||
Self::Consensus, | ||
Self::BelowCapacity, | ||
Self::BelowThreshold, | ||
Self::Inactive, | ||
Self::Jailed, | ||
Self::Unknown, | ||
] | ||
.to_vec() | ||
} | ||
} | ||
|
||
#[derive(Clone, Serialize, Deserialize, Validate)] | ||
pub struct PoSQueryParams { | ||
#[validate(range(min = 1, max = 10000))] | ||
pub page: Option<u64>, | ||
pub state: Option<Vec<ValidatorStateDto>>, | ||
} | ||
|
||
#[derive(Clone, Serialize, Deserialize, Validate)] | ||
pub struct MyValidatorQueryParams { | ||
#[validate(range(min = 1, max = 10000))] | ||
pub page: Option<u64>, | ||
#[validate(length( | ||
min = 1, | ||
message = "Address query parameter cannot be empty" | ||
))] | ||
pub addresses: Vec<String>, | ||
} |
Oops, something went wrong.