Trivial cleaning

This commit is contained in:
emostov
2020-12-14 14:40:25 -08:00
parent eef192925b
commit dc782e930e
3 changed files with 11 additions and 15 deletions
+1 -5
View File
@@ -30,11 +30,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let dest = AccountKeyring::Bob.to_account_id().into();
let client = ClientBuilder::<KusamaRuntime>::new().build().await?;
let hash = client.transfer(
&signer,
&dest,
10_000
).await?;
let hash = client.transfer(&signer, &dest, 10_000).await?;
println!("Balance transfer extrinsic submitted: {}", hash);
+1 -5
View File
@@ -33,11 +33,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let dest = AccountKeyring::Bob.to_account_id().into();
let client = ClientBuilder::<DefaultNodeRuntime>::new().build().await?;
let result = client.transfer_and_watch(
&signer,
&dest,
10_000
).await?;
let result = client.transfer_and_watch(&signer, &dest, 10_000).await?;
if let Some(event) = result.transfer()? {
println!("Balance transfer success: value: {:?}", event.amount);
+9 -5
View File
@@ -89,7 +89,7 @@ pub use crate::{
SignedExtra,
Signer,
UncheckedExtrinsic,
DEFAULT_MORTAL_PERIOD
DEFAULT_MORTAL_PERIOD,
},
frame::*,
metadata::{
@@ -186,7 +186,7 @@ impl<T: Runtime> ClientBuilder<T> {
page_size: self.page_size.unwrap_or(10),
signed_options: ClientSignedOptions {
mortal_period: Some(DEFAULT_MORTAL_PERIOD),
}
},
})
}
}
@@ -478,7 +478,7 @@ impl<T: Runtime> Client<T> {
pub async fn create_signed<C: Call<T> + Send + Sync>(
&self,
call: C,
signer: &(dyn Signer<T> + Send + Sync)
signer: &(dyn Signer<T> + Send + Sync),
) -> Result<UncheckedExtrinsic<T>, Error>
where
<<T::Extra as SignedExtra<T>>::Extra as SignedExtension>::AdditionalSigned:
@@ -495,10 +495,14 @@ impl<T: Runtime> Client<T> {
Some(signed_block) => signed_block.block,
None => return Err("RPC chain_getBlock returned None when Some(signed_block) was expected".into()),
};
let current_number = (*current_block.header().number()).saturated_into::<u64>();
let current_number =
(*current_block.header().number()).saturated_into::<u64>();
let current_hash = current_block.hash();
(Era::mortal(mortal_period, current_number), Some(current_hash))
(
Era::mortal(mortal_period, current_number),
Some(current_hash),
)
} else {
(Era::Immortal, None)
};