Expose the rpc client in Client (#267)

When we build a `Client` for a substrate chain, we can only access the
methods exposed in `Client` which does not cover all the RPC interfaces
in the chain, it's not feasible to request the methods like `chain_getKeys`
with `Client` only. The downstream user of this library has to build another
`RpcClient` for the uncovered RPC interfaces, which can be unneccessary.
This commit is contained in:
Liu-Cheng Xu
2021-05-21 18:45:34 +08:00
committed by GitHub
parent 94db874942
commit cef6d697b8
2 changed files with 7 additions and 1 deletions
+5
View File
@@ -353,6 +353,11 @@ impl<T: Runtime> Client<T> {
&self.properties
}
/// Returns the rpc client.
pub fn rpc_client(&self) -> &RpcClient {
&self.rpc.client
}
/// Fetch the value under an unhashed storage key
pub async fn fetch_unhashed<V: Decode>(
&self,
+2 -1
View File
@@ -258,7 +258,8 @@ pub struct ReadProof<Hash> {
/// Client for substrate rpc interfaces
pub struct Rpc<T: Runtime> {
client: RpcClient,
/// Rpc client for sending requests.
pub client: RpcClient,
marker: PhantomData<T>,
accept_weak_inclusion: bool,
}