@@ -628,17 +628,39 @@ impl TxIn {
628
628
}
629
629
}
630
630
}
631
-
632
- #[ no_mangle]
633
- /// Frees the witness and script_sig in a TxIn
634
- pub extern "C" fn TxIn_free ( _res : TxIn ) { }
635
-
636
631
#[ no_mangle]
637
632
/// Convenience function for constructing a new TxIn
638
633
pub extern "C" fn TxIn_new ( witness : Witness , script_sig : derived:: CVec_u8Z , sequence : u32 , previous_txid : ThirtyTwoBytes , previous_vout : u32 ) -> TxIn {
639
634
TxIn { witness, script_sig, sequence, previous_txid, previous_vout }
640
635
}
641
-
636
+ #[ no_mangle]
637
+ /// Gets the `witness` in the given `TxIn`.
638
+ pub extern "C" fn TxIn_get_witness ( txin : & TxIn ) -> Witness {
639
+ txin. witness . clone ( )
640
+ }
641
+ #[ no_mangle]
642
+ /// Gets the `script_sig` in the given `TxIn`.
643
+ pub extern "C" fn TxIn_get_script_sig ( txin : & TxIn ) -> u8slice {
644
+ u8slice:: from_vec ( & txin. script_sig )
645
+ }
646
+ #[ no_mangle]
647
+ /// Gets the `sequence` in the given `TxIn`.
648
+ pub extern "C" fn TxIn_get_sequence ( txin : & TxIn ) -> u32 {
649
+ txin. sequence
650
+ }
651
+ #[ no_mangle]
652
+ /// Gets the previous outpoint txid in the given `TxIn`.
653
+ pub extern "C" fn TxIn_get_previous_txid ( txin : & TxIn ) -> ThirtyTwoBytes {
654
+ txin. previous_txid
655
+ }
656
+ #[ no_mangle]
657
+ /// Gets the previout outpoint index in the given `TxIn`.
658
+ pub extern "C" fn TxIn_get_previous_vout ( txin : & TxIn ) -> u32 {
659
+ txin. previous_vout
660
+ }
661
+ #[ no_mangle]
662
+ /// Frees the witness and script_sig in a TxIn
663
+ pub extern "C" fn TxIn_free ( _res : TxIn ) { }
642
664
643
665
#[ repr( C ) ]
644
666
#[ derive( Clone ) ]
@@ -672,6 +694,16 @@ pub extern "C" fn TxOut_new(script_pubkey: derived::CVec_u8Z, value: u64) -> TxO
672
694
TxOut { script_pubkey, value }
673
695
}
674
696
#[ no_mangle]
697
+ /// Gets the `script_pubkey` in the given `TxOut`.
698
+ pub extern "C" fn TxOut_get_script_pubkey ( txout : & TxOut ) -> u8slice {
699
+ u8slice:: from_vec ( & txout. script_pubkey )
700
+ }
701
+ #[ no_mangle]
702
+ /// Gets the value in the given `TxOut`.
703
+ pub extern "C" fn TxOut_get_value ( txout : & TxOut ) -> u64 {
704
+ txout. value
705
+ }
706
+ #[ no_mangle]
675
707
/// Frees the data pointed to by script_pubkey.
676
708
pub extern "C" fn TxOut_free ( _res : TxOut ) { }
677
709
#[ no_mangle]
0 commit comments