#[non_exhaustive]pub enum Payload {
PubkeyHash(PubkeyHash),
ScriptHash(ScriptHash),
WitnessProgram(WitnessProgram),
}
Expand description
The method used to produce an address.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PubkeyHash(PubkeyHash)
P2PKH address.
ScriptHash(ScriptHash)
P2SH address.
WitnessProgram(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) -> ScriptBuf
pub fn script_pubkey(&self) -> ScriptBuf
Generates a script pubkey spending to this Payload.
sourcepub fn matches_script_pubkey(&self, script: &Script) -> bool
pub fn matches_script_pubkey(&self, script: &Script) -> bool
Returns true if the address creates a particular script This function doesn’t make any allocations.
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<TapNodeHash>
) -> Payload
pub fn p2tr<C: Verification>( secp: &Secp256k1<C>, internal_key: UntweakedPublicKey, merkle_root: Option<TapNodeHash> ) -> 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
self
and other
) and is used by the <=
operator. Read more