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); }
public void TestSave() { JObject wallet = new(); wallet["name"] = "name"; wallet["version"] = new Version("1.0").ToString(); wallet["scrypt"] = new ScryptParameters(2, 1, 1).ToJson(); wallet["accounts"] = new JArray(); wallet["extra"] = new JObject(); File.WriteAllText(wPath, wallet.ToString()); uut = new NEP6Wallet(wPath, "123", ProtocolSettings.Default); uut.CreateAccount(keyPair.PrivateKey); bool result = uut.Contains(testScriptHash); Assert.AreEqual(true, result); uut.Save(); result = uut.Contains(testScriptHash); Assert.AreEqual(true, result); }
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); }
public void TestMigrate() { string path = GetRandomPath(); UserWallet uw = UserWallet.Create(path, "123"); uw.CreateAccount(keyPair.PrivateKey); string npath = Path.Combine(path, "w.json"); NEP6Wallet nw = NEP6Wallet.Migrate(npath, path, "123"); bool result = nw.Contains(testScriptHash); Assert.AreEqual(true, result); }
public void TestMigrate() { string path = GetRandomPath(); UserWallet uw = UserWallet.Create(path, "123", ProtocolSettings.Default); uw.CreateAccount(keyPair.PrivateKey); string npath = CreateWalletFile(); // Scrypt test values NEP6Wallet nw = NEP6Wallet.Migrate(npath, path, "123", ProtocolSettings.Default); bool result = nw.Contains(testScriptHash); Assert.AreEqual(true, result); uw.Delete(); nw.Delete(); }
public void TestContains() { bool result = uut.Contains(testScriptHash); Assert.AreEqual(false, result); uut.CreateAccount(testScriptHash); result = uut.Contains(testScriptHash); Assert.AreEqual(true, result); }