pub fn derive_bitcoin_address(
mnemonic_phrase: &str,
derivation_path_str: Option<&str>,
network: Option<Network>,
bip39_passphrase: Option<&str>,
) -> Result<GetAddressResponse, DerivationError>Expand description
Derives a Bitcoin address from a mnemonic phrase, derivation path, network type, and optional BIP39 passphrase.
§Arguments
mnemonic_phrase- A BIP39 mnemonic phrase (space-separated words)derivation_path_str- Optional BIP32 derivation path (e.g., “m/84’/0’/0’/0/0”). Default is “m/84’/0’/0’/0/0”.network- Optional network type. Default is Network::Bitcoin.bip39_passphrase- Optional BIP39 passphrase. Default is an empty string.
§Returns
Result<GetAddressResponse, DerivationError>- Address information or an error
§Errors
DerivationError::InvalidDerivationPath- If the path format is invalid or network mismatchesDerivationError::InvalidNetworkType- If an unsupported network is specifiedDerivationError::InvalidPurposeField- If the purpose field is not supportedDerivationError::Bip39Error- If the mnemonic is invalidDerivationError::Bip32Error- If key derivation failsDerivationError::SecpError- If secp256k1 operations failDerivationError::BitcoinError- If address generation failsDerivationError::InvalidXOnlyPubkey- If creating an X-only public key fails