multiple transactions from stash account
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
10b8337f8d
commit
91fb7380d6
@ -24,6 +24,7 @@ pub struct StashDetails {
|
|||||||
staked_total: Option<u128>,
|
staked_total: Option<u128>,
|
||||||
staked_active: Option<u128>,
|
staked_active: Option<u128>,
|
||||||
stash_account_id: [u8; 32],
|
stash_account_id: [u8; 32],
|
||||||
|
stash_secret: [u8; 32],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for StashDetails {
|
impl Default for StashDetails {
|
||||||
@ -45,6 +46,7 @@ impl StashDetails {
|
|||||||
staked_total: None,
|
staked_total: None,
|
||||||
staked_active: None,
|
staked_active: None,
|
||||||
stash_account_id: [0u8; 32],
|
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>> {
|
fn update(&mut self, action: Action) -> Result<Option<Action>> {
|
||||||
match action {
|
match action {
|
||||||
|
Action::SetStashSecret(secret) => self.stash_secret = secret,
|
||||||
Action::SetStashAccount(account_id) => self.stash_account_id = account_id,
|
Action::SetStashAccount(account_id) => self.stash_account_id = account_id,
|
||||||
Action::SetIsBonded(is_bonded) => self.is_bonded = is_bonded,
|
Action::SetIsBonded(is_bonded) => self.is_bonded = is_bonded,
|
||||||
Action::SetStakedAmountRatio(total, active) => {
|
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 => {
|
Action::BalanceResponse(account_id, maybe_balance) if account_id == self.stash_account_id => {
|
||||||
if let Some(network_tx) = &self.network_tx {
|
if let Some(network_tx) = &self.network_tx {
|
||||||
let _ = network_tx.send(Action::SetSender(
|
let _ = network_tx.send(Action::SetSender(
|
||||||
hex::encode(self.stash_account_id),
|
hex::encode(self.stash_secret),
|
||||||
maybe_balance.clone().map(|b| b.nonce)));
|
maybe_balance.clone().map(|b| b.nonce)));
|
||||||
}
|
}
|
||||||
self.free_balance = maybe_balance.map(|balance| balance.free
|
self.free_balance = maybe_balance.map(|balance| balance.free
|
||||||
|
@ -265,6 +265,7 @@ impl Network {
|
|||||||
Action::BondValidatorExtraFrom(sender, amount) => {
|
Action::BondValidatorExtraFrom(sender, amount) => {
|
||||||
let sender_str = hex::encode(sender);
|
let sender_str = hex::encode(sender);
|
||||||
let maybe_nonce = self.senders.get_mut(&sender_str);
|
let maybe_nonce = self.senders.get_mut(&sender_str);
|
||||||
|
|
||||||
if let Ok(tx_progress) = predefined_txs::bond_extra(
|
if let Ok(tx_progress) = predefined_txs::bond_extra(
|
||||||
&self.action_tx,
|
&self.action_tx,
|
||||||
&self.online_client_api,
|
&self.online_client_api,
|
||||||
|
Loading…
Reference in New Issue
Block a user