mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 00:31:02 +00:00
Bump jsonrpsee from de7cbf2 to a0bea41 (#28)
* Bump jsonrpsee from `de7cbf2` to `a0bea41` Bumps [jsonrpsee](https://github.com/paritytech/jsonrpsee) from `de7cbf2` to `a0bea41`. - [Release notes](https://github.com/paritytech/jsonrpsee/releases) - [Commits](https://github.com/paritytech/jsonrpsee/compare/de7cbf2b7528802b6c1079de837db1d4f24561a6...a0bea41c4f37125fa742ec48b12e11cf55c592b5) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Fix imports. * Update client code. Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
committed by
Bastian Köcher
parent
24dc3beaf5
commit
8767d443c0
@@ -20,8 +20,11 @@ use crate::params::{RPCUrlParam, Params};
|
|||||||
|
|
||||||
use futures::{prelude::*, channel::{mpsc, oneshot}, future, select};
|
use futures::{prelude::*, channel::{mpsc, oneshot}, future, select};
|
||||||
use jsonrpsee::{
|
use jsonrpsee::{
|
||||||
core::client::{RawClientError, RawClientEvent, RawClientRequestId, RawClientSubscription},
|
raw::client::{RawClient, RawClientError, RawClientEvent, RawClientRequestId, RawClientSubscription},
|
||||||
ws::{WsRawClient, WsConnecError, ws_raw_client},
|
transport::{
|
||||||
|
TransportClient,
|
||||||
|
ws::{WsTransportClient, WsConnecError},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use node_primitives::{Hash, Header};
|
use node_primitives::{Hash, Header};
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
@@ -47,7 +50,7 @@ enum Event {
|
|||||||
|
|
||||||
struct Chain {
|
struct Chain {
|
||||||
url: String,
|
url: String,
|
||||||
client: WsRawClient,
|
client: RawClient<WsTransportClient>,
|
||||||
sender: mpsc::Sender<Event>,
|
sender: mpsc::Sender<Event>,
|
||||||
receiver: mpsc::Receiver<Event>,
|
receiver: mpsc::Receiver<Event>,
|
||||||
genesis_hash: Hash,
|
genesis_hash: Hash,
|
||||||
@@ -60,10 +63,11 @@ async fn init_rpc_connection(url: &RPCUrlParam) -> Result<Chain, Error> {
|
|||||||
|
|
||||||
// Skip the leading "ws://" and trailing "/".
|
// Skip the leading "ws://" and trailing "/".
|
||||||
let url_without_scheme = &url_str[5..(url_str.len() - 1)];
|
let url_without_scheme = &url_str[5..(url_str.len() - 1)];
|
||||||
let mut client = ws_raw_client(url_without_scheme)
|
let transport = WsTransportClient::new(url_without_scheme)
|
||||||
.await
|
.await
|
||||||
.map_err(|err| Error::WsConnectionError(err.to_string()))?;
|
.map_err(|err| Error::WsConnectionError(err.to_string()))?;
|
||||||
|
|
||||||
|
let mut client = RawClient::new(transport);
|
||||||
let genesis_hash = rpc::genesis_block_hash(&mut client)
|
let genesis_hash = rpc::genesis_block_hash(&mut client)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| Error::RPCError(e.to_string()))?
|
.map_err(|e| Error::RPCError(e.to_string()))?
|
||||||
@@ -252,7 +256,7 @@ async fn setup_subscriptions(chain: &mut Chain)
|
|||||||
let new_heads_subscription_id = chain.client
|
let new_heads_subscription_id = chain.client
|
||||||
.start_subscription(
|
.start_subscription(
|
||||||
"chain_subscribeNewHeads",
|
"chain_subscribeNewHeads",
|
||||||
jsonrpsee::core::common::Params::None,
|
jsonrpsee::common::Params::None,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.map_err(RawClientError::Inner)?;
|
.map_err(RawClientError::Inner)?;
|
||||||
@@ -260,7 +264,7 @@ async fn setup_subscriptions(chain: &mut Chain)
|
|||||||
let finalized_heads_subscription_id = chain.client
|
let finalized_heads_subscription_id = chain.client
|
||||||
.start_subscription(
|
.start_subscription(
|
||||||
"chain_subscribeFinalizedHeads",
|
"chain_subscribeFinalizedHeads",
|
||||||
jsonrpsee::core::common::Params::None,
|
jsonrpsee::common::Params::None,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.map_err(RawClientError::Inner)?;
|
.map_err(RawClientError::Inner)?;
|
||||||
@@ -350,9 +354,9 @@ async fn handle_rpc_event(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Let's say this never sends over a channel (ie. cannot block on another task).
|
// Let's say this never sends over a channel (ie. cannot block on another task).
|
||||||
async fn handle_bridge_event(
|
async fn handle_bridge_event<R: TransportClient>(
|
||||||
chain_id: ChainId,
|
chain_id: ChainId,
|
||||||
rpc_client: &mut WsRawClient,
|
rpc_client: &mut RawClient<R>,
|
||||||
event: Event,
|
event: Event,
|
||||||
) -> Result<(), Error>
|
) -> Result<(), Error>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,10 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use jsonrpsee::core::client::{RawClient, RawClientError, TransportClient};
|
use jsonrpsee::{
|
||||||
|
raw::client::{RawClient, RawClientError},
|
||||||
|
transport::TransportClient,
|
||||||
|
};
|
||||||
use node_primitives::{BlockNumber, Hash, Header};
|
use node_primitives::{BlockNumber, Hash, Header};
|
||||||
use sp_core::Bytes;
|
use sp_core::Bytes;
|
||||||
use sp_rpc::number::NumberOrHex;
|
use sp_rpc::number::NumberOrHex;
|
||||||
|
|||||||
Reference in New Issue
Block a user