Skip to content

Commit

Permalink
feat(gsdk): allow transaction retracted (#2963)
Browse files Browse the repository at this point in the history
  • Loading branch information
clearloop authored Jul 22, 2023
1 parent f4e642c commit 4541852
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
12 changes: 6 additions & 6 deletions gsdk/src/signer/calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,16 @@ impl Signer {
b.block_hash(),
b.extrinsic_hash()
),
TxStatus::Retracted(h) => log::info!(" Status: Retracted( {h} )"),
TxStatus::FinalityTimeout(h) => log::info!(" Status: FinalityTimeout( {h} )"),
TxStatus::Retracted(h) => log::warn!(" Status: Retracted( {h} )"),
TxStatus::FinalityTimeout(h) => log::error!(" Status: FinalityTimeout( {h} )"),
TxStatus::Finalized(b) => log::info!(
" Status: Finalized( block hash: {}, extrinsic hash: {} )",
b.block_hash(),
b.extrinsic_hash()
),
TxStatus::Usurped(h) => log::info!(" Status: Usurped( {h} )"),
TxStatus::Dropped => log::info!(" Status: Dropped"),
TxStatus::Invalid => log::info!(" Status: Invalid"),
TxStatus::Usurped(h) => log::error!(" Status: Usurped( {h} )"),
TxStatus::Dropped => log::error!(" Status: Dropped"),
TxStatus::Invalid => log::error!(" Status: Invalid"),
}
}

Expand Down Expand Up @@ -389,7 +389,7 @@ impl Signer {
let status = status?;
self.log_status(&status);
match status {
Future | Ready | Broadcast(_) | InBlock(_) => (),
Future | Ready | Broadcast(_) | InBlock(_) | Retracted(_) => (),
Finalized(b) => {
log::info!(
"Successfully submitted call {}::{} {} at {}!",
Expand Down
15 changes: 7 additions & 8 deletions gsdk/src/signer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@ impl Signer {
}

/// Change inner signer.
pub fn change(self, suri: &str, passwd: Option<&str>) -> Result<Self> {
Ok(Self {
api: self.api,
signer: PairSigner::new(
Pair::from_string(suri, passwd).map_err(|_| Error::InvalidSecret)?,
),
nonce: None,
})
pub fn change(mut self, suri: &str, passwd: Option<&str>) -> Result<Self> {
let signer =
PairSigner::new(Pair::from_string(suri, passwd).map_err(|_| Error::InvalidSecret)?);
self.signer = signer;

Ok(self)
}

/// Set nonce of the signer
pub fn set_nonce(&mut self, nonce: u32) {
self.nonce = Some(nonce)
}
Expand Down

0 comments on commit 4541852

Please sign in to comment.