pub fn address(&self, network: &'static AddressParams) -> Option<elements::Address> {
        match *self {
            Descriptor::Bare(..) => None,
            Descriptor::Pk(..) => None,
            Descriptor::Pkh(ref pk) => {
                Some(elements::Address::p2pkh(&pk.to_public_key(), None, network))
            }
            Descriptor::Wpkh(ref pk) => Some(elements::Address::p2wpkh(
                &pk.to_public_key(),
                None,
                network,
            )),
            Descriptor::ShWpkh(ref pk) => Some(elements::Address::p2shwpkh(
                &pk.to_public_key(),
                None,
                network,
            )),
            Descriptor::Sh(ref miniscript) => {
                Some(elements::Address::p2sh(&miniscript.encode(), None, network))
            }
            Descriptor::Wsh(ref miniscript) => Some(elements::Address::p2wsh(
                &miniscript.encode(),
                None,
                network,
            )),
            Descriptor::ShWsh(ref miniscript) => Some(elements::Address::p2shwsh(
                &miniscript.encode(),
                None,
                network,
            )),
            Descriptor::Cov(ref cov) => Some(cov.commit_ctx.address()),
        }
    }
/// Computes the Bitcoin address of the descriptor, if one exists
Computes the Bitcoin address of the descriptor, if one exists
Computes the Bitcoin address of the descriptor if one exists
pub fn address(&self, network: &'static AddressParams) -> Option<elements::Address> {
        match *self {
            Descriptor::Bare(..) => None,
            Descriptor::Pk(..) => None,
            Descriptor::Pkh(ref pk) => {
                Some(elements::Address::p2pkh(&pk.to_public_key(), None, network))
            }
            Descriptor::Wpkh(ref pk) => Some(elements::Address::p2wpkh(
                &pk.to_public_key(),
                None,
                network,
            )),
            Descriptor::ShWpkh(ref pk) => Some(elements::Address::p2shwpkh(
                &pk.to_public_key(),
                None,
                network,
            )),
            Descriptor::Sh(ref miniscript) => {
                Some(elements::Address::p2sh(&miniscript.encode(), None, network))
            }
            Descriptor::Wsh(ref miniscript) => Some(elements::Address::p2wsh(
                &miniscript.encode(),
                None,
                network,
            )),
            Descriptor::ShWsh(ref miniscript) => Some(elements::Address::p2shwsh(
                &miniscript.encode(),
                None,
                network,
            )),
            Descriptor::Cov(ref cov) => Some(cov.commit_ctx.address()),
        }
    }
pub fn address ( & self , network : & ' static AddressParams ) -> Option < elements :: Address > { match * self { Descriptor :: Bare ( .. ) => None , Descriptor :: Pk ( .. ) => None , Descriptor :: Pkh ( ref pk ) => { Some ( elements :: Address :: p2pkh ( & pk . to_public_key ( ) , None , network ) ) } Descriptor :: Wpkh ( ref pk ) => Some ( elements :: Address :: p2wpkh ( & pk . to_public_key ( ) , None , network , ) ) , Descriptor :: ShWpkh ( ref pk ) => Some ( elements :: Address :: p2shwpkh ( & pk . to_public_key ( ) , None , network , ) ) , Descriptor :: Sh ( ref miniscript ) => { Some ( elements :: Address :: p2sh ( & miniscript . encode ( ) , None , network ) ) } Descriptor :: Wsh ( ref miniscript ) => Some ( elements :: Address :: p2wsh ( & miniscript . encode ( ) , None , network , ) ) , Descriptor :: ShWsh ( ref miniscript ) => Some ( elements :: Address :: p2shwsh ( & miniscript . encode ( ) , None , network , ) ) , Descriptor :: Cov ( ref cov ) => Some ( cov . commit_ctx . address ( ) ) , } }
Computes the Bitcoin address of the descriptor, if one exists
Computes the Bitcoin address of the descriptor if one exists
&self
network
&'static AddressParams
&self
network
&'static AddressParams