Update to jsonrpsee 0.7 and impl Stream on TransactionProgress (#380)

* Update to jsonrpsee 0.7 and impl Stream on TransactionProgress

* Fix doc links after rename to next_item

* Add another doc comment
This commit is contained in:
James Wilson
2022-01-04 15:05:53 +00:00
committed by GitHub
parent 3fb4c7089a
commit 26258c84cc
8 changed files with 126 additions and 100 deletions
+18 -20
View File
@@ -33,25 +33,23 @@ use core::{
};
use frame_metadata::RuntimeMetadataPrefixed;
use jsonrpsee::{
core::{
client::{
Client,
ClientT,
Subscription,
SubscriptionClientT,
},
to_json_value,
DeserializeOwned,
Error as RpcError,
JsonValue,
},
http_client::{
HttpClient,
HttpClientBuilder,
},
types::{
to_json_value,
traits::{
Client,
SubscriptionClient,
},
DeserializeOwned,
Error as RpcError,
JsonValue,
Subscription,
},
ws_client::{
WsClient,
WsClientBuilder,
},
ws_client::WsClientBuilder,
};
use serde::{
Deserialize,
@@ -172,7 +170,7 @@ pub enum SubstrateTransactionStatus<Hash, BlockHash> {
#[derive(Clone)]
pub enum RpcClient {
/// JSONRPC client WebSocket transport.
WebSocket(Arc<WsClient>),
WebSocket(Arc<Client>),
/// JSONRPC client HTTP transport.
// NOTE: Arc because `HttpClient` is not clone.
Http(Arc<HttpClient>),
@@ -239,14 +237,14 @@ impl RpcClient {
}
}
impl From<WsClient> for RpcClient {
fn from(client: WsClient) -> Self {
impl From<Client> for RpcClient {
fn from(client: Client) -> Self {
RpcClient::WebSocket(Arc::new(client))
}
}
impl From<Arc<WsClient>> for RpcClient {
fn from(client: Arc<WsClient>) -> Self {
impl From<Arc<Client>> for RpcClient {
fn from(client: Arc<Client>) -> Self {
RpcClient::WebSocket(client)
}
}