diff --git a/Cargo.lock b/Cargo.lock index 57366eb4..eca090af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -449,6 +449,7 @@ name = "chia-sdk-driver" version = "0.19.1" dependencies = [ "anyhow", + "bech32", "bigdecimal", "chia-bls 0.15.0", "chia-consensus", @@ -457,28 +458,6 @@ dependencies = [ "chia-sdk-signer", "chia-sdk-test", "chia-sdk-types", - "clvm-traits", - "clvm-utils", - "clvmr", - "hex", - "hex-literal", - "num-bigint", - "rstest", - "thiserror", -] - -[[package]] -name = "chia-sdk-offers" -version = "0.19.1" -dependencies = [ - "anyhow", - "bech32", - "chia-bls 0.15.0", - "chia-protocol", - "chia-puzzles", - "chia-sdk-driver", - "chia-sdk-test", - "chia-sdk-types", "chia-traits 0.15.0", "clvm-traits", "clvm-utils", @@ -487,7 +466,9 @@ dependencies = [ "hex", "hex-literal", "indexmap", + "num-bigint", "once_cell", + "rstest", "thiserror", ] @@ -623,7 +604,6 @@ dependencies = [ "chia-puzzles", "chia-sdk-client", "chia-sdk-driver", - "chia-sdk-offers", "chia-sdk-signer", "chia-sdk-test", "chia-sdk-types", diff --git a/Cargo.toml b/Cargo.toml index df6601f2..8905ffd9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,13 +62,13 @@ workspace = true [features] chip-0035 = ["chia-sdk-driver/chip-0035"] +offers = ["chia-sdk-driver/offers"] native-tls = ["chia-sdk-client/native-tls"] rustls = ["chia-sdk-client/rustls"] [dependencies] chia-sdk-client = { workspace = true } chia-sdk-driver = { workspace = true } -chia-sdk-offers = { workspace = true } chia-sdk-signer = { workspace = true } chia-sdk-test = { workspace = true } chia-sdk-types = { workspace = true } @@ -89,7 +89,6 @@ chia-wallet-sdk = { version = "0.19.1", path = "." } chia-sdk-client = { version = "0.19.1", path = "./crates/chia-sdk-client" } chia-sdk-derive = { version = "0.19.1", path = "./crates/chia-sdk-derive" } chia-sdk-driver = { version = "0.19.1", path = "./crates/chia-sdk-driver" } -chia-sdk-offers = { version = "0.19.1", path = "./crates/chia-sdk-offers" } chia-sdk-signer = { version = "0.19.1", path = "./crates/chia-sdk-signer" } chia-sdk-test = { version = "0.19.1", path = "./crates/chia-sdk-test" } chia-sdk-types = { version = "0.19.1", path = "./crates/chia-sdk-types" } diff --git a/crates/chia-sdk-driver/Cargo.toml b/crates/chia-sdk-driver/Cargo.toml index 02cffc0c..47851925 100644 --- a/crates/chia-sdk-driver/Cargo.toml +++ b/crates/chia-sdk-driver/Cargo.toml @@ -19,6 +19,7 @@ workspace = true [features] chip-0035 = [] +offers = ["dep:bech32", "dep:chia-traits", "dep:flate2", "dep:indexmap", "dep:once_cell"] [dependencies] chia-bls = { workspace = true } @@ -33,6 +34,11 @@ hex-literal = { workspace = true } num-bigint = { workspace = true} hex = { workspace = true } bigdecimal = { workspace = true } +bech32 = { workspace = true, optional = true } +chia-traits = { workspace = true, optional = true } +flate2 = { workspace = true, features = ["zlib-ng-compat"], optional = true } +indexmap = { workspace = true, optional = true } +once_cell = { workspace = true, optional = true } [dev-dependencies] chia-sdk-test = { workspace = true } diff --git a/crates/chia-sdk-driver/src/lib.rs b/crates/chia-sdk-driver/src/lib.rs index ed35b73a..6a360974 100644 --- a/crates/chia-sdk-driver/src/lib.rs +++ b/crates/chia-sdk-driver/src/lib.rs @@ -21,3 +21,9 @@ pub use puzzle::*; pub use spend::*; pub use spend_context::*; pub use spend_with_conditions::*; + +#[cfg(feature = "offers")] +mod offers; + +#[cfg(feature = "offers")] +pub use offers::*; diff --git a/crates/chia-sdk-offers/src/lib.rs b/crates/chia-sdk-driver/src/offers.rs similarity index 100% rename from crates/chia-sdk-offers/src/lib.rs rename to crates/chia-sdk-driver/src/offers.rs diff --git a/crates/chia-sdk-offers/src/compress.rs b/crates/chia-sdk-driver/src/offers/compress.rs similarity index 95% rename from crates/chia-sdk-offers/src/compress.rs rename to crates/chia-sdk-driver/src/offers/compress.rs index 14d0c17d..4d461e90 100644 --- a/crates/chia-sdk-offers/src/compress.rs +++ b/crates/chia-sdk-driver/src/offers/compress.rs @@ -108,6 +108,6 @@ mod tests { SpendBundle::from_bytes(&decompressed_offer).unwrap(); } - const COMPRESSED_OFFER: &str = include_str!("../test_data/compressed.offer"); - const DECOMPRESSED_OFFER: &str = include_str!("../test_data/decompressed.offer"); + const COMPRESSED_OFFER: &str = include_str!("./test_data/compressed.offer"); + const DECOMPRESSED_OFFER: &str = include_str!("./test_data/decompressed.offer"); } diff --git a/crates/chia-sdk-offers/src/encode.rs b/crates/chia-sdk-driver/src/offers/encode.rs similarity index 100% rename from crates/chia-sdk-offers/src/encode.rs rename to crates/chia-sdk-driver/src/offers/encode.rs diff --git a/crates/chia-sdk-offers/src/error.rs b/crates/chia-sdk-driver/src/offers/error.rs similarity index 100% rename from crates/chia-sdk-offers/src/error.rs rename to crates/chia-sdk-driver/src/offers/error.rs diff --git a/crates/chia-sdk-offers/src/offer.rs b/crates/chia-sdk-driver/src/offers/offer.rs similarity index 97% rename from crates/chia-sdk-offers/src/offer.rs rename to crates/chia-sdk-driver/src/offers/offer.rs index bfe9a0db..5bf46fad 100644 --- a/crates/chia-sdk-offers/src/offer.rs +++ b/crates/chia-sdk-driver/src/offers/offer.rs @@ -1,6 +1,5 @@ use chia_protocol::{Bytes32, SpendBundle}; use chia_puzzles::offer::SettlementPaymentsSolution; -use chia_sdk_driver::Puzzle; use chia_traits::Streamable; use clvm_traits::{FromClvm, ToClvm}; use clvm_utils::{tree_hash, ToTreeHash}; @@ -9,7 +8,7 @@ use indexmap::IndexMap; use crate::{ compress_offer_bytes, decode_offer_data, decompress_offer_bytes, encode_offer_data, Make, - OfferBuilder, OfferError, ParsedOffer, Take, + OfferBuilder, OfferError, ParsedOffer, Puzzle, Take, }; #[derive(Debug, Clone)] diff --git a/crates/chia-sdk-offers/src/offer_builder.rs b/crates/chia-sdk-driver/src/offers/offer_builder.rs similarity index 98% rename from crates/chia-sdk-offers/src/offer_builder.rs rename to crates/chia-sdk-driver/src/offers/offer_builder.rs index 39433316..0e5ec812 100644 --- a/crates/chia-sdk-offers/src/offer_builder.rs +++ b/crates/chia-sdk-driver/src/offers/offer_builder.rs @@ -1,13 +1,12 @@ use chia_protocol::{Bytes32, Coin, CoinSpend, SpendBundle}; use chia_puzzles::offer::{NotarizedPayment, Payment, SettlementPaymentsSolution}; -use chia_sdk_driver::{DriverError, Puzzle, SpendContext}; use chia_sdk_types::{announcement_id, AssertPuzzleAnnouncement}; use clvm_traits::ToClvm; use clvm_utils::tree_hash; use clvmr::Allocator; use indexmap::IndexMap; -use crate::{Offer, ParsedOffer}; +use crate::{DriverError, Offer, ParsedOffer, Puzzle, SpendContext}; #[derive(Debug, Clone)] pub struct OfferBuilder { diff --git a/crates/chia-sdk-offers/src/parsed_offer.rs b/crates/chia-sdk-driver/src/offers/parsed_offer.rs similarity index 88% rename from crates/chia-sdk-offers/src/parsed_offer.rs rename to crates/chia-sdk-driver/src/offers/parsed_offer.rs index ace33dc9..4f5aff99 100644 --- a/crates/chia-sdk-offers/src/parsed_offer.rs +++ b/crates/chia-sdk-driver/src/offers/parsed_offer.rs @@ -1,10 +1,9 @@ use chia_bls::Signature; use chia_protocol::{Bytes32, CoinSpend}; use chia_puzzles::offer::NotarizedPayment; -use chia_sdk_driver::Puzzle; use indexmap::IndexMap; -use crate::{OfferBuilder, Take}; +use crate::{OfferBuilder, Puzzle, Take}; #[derive(Debug, Default, Clone)] pub struct ParsedOffer { diff --git a/crates/chia-sdk-offers/test_data/compressed.offer b/crates/chia-sdk-driver/src/offers/test_data/compressed.offer similarity index 100% rename from crates/chia-sdk-offers/test_data/compressed.offer rename to crates/chia-sdk-driver/src/offers/test_data/compressed.offer diff --git a/crates/chia-sdk-offers/test_data/decompressed.offer b/crates/chia-sdk-driver/src/offers/test_data/decompressed.offer similarity index 100% rename from crates/chia-sdk-offers/test_data/decompressed.offer rename to crates/chia-sdk-driver/src/offers/test_data/decompressed.offer diff --git a/crates/chia-sdk-offers/tests/nft_for_nft.rs b/crates/chia-sdk-driver/src/offers/tests/nft_for_nft.rs similarity index 100% rename from crates/chia-sdk-offers/tests/nft_for_nft.rs rename to crates/chia-sdk-driver/src/offers/tests/nft_for_nft.rs diff --git a/crates/chia-sdk-offers/tests/nft_for_xch.rs b/crates/chia-sdk-driver/src/offers/tests/nft_for_xch.rs similarity index 100% rename from crates/chia-sdk-offers/tests/nft_for_xch.rs rename to crates/chia-sdk-driver/src/offers/tests/nft_for_xch.rs diff --git a/crates/chia-sdk-offers/Cargo.toml b/crates/chia-sdk-offers/Cargo.toml deleted file mode 100644 index 734d90e3..00000000 --- a/crates/chia-sdk-offers/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -name = "chia-sdk-offers" -version = "0.19.1" -edition = "2021" -license = "Apache-2.0" -description = "Implements Chia offer file creation and acceptance." -authors = ["Brandon Haggstrom "] -homepage = "https://github.com/Rigidity/chia-wallet-sdk" -repository = "https://github.com/Rigidity/chia-wallet-sdk" -readme = { workspace = true } -keywords = { workspace = true } -categories = { workspace = true } - -[lints] -workspace = true - -[dependencies] -bech32 = { workspace = true } -thiserror = { workspace = true } -chia-protocol = { workspace = true } -chia-puzzles = { workspace = true } -chia-traits = { workspace = true } -chia-bls = { workspace = true } -clvm-traits = { workspace = true } -clvm-utils = { workspace = true } -clvmr = { workspace = true } -flate2 = { workspace = true, features = ["zlib-ng-compat"] } -indexmap = { workspace = true } -chia-sdk-driver = { workspace = true } -chia-sdk-types = { workspace = true } -once_cell = { workspace = true } - -[dev-dependencies] -hex-literal = { workspace = true } -hex = { workspace = true } -anyhow = { workspace = true } -chia-sdk-test = { path = "../chia-sdk-test" } diff --git a/src/lib.rs b/src/lib.rs index 0e3247e9..53510c38 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,6 @@ pub use chia_sdk_client::*; pub use chia_sdk_driver::*; -pub use chia_sdk_offers::*; pub use chia_sdk_signer::*; pub use chia_sdk_test::*; pub use chia_sdk_types::*;