]> Untitled Git - bdk/commitdiff
Expose get_tx() method from `DB` to `Wallet`
authorrajarshimaitra <rajarshi149@gmail.com>
Thu, 23 Sep 2021 10:42:53 +0000 (16:12 +0530)
committerrajarshimaitra <rajarshi149@gmail.com>
Thu, 7 Oct 2021 15:19:07 +0000 (20:49 +0530)
src/wallet/mod.rs

index 109a219cbdcdc1716d697caaea425ba9025d8bb9..01dfdfc794b3d3c01a545c8d4fd6dd48cc4fc897 100644 (file)
@@ -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<Vec<LocalUtxo>, 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<Option<TransactionDetails>, 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