Skip to content

Commit 97871ec

Browse files
authored
Protocol Separation (#723)
1 parent cc64f68 commit 97871ec

File tree

159 files changed

+5770
-5603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+5770
-5603
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* Remove `BackupService` and `BackupStore` since it's unused
1212
* Remove file-based `FileUpload` - we use surreal/nostr-based everywhere
1313
* Refactoring & Restructuring, removing cross-crate exports (breaking for Library dependents)
14+
* Properly separate `protocol` parts from `application` in `bcr-ebill-core` (breaking for Library dependents, breaking DB change)
1415

1516
# 0.4.12
1617

crates/bcr-ebill-api/src/external/bitcoin.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
use crate::get_config;
22
use async_trait::async_trait;
33
use bcr_ebill_core::{
4-
BitcoinAddress, PublicKey, ServiceTraitBounds,
5-
bill::{InMempoolData, PaidData, PaymentState},
6-
sum::Sum,
7-
timestamp::Timestamp,
4+
application::ServiceTraitBounds,
5+
application::bill::{InMempoolData, PaidData, PaymentState},
6+
protocol::BitcoinAddress,
7+
protocol::PublicKey,
8+
protocol::Sum,
9+
protocol::Timestamp,
810
};
911
use bitcoin::{Network, secp256k1::Scalar};
1012
use log::debug;

crates/bcr-ebill-api/src/external/court.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use async_trait::async_trait;
22
use bcr_ebill_core::{
3-
ServiceTraitBounds, blockchain::bill::BillToShareWithExternalParty, util::BcrKeys,
3+
application::ServiceTraitBounds, protocol::blockchain::bill::BillToShareWithExternalParty,
4+
protocol::crypto::BcrKeys,
45
};
56
use bitcoin::hashes::{Hash, sha256::Hash as Sha256};
67
use borsh::to_vec;
@@ -33,8 +34,8 @@ use mockall::automock;
3334
pub struct ReceiveBillRequest {
3435
pub content: BillToShareWithExternalParty,
3536
#[borsh(
36-
serialize_with = "bcr_ebill_core::util::borsh::serialize_pubkey",
37-
deserialize_with = "bcr_ebill_core::util::borsh::deserialize_pubkey"
37+
serialize_with = "bcr_ebill_core::protocol::serialization::serialize_pubkey",
38+
deserialize_with = "bcr_ebill_core::protocol::serialization::deserialize_pubkey"
3839
)]
3940
pub public_key: PublicKey,
4041
}

crates/bcr-ebill-api/src/external/email.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use async_trait::async_trait;
22
use bcr_common::core::{BillId, NodeId};
3-
use bcr_ebill_core::email::Email;
4-
use bcr_ebill_core::{ServiceTraitBounds, notification::BillEventType};
3+
use bcr_ebill_core::application::ServiceTraitBounds;
4+
use bcr_ebill_core::protocol::{Email, event::bill_events::BillEventType};
55
use borsh_derive::BorshSerialize;
66
use nostr::hashes::Hash;
77
use nostr::util::SECP256K1;

crates/bcr-ebill-api/src/external/file_storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::io::Write;
22

33
use async_trait::async_trait;
4-
use bcr_ebill_core::ServiceTraitBounds;
4+
use bcr_ebill_core::application::ServiceTraitBounds;
55
use nostr::hashes::{
66
Hash,
77
sha256::{self, Hash as Sha256HexHash},

crates/bcr-ebill-api/src/external/identity_proof.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use async_trait::async_trait;
22
use bcr_ebill_core::{
3-
ServiceTraitBounds, ValidationError,
4-
identity_proof::{IdentityProofStamp, IdentityProofStatus},
5-
util::crypto,
3+
application::ServiceTraitBounds, application::ValidationError,
4+
application::identity_proof::IdentityProofStatus, protocol::IdentityProofStamp,
5+
protocol::crypto,
66
};
77
use borsh_derive::BorshSerialize;
88
use log::error;
@@ -176,7 +176,7 @@ fn create_proxy_req(
176176
pub mod tests {
177177
use std::str::FromStr;
178178

179-
use bcr_ebill_core::util::BcrKeys;
179+
use bcr_ebill_core::protocol::crypto::BcrKeys;
180180
use bitcoin::XOnlyPublicKey;
181181
use nostr::key::SecretKey;
182182
use secp256k1::schnorr::Signature;
@@ -226,7 +226,6 @@ pub mod tests {
226226
let node_id = node_id_test();
227227
let relay_url = url::Url::parse("wss://bcr-relay-dev.minibill.tech").unwrap();
228228
let private_key = BcrKeys::from_private_key(&private_key_test())
229-
.unwrap()
230229
.get_nostr_keys()
231230
.secret_key()
232231
.to_owned();

crates/bcr-ebill-api/src/external/mint.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use bcr_common::client::keys::Client as KeysClient;
55
use bcr_common::client::quote::Client as QuoteClient;
66
use bcr_common::client::swap::Client as SwapClient;
77
use bcr_common::wire::quotes::{ResolveOffer, StatusReply};
8-
use bcr_ebill_core::sum::Sum;
8+
use bcr_ebill_core::protocol::Sum;
99
use bcr_ebill_core::{
10-
DateTimeUtc, SecretKey, ServiceTraitBounds, blockchain::bill::BillToShareWithExternalParty,
11-
util::BcrKeys,
10+
application::ServiceTraitBounds, protocol::DateTimeUtc, protocol::SecretKey,
11+
protocol::blockchain::bill::BillToShareWithExternalParty, protocol::crypto::BcrKeys,
1212
};
1313
use cashu::{ProofsMethods, State, nut01 as cdk01, nut02 as cdk02};
1414
use thiserror::Error;

crates/bcr-ebill-api/src/external/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pub mod email;
44
pub mod file_storage;
55
pub mod identity_proof;
66
pub mod mint;
7-
pub mod time;
87

98
use thiserror::Error;
109

crates/bcr-ebill-api/src/external/time.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)