bdkffi::bitcoin

Struct Psbt

Source
pub struct Psbt(/* private fields */);
Expand description

A Partially Signed Transaction.

Implementations§

Source§

impl Psbt

Source

pub fn new(psbt_base64: String) -> Result<Self, PsbtParseError>

Creates a new Psbt instance from a base64-encoded string.

Source

pub fn from_unsigned_tx(tx: Arc<Transaction>) -> Result<Arc<Psbt>, PsbtError>

Creates a PSBT from an unsigned transaction.

§Errors

If transactions is not unsigned.

Source

pub fn from_file(path: String) -> Result<Self, PsbtError>

Create a new Psbt from a .psbt file.

Source

pub fn serialize(&self) -> String

Serialize the PSBT into a base64-encoded string.

Source

pub fn extract_tx(&self) -> Result<Arc<Transaction>, ExtractTxError>

Extracts the Transaction from a Psbt by filling in the available signature information.

§Errors

ExtractTxError variants will contain either the Psbt itself or the Transaction that was extracted. These can be extracted from the Errors in order to recover. See the error documentation for info on the variants. In general, it covers large fees.

Source

pub fn fee(&self) -> Result<u64, PsbtError>

Calculates transaction fee.

‘Fee’ being the amount that will be paid for mining a transaction with the current inputs and outputs i.e., the difference in value of the total inputs and the total outputs.

§Errors
  • MissingUtxo when UTXO information for any input is not present or is invalid.
  • NegativeFee if calculated value is negative.
  • FeeOverflow if an integer overflow occurs.
Source

pub fn combine(&self, other: Arc<Psbt>) -> Result<Arc<Psbt>, PsbtError>

Combines this Psbt with other PSBT as described by BIP 174.

In accordance with BIP 174 this function is commutative i.e., A.combine(B) == B.combine(A)

Source

pub fn finalize(&self) -> FinalizedPsbtResult

Finalizes the current PSBT and produces a result indicating

whether the finalization was successful or not.

Source

pub fn write_to_file(&self, path: String) -> Result<(), PsbtError>

Write the Psbt to a file. Note that the file must not yet exist.

Source

pub fn json_serialize(&self) -> String

Serializes the PSBT into a JSON string representation.

Source

pub fn spend_utxo(&self, input_index: u64) -> String

Returns the spending utxo for this PSBT’s input at input_index.

Source

pub fn input(&self) -> Vec<Input>

The corresponding key-value map for each input in the unsigned transaction.

Source

pub fn output(&self) -> Vec<Output>

The corresponding key-value map for each output in the unsigned transaction.

Trait Implementations§

Source§

impl From<Psbt> for Psbt

Source§

fn from(psbt: BdkPsbt) -> Self

Converts to this type from the input type.
Source§

impl<UT> LiftRef<UT> for Psbt

Source§

impl<UT> LowerError<UT> for Psbt

Source§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for Psbt

Source§

type ReturnType = <Arc<Psbt> as LowerReturn<UniFfiTag>>::ReturnType

The type that should be returned by scaffolding functions for this type. Read more
Source§

fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
Source§

impl<UT> TypeId<UT> for Psbt

Source§

const TYPE_ID_META: MetadataBuffer

Auto Trait Implementations§

§

impl !Freeze for Psbt

§

impl RefUnwindSafe for Psbt

§

impl Send for Psbt

§

impl Sync for Psbt

§

impl Unpin for Psbt

§

impl UnwindSafe for Psbt

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V