Struct psbt::Output

source ·
pub struct Output {
    pub amount: Sats,
    pub script: ScriptPubkey,
    pub redeem_script: Option<RedeemScript>,
    pub witness_script: Option<WitnessScript>,
    pub bip32_derivation: IndexMap<CompressedPk, KeyOrigin>,
    pub tap_internal_key: Option<InternalPk>,
    pub tap_tree: Option<TapTree>,
    pub tap_bip32_derivation: IndexMap<XOnlyPk, TapDerivation>,
    pub proprietary: IndexMap<PropKey, ValueData>,
    pub unknown: IndexMap<u8, IndexMap<KeyData, ValueData>>,
    /* private fields */
}

Fields§

§amount: Sats

The output’s amount in satoshis.

§script: ScriptPubkey

The script for this output, also known as the scriptPubKey.

§redeem_script: Option<RedeemScript>

The redeem script for this output.

§witness_script: Option<WitnessScript>

The witness script for this output.

§bip32_derivation: IndexMap<CompressedPk, KeyOrigin>

A map from public keys needed to spend this output to their corresponding master key fingerprints and derivation paths.

§tap_internal_key: Option<InternalPk>

The X-only pubkey used as the internal key in this output.

§tap_tree: Option<TapTree>

One or more tuples representing the depth, leaf version, and script for a leaf in the Taproot tree, allowing the entire tree to be reconstructed. The tuples must be in depth first search order so that the tree is correctly reconstructed. Each tuple is an 8-bit unsigned integer representing the depth in the Taproot tree for this script, an 8-bit unsigned integer representing the leaf version, the length of the script as a compact size unsigned integer, and the script itself.

§tap_bip32_derivation: IndexMap<XOnlyPk, TapDerivation>

A compact size unsigned integer representing the number of leaf hashes, followed by a list of leaf hashes, followed by the 4 byte master key fingerprint concatenated with the derivation path of the public key. The derivation path is represented as 32-bit little endian unsigned integer indexes concatenated with each other. Public keys are those needed to spend this output. The leaf hashes are of the leaves which involve this public key. The internal key does not have leaf hashes, so can be indicated with a hashes len of 0. Finalizers should remove this field after PSBT_IN_FINAL_SCRIPTWITNESS is constructed.

§proprietary: IndexMap<PropKey, ValueData>

Proprietary keys

§unknown: IndexMap<u8, IndexMap<KeyData, ValueData>>

Unknown keys

Implementations§

source§

impl Output

source

pub fn new(index: usize) -> Self

source

pub fn with_txout(txout: TxOut, index: usize) -> Self

source

pub fn from_txout((index, txout): (usize, TxOut)) -> Self

source

pub fn to_txout(&self) -> TxOut

source

pub fn value(&self) -> Sats

source

pub fn index(&self) -> usize

Trait Implementations§

source§

impl Clone for Output

source§

fn clone(&self) -> Output

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Output

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl KeyMap for Output

§

type Keys = OutputKey

source§

const PROPRIETARY_TYPE: Self::Keys = OutputKey::Proprietary

source§

fn proprietary(&self) -> &IndexMap<PropKey, ValueData>

source§

fn unknown(&self) -> &IndexMap<u8, IndexMap<KeyData, ValueData>>

source§

fn proprietary_mut(&mut self) -> &mut IndexMap<PropKey, ValueData>

source§

fn unknown_mut(&mut self) -> &mut IndexMap<u8, IndexMap<KeyData, ValueData>>

source§

fn retrieve_key_pair<'enc>( &'enc self, _: PsbtVer, key_type: Self::Keys ) -> Vec<KeyPair<Self::Keys, Box<dyn Encode + 'enc>, Box<dyn Encode + 'enc>>>

source§

fn insert_singular( &mut self, key_type: Self::Keys, value_data: ValueData ) -> Result<(), PsbtError>

source§

fn insert_plural( &mut self, key_type: Self::Keys, key_data: KeyData, value_data: ValueData ) -> Result<(), PsbtError>

source§

fn encode_map( &self, version: PsbtVer, writer: &mut dyn Write ) -> Result<usize, IoError>

source§

fn parse_map( &mut self, version: PsbtVer, map: Map<Self::Keys> ) -> Result<(), PsbtError>

source§

fn insert_proprietary(&mut self, prop_key: PropKey, value_data: ValueData)

source§

fn insert_unknown( &mut self, key_type: u8, key_data: KeyData, value_data: ValueData )

source§

impl PartialEq for Output

source§

fn eq(&self, other: &Output) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Output

source§

impl StructuralEq for Output

source§

impl StructuralPartialEq for Output

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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<T> VerifyEq for Twhere T: Eq,

§

fn verify_eq(&self, other: &T) -> bool

Verifies commit-equivalence of two instances of the same type.