mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 13:01:07 +00:00
refactor(rpc): support default port in URL (#1122)
* refactor: support default port in URL Update jsonrpsee to v0.20 to support the default port number in URLs. * fix nit, revert web feature * fix lightclient code
This commit is contained in:
@@ -13,6 +13,6 @@ impl-serde = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
tokio = { workspace = true, features = ["rt-multi-thread"] }
|
||||
which = { workspace = true }
|
||||
jsonrpsee = { workspace = true, features = ["async-client", "client-ws-transport"] }
|
||||
jsonrpsee = { workspace = true, features = ["async-client", "client-ws-transport-native-tls"] }
|
||||
hex = { workspace = true }
|
||||
codec = { workspace = true }
|
||||
|
||||
@@ -102,7 +102,7 @@ async fn run() {
|
||||
// Use jsonrpsee to obtain metadata from the node.
|
||||
mod client {
|
||||
pub use jsonrpsee::{
|
||||
client_transport::ws::{InvalidUri, Receiver, Sender, Uri, WsTransportClientBuilder},
|
||||
client_transport::ws::{Receiver, Sender, Url, WsTransportClientBuilder},
|
||||
core::{
|
||||
client::{Client, ClientBuilder},
|
||||
Error,
|
||||
@@ -114,13 +114,11 @@ mod client {
|
||||
/// Build WS RPC client from URL
|
||||
pub async fn build(url: &str) -> Result<Client, Error> {
|
||||
let (sender, receiver) = ws_transport(url).await?;
|
||||
Ok(ClientBuilder::default().build_with_tokio(sender, receiver))
|
||||
Ok(Client::builder().build_with_tokio(sender, receiver))
|
||||
}
|
||||
|
||||
async fn ws_transport(url: &str) -> Result<(Sender, Receiver), Error> {
|
||||
let url: Uri = url
|
||||
.parse()
|
||||
.map_err(|e: InvalidUri| Error::Transport(e.into()))?;
|
||||
let url = Url::parse(url).map_err(|e| Error::Transport(e.into()))?;
|
||||
WsTransportClientBuilder::default()
|
||||
.build(url)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user