[package]
name = "alloy"
description = "Connect applications to blockchains"

version.workspace = true
edition.workspace = true
rust-version.workspace = true
authors.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
exclude.workspace = true

[package.metadata.docs.rs]
all-features = true
rustdoc-args = [
    "-Zunstable-options",
    "--generate-link-to-definition",
    "--show-type-layout",
]

[lints]
workspace = true

[dependencies]
# core
alloy-core.workspace = true

# alloy
alloy-consensus = { workspace = true, optional = true }
alloy-contract = { workspace = true, optional = true }
alloy-eips = { workspace = true, optional = true }
alloy-ens = { workspace = true, optional = true, features = ["contract", "provider"] }
alloy-genesis = { workspace = true, optional = true }
alloy-network = { workspace = true, optional = true }
alloy-node-bindings = { workspace = true, optional = true }

# providers
alloy-provider = { workspace = true, optional = true }

# pubsub
alloy-pubsub = { workspace = true, optional = true }

# rpc
alloy-json-rpc = { workspace = true, optional = true }
alloy-rpc-client = { workspace = true, optional = true }
alloy-rpc-types = { workspace = true, optional = true }

# serde
alloy-serde = { workspace = true, optional = true }

# signer
alloy-signer = { workspace = true, optional = true }
alloy-signer-aws = { workspace = true, optional = true }
alloy-signer-gcp = { workspace = true, optional = true }
alloy-signer-ledger = { workspace = true, optional = true }
alloy-signer-local = { workspace = true, optional = true }
alloy-signer-trezor = { workspace = true, optional = true }
alloy-signer-turnkey = { workspace = true, optional = true }

# transport
alloy-transport = { workspace = true, optional = true }
alloy-transport-http = { workspace = true, optional = true }
alloy-transport-ipc = { workspace = true, optional = true }
alloy-transport-ws = { workspace = true, optional = true }

# trie
alloy-trie = { workspace = true, optional = true }

# ----------------------------------------- Configuration ---------------------------------------- #

[features]
default = [
    "std",
    "reqwest",
    "reqwest-rustls-tls",
    "alloy-core/default",
    "essentials",
]

# std
std = [
    "alloy-core/std",
    "alloy-eips?/std",
    "alloy-genesis?/std",
    "alloy-serde?/std",
    "alloy-consensus?/std",
    "alloy-trie?/std",
]

# essential features that enable basic network interactions out of the box.
essentials = ["contract", "provider-http", "rpc-types", "signer-local"]

# full
full = [
    "consensus",
    "eips",
    "essentials",
    "k256",
    "kzg",
    "network",
    "provider-ws",
    "provider-ipc",
    "provider-trace-api",
    "provider-txpool-api",
    "provider-debug-api",
    "provider-anvil-api",
    "pubsub",
    "rlp",
]

# configuration
reqwest = [
    "alloy-rpc-client?/reqwest",
    "alloy-provider?/reqwest",
    "alloy-transport-http?/reqwest",
]
reqwest-default-tls = [
    "alloy-rpc-client?/reqwest",
    "alloy-provider?/reqwest",
    "alloy-transport-http?/reqwest",
    "alloy-transport-http?/reqwest-default-tls",
]
reqwest-rustls-tls = [
    "alloy-rpc-client?/reqwest",
    "alloy-provider?/reqwest",
    "alloy-transport-http?/reqwest",
    "alloy-transport-http?/reqwest-rustls-tls",
]
reqwest-native-tls = [
    "alloy-rpc-client?/reqwest",
    "alloy-provider?/reqwest",
    "alloy-transport-http?/reqwest",
    "alloy-transport-http?/reqwest-native-tls",
]
hyper = [
    "alloy-rpc-client?/hyper",
    "alloy-provider?/hyper",
    "alloy-transport-http?/hyper",
]
wasm-bindgen = ["alloy-transport?/wasm-bindgen"]

# ---------------------------------------- Main re-exports --------------------------------------- #

