Beispiel #1
0
        private void LoadAccounts()
        {
            Accounts = new List <Account>();

            var accounts = EthereumService.GetAccounts();

            cmdAccounts.Items.Clear();

            foreach (var account in accounts)
            {
                var a = new Account();
                a.Address = account;

                var filter = new Filter(fromBlock: "0x01")
                {
                    Address = a.Address
                };

                a.FilterId = EthereumService.NewFilter(filter);
                Accounts.Add(a);

                var sign = EthereumService.Sign(a.Address, "Pass@123");

                a.Unlocked = sign != null;

                cmdAccounts.Items.Add(a);
                EthereumService.UnlockAccount(a.Address, "Pass@123");
            }

            if (accounts.Any())
            {
                cmdAccounts.SelectedIndex = 0;
            }
        }
Beispiel #2
0
        private void LoadAccounts()
        {
            Accounts = new List <Account>();

            var accounts = EthereumService.GetAccounts();



            foreach (var account in accounts)
            {
                var a = new Account();
                a.Address = account;

                var filter = new Filter(fromBlock: "0x01")
                {
                    Address = a.Address
                };

                a.FilterId = EthereumService.NewFilter(filter);
                Accounts.Add(a);
                ListViewItem item = new ListViewItem(a.Address);
                var          sign = EthereumService.Sign(a.Address, "Pass@123");
                lstboxAccountList.Items.Add(a.Address);

                a.Unlocked = sign != null;
                EthereumService.UnlockAccount(a.Address, "Pass@123");
            }
        }
Beispiel #3
0
        private List <EthAccount> LoadAccounts()
        {
            var privateConnection = new ConnectionOptions()
            {
                Port = "8545",
                Url  = "http://localhost"
            };

            ethereumService = new EthereumService(privateConnection);
            Accounts        = new List <EthAccount>();

            var accounts = ethereumService.GetAccounts();



            foreach (var account in accounts)
            {
                var a = new EthAccount();
                a.Address = account;

                var filter = new Filter(fromBlock: "0x01")
                {
                    Address = a.Address
                };

                a.FilterId = ethereumService.NewFilter(filter);
                Accounts.Add(a);
                var sign = ethereumService.Sign(a.Address, "Pass@123");
                a.Unlocked = sign != null;

                ethereumService.UnlockAccount(a.Address, "Pass@123");

                bool result = ethereumService.UnlockAccount(account, "Pass@123");
                if (result)
                {
                    var balance = ethereumService.GetBalance(account, BlockTag.Latest);
                    //var specifier = "0,0.000";
                    a.Balance = balance.WeiToEther();//string.Format("{0} Eth", balance.WeiToEther().ToString("0,0.000"));
                }
            }
            return(Accounts);
        }