fix: Convert vendor/pezkuwi-subxt from submodule to regular directory

This commit is contained in:
2025-12-19 16:45:24 +03:00
parent 9a52edf0df
commit fdd023c499
393 changed files with 154124 additions and 1 deletions
@@ -0,0 +1 @@
/target
File diff suppressed because it is too large Load Diff
+18
View File
@@ -0,0 +1,18 @@
[package]
name = "wasm-rpc-tests"
version = "0.1.0"
edition = "2021"
publish = false
[dev-dependencies]
wasm-bindgen-test = "0.3.24"
tracing-wasm = "0.2.1"
tracing = "0.1.34"
console_error_panic_hook = "0.1.7"
serde_json = "1"
futures-util = "0.3.30"
# This crate is not a part of the workspace, because it
# requires the "jsonrpsee web" features to be enabled, which we don't
# want enabled for workspace builds in general.
subxt = { path = "../../subxt", default-features = false, features = ["web", "jsonrpsee", "reconnecting-rpc-client"] }
@@ -0,0 +1,60 @@
#![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);
// Run the tests by calling:
//
// ```text
// wasm-pack test --firefox --headless`
// ```
//
// You'll need to have a substrate node running:
//
// ```bash
// ./substrate-node --dev --node-key 0000000000000000000000000000000000000000000000000000000000000001 --listen-addr /ip4/0.0.0.0/tcp/30333/ws
// ```
//
// Use the following to enable logs:
// ```
// console_error_panic_hook::set_once();
// tracing_wasm::set_as_global_default();
// ```
#[wasm_bindgen_test]
async fn wasm_ws_transport_works() {
console_error_panic_hook::set_once();
tracing_wasm::set_as_global_default();
let client = subxt::client::OnlineClient::<SubstrateConfig>::from_url("ws://127.0.0.1:9944")
.await
.unwrap();
let hasher = client.hasher();
let mut stream = client.backend().stream_best_block_headers(hasher).await.unwrap();
assert!(stream.next().await.is_some());
}
#[wasm_bindgen_test]
async fn wasm_ws_chainhead_works() {
let rpc = subxt::backend::rpc::RpcClient::from_url("ws://127.0.0.1:9944").await.unwrap();
let backend = subxt::backend::chain_head::ChainHeadBackendBuilder::new().build_with_background_driver(rpc);
let client = subxt::client::OnlineClient::<SubstrateConfig>::from_backend(std::sync::Arc::new(backend)).await.unwrap();
let hasher = client.hasher();
let mut stream = client.backend().stream_best_block_headers(hasher).await.unwrap();
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 hasher = client.hasher();
let mut stream = client.backend().stream_best_block_headers(hasher).await.unwrap();
assert!(stream.next().await.is_some());
}