Cargo Features

[dependencies]
subxt = { version = "0.38.0", default-features = false, features = ["native", "web", "runtime", "reconnecting-rpc-client", "jsonrpsee", "substrate-compat", "unstable-metadata", "unstable-light-client", "runtime-metadata-path"] }
default = jsonrpsee, native

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.

native default = tokio-util

Enable this for native (ie non web/wasm builds).
Exactly 1 of "web" and "native" is expected.

Enables native of optional subxt-lightclient and async-client, client-ws-transport-tls and ws-client of optional jsonrpsee

Included if the "jsonrpsee" feature is enabled.

and sync of optional tokio

Included if the reconnecting rpc client feature is enabled Only the tokio/sync is used in the reconnecting rpc client and that compiles both for native and web.

Affects platform::ws_client

web

Enable this for web/wasm builds.
Exactly 1 of "web" and "native" is expected.

Enables wasm-bindgen of optional finito, async-wasm-client, client-web-transport and wasm-client of optional jsonrpsee, sync of optional tokio and js of getrandom

Included if "web" feature is enabled, to enable its js feature.

and web of subxt-macro and optional subxt-lightclient

subxt-macro:

Other subxt crates we depend on.

Affects platform::ws_client

runtime jsonrpsee = wasm-bindgen-futures

Feature flag to enable the default future executor. Technically it's a hack enable to both but simplifies the conditional compilation and subxt is selecting executor based on the used platform.

For instance wasm-bindgen-futures panics if the platform isn't wasm32 and similar for tokio that requires a tokio runtime to be initialized.

Enables rt of tokio

reconnecting-rpc-client = jsonrpsee

Enable this to use the reconnecting rpc client

Enables finito

jsonrpsee default reconnecting-rpc-client? = runtime

Enable this to use jsonrpsee (allowing for example OnlineClient::from_url).

Enables jsonrpsee

substrate-compat

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".

Enables substrate-compat of subxt-core

unstable-metadata

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-light-client = subxt-lightclient

Activate this to expose the Light Client functionality.
Note that this feature is experimental and things may break or not work as expected.

runtime-metadata-path

Activate this to expose the ability to generate metadata from Wasm runtime files.

Enables runtime-metadata-path of subxt-macro

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

subxt-lightclient unstable-light-client?
getrandom web?
tokio-util native

Enables tokio-util

Included if "native" feature is enabled

tokio runtime?
wasm-bindgen-futures runtime?