make [btc] feature optional and the default one & enable [sol] as optional feature

This commit is contained in:
ghassmo
2021-09-10 13:02:43 +03:00
parent 0e34beb106
commit df97ccf8fb
2 changed files with 7 additions and 6 deletions

View File

@@ -88,19 +88,17 @@ tokio-tungstenite = {version = "0.15.0", optional = true}
tokio = {version = "1.11.0", features = ["full"], optional = true}
## Cashier Bitcoin Dependencies
# TODO: Make optional, cashier should have "features" to enable different chains
# See https://doc.rust-lang.org/cargo/reference/features.html
bitcoin = {version = "0.27.0", optional = false }
secp256k1 = {version = "0.20.3", optional = false }
electrum-client = {version = "0.8.0", optional = false }
bitcoin = {version = "0.27.0", optional = true }
secp256k1 = {version = "0.20.3", optional = true}
electrum-client = {version = "0.8.0", optional = true }
[dependencies.rusqlite]
version = "0.25.1"
features = ["bundled", "sqlcipher"]
[features]
default = ["bitcoin", "secp256k1", "electrum-client"]
sol = ["solana-sdk", "solana-client", "tokio-tungstenite", "tokio"]
#btc = ["bitcoin", "secp256k1", "electrum-client"]
[[bin]]
name = "lisp"

View File

@@ -42,6 +42,7 @@ pub enum Error {
ZmqError(String),
VerifyFailed,
ClientFailed(String),
#[cfg(feature = "default")]
BtcFailed(String),
TryIntoError,
TryFromError,
@@ -94,6 +95,7 @@ impl fmt::Display for Error {
Error::ZmqError(ref err) => write!(f, "ZmqError: {}", err),
Error::VerifyFailed => f.write_str("Verify failed"),
Error::ClientFailed(ref err) => write!(f, "Client failed: {}", err),
#[cfg(feature = "default")]
Error::BtcFailed(ref err) => write!(f, "Btc client failed: {}", err),
Error::TryIntoError => f.write_str("TryInto error"),
Error::TryFromError => f.write_str("TryFrom error"),
@@ -217,6 +219,7 @@ impl From<client::ClientFailed> for Error {
}
}
#[cfg(feature = "default")]
impl From<crate::service::BtcFailed> for Error {
fn from(err: crate::service::BtcFailed) -> Error {
Error::BtcFailed(err.to_string())