Split RPCs into a separate crate (#1910)

* WIP extract RPCs into separate crate

* fmt

* Fix test

* Remove unused deps

* fix import

* WIP: Fix up errors and most tests. Start extracintg some tests/code to rpc crate

* MockRpcClient sync or async

* MockRpcClient only async but better type inference

* WIP MockRpcClient FnMuts and some test updates to use it

* Get all but one test working with new MockRpcClient

* WIP trying to debug failure

* WIP, Tests mostly fixed, need to add back oen more

* Get mock RPC tests working

* fmt

* fmt

* Clippy and comment tweak

* update CI to explicitly check subxt-rpc features

* clippy

* small tweaks after pass over

* feature flag rename

* update some docs

* Fix some examples

* fmt

* Fix features flags to work with web/wasm32

* Fix unused dep warning

* explicit targets in wasm CI

* Add better crate level docs

* fmt

* Address review comments

* Comment out flaky test for now and make more obvious how similar POlkadot and Substrate configs are

* Not a doc comment

* Remove unused imports
This commit is contained in:
James Wilson
2025-02-18 12:07:00 +00:00
committed by GitHub
parent 333de953ec
commit 816a86423b
50 changed files with 4575 additions and 1186 deletions
+17 -1
View File
@@ -191,13 +191,24 @@ jobs:
cargo check -p subxt-signer --no-default-features --features ecdsa
cargo check -p subxt-signer --no-default-features --features unstable-eth
# Subxt-rpcs has a bunch of clients that can be exposed. Check that they all stand on their own.
- name: Cargo check subxt-rpcs
run: |
cargo check -p subxt-rpcs
cargo check -p subxt-rpcs --no-default-features --features native
cargo check -p subxt-rpcs --no-default-features --features native,subxt
cargo check -p subxt-rpcs --no-default-features --features native,jsonrpsee
cargo check -p subxt-rpcs --no-default-features --features native,reconnecting-rpc-client
cargo check -p subxt-rpcs --no-default-features --features native,mock-rpc-client
cargo check -p subxt-rpcs --no-default-features --features native,unstable-light-client
# We can't enable web features here, so no cargo hack.
- name: Cargo check subxt-lightclient
run: cargo check -p subxt-lightclient
# Next, check each other package in isolation.
- name: Cargo hack; check each feature/crate on its own
run: cargo hack --exclude subxt --exclude subxt-signer --exclude subxt-lightclient --exclude-all-features --each-feature check --workspace
run: cargo hack --exclude subxt --exclude subxt-signer --exclude subxt-lightclient --exclude subxt-rpcs --exclude-all-features --each-feature check --workspace
# Check the parachain-example code, which isn't a part of the workspace so is otherwise ignored.
- name: Cargo check parachain-example
@@ -225,6 +236,11 @@ jobs:
- name: Rust Cache
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
- name: Cargo check web features which require wasm32 target.
run: |
cargo check -p subxt-rpcs --target wasm32-unknown-unknown --no-default-features --features web
cargo check -p subxt-rpcs --target wasm32-unknown-unknown --no-default-features --features web,reconnecting-rpc-client
# Check WASM examples, which aren't a part of the workspace and so are otherwise missed:
- name: Cargo check WASM examples
run: |