Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 15 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ console_error_panic_hook = "0.1.7"
darling = "0.20.10"
derive-where = "1.2.7"
either = { version = "1.13.0", default-features = false }
finito = { version = "0.1.0", default-features = false }
frame-metadata = { version = "16.0.0", default-features = false }
futures = { version = "0.3.30", default-features = false, features = ["std"] }
getrandom = { version = "0.2", default-features = false }
Expand Down
16 changes: 10 additions & 6 deletions subxt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,28 @@ default = ["jsonrpsee", "native"]
native = [
"jsonrpsee?/async-client",
"jsonrpsee?/client-ws-transport-tls",
"jsonrpsee?/ws-client",
"subxt-lightclient?/native",
"tokio-util",
"reconnecting-jsonrpsee-ws-client?/native",
"tokio?/sync",
]

# Enable this for web/wasm builds.
# Exactly 1 of "web" and "native" is expected.
web = [
"jsonrpsee?/async-wasm-client",
"jsonrpsee?/client-web-transport",
"jsonrpsee?/wasm-client",
"getrandom/js",
"subxt-lightclient?/web",
"subxt-macro/web",
"instant/wasm-bindgen",
"reconnecting-jsonrpsee-ws-client?/web",
"tokio?/sync",
"finito?/wasm-bindgen",
]

# Enable this to use the reconnecting rpc client
unstable-reconnecting-rpc-client = ["dep:reconnecting-jsonrpsee-ws-client"]
unstable-reconnecting-rpc-client = ["dep:finito", "dep:tokio"]

# Enable this to use jsonrpsee (allowing for example `OnlineClient::from_url`).
jsonrpsee = [
Expand Down Expand Up @@ -100,9 +103,6 @@ subxt-core = { workspace = true, features = ["std"] }
subxt-metadata = { workspace = true, features = ["std"] }
subxt-lightclient = { workspace = true, optional = true, default-features = false }

# Reconnecting jsonrpc ws client
reconnecting-jsonrpsee-ws-client = { version = "0.4.3", optional = true, default-features = false }

# For parsing urls to disallow insecure schemes
url = { workspace = true }

Expand All @@ -112,6 +112,10 @@ getrandom = { workspace = true, optional = true }
# Included if "native" feature is enabled
tokio-util = { workspace = true, features = ["compat"], optional = true }

# Included if the reconnecting rpc client feature is enabled
tokio = { workspace = true, optional = true }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up tokio, perhaps we can replace it with futures channels and stuff

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll prob want a tokio feature flag or similar anyway so that we can make it easy to start up the UnstableBackend etc!

I see web enabled tokio?/sync; would webandtokio/sync` work together though?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, tokio/sync works for wasm/web but that could easily be replaced by futures channel

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot that I used tokio::sync::Notify so I prefer to keep tokio but not runtime agnostic but it's doesn't matter anyway because jsonrpsee is already using tokio channels.

We could change that though if becomes an issue.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup I don't mind that it uses tokio since jsonrpsee does anyway, so we don't really gain anything by trying to remove it anyways from this I guess!

finito = { workspace = true, optional = true }

[dev-dependencies]
bitvec = { workspace = true }
codec = { workspace = true, features = ["derive", "bit-vec"] }
Expand Down
270 changes: 0 additions & 270 deletions subxt/src/backend/rpc/reconnecting_rpc_client.rs

This file was deleted.

Loading
Loading