pub struct ElementsAddress {
pub params: &'static AddressParams,
pub payload: Payload,
pub blinding_pubkey: Option<PublicKey>,
}Expand description
An Elements address.
Fields§
§params: &'static AddressParamsthe network
payload: Payloadthe traditional non-confidential payload
blinding_pubkey: Option<PublicKey>the blinding pubkey
Implementations§
Source§impl Address
impl Address
Sourcepub fn is_blinded(&self) -> bool
pub fn is_blinded(&self) -> bool
Inspect if the address is a blinded address.
Sourcepub fn p2pkh(
pk: &PublicKey,
blinder: Option<PublicKey>,
params: &'static AddressParams,
) -> Address
pub fn p2pkh( pk: &PublicKey, blinder: Option<PublicKey>, params: &'static AddressParams, ) -> Address
Creates a pay to (compressed) public key hash address from a public key This is the preferred non-witness type address
Sourcepub fn p2sh(
script: &Script,
blinder: Option<PublicKey>,
params: &'static AddressParams,
) -> Address
pub fn p2sh( script: &Script, blinder: Option<PublicKey>, params: &'static AddressParams, ) -> Address
Creates a pay to script hash P2SH address from a script This address type was introduced with BIP16 and is the popular type to implement multi-sig these days.
Sourcepub fn p2wpkh(
pk: &PublicKey,
blinder: Option<PublicKey>,
params: &'static AddressParams,
) -> Address
pub fn p2wpkh( pk: &PublicKey, blinder: Option<PublicKey>, params: &'static AddressParams, ) -> Address
Create a witness pay to public key address from a public key This is the native segwit address type for an output redeemable with a single signature
Sourcepub fn p2shwpkh(
pk: &PublicKey,
blinder: Option<PublicKey>,
params: &'static AddressParams,
) -> Address
pub fn p2shwpkh( pk: &PublicKey, blinder: Option<PublicKey>, params: &'static AddressParams, ) -> Address
Create a pay to script address that embeds a witness pay to public key This is a segwit address type that looks familiar (as p2sh) to legacy clients
Sourcepub fn p2wsh(
script: &Script,
blinder: Option<PublicKey>,
params: &'static AddressParams,
) -> Address
pub fn p2wsh( script: &Script, blinder: Option<PublicKey>, params: &'static AddressParams, ) -> Address
Create a witness pay to script hash address
Sourcepub fn p2shwsh(
script: &Script,
blinder: Option<PublicKey>,
params: &'static AddressParams,
) -> Address
pub fn p2shwsh( script: &Script, blinder: Option<PublicKey>, params: &'static AddressParams, ) -> Address
Create a pay to script address that embeds a witness pay to script hash address This is a segwit address type that looks familiar (as p2sh) to legacy clients
Sourcepub fn p2tr<C>(
secp: &Secp256k1<C>,
internal_key: XOnlyPublicKey,
merkle_root: Option<TapNodeHash>,
blinder: Option<PublicKey>,
params: &'static AddressParams,
) -> Addresswhere
C: Verification,
pub fn p2tr<C>(
secp: &Secp256k1<C>,
internal_key: XOnlyPublicKey,
merkle_root: Option<TapNodeHash>,
blinder: Option<PublicKey>,
params: &'static AddressParams,
) -> Addresswhere
C: Verification,
Creates a pay to taproot address from an untweaked key.
Sourcepub fn p2tr_tweaked(
output_key: TweakedPublicKey,
blinder: Option<PublicKey>,
params: &'static AddressParams,
) -> Address
pub fn p2tr_tweaked( output_key: TweakedPublicKey, blinder: Option<PublicKey>, params: &'static AddressParams, ) -> Address
Creates a pay to taproot address from a pre-tweaked output key.
This method is not recommended for use, Address::p2tr() should be used where possible.
Sourcepub fn from_script(
script: &Script,
blinder: Option<PublicKey>,
params: &'static AddressParams,
) -> Option<Address>
pub fn from_script( script: &Script, blinder: Option<PublicKey>, params: &'static AddressParams, ) -> Option<Address>
Get an Address from an output script.
Sourcepub fn script_pubkey(&self) -> Script
pub fn script_pubkey(&self) -> Script
Generates a script pubkey spending to this address
Sourcepub fn to_unconfidential(&self) -> Address
pub fn to_unconfidential(&self) -> Address
Convert this address to an unconfidential address.
Sourcepub fn to_confidential(&self, blinding_pubkey: PublicKey) -> Address
pub fn to_confidential(&self, blinding_pubkey: PublicKey) -> Address
Convert this address to a confidential address with the given blinding pubkey.
Sourcepub fn parse_with_params(
s: &str,
params: &'static AddressParams,
) -> Result<Address, AddressError>
pub fn parse_with_params( s: &str, params: &'static AddressParams, ) -> Result<Address, AddressError>
Parse the address using the given parameters. When using the built-in parameters, you can use FromStr.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Address
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Address
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<Address, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Address, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Serialize for Address
Available on crate feature serde only.
impl Serialize for Address
serde only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl Eq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.