Skip to content

Commit 7dd094a

Browse files
refactor: open visibility in accordance with our public API
1 parent 7f987ae commit 7dd094a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

bdk-ffi/src/bitcoin.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use std::ops::Deref;
3737
use std::str::FromStr;
3838
use std::sync::{Arc, Mutex};
3939

40-
pub(crate) type DescriptorType = bdk_wallet::miniscript::descriptor::DescriptorType;
40+
pub type DescriptorType = bdk_wallet::miniscript::descriptor::DescriptorType;
4141
pub type Network = bdk_wallet::bitcoin::Network;
4242

4343
/// A reference to an unspent output by TXID and output index.
@@ -508,7 +508,7 @@ pub struct Psbt(pub(crate) Mutex<BdkPsbt>);
508508
impl Psbt {
509509
/// Creates a new `Psbt` instance from a base64-encoded string.
510510
#[uniffi::constructor]
511-
pub(crate) fn new(psbt_base64: String) -> Result<Self, PsbtParseError> {
511+
pub fn new(psbt_base64: String) -> Result<Self, PsbtParseError> {
512512
let psbt: BdkPsbt = BdkPsbt::from_str(&psbt_base64)?;
513513
Ok(Psbt(Mutex::new(psbt)))
514514
}
@@ -519,22 +519,22 @@ impl Psbt {
519519
///
520520
/// If transactions is not unsigned.
521521
#[uniffi::constructor]
522-
pub(crate) fn from_unsigned_tx(tx: Arc<Transaction>) -> Result<Arc<Psbt>, PsbtError> {
522+
pub fn from_unsigned_tx(tx: Arc<Transaction>) -> Result<Arc<Psbt>, PsbtError> {
523523
let psbt: BdkPsbt = BdkPsbt::from_unsigned_tx(tx.0.clone())?;
524524
Ok(Arc::new(Psbt(Mutex::new(psbt))))
525525
}
526526

527527
/// Create a new `Psbt` from a `.psbt` file.
528528
#[uniffi::constructor]
529-
pub(crate) fn from_file(path: String) -> Result<Self, PsbtError> {
529+
pub fn from_file(path: String) -> Result<Self, PsbtError> {
530530
let file = File::open(path)?;
531531
let mut buf_read = BufReader::new(file);
532532
let psbt: BdkPsbt = BdkPsbt::deserialize_from_reader(&mut buf_read)?;
533533
Ok(Psbt(Mutex::new(psbt)))
534534
}
535535

536536
/// Serialize the PSBT into a base64-encoded string.
537-
pub(crate) fn serialize(&self) -> String {
537+
pub fn serialize(&self) -> String {
538538
let psbt = self.0.lock().unwrap().clone();
539539
psbt.to_string()
540540
}
@@ -546,7 +546,7 @@ impl Psbt {
546546
/// `ExtractTxError` variants will contain either the `Psbt` itself or the `Transaction`
547547
/// that was extracted. These can be extracted from the Errors in order to recover.
548548
/// See the error documentation for info on the variants. In general, it covers large fees.
549-
pub(crate) fn extract_tx(&self) -> Result<Arc<Transaction>, ExtractTxError> {
549+
pub fn extract_tx(&self) -> Result<Arc<Transaction>, ExtractTxError> {
550550
let tx: BdkTransaction = self.0.lock().unwrap().clone().extract_tx()?;
551551
let transaction: Transaction = tx.into();
552552
Ok(Arc::new(transaction))
@@ -562,7 +562,7 @@ impl Psbt {
562562
/// - `MissingUtxo` when UTXO information for any input is not present or is invalid.
563563
/// - `NegativeFee` if calculated value is negative.
564564
/// - `FeeOverflow` if an integer overflow occurs.
565-
pub(crate) fn fee(&self) -> Result<u64, PsbtError> {
565+
pub fn fee(&self) -> Result<u64, PsbtError> {
566566
self.0
567567
.lock()
568568
.unwrap()
@@ -574,7 +574,7 @@ impl Psbt {
574574
/// Combines this `Psbt` with `other` PSBT as described by BIP 174.
575575
///
576576
/// In accordance with BIP 174 this function is commutative i.e., `A.combine(B) == B.combine(A)`
577-
pub(crate) fn combine(&self, other: Arc<Psbt>) -> Result<Arc<Psbt>, PsbtError> {
577+
pub fn combine(&self, other: Arc<Psbt>) -> Result<Arc<Psbt>, PsbtError> {
578578
let mut original_psbt = self.0.lock().unwrap().clone();
579579
let other_psbt = other.0.lock().unwrap().clone();
580580
original_psbt.combine(other_psbt)?;
@@ -584,7 +584,7 @@ impl Psbt {
584584
/// Finalizes the current PSBT and produces a result indicating
585585
///
586586
/// whether the finalization was successful or not.
587-
pub(crate) fn finalize(&self) -> FinalizedPsbtResult {
587+
pub fn finalize(&self) -> FinalizedPsbtResult {
588588
let curve = Secp256k1::verification_only();
589589
let finalized = self.0.lock().unwrap().clone().finalize(&curve);
590590
match finalized {
@@ -605,7 +605,7 @@ impl Psbt {
605605
}
606606

607607
/// Write the `Psbt` to a file. Note that the file must not yet exist.
608-
pub(crate) fn write_to_file(&self, path: String) -> Result<(), PsbtError> {
608+
pub fn write_to_file(&self, path: String) -> Result<(), PsbtError> {
609609
let file = File::create_new(path)?;
610610
let mut writer = BufWriter::new(file);
611611
let psbt = self.0.lock().unwrap();
@@ -614,13 +614,13 @@ impl Psbt {
614614
}
615615

616616
/// Serializes the PSBT into a JSON string representation.
617-
pub(crate) fn json_serialize(&self) -> String {
617+
pub fn json_serialize(&self) -> String {
618618
let psbt = self.0.lock().unwrap();
619619
serde_json::to_string(psbt.deref()).unwrap()
620620
}
621621

622622
/// Returns the spending utxo for this PSBT's input at `input_index`.
623-
pub(crate) fn spend_utxo(&self, input_index: u64) -> String {
623+
pub fn spend_utxo(&self, input_index: u64) -> String {
624624
let psbt = self.0.lock().unwrap();
625625
let utxo = psbt.spend_utxo(input_index as usize).unwrap();
626626
serde_json::to_string(&utxo).unwrap()

0 commit comments

Comments
 (0)