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

Combine driver and offer code #131

Merged
merged 2 commits into from
Nov 26, 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
26 changes: 3 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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" }
Expand Down
6 changes: 6 additions & 0 deletions crates/chia-sdk-driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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 }
Expand Down
6 changes: 6 additions & 0 deletions crates/chia-sdk-driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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)]
Expand Down
Original file line number Diff line number Diff line change
@@ -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<T> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
37 changes: 0 additions & 37 deletions crates/chia-sdk-offers/Cargo.toml

This file was deleted.

1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down