Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(alloy): re-export alloy-core items individually #230

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ alloy-transport-http = { version = "0.1.0", default-features = false, path = "cr
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-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-core = { version = "0.6.3", default-features = false, features = ["std"] }
alloy-dyn-abi = { version = "0.6.3", default-features = false, features = ["std"] }
alloy-json-abi = { version = "0.6.3", default-features = false, features = ["std"] }
alloy-primitives = { version = "0.6.3", default-features = false, features = ["std"] }
alloy-sol-types = { version = "0.6.3", default-features = false, features = ["std"] }

alloy-rlp = "0.3"

Expand Down Expand Up @@ -99,6 +99,7 @@ serial_test = "3.0"
similar-asserts = "1.5"
tempfile = "3.8"

# TODO: Remove once alloy-contract is stable. This is only used in tests for `sol!`.
[patch.crates-io]
alloy-sol-macro = { git = "https://github.com/alloy-rs/core", rev = "18b0509950c90d9ec38f25913b692ae4cdd6f227" }
# TODO: Keep around until alloy-contract is stable.
# This should only be used in `alloy-contract` tests.
# [patch.crates-io]
# alloy-sol-macro = { git = "https://github.com/alloy-rs/core", rev = "18b0509950c90d9ec38f25913b692ae4cdd6f227" }
Comment on lines +102 to +105
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be commented?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, currently there are no changes but it should be re enabled for testing with network changes

68 changes: 49 additions & 19 deletions crates/alloy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,56 @@
#[cfg(feature = "transport-http-reqwest")]
use reqwest as _;

/* --------------------------------------- Core re-exports -------------------------------------- */

// Re-export the core crate.
// This should generally not be used by downstream crates as we re-export everything else
// individually.
// It is acceptable to use this if an item has been added to `alloy-core` and it has not been added
// to the re-exports below.
#[doc(hidden)]
pub use alloy_core as core;

#[doc(inline)]
pub use self::core::primitives;
#[doc(no_inline)]
pub use primitives::{hex, uint};

#[cfg(feature = "dyn-abi")]
#[doc(inline)]
pub use self::core::dyn_abi;

#[cfg(feature = "json-abi")]
#[doc(inline)]
pub use self::core::json_abi;

#[cfg(feature = "sol-types")]
#[doc(inline)]
pub use self::core::sol_types;
#[cfg(all(doc, feature = "sol-types"))] // Show this re-export in docs instead of the wrapper below.
#[doc(no_inline)]
pub use sol_types::sol;

#[cfg(feature = "rlp")]
#[doc(inline)]
pub use alloy_core::*;
pub use self::core::rlp;

/// [`sol!`](sol_types::sol!) macro wrapper to route imports to the correct crate.
///
/// See [`sol!`](sol_types::sol!) for the actual macro documentation.
#[cfg(all(not(doc), feature = "sol-types"))] // Show the actual macro in docs.
#[doc(hidden)]
#[macro_export]
macro_rules! sol {
($($t:tt)*) => {
$crate::sol_types::sol! {
#![sol(alloy_sol_types = $crate::sol_types, alloy_contract = $crate::contract)]
$($t)*
}
};
}

/* --------------------------------------- Main re-exports -------------------------------------- */

#[cfg(feature = "contract")]
#[doc(inline)]
Expand Down Expand Up @@ -158,21 +206,3 @@ pub mod pubsub {
#[doc(inline)]
pub use alloy_pubsub::*;
}

// TODO: Enable on next alloy-core release.
/*
/// [`sol!`](sol_types::sol!) macro wrapper to route imports to the correct crate.
///
/// See [`sol!`](sol_types::sol!) for the actual macro documentation.
#[cfg(all(not(doc), feature = "sol-types"))]
#[doc(hidden)]
#[macro_export]
macro_rules! sol {
($($t:tt)*) => {
$crate::sol_types::sol! {
#![sol(alloy_sol_types = $crate::sol_types, alloy_contract = $crate::contract)]
$($t)*
}
};
}
*/
Loading