use solana_address::Address;
use winterwallet_common::{ID, WINTERWALLET_SEED};
pub fn find_wallet_address(wallet_id: &[u8; 32]) -> (Address, u8) {
Address::find_program_address(&[WINTERWALLET_SEED, wallet_id], &ID)
}
pub fn wallet_id_from_mnemonic(mnemonic: &str) -> Result<[u8; 32], crate::Error> {
let keypair = winterwallet_core::WinternitzKeypair::from_mnemonic(mnemonic, 0)?;
let privkey = keypair.derive::<{ winterwallet_common::WINTERNITZ_SCALARS }>();
let pubkey = privkey.to_pubkey();
Ok(*pubkey.merklize().as_bytes())
}