pub async fn hex_public_key_to_bech32_address(&self, hex: &str, bech32_hrp: Option<&str>) -> crate::Result<String> {
        let mut public_key = [0u8; ED25519_ADDRESS_LENGTH];
        hex::decode_to_slice(&hex, &mut public_key)?;

        let address = Blake2b256::digest(&public_key)
            .try_into()
            .map_err(|_e| Error::Blake2b256Error("Hashing the public key failed."))?;
        let address: Ed25519Address = Ed25519Address::new(address);
        match bech32_hrp {
            Some(hrp) => Ok(Address::Ed25519(address).to_bech32(hrp)),
            None => Ok(Address::Ed25519(address).to_bech32(self.get_bech32_hrp().await?.as_str())),
        }
    }
/// Transforms a hex encoded public key to a bech32 encoded address
Transforms a hex encoded public key to a bech32 encoded address
Transforms a hex encoded public key to a bech32 encoded address
pub async fn hex_public_key_to_bech32_address(&self, hex: &str, bech32_hrp: Option<&str>) -> crate::Result<String> {
        let mut public_key = [0u8; ED25519_ADDRESS_LENGTH];
        hex::decode_to_slice(&hex, &mut public_key)?;
        let address = Blake2b256::digest(&public_key)
            .try_into()
            .map_err(|_e| Error::Blake2b256Error("Hashing the public key failed."))?;
        let address: Ed25519Address = Ed25519Address::new(address);
        match bech32_hrp {
            Some(hrp) => Ok(Address::Ed25519(address).to_bech32(hrp)),
            None => Ok(Address::Ed25519(address).to_bech32(self.get_bech32_hrp().await?.as_str())),
        }
    }
pub async fn hex_public_key_to_bech32_address ( & self , hex : & str , bech32_hrp : Option < & str > ) -> crate :: Result < String > { let mut public_key = [ 0u8 ; ED25519_ADDRESS_LENGTH ] ; hex :: decode_to_slice ( & hex , & mut public_key ) ? ; let address = Blake2b256 :: digest ( & public_key ) . try_into ( ) . map_err ( | _e | Error :: Blake2b256Error ( " " ) ) ? ; let address : Ed25519Address = Ed25519Address :: new ( address ) ; match bech32_hrp { Some ( hrp ) => Ok ( Address :: Ed25519 ( address ) . to_bech32 ( hrp ) ) , None => Ok ( Address :: Ed25519 ( address ) . to_bech32 ( self . get_bech32_hrp ( ) . await ? . as_str ( ) ) ) , } }
Transforms a hex encoded public key to a bech32 encoded address
Transforms a hex encoded public key to a bech32 encoded address
&self
hex
&str
bech32_hrp
Option<&str>
&self
hex
&str
bech32_hrp
Option<&str>