make ledger responses depending on account_id
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
2afc38068a
commit
76d87aecbf
@ -2,7 +2,7 @@
|
|||||||
name = "ghost-eye"
|
name = "ghost-eye"
|
||||||
authors = ["str3tch <stretch@ghostchain.io>"]
|
authors = ["str3tch <stretch@ghostchain.io>"]
|
||||||
description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost"
|
description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost"
|
||||||
version = "0.3.27"
|
version = "0.3.28"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -115,7 +115,7 @@ pub enum Action {
|
|||||||
SetStashSecret([u8; 32]),
|
SetStashSecret([u8; 32]),
|
||||||
SetChoosenValidator([u8; 32], u32, u32),
|
SetChoosenValidator([u8; 32], u32, u32),
|
||||||
SetSlashingSpansLength(usize, [u8; 32]),
|
SetSlashingSpansLength(usize, [u8; 32]),
|
||||||
SetUnlockingIsEmpty(bool),
|
SetUnlockingIsEmpty(bool, [u8; 32]),
|
||||||
|
|
||||||
BestBlockInformation(H256, u32),
|
BestBlockInformation(H256, u32),
|
||||||
FinalizedBlockInformation(H256, u32),
|
FinalizedBlockInformation(H256, u32),
|
||||||
@ -132,7 +132,7 @@ pub enum Action {
|
|||||||
SetValidatorEraReward(u32, u128),
|
SetValidatorEraReward(u32, u128),
|
||||||
SetValidatorEraClaimed(u32, bool),
|
SetValidatorEraClaimed(u32, bool),
|
||||||
SetValidatorEraSlash(u32, u128),
|
SetValidatorEraSlash(u32, u128),
|
||||||
SetValidatorEraUnlocking(u32, u128),
|
SetValidatorEraUnlocking(u32, u128, [u8; 32]),
|
||||||
SetIsBonded(bool),
|
SetIsBonded(bool),
|
||||||
SetStakedAmountRatio(u128, u128, [u8; 32]),
|
SetStakedAmountRatio(u128, u128, [u8; 32]),
|
||||||
SetStakedRatio(u128, u128, [u8; 32]),
|
SetStakedRatio(u128, u128, [u8; 32]),
|
||||||
|
@ -120,14 +120,15 @@ impl Component for WithdrawPopup {
|
|||||||
|
|
||||||
fn update(&mut self, action: Action) -> Result<Option<Action>> {
|
fn update(&mut self, action: Action) -> Result<Option<Action>> {
|
||||||
match action {
|
match action {
|
||||||
|
Action::SetExistentialDeposit(existential_deposit) => self.existential_deposit = existential_deposit,
|
||||||
Action::SetStashAccount(account_id) => self.stash_account = account_id,
|
Action::SetStashAccount(account_id) => self.stash_account = account_id,
|
||||||
Action::SetStashSecret(secret_seed) => self.secret_seed = secret_seed,
|
Action::SetStashSecret(secret_seed) => self.secret_seed = secret_seed,
|
||||||
Action::SetSlashingSpansLength(length, account_id) if self.stash_account == account_id =>
|
Action::SetSlashingSpansLength(length, account_id) if self.stash_account == account_id =>
|
||||||
self.slashing_spans_length = length as u32,
|
self.slashing_spans_length = length as u32,
|
||||||
Action::SetStakedAmountRatio(_, active_balance, account_id) if self.stash_account == account_id =>
|
Action::SetStakedAmountRatio(_, active_balance, account_id) if self.stash_account == account_id =>
|
||||||
self.active_balance = active_balance,
|
self.active_balance = active_balance,
|
||||||
Action::SetUnlockingIsEmpty(is_empty) => self.unlocking_is_empty = is_empty,
|
Action::SetUnlockingIsEmpty(is_empty, account_id) if self.stash_account == account_id =>
|
||||||
Action::SetExistentialDeposit(existential_deposit) => self.existential_deposit = existential_deposit,
|
self.unlocking_is_empty = is_empty,
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
Ok(None)
|
Ok(None)
|
||||||
|
@ -27,6 +27,7 @@ pub struct Withdrawals {
|
|||||||
scroll_state: ScrollbarState,
|
scroll_state: ScrollbarState,
|
||||||
table_state: TableState,
|
table_state: TableState,
|
||||||
unlockings: BTreeMap<u32, u128>,
|
unlockings: BTreeMap<u32, u128>,
|
||||||
|
stash_account: [u8; 32],
|
||||||
current_era: u32,
|
current_era: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ impl Withdrawals {
|
|||||||
table_state: TableState::new(),
|
table_state: TableState::new(),
|
||||||
palette: StylePalette::default(),
|
palette: StylePalette::default(),
|
||||||
unlockings: BTreeMap::new(),
|
unlockings: BTreeMap::new(),
|
||||||
|
stash_account: [0u8; 32],
|
||||||
current_era: 0,
|
current_era: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,8 +153,9 @@ impl Component for Withdrawals {
|
|||||||
|
|
||||||
fn update(&mut self, action: Action) -> Result<Option<Action>> {
|
fn update(&mut self, action: Action) -> Result<Option<Action>> {
|
||||||
match action {
|
match action {
|
||||||
|
Action::SetStashAccount(account_id) => self.stash_account = account_id,
|
||||||
Action::SetCurrentEra(current_era) => self.current_era = current_era,
|
Action::SetCurrentEra(current_era) => self.current_era = current_era,
|
||||||
Action::SetValidatorEraUnlocking(era_index, unlocking) =>
|
Action::SetValidatorEraUnlocking(era_index, unlocking, account_id) if self.stash_account == account_id =>
|
||||||
self.add_new_unlocking(era_index, unlocking),
|
self.add_new_unlocking(era_index, unlocking),
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
|
@ -435,9 +435,9 @@ pub async fn get_validators_ledger(
|
|||||||
|
|
||||||
if let Some(ledger) = maybe_ledger {
|
if let Some(ledger) = maybe_ledger {
|
||||||
action_tx.send(Action::SetStakedAmountRatio(ledger.total, ledger.active, *account_id))?;
|
action_tx.send(Action::SetStakedAmountRatio(ledger.total, ledger.active, *account_id))?;
|
||||||
action_tx.send(Action::SetUnlockingIsEmpty(ledger.unlocking.0.is_empty()))?;
|
action_tx.send(Action::SetUnlockingIsEmpty(ledger.unlocking.0.is_empty(), *account_id))?;
|
||||||
for chunk in ledger.unlocking.0.iter() {
|
for chunk in ledger.unlocking.0.iter() {
|
||||||
action_tx.send(Action::SetValidatorEraUnlocking(chunk.era, chunk.value))?;
|
action_tx.send(Action::SetValidatorEraUnlocking(chunk.era, chunk.value, *account_id))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user