[package]
name = "darkfi"
version = "0.4.0"
homepage = "https://dark.fi"
description = "Anonymous. Uncensored. Sovereign."
authors = ["Dyne.org foundation <foundation@dyne.org>"]
repository = "https://github.com/darkrenaissance/darkfi"
license = "AGPL-3.0-only"
edition = "2021"

[lib]
name = "darkfi"
doctest = false

#[profile.release]
#debug = true
#lto = "fat"
#codegen-units = 1

[workspace]
members = [
    "bin/zkas",
    #"bin/cashierd",
    "bin/darkfid",
    "bin/drk",
    "bin/faucetd",
    "bin/fud/fu",
    "bin/fud/fud",
    "bin/ircd",
    "bin/ircd2",
    "bin/dnetview",
    #"bin/dao/daod",
    #"bin/dao/dao-cli",
    "bin/tau/taud",
    "bin/tau/tau-cli",
    #"bin/darkwiki/darkwikid",
    #"bin/darkwiki/darkwiki-cli",
    "bin/vanityaddr",
    "bin/lilith",
    "bin/zktool",

    "src/sdk",
    "src/serial",
    "src/serial/derive",
    "src/serial/derive-internal",

    "src/contract/money",
    "src/contract/dao",

    "example/dchat",
]

[dependencies]
# Hard dependencies
libc = "0.2.139"
log = "0.4.17"
thiserror = "1.0.38"

# async-runtime
async-std = {version = "1.12.0", features = ["attributes"], optional = true}
async-trait = {version = "0.1.64", optional = true}
futures = {version = "0.3.26", optional = true}
smol = {version = "1.3.0", optional = true}

# Networking
futures-rustls = {version = "0.22.2", features = ["dangerous_configuration"], optional = true}
iprange = {version = "0.6.7", optional = true}
ipnet = {version = "2.7.1", optional = true}
socket2 = {version = "0.4.7", optional = true}

# TLS cert utilities
ed25519-compact = {version = "2.0.4", features = ["pem"], optional = true}
rcgen = {version = "0.10.0", features = ["pem"], optional = true}
rustls-pemfile = {version = "1.0.2", optional = true}

# Encoding
bs58 = {version = "0.4.0", optional = true}
hex = {version = "0.4.3", optional = true}
serde_json = {version = "1.0.91", optional = true}
serde = {version = "1.0.152", features = ["derive"], optional = true}
structopt = {version= "0.3.26", optional = true}
structopt-toml = {version= "0.5.1", optional = true}
toml = {version = "0.7.1", optional = true}
# big float
dashu = { version = "0.2.0", git = "https://github.com/ertosns/dashu", optional=true }

# Utilities
# TODO: check chrono usage and impl our own
chrono = {version = "0.4.23", optional = true}
darkfi-serial = {path = "src/serial", optional = true}
darkfi-derive = {path = "src/serial/derive", optional = true}
darkfi-derive-internal = {path = "src/serial/derive-internal", optional = true}
indexmap = {version = "1.9.2", optional = true}
itertools = {version = "0.10.5", optional = true}
lazy_static = {version = "1.4.0", optional = true}
# TODO: Test without serde
url = {version = "2.3.1", features = ["serde"], optional = true}

# Misc
# TODO: Implement something simple and kill these deps
indicatif = {version = "0.17.3", optional = true}
simplelog = {version = "0.12.0", optional = true}

# Websockets
async-tungstenite = {version = "0.19.0", optional = true}

# socks5
fast-socks5 = {version = "0.4.3", optional = true}
            
# Crypto
rand = {version = "0.8.5", optional = true}
blake3 = {version = "1.3.3", optional = true}
crypto_api_chachapoly = {version = "0.5.0", optional = true}
halo2_proofs = {version = "0.2.0", optional = true}
halo2_gadgets = {version = "0.2.0", optional = true}

# Smart contract runtime
darkfi-sdk = {path = "src/sdk", optional = true}
wasmer = {version = "3.1.1", optional = true}
wasmer-compiler-singlepass = {version = "3.1.1", optional = true}
wasmer-middlewares = {version = "3.1.1", optional = true}

# Wallet management
libsqlite3-sys = {version = "0.24.1", features = ["bundled-sqlcipher"],  optional = true }
sqlx = {version = "0.6.2", features = ["runtime-async-std-rustls", "sqlite"], optional = true}

# Blockchain store
sled = {version = "0.34.7", optional = true}

[dev-dependencies]
clap = {version = "4.1.4", features = ["derive"]}
halo2_proofs = {version = "0.2.0", features = ["dev-graph", "gadget-traces", "sanity-checks"]}
halo2_gadgets = {version = "0.2.0", features = ["dev-graph", "test-dependencies"]}
plotters = "0.3.4"
easy-parallel = "3.2.0"

# -----BEGIN LIBRARY FEATURES-----
[features]
async-runtime = [
    "async-std",
    "async-trait",
    "futures",
    "smol",
]

blockchain = [
    "blake3",
    "bs58", # <-- remove after we get rid of json for notifications
    "chrono",
    "dashu",
    "halo2_proofs",
    "lazy_static",
    "rand",
    "sled",
    "sqlx",
    "url",
    "crypto_api_chachapoly",

    "async-runtime",
    "darkfi-sdk",
    "darkfi-serial/crypto",
    "net",
    "rpc",
    "tx",
    "util",
    "wallet",
    "wasm-runtime",
]

dht = [
    "blake3",
    "chrono",
    "rand",

    "async-runtime",
    "darkfi-serial",
    "darkfi-serial/collections",
    "darkfi-serial/hash",
    "net",
]

net = [
    "ed25519-compact",
    "fast-socks5",
    "futures-rustls",
    "hex",
    "iprange",
    "ipnet",
    "structopt",
    "structopt-toml",
    "rand",
    "rcgen",
    "rustls-pemfile",
    "serde",
    "serde_json",
    "socket2",
    "url",

    "async-runtime",
    "darkfi-serial",
    "darkfi-serial/async",
    "darkfi-serial/url",
    "system",
    "util",
]

raft = [
    "chrono",
    "rand",
    "sled",

    "async-runtime",
    "darkfi-serial",
    "net",
    "util",
]

rpc = [
    "hex",
    "rand",
    "serde",
    "serde_json",
    "url",

    "async-runtime",
    "darkfi-serial",
    "net",
]

system = [
    "rand",

    "async-runtime",
]

tx = [
    "blake3",
    "rand",
    
    "async-runtime",
    "darkfi-sdk",
    "darkfi-serial",
    "zk",
]

util = [
    "chrono",
    "simplelog",
    "serde",
    "serde_json",
    "toml",
    "url",

    "darkfi-serial",
]

wallet = [
    "async-std",
    "rand",
    "sqlx",
    "libsqlite3-sys",

    "darkfi-serial",
    "util",
]

wasm-runtime = [
    "wasmer",
    "wasmer-compiler-singlepass",
    "wasmer-middlewares",

    "blockchain",
    "darkfi-sdk",
]

websockets = [
    "async-tungstenite",
]

zk = [
    "halo2_proofs",
    "halo2_gadgets",
    "rand",

    "darkfi-sdk",
    "zkas",
]

zkas = [
    "indexmap",
    "itertools",

    "darkfi-serial",
]
# -----END LIBRARY FEATURES-----

[[example]]
name = "net"
path = "example/net.rs"
required-features = ["async-runtime", "net"]

[[example]]
name = "zk"
path = "example/zk.rs"
required-features = ["zk"]

[[example]]
name = "zk-inclusion-proof"
path = "example/zk-inclusion-proof.rs"
required-features = ["zk"]

