Skip to content

Commit

Permalink
remove macros for in-memory connection
Browse files Browse the repository at this point in the history
  • Loading branch information
rustaceanrob committed Aug 6, 2024
1 parent d7dac1a commit cdbf424
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 247 deletions.
49 changes: 3 additions & 46 deletions bdk-ffi/src/bdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -431,46 +431,6 @@ interface Wallet {
boolean persist(Connection connection);
};

interface WalletNoPersist {
[Throws=DescriptorError]
constructor(Descriptor descriptor, Descriptor change_descriptor, Network network);

AddressInfo reveal_next_address(KeychainKind keychain);

Network network();

Balance balance();

[Throws=CannotConnectError]
void apply_update(Update update);

boolean is_mine(Script script);

[Throws=SignerError]
boolean sign(Psbt psbt);

SentAndReceivedValues sent_and_received([ByRef] Transaction tx);

sequence<CanonicalTx> transactions();

[Throws=TxidParseError]
CanonicalTx? get_tx(string txid);

[Throws=CalculateFeeError]
Amount calculate_fee([ByRef] Transaction tx);

[Throws=CalculateFeeError]
FeeRate calculate_fee_rate([ByRef] Transaction tx);

sequence<LocalOutput> list_unspent();

sequence<LocalOutput> list_output();

FullScanRequest start_full_scan();

SyncRequest start_sync_with_revealed_spks();
};

interface Update {};

interface TxBuilder {
Expand Down Expand Up @@ -508,9 +468,6 @@ interface TxBuilder {

[Throws=CreateTxError]
Psbt finish([ByRef] Wallet wallet);

[Throws=CreateTxError]
Psbt finish_no_persist([ByRef] WalletNoPersist wallet);
};

interface BumpFeeTxBuilder {
Expand All @@ -522,9 +479,6 @@ interface BumpFeeTxBuilder {

[Throws=CreateTxError]
Psbt finish([ByRef] Wallet wallet);

[Throws=CreateTxError]
Psbt finish_no_persist([ByRef] WalletNoPersist wallet);
};

// ------------------------------------------------------------------------
Expand All @@ -534,6 +488,9 @@ interface BumpFeeTxBuilder {
interface Connection {
[Throws=SqliteError]
constructor(string path);

[Name=new_in_memory, Throws=SqliteError]
constructor();
};

// ------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion bdk-ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ use crate::wallet::SentAndReceivedValues;
use crate::types::SyncRequest;
use crate::types::SyncScriptInspector;
use crate::wallet::Wallet;
use crate::wallet::WalletNoPersist;
use crate::error::LoadWithPersistError;

use bdk_wallet::bitcoin::Network;
Expand Down
5 changes: 5 additions & 0 deletions bdk-ffi/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ impl Connection {
Ok(Self(Mutex::new(connection)))
}

pub fn new_in_memory() -> Result<Self, SqliteError> {
let connection = BdkConnection::open_in_memory()?;
Ok(Self(Mutex::new(connection)))
}

pub(crate) fn get_store(&self) -> MutexGuard<BdkConnection> {
self.0.lock().expect("must lock")
}
Expand Down
Loading

0 comments on commit cdbf424

Please sign in to comment.