pub fn key_derive_from_seed(seed: &[u8], path: &str) -> Result<ExtendedKey, SignerError> {
    let esk = derive_extended_secret_key(seed, path)?;

    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 seed and derivation path
///
/// # Arguments
///
/// * `seed` - A seed as bytes array
/// * `path` - A string containing a derivation path
///
Returns a public key, private key and address given a seed and derivation path
Returns a public key private key and address given a seed and derivation path
pub fn key_derive_from_seed(seed: &[u8], path: &str) -> Result<ExtendedKey, SignerError> {
    let esk = derive_extended_secret_key(seed, path)?;
    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_from_seed ( seed : & [ u8 ] , path : & str ) -> Result < ExtendedKey , SignerError > { let esk = derive_extended_secret_key ( seed , path ) ? ; 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 seed and derivation path
Returns a public key private key and address given a seed and derivation path
seed
&[u8]
path
&str
seed
&[u8]
path
&str