Skip to content

Commit

Permalink
refactor: move small types in types module
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Sep 16, 2024
1 parent 1ddf386 commit bdb5174
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 24 deletions.
2 changes: 1 addition & 1 deletion bdk-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ use crate::types::FullScanRequestBuilder;
use crate::types::FullScanScriptInspector;
use crate::types::LocalOutput;
use crate::types::ScriptAmount;
use crate::types::SentAndReceivedValues;
use crate::types::SyncRequest;
use crate::types::SyncRequestBuilder;
use crate::types::SyncScriptInspector;
use crate::types::Update;
use crate::wallet::SentAndReceivedValues;
use crate::wallet::Wallet;

use bitcoin_ffi::Amount;
Expand Down
4 changes: 2 additions & 2 deletions bdk-ffi/src/tx_builder.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::bitcoin::Psbt;
use crate::error::CreateTxError;
use crate::types::ScriptAmount;
use crate::wallet::{RbfValue, Wallet};
use crate::types::{RbfValue, ScriptAmount};
use crate::wallet::Wallet;

use bitcoin_ffi::{Amount, FeeRate, Script};

Expand Down
11 changes: 11 additions & 0 deletions bdk-ffi/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,14 @@ impl FullScanRequestBuilder {
}

pub struct Update(pub(crate) BdkUpdate);

pub struct SentAndReceivedValues {
pub sent: Arc<Amount>,
pub received: Arc<Amount>,
}

#[derive(Clone, Debug)]
pub enum RbfValue {
Default,
Value(u32),
}
28 changes: 7 additions & 21 deletions bdk-ffi/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@ use crate::error::{
SignerError, SqliteError, TxidParseError,
};
use crate::store::Connection;
use crate::types::{AddressInfo, Balance, CanonicalTx, LocalOutput};
use crate::types::{FullScanRequestBuilder, SyncRequestBuilder, Update};
use crate::types::{
AddressInfo, Balance, CanonicalTx, FullScanRequestBuilder, LocalOutput, SentAndReceivedValues,
SyncRequestBuilder, Update,
};

use bitcoin_ffi::Amount;
use bitcoin_ffi::FeeRate;
use bitcoin_ffi::Script;
use bitcoin_ffi::{Amount, FeeRate, Script};

use bdk_wallet::bitcoin::Network;
use bdk_wallet::bitcoin::Txid;
use bdk_wallet::bitcoin::{Network, Txid};
use bdk_wallet::rusqlite::Connection as BdkConnection;
use bdk_wallet::PersistedWallet;
use bdk_wallet::Wallet as BdkWallet;
use bdk_wallet::{KeychainKind, SignOptions};
use bdk_wallet::{KeychainKind, PersistedWallet, SignOptions, Wallet as BdkWallet};

use std::borrow::BorrowMut;
use std::str::FromStr;
Expand Down Expand Up @@ -178,14 +175,3 @@ impl Wallet {
})
}
}

pub struct SentAndReceivedValues {
pub sent: Arc<Amount>,
pub received: Arc<Amount>,
}

#[derive(Clone, Debug)]
pub enum RbfValue {
Default,
Value(u32),
}

0 comments on commit bdb5174

Please sign in to comment.