refactor: replace reconnecting-jsonrpsee-ws-client with subxt-reconnecting-rpc-client (#1705)

* feat: add native subxt rpc reconn client

* add jsonrpsee dep to reconnecting-client

* Update subxt/src/backend/rpc/reconnecting_rpc_client/tests.rs

* fix grumbles

* add simple wasm test for reconnecting client

* fix test build

* cargo fmt

* remove reconnect apis

* Update testing/wasm-rpc-tests/tests/wasm.rs

* Update subxt/src/backend/rpc/reconnecting_rpc_client/tests.rs

* Update subxt/src/backend/rpc/reconnecting_rpc_client/tests.rs
This commit is contained in:
Niklas Adolfsson
2024-08-27 15:18:06 +02:00
committed by GitHub
parent 193452e95f
commit 4bc27d4977
14 changed files with 1102 additions and 343 deletions
+11 -1
View File
@@ -1,6 +1,7 @@
#![cfg(target_arch = "wasm32")]
use subxt::config::SubstrateConfig;
use subxt::backend::rpc::reconnecting_rpc_client::RpcClient as ReconnectingRpcClient;
use wasm_bindgen_test::*;
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
@@ -32,5 +33,14 @@ async fn wasm_ws_transport_works() {
.unwrap();
let mut stream = client.backend().stream_best_block_headers().await.unwrap();
stream.next().await;
assert!(stream.next().await.is_some());
}
#[wasm_bindgen_test]
async fn reconnecting_rpc_client_ws_transport_works() {
let rpc = ReconnectingRpcClient::builder().build("ws://127.0.0.1:9944".to_string()).await.unwrap();
let client = subxt::client::OnlineClient::<SubstrateConfig>::from_rpc_client(rpc.clone()).await.unwrap();
let mut stream = client.backend().stream_best_block_headers().await.unwrap();
assert!(stream.next().await.is_some());
}