[package]
name = "avalanche-types"
version = "0.0.194" # https://crates.io/crates/avalanche-types
edition = "2021"
rust-version = "1.66"
publish = true
description = "Avalanche primitive types in Rust"
license = "BSD-3-Clause"
homepage = "https://avax.network"
repository = "https://github.com/ava-labs/avalanche-types-rs"
readme = "README.md"

[dependencies]
async-trait = "0.1.60" # for "key::secp256k1" sign trait
bech32 = "0.9.1"
bs58 = "0.4.0"
bytes = "1.3.0"
chrono = "0.4.23"
cmp-manager = "0.0.1"
hex = "0.4.3"
lazy_static = "1.4.0"
log = "0.4.17"
prefix-manager = "0.0.2"
ring = "0.16.20"
rust-embed = "6.4.2"
rustls-pemfile = "1.0.1"
serde = { version = "1.0.152", features = ["derive"] } # https://github.com/serde-rs/serde/releases
serde_json = "1.0.91" # https://github.com/serde-rs/json/releases
serde_with = { version = "2.1.0", features = ["hex"] }
serde_yaml = "0.9.16" # https://github.com/dtolnay/serde-yaml/releases
thiserror = "1.0.38"
zerocopy = "0.6.1"

# for "secp256k1" and "address"
ecdsa = { version = "0.14.8", optional = false }
ethers-core = { version = "1.0.2", optional = false }
hmac = { version = "0.12.1", optional = false }
k256 = { version = "0.11.6", features = ["ecdsa", "keccak256"], optional = false }
primitive-types = { version = "0.12.1", features = ["impl-serde"], optional = false } # https://crates.io/crates/primitive-types
rand = { version = "0.8.5", optional = false }
ripemd = { version = "0.1.3", optional = false }
sha2 = { version = "0.10.6", optional = false }
sha3 = { version = "0.10.6", optional = false }
spki = { version = "0.6.0", optional = false }

# [OPTIONAL] for "libsecp256k1"
secp256k1 = { version = "0.25.0", features = ["global-context", "rand-std", "recovery"], optional = true } # https://crates.io/crates/secp256k1

# [OPTIONAL] for "kms_aws"
aws-manager = { version = "0.22.20", features = ["kms"], optional = true } # https://github.com/gyuho/aws-manager/tags
aws-sdk-kms = { version = "0.22.0", optional = true } # https://crates.io/crates/aws-sdk-kms/versions
aws-smithy-types = { version = "0.52.0", optional = true } # https://github.com/awslabs/smithy-rs/releases

# [OPTIONAL] for "cert"
rcgen = { version = "0.10.0", optional = true } # https://github.com/est31/rcgen
rsa = { version = "0.7.2", features = ["pem"], optional = true } # https://crates.io/crates/rsa
rustls = { version = "0.20.7", optional = true } # https://github.com/rustls/rustls/tags

# [OPTIONAL] for "message"
flate2 = { version = "1.0.25", optional = true }

# [OPTIONAL] for "mnemonic"
bip32 = { version = "0.4.0", optional = true }
rand_core = { version = "0.6.4", features = ["std"], optional = true }

# [OPTIONAL] for "client" and "kms_aws"
ethers = { version = "1.0.2", optional = true }
ethers-providers = { version = "1.0.2", optional = true }
ethers-signers = { version = "1.0.2", optional = true }
http-manager = { version = "0.0.6", optional = true }
tokio = { version = "1.24.0", features = ["full"], optional = true } # https://github.com/tokio-rs/tokio/releases

# [OPTIONAL] for "evm"
rlp = { version = "0.5.2", default-features = false, features = ["std"], optional = true }

