@@ -37,7 +37,7 @@ use std::ops::Deref;
37
37
use std:: str:: FromStr ;
38
38
use std:: sync:: { Arc , Mutex } ;
39
39
40
- pub ( crate ) type DescriptorType = bdk_wallet:: miniscript:: descriptor:: DescriptorType ;
40
+ pub type DescriptorType = bdk_wallet:: miniscript:: descriptor:: DescriptorType ;
41
41
pub type Network = bdk_wallet:: bitcoin:: Network ;
42
42
43
43
/// A reference to an unspent output by TXID and output index.
@@ -508,7 +508,7 @@ pub struct Psbt(pub(crate) Mutex<BdkPsbt>);
508
508
impl Psbt {
509
509
/// Creates a new `Psbt` instance from a base64-encoded string.
510
510
#[ uniffi:: constructor]
511
- pub ( crate ) fn new ( psbt_base64 : String ) -> Result < Self , PsbtParseError > {
511
+ pub fn new ( psbt_base64 : String ) -> Result < Self , PsbtParseError > {
512
512
let psbt: BdkPsbt = BdkPsbt :: from_str ( & psbt_base64) ?;
513
513
Ok ( Psbt ( Mutex :: new ( psbt) ) )
514
514
}
@@ -519,22 +519,22 @@ impl Psbt {
519
519
///
520
520
/// If transactions is not unsigned.
521
521
#[ 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 > {
523
523
let psbt: BdkPsbt = BdkPsbt :: from_unsigned_tx ( tx. 0 . clone ( ) ) ?;
524
524
Ok ( Arc :: new ( Psbt ( Mutex :: new ( psbt) ) ) )
525
525
}
526
526
527
527
/// Create a new `Psbt` from a `.psbt` file.
528
528
#[ uniffi:: constructor]
529
- pub ( crate ) fn from_file ( path : String ) -> Result < Self , PsbtError > {
529
+ pub fn from_file ( path : String ) -> Result < Self , PsbtError > {
530
530
let file = File :: open ( path) ?;
531
531
let mut buf_read = BufReader :: new ( file) ;
532
532
let psbt: BdkPsbt = BdkPsbt :: deserialize_from_reader ( & mut buf_read) ?;
533
533
Ok ( Psbt ( Mutex :: new ( psbt) ) )
534
534
}
535
535
536
536
/// Serialize the PSBT into a base64-encoded string.
537
- pub ( crate ) fn serialize ( & self ) -> String {
537
+ pub fn serialize ( & self ) -> String {
538
538
let psbt = self . 0 . lock ( ) . unwrap ( ) . clone ( ) ;
539
539
psbt. to_string ( )
540
540
}
@@ -546,7 +546,7 @@ impl Psbt {
546
546
/// `ExtractTxError` variants will contain either the `Psbt` itself or the `Transaction`
547
547
/// that was extracted. These can be extracted from the Errors in order to recover.
548
548
/// 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 > {
550
550
let tx: BdkTransaction = self . 0 . lock ( ) . unwrap ( ) . clone ( ) . extract_tx ( ) ?;
551
551
let transaction: Transaction = tx. into ( ) ;
552
552
Ok ( Arc :: new ( transaction) )
@@ -562,7 +562,7 @@ impl Psbt {
562
562
/// - `MissingUtxo` when UTXO information for any input is not present or is invalid.
563
563
/// - `NegativeFee` if calculated value is negative.
564
564
/// - `FeeOverflow` if an integer overflow occurs.
565
- pub ( crate ) fn fee ( & self ) -> Result < u64 , PsbtError > {
565
+ pub fn fee ( & self ) -> Result < u64 , PsbtError > {
566
566
self . 0
567
567
. lock ( )
568
568
. unwrap ( )
@@ -574,7 +574,7 @@ impl Psbt {
574
574
/// Combines this `Psbt` with `other` PSBT as described by BIP 174.
575
575
///
576
576
/// 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 > {
578
578
let mut original_psbt = self . 0 . lock ( ) . unwrap ( ) . clone ( ) ;
579
579
let other_psbt = other. 0 . lock ( ) . unwrap ( ) . clone ( ) ;
580
580
original_psbt. combine ( other_psbt) ?;
@@ -584,7 +584,7 @@ impl Psbt {
584
584
/// Finalizes the current PSBT and produces a result indicating
585
585
///
586
586
/// whether the finalization was successful or not.
587
- pub ( crate ) fn finalize ( & self ) -> FinalizedPsbtResult {
587
+ pub fn finalize ( & self ) -> FinalizedPsbtResult {
588
588
let curve = Secp256k1 :: verification_only ( ) ;
589
589
let finalized = self . 0 . lock ( ) . unwrap ( ) . clone ( ) . finalize ( & curve) ;
590
590
match finalized {
@@ -605,7 +605,7 @@ impl Psbt {
605
605
}
606
606
607
607
/// 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 > {
609
609
let file = File :: create_new ( path) ?;
610
610
let mut writer = BufWriter :: new ( file) ;
611
611
let psbt = self . 0 . lock ( ) . unwrap ( ) ;
@@ -614,13 +614,13 @@ impl Psbt {
614
614
}
615
615
616
616
/// Serializes the PSBT into a JSON string representation.
617
- pub ( crate ) fn json_serialize ( & self ) -> String {
617
+ pub fn json_serialize ( & self ) -> String {
618
618
let psbt = self . 0 . lock ( ) . unwrap ( ) ;
619
619
serde_json:: to_string ( psbt. deref ( ) ) . unwrap ( )
620
620
}
621
621
622
622
/// 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 {
624
624
let psbt = self . 0 . lock ( ) . unwrap ( ) ;
625
625
let utxo = psbt. spend_utxo ( input_index as usize ) . unwrap ( ) ;
626
626
serde_json:: to_string ( & utxo) . unwrap ( )
0 commit comments