From 2ee125655b443f00aa16454fd6715afd2e1b0d23 Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Thu, 23 Sep 2021 16:12:53 +0530 Subject: [PATCH 1/2] Expose get_tx() method from `DB` to `Wallet` --- src/wallet/mod.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/wallet/mod.rs b/src/wallet/mod.rs index 109a219c..01dfdfc7 100644 --- a/src/wallet/mod.rs +++ b/src/wallet/mod.rs @@ -323,7 +323,7 @@ where /// Return the list of unspent outputs of this wallet /// - /// Note that this methods only operate on the internal database, which first needs to be + /// Note that this method only operates on the internal database, which first needs to be /// [`Wallet::sync`] manually. pub fn list_unspent(&self) -> Result, Error> { self.database.borrow().iter_utxos() @@ -335,6 +335,21 @@ where self.database.borrow().get_utxo(&outpoint) } + /// Return a single transactions made and received by the wallet + /// + /// Optionally fill the [`TransactionDetails::transaction`] field with the raw transaction if + /// `include_raw` is `true`. + /// + /// Note that this method only operates on the internal database, which first needs to be + /// [`Wallet::sync`] manually. + pub fn get_tx( + &self, + txid: &Txid, + include_raw: bool, + ) -> Result, Error> { + self.database.borrow().get_tx(txid, include_raw) + } + /// Return the list of transactions made and received by the wallet /// /// Optionally fill the [`TransactionDetails::transaction`] field with the raw transaction if From 2f38d3e526244cdb982b08abe9ecdf86af9c2257 Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Thu, 23 Sep 2021 16:16:31 +0530 Subject: [PATCH 2/2] Update ChangeLog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eae7898e..75fcfa50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Activate `miniscript/use-serde` feature to allow consumers of the library to access it via the re-exported `miniscript` crate. - Add support for proxies in `EsploraBlockchain` - Added `SqliteDatabase` that implements `Database` backed by a sqlite database using `rusqlite` crate. +- Exposed `get_tx()` method from `Database` to `Wallet`. ## [v0.11.0] - [v0.10.0]