multiple transactions from stash account

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2025-02-11 16:18:27 +03:00
parent 10b8337f8d
commit 91fb7380d6
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
2 changed files with 5 additions and 1 deletions

View File

@ -24,6 +24,7 @@ pub struct StashDetails {
staked_total: Option<u128>,
staked_active: Option<u128>,
stash_account_id: [u8; 32],
stash_secret: [u8; 32],
}
impl Default for StashDetails {
@ -45,6 +46,7 @@ impl StashDetails {
staked_total: None,
staked_active: None,
stash_account_id: [0u8; 32],
stash_secret: [0u8; 32],
}
}
@ -94,6 +96,7 @@ impl Component for StashDetails {
fn update(&mut self, action: Action) -> Result<Option<Action>> {
match action {
Action::SetStashSecret(secret) => self.stash_secret = secret,
Action::SetStashAccount(account_id) => self.stash_account_id = account_id,
Action::SetIsBonded(is_bonded) => self.is_bonded = is_bonded,
Action::SetStakedAmountRatio(total, active) => {
@ -103,7 +106,7 @@ impl Component for StashDetails {
Action::BalanceResponse(account_id, maybe_balance) if account_id == self.stash_account_id => {
if let Some(network_tx) = &self.network_tx {
let _ = network_tx.send(Action::SetSender(
hex::encode(self.stash_account_id),
hex::encode(self.stash_secret),
maybe_balance.clone().map(|b| b.nonce)));
}
self.free_balance = maybe_balance.map(|balance| balance.free

View File

@ -265,6 +265,7 @@ impl Network {
Action::BondValidatorExtraFrom(sender, amount) => {
let sender_str = hex::encode(sender);
let maybe_nonce = self.senders.get_mut(&sender_str);
if let Ok(tx_progress) = predefined_txs::bond_extra(
&self.action_tx,
&self.online_client_api,