make web and native features explicit in signer if subxt feature enabled

This commit is contained in:
Tadeo hepperle
2023-10-09 11:38:29 +02:00
parent 9c85982208
commit f40f22d78b
7 changed files with 331 additions and 149 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ description = "Sign extrinsics to be submitted by Subxt"
keywords = ["parity", "subxt", "extrinsic", "signer"]
[features]
default = ["sr25519", "ecdsa", "subxt", "native"]
default = ["sr25519", "ecdsa", "subxt"]
# Pick the signer implementation(s) you need by enabling the
# corresponding features. Note: I had more difficulties getting
@@ -30,8 +30,8 @@ subxt = ["dep:subxt"]
# The getrandom package is used via schnorrkel. We need to enable the JS
# feature on it if compiling for the web.
web = ["getrandom/js", "subxt?/web"]
native = ["subxt?/native"]
web = ["getrandom/js", "subxt/web"]
native = ["subxt/native"]
[dependencies]
subxt = { workspace = true, optional = true, default-features = false }
+8 -2
View File
@@ -39,5 +39,11 @@ pub use secrecy::{ExposeSecret, SecretString};
// DeriveJunctions are the "path" part of these SecretUris.
pub use crypto::{DeriveJunction, SecretUri, SecretUriError, DEV_PHRASE};
#[cfg(all(feature = "subxt", not(any(feature = "web", feature = "native"))))]
compile_error!("subxt-signer: When using the 'subxt' feature, exactly one of the 'web' and 'native' features should be used.");
#[cfg(all(
feature = "subxt",
any(
all(feature = "web", feature = "native"),
not(any(feature = "web", feature = "native"))
)
))]
compile_error!("subxt-signer: exactly one of the 'web' and 'native' features should be used.");
+2 -2
View File
@@ -14,8 +14,8 @@ serde_json = "1"
# enable the "web" feature here but don't want it enabled as part
# of workspace builds. Also disable the "subxt" feature here because
# we want to ensure it works in isolation of that.
subxt-signer = { path = "..", default-features = false, features = ["web", "sr25519", "ecdsa"] }
subxt-signer = { path = "..", features = ["web"] }
# this shouldn't be needed, it's in workspace.exclude, but still
# I get the complaint unless I add it...
[workspace]
[workspace]