pub struct PartiallySignedTransaction {
pub global: HashMap<Vec<u8>, Vec<u8>>,
pub inputs: Vec<HashMap<Vec<u8>, Vec<u8>>>,
pub outputs: Vec<HashMap<Vec<u8>, Vec<u8>>>,
pub version: u8,
}Expand description
Partially Signed Bitcoin Transaction
Fields§
§global: HashMap<Vec<u8>, Vec<u8>>Global map (unsigned transaction, xpubs, etc.)
inputs: Vec<HashMap<Vec<u8>, Vec<u8>>>Input maps (one per input)
outputs: Vec<HashMap<Vec<u8>, Vec<u8>>>Output maps (one per output)
version: u8Version (default: 0)
Implementations§
Source§impl PartiallySignedTransaction
impl PartiallySignedTransaction
Sourcepub fn new(unsigned_tx: &[u8]) -> GovernanceResult<Self>
pub fn new(unsigned_tx: &[u8]) -> GovernanceResult<Self>
Create a new PSBT from an unsigned transaction
Sourcepub fn add_input_data(
&mut self,
input_index: usize,
key: Vec<u8>,
value: Vec<u8>,
) -> GovernanceResult<()>
pub fn add_input_data( &mut self, input_index: usize, key: Vec<u8>, value: Vec<u8>, ) -> GovernanceResult<()>
Add input data
Sourcepub fn add_output_data(
&mut self,
output_index: usize,
key: Vec<u8>,
value: Vec<u8>,
) -> GovernanceResult<()>
pub fn add_output_data( &mut self, output_index: usize, key: Vec<u8>, value: Vec<u8>, ) -> GovernanceResult<()>
Add output data
Sourcepub fn add_partial_signature(
&mut self,
input_index: usize,
pubkey: Vec<u8>,
signature: Vec<u8>,
) -> GovernanceResult<()>
pub fn add_partial_signature( &mut self, input_index: usize, pubkey: Vec<u8>, signature: Vec<u8>, ) -> GovernanceResult<()>
Add partial signature to an input
Sourcepub fn add_bip32_derivation(
&mut self,
input_index: usize,
pubkey: Vec<u8>,
derivation: Bip32Derivation,
) -> GovernanceResult<()>
pub fn add_bip32_derivation( &mut self, input_index: usize, pubkey: Vec<u8>, derivation: Bip32Derivation, ) -> GovernanceResult<()>
Add BIP32 derivation path to an input
Sourcepub fn set_sighash_type(
&mut self,
input_index: usize,
sighash_type: SighashType,
) -> GovernanceResult<()>
pub fn set_sighash_type( &mut self, input_index: usize, sighash_type: SighashType, ) -> GovernanceResult<()>
Set sighash type for an input
Sourcepub fn is_finalized(&self) -> bool
pub fn is_finalized(&self) -> bool
Check if PSBT is finalized (all inputs have final script sig/witness)
Sourcepub fn extract_transaction(&self) -> GovernanceResult<Vec<u8>>
pub fn extract_transaction(&self) -> GovernanceResult<Vec<u8>>
Extract final transaction (throws error if not finalized)
Sourcepub fn serialize(&self) -> GovernanceResult<Vec<u8>>
pub fn serialize(&self) -> GovernanceResult<Vec<u8>>
Serialize PSBT to bytes
Sourcepub fn deserialize(data: &[u8]) -> GovernanceResult<Self>
pub fn deserialize(data: &[u8]) -> GovernanceResult<Self>
Deserialize PSBT from bytes
Trait Implementations§
Source§impl Clone for PartiallySignedTransaction
impl Clone for PartiallySignedTransaction
Source§fn clone(&self) -> PartiallySignedTransaction
fn clone(&self) -> PartiallySignedTransaction
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PartiallySignedTransaction
impl Debug for PartiallySignedTransaction
Source§impl PartialEq for PartiallySignedTransaction
impl PartialEq for PartiallySignedTransaction
Source§fn eq(&self, other: &PartiallySignedTransaction) -> bool
fn eq(&self, other: &PartiallySignedTransaction) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for PartiallySignedTransaction
impl StructuralPartialEq for PartiallySignedTransaction
Auto Trait Implementations§
impl Freeze for PartiallySignedTransaction
impl RefUnwindSafe for PartiallySignedTransaction
impl Send for PartiallySignedTransaction
impl Sync for PartiallySignedTransaction
impl Unpin for PartiallySignedTransaction
impl UnsafeUnpin for PartiallySignedTransaction
impl UnwindSafe for PartiallySignedTransaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more