[package]
name = "subxt-lightclient"
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 = "Light Client for chain interaction"
keywords = ["parity", "substrate", "blockchain"]

[lints]
workspace = true

[features]
default = ["native"]

# Enable this for native (ie non web/wasm builds).
# Exactly 1 of "web" and "native" is expected.
native = [
    "smoldot-light/std",
    "tokio/rt",
]

# Enable this for web/wasm builds.
# Exactly 1 of "web" and "native" is expected.
web = [
    "getrandom/js",
    "smoldot/std",

    # For the light-client platform.
    "wasm-bindgen-futures",
	"futures-timer/wasm-bindgen",
    "web-time",
    "pin-project",

    # For websocket.
    "js-sys",
    "send_wrapper",
    "web-sys",
    "wasm-bindgen",
]

[dependencies]
futures = { workspace = true, features = ["async-await"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["default", "raw_value"] }
thiserror = { workspace = true }
tracing = { workspace = true }
smoldot-light = { workspace = true }
tokio-stream = { workspace = true }
tokio = { workspace = true, features = ["sync"] }
futures-util = { workspace = true }

# Only needed for web
js-sys = { workspace = true, optional = true }
send_wrapper = { workspace = true, optional = true }
web-sys = { workspace = true, optional = true }
wasm-bindgen = { workspace = true, optional = true }
wasm-bindgen-futures = { workspace = true, optional = true }
smoldot = { workspace = true, optional = true }
pin-project = { workspace = true, optional = true }
futures-timer = { workspace = true, optional = true }
web-time = { workspace = true, optional = true }
getrandom = { workspace = true, optional = true }

[package.metadata.docs.rs]
default-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.playground]
default-features = true
