mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2025-12-06 16:43:01 +11:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
1a71329e6a
|
|||
|
c2990afed3
|
@@ -31,7 +31,9 @@ namespace FireWallet
|
|||||||
public bool batchMode { get; set; }
|
public bool batchMode { get; set; }
|
||||||
public BatchForm batchForm { get; set; }
|
public BatchForm batchForm { get; set; }
|
||||||
public bool watchOnly { get; set; }
|
public bool watchOnly { get; set; }
|
||||||
|
public bool HSD { get; set; }
|
||||||
|
|
||||||
|
public Process hsdProcess { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
#region Application
|
#region Application
|
||||||
public MainForm()
|
public MainForm()
|
||||||
@@ -84,6 +86,22 @@ namespace FireWallet
|
|||||||
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
AddLog("Closing");
|
AddLog("Closing");
|
||||||
|
if (hsdProcess != null)
|
||||||
|
{
|
||||||
|
this.Hide();
|
||||||
|
hsdProcess.Kill();
|
||||||
|
AddLog("HSD Closed");
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
hsdProcess.Dispose();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
AddLog("Dispose failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -91,8 +109,9 @@ namespace FireWallet
|
|||||||
|
|
||||||
|
|
||||||
#region Settings
|
#region Settings
|
||||||
private void LoadNode()
|
private async void LoadNode()
|
||||||
{
|
{
|
||||||
|
HSD = false;
|
||||||
if (!File.Exists(dir + "node.txt"))
|
if (!File.Exists(dir + "node.txt"))
|
||||||
{
|
{
|
||||||
NodeForm cf = new NodeForm();
|
NodeForm cf = new NodeForm();
|
||||||
@@ -137,6 +156,52 @@ namespace FireWallet
|
|||||||
toolStripStatusLabelNetwork.Text = "Network: Testnet";
|
toolStripStatusLabelNetwork.Text = "Network: Testnet";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nodeSettings.ContainsKey("HSD"))
|
||||||
|
{
|
||||||
|
if (nodeSettings["HSD"].ToLower() == "true")
|
||||||
|
{
|
||||||
|
HSD = true;
|
||||||
|
AddLog("Starting HSD");
|
||||||
|
toolStripStatusLabelstatus.Text = "Status: HSD Starting";
|
||||||
|
|
||||||
|
if (!Directory.Exists(dir + "hsd"))
|
||||||
|
{
|
||||||
|
NotifyForm Notifyinstall = new NotifyForm("Installing hsd\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.git";
|
||||||
|
string destinationPath = dir + "hsd";
|
||||||
|
CloneRepository(repositoryUrl, destinationPath);
|
||||||
|
|
||||||
|
Notifyinstall.CloseNotification();
|
||||||
|
Notifyinstall.Dispose();
|
||||||
|
}
|
||||||
|
hsdProcess = new Process();
|
||||||
|
|
||||||
|
hsdProcess.StartInfo.CreateNoWindow = true;
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NodeStatus();
|
NodeStatus();
|
||||||
|
|
||||||
|
|
||||||
@@ -1187,7 +1252,8 @@ namespace FireWallet
|
|||||||
pNpmRunDist.StandardInput.WriteLine("npm install & exit");
|
pNpmRunDist.StandardInput.WriteLine("npm install & exit");
|
||||||
pNpmRunDist.WaitForExit();
|
pNpmRunDist.WaitForExit();
|
||||||
|
|
||||||
|
if (repositoryUrl == "https://github.com/handshake-org/hsd-ledger.git")
|
||||||
|
{
|
||||||
// Replace /bin/hsd-ledger with /bin/hsd-ledger from
|
// Replace /bin/hsd-ledger with /bin/hsd-ledger from
|
||||||
// https://raw.githubusercontent.com/Nathanwoodburn/FireWallet/master/hsd-ledger
|
// https://raw.githubusercontent.com/Nathanwoodburn/FireWallet/master/hsd-ledger
|
||||||
// This version of hsd-ledger has the sendraw transaction function added which is needed for batching
|
// This version of hsd-ledger has the sendraw transaction function added which is needed for batching
|
||||||
@@ -1198,10 +1264,7 @@ namespace FireWallet
|
|||||||
// Download the new hsd-ledger
|
// Download the new hsd-ledger
|
||||||
WebClient downloader = new WebClient();
|
WebClient downloader = new WebClient();
|
||||||
downloader.DownloadFile("https://raw.githubusercontent.com/Nathanwoodburn/FireWallet/master/hsd-ledger", sourcePath);
|
downloader.DownloadFile("https://raw.githubusercontent.com/Nathanwoodburn/FireWallet/master/hsd-ledger", sourcePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
13
FireWallet/NodeForm.Designer.cs
generated
13
FireWallet/NodeForm.Designer.cs
generated
@@ -36,6 +36,7 @@ namespace FireWallet
|
|||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NodeForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NodeForm));
|
||||||
labelWelcome = new Label();
|
labelWelcome = new Label();
|
||||||
groupBoxNode = new GroupBox();
|
groupBoxNode = new GroupBox();
|
||||||
|
checkBoxRunHSD = new CheckBox();
|
||||||
labelNodeStatus = new Label();
|
labelNodeStatus = new Label();
|
||||||
comboBoxNodeNetwork = new ComboBox();
|
comboBoxNodeNetwork = new ComboBox();
|
||||||
buttonSave = new Button();
|
buttonSave = new Button();
|
||||||
@@ -61,6 +62,7 @@ namespace FireWallet
|
|||||||
//
|
//
|
||||||
// groupBoxNode
|
// groupBoxNode
|
||||||
//
|
//
|
||||||
|
groupBoxNode.Controls.Add(checkBoxRunHSD);
|
||||||
groupBoxNode.Controls.Add(labelNodeStatus);
|
groupBoxNode.Controls.Add(labelNodeStatus);
|
||||||
groupBoxNode.Controls.Add(comboBoxNodeNetwork);
|
groupBoxNode.Controls.Add(comboBoxNodeNetwork);
|
||||||
groupBoxNode.Controls.Add(buttonSave);
|
groupBoxNode.Controls.Add(buttonSave);
|
||||||
@@ -77,6 +79,16 @@ namespace FireWallet
|
|||||||
groupBoxNode.TabStop = false;
|
groupBoxNode.TabStop = false;
|
||||||
groupBoxNode.Text = "Node";
|
groupBoxNode.Text = "Node";
|
||||||
//
|
//
|
||||||
|
// checkBoxRunHSD
|
||||||
|
//
|
||||||
|
checkBoxRunHSD.AutoSize = true;
|
||||||
|
checkBoxRunHSD.Location = new Point(62, 100);
|
||||||
|
checkBoxRunHSD.Name = "checkBoxRunHSD";
|
||||||
|
checkBoxRunHSD.Size = new Size(304, 19);
|
||||||
|
checkBoxRunHSD.TabIndex = 10;
|
||||||
|
checkBoxRunHSD.Text = "Run HSD (use this if you don't want to run Bob/HSD)";
|
||||||
|
checkBoxRunHSD.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// labelNodeStatus
|
// labelNodeStatus
|
||||||
//
|
//
|
||||||
labelNodeStatus.AutoSize = true;
|
labelNodeStatus.AutoSize = true;
|
||||||
@@ -193,5 +205,6 @@ namespace FireWallet
|
|||||||
private Button buttonSave;
|
private Button buttonSave;
|
||||||
private ComboBox comboBoxNodeNetwork;
|
private ComboBox comboBoxNodeNetwork;
|
||||||
private Label labelNodeStatus;
|
private Label labelNodeStatus;
|
||||||
|
private CheckBox checkBoxRunHSD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,6 +278,19 @@ namespace FireWallet
|
|||||||
|
|
||||||
private void SaveSettings(object sender, EventArgs e)
|
private void SaveSettings(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (checkBoxRunHSD.Checked)
|
||||||
|
{
|
||||||
|
StreamWriter sw = new StreamWriter(dir + "node.txt");
|
||||||
|
sw.WriteLine("IP: " + textBoxNodeIP.Text);
|
||||||
|
sw.WriteLine("Network: " + comboBoxNodeNetwork.SelectedIndex);
|
||||||
|
sw.WriteLine("Key: " + textBoxNodeKey.Text);
|
||||||
|
sw.WriteLine("HSD: True");
|
||||||
|
sw.Dispose();
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
buttonNodeTest.PerformClick();
|
buttonNodeTest.PerformClick();
|
||||||
|
|
||||||
if (labelNodeStatus.Text != "Node Connected")
|
if (labelNodeStatus.Text != "Node Connected")
|
||||||
@@ -292,4 +305,5 @@ namespace FireWallet
|
|||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ This password will be used to encrypt your wallet and to login to your wallet.
|
|||||||
## First time setup
|
## First time setup
|
||||||
When you first open the wallet you will be prompted to set your node settings.
|
When you first open the wallet you will be prompted to set your node settings.
|
||||||
|
|
||||||
|
You can either connect to an existing HSD (or Bob) node or you can run your own node.
|
||||||
|
If you want to run your own node you should select the `Run HSD` option.
|
||||||
|
This will take a few minutes to download and install HSD.
|
||||||
|
|
||||||
You can get the API key from the HSD launch command or
|
You can get the API key from the HSD launch command or
|
||||||
in Bob wallet under settings > Wallet > API key.
|
in Bob wallet under settings > Wallet > API key.
|
||||||
If you change this key in HSD or Bob you will need to update it in FireWallet.
|
If you change this key in HSD or Bob you will need to update it in FireWallet.
|
||||||
|
|||||||
Reference in New Issue
Block a user