From 33b4eb7e1d64dce2317ca19e3bf3ced49a0c7289 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Thu, 24 Nov 2022 17:01:47 +0000 Subject: [PATCH] examples: Adjust example to return subscription ID Signed-off-by: Alexandru Vasile --- examples/examples/custom_rpc_client.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/examples/custom_rpc_client.rs b/examples/examples/custom_rpc_client.rs index 52e0cd8227..a4be9a6a0a 100644 --- a/examples/examples/custom_rpc_client.rs +++ b/examples/examples/custom_rpc_client.rs @@ -16,6 +16,7 @@ use subxt::{ RpcClientT, RpcFuture, RpcSubscription, + RpcSubscriptionId, }, OnlineClient, PolkadotConfig, @@ -54,7 +55,7 @@ impl RpcClientT for MyLoggingClient { sub: &'a str, params: Option>, unsub: &'a str, - ) -> RpcFuture<'a, RpcSubscription> { + ) -> RpcFuture<'a, (RpcSubscription, Option)> { writeln!( self.log.lock().unwrap(), "{sub}({}) (unsub: {unsub})", @@ -68,7 +69,8 @@ impl RpcClientT for MyLoggingClient { let res = RawValue::from_string("[]".to_string()).unwrap(); let stream = futures::stream::once(async move { Ok(res) }); let stream: Pin + Send>> = Box::pin(stream); - Box::pin(std::future::ready(Ok(stream))) + // This subscription does not provide an ID. + Box::pin(std::future::ready(Ok((stream, None)))) } }