[package]
name = "avalanche-types"
version = "0.0.312" # https://crates.io/crates/avalanche-types
edition = "2021"
rust-version = "1.68" # use "rustup override set stable" to overwrite current toolchain
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.67" # for "key::secp256k1" sign trait, https://github.com/dtolnay/async-trait
bech32 = "0.9.1"
blst = "0.3.10" # https://github.com/supranational/blst/tree/master/bindings/rust, for "BLS
bs58 = "0.4.0"
bytes = "1.4.0"
chrono = "0.4.24"
cmp-manager = "0.0.1"
ecdsa = { version = "0.16.1", features = ["rfc6979"] } # https://github.com/RustCrypto/elliptic-curves/tree/master/k256
ethers-core = { version = "=2.0.0", features = ["eip712"] }
hex = "0.4.3"
hmac = "0.12.1"
k256 = { version = "0.13.0", features = ["ecdsa"] } # https://github.com/RustCrypto/elliptic-curves/tree/master/k256
lazy_static = "1.4.0"
log = "0.4.17"
prefix-manager = "0.0.2"
primitive-types = { version = "0.12.1", features = ["impl-serde"] } # https://crates.io/crates/primitive-types
rand = "0.8.5"
ring = "0.16.20"
ripemd = "0.1.3"
rust-embed = "6.6.0" # https://github.com/pyrossh/rust-embed
rustls-pemfile = "1.0.2"
serde = { version = "1.0.158", features = ["derive"] } # https://github.com/serde-rs/serde/releases
serde_json = "1.0.94" # https://github.com/serde-rs/json/releases
serde_with = { version = "2.3.1", features = ["hex"] }
serde_yaml = "0.9.19" # https://github.com/dtolnay/serde-yaml/releases
sha2 = "0.10.6"
sha3 = "0.10.6" # https://github.com/RustCrypto/hashes
spki = "0.7.0" # https://github.com/RustCrypto/formats/tree/master/spki
thiserror = "1.0.40"
zerocopy = "0.6.1"
zeroize = "1.5.7" # for "BLS

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

