pub fn key_derive(
    mnemonic: &str,
    path: &str,
    password: &str,
    language_code: &str,
) -> Result<ExtendedKey, SignerError> {
    let esk = derive_extended_secret_key_from_mnemonic(mnemonic, path, password, language_code)?;

    let mut address = Address::new_secp256k1(esk.public_key().as_ref())?;

    let bip44_path = BIP44Path::from_string(path)?;

    address.set_network(Network::Mainnet);
    if bip44_path.is_testnet() {
        address.set_network(Network::Testnet);
    }

    Ok(ExtendedKey {
        private_key: PrivateKey(esk.secret_key()),
        public_key: PublicKey::SECP256K1PublicKey(SECP256K1PublicKey::parse(&esk.public_key())?),
        address: address.to_string(),
    })
}
/// Returns a public key, private key and address given a mnemonic, derivation path and a password (support chinese mnemonic)
///
/// # Arguments
///
/// * `mnemonic` - A string containing a 24-words English mnemonic
/// * `path` - A string containing a derivation path
/// * `password` - Password to decrypt seed, if none use and empty string (e.g "")
/// * `language_code` - The language code for the mnemonic (e.g "en" if english words are used)
Returns a public key, private key and address given a mnemonic, derivation path and a password (support chinese mnemonic)
Returns a public key private key and address given a mnemonic derivation path and a password ( support chinese mnemonic )
pub fn key_derive(
    mnemonic: &str,
    path: &str,
    password: &str,
    language_code: &str,
) -> Result<ExtendedKey, SignerError> {
    let esk = derive_extended_secret_key_from_mnemonic(mnemonic, path, password, language_code)?;
    let mut address = Address::new_secp256k1(esk.public_key().as_ref())?;
    let bip44_path = BIP44Path::from_string(path)?;
    address.set_network(Network::Mainnet);
    if bip44_path.is_testnet() {
        address.set_network(Network::Testnet);
    }
    Ok(ExtendedKey {
        private_key: PrivateKey(esk.secret_key()),
        public_key: PublicKey::SECP256K1PublicKey(SECP256K1PublicKey::parse(&esk.public_key())?),
        address: address.to_string(),
    })
}
pub fn key_derive ( mnemonic : & str , path : & str , password : & str , language_code : & str , ) -> Result < ExtendedKey , SignerError > { let esk = derive_extended_secret_key_from_mnemonic ( mnemonic , path , password , language_code ) ? ; let mut address = Address :: new_secp256k1 ( esk . public_key ( ) . as_ref ( ) ) ? ; let bip44_path = BIP44Path :: from_string ( path ) ? ; address . set_network ( Network :: Mainnet ) ; if bip44_path . is_testnet ( ) { address . set_network ( Network :: Testnet ) ; } Ok ( ExtendedKey { private_key : PrivateKey ( esk . secret_key ( ) ) , public_key : PublicKey :: SECP256K1PublicKey ( SECP256K1PublicKey :: parse ( & esk . public_key ( ) ) ? ) , address : address . to_string ( ) , } ) }
Returns a public key, private key and address given a mnemonic, derivation path and a password (support chinese mnemonic)
Returns a public key private key and address given a mnemonic derivation path and a password ( support chinese mnemonic )
mnemonic
&str
path
&str
password
&str
language_code
&str
mnemonic
&str
path
&str
password
&str
language_code
&str