public static Wallet Open(string privateKey, EnvironmentInfo environment) { Wallet wallet = new Wallet(); wallet.IsOpen = true; wallet.PrivateKey = privateKey; wallet.Environment = environment; wallet.EcKey = GetECKey(privateKey); wallet.AddressBytes = wallet.EcKey.PubKey.Hash.ToBytes(); wallet.Address = CryptoUtility.GetAddress(wallet.AddressBytes, environment.Hrp); wallet.PubKeyForSign = GetPubKeyForSign(wallet.EcKey.PubKey.ToBytes()); wallet.MnemonicWords = ""; return(wallet); }
public static Wallet Open(string mnemonicWords, string password, EnvironmentInfo environment) { var key = CryptoUtility.GetKeyFromMnemonic(mnemonicWords, password, environment.Hrp); Wallet wallet = new Wallet(); wallet.IsOpen = true; wallet.PrivateKey = key.PrivateKey; wallet.Environment = environment; wallet.EcKey = GetECKey(key.PrivateKey); wallet.AddressBytes = wallet.EcKey.PubKey.Hash.ToBytes(); wallet.Address = CryptoUtility.GetAddress(wallet.AddressBytes, environment.Hrp); wallet.PubKeyForSign = GetPubKeyForSign(wallet.EcKey.PubKey.ToBytes()); wallet.MnemonicWords = mnemonicWords; return(wallet); }