diff --git a/end2end-tests/tests/common/cert.rs b/end2end-tests/tests/common/cert.rs index 75ad8607b8bdd1a91b46637fc68aa1f44ebcd178..9694c7e57b2a199c792920b2f400ead22c55fcf1 100644 --- a/end2end-tests/tests/common/cert.rs +++ b/end2end-tests/tests/common/cert.rs @@ -20,17 +20,13 @@ use super::*; use sp_keyring::AccountKeyring; use subxt::{tx::PairSigner, utils::MultiAddress}; -pub async fn certify( - rpc_client: &RpcClient, - from: AccountKeyring, - to: AccountKeyring, -) -> Result<()> { - let client = Client::from_rpc_client(rpc_client.clone()).await.unwrap(); +pub async fn certify(client: &FullClient, from: AccountKeyring, to: AccountKeyring) -> Result<()> { let signer = PairSigner::new(from.pair()); let from = from.to_account_id(); let to = to.to_account_id(); let issuer_index = client + .client .storage() .at_latest() .await @@ -43,6 +39,7 @@ pub async fn certify( .await? .unwrap_or_else(|| panic!("{} issuer must exist", from)); let receiver_index = client + .client .storage() .at_latest() .await @@ -52,8 +49,9 @@ pub async fn certify( .unwrap_or_else(|| panic!("{} issuer must exist", from)); let _events = create_block_with_extrinsic( - rpc_client, + &client.rpc, client + .client .tx() .create_signed( &gdev::tx() diff --git a/end2end-tests/tests/common/distance.rs b/end2end-tests/tests/common/distance.rs index 4b1d348cda447b16ae267e4d2234b6f62e32a010..97add31a313804b983b61b3d5feb4228dc9593f9 100644 --- a/end2end-tests/tests/common/distance.rs +++ b/end2end-tests/tests/common/distance.rs @@ -23,13 +23,13 @@ use subxt::backend::rpc::RpcClient; use subxt::tx::{PairSigner, Signer}; use subxt::utils::AccountId32; -pub async fn request_evaluation(rpc_client: &RpcClient, origin: AccountKeyring) -> Result<()> { - let client = Client::from_rpc_client(rpc_client.clone()).await.unwrap(); +pub async fn request_evaluation(client: &FullClient, origin: AccountKeyring) -> Result<()> { let origin = PairSigner::new(origin.pair()); let _events = create_block_with_extrinsic( - rpc_client, + &client.rpc, client + .client .tx() .create_signed( &gdev::tx().distance().request_distance_evaluation(), @@ -44,11 +44,10 @@ pub async fn request_evaluation(rpc_client: &RpcClient, origin: AccountKeyring) } pub async fn run_oracle( - rpc_client: &RpcClient, + client: &FullClient, origin: AccountKeyring, rpc_url: String, ) -> Result<()> { - let client = Client::from_rpc_client(rpc_client.clone()).await.unwrap(); let origin = PairSigner::new(origin.pair()); let account_id: &AccountId32 = origin.account_id(); @@ -63,12 +62,12 @@ pub async fn run_oracle( .await { for _ in 0..30 { - super::create_empty_block(rpc_client).await?; + super::create_empty_block(&client.rpc).await?; } let _events = create_block_with_extrinsic( - rpc_client, - client + &client.rpc, + client.client .tx() .create_signed( &gdev::tx().sudo().sudo(gdev::runtime_types::gdev_runtime::RuntimeCall::Distance( diff --git a/end2end-tests/tests/common/identity.rs b/end2end-tests/tests/common/identity.rs index aa77be3ef7eb1477473553f215b3bba1a8389793..ab42cff025a9044cc3b23646fa1de82ef4ead41b 100644 --- a/end2end-tests/tests/common/identity.rs +++ b/end2end-tests/tests/common/identity.rs @@ -31,17 +31,17 @@ type IdtyValue = // submit extrinsics pub async fn create_identity( - rpc_client: &RpcClient, + client: &FullClient, from: AccountKeyring, to: AccountKeyring, ) -> Result<()> { - let client = Client::from_rpc_client(rpc_client.clone()).await.unwrap(); let from = PairSigner::new(from.pair()); let to = to.to_account_id(); let _events = create_block_with_extrinsic( - rpc_client, + &client.rpc, client + .client .tx() .create_signed( &gdev::tx().identity().create_identity(to.into()), @@ -56,17 +56,17 @@ pub async fn create_identity( } pub async fn confirm_identity( - rpc_client: &RpcClient, + client: &FullClient, from: AccountKeyring, pseudo: String, ) -> Result<()> { - let client = Client::from_rpc_client(rpc_client.clone()).await.unwrap(); let from = PairSigner::new(from.pair()); let pseudo: IdtyName = IdtyName(pseudo.as_bytes().to_vec()); let _events = create_block_with_extrinsic( - rpc_client, + &client.rpc, client + .client .tx() .create_signed( &gdev::tx().identity().confirm_identity(pseudo), diff --git a/end2end-tests/tests/common/oneshot.rs b/end2end-tests/tests/common/oneshot.rs index 71effe99970cc63e8378cbba8f04080b7ff7050f..51478d12978f6432da50e06c7d47e180dae32a63 100644 --- a/end2end-tests/tests/common/oneshot.rs +++ b/end2end-tests/tests/common/oneshot.rs @@ -43,18 +43,18 @@ impl Account { } pub async fn create_oneshot_account( - rpc_client: &RpcClient, + client: &FullClient, from: AccountKeyring, amount: u64, to: AccountKeyring, ) -> Result<()> { - let client = Client::from_rpc_client(rpc_client.clone()).await.unwrap(); let from = PairSigner::new(from.pair()); let to = to.to_account_id(); let _events = create_block_with_extrinsic( - rpc_client, + &client.rpc, client + .client .tx() .create_signed( &gdev::tx() @@ -71,17 +71,17 @@ pub async fn create_oneshot_account( } pub async fn consume_oneshot_account( - rpc_client: &RpcClient, + client: &FullClient, from: AccountKeyring, to: Account, ) -> Result<()> { - let client = Client::from_rpc_client(rpc_client.clone()).await.unwrap(); let from = PairSigner::new(from.pair()); let to = to.to_account_id(); let _events = create_block_with_extrinsic( - rpc_client, + &client.rpc, client + .client .tx() .create_signed( &gdev::tx().oneshot_account().consume_oneshot_account(0, to), @@ -97,20 +97,20 @@ pub async fn consume_oneshot_account( #[allow(clippy::too_many_arguments)] pub async fn consume_oneshot_account_with_remaining( - rpc_client: &RpcClient, + client: &FullClient, from: AccountKeyring, amount: u64, to: Account, remaining_to: Account, ) -> Result<()> { - let client = Client::from_rpc_client(rpc_client.clone()).await.unwrap(); let from = PairSigner::new(from.pair()); let to = to.to_account_id(); let remaining_to = remaining_to.to_account_id(); let _events = create_block_with_extrinsic( - rpc_client, + &client.rpc, client + .client .tx() .create_signed( &gdev::tx() diff --git a/end2end-tests/tests/cucumber_tests.rs b/end2end-tests/tests/cucumber_tests.rs index 3b1d5fe9fa7328b01fa1f0baeaa2eb5022785241..e63495dff01ad78930744ddb0c5747a7f3058d9a 100644 --- a/end2end-tests/tests/cucumber_tests.rs +++ b/end2end-tests/tests/cucumber_tests.rs @@ -254,7 +254,7 @@ async fn create_oneshot_account( assert!(!is_ud); - common::oneshot::create_oneshot_account(world.rpc_client(), from, amount, to).await + common::oneshot::create_oneshot_account(world.full_client(), from, amount, to).await } #[allow(clippy::needless_pass_by_ref_mut)] @@ -274,7 +274,7 @@ async fn consume_oneshot_account( _ => unreachable!(), }; - common::oneshot::consume_oneshot_account(world.rpc_client(), from, to).await + common::oneshot::consume_oneshot_account(world.full_client(), from, to).await } #[when( @@ -311,7 +311,7 @@ async fn consume_oneshot_account_with_remaining( assert!(!is_ud); common::oneshot::consume_oneshot_account_with_remaining( - world.rpc_client(), + world.full_client(), from, amount, to, @@ -337,7 +337,7 @@ async fn certifies(world: &mut DuniterWorld, from: String, to: String) -> Result let from = AccountKeyring::from_str(&from).expect("unknown from"); let to = AccountKeyring::from_str(&to).expect("unknown to"); - common::cert::certify(world.rpc_client(), from, to).await + common::cert::certify(world.full_client(), from, to).await } #[allow(clippy::needless_pass_by_ref_mut)] @@ -347,7 +347,7 @@ async fn creates_identity(world: &mut DuniterWorld, from: String, to: String) -> let from = AccountKeyring::from_str(&from).expect("unknown from"); let to = AccountKeyring::from_str(&to).expect("unknown to"); - common::identity::create_identity(world.rpc_client(), from, to).await + common::identity::create_identity(world.full_client(), from, to).await } #[allow(clippy::needless_pass_by_ref_mut)] @@ -355,7 +355,7 @@ async fn creates_identity(world: &mut DuniterWorld, from: String, to: String) -> async fn confirm_identity(world: &mut DuniterWorld, from: String, pseudo: String) -> Result<()> { let from = AccountKeyring::from_str(&from).expect("unknown from"); - common::identity::confirm_identity(world.rpc_client(), from, pseudo).await + common::identity::confirm_identity(world.full_client(), from, pseudo).await } #[allow(clippy::needless_pass_by_ref_mut)] @@ -363,7 +363,7 @@ async fn confirm_identity(world: &mut DuniterWorld, from: String, pseudo: String async fn request_distance_evaluation(world: &mut DuniterWorld, who: String) -> Result<()> { let who = AccountKeyring::from_str(&who).expect("unknown origin"); - common::distance::request_evaluation(world.rpc_client(), who).await + common::distance::request_evaluation(world.full_client(), who).await } #[allow(clippy::needless_pass_by_ref_mut)] @@ -372,7 +372,7 @@ async fn run_distance_oracle(world: &mut DuniterWorld, who: String) -> Result<() let who = AccountKeyring::from_str(&who).expect("unknown origin"); common::distance::run_oracle( - world.rpc_client(), + world.full_client(), who, format!("ws://127.0.0.1:{}", world.inner.as_ref().unwrap().ws_port), )