Skip to content

Commit

Permalink
Add network id to validator details and summary.
Browse files Browse the repository at this point in the history
  • Loading branch information
kukabi committed Aug 1, 2022
1 parent a367597 commit 96a2f2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions subvt-substrate-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const KEY_QUERY_PAGE_SIZE: usize = 1000;

/// The client.
pub struct SubstrateClient {
network_id: u32,
pub chain: Chain,
pub metadata: Metadata,
pub system_properties: SystemProperties,
Expand Down Expand Up @@ -86,6 +87,7 @@ impl SubstrateClient {
ws_client.request("system_properties", None).await?;
log::info!("Got system properties. {:?}", system_properties);
Ok(Self {
network_id: config.substrate.network_id,
chain,
metadata,
system_properties,
Expand Down Expand Up @@ -632,6 +634,7 @@ impl SubstrateClient {
account.id,
ValidatorDetails {
account: account.clone(),
network_id: self.network_id,
is_active,
is_para_validator,
para_core_assignment,
Expand Down
3 changes: 3 additions & 0 deletions subvt-types/src/subvt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub struct NetworkStatusUpdate {
pub struct ValidatorDetails {
#[diff_key]
pub account: Account,
pub network_id: u32,
pub controller_account_id: AccountId,
pub preferences: ValidatorPreferences,
pub self_stake: Stake,
Expand Down Expand Up @@ -98,6 +99,7 @@ pub struct ValidatorSummary {
#[diff_key]
pub account_id: AccountId,
pub address: String,
pub network_id: u32,
pub controller_account_id: AccountId,
#[serde(skip_serializing_if = "Option::is_none")]
pub display: Option<String>,
Expand Down Expand Up @@ -151,6 +153,7 @@ impl From<&ValidatorDetails> for ValidatorSummary {
ValidatorSummary {
account_id: validator.account.id,
address: validator.account.address.clone(),
network_id: validator.network_id,
controller_account_id: validator.controller_account_id,
display: validator.account.get_display(),
parent_display: validator.account.get_parent_display(),
Expand Down

0 comments on commit 96a2f2e

Please sign in to comment.