コード例 #1
0
        public NEP6Wallet(MyJson.JsonNode_Object wallet)
        {
            this.accounts = new Dictionary <string, NEP6Account>();

            this.scrypt = ScryptParameters.FromJson(wallet["scrypt"].AsDict());
            var accounts = wallet["accounts"].AsList();

            foreach (MyJson.JsonNode_Object a in accounts)
            {
                var ac = NEP6Account.FromJson(a, this);
                this.accounts[Helper.Bytes2HexString(ac.ScriptHash)] = ac;
            }
        }
コード例 #2
0
        public NEP6Wallet(string path)
        {
            this.accounts = new Dictionary <string, NEP6Account>();

            this.path = path;
            if (File.Exists(path))
            {
                string txt = System.IO.File.ReadAllText(path);
                MyJson.JsonNode_Object wallet = MyJson.Parse(txt) as MyJson.JsonNode_Object;

                this.scrypt = ScryptParameters.FromJson(wallet["scrypt"] as MyJson.JsonNode_Object);
                var accounts = wallet["accounts"].AsList();
                foreach (MyJson.JsonNode_Object a in accounts)
                {
                    var ac = NEP6Account.FromJson(a, this);
                    this.accounts[Helper.Bytes2HexString(ac.ScriptHash)] = ac;
                }
            }
            else
            {
                this.scrypt = ScryptParameters.Default;
            }
        }