From 31dfd7df10cf5f70f1cd2d08768e74deb618e511 Mon Sep 17 00:00:00 2001 From: Peter White Date: Tue, 11 Feb 2025 03:19:25 -0700 Subject: [PATCH] feat(e2e): add node `url` to `Client` (#2399) --- crates/e2e/macro/src/codegen.rs | 2 +- crates/e2e/src/subxt_client.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/e2e/macro/src/codegen.rs b/crates/e2e/macro/src/codegen.rs index abe02f4b48..5b7310bc5b 100644 --- a/crates/e2e/macro/src/codegen.rs +++ b/crates/e2e/macro/src/codegen.rs @@ -140,7 +140,7 @@ fn build_full_client( let mut client = ::ink_e2e::Client::< ::ink_e2e::PolkadotConfig, #environment - >::new(node_rpc.rpc(), contracts).await?; + >::new(node_rpc.rpc(), contracts, node_rpc.url().to_string()).await?; } } } diff --git a/crates/e2e/src/subxt_client.rs b/crates/e2e/src/subxt_client.rs index 8239f3aaf0..42ccef0635 100644 --- a/crates/e2e/src/subxt_client.rs +++ b/crates/e2e/src/subxt_client.rs @@ -111,6 +111,7 @@ where { api: ReviveApi, contracts: ContractsRegistry, + url: String, } impl Client @@ -133,10 +134,12 @@ where pub async fn new>( client: subxt::backend::rpc::RpcClient, contracts: impl IntoIterator, + url: String, ) -> Result { Ok(Self { api: ReviveApi::new(client).await?, contracts: ContractsRegistry::new(contracts), + url, }) } @@ -312,6 +315,11 @@ where DispatchError::decode_from(dispatch_err_encoded, self.api.client.metadata()) .expect("failed to decode valid dispatch error") } + + /// Returns the URL of the running node. + pub fn url(&self) -> &str { + &self.url + } } #[async_trait]