Skip to content

Commit 97af24a

Browse files
refactor: open visibility in accordance with our public API
1 parent bbb3b8f commit 97af24a

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
@@ -39,7 +39,7 @@ use std::ops::Deref;
3939
use std::str::FromStr;
4040
use std::sync::{Arc, Mutex};
4141

42-
pub(crate) type DescriptorType = bdk_wallet::miniscript::descriptor::DescriptorType;
42+
pub type DescriptorType = bdk_wallet::miniscript::descriptor::DescriptorType;
4343
pub type Network = bdk_wallet::bitcoin::Network;
4444

4545
/// A reference to an unspent output by TXID and output index.
@@ -770,7 +770,7 @@ pub struct Psbt(pub(crate) Mutex<BdkPsbt>);
770770
impl Psbt {
771771
/// Creates a new `Psbt` instance from a base64-encoded string.
772772
#[uniffi::constructor]
773-
pub(crate) fn new(psbt_base64: String) -> Result<Self, PsbtParseError> {
773+
pub fn new(psbt_base64: String) -> Result<Self, PsbtParseError> {
774774
let psbt: BdkPsbt = BdkPsbt::from_str(&psbt_base64)?;
775775
Ok(Psbt(Mutex::new(psbt)))
776776
}
@@ -781,22 +781,22 @@ impl Psbt {
781781
///
782782
/// If transactions is not unsigned.
783783
#[uniffi::constructor]
784-
pub(crate) fn from_unsigned_tx(tx: Arc<Transaction>) -> Result<Arc<Psbt>, PsbtError> {
784+
pub fn from_unsigned_tx(tx: Arc<Transaction>) -> Result<Arc<Psbt>, PsbtError> {
785785
let psbt: BdkPsbt = BdkPsbt::from_unsigned_tx(tx.0.clone())?;
786786
Ok(Arc::new(Psbt(Mutex::new(psbt))))
787787
}
788788

789789
/// Create a new `Psbt` from a `.psbt` file.
790790
#[uniffi::constructor]
791-
pub(crate) fn from_file(path: String) -> Result<Self, PsbtError> {
791+
pub fn from_file(path: String) -> Result<Self, PsbtError> {
792792
let file = File::open(path)?;
793793
let mut buf_read = BufReader::new(file);
794794
let psbt: BdkPsbt = BdkPsbt::deserialize_from_reader(&mut buf_read)?;
795795
Ok(Psbt(Mutex::new(psbt)))
796796
}
797797

798798
/// Serialize the PSBT into a base64-encoded string.
799-
pub(crate) fn serialize(&self) -> String {
799+
pub fn serialize(&self) -> String {
800800
let psbt = self.0.lock().unwrap().clone();
801801
psbt.to_string()
802802
}
@@ -808,7 +808,7 @@ impl Psbt {
808808
/// `ExtractTxError` variants will contain either the `Psbt` itself or the `Transaction`
809809
/// that was extracted. These can be extracted from the Errors in order to recover.
810810
/// See the error documentation for info on the variants. In general, it covers large fees.
811-
pub(crate) fn extract_tx(&self) -> Result<Arc<Transaction>, ExtractTxError> {
811+
pub fn extract_tx(&self) -> Result<Arc<Transaction>, ExtractTxError> {
812812
let tx: BdkTransaction = self.0.lock().unwrap().clone().extract_tx()?;
813813
let transaction: Transaction = tx.into();
814814
Ok(Arc::new(transaction))
@@ -824,7 +824,7 @@ impl Psbt {
824824
/// - `MissingUtxo` when UTXO information for any input is not present or is invalid.
825825
/// - `NegativeFee` if calculated value is negative.
826826
/// - `FeeOverflow` if an integer overflow occurs.
827-
pub(crate) fn fee(&self) -> Result<u64, PsbtError> {
827+
pub fn fee(&self) -> Result<u64, PsbtError> {
828828
self.0
829829
.lock()
830830
.unwrap()
@@ -836,7 +836,7 @@ impl Psbt {
836836
/// Combines this `Psbt` with `other` PSBT as described by BIP 174.
837837
///
838838
/// In accordance with BIP 174 this function is commutative i.e., `A.combine(B) == B.combine(A)`
839-
pub(crate) fn combine(&self, other: Arc<Psbt>) -> Result<Arc<Psbt>, PsbtError> {
839+
pub fn combine(&self, other: Arc<Psbt>) -> Result<Arc<Psbt>, PsbtError> {
840840
let mut original_psbt = self.0.lock().unwrap().clone();
841841
let other_psbt = other.0.lock().unwrap().clone();
842842
original_psbt.combine(other_psbt)?;
@@ -846,7 +846,7 @@ impl Psbt {
846846
/// Finalizes the current PSBT and produces a result indicating
847847
///
848848
/// whether the finalization was successful or not.
849-
pub(crate) fn finalize(&self) -> FinalizedPsbtResult {
849+
pub fn finalize(&self) -> FinalizedPsbtResult {
850850
let curve = Secp256k1::verification_only();
851851
let finalized = self.0.lock().unwrap().clone().finalize(&curve);
852852
match finalized {
@@ -867,7 +867,7 @@ impl Psbt {
867867
}
868868

869869
/// Write the `Psbt` to a file. Note that the file must not yet exist.
870-
pub(crate) fn write_to_file(&self, path: String) -> Result<(), PsbtError> {
870+
pub fn write_to_file(&self, path: String) -> Result<(), PsbtError> {
871871
let file = File::create_new(path)?;
872872
let mut writer = BufWriter::new(file);
873873
let psbt = self.0.lock().unwrap();
@@ -876,13 +876,13 @@ impl Psbt {
876876
}
877877

878878
/// Serializes the PSBT into a JSON string representation.
879-
pub(crate) fn json_serialize(&self) -> String {
879+
pub fn json_serialize(&self) -> String {
880880
let psbt = self.0.lock().unwrap();
881881
serde_json::to_string(psbt.deref()).unwrap()
882882
}
883883

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

0 commit comments

Comments
 (0)