public void CreateNewWallet()
        {
            var wlt = SimpleWallet.CreateNewSimpleWallet("one", new Password("testtest"), NetworkType.Types.MAIN_NET);

            Assert.AreEqual("", wlt.WalletObj.PrivateKey);
            Assert.AreEqual("one", wlt.WalletObj.Name);
            Assert.AreEqual((byte)104, wlt.Network.GetNetwork());
            Assert.AreEqual("one", wlt.Name);
            Assert.IsNotNull(wlt.WalletObj.Accounts.Account[0].Address);
            Assert.IsNotNull(wlt.WalletObj.Accounts.Account[0].Encrypted);
            Assert.IsNotNull(wlt.WalletObj.Accounts.Account[0].Iv);
            Assert.AreEqual("pass:bip32", wlt.WalletObj.Accounts.Account[0].Algo);
            Assert.AreEqual("", wlt.WalletObj.Accounts.Account[0].Child);
            Assert.AreEqual("Primary", wlt.WalletObj.Accounts.Account[0].Label);
        }
        public void CreateNewWalletWithKey()
        {
            var wlt = SimpleWallet.CreateNewSimpleWallet("two", new Password("testtest"), "9822cf9571a5551ec19720b87a567a20797b75ec4b6711387643fc352fef704e", NetworkType.Types.MAIN_NET);

            Assert.AreEqual("", wlt.WalletObj.PrivateKey);
            Assert.AreEqual("two", wlt.WalletObj.Name);
            Assert.AreEqual(wlt.EncryptedPrivateKey.Decrypt(new Password("testtest")), "9822cf9571a5551ec19720b87a567a20797b75ec4b6711387643fc352fef704e");
            Assert.AreEqual((byte)104, wlt.Network.GetNetwork());
            Assert.AreEqual("two", wlt.Name);
            Assert.IsNotNull(wlt.WalletObj.Accounts.Account[0].Address);
            Assert.IsNotNull(wlt.WalletObj.Accounts.Account[0].Encrypted);
            Assert.IsNotNull(wlt.WalletObj.Accounts.Account[0].Iv);
            Assert.AreEqual("pass:bip32", wlt.WalletObj.Accounts.Account[0].Algo);
            Assert.AreEqual("", wlt.WalletObj.Accounts.Account[0].Child);
            Assert.AreEqual("Primary", wlt.WalletObj.Accounts.Account[0].Label);
        }
Exemplo n.º 3
0
        public static void CreateWallet(string walletName, string password, NetworkType.Types nettype, string filePath)
        {
            var createSimpleWallet = SimpleWallet.CreateNewSimpleWallet(walletName, new Password(password), nettype);

            File.WriteAllText(filePath, createSimpleWallet.WriteFile());
        }