Exemple #1
0
 private void btnLoadWalletInfo_Click(object sender, EventArgs e)
 {
     try
     {
         string url = ConfigurationManager.AppSettings.Get("StratisNodeBaseUrl");
         IWalletServiceProxy walletServiceProxy = new WalletServiceProxy(url);
         var response = walletServiceProxy.GetWalletInfo(txtWalletName.Text.Trim());
         if (response != null)
         {
             txtFilePath.Text       = response.walletFilePath;
             txtNetwork.Text        = response.network;
             txtChainTip.Text       = response.chainTip.ToString();
             txtCreationTime.Text   = response.creationTime.ToString();
             txtIsDecrypted.Text    = response.isDecrypted.ToString();
             txtLastBlockSync.Text  = response.lastBlockSyncedHeight.ToString();
             txtConnectedNodes.Text = response.connectedNodes.ToString();
             txtChainSynced.Text    = response.isChainSynced.ToString();
         }
         else
         {
             MessageBox.Show("Problem in fetching the wallet info. Please contact the support team");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        private void btnGetBalance_Click(object sender, EventArgs e)
        {
            try
            {
                string url = ConfigurationManager.AppSettings.Get("StratisNodeBaseUrl");
                IWalletServiceProxy walletServiceProxy = new WalletServiceProxy(url);
                var response = walletServiceProxy.GetWalletBalance(txtWalletName.Text.Trim());
                if (response != null && response.balances.Count > 0)
                {
                    dataGridView1.DataSource = response.balances[0].addresses;

                    txtAccountName.Text        = response.balances[0].accountName;
                    txtAccountHDPath.Text      = response.balances[0].accountHdPath;
                    txtAccountConfirmed.Text   = response.balances[0].amountConfirmed.ToString();
                    txtAccountUnConfirmed.Text = response.balances[0].amountUnconfirmed.ToString();
                    txtCoinType.Text           = response.balances[0].coinType.ToString();
                    txtSpendableAmount.Text    = response.balances[0].spendableAmount.ToString();
                }
                else
                {
                    dataGridView1.DataSource = null;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #3
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     try
     {
         string url = ConfigurationManager.AppSettings.Get("StratisNodeBaseUrl");
         IWalletServiceProxy walletServiceProxy = new WalletServiceProxy(url);
         string mnemonic = walletServiceProxy.CreateMnemonic(cmbLanguage.Text,
                                                             int.Parse(cmbWordCount.Text));
         richTextBox1.Text = mnemonic.Replace("\"", "");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #4
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtMnemonic.Text))
                {
                    MessageBox.Show("Please specify the Mnemonic", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtMnemonic.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(txtWalletName.Text))
                {
                    MessageBox.Show("Please specify the Wallet Name", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtWalletName.Focus();
                    return;
                }

                if (string.IsNullOrEmpty(txtPassword.Text))
                {
                    MessageBox.Show("Please specify the Wallet Password", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtPassword.Focus();
                    return;
                }


                string url = ConfigurationManager.AppSettings.Get("StratisNodeBaseUrl");
                IWalletServiceProxy walletServiceProxy = new WalletServiceProxy(url);
                var response = walletServiceProxy.CreateWallet(txtMnemonic.Text.Trim(),
                                                               txtPassword.Text.Trim(), txtPassphrase.Text.Trim(),
                                                               txtWalletName.Text.Trim());
                if (response)
                {
                    MessageBox.Show("Successful");
                }
                else
                {
                    MessageBox.Show("Problem in creating the wallet. Please contact the support team");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void btnHistory_Click(object sender, EventArgs e)
        {
            // Pull the wallet history
            try
            {
                historyViewModels.Clear();

                string url = ConfigurationManager.AppSettings.Get("StratisNodeBaseUrl");
                IWalletServiceProxy walletServiceProxy = new WalletServiceProxy(url);
                WalletHistoryRoot   walletHistoryRoot  = walletServiceProxy.GetWalletHistory(txtWalletName.Text.Trim());

                if (walletHistoryRoot != null)
                {
                    foreach (var history in walletHistoryRoot.history)
                    {
                        foreach (var transactionHistory in history.transactionsHistory)
                        {
                            historyViewModels.Add(new HistoryViewModel
                            {
                                accountName      = history.accountName,
                                amount           = transactionHistory.amount,
                                blockIndex       = transactionHistory.blockIndex,
                                coinType         = history.coinType,
                                confirmedInBlock = transactionHistory.confirmedInBlock,
                                fee       = transactionHistory.fee,
                                id        = transactionHistory.id,
                                payments  = transactionHistory.payments,
                                timestamp = transactionHistory.timestamp,
                                toAddress = transactionHistory.toAddress,
                                type      = transactionHistory.type
                            });
                        }
                    }

                    ComboBoxSelectedIndexChanged();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #6
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     try
     {
         string url = ConfigurationManager.AppSettings.Get("StratisNodeBaseUrl");
         IWalletServiceProxy walletServiceProxy = new WalletServiceProxy(url);
         var response = walletServiceProxy.LoadWallet(txtUserName.Text.Trim(),
                                                      txtPassword.Text.Trim());
         if (response)
         {
             MessageBox.Show("Successful");
         }
         else
         {
             MessageBox.Show("Problem in loading the wallet. Please contact the support team");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }