pub trait ToPublicKey: MiniscriptKey {
    // Required methods
    fn to_public_key(&self) -> PublicKey;
    fn to_sha256(hash: &<Self as MiniscriptKey>::Sha256) -> Hash;
    fn to_hash256(hash: &<Self as MiniscriptKey>::Hash256) -> Hash;
    fn to_ripemd160(hash: &<Self as MiniscriptKey>::Ripemd160) -> Hash;
    fn to_hash160(hash: &<Self as MiniscriptKey>::Hash160) -> Hash;

    // Provided methods
    fn to_x_only_pubkey(&self) -> XOnlyPublicKey { ... }
    fn to_pubkeyhash(&self, sig_type: SigType) -> Hash { ... }
}
Expand description

Trait describing public key types which can be converted to bitcoin pubkeys

Required Methods§

source

fn to_public_key(&self) -> PublicKey

Converts an object to a public key

source

fn to_sha256(hash: &<Self as MiniscriptKey>::Sha256) -> Hash

Converts the generic associated MiniscriptKey::Sha256 to [sha256::Hash]

source

fn to_hash256(hash: &<Self as MiniscriptKey>::Hash256) -> Hash

Converts the generic associated MiniscriptKey::Hash256 to hash256::Hash

source

fn to_ripemd160(hash: &<Self as MiniscriptKey>::Ripemd160) -> Hash

Converts the generic associated MiniscriptKey::Ripemd160 to [ripemd160::Hash]

source

fn to_hash160(hash: &<Self as MiniscriptKey>::Hash160) -> Hash

Converts the generic associated MiniscriptKey::Hash160 to [hash160::Hash]

Provided Methods§

source

fn to_x_only_pubkey(&self) -> XOnlyPublicKey

Convert an object to x-only pubkey

source

fn to_pubkeyhash(&self, sig_type: SigType) -> Hash

Obtain the public key hash for this MiniscriptKey Expects an argument to specify the signature type. This would determine whether to serialize the key as 32 byte x-only pubkey or regular public key when computing the hash160

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl ToPublicKey for PublicKey

source§

fn to_public_key(&self) -> PublicKey

source§

fn to_sha256(hash: &Hash) -> Hash

source§

fn to_hash256(hash: &Hash) -> Hash

source§

fn to_ripemd160(hash: &Hash) -> Hash

source§

fn to_hash160(hash: &Hash) -> Hash

source§

impl ToPublicKey for PublicKey

source§

fn to_public_key(&self) -> PublicKey

source§

fn to_sha256(hash: &Hash) -> Hash

source§

fn to_hash256(hash: &Hash) -> Hash

source§

fn to_ripemd160(hash: &Hash) -> Hash

source§

fn to_hash160(hash: &Hash) -> Hash

source§

impl ToPublicKey for XOnlyPublicKey

source§

fn to_public_key(&self) -> PublicKey

source§

fn to_x_only_pubkey(&self) -> XOnlyPublicKey

source§

fn to_sha256(hash: &Hash) -> Hash

source§

fn to_hash256(hash: &Hash) -> Hash

source§

fn to_ripemd160(hash: &Hash) -> Hash

source§

fn to_hash160(hash: &Hash) -> Hash

Implementors§