Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var    rpcClient      = new RpcClient(new Uri("http://neo.org:10332"));
            var    NeoApiServices = new NeoApiService(rpcClient);
            var    walletManager  = new WalletManager(new NeoScanRestService(NeoScanNet.MainNet), rpcClient);
            string accresult      = "";

            try
            {
                var acc = walletManager.GetDefaultAccount();
                accresult = JsonConvert.SerializeObject(acc, Formatting.Indented);
                Console.WriteLine(accresult);
                Process.Start("https://neotracker.io/address/" + acc.Address);
            }
            catch
            {
                var cacc = walletManager.CreateAccount("metinyakarNet", "wordpress").Result;
                cacc.IsDefault = true;
                walletManager.AddAccount(cacc);
                //walletManager.DeleteAccount(cacc.Address.ToAddress());
                var acc = walletManager.GetAccount(cacc.Address);
                accresult = JsonConvert.SerializeObject(acc, Formatting.Indented);
                File.WriteAllText("neoAccResult.txt", accresult);
                Console.WriteLine(accresult);
                string trackerurl = "https://neotracker.io/address/" + acc.Address.ToAddress();
                Process.Start(trackerurl);
            }

            Console.Read();
        }
Ejemplo n.º 2
0
        public static void DeleteAccountTest()
        {
            Wallet        wallet        = Wallet.FromJson(walletJson);
            WalletManager walletManager = new WalletManager(wallet);

            var createdAccount = walletManager.CreateAccount("Test Account");

            walletManager.AddAccount(createdAccount);
            walletManager.DeleteAccount(createdAccount);

            Assert.DoesNotContain(createdAccount, wallet.Accounts);
        }
Ejemplo n.º 3
0
        public static void DeleteAccountByAddressTest()
        {
            Wallet        wallet        = Wallet.FromJson(walletJson);
            WalletManager walletManager = new WalletManager(wallet);

            var scriptHash      = "AQLASLtT6pWbThcSCYU1biVqhMnzhTgLFq".ToScriptHash();
            var accountToDelete = new Account(scriptHash);

            walletManager.AddAccount(accountToDelete);
            walletManager.DeleteAccount("AQLASLtT6pWbThcSCYU1biVqhMnzhTgLFq");

            Assert.DoesNotContain(accountToDelete, wallet.Accounts);
        }