mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 04:37:57 +00:00
bec896d91a
* add simple reconnecting rpc client * initial retryable calls * add reconnecting backend * add reconnecting example for unstable backend * add todo what isn't working * FollowStream: restart on reconn * naive fix: fetch sub_id in stream_headers * cleanup * remove resubscribe APIs * cleanup and remove many wrapper streams * remove retry backend * legacy rpc: make it retryable * unstable rpc: make it retryable * fix nits * support wasm as well * remove deadcode * address grumbles * revert rpc methods * don't create a subscription per block * get rid off retry logic in subxt rpc * Update subxt/Cargo.toml * Update subxt/src/backend/legacy/mod.rs * Update subxt/src/backend/legacy/mod.rs * remove outdated comments * fix bad merge * Fix reconnecting RPC client and update dependencies * add back retry logic and remove `finito` * fix nits * cleanup * add hack for race when reconnecting * backend: emit Stop event DisconnectWillRecoonect * merge reconnecting client examples * add fn retry_stream * cleanup * add all features from reconnecting-rpc-client * fix build * remove needless retry for fetch_storage * StorageFetchDescendantKeysStream handle disconnect err * dont retry transactions * fetch subscription ID from FollowStreamMsg * fix nits * Update subxt/src/backend/legacy/mod.rs * Update subxt/src/backend/legacy/mod.rs * add reconn to StorageItems stream * StorageFetchDescendantKeysStreamchore: retry storage call * RetryStream: emit DisconnectWillReconnect msg * runtime subscriptions ignore DisconnectWillReconn * Update subxt/examples/setup_reconnecting_rpc_client.rs * Update subxt/src/client/online_client.rs * Update subxt/src/client/online_client.rs * Add custom stream wrapper for finalized blocks * add missing retry block * clippy * clippy again * cleanup * remove duplicate logic * fix more grumbles * Update subxt/examples/setup_reconnecting_rpc_client.rs Co-authored-by: James Wilson <james@jsdw.me> * simplify the example * remove pin-project dep * remove duplicate retry logic * remove extra code * specify trait bounds for retry api * simplify the example * fix weird Poll::Pending return * fix nit in poll impl * remove needless paths * make retry_stream pub and add doc examples * Update subxt/src/backend/utils.rs --------- Co-authored-by: James Wilson <james@jsdw.me>
152 lines
5.5 KiB
TOML
152 lines
5.5 KiB
TOML
[package]
|
|
name = "subxt"
|
|
version.workspace = true
|
|
authors.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
publish = true
|
|
|
|
license.workspace = true
|
|
readme = "../README.md"
|
|
repository.workspace = true
|
|
documentation.workspace = true
|
|
homepage.workspace = true
|
|
description = "Submit extrinsics (transactions) to a substrate node via RPC"
|
|
keywords = ["parity", "substrate", "blockchain"]
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[features]
|
|
# For dev and documentation reasons we enable more features than are often desired.
|
|
# it's recommended to use `--no-default-features` and then select what you need.
|
|
default = ["jsonrpsee", "native"]
|
|
|
|
# Enable this for native (ie non web/wasm builds).
|
|
# Exactly 1 of "web" and "native" is expected.
|
|
native = [
|
|
"jsonrpsee?/async-client",
|
|
"jsonrpsee?/client-ws-transport-native-tls",
|
|
"subxt-lightclient?/native",
|
|
"tokio-util",
|
|
"reconnecting-jsonrpsee-ws-client?/native",
|
|
]
|
|
|
|
# Enable this for web/wasm builds.
|
|
# Exactly 1 of "web" and "native" is expected.
|
|
web = [
|
|
"jsonrpsee?/async-wasm-client",
|
|
"jsonrpsee?/client-web-transport",
|
|
"getrandom/js",
|
|
"subxt-lightclient?/web",
|
|
"subxt-macro/web",
|
|
"instant/wasm-bindgen",
|
|
"reconnecting-jsonrpsee-ws-client?/web",
|
|
]
|
|
|
|
# Enable this to use the reconnecting rpc client
|
|
unstable-reconnecting-rpc-client = ["dep:reconnecting-jsonrpsee-ws-client"]
|
|
|
|
# Enable this to use jsonrpsee (allowing for example `OnlineClient::from_url`).
|
|
jsonrpsee = [
|
|
"dep:jsonrpsee",
|
|
]
|
|
|
|
# Enable this to pull in extra Substrate dependencies which make it possible to
|
|
# use the `sp_core::crypto::Pair` Signer implementation, as well as adding some
|
|
# `From` impls for types like `AccountId32`. Cannot be used with "web".
|
|
substrate-compat = ["subxt-core/substrate-compat"]
|
|
|
|
# Enable this to fetch and utilize the latest unstable metadata from a node.
|
|
# The unstable metadata is subject to breaking changes and the subxt might
|
|
# fail to decode the metadata properly. Use this to experiment with the
|
|
# latest features exposed by the metadata.
|
|
unstable-metadata = []
|
|
|
|
# Activate this to expose the Light Client functionality.
|
|
# Note that this feature is experimental and things may break or not work as expected.
|
|
unstable-light-client = ["subxt-lightclient"]
|
|
|
|
[dependencies]
|
|
async-trait = { workspace = true }
|
|
codec = { package = "parity-scale-codec", workspace = true, features = ["derive"] }
|
|
derive-where = { workspace = true }
|
|
scale-info = { workspace = true, features = ["default"] }
|
|
scale-value = { workspace = true, features = ["default"] }
|
|
scale-bits = { workspace = true, features = ["default"] }
|
|
scale-decode = { workspace = true, features = ["default"] }
|
|
scale-encode = { workspace = true, features = ["default"] }
|
|
futures = { workspace = true }
|
|
hex = { workspace = true }
|
|
serde = { workspace = true, features = ["derive"] }
|
|
serde_json = { workspace = true, features = ["default", "raw_value"] }
|
|
thiserror = { workspace = true }
|
|
tracing = { workspace = true }
|
|
frame-metadata = { workspace = true }
|
|
either = { workspace = true }
|
|
instant = { workspace = true }
|
|
|
|
# Provides some deserialization, types like U256/H256 and hashing impls like twox/blake256:
|
|
impl-serde = { workspace = true }
|
|
primitive-types = { workspace = true, features = ["codec", "scale-info", "serde"] }
|
|
sp-crypto-hashing = { workspace = true }
|
|
|
|
# Included if the "jsonrpsee" feature is enabled.
|
|
jsonrpsee = { workspace = true, optional = true, features = ["jsonrpsee-types"] }
|
|
|
|
# Other subxt crates we depend on.
|
|
subxt-macro = { workspace = true }
|
|
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", optional = true, default-features = false }
|
|
|
|
# For parsing urls to disallow insecure schemes
|
|
url = { workspace = true }
|
|
|
|
# Included if "web" feature is enabled, to enable its js feature.
|
|
getrandom = { workspace = true, optional = true }
|
|
|
|
# Included if "native" feature is enabled
|
|
tokio-util = { workspace = true, features = ["compat"], optional = true }
|
|
|
|
[dev-dependencies]
|
|
bitvec = { workspace = true }
|
|
codec = { workspace = true, features = ["derive", "bit-vec"] }
|
|
scale-info = { workspace = true, features = ["bit-vec"] }
|
|
tokio = { workspace = true, features = ["macros", "time", "rt-multi-thread"] }
|
|
sp-core = { workspace = true }
|
|
sp-keyring = { workspace = true }
|
|
sp-runtime = { workspace = true }
|
|
assert_matches = { workspace = true }
|
|
subxt-signer = { path = "../signer", features = ["unstable-eth"] }
|
|
# Tracing subscriber is useful for light-client examples to ensure that
|
|
# the `bootNodes` and chain spec are configured correctly. If all is fine, then
|
|
# the light-client wlll emit INFO logs with
|
|
# `GrandPa warp sync finished` and `Finalized block runtime ready.`
|
|
tracing-subscriber = { workspace = true }
|
|
|
|
[[example]]
|
|
name = "light_client_basic"
|
|
path = "examples/light_client_basic.rs"
|
|
required-features = ["unstable-light-client", "jsonrpsee"]
|
|
|
|
[[example]]
|
|
name = "light_client_local_node"
|
|
path = "examples/light_client_local_node.rs"
|
|
required-features = ["unstable-light-client", "jsonrpsee", "native"]
|
|
|
|
[[example]]
|
|
name = "setup_reconnecting_rpc_client"
|
|
path = "examples/setup_reconnecting_rpc_client.rs"
|
|
required-features = ["unstable-reconnecting-rpc-client"]
|
|
|
|
[package.metadata.docs.rs]
|
|
features = ["default", "substrate-compat", "unstable-light-client"]
|
|
rustdoc-args = ["--cfg", "docsrs"]
|
|
|
|
[package.metadata.playground]
|
|
features = ["default", "substrate-compat", "unstable-light-client"]
|