private void LoadFromJson(JObject wallet, out ScryptParameters scrypt, out Dictionary <UInt160, TLP6Account> accounts, out JObject extra) { this.name = wallet["name"]?.AsString(); this.version = Version.Parse(wallet["version"].AsString()); scrypt = ScryptParameters.FromJson(wallet["scrypt"]); accounts = ((JArray)wallet["accounts"]).Select(p => TLP6Account.FromJson(p, this)).ToDictionary(p => p.ScriptHash); extra = wallet["extra"]; }
public TLP6Wallet(string path, string name = null) { this.path = path; if (File.Exists(path)) { JObject wallet; using (StreamReader reader = new StreamReader(path)) { wallet = JObject.Parse(reader); } LoadFromJson(wallet, out Scrypt, out accounts, out extra); } else { this.name = name; this.version = Version.Parse("1.0"); this.Scrypt = ScryptParameters.Default; this.accounts = new Dictionary <UInt160, TLP6Account>(); this.extra = JObject.Null; } }