Example #1
0
        public MainWindowViewModel()
        {
            var passwordDlg = new PasswordDialog();

            if (passwordDlg.ShowDialog() == true)
            {
                var password1 = passwordDlg.PasswordPwBox1.Password;
                var password2 = passwordDlg.PasswordPwBox2.Password;

                KeyStore.LogIn(password1, password2);
                KeyStore.GetApiKeys();

                var apiUrl = KeyStore.InfuraMainnetKey;

                httpClient = new HttpClient();
                Infura     = new NodeModel(string.IsNullOrEmpty(KeyStore.InfuraMainnetKey) ? new EthereumNodeService("Infura", $"https://mainnet.infura.io", httpClient) : new EthereumNodeService("Infura", apiUrl, httpClient));

                var client = new HttpClient();

                WhaleAlert = new WhaleAlertModel(client, KeyStore.WhaleAlertKey);
            }

            //Infura = new NodeModel(new EthereumNodeService("Infura", "https://mainnet.infura.io"));
            //Local = new NodeModel(new EthereumNodeService("Local", "http://localhost:8545"), true, true);
            //Local = new NodeModel(new EthereumNodeService(new Web3("http://localhost:8546")));
        }
Example #2
0
        private async Task <IList <CryptoAsset> > GetAllStatus()
        {
            _whaleAlert = new WhaleAlertModel(_httpClient, _keyStore.WhaleAlertKey);
            await _whaleAlert.GetStatus();

            Status = _whaleAlert.Status.Result;
            Count  = _whaleAlert.Status.BlockchainCount;

            var assets = new List <CryptoAsset>();

            if (_whaleAlert.Status.BlockchainCount > 0)
            {
                foreach (var blockchain in _whaleAlert.Status.Blockchains)
                {
                    foreach (var symbol in blockchain.Symbols)
                    {
                        assets.Add(new CryptoAsset(blockchain.Name, symbol, blockchain.Status.ToString()));
                    }
                }
            }

            return(assets);
        }