# general
contract = [
    "dep:alloy-contract",
    "providers",
    "dyn-abi",
    "json-abi",
    "json",
    "sol-types",
]
eips = ["dep:alloy-eips", "rlp"]
ens = ["dep:alloy-ens"]
genesis = ["dep:alloy-genesis"]
network = ["dep:alloy-network"]
node-bindings = ["dep:alloy-node-bindings", "alloy-provider?/anvil-node"]

# consensus
consensus = ["dep:alloy-consensus", "rlp"]
consensus-secp256k1 = ["consensus", "alloy-consensus?/secp256k1"]

# providers
providers = [
    "dep:alloy-provider",
    "rpc-client",
    "transports",
    "eips",
    "consensus",
    "network",
]
provider-http = ["providers", "transport-http"]
provider-ws = ["providers", "alloy-provider?/ws", "transport-ws"]
provider-ipc = ["providers", "alloy-provider?/ipc", "transport-ipc"]
provider-admin-api = [
    "providers",
    "alloy-provider?/admin-api",
    "rpc-types-admin",
]
provider-anvil-api = [
    "providers",
    "alloy-provider?/anvil-api",
    "rpc-types-anvil",
]
provider-debug-api = [
    "providers",
    "alloy-provider?/debug-api",
    "rpc-types-debug",
    "rpc-types-trace",
]
provider-engine-api = [
    "providers",
    "alloy-provider?/engine-api",
    "rpc-types-engine",
]
provider-mev-api = ["providers", "alloy-provider?/mev-api", "rpc-types-mev"]
provider-net-api = ["providers", "alloy-provider?/net-api"]
provider-trace-api = [
    "providers",
    "alloy-provider?/trace-api",
    "rpc-types-trace",
]
provider-txpool-api = [
    "providers",
    "alloy-provider?/txpool-api",
    "rpc-types-txpool",
]
provider-anvil-node = [
    "providers",
    "provider-anvil-api",
    "alloy-provider?/anvil-node",
    "node-bindings",
]

# pubsub
pubsub = [
    "dep:alloy-pubsub",
    "alloy-contract?/pubsub",
    "alloy-provider?/pubsub",
    "alloy-rpc-client?/pubsub",
]

# rpc
rpc = []
json-rpc = ["rpc", "dep:alloy-json-rpc"]
rpc-client = ["rpc", "transports", "transport-http", "dep:alloy-rpc-client"]
rpc-client-ws = ["rpc-client", "transport-ws", "alloy-rpc-client?/ws"]
rpc-client-ipc = ["rpc-client", "transport-ipc", "alloy-rpc-client?/ipc"]
rpc-types = ["rpc", "serde", "dep:alloy-rpc-types", "alloy-rpc-types?/eth"]
rpc-types-admin = [
    "rpc-types",
    "alloy-rpc-types?/admin",
    "alloy-provider?/admin-api",
]
rpc-types-anvil = [
    "rpc-types",
    "alloy-rpc-types?/anvil",
    "alloy-provider?/anvil-api",
]
rpc-types-any = ["rpc-types", "alloy-rpc-types?/any"]
rpc-types-beacon = ["rpc-types", "alloy-rpc-types?/beacon"]
rpc-types-debug = [
    "rpc-types",
    "alloy-rpc-types?/debug",
    "alloy-provider?/debug-api",
]
rpc-types-engine = [
    "rpc-types",
    "alloy-rpc-types?/engine",
    "alloy-provider?/engine-api",
]
rpc-types-eth = ["rpc-types", "alloy-rpc-types?/eth"]
rpc-types-mev = ["rpc-types", "alloy-rpc-types?/mev"]
rpc-types-trace = [
    "rpc-types",
    "alloy-rpc-types?/trace",
    "alloy-provider?/trace-api",
]
rpc-types-txpool = [
    "rpc-types",
    "alloy-rpc-types?/txpool",
    "alloy-provider?/txpool-api",
]

