Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdplm committed Sep 16, 2020
1 parent dffbba6 commit 0860bad
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions src/frame/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ mod tests {
};
// use sp_core::{sr25519::Pair, Pair as _};
use crate::{
error::Error,
extrinsic::Signer,
frame::{
balances::*,
Expand All @@ -215,35 +216,33 @@ mod tests {
use sp_keyring::AccountKeyring;

#[async_std::test]
async fn test_nominate() {
async fn test_nominate() -> Result<(), Error> {
env_logger::try_init().ok();
let alice = PairSigner::<RT, _>::new(AccountKeyring::Alice.pair());
let bob = PairSigner::<RT, _>::new(AccountKeyring::Bob.pair());

let client = ClientBuilder::<RT>::new().build().await.unwrap();
let current_era = client.current_era(None).await.unwrap();
let client = ClientBuilder::<RT>::new().build().await?;
let current_era = client.current_era(None).await?;
println!("Current era: {:?}", current_era);
let hd = client.history_depth(None).await.unwrap();
let hd = client.history_depth(None).await?;
println!("History depth: {:?}", hd);
let total_issuance = client.total_issuance(None).await.unwrap();
let total_issuance = client.total_issuance(None).await?;
println!("total issuance: {:?}", total_issuance);
let alice_account = client.account(&alice.account_id(), None).await.unwrap();
let alice_account = client.account(&alice.account_id(), None).await?;
println!("Alice's account info: {:?}", alice_account);
let o = client
.nominate(&alice, vec![bob.account_id().clone()])
.await
.unwrap();
.await?;
println!("Nom nom: {:?}", o);
let o = client
.validate(&bob, ValidatorPrefs::default())
.await
.unwrap();
.await?;
println!("Validator result: {:?}", o);
for &i in &[RewardDestination::Controller] {
for &j in &[&bob, &alice] {
println!(
"Transaction result: {:?}",
client.set_payee(j, i).await.unwrap()
client.set_payee(j, i).await?
);
}
}
Expand All @@ -255,22 +254,9 @@ mod tests {
},
None
)
.await
.unwrap(),
.await?,
None
);
// let event = client.
// current_era()
// .await;
// println!("Current era: {:?}", event);
// let (client, _) = test_client().await;
// let event = client.
// nominate_and_watch(&alice, vec![AccountKeyring::Bob.to_account_id()])
// .await
// .unwrap();
// // .nominate()
// // .unwrap()
// // .unwrap();
// dbg!(event);
Ok(())
}
}

0 comments on commit 0860bad

Please sign in to comment.