# [OPTIONAL] for "subnet"
futures = { version = "0.3.25", optional = true }
http = { version = "0.2.8", optional = true }
hyper = { version = "0.14.23", optional = true }
jsonrpc-core = { version = "18.0.0", optional = true }
jsonrpc-http-server = { version = "18.0.0", optional = true }
num-derive = { version = "0.3.3", optional = true }
num-traits = { version = "0.2.15", optional = true }
prost = { version = "0.11.5", optional = true } # prost-build requires "cmake", https://github.com/tokio-rs/prost/releases
semver = { version = "1.0.16", optional = true }
tokio-stream = { version = "0.1.11", features = ["net"], optional = true }
tonic = { version = "0.8.3", features = ["gzip"], optional = true } # https://github.com/hyperium/tonic/tags
tonic-health = { version = "0.8.0", optional = true }
tonic-reflection = { version = "0.6.0", optional = true }
tower-service = { version = "0.3.2", optional = true }

# [OPTIONAL] for "subnet_metrics"
prometheus = { version = "0.13.3", default_features=false, features = ["process"], optional = true }

# [OPTIONAL] for "codec"
base64 = { version = "0.20.0", optional = true }
num-bigint = { version = "0.4.3", optional = true }

[build-dependencies]
protoc-gen-prost = "0.2.1"
protoc-gen-tonic = "0.2.1"

[dev-dependencies]
env_logger = "0.10.0"
id-manager = "0.0.2"
random-manager = "0.0.2"
tempfile = "3.3.0"
tokio-stream = { version = "0.1.11", features = ["net"]}
tokio-test = "0.4.2"

# Add optional features to docs.
[package.metadata.docs.rs]
features = [ "subnet", "subnet_metrics" ]

[features]
default = [
    # "avalanchego",
    # "cert",
    # "client",
    # "codec_base64",
    # "codec_big_int",
    # "evm",
    # "kms_aws",
    # "libsecp256k1",
    # "message",
    # "mnemonic",
    # "proto",
    # "subnet",
    # "subnet_metrics",
    # "subnet_evm",
    # "xsvm",
]

avalanchego = []
cert = ["rcgen", "rsa", "rustls"]
client = ["http-manager", "ethers", "ethers-providers", "ethers-signers", "tokio"]
codec_base64 = ["base64"]
codec_big_int = ["num-bigint"]
evm = ["rlp"]
kms_aws = ["aws-manager", "aws-sdk-kms", "aws-smithy-types", "ethers-signers"]
libsecp256k1 = ["secp256k1"]
mnemonic = ["bip32", "rand_core"]
subnet_evm = []
xsvm = []

proto = [
    "prost",
    "tonic",
]
message = [
    "flate2",
    "proto",
]
subnet = [
    "futures",
    "http",
    "hyper",
    "jsonrpc-core",
    "num-derive",
    "num-traits",
    "prost",
    "semver",
    "tokio",
    "tokio-stream",
    "tonic",
    "tonic-health",
    "tonic-reflection",
    "tower-service",
    "proto",
]

subnet_metrics = [
    "prometheus",
    "subnet"
]

[[example]]
name = "client_evm"
required-features = ["client", "evm"]

[[example]]
name = "client_evm_send_raw_transaction_hot_key"
required-features = ["client", "evm"]

[[example]]
name = "client_evm_send_raw_transaction_kms_aws"
required-features = ["client", "evm", "kms_aws"]

[[example]]
name = "client_evm_send_transaction_hot_key"
required-features = ["client", "evm"]

[[example]]
name = "client_info"
required-features = ["client"]

[[example]]
name = "client_p"
required-features = ["client"]

[[example]]
name = "client_x"
required-features = ["client"]

[[example]]
name = "key_cert"
required-features = ["cert"]

[[example]]
name = "key_secp256k1_kms_aws"
required-features = ["kms_aws"]

[[example]]
name = "key_secp256k1_mnemonic_derive_load"
required-features = ["mnemonic"]

[[example]]
name = "proto_client"
required-features = ["proto", "subnet"]

[[example]]
name = "proto_server"
required-features = ["proto", "subnet"]

[[test]]
name = "integration"
path = "tests/integration_tests.rs"
required-features = ["subnet"]

[lib]
doctest = false

[package.metadata.cargo-udeps.ignore]
build = ["protoc-gen-prost", "protoc-gen-tonic"]
development = ["id-manager", "tokio-test", "tonic-reflection", "tempfile"]
normal = ["rsa", "rustls-pemfile"]
