pub enum Payload {
PubkeyHash(PubkeyHash),
ScriptHash(ScriptHash),
WitnessProgram {
version: WitnessVersion,
program: Vec<u8>,
},
}
Expand description
The method used to produce an address.
Variants§
PubkeyHash(PubkeyHash)
P2PKH address.
ScriptHash(ScriptHash)
P2SH address.
WitnessProgram
Segwit address.
Implementations§
source§impl Payload
impl Payload
sourcepub fn from_script(script: &Script) -> Result<Payload, Error>
pub fn from_script(script: &Script) -> Result<Payload, Error>
Constructs a Payload from an output script (scriptPubkey
).
sourcepub fn script_pubkey(&self) -> Script
pub fn script_pubkey(&self) -> Script
Generates a script pubkey spending to this Payload.
sourcepub fn p2pkh(pk: &PublicKey) -> Payload
pub fn p2pkh(pk: &PublicKey) -> Payload
Creates a pay to (compressed) public key hash payload from a public key
sourcepub fn p2sh(script: &Script) -> Result<Payload, Error>
pub fn p2sh(script: &Script) -> Result<Payload, Error>
Creates a pay to script hash P2SH payload from a script
sourcepub fn p2wpkh(pk: &PublicKey) -> Result<Payload, Error>
pub fn p2wpkh(pk: &PublicKey) -> Result<Payload, Error>
Create a witness pay to public key payload from a public key
sourcepub fn p2shwpkh(pk: &PublicKey) -> Result<Payload, Error>
pub fn p2shwpkh(pk: &PublicKey) -> Result<Payload, Error>
Create a pay to script payload that embeds a witness pay to public key
sourcepub fn p2shwsh(script: &Script) -> Payload
pub fn p2shwsh(script: &Script) -> Payload
Create a pay to script payload that embeds a witness pay to script hash address
sourcepub fn p2tr<C: Verification>(
secp: &Secp256k1<C>,
internal_key: UntweakedPublicKey,
merkle_root: Option<TapBranchHash>
) -> Payload
pub fn p2tr<C: Verification>( secp: &Secp256k1<C>, internal_key: UntweakedPublicKey, merkle_root: Option<TapBranchHash> ) -> Payload
Create a pay to taproot payload from untweaked key
sourcepub fn p2tr_tweaked(output_key: TweakedPublicKey) -> Payload
pub fn p2tr_tweaked(output_key: TweakedPublicKey) -> Payload
Create a pay to taproot payload from a pre-tweaked output key.
This method is not recommended for use and Payload::p2tr() should be used where possible.
Trait Implementations§
source§impl Ord for Payload
impl Ord for Payload
source§impl PartialEq<Payload> for Payload
impl PartialEq<Payload> for Payload
source§impl PartialOrd<Payload> for Payload
impl PartialOrd<Payload> for Payload
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Payload
impl StructuralEq for Payload
impl StructuralPartialEq for Payload
Auto Trait Implementations§
impl RefUnwindSafe for Payload
impl Send for Payload
impl Sync for Payload
impl Unpin for Payload
impl UnwindSafe for Payload
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