pub struct TaprootOutput {
pub output_key: XOnlyPublicKey,
pub parity: Parity,
pub internal_key: XOnlyPublicKey,
pub merkle_root: Option<TapNodeHash>,
}Expand description
Taproot output key and spending info
Fields§
§output_key: XOnlyPublicKeyThe output public key (tweaked)
parity: ParityParity of the output key
internal_key: XOnlyPublicKeyInternal key (before tweaking)
merkle_root: Option<TapNodeHash>Merkle root (None for key-path only)
Implementations§
Source§impl TaprootOutput
impl TaprootOutput
Sourcepub fn key_path_only(internal_key: XOnlyPublicKey) -> Result<Self, TaprootError>
pub fn key_path_only(internal_key: XOnlyPublicKey) -> Result<Self, TaprootError>
Create a key-path only output (no script tree)
Sourcepub fn with_script_tree(
internal_key: XOnlyPublicKey,
tree: &TapTree,
) -> Result<Self, TaprootError>
pub fn with_script_tree( internal_key: XOnlyPublicKey, tree: &TapTree, ) -> Result<Self, TaprootError>
Create an output with a script tree
Sourcepub fn from_output_key(output_key: XOnlyPublicKey) -> Self
pub fn from_output_key(output_key: XOnlyPublicKey) -> Self
Create from output key directly (for parsing existing outputs)
Sourcepub fn script_pubkey(&self) -> Vec<u8> ⓘ
pub fn script_pubkey(&self) -> Vec<u8> ⓘ
Get the P2TR script pubkey (OP_1 <32-byte-key>)
Sourcepub fn address(&self, network: Network) -> Result<String, TaprootError>
pub fn address(&self, network: Network) -> Result<String, TaprootError>
Get the bech32m address
Sourcepub fn is_key_path_only(&self) -> bool
pub fn is_key_path_only(&self) -> bool
Check if this is a key-path only output
Trait Implementations§
Source§impl Clone for TaprootOutput
impl Clone for TaprootOutput
Source§fn clone(&self) -> TaprootOutput
fn clone(&self) -> TaprootOutput
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TaprootOutput
impl RefUnwindSafe for TaprootOutput
impl Send for TaprootOutput
impl Sync for TaprootOutput
impl Unpin for TaprootOutput
impl UnwindSafe for TaprootOutput
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