# signers
signers = ["dep:alloy-signer"]
signer-aws = ["signers", "dep:alloy-signer-aws"]
signer-gcp = ["signers", "dep:alloy-signer-gcp"]
signer-ledger = ["signers", "dep:alloy-signer-ledger"]
signer-ledger-browser = ["signer-ledger", "alloy-signer-ledger?/browser"]
signer-ledger-node = ["signer-ledger", "alloy-signer-ledger?/node"]
signer-local = ["signers", "dep:alloy-signer-local"]
signer-trezor = ["signers", "dep:alloy-signer-trezor"]
signer-turnkey = ["signers", "dep:alloy-signer-turnkey"]
signer-keystore = ["signer-local", "alloy-signer-local?/keystore"]
signer-keystore-geth-compat = [
    "signer-local",
    "alloy-signer-local?/keystore-geth-compat",
]
signer-mnemonic = ["signer-local", "alloy-signer-local?/mnemonic"]
signer-mnemonic-all-languages = [
    "signer-mnemonic",
    "alloy-signer-local?/mnemonic-all-languages",
]
signer-yubihsm = ["signer-local", "alloy-signer-local?/yubihsm"]
secp256k1 = [
	"alloy-consensus?/secp256k1",
	"alloy-signer-local?/secp256k1"
]
# transports
transports = ["dep:alloy-transport"]
transport-http = ["transports", "dep:alloy-transport-http"]
transport-ipc = ["transports", "pubsub", "dep:alloy-transport-ipc"]
transport-ipc-mock = ["alloy-transport-ipc?/mock"]
transport-ws = ["transports", "pubsub", "dep:alloy-transport-ws"]
transport-throttle = ["transports", "alloy-transport?/throttle"]

# trie
trie = ["dep:alloy-trie"]

# ---------------------------------------- Core re-exports --------------------------------------- #

dyn-abi = ["alloy-core/dyn-abi"]
json-abi = ["alloy-core/json-abi"]
json = ["alloy-core/json"]
sol-types = ["alloy-core/sol-types"]

asm-keccak = ["alloy-core/asm-keccak"]
native-keccak = ["alloy-core/native-keccak"]
sha3-keccak = ["alloy-core/sha3-keccak"]
tiny-keccak = ["alloy-core/tiny-keccak"]

map = ["alloy-core/map"]
map-hashbrown = ["alloy-core/map-hashbrown"]
map-indexmap = ["alloy-core/map-indexmap"]
map-fxhash = ["alloy-core/map-fxhash"]

getrandom = ["alloy-core/getrandom"]
rand = ["alloy-core/rand"]
rlp = ["alloy-core/rlp"]
serde = [
    "alloy-core/serde",
    "alloy-eips?/serde",
    "alloy-consensus?/serde",
    "dep:alloy-serde",
    "alloy-trie?/serde",
]
serde-bincode-compat = ["alloy-consensus/serde-bincode-compat"]
ssz = ["alloy-rpc-types?/ssz", "alloy-eips?/ssz"]
k256 = [
    "alloy-core/k256",
    "alloy-consensus?/k256",
    "alloy-network?/k256",
    "alloy-rpc-types?/k256",
    "alloy-eips?/k256",
]
kzg = ["alloy-consensus?/kzg", "alloy-rpc-types?/kzg"]
eip712 = [
    "alloy-core/eip712",
    "alloy-signer?/eip712",
    "alloy-signer-aws?/eip712",
    "alloy-signer-gcp?/eip712",
    "alloy-signer-ledger?/eip712",
    "alloy-signer-local?/eip712",
    "alloy-signer-turnkey?/eip712",
    # TODO: https://github.com/alloy-rs/alloy/issues/201
    # "alloy-signer-trezor?/eip712",
]
more-tuple-impls = ["alloy-core/more-tuple-impls"]

arbitrary = [
    "alloy-core/arbitrary",
    "alloy-consensus?/arbitrary",
    "alloy-eips?/arbitrary",
    "alloy-rpc-types?/arbitrary",
    "alloy-serde?/arbitrary",
    "alloy-trie?/arbitrary",
]
postgres = ["alloy-core/postgres"]
