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
sourceimpl 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
sourceimpl Ord for Payload
impl Ord for Payload
1.21.0 · sourceconst fn max(self, other: Self) -> Selfwhere
Self: Sized,
const fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 · sourceconst fn min(self, other: Self) -> Selfwhere
Self: Sized,
const fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<Payload> for Payload
impl PartialOrd<Payload> for Payload
sourcefn partial_cmp(&self, other: &Payload) -> Option<Ordering>
fn partial_cmp(&self, other: &Payload) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more