fuels-rs icon indicating copy to clipboard operation
fuels-rs copied to clipboard

docs: Update wallet.rs in-line BIP doc

Open K1-R1 opened this issue 9 months ago • 0 comments

In wallet.rs:

/// Creates a new wallet from a mnemonic phrase.
/// It takes a path to a BIP32 derivation path.
pub fn new_from_mnemonic_phrase_with_path(

The in-line docs specify that the function takes a BIP32 derivation path, however it is not limited to only BIP32, and in the function new_from_mnemonic_phrasea BIP44 path is used when internally calling new_from_mnemonic_phrase_with_path:

pub const DEFAULT_DERIVATION_PATH_PREFIX: &str = "m/44'/1179993420'";

/// Creates a new wallet from a mnemonic phrase.
/// The default derivation path is used.
pub fn new_from_mnemonic_phrase(phrase: &str, provider: Option<Provider>) -> Result<Self> {
    let path = format!("{DEFAULT_DERIVATION_PATH_PREFIX}/0'/0/0");
    Self::new_from_mnemonic_phrase_with_path(phrase, provider, &path)
}

The in-line docs should clarify that the function is not only limited to BIP32 derivation paths.

K1-R1 avatar May 09 '24 08:05 K1-R1