Compare commits
2 Commits
3284d5d07e
...
ee5640349a
Author | SHA1 | Date | |
---|---|---|---|
ee5640349a | |||
3557e5fa4e |
@ -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.40"
|
version = "0.3.41"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
homepage = "https://git.ghostchain.io/ghostchain"
|
homepage = "https://git.ghostchain.io/ghostchain"
|
||||||
repository = "https://git.ghostchain.io/ghostchain/ghost-eye"
|
repository = "https://git.ghostchain.io/ghostchain/ghost-eye"
|
||||||
|
@ -64,19 +64,18 @@ impl History {
|
|||||||
|
|
||||||
fn payout_by_era_index(&mut self) {
|
fn payout_by_era_index(&mut self) {
|
||||||
if let Some(index) = self.table_state.selected() {
|
if let Some(index) = self.table_state.selected() {
|
||||||
let length = self.rewards.len() as u32;
|
let rev_index = self.rewards.len()
|
||||||
let era_index = self.rewards
|
.saturating_sub(index)
|
||||||
.keys()
|
.saturating_sub(1);
|
||||||
.nth(index)
|
|
||||||
.map(|i| length - i - 1)
|
if let Some(era_index) = self.rewards.keys().nth(rev_index) {
|
||||||
.expect("BTreeMap of rewards is indexed; qed");
|
let is_claimed = self.rewards
|
||||||
let is_claimed = self.rewards
|
.get(&era_index)
|
||||||
.get(&era_index)
|
.map(|x| x.is_claimed)
|
||||||
.map(|x| x.is_claimed)
|
.expect("BTreeMap of rewards is indexed; qed");
|
||||||
.expect("BTreeMap of rewards is indexed; qed");
|
if let Some(action_tx) = &self.action_tx {
|
||||||
if let Some(action_tx) = &self.action_tx {
|
let _ = action_tx.send(Action::PayoutValidatorPopup(*era_index, is_claimed));
|
||||||
let _ = action_tx.send(
|
}
|
||||||
Action::PayoutValidatorPopup(era_index, is_claimed));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ 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::SetStashAccount(account_id) => self.stash_account = account_id,
|
||||||
Action::SetCurrentEra(current_era) => self.current_era = current_era,
|
Action::SetActiveEra(era_info) => self.current_era = era_info.index,
|
||||||
Action::SetValidatorEraUnlocking(era_index, unlocking, account_id) if self.stash_account == account_id =>
|
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),
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -281,12 +281,14 @@ pub async fn get_validator_staking_results(
|
|||||||
api: &OnlineClient<CasperConfig>,
|
api: &OnlineClient<CasperConfig>,
|
||||||
account_id: &[u8; 32],
|
account_id: &[u8; 32],
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let current_era = super::raw_calls::staking::current_era(api, None).await?.unwrap_or(0);
|
let current_era = super::raw_calls::staking::active_era(api, None)
|
||||||
|
.await?
|
||||||
|
.map(|era_info| era_info.index)
|
||||||
|
.unwrap_or(0);
|
||||||
let era_depth = super::raw_calls::staking::history_depth(api).unwrap_or(0);
|
let era_depth = super::raw_calls::staking::history_depth(api).unwrap_or(0);
|
||||||
|
|
||||||
let start = current_era.saturating_sub(era_depth);
|
let start = current_era.saturating_sub(era_depth);
|
||||||
let end = current_era.saturating_sub(1);
|
for era_index in (start..current_era).rev() {
|
||||||
for era_index in (start..end).rev() {
|
|
||||||
if get_validator_staking_result(action_tx, api, account_id, era_index).await? {
|
if get_validator_staking_result(action_tx, api, account_id, era_index).await? {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -546,7 +548,10 @@ pub async fn get_validator_latest_claim(
|
|||||||
api: &OnlineClient<CasperConfig>,
|
api: &OnlineClient<CasperConfig>,
|
||||||
account_id: &[u8; 32],
|
account_id: &[u8; 32],
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let current_era = super::raw_calls::staking::current_era(api, None).await?.unwrap_or(0);
|
let current_era = super::raw_calls::staking::active_era(api, None)
|
||||||
|
.await?
|
||||||
|
.map(|era_info| era_info.index)
|
||||||
|
.unwrap_or(0);
|
||||||
let era_depth = super::raw_calls::staking::history_depth(api).unwrap_or(0);
|
let era_depth = super::raw_calls::staking::history_depth(api).unwrap_or(0);
|
||||||
|
|
||||||
let last_era = current_era.saturating_sub(era_depth);
|
let last_era = current_era.saturating_sub(era_depth);
|
||||||
|
Loading…
Reference in New Issue
Block a user