Skip to content

Commit

Permalink
feat: add alloy prelude crate (#203)
Browse files Browse the repository at this point in the history
* feat: add `alloy` prelude crate

* docs

* chore: unused attribute

* update
  • Loading branch information
DaniPopes authored Feb 14, 2024
1 parent a4453d4 commit ff0b65d
Show file tree
Hide file tree
Showing 22 changed files with 373 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
with:
cache-on-failure: true
- name: cargo hack
run: cargo hack check --feature-powerset --depth 2
run: cargo hack check --feature-powerset --depth 1

clippy:
runs-on: ubuntu-latest
Expand Down
53 changes: 27 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,34 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[workspace.dependencies]
alloy-consensus = { version = "0.1.0", path = "crates/consensus" }
alloy-dyn-contract = { version = "0.1.0", path = "crates/dyn-contract" }
alloy-eips = { version = "0.1.0", path = "crates/eips" }
alloy-genesis = { version = "0.1.0", path = "crates/genesis" }
alloy-json-rpc = { version = "0.1.0", path = "crates/json-rpc" }
alloy-network = { version = "0.1.0", path = "crates/network" }
alloy-node-bindings = { version = "0.1.0", path = "crates/node-bindings" }
alloy-providers = { version = "0.1.0", path = "crates/providers" }
alloy-pubsub = { version = "0.1.0", path = "crates/pubsub" }
alloy-rpc-client = { version = "0.1.0", path = "crates/rpc-client" }
alloy-rpc-engine-types = { version = "0.1.0", path = "crates/rpc-engine-types" }
alloy-rpc-trace-types = { version = "0.1.0", path = "crates/rpc-trace-types" }
alloy-rpc-types = { version = "0.1.0", path = "crates/rpc-types" }
alloy-signer = { version = "0.1.0", path = "crates/signer" }
alloy-signer-aws = { version = "0.1.0", path = "crates/signer-aws" }
alloy-signer-gcp = { version = "0.1.0", path = "crates/signer-gcp" }
alloy-signer-ledger = { version = "0.1.0", path = "crates/signer-ledger" }
alloy-signer-trezor = { version = "0.1.0", path = "crates/signer-trezor" }
alloy-transport = { version = "0.1.0", path = "crates/transport" }
alloy-transport-http = { version = "0.1.0", path = "crates/transport-http" }
alloy-transport-ipc = { version = "0.1.0", path = "crates/transport-ipc" }
alloy-transport-ws = { version = "0.1.0", path = "crates/transport-ws" }
alloy-consensus = { version = "0.1.0", default-features = false, path = "crates/consensus" }
alloy-contract = { version = "0.1.0", default-features = false, path = "crates/contract" }
alloy-eips = { version = "0.1.0", default-features = false, path = "crates/eips" }
alloy-genesis = { version = "0.1.0", default-features = false, path = "crates/genesis" }
alloy-json-rpc = { version = "0.1.0", default-features = false, path = "crates/json-rpc" }
alloy-network = { version = "0.1.0", default-features = false, path = "crates/network" }
alloy-node-bindings = { version = "0.1.0", default-features = false, path = "crates/node-bindings" }
alloy-providers = { version = "0.1.0", default-features = false, path = "crates/providers" }
alloy-pubsub = { version = "0.1.0", default-features = false, path = "crates/pubsub" }
alloy-rpc-client = { version = "0.1.0", default-features = false, path = "crates/rpc-client" }
alloy-rpc-engine-types = { version = "0.1.0", default-features = false, path = "crates/rpc-engine-types" }
alloy-rpc-trace-types = { version = "0.1.0", default-features = false, path = "crates/rpc-trace-types" }
alloy-rpc-types = { version = "0.1.0", default-features = false, path = "crates/rpc-types" }
alloy-signer = { version = "0.1.0", default-features = false, path = "crates/signer" }
alloy-signer-aws = { version = "0.1.0", default-features = false, path = "crates/signer-aws" }
alloy-signer-gcp = { version = "0.1.0", default-features = false, path = "crates/signer-gcp" }
alloy-signer-ledger = { version = "0.1.0", default-features = false, path = "crates/signer-ledger" }
alloy-signer-trezor = { version = "0.1.0", default-features = false, path = "crates/signer-trezor" }
alloy-transport = { version = "0.1.0", default-features = false, path = "crates/transport" }
alloy-transport-http = { version = "0.1.0", default-features = false, path = "crates/transport-http" }
alloy-transport-ipc = { version = "0.1.0", default-features = false, path = "crates/transport-ipc" }
alloy-transport-ws = { version = "0.1.0", default-features = false, path = "crates/transport-ws" }

alloy-primitives = "0.6"
alloy-sol-types = "0.6"
alloy-dyn-abi = "0.6"
alloy-json-abi = "0.6"
alloy-core = { version = "0.6", default-features = false, features = ["std"] }
alloy-dyn-abi = { version = "0.6", default-features = false, features = ["std"] }
alloy-json-abi = { version = "0.6", default-features = false, features = ["std"] }
alloy-primitives = { version = "0.6", default-features = false, features = ["std"] }
alloy-sol-types = { version = "0.6", default-features = false, features = ["std"] }

alloy-rlp = "0.3"

Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ feature-parity in Alloy. No action is currently needed from devs.

This repository contains the following crates:

- [`alloy`]: Meta-crate for the entire project, including [`alloy-core`]
- [`alloy-consensus`] - Ethereum consensus interface
- [`alloy-contract`] - Interact with on-chain contracts
- [`alloy-eips`] - Ethereum Improvement Proprosal (EIP) implementations
- [`alloy-genesis`] - Ethereum genesis file definitions
- [`alloy-json-rpc`] - Core data types for JSON-RPC 2.0 clients
- [`alloy-network`] - Network abstraction for RPC types
- [`alloy-node-bindings`] - Ethereum execution-layer client bindings
- [`alloy-providers`] - Client trait for interacting with Ethereum-like RPC endpoints
- [`alloy-pubsub`] - Ethereum JSON-RPC [publish-subscribe] provider
- [`alloy-rpc-client`] - High-level Ethereum JSON-RPC client implementation
- [`alloy-providers`] - Interface with an Ethereum blockchain
- [`alloy-pubsub`] - Ethereum JSON-RPC [publish-subscribe] tower service and type definitions
- [`alloy-rpc-client`] - Low-level Ethereum JSON-RPC client implementation
- [`alloy-rpc-types`] - Ethereum JSON-RPC types
- [`alloy-rpc-engine-types`] - Ethereum execution-consensus layer (engine) API RPC types
- [`alloy-rpc-trace-types`] - Ethereum RPC trace types
Expand All @@ -40,7 +42,9 @@ This repository contains the following crates:
- [`alloy-transport-ipc`] - IPC transport implementation
- [`alloy-transport-ws`] - WS transport implementation

[`alloy`]: crates/alloy
[`alloy-consensus`]: crates/consensus
[`alloy-contract`]: crates/contract
[`alloy-eips`]: crates/eips
[`alloy-genesis`]: crates/genesis
[`alloy-json-rpc`]: crates/json-rpc
Expand All @@ -62,6 +66,7 @@ This repository contains the following crates:
[`alloy-transport-ipc`]: crates/transport-ipc
[`alloy-transport-ws`]: crates/transport-ws

[`alloy-core`]: https://docs.rs/alloy-core
[publish-subscribe]: https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern
[AWS KMS]: https://aws.amazon.com/kms
[GCP KMS]: https://cloud.google.com/kms
Expand Down
131 changes: 131 additions & 0 deletions crates/alloy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
[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

[dependencies]
alloy-core = { workspace = true, default-features = false, features = ["std"] }

alloy-consensus = { workspace = true, default-features = false, optional = true }
alloy-contract = { workspace = true, default-features = false, optional = true }
alloy-eips = { workspace = true, default-features = false, optional = true }
alloy-genesis = { workspace = true, default-features = false, optional = true }
alloy-network = { workspace = true, default-features = false, optional = true }
alloy-node-bindings = { workspace = true, default-features = false, optional = true }
alloy-providers = { workspace = true, default-features = false, optional = true }
alloy-pubsub = { workspace = true, default-features = false, optional = true }

# rpc
alloy-json-rpc = { workspace = true, default-features = false, optional = true }
alloy-rpc-client = { workspace = true, default-features = false, optional = true }
alloy-rpc-engine-types = { workspace = true, default-features = false, optional = true }
alloy-rpc-trace-types = { workspace = true, default-features = false, optional = true }
alloy-rpc-types = { workspace = true, default-features = false, optional = true }

# signer
alloy-signer = { workspace = true, default-features = false, optional = true }
alloy-signer-aws = { workspace = true, default-features = false, optional = true }
alloy-signer-gcp = { workspace = true, default-features = false, optional = true }
alloy-signer-ledger = { workspace = true, default-features = false, optional = true }
alloy-signer-trezor = { workspace = true, default-features = false, optional = true }

# transport
alloy-transport = { workspace = true, default-features = false, optional = true }
alloy-transport-http = { workspace = true, default-features = false, optional = true }
reqwest = { workspace = true, default-features = false, optional = true }
alloy-transport-ipc = { workspace = true, default-features = false, optional = true }
alloy-transport-ws = { workspace = true, default-features = false, optional = true }

[features]
default = ["transport-http-reqwest", "default-tls"]

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

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

postgres = ["alloy-core/postgres"]
getrandom = ["alloy-core/getrandom"]
rand = ["alloy-core/rand"]
rlp = ["alloy-core/rlp"]
serde = ["alloy-core/serde", "alloy-eips?/serde"]
ssz = ["alloy-core/ssz", "alloy-rpc-types?/ssz", "alloy-rpc-engine-types?/ssz"]
arbitrary = [
"alloy-core/arbitrary",
"alloy-consensus?/arbitrary",
"alloy-eips?/arbitrary",
"alloy-rpc-types?/arbitrary",
]
k256 = ["alloy-core/k256", "alloy-consensus?/k256", "alloy-network?/k256"]
eip712 = [
"alloy-core/eip712",
"alloy-signer?/eip712",
"alloy-signer-aws?/eip712",
"alloy-signer-gcp?/eip712",
"alloy-signer-ledger?/eip712",
# TODO: https://github.com/alloy-rs/alloy/issues/201
# "alloy-signer-trezor?/eip712",
]

# alloy
default-tls = ["reqwest?/default-tls"]
jsonrpsee-types = ["alloy-rpc-types?/jsonrpsee-types", "alloy-rpc-engine-types?/jsonrpsee-types"]

consensus = ["dep:alloy-consensus"]
eips = ["dep:alloy-eips"]
network = ["dep:alloy-network"]
genesis = ["dep:alloy-genesis"]
node-bindings = ["dep:alloy-node-bindings"]

contract = ["dep:alloy-contract", "dyn-abi", "json-abi", "json", "sol-types"]

## providers
providers = ["dep:alloy-providers"]
provider-http = ["providers", "transport-http"]
provider-ws = ["providers", "transport-ws"]
provider-ipc = ["providers", "transport-ipc"]

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

## rpc
rpc = []
json-rpc = ["rpc", "dep:alloy-json-rpc"]
rpc-client = ["rpc", "dep:alloy-rpc-client"]
rpc-types = ["rpc"]
rpc-types-eth = ["rpc-types", "dep:alloy-rpc-types"]
rpc-types-engine = ["rpc-types", "dep:alloy-rpc-engine-types"]
rpc-types-trace = ["rpc-types", "dep:alloy-rpc-trace-types"]

## signers
signers = ["dep:alloy-signer"]
### Default signer extensions
signer-keystore = ["signers", "alloy-signer?/keystore"]
signer-mnemonic = ["signers", "alloy-signer?/mnemonic"]
signer-yubihsm = ["signers", "alloy-signer?/yubihsm"]
### Signer implementations
signer-aws = ["signers", "dep:alloy-signer-aws"]
signer-gcp = ["signers", "dep:alloy-signer-gcp"]
signer-ledger = ["signers", "dep:alloy-signer-ledger"]
signer-trezor = ["signers", "dep:alloy-signer-trezor"]

## transports
transports = ["dep:alloy-transport"]
transport-http = ["transports", "dep:alloy-transport-http"]
transport-http-reqwest = ["dep:reqwest", "alloy-transport-http?/reqwest"]
transport-http-hyper = ["alloy-transport-http?/hyper"]
transport-ipc = ["transports", "pubsub", "dep:alloy-transport-ipc"]
transport-ipc-mock = ["alloy-transport-ipc?/mock"]
transport-ws = ["transports", "pubsub", "dep:alloy-transport-ws"]
1 change: 1 addition & 0 deletions crates/alloy/README.md
Loading

0 comments on commit ff0b65d

Please sign in to comment.