Skip to content

Commit 31dfd7d

Browse files
authored
feat(e2e): add node url to Client (#2399)
1 parent 7338425 commit 31dfd7d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

crates/e2e/macro/src/codegen.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn build_full_client(
140140
let mut client = ::ink_e2e::Client::<
141141
::ink_e2e::PolkadotConfig,
142142
#environment
143-
>::new(node_rpc.rpc(), contracts).await?;
143+
>::new(node_rpc.rpc(), contracts, node_rpc.url().to_string()).await?;
144144
}
145145
}
146146
}

crates/e2e/src/subxt_client.rs

+8
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ where
111111
{
112112
api: ReviveApi<C, E>,
113113
contracts: ContractsRegistry,
114+
url: String,
114115
}
115116

116117
impl<C, E> Client<C, E>
@@ -133,10 +134,12 @@ where
133134
pub async fn new<P: Into<PathBuf>>(
134135
client: subxt::backend::rpc::RpcClient,
135136
contracts: impl IntoIterator<Item = P>,
137+
url: String,
136138
) -> Result<Self, subxt::Error> {
137139
Ok(Self {
138140
api: ReviveApi::new(client).await?,
139141
contracts: ContractsRegistry::new(contracts),
142+
url,
140143
})
141144
}
142145

@@ -312,6 +315,11 @@ where
312315
DispatchError::decode_from(dispatch_err_encoded, self.api.client.metadata())
313316
.expect("failed to decode valid dispatch error")
314317
}
318+
319+
/// Returns the URL of the running node.
320+
pub fn url(&self) -> &str {
321+
&self.url
322+
}
315323
}
316324

317325
#[async_trait]

0 commit comments

Comments
 (0)