From 9f7d95b898edb5133b41f846bf6582c61dc40ba5 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Thu, 24 Nov 2022 16:58:38 +0000 Subject: [PATCH] rpc: Extend `RpcClientT` to return the subscription ID Signed-off-by: Alexandru Vasile --- subxt/src/rpc/mod.rs | 1 + subxt/src/rpc/rpc_client_t.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/subxt/src/rpc/mod.rs b/subxt/src/rpc/mod.rs index 3e0e8cf443..95e15d6d27 100644 --- a/subxt/src/rpc/mod.rs +++ b/subxt/src/rpc/mod.rs @@ -69,6 +69,7 @@ pub use rpc_client_t::{ RpcClientT, RpcFuture, RpcSubscription, + RpcSubscriptionId, }; pub use rpc_client::{ diff --git a/subxt/src/rpc/rpc_client_t.rs b/subxt/src/rpc/rpc_client_t.rs index d32924ffbe..c8e4f687f3 100644 --- a/subxt/src/rpc/rpc_client_t.rs +++ b/subxt/src/rpc/rpc_client_t.rs @@ -52,7 +52,7 @@ pub trait RpcClientT: Send + Sync + 'static { sub: &'a str, params: Option>, unsub: &'a str, - ) -> RpcFuture<'a, RpcSubscription>; + ) -> RpcFuture<'a, (RpcSubscription, Option)>; } /// A boxed future that is returned from the [`RpcClientT`] methods. @@ -62,3 +62,6 @@ pub type RpcFuture<'a, T> = /// The inner subscription stream returned from our [`RpcClientT`]'s `subscription` method. pub type RpcSubscription = Pin, RpcError>> + Send + 'static>>; + +/// The ID associated with the [`RpcClientT`]'s `subscription`. +pub type RpcSubscriptionId = String;