[package]
name = "lnpbp"
version = "0.2.0-beta.4"
license = "MIT"
authors = ["Dr. Maxim Orlovsky <orlovsky@pandoracore.com>"]
description = "LNP/BP Core Library implementing LNPBP specifications & standards"
repository = "https://github.com/LNP-BP/rust-lnpbp"
homepage = "https://github.com/LNP-BP"
keywords = ["bitcoin", "lightning", "lnp-bp", "layer-3", "cryptography"]
readme = "README.md"
edition = "2018"
exclude = [".github", "derive", "contrib", "services"]

[lib]
name = "lnpbp"
path = "src/lib.rs"
crate-type = ["dylib", "rlib", "staticlib"]

# Dependencies
# ============
#
# Version policy
# --------------
# The policy in specifying dependencies versions are to use tilde requirements
# according to
# <https://doc.rust-lang.org/nightly/cargo/reference/specifying-dependencies.html?highlight=feature#tilde-requirements>
# with full semver version specification (major, minor and patch components)
# which means that we may upgrade for patches/bugfixes, but must not change
# even the minor version of the package.
# Once the library is stable consider upgrading tilde requirements to strict
# equivalence requirements (with '=' sign) since even dependencies patching will
# not introduce risk of breaking the consensus and even security updates must
# be done manually after through testing
[dependencies]
# Dependencies on other LNP/BP repositories
# -----------------------------------------
amplify = { version = "~2.3.1", features = ["stringly_conversions"] }
amplify_derive = "~2.3.0"
lnpbp_derive = "=0.2.0-beta.4"
# Dependencies on core rust-bitcoin ecosystem projects
# ----------------------------------------------------
bitcoin = { version = "~0.25.1", features = ["rand"] }
bitcoin_hashes = "~0.9.3" # we need macro from here
# <https://github.com/LNP-BP/LNPBPs/blob/master/lnpbp-0002.md#deterministic-public-key-extraction-from-bitcoin-script>
# We have to fix version of miniscript as required by LNPBP-2 specification
miniscript = { version = "~3.0.0", features = ["compiler"] }
bech32 = "~0.7.2"
lightning-invoice = { version = "~0.3.0", optional = true }
chacha20poly1305 = "~0.7.0"
#   Used only as a part of RGB for encoding Ed25519 key data (for instance as
#   a part of Tor address)
ed25519-dalek = { version = "~1.0.0", optional = true }
# Core rust projects
# ------------------
#   This strange naming is a workaround for cargo inability to define required
#   features for a dependency. See
#   <https://github.com/rust-lang/api-guidelines/issues/180> for the explanation
#   and references.
serde_crate = { package = "serde", version = "~1.0.106", features = ["derive"], optional = true }
serde_with = { version = "~1.5.1", optional = true, features = ["hex"] }
serde_with_macros = "~1.2.0" # Fix for the problem in 1.3.0
tokio = { version = "~0.2.18", features = ["tcp", "sync"], optional = true }
lazy_static = "~1.4.0"
# Networking deps
# ---------------
#   All these dependencies are used to provide support for networking URLs in
#   `lnp` mod and are turned on only if `lbp`, `zmq` or `url` features are used
zmq = { version = "~0.9.2", optional = true }
url = { version = "~2.1.1", optional = true }
# Serializtion
# ------------
#    Used in RGB data Bech32 encodings
deflate = { version = "~0.8.6", optional = true }
inflate = { version = "~0.4.5", optional = true }
chrono = "~0.4.19"
# Temporary-needed dependencies:
# ------------------------------
# 1. We are of no control of what's happening in Grin and would like to prevent
#    updates w/o checking them manually. Should Elements Project secpk256k-zkp
#    accept bulletproofs code, we will switch to it
grin_secp256k1zkp = { version = "=0.7.9", optional = true }
# 2. We use these to simplify enum strict encoding, but once the required
#    functionality will become part of either amplify_derive or lnpbp_derive
#    crates they should be removed
num-traits = "~0.2.11"
num-derive = "~0.3.0"
# 3. Once async traits will get to rust compiler, this one will be also not
#    needed
async-trait = { version = "~0.1.30", optional = true }
torut = { version = "~0.1.6", features = ["v2", "v3"] }

[target.'cfg(target_os="android")'.dependencies]
cc = { version = "=1.0.41" }
# TODO: Find a soliton to a problem with breaking change in one of tokio
#       dependencies
# socket2 = { version = "=0.3.15" }
zmq = { version = "~0.9", features = ["vendored"] }

[target.'cfg(target_os="ios")'.dependencies]
zeromq-src = { version = "~0.1", git = "https://github.com/LNP-BP/zeromq-src-rs", branch = "fix/cmake" }

[target.'cfg(target_os="windows")'.dependencies]
openssl = { version = "~0.10", features = ["vendored"] }

[patch.crates-io]
# required to build on 32-bit architectures
# see also https://github.com/LNP-BP/rgb-node/issues/4
lightning-invoice = { git = "https://github.com/LNP-BP/rust-lightning-invoice", tag = "lnpbp-v0.1.0-beta-4", optional = true  }

# Features
# ========
[features]
# Listings
# --------
#   By default we use tokio-enhanced LNP with Tor support and URL support
default = ["lnp", "rgb", "tor", "url"]
all = [
       # Library components
       "lnp", "rgb",
       # Core rust
       "serde", "tokio", "async",
       # Cryptographic optionals
       "keygen", "elgamal",
       # Networking
       "tor", "url", "websockets", "vendored_openssl"]
# High-level library components
# -----------------------------
lnp = ["async", "zmq", "lightning-invoice"]
rgb = ["bulletproofs", "ed25519-dalek", "deflate", "inflate"]
# Exposing core rust componens
# ----------------------------
#   These also include re-assembly of necessary features from dependencies
async = ["async-trait", "tokio"]
serde = ["serde_crate", "serde_with", "amplify/serde",
         "bitcoin/use-serde", "miniscript/serde" ]
# Optional cryptographic functionality
# ------------------------------------
bulletproofs = ["grin_secp256k1zkp"] # Auto-required and used only by RGB
keygen = ["bitcoin/rand"]
elgamal = [] # Provides ElGamal encryption module from this library
# Networking
# ----------
websockets = [] # Used only by LNP
tor = ["amplify/tor"] # Exposes dependency feature
vendored_openssl = ["torut/vendored_openssl"]

[workspace]
members = [".", "derive", "services"]
default-members = [".", "derive", "services"]
exclude = ["dep_test"]
