예제 #1
0
        public void TestImportNep2()
        {
            bool result = uut.Contains(testScriptHash);

            Assert.AreEqual(false, result);
            uut.Import(nep2key, "123", 0, 0, 0);
            result = uut.Contains(testScriptHash);
            Assert.AreEqual(true, result);
            uut.DeleteAccount(testScriptHash);
            result = uut.Contains(testScriptHash);
            Assert.AreEqual(false, result);
            JObject wallet = new JObject();

            wallet["name"]     = "name";
            wallet["version"]  = new Version().ToString();
            wallet["scrypt"]   = new ScryptParameters(0, 0, 0).ToJson();
            wallet["accounts"] = new JArray();
            wallet["extra"]    = new JObject();
            uut    = new NEP6Wallet(wallet);
            result = uut.Contains(testScriptHash);
            Assert.AreEqual(false, result);
            uut.Import(nep2key, "123", 0, 0, 0);
            result = uut.Contains(testScriptHash);
            Assert.AreEqual(true, result);
        }
예제 #2
0
        public void TestSave()
        {
            JObject wallet = new JObject();

            wallet["name"]     = "name";
            wallet["version"]  = new System.Version().ToString();
            wallet["scrypt"]   = new ScryptParameters(0, 0, 0).ToJson();
            wallet["accounts"] = new JArray();
            wallet["extra"]    = new JObject();
            File.WriteAllText(wPath, wallet.ToString());
            uut = new NEP6Wallet(wPath);
            uut.Unlock("123");
            uut.CreateAccount(keyPair.PrivateKey);
            bool result = uut.Contains(testScriptHash);

            Assert.AreEqual(true, result);
            uut.Save();
            result = uut.Contains(testScriptHash);
            Assert.AreEqual(true, result);
        }
예제 #3
0
        public void TestContains()
        {
            bool result = uut.Contains(testScriptHash);

            Assert.AreEqual(false, result);
            uut.CreateAccount(testScriptHash);
            result = uut.Contains(testScriptHash);
            Assert.AreEqual(true, result);
        }