use log::info;

use avalanche_types::key::{hot, mnemonic};

/// cargo run --example key_hot_mnemonic_gen
fn main() {
    // ref. https://github.com/env-logger-rs/env_logger/issues/47
    env_logger::init_from_env(
        env_logger::Env::default().filter_or(env_logger::DEFAULT_FILTER_ENV, "info"),
    );

    // ref. https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md
    // ref. https://iancoleman.io/bip39/
    let phrase = mnemonic::gen_24();
    info!("mnemonic phrase: {}", phrase);

    let key = hot::Key::from_mnemonic_phrase(phrase, String::from("m/44'/9000'/0'")).unwrap();

    let entry = key
        .private_key_info_entry(1)
        .expect("failed private_key_info_entry");
    info!("network ID 1:\n{}", entry);

    let entry = key
        .private_key_info_entry(9999)
        .expect("failed private_key_info_entry");
    info!("network ID 9999:\n{}", entry);
}
