mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2025-12-06 16:43:01 +11:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
7388710704
|
|||
|
92bef9ef5d
|
|||
|
03a6b4d6da
|
39
FireWallet/MainForm.Designer.cs
generated
39
FireWallet/MainForm.Designer.cs
generated
@@ -39,6 +39,7 @@ namespace FireWallet
|
|||||||
toolStripStatusLabelNetwork = new ToolStripStatusLabel();
|
toolStripStatusLabelNetwork = new ToolStripStatusLabel();
|
||||||
toolStripStatusLabelstatus = new ToolStripStatusLabel();
|
toolStripStatusLabelstatus = new ToolStripStatusLabel();
|
||||||
toolStripStatusLabelaccount = new ToolStripStatusLabel();
|
toolStripStatusLabelaccount = new ToolStripStatusLabel();
|
||||||
|
toolStripStatusLabelLedger = new ToolStripStatusLabel();
|
||||||
toolStripSplitButtonlogout = new ToolStripSplitButton();
|
toolStripSplitButtonlogout = new ToolStripSplitButton();
|
||||||
timerNodeStatus = new System.Windows.Forms.Timer(components);
|
timerNodeStatus = new System.Windows.Forms.Timer(components);
|
||||||
panelaccount = new Panel();
|
panelaccount = new Panel();
|
||||||
@@ -80,6 +81,7 @@ namespace FireWallet
|
|||||||
labelSendingTo = new Label();
|
labelSendingTo = new Label();
|
||||||
labelSendPrompt = new Label();
|
labelSendPrompt = new Label();
|
||||||
panelRecieve = new Panel();
|
panelRecieve = new Panel();
|
||||||
|
buttonAddressVerify = new Button();
|
||||||
pictureBoxReceiveQR = new PictureBox();
|
pictureBoxReceiveQR = new PictureBox();
|
||||||
labelReceive2 = new Label();
|
labelReceive2 = new Label();
|
||||||
textBoxReceiveAddress = new TextBox();
|
textBoxReceiveAddress = new TextBox();
|
||||||
@@ -111,7 +113,6 @@ namespace FireWallet
|
|||||||
textBoxExAddr = new TextBox();
|
textBoxExAddr = new TextBox();
|
||||||
labelSettings4 = new Label();
|
labelSettings4 = new Label();
|
||||||
textBoxExTX = new TextBox();
|
textBoxExTX = new TextBox();
|
||||||
toolStripStatusLabelLedger = new ToolStripStatusLabel();
|
|
||||||
statusStripmain.SuspendLayout();
|
statusStripmain.SuspendLayout();
|
||||||
panelaccount.SuspendLayout();
|
panelaccount.SuspendLayout();
|
||||||
groupBoxaccount.SuspendLayout();
|
groupBoxaccount.SuspendLayout();
|
||||||
@@ -167,6 +168,13 @@ namespace FireWallet
|
|||||||
toolStripStatusLabelaccount.Size = new Size(55, 17);
|
toolStripStatusLabelaccount.Size = new Size(55, 17);
|
||||||
toolStripStatusLabelaccount.Text = "Account:";
|
toolStripStatusLabelaccount.Text = "Account:";
|
||||||
//
|
//
|
||||||
|
// toolStripStatusLabelLedger
|
||||||
|
//
|
||||||
|
toolStripStatusLabelLedger.Margin = new Padding(50, 3, 50, 2);
|
||||||
|
toolStripStatusLabelLedger.Name = "toolStripStatusLabelLedger";
|
||||||
|
toolStripStatusLabelLedger.Size = new Size(71, 17);
|
||||||
|
toolStripStatusLabelLedger.Text = "Cold Wallet:";
|
||||||
|
//
|
||||||
// toolStripSplitButtonlogout
|
// toolStripSplitButtonlogout
|
||||||
//
|
//
|
||||||
toolStripSplitButtonlogout.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
toolStripSplitButtonlogout.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||||
@@ -619,16 +627,30 @@ namespace FireWallet
|
|||||||
//
|
//
|
||||||
// panelRecieve
|
// panelRecieve
|
||||||
//
|
//
|
||||||
|
panelRecieve.Controls.Add(buttonAddressVerify);
|
||||||
panelRecieve.Controls.Add(pictureBoxReceiveQR);
|
panelRecieve.Controls.Add(pictureBoxReceiveQR);
|
||||||
panelRecieve.Controls.Add(labelReceive2);
|
panelRecieve.Controls.Add(labelReceive2);
|
||||||
panelRecieve.Controls.Add(textBoxReceiveAddress);
|
panelRecieve.Controls.Add(textBoxReceiveAddress);
|
||||||
panelRecieve.Controls.Add(labelReceive1);
|
panelRecieve.Controls.Add(labelReceive1);
|
||||||
panelRecieve.Location = new Point(1057, 62);
|
panelRecieve.Location = new Point(117, 34);
|
||||||
panelRecieve.Name = "panelRecieve";
|
panelRecieve.Name = "panelRecieve";
|
||||||
panelRecieve.Size = new Size(995, 523);
|
panelRecieve.Size = new Size(995, 523);
|
||||||
panelRecieve.TabIndex = 17;
|
panelRecieve.TabIndex = 17;
|
||||||
panelRecieve.Visible = false;
|
panelRecieve.Visible = false;
|
||||||
//
|
//
|
||||||
|
// buttonAddressVerify
|
||||||
|
//
|
||||||
|
buttonAddressVerify.FlatStyle = FlatStyle.Flat;
|
||||||
|
buttonAddressVerify.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
buttonAddressVerify.Location = new Point(769, 110);
|
||||||
|
buttonAddressVerify.Name = "buttonAddressVerify";
|
||||||
|
buttonAddressVerify.Size = new Size(126, 32);
|
||||||
|
buttonAddressVerify.TabIndex = 21;
|
||||||
|
buttonAddressVerify.Text = "Create && Verify";
|
||||||
|
buttonAddressVerify.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddressVerify.Visible = false;
|
||||||
|
buttonAddressVerify.Click += buttonAddressVerify_Click;
|
||||||
|
//
|
||||||
// pictureBoxReceiveQR
|
// pictureBoxReceiveQR
|
||||||
//
|
//
|
||||||
pictureBoxReceiveQR.Location = new Point(391, 190);
|
pictureBoxReceiveQR.Location = new Point(391, 190);
|
||||||
@@ -937,28 +959,22 @@ namespace FireWallet
|
|||||||
textBoxExTX.Size = new Size(307, 29);
|
textBoxExTX.Size = new Size(307, 29);
|
||||||
textBoxExTX.TabIndex = 1;
|
textBoxExTX.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// toolStripStatusLabelLedger
|
|
||||||
//
|
|
||||||
toolStripStatusLabelLedger.Margin = new Padding(50, 3, 50, 2);
|
|
||||||
toolStripStatusLabelLedger.Name = "toolStripStatusLabelLedger";
|
|
||||||
toolStripStatusLabelLedger.Size = new Size(71, 17);
|
|
||||||
toolStripStatusLabelLedger.Text = "Cold Wallet:";
|
|
||||||
//
|
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1152, 575);
|
ClientSize = new Size(1152, 575);
|
||||||
|
Controls.Add(panelaccount);
|
||||||
|
Controls.Add(panelRecieve);
|
||||||
Controls.Add(panelSettings);
|
Controls.Add(panelSettings);
|
||||||
Controls.Add(panelDomains);
|
Controls.Add(panelDomains);
|
||||||
Controls.Add(panelRecieve);
|
|
||||||
Controls.Add(panelSend);
|
Controls.Add(panelSend);
|
||||||
Controls.Add(panelPortfolio);
|
Controls.Add(panelPortfolio);
|
||||||
Controls.Add(panelNav);
|
Controls.Add(panelNav);
|
||||||
Controls.Add(panelaccount);
|
|
||||||
Controls.Add(statusStripmain);
|
Controls.Add(statusStripmain);
|
||||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||||
Name = "MainForm";
|
Name = "MainForm";
|
||||||
|
Opacity = 0D;
|
||||||
Text = "FireWallet";
|
Text = "FireWallet";
|
||||||
FormClosing += MainForm_Closing;
|
FormClosing += MainForm_Closing;
|
||||||
Load += MainForm_Load;
|
Load += MainForm_Load;
|
||||||
@@ -1074,5 +1090,6 @@ namespace FireWallet
|
|||||||
private GroupBox groupBoxSettingsWallet;
|
private GroupBox groupBoxSettingsWallet;
|
||||||
private Button buttonSettingsRescan;
|
private Button buttonSettingsRescan;
|
||||||
private ToolStripStatusLabel toolStripStatusLabelLedger;
|
private ToolStripStatusLabel toolStripStatusLabelLedger;
|
||||||
|
private Button buttonAddressVerify;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,13 +39,16 @@ namespace FireWallet
|
|||||||
public MainForm()
|
public MainForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
panelaccount.Visible = true;
|
||||||
}
|
}
|
||||||
private void MainForm_Load(object sender, EventArgs e)
|
private async void MainForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
watchOnly = false;
|
watchOnly = false;
|
||||||
account = "";
|
account = "";
|
||||||
timerNodeStatus.Stop();
|
timerNodeStatus.Stop();
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
UpdateTheme();
|
||||||
|
if (await LoadNode() != true) this.Close();
|
||||||
|
|
||||||
if (userSettings.ContainsKey("hide-splash"))
|
if (userSettings.ContainsKey("hide-splash"))
|
||||||
{
|
{
|
||||||
@@ -57,9 +60,14 @@ namespace FireWallet
|
|||||||
ss.Dispose();
|
ss.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Show splash screen
|
||||||
|
SplashScreen ss = new SplashScreen();
|
||||||
|
ss.ShowDialog();
|
||||||
|
ss.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
UpdateTheme();
|
|
||||||
LoadNode();
|
|
||||||
|
|
||||||
|
|
||||||
// Edit the theme of the navigation panel
|
// Edit the theme of the navigation panel
|
||||||
@@ -79,16 +87,16 @@ namespace FireWallet
|
|||||||
GetAccounts();
|
GetAccounts();
|
||||||
|
|
||||||
AddLog("Loaded");
|
AddLog("Loaded");
|
||||||
|
Opacity = 1;
|
||||||
batchMode = false;
|
batchMode = false;
|
||||||
textBoxaccountpassword.Focus();
|
textBoxaccountpassword.Focus();
|
||||||
timerNodeStatus.Start();
|
|
||||||
}
|
}
|
||||||
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
AddLog("Closing");
|
AddLog("Closing");
|
||||||
if (hsdProcess != null)
|
if (hsdProcess != null)
|
||||||
{
|
{
|
||||||
this.Hide();
|
this.Opacity = 0;
|
||||||
hsdProcess.Kill();
|
hsdProcess.Kill();
|
||||||
AddLog("HSD Closed");
|
AddLog("HSD Closed");
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
@@ -109,7 +117,7 @@ namespace FireWallet
|
|||||||
|
|
||||||
|
|
||||||
#region Settings
|
#region Settings
|
||||||
private async void LoadNode()
|
private async Task<bool> LoadNode()
|
||||||
{
|
{
|
||||||
HSD = false;
|
HSD = false;
|
||||||
if (!File.Exists(dir + "node.txt"))
|
if (!File.Exists(dir + "node.txt"))
|
||||||
@@ -123,7 +131,8 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
AddLog("Node setup failed");
|
AddLog("Node setup failed");
|
||||||
this.Close();
|
this.Close();
|
||||||
return;
|
await Task.Delay(1000);
|
||||||
|
AddLog("Close Failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamReader sr = new StreamReader(dir + "node.txt");
|
StreamReader sr = new StreamReader(dir + "node.txt");
|
||||||
@@ -141,7 +150,8 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
AddLog("Node Settings file is missing key");
|
AddLog("Node Settings file is missing key");
|
||||||
this.Close();
|
this.Close();
|
||||||
return;
|
await Task.Delay(1000);
|
||||||
|
AddLog("Close Failed");
|
||||||
}
|
}
|
||||||
network = Convert.ToInt32(nodeSettings["Network"]);
|
network = Convert.ToInt32(nodeSettings["Network"]);
|
||||||
switch (network)
|
switch (network)
|
||||||
@@ -181,33 +191,52 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
hsdProcess = new Process();
|
hsdProcess = new Process();
|
||||||
|
|
||||||
hsdProcess.StartInfo.CreateNoWindow = true;
|
bool hideScreen = true;
|
||||||
|
if (nodeSettings.ContainsKey("HideScreen"))
|
||||||
hsdProcess.StartInfo.RedirectStandardInput = true;
|
|
||||||
hsdProcess.StartInfo.RedirectStandardOutput = false;
|
|
||||||
hsdProcess.StartInfo.UseShellExecute = false;
|
|
||||||
hsdProcess.StartInfo.RedirectStandardError = false;
|
|
||||||
hsdProcess.StartInfo.FileName = "node.exe";
|
|
||||||
hsdProcess.StartInfo.Arguments = dir + "hsd/bin/hsd --index-tx --index-address --api-key" + nodeSettings["Key"];
|
|
||||||
|
|
||||||
string bobPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Bob\\hsd_data";
|
|
||||||
if (Directory.Exists(bobPath))
|
|
||||||
{
|
{
|
||||||
hsdProcess.StartInfo.Arguments = hsdProcess.StartInfo.Arguments + " --prefix " + bobPath;
|
if (nodeSettings["HideScreen"].ToLower() == "false")
|
||||||
|
{
|
||||||
|
hideScreen = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
hsdProcess.Start();
|
try
|
||||||
|
{
|
||||||
|
hsdProcess.StartInfo.CreateNoWindow = hideScreen;
|
||||||
|
|
||||||
|
hsdProcess.StartInfo.RedirectStandardInput = true;
|
||||||
|
hsdProcess.StartInfo.RedirectStandardOutput = false;
|
||||||
|
hsdProcess.StartInfo.UseShellExecute = false;
|
||||||
|
hsdProcess.StartInfo.RedirectStandardError = false;
|
||||||
|
hsdProcess.StartInfo.FileName = "node.exe";
|
||||||
|
hsdProcess.StartInfo.Arguments = dir + "hsd/bin/hsd --index-tx --index-address --api-key " + nodeSettings["Key"];
|
||||||
|
|
||||||
|
string bobPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Bob\\hsd_data";
|
||||||
|
if (Directory.Exists(bobPath))
|
||||||
|
{
|
||||||
|
hsdProcess.StartInfo.Arguments = hsdProcess.StartInfo.Arguments + " --prefix " + bobPath;
|
||||||
|
}
|
||||||
|
hsdProcess.Start();
|
||||||
|
// Wait for HSD to start
|
||||||
|
await Task.Delay(2000);
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
AddLog("HSD Failed to start");
|
||||||
|
AddLog(ex.Message);
|
||||||
|
this.Close();
|
||||||
|
await Task.Delay(1000);
|
||||||
|
AddLog("Close Failed");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
timerNodeStatus.Start();
|
||||||
NodeStatus();
|
NodeStatus();
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
private void LoadSettings()
|
private void LoadSettings()
|
||||||
{
|
{
|
||||||
|
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
|
||||||
if (!File.Exists(dir + "settings.txt"))
|
if (!File.Exists(dir + "settings.txt"))
|
||||||
{
|
{
|
||||||
AddLog("Creating settings file");
|
AddLog("Creating settings file");
|
||||||
@@ -455,19 +484,27 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
private async void GetAccounts()
|
private async void GetAccounts()
|
||||||
{
|
{
|
||||||
string APIresponse = await APIGet("wallet", true);
|
try
|
||||||
comboBoxaccount.Items.Clear();
|
|
||||||
if (APIresponse != "Error")
|
|
||||||
{
|
{
|
||||||
comboBoxaccount.Enabled = true;
|
string APIresponse = await APIGet("wallet", true);
|
||||||
JArray jArray = JArray.Parse(APIresponse);
|
comboBoxaccount.Items.Clear();
|
||||||
foreach (string account in jArray)
|
if (APIresponse != "Error")
|
||||||
{
|
{
|
||||||
comboBoxaccount.Items.Add(account);
|
comboBoxaccount.Enabled = true;
|
||||||
}
|
JArray jArray = JArray.Parse(APIresponse);
|
||||||
if (comboBoxaccount.Items.Count > 0)
|
foreach (string account in jArray)
|
||||||
{
|
{
|
||||||
comboBoxaccount.SelectedIndex = 0;
|
comboBoxaccount.Items.Add(account);
|
||||||
|
}
|
||||||
|
if (comboBoxaccount.Items.Count > 0)
|
||||||
|
{
|
||||||
|
comboBoxaccount.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
comboBoxaccount.Items.Add("No accounts found");
|
||||||
|
comboBoxaccount.Enabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -475,10 +512,9 @@ namespace FireWallet
|
|||||||
comboBoxaccount.Enabled = false;
|
comboBoxaccount.Enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
catch
|
||||||
{
|
{
|
||||||
comboBoxaccount.Items.Add("No accounts found");
|
AddLog("Error getting accounts");
|
||||||
comboBoxaccount.Enabled = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private async Task<bool> Login()
|
private async Task<bool> Login()
|
||||||
@@ -523,6 +559,15 @@ namespace FireWallet
|
|||||||
if (jObject["watchOnly"].ToString() == "True") watchOnly = true;
|
if (jObject["watchOnly"].ToString() == "True") watchOnly = true;
|
||||||
else watchOnly = false;
|
else watchOnly = false;
|
||||||
toolStripStatusLabelLedger.Text = "Cold Wallet: " + watchOnly.ToString();
|
toolStripStatusLabelLedger.Text = "Cold Wallet: " + watchOnly.ToString();
|
||||||
|
|
||||||
|
if (watchOnly)
|
||||||
|
{
|
||||||
|
buttonAddressVerify.Visible = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buttonAddressVerify.Visible = false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,6 +712,8 @@ namespace FireWallet
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<string> APIGet(string path, bool wallet)
|
public async Task<string> APIGet(string path, bool wallet)
|
||||||
{
|
{
|
||||||
|
if (nodeSettings == null) return "Error";
|
||||||
|
if (!nodeSettings.ContainsKey("Key") || !nodeSettings.ContainsKey("IP")) return "Error";
|
||||||
string key = nodeSettings["Key"];
|
string key = nodeSettings["Key"];
|
||||||
string ip = nodeSettings["IP"];
|
string ip = nodeSettings["IP"];
|
||||||
|
|
||||||
@@ -1118,7 +1165,8 @@ namespace FireWallet
|
|||||||
labelSendingError.Hide();
|
labelSendingError.Hide();
|
||||||
labelSendingError.Text = "";
|
labelSendingError.Text = "";
|
||||||
buttonNavPortfolio.PerformClick();
|
buttonNavPortfolio.PerformClick();
|
||||||
} else // Cold wallet signing
|
}
|
||||||
|
else // Cold wallet signing
|
||||||
{
|
{
|
||||||
AddLog("Sending CW " + amount.ToString() + " HNS to " + address);
|
AddLog("Sending CW " + amount.ToString() + " HNS to " + address);
|
||||||
|
|
||||||
@@ -1137,14 +1185,14 @@ namespace FireWallet
|
|||||||
// Try to install hsd-ledger
|
// Try to install hsd-ledger
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NotifyForm Notifyinstall = new NotifyForm("Installing hsd-ledger\nThis may take a few minutes\nDo not close FireWallet",false);
|
NotifyForm Notifyinstall = new NotifyForm("Installing hsd-ledger\nThis may take a few minutes\nDo not close FireWallet", false);
|
||||||
Notifyinstall.Show();
|
Notifyinstall.Show();
|
||||||
// Wait for the notification to show
|
// Wait for the notification to show
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
|
|
||||||
string repositoryUrl = "https://github.com/handshake-org/hsd-ledger.git";
|
string repositoryUrl = "https://github.com/handshake-org/hsd-ledger.git";
|
||||||
string destinationPath = dir + "hsd-ledger";
|
string destinationPath = dir + "hsd-ledger";
|
||||||
CloneRepository(repositoryUrl,destinationPath);
|
CloneRepository(repositoryUrl, destinationPath);
|
||||||
|
|
||||||
Notifyinstall.CloseNotification();
|
Notifyinstall.CloseNotification();
|
||||||
Notifyinstall.Dispose();
|
Notifyinstall.Dispose();
|
||||||
@@ -1160,7 +1208,7 @@ namespace FireWallet
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyForm notify = new NotifyForm("Please confirm the transaction on your Ledger device",false);
|
NotifyForm notify = new NotifyForm("Please confirm the transaction on your Ledger device", false);
|
||||||
notify.Show();
|
notify.Show();
|
||||||
|
|
||||||
var proc = new Process();
|
var proc = new Process();
|
||||||
@@ -1202,7 +1250,8 @@ namespace FireWallet
|
|||||||
textBoxSendingTo.Text = "";
|
textBoxSendingTo.Text = "";
|
||||||
textBoxSendingAmount.Text = "";
|
textBoxSendingAmount.Text = "";
|
||||||
buttonNavPortfolio.PerformClick();
|
buttonNavPortfolio.PerformClick();
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
NotifyForm notifyError = new NotifyForm("Error Transaction Failed\nCheck logs for more details");
|
NotifyForm notifyError = new NotifyForm("Error Transaction Failed\nCheck logs for more details");
|
||||||
notifyError.ShowDialog();
|
notifyError.ShowDialog();
|
||||||
@@ -1219,16 +1268,25 @@ namespace FireWallet
|
|||||||
labelSendingError.Text = ex.Message;
|
labelSendingError.Text = ex.Message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void CloneRepository(string repositoryUrl, string destinationPath)
|
public void CloneRepository(string repositoryUrl, string destinationPath)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
bool hideScreen = true;
|
||||||
|
if (nodeSettings.ContainsKey("HideScreen"))
|
||||||
|
{
|
||||||
|
if (nodeSettings["HideScreen"].ToLower() == "false")
|
||||||
|
{
|
||||||
|
hideScreen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||||
startInfo.FileName = "git";
|
startInfo.FileName = "git";
|
||||||
startInfo.Arguments = $"clone {repositoryUrl} {destinationPath}";
|
startInfo.Arguments = $"clone {repositoryUrl} {destinationPath}";
|
||||||
startInfo.RedirectStandardOutput = true;
|
startInfo.RedirectStandardOutput = true;
|
||||||
startInfo.UseShellExecute = false;
|
startInfo.UseShellExecute = false;
|
||||||
startInfo.CreateNoWindow = true;
|
startInfo.CreateNoWindow = hideScreen;
|
||||||
|
|
||||||
Process process = new Process();
|
Process process = new Process();
|
||||||
process.StartInfo = startInfo;
|
process.StartInfo = startInfo;
|
||||||
@@ -1246,7 +1304,7 @@ namespace FireWallet
|
|||||||
FileName = "cmd",
|
FileName = "cmd",
|
||||||
RedirectStandardInput = true,
|
RedirectStandardInput = true,
|
||||||
WorkingDirectory = destinationPath,
|
WorkingDirectory = destinationPath,
|
||||||
CreateNoWindow = true
|
CreateNoWindow = hideScreen
|
||||||
};
|
};
|
||||||
var pNpmRunDist = Process.Start(psiNpmRunDist);
|
var pNpmRunDist = Process.Start(psiNpmRunDist);
|
||||||
pNpmRunDist.StandardInput.WriteLine("npm install & exit");
|
pNpmRunDist.StandardInput.WriteLine("npm install & exit");
|
||||||
@@ -1272,7 +1330,7 @@ namespace FireWallet
|
|||||||
AddLog(ex.Message);
|
AddLog(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static bool CheckNodeInstalled()
|
public bool CheckNodeInstalled()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -1308,6 +1366,52 @@ namespace FireWallet
|
|||||||
labelReceive2.Text = "Copied to clipboard";
|
labelReceive2.Text = "Copied to clipboard";
|
||||||
labelReceive2.Left = (panelRecieve.Width - labelReceive2.Width) / 2;
|
labelReceive2.Left = (panelRecieve.Width - labelReceive2.Width) / 2;
|
||||||
}
|
}
|
||||||
|
private async void buttonAddressVerify_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
var proc = new Process();
|
||||||
|
proc.StartInfo.CreateNoWindow = true;
|
||||||
|
proc.StartInfo.RedirectStandardInput = true;
|
||||||
|
proc.StartInfo.RedirectStandardOutput = true;
|
||||||
|
proc.StartInfo.UseShellExecute = false;
|
||||||
|
proc.StartInfo.RedirectStandardError = true;
|
||||||
|
proc.StartInfo.FileName = "node.exe";
|
||||||
|
proc.StartInfo.Arguments = dir + "hsd-ledger/bin/hsd-ledger createaddress --api-key " + nodeSettings["Key"] + " -w " + account;
|
||||||
|
proc.Start();
|
||||||
|
|
||||||
|
// Wait 1 sec
|
||||||
|
await Task.Delay(1000);
|
||||||
|
|
||||||
|
// Get the output into a string
|
||||||
|
string result = proc.StandardOutput.ReadLine();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result = result.Replace("Verify address on Ledger device: ", "");
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
AddLog(result);
|
||||||
|
textBoxReceiveAddress.Text = result;
|
||||||
|
Size size = TextRenderer.MeasureText(textBoxReceiveAddress.Text, textBoxReceiveAddress.Font);
|
||||||
|
textBoxReceiveAddress.Width = size.Width + 10;
|
||||||
|
textBoxReceiveAddress.Left = (panelRecieve.Width - textBoxReceiveAddress.Width) / 2;
|
||||||
|
|
||||||
|
|
||||||
|
NotifyForm notify = new NotifyForm("Please confirm the address on your Ledger device", false);
|
||||||
|
notify.Show();
|
||||||
|
|
||||||
|
// Handle events until process exits
|
||||||
|
while (!proc.HasExited)
|
||||||
|
{
|
||||||
|
// Check for cancellation
|
||||||
|
if (proc.WaitForExit(100))
|
||||||
|
break;
|
||||||
|
Application.DoEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
notify.CloseNotification();
|
||||||
|
notify.Dispose();
|
||||||
|
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Domains
|
#region Domains
|
||||||
public string[] Domains { get; set; }
|
public string[] Domains { get; set; }
|
||||||
@@ -1525,5 +1629,7 @@ namespace FireWallet
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1
FireWallet/NewAccountForm.Designer.cs
generated
1
FireWallet/NewAccountForm.Designer.cs
generated
@@ -104,7 +104,6 @@
|
|||||||
//
|
//
|
||||||
// buttonCold
|
// buttonCold
|
||||||
//
|
//
|
||||||
buttonCold.Enabled = false;
|
|
||||||
buttonCold.FlatStyle = FlatStyle.Flat;
|
buttonCold.FlatStyle = FlatStyle.Flat;
|
||||||
buttonCold.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
buttonCold.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
buttonCold.Location = new Point(147, 239);
|
buttonCold.Location = new Point(147, 239);
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Security.Principal;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -59,9 +61,50 @@ namespace FireWallet
|
|||||||
groupBoxNew.Text = "Import Wallet";
|
groupBoxNew.Text = "Import Wallet";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonCold_Click(object sender, EventArgs e)
|
private async void buttonCold_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// TODO - Cold wallet
|
if (!Directory.Exists(mainForm.dir + "hsd-ledger"))
|
||||||
|
{
|
||||||
|
if (mainForm.CheckNodeInstalled() == false)
|
||||||
|
{
|
||||||
|
mainForm.AddLog("Node not installed");
|
||||||
|
NotifyForm notify1 = new NotifyForm("Node not installed\nPlease install it to use Ledger");
|
||||||
|
notify1.ShowDialog();
|
||||||
|
notify1.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mainForm.AddLog("Installing hsd-ledger");
|
||||||
|
|
||||||
|
// Try to install hsd-ledger
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NotifyForm Notifyinstall = new NotifyForm("Installing hsd-ledger\nThis may take a few minutes\nDo not close FireWallet", false);
|
||||||
|
Notifyinstall.Show();
|
||||||
|
// Wait for the notification to show
|
||||||
|
await Task.Delay(1000);
|
||||||
|
|
||||||
|
string repositoryUrl = "https://github.com/handshake-org/hsd-ledger.git";
|
||||||
|
string destinationPath = mainForm.dir + "hsd-ledger";
|
||||||
|
mainForm.CloneRepository(repositoryUrl, destinationPath);
|
||||||
|
|
||||||
|
Notifyinstall.CloseNotification();
|
||||||
|
Notifyinstall.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
NotifyForm notifyError = new NotifyForm("Error installing hsd-ledger\n" + ex.Message);
|
||||||
|
mainForm.AddLog(ex.Message);
|
||||||
|
notifyError.ShowDialog();
|
||||||
|
notifyError.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Import HSD Wallet
|
||||||
|
groupBoxNew.Show();
|
||||||
|
groupBoxNew.Text = "Import Ledger";
|
||||||
|
buttonNext.Show();
|
||||||
|
page = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textBoxNewName_TextChanged(object sender, EventArgs e)
|
private void textBoxNewName_TextChanged(object sender, EventArgs e)
|
||||||
@@ -136,7 +179,7 @@ namespace FireWallet
|
|||||||
// Create new wallet
|
// Create new wallet
|
||||||
buttonNext.Enabled = false;
|
buttonNext.Enabled = false;
|
||||||
string path = "wallet/" + textBoxNewName.Text;
|
string path = "wallet/" + textBoxNewName.Text;
|
||||||
string content = "{\"passphrase\":\"" + textBoxNewPass1.Text + "\",\"mnemonic\":\"" + textBoxSeedPhrase.Text +"\"}";
|
string content = "{\"passphrase\":\"" + textBoxNewPass1.Text + "\",\"mnemonic\":\"" + textBoxSeedPhrase.Text + "\"}";
|
||||||
string response = await APIPut(path, true, content);
|
string response = await APIPut(path, true, content);
|
||||||
if (response == "Error")
|
if (response == "Error")
|
||||||
{
|
{
|
||||||
@@ -152,6 +195,40 @@ namespace FireWallet
|
|||||||
notify2.Dispose();
|
notify2.Dispose();
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
else if (page == 4)
|
||||||
|
{
|
||||||
|
// Import Ledger
|
||||||
|
buttonNext.Enabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
var proc = new Process();
|
||||||
|
proc.StartInfo.CreateNoWindow = true;
|
||||||
|
proc.StartInfo.RedirectStandardInput = true;
|
||||||
|
proc.StartInfo.RedirectStandardOutput = true;
|
||||||
|
proc.StartInfo.UseShellExecute = false;
|
||||||
|
proc.StartInfo.RedirectStandardError = true;
|
||||||
|
proc.StartInfo.FileName = "node.exe";
|
||||||
|
proc.StartInfo.Arguments = mainForm.dir + "hsd-ledger/bin/hsd-ledger createwallet " + textBoxNewPass1.Text + " --api-key " + mainForm.nodeSettings["Key"];
|
||||||
|
var outputBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
// Event handler for capturing output data
|
||||||
|
proc.OutputDataReceived += (sender, args) =>
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(args.Data))
|
||||||
|
{
|
||||||
|
outputBuilder.AppendLine(args.Data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
proc.Start();
|
||||||
|
proc.BeginOutputReadLine();
|
||||||
|
proc.WaitForExit();
|
||||||
|
|
||||||
|
mainForm.AddLog(outputBuilder.ToString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpClient httpClient = new HttpClient();
|
HttpClient httpClient = new HttpClient();
|
||||||
|
|||||||
@@ -278,6 +278,13 @@ namespace FireWallet
|
|||||||
|
|
||||||
private void SaveSettings(object sender, EventArgs e)
|
private void SaveSettings(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (textBoxNodeKey.Text == "")
|
||||||
|
{
|
||||||
|
NotifyForm notifyForm = new NotifyForm("Please enter a key");
|
||||||
|
notifyForm.ShowDialog();
|
||||||
|
notifyForm.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (checkBoxRunHSD.Checked)
|
if (checkBoxRunHSD.Checked)
|
||||||
{
|
{
|
||||||
StreamWriter sw = new StreamWriter(dir + "node.txt");
|
StreamWriter sw = new StreamWriter(dir + "node.txt");
|
||||||
|
|||||||
@@ -27,10 +27,7 @@ namespace FireWallet
|
|||||||
|
|
||||||
private void SplashScreen_FormClosing(object sender, FormClosingEventArgs e)
|
private void SplashScreen_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
if (!close)
|
|
||||||
{
|
|
||||||
e.Cancel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void label2_Click(object sender, EventArgs e)
|
private void label2_Click(object sender, EventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user