mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 14:41:11 +00:00
fmt
This commit is contained in:
+3
-4
@@ -35,10 +35,10 @@ use core::{
|
||||
use frame_metadata::RuntimeMetadataPrefixed;
|
||||
pub use jsonrpsee::{
|
||||
client_transport::ws::{
|
||||
Receiver as WsReceiver,
|
||||
Sender as WsSender,
|
||||
Uri,
|
||||
WsTransportClientBuilder,
|
||||
Sender as WsSender,
|
||||
Receiver as WsReceiver,
|
||||
},
|
||||
core_client::{
|
||||
Client as RpcClient,
|
||||
@@ -663,8 +663,7 @@ pub async fn build_ws_client(url: &str) -> Result<RpcClient, RpcError> {
|
||||
}
|
||||
|
||||
async fn ws_transport(url: &str) -> (WsSender, WsReceiver) {
|
||||
// TODO: fix unwraps because I'm lazy.
|
||||
|
||||
// fix unwraps because I'm lazy.
|
||||
let url: Uri = url.parse().unwrap();
|
||||
WsTransportClientBuilder::default()
|
||||
.build(url)
|
||||
|
||||
+10
-7
@@ -27,7 +27,11 @@ use std::{
|
||||
thread,
|
||||
time,
|
||||
};
|
||||
use subxt::rpc::{Client as _, rpc_params, build_ws_client};
|
||||
use subxt::rpc::{
|
||||
build_ws_client,
|
||||
rpc_params,
|
||||
Client as _,
|
||||
};
|
||||
|
||||
static SUBSTRATE_BIN_ENV_VAR: &str = "SUBSTRATE_NODE_PATH";
|
||||
|
||||
@@ -61,12 +65,11 @@ async fn main() {
|
||||
if retries >= MAX_RETRIES {
|
||||
panic!("Cannot connect to substrate node after {} retries", retries);
|
||||
}
|
||||
let res =
|
||||
build_ws_client(&format!("ws://localhost:{}", port))
|
||||
.await
|
||||
.expect("should only error if malformed URL for an HTTP connection")
|
||||
.request("state_getMetadata", rpc_params![])
|
||||
.await;
|
||||
let res = build_ws_client(&format!("ws://localhost:{}", port))
|
||||
.await
|
||||
.expect("should only error if malformed URL for an HTTP connection")
|
||||
.request("state_getMetadata", rpc_params![])
|
||||
.await;
|
||||
match res {
|
||||
Ok(res) => {
|
||||
let _ = cmd.kill();
|
||||
|
||||
Reference in New Issue
Block a user