mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
Unstable Backend: add back the old chainHead RPCs/tests (#1137)
* add back unstable APIs and tests * clippy fixes * fmt with new rust * deserialize from object or array into api versions * remove inspect * add some of the other unstable RPC methods we might want * clippy fix * no unused deps warning in test crate * fix doc fails * legacy -> unstable Co-authored-by: Tadeo Hepperle <62739623+tadeohepperle@users.noreply.github.com> * runtime_updates -> with_runtiem * add test and be consistent with naming of unstable RPCs --------- Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> Co-authored-by: Tadeo Hepperle <62739623+tadeohepperle@users.noreply.github.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use substrate_runner::SubstrateNode;
|
||||
use subxt::{
|
||||
backend::{legacy, rpc},
|
||||
backend::{legacy, rpc, unstable},
|
||||
Config, OnlineClient,
|
||||
};
|
||||
|
||||
@@ -36,15 +36,25 @@ where
|
||||
TestNodeProcessBuilder::new(paths)
|
||||
}
|
||||
|
||||
/// Hand back an RPC client connected to the test node.
|
||||
/// Hand back an RPC client connected to the test node which exposes the legacy RPC methods.
|
||||
pub async fn legacy_rpc_methods(&self) -> legacy::LegacyRpcMethods<R> {
|
||||
let url = format!("ws://127.0.0.1:{}", self.proc.ws_port());
|
||||
let rpc_client = rpc::RpcClient::from_url(url)
|
||||
.await
|
||||
.expect("Unable to connect RPC client to test node");
|
||||
let rpc_client = self.rpc_client().await;
|
||||
legacy::LegacyRpcMethods::new(rpc_client)
|
||||
}
|
||||
|
||||
/// Hand back an RPC client connected to the test node which exposes the unstable RPC methods.
|
||||
pub async fn unstable_rpc_methods(&self) -> unstable::UnstableRpcMethods<R> {
|
||||
let rpc_client = self.rpc_client().await;
|
||||
unstable::UnstableRpcMethods::new(rpc_client)
|
||||
}
|
||||
|
||||
async fn rpc_client(&self) -> rpc::RpcClient {
|
||||
let url = format!("ws://127.0.0.1:{}", self.proc.ws_port());
|
||||
rpc::RpcClient::from_url(url)
|
||||
.await
|
||||
.expect("Unable to connect RPC client to test node")
|
||||
}
|
||||
|
||||
/// Returns the subxt client connected to the running node.
|
||||
#[cfg(not(feature = "unstable-light-client"))]
|
||||
pub fn client(&self) -> OnlineClient<R> {
|
||||
|
||||
Reference in New Issue
Block a user