# [OPTIONAL] for "kms_aws"
aws-manager = { version = "0.24.27", features = ["kms"], optional = true } # https://github.com/gyuho/aws-manager/tags
aws-sdk-kms = { version = "0.24.0", optional = true } # https://crates.io/crates/aws-sdk-kms/versions
aws-smithy-types = { version = "0.54.4", 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.8.2", features = ["pem"], optional = true } # https://crates.io/crates/rsa
rustls = { version = "0.20.8", 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 "evm", "jsonrpc_client"
reqwest = { version = "0.11.15", optional = true } # https://github.com/seanmonstar/reqwest/releases
tokio = { version = "1.26.0", features = ["full"], optional = true } # https://github.com/tokio-rs/tokio/releases

# [OPTIONAL] for "utils"
url = { version = "2.3.1", optional = true }

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

# [OPTIONAL] for "wallet_evm"
ethers = { version = "=2.0.0", features = ["eip712"], optional = true } # https://github.com/gakonst/ethers-rs/releases
ethers-providers = { version = "=2.0.0", optional = true } # https://github.com/gakonst/ethers-rs/releases
ethers-signers = { version = "=2.0.0", optional = true } # https://github.com/gakonst/ethers-rs/releases

# [OPTIONAL] for "subnet"
futures = { version = "0.3.27", optional = true }
http = { version = "0.2.9", optional = true }
hyper = { version = "0.14.25", 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.8", optional = true } # prost-build requires "cmake", https://github.com/tokio-rs/prost/releases
semver = { version = "1.0.17", optional = true }
tokio-stream = { version = "0.1.12", 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.21.0", optional = true } # https://github.com/marshallpierce/rust-base64
num-bigint = { version = "0.4.3", optional = true }

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

[dev-dependencies]
env_logger = "0.10.0"
id-manager = "0.0.3"
random-manager = "0.0.5"
tempfile = "3.4.0"
tokio-stream = { version = "0.1.12", features = ["net"] }
tokio-test = "0.4.2"

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

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

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

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 = "evm_eip712_gsn_domain_separator"
required-features = ["evm"]

[[example]]
name = "evm_eip712_gsn_request_type_hash"
required-features = ["evm"]


[[example]]
name = "evm_contract_abi_calldata"
required-features = ["evm"]


[[example]]
name = "evm_contract_forwarder_get_nonce"
required-features = ["jsonrpc_client", "evm"]


[[example]]
name = "evm_contract_counter_increment"
required-features = ["jsonrpc_client", "evm"]

[[example]]
name = "evm_contract_counter_get_last"
required-features = ["jsonrpc_client", "evm"]

[[example]]
name = "evm_contract_counter_increment_append_calldata"
required-features = ["jsonrpc_client", "evm"]

[[example]]
name = "evm_contract_counter_increment_forwarder_proxy_call"
required-features = ["jsonrpc_client", "evm", "wallet", "wallet_evm"]

[[example]]
name = "evm_contract_counter_increment_forwarder_execute"
required-features = ["jsonrpc_client", "evm", "wallet", "wallet_evm"]

[[example]]
name = "evm_contract_counter_increment_forwarder_relay_eip712"
required-features = ["jsonrpc_client", "evm", "wallet", "wallet_evm"]


[[example]]
name = "evm_contract_voter_vote_a_forwarder_relay_eip712"
required-features = ["jsonrpc_client", "evm", "wallet", "wallet_evm"]


[[example]]
name = "evm_contract_simple_registry_register"
required-features = ["jsonrpc_client", "evm"]

[[example]]
name = "evm_contract_simple_registry_register_forwarder_execute"
required-features = ["jsonrpc_client", "evm", "wallet", "wallet_evm"]

[[example]]
name = "evm_contract_simple_registry_register_forwarder_relay_eip712"
required-features = ["jsonrpc_client", "evm", "wallet", "wallet_evm"]


[[example]]
name = "evm_contract_erc20_simple_token_increase_allowance_forwarder_relay_eip712"
required-features = ["jsonrpc_client", "evm", "wallet", "wallet_evm"]

[[example]]
name = "evm_contract_erc20_simple_token_transfer_from_forwarder_relay_eip712"
required-features = ["jsonrpc_client", "evm", "wallet", "wallet_evm"]


[[example]]
name = "evm_contract_erc721_my_token_mint_forwarder_relay_eip712"
required-features = ["jsonrpc_client", "evm", "wallet", "wallet_evm"]

[[example]]
name = "evm_contract_erc721_my_token_approve_forwarder_relay_eip712"
required-features = ["jsonrpc_client", "evm", "wallet", "wallet_evm"]

[[example]]
name = "evm_contract_erc721_my_token_transfer_from_forwarder_relay_eip712"
required-features = ["jsonrpc_client", "evm", "wallet", "wallet_evm"]


[[example]]
name = "evm_send_raw_transaction_eip1559_hot_key"
required-features = ["jsonrpc_client", "evm"]

[[example]]
name = "evm_send_raw_transaction_eip1559_kms_aws"
required-features = ["jsonrpc_client", "evm", "kms_aws"]


[[example]]
name = "wallet_evm_send_transaction_hot_key"
required-features = ["jsonrpc_client", "wallet", "wallet_evm"]

[[example]]
name = "jsonrpc_client_evm"
required-features = ["jsonrpc_client", "wallet", "wallet_evm"]

[[example]]
name = "jsonrpc_client_info"
required-features = ["jsonrpc_client"]

[[example]]
name = "jsonrpc_client_p"
required-features = ["jsonrpc_client"]

[[example]]
name = "jsonrpc_client_x"
required-features = ["jsonrpc_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"]
