pub fn key_from_mnemonic(&self, mnemonic_words: &str) -> Result<KeyEntry, Error> {
        // Get the private key from the mnemonic
        let private_key = private_key_from_mnemonic(mnemonic_words)?;

        // Get the public Key from the private key
        let public_key = ExtendedPubKey::from_private(&Secp256k1::new(), &private_key);

        // Get address from the public Key
        let address = get_address(public_key);

        // Compute Bech32 account
        let account = bech32::encode(self.account_prefix(), address.to_base32(), Variant::Bech32)
            .map_err(|e| Kind::Bech32Account.context(e))?;

        Ok(KeyEntry {
            public_key,
            private_key,
            address,
            account,
        })
    }
/// Add a key entry in the store using a mnemonic.
Add a key entry in the store using a mnemonic.
Add a key entry in the store using a mnemonic .
pub fn key_from_mnemonic(&self, mnemonic_words: &str) -> Result<KeyEntry, Error> {
        // Get the private key from the mnemonic
        let private_key = private_key_from_mnemonic(mnemonic_words)?;
        // Get the public Key from the private key
        let public_key = ExtendedPubKey::from_private(&Secp256k1::new(), &private_key);
        // Get address from the public Key
        let address = get_address(public_key);
        // Compute Bech32 account
        let account = bech32::encode(self.account_prefix(), address.to_base32(), Variant::Bech32)
            .map_err(|e| Kind::Bech32Account.context(e))?;
        Ok(KeyEntry {
            public_key,
            private_key,
            address,
            account,
        })
    }
pub fn key_from_mnemonic ( & self , mnemonic_words : & str ) -> Result < KeyEntry , Error > { // Get the private key from the mnemonic let private_key = private_key_from_mnemonic ( mnemonic_words ) ? ; // Get the public Key from the private key let public_key = ExtendedPubKey :: from_private ( & Secp256k1 :: new ( ) , & private_key ) ; // Get address from the public Key let address = get_address ( public_key ) ; // Compute Bech32 account let account = bech32 :: encode ( self . account_prefix ( ) , address . to_base32 ( ) , Variant :: Bech32 ) . map_err ( | e | Kind :: Bech32Account . context ( e ) ) ? ; Ok ( KeyEntry { public_key , private_key , address , account , } ) }
Add a key entry in the store using a mnemonic.
Add a key entry in the store using a mnemonic .
&self
mnemonic_words
&str
&self
mnemonic_words
&str