mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2025-12-06 00:23:00 +11:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
d4620af384
|
|||
|
15cb4efaf1
|
|||
|
18607358bf
|
|||
|
6db6d02e9e
|
|||
|
3eda3d7419
|
|||
|
3f6c2bdded
|
|||
|
2bfca908a9
|
|||
|
531d41a413
|
|||
|
960af0b169
|
|||
|
14a685690c
|
|||
|
816e16a9aa
|
|||
|
036819169d
|
|||
|
1675ac48f3
|
|||
|
f44aac35f0
|
|||
|
bf2e41058d
|
|||
|
2109879f93
|
|||
|
112b719d78
|
|||
|
2395c4ca29
|
@@ -538,14 +538,8 @@ namespace FireWallet
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
StreamWriter sw = new StreamWriter(dir + "hsd-ledger/bin/names.txt");
|
||||
string domainslist = string.Join(",", batches.Select(batch => batch.domain));
|
||||
sw.Write(domainslist);
|
||||
sw.Dispose();
|
||||
StreamWriter sw2 = new StreamWriter(dir + "hsd-ledger/bin/batch.json");
|
||||
sw2.Write(response);
|
||||
sw2.Dispose();
|
||||
|
||||
string domainslist = string.Join(",", batches.Select(batch => "\\\"" + batch.domain + "\\\""));
|
||||
|
||||
NotifyForm notify = new NotifyForm("Please confirm the transaction on your Ledger device", false);
|
||||
notify.Show();
|
||||
@@ -558,7 +552,9 @@ namespace FireWallet
|
||||
proc.StartInfo.RedirectStandardError = true;
|
||||
proc.StartInfo.FileName = "node.exe";
|
||||
proc.StartInfo.WorkingDirectory = dir + "hsd-ledger/bin/";
|
||||
proc.StartInfo.Arguments = dir + "hsd-ledger/bin/hsd-ledger sendraw batch.json names.txt --api-key " + mainForm.nodeSettings["Key"] + " -w " + mainForm.account;
|
||||
string args = "hsd-ledger/bin/hsd-ledger sendraw \"\"" + response.Replace("\"","\\\"") + "\"\" [" + domainslist + "] --api-key " + mainForm.nodeSettings["Key"] + " -w " + mainForm.account;
|
||||
|
||||
proc.StartInfo.Arguments = dir + args;
|
||||
var outputBuilder = new StringBuilder();
|
||||
|
||||
// Event handler for capturing output data
|
||||
@@ -590,6 +586,8 @@ namespace FireWallet
|
||||
}
|
||||
else
|
||||
{
|
||||
AddLog(args);
|
||||
AddLog(proc.StandardError.ReadToEnd());
|
||||
NotifyForm notifyError = new NotifyForm("Error Transaction Failed\nCheck logs for more details");
|
||||
notifyError.ShowDialog();
|
||||
notifyError.Dispose();
|
||||
|
||||
@@ -32,36 +32,7 @@ namespace FireWallet
|
||||
this.explorerTX = explorerTX;
|
||||
this.explorerName = explorerName;
|
||||
this.mainForm = mainForm;
|
||||
}
|
||||
|
||||
#region Theming
|
||||
private void UpdateTheme()
|
||||
{
|
||||
// Check if file exists
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
CreateConfig(dir);
|
||||
}
|
||||
if (!File.Exists(dir + "theme.txt"))
|
||||
{
|
||||
CreateConfig(dir);
|
||||
}
|
||||
|
||||
// Read file
|
||||
StreamReader sr = new StreamReader(dir + "theme.txt");
|
||||
theme = new Dictionary<string, string>();
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
string line = sr.ReadLine();
|
||||
string[] split = line.Split(':');
|
||||
theme.Add(split[0].Trim(), split[1].Trim());
|
||||
}
|
||||
sr.Dispose();
|
||||
|
||||
if (!theme.ContainsKey("background") || !theme.ContainsKey("background-alt") || !theme.ContainsKey("foreground") || !theme.ContainsKey("foreground-alt"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.theme = mainForm.theme;
|
||||
|
||||
// Apply theme
|
||||
this.BackColor = ColorTranslator.FromHtml(theme["background"]);
|
||||
@@ -73,35 +44,12 @@ namespace FireWallet
|
||||
// Need to specify this for each groupbox to override the black text
|
||||
foreach (Control c in Controls)
|
||||
{
|
||||
ThemeControl(c);
|
||||
mainForm.ThemeControl(c);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Transparancy
|
||||
applyTransparency(theme);
|
||||
|
||||
|
||||
applyTransparency(mainForm.theme);
|
||||
}
|
||||
private void ThemeControl(Control c)
|
||||
{
|
||||
if (c.GetType() == typeof(GroupBox) || c.GetType() == typeof(Panel))
|
||||
{
|
||||
c.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
|
||||
foreach (Control sub in c.Controls)
|
||||
{
|
||||
ThemeControl(sub);
|
||||
}
|
||||
}
|
||||
if (c.GetType() == typeof(TextBox) || c.GetType() == typeof(Button)
|
||||
|| c.GetType() == typeof(ComboBox) || c.GetType() == typeof(StatusStrip))
|
||||
{
|
||||
c.ForeColor = ColorTranslator.FromHtml(theme["foreground-alt"]);
|
||||
c.BackColor = ColorTranslator.FromHtml(theme["background-alt"]);
|
||||
}
|
||||
}
|
||||
|
||||
#region Theme
|
||||
private void applyTransparency(Dictionary<string, string> theme)
|
||||
{
|
||||
if (theme.ContainsKey("transparent-mode"))
|
||||
@@ -148,26 +96,6 @@ namespace FireWallet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateConfig(string dir)
|
||||
{
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
StreamWriter sw = new StreamWriter(dir + "theme.txt");
|
||||
sw.WriteLine("background: #000000");
|
||||
sw.WriteLine("foreground: #8e05c2");
|
||||
sw.WriteLine("background-alt: #3e065f");
|
||||
sw.WriteLine("foreground-alt: #ffffff");
|
||||
sw.WriteLine("transparent-mode: off");
|
||||
sw.WriteLine("transparency-key: main");
|
||||
sw.WriteLine("transparency-percent: 90");
|
||||
|
||||
sw.Dispose();
|
||||
|
||||
}
|
||||
|
||||
// Required for mica effect
|
||||
internal enum AccentState
|
||||
{
|
||||
@@ -209,7 +137,6 @@ namespace FireWallet
|
||||
|
||||
private void DomainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
UpdateTheme();
|
||||
own = false;
|
||||
StreamReader sr = new StreamReader(dir + "node.txt");
|
||||
nodeSettings = new Dictionary<string, string>();
|
||||
@@ -330,6 +257,14 @@ namespace FireWallet
|
||||
{
|
||||
labelStatusMain.Text = "Error";
|
||||
}
|
||||
|
||||
|
||||
if (labelStatusReserved.Text == "True")
|
||||
{
|
||||
buttonActionAlt.Hide();
|
||||
buttonActionMain.Hide();
|
||||
groupBoxAction.Text = "Reserved";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<PackageIcon>HSDBatcher.png</PackageIcon>
|
||||
<RepositoryUrl>https://github.com/Nathanwoodburn/FireWallet</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<Version>2.5</Version>
|
||||
<Version>2.7</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
30
FireWallet/MainForm.Designer.cs
generated
30
FireWallet/MainForm.Designer.cs
generated
@@ -59,7 +59,6 @@ namespace FireWallet
|
||||
buttonNavSend = new Button();
|
||||
buttonNavPortfolio = new Button();
|
||||
panelPortfolio = new Panel();
|
||||
buttonRenewAll = new Button();
|
||||
buttonRevealAll = new Button();
|
||||
groupBoxTransactions = new GroupBox();
|
||||
groupBoxinfo = new GroupBox();
|
||||
@@ -70,6 +69,7 @@ namespace FireWallet
|
||||
labelBalanceTotal = new Label();
|
||||
labelLocked = new Label();
|
||||
labelBalance = new Label();
|
||||
buttonRenewAll = new Button();
|
||||
panelSend = new Panel();
|
||||
checkBoxSendSubFee = new CheckBox();
|
||||
buttonSendMax = new Button();
|
||||
@@ -400,18 +400,6 @@ namespace FireWallet
|
||||
panelPortfolio.TabIndex = 7;
|
||||
panelPortfolio.Visible = false;
|
||||
//
|
||||
// buttonRenewAll
|
||||
//
|
||||
buttonRenewAll.FlatStyle = FlatStyle.Flat;
|
||||
buttonRenewAll.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonRenewAll.Location = new Point(813, 9);
|
||||
buttonRenewAll.Name = "buttonRenewAll";
|
||||
buttonRenewAll.Size = new Size(89, 32);
|
||||
buttonRenewAll.TabIndex = 10;
|
||||
buttonRenewAll.Text = "Renew All";
|
||||
buttonRenewAll.UseVisualStyleBackColor = true;
|
||||
buttonRenewAll.Click += buttonRenewAll_Click;
|
||||
//
|
||||
// buttonRevealAll
|
||||
//
|
||||
buttonRevealAll.FlatStyle = FlatStyle.Flat;
|
||||
@@ -518,6 +506,18 @@ namespace FireWallet
|
||||
labelBalance.TabIndex = 0;
|
||||
labelBalance.Text = "labelBalance";
|
||||
//
|
||||
// buttonRenewAll
|
||||
//
|
||||
buttonRenewAll.FlatStyle = FlatStyle.Flat;
|
||||
buttonRenewAll.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonRenewAll.Location = new Point(813, 9);
|
||||
buttonRenewAll.Name = "buttonRenewAll";
|
||||
buttonRenewAll.Size = new Size(89, 32);
|
||||
buttonRenewAll.TabIndex = 10;
|
||||
buttonRenewAll.Text = "Renew All";
|
||||
buttonRenewAll.UseVisualStyleBackColor = true;
|
||||
buttonRenewAll.Click += buttonRenewAll_Click;
|
||||
//
|
||||
// panelSend
|
||||
//
|
||||
panelSend.Controls.Add(checkBoxSendSubFee);
|
||||
@@ -792,7 +792,7 @@ namespace FireWallet
|
||||
panelSettings.Controls.Add(buttonSettingsSave);
|
||||
panelSettings.Controls.Add(groupBoxSettingsExplorer);
|
||||
panelSettings.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
panelSettings.Location = new Point(1065, 211);
|
||||
panelSettings.Location = new Point(1065, 51);
|
||||
panelSettings.Name = "panelSettings";
|
||||
panelSettings.Size = new Size(930, 550);
|
||||
panelSettings.TabIndex = 19;
|
||||
@@ -1007,6 +1007,7 @@ namespace FireWallet
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1152, 575);
|
||||
Controls.Add(panelSettings);
|
||||
Controls.Add(panelaccount);
|
||||
Controls.Add(panelPortfolio);
|
||||
Controls.Add(panelRecieve);
|
||||
@@ -1014,7 +1015,6 @@ namespace FireWallet
|
||||
Controls.Add(panelSend);
|
||||
Controls.Add(panelNav);
|
||||
Controls.Add(statusStripmain);
|
||||
Controls.Add(panelSettings);
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
Name = "MainForm";
|
||||
Opacity = 0D;
|
||||
|
||||
@@ -50,6 +50,9 @@ namespace FireWallet
|
||||
UpdateTheme();
|
||||
if (await LoadNode() != true) this.Close();
|
||||
|
||||
|
||||
if (this.Disposing || this.IsDisposed) return;
|
||||
|
||||
if (userSettings.ContainsKey("hide-splash"))
|
||||
{
|
||||
if (userSettings["hide-splash"] == "false")
|
||||
@@ -89,6 +92,11 @@ namespace FireWallet
|
||||
AddLog("Loaded");
|
||||
Opacity = 1;
|
||||
batchMode = false;
|
||||
// Pull form to front
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
this.Show();
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
|
||||
textBoxaccountpassword.Focus();
|
||||
}
|
||||
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
||||
@@ -213,7 +221,8 @@ namespace FireWallet
|
||||
if (hideScreen)
|
||||
{
|
||||
hsdProcess.StartInfo.RedirectStandardError = true;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
hsdProcess.StartInfo.RedirectStandardError = false;
|
||||
}
|
||||
@@ -232,7 +241,7 @@ namespace FireWallet
|
||||
hsdProcess.Start();
|
||||
// Wait for HSD to start
|
||||
await Task.Delay(2000);
|
||||
|
||||
|
||||
// Check if HSD is running
|
||||
if (hsdProcess.HasExited)
|
||||
{
|
||||
@@ -298,6 +307,7 @@ namespace FireWallet
|
||||
#region Logging
|
||||
public void AddLog(string message)
|
||||
{
|
||||
if (message.Contains("Get Error: No connection could be made because the target machine actively refused it")) return;
|
||||
StreamWriter sw = new StreamWriter(dir + "log.txt", true);
|
||||
sw.WriteLine(DateTime.Now.ToString() + ": " + message);
|
||||
sw.Dispose();
|
||||
@@ -592,11 +602,15 @@ namespace FireWallet
|
||||
watchOnly = true;
|
||||
toolStripStatusLabelLedger.Text = "Cold Wallet";
|
||||
toolStripStatusLabelLedger.Visible = true;
|
||||
buttonRevealAll.Visible = false;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
watchOnly = false;
|
||||
toolStripStatusLabelLedger.Visible = false;
|
||||
buttonRevealAll.Visible = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -738,10 +752,9 @@ namespace FireWallet
|
||||
/// <returns></returns>
|
||||
public async Task<string> APIPost(string path, bool wallet, string content)
|
||||
{
|
||||
if (content == "{\"passphrase\": \"\" ,\"timeout\": 60}")
|
||||
if (content == "{\"passphrase\": \"\",\"timeout\": 60}")
|
||||
{
|
||||
// For some reason, the API doesn't like an empty password, so we'll just use a default one
|
||||
content = "{\"passphrase\": \"password\" ,\"timeout\": 60}";
|
||||
return "";
|
||||
}
|
||||
string key = nodeSettings["Key"];
|
||||
string ip = nodeSettings["IP"];
|
||||
@@ -767,6 +780,8 @@ namespace FireWallet
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog("Post Error: " + ex.Message);
|
||||
AddLog(await resp.Content.ReadAsStringAsync());
|
||||
AddLog("Content: " + content);
|
||||
return "Error";
|
||||
}
|
||||
|
||||
@@ -835,6 +850,7 @@ namespace FireWallet
|
||||
decimal progress = Convert.ToDecimal(chain["progress"].ToString());
|
||||
labelSyncPercent.Text = "Sync: " + decimal.Round(progress * 100, 2) + "%";
|
||||
|
||||
|
||||
// Exit if set to 0 TXs
|
||||
if (userSettings.ContainsKey("portfolio-tx"))
|
||||
{
|
||||
@@ -854,28 +870,67 @@ namespace FireWallet
|
||||
labelPendingCount.Text = "Unconfirmed TX: " + pendingTxs.Count.ToString();
|
||||
|
||||
|
||||
// Get TX's
|
||||
APIresponse = await APIGet("wallet/" + account + "/tx/history", true);
|
||||
// Check how many TX there are
|
||||
APIresponse = await APIGet("wallet/" + account, true);
|
||||
JObject wallet = JObject.Parse(APIresponse);
|
||||
if (!wallet.ContainsKey("balance"))
|
||||
{
|
||||
AddLog("GetInfo Error");
|
||||
AddLog(APIresponse);
|
||||
return;
|
||||
}
|
||||
JObject balance = JObject.Parse(wallet["balance"].ToString());
|
||||
int TotalTX = Convert.ToInt32(balance["tx"].ToString());
|
||||
int toGet = 10;
|
||||
if (userSettings.ContainsKey("portfolio-tx")) toGet = Convert.ToInt32(userSettings["portfolio-tx"]);
|
||||
|
||||
if (toGet > TotalTX) toGet = TotalTX;
|
||||
int toSkip = TotalTX - toGet;
|
||||
|
||||
// GET TXs
|
||||
if (watchOnly)
|
||||
{
|
||||
APIresponse = await APIPost("", true, "{\"method\": \"listtransactions\",\"params\": [\"default\"," + toGet + "," + toSkip + ", true]}");
|
||||
} else
|
||||
{
|
||||
APIresponse = await APIPost("", true, "{\"method\": \"listtransactions\",\"params\": [\"default\"," + toGet + "," + toSkip + "]}");
|
||||
}
|
||||
|
||||
if (APIresponse == "Error")
|
||||
{
|
||||
AddLog("GetInfo Error");
|
||||
return;
|
||||
}
|
||||
JArray txs = JArray.Parse(APIresponse);
|
||||
int txCount = txs.Count;
|
||||
if (txCount > groupBoxTransactions.Height / 55) txCount = (int)Math.Floor(groupBoxTransactions.Height / 55.0);
|
||||
if (userSettings.ContainsKey("portfolio-tx")) txCount = Convert.ToInt32(userSettings["portfolio-tx"]);
|
||||
if (txCount > txs.Count) txCount = txs.Count;
|
||||
Control[] tmpControls = new Control[txCount];
|
||||
for (int i = 0; i < txCount; i++)
|
||||
JObject TXGET = JObject.Parse(APIresponse);
|
||||
|
||||
// Check for error
|
||||
if (TXGET["error"].ToString() != "")
|
||||
{
|
||||
AddLog("GetInfo Error");
|
||||
AddLog(APIresponse);
|
||||
return;
|
||||
}
|
||||
|
||||
JArray txs = JArray.Parse(TXGET["result"].ToString());
|
||||
if (toGet > txs.Count)
|
||||
{
|
||||
toGet = txs.Count;
|
||||
}
|
||||
Control[] tmpControls = new Control[toGet];
|
||||
for (int i = 0; i < toGet; i++)
|
||||
{
|
||||
|
||||
// Get last tx
|
||||
JObject tx = JObject.Parse(txs[txs.Count - 1 - i].ToString());
|
||||
JObject tx = JObject.Parse(await APIGet("wallet/" + account + "/tx/" + txs[toGet - i - 1]["txid"].ToString(), true));
|
||||
|
||||
string hash = tx["hash"].ToString();
|
||||
string date = tx["mdate"].ToString();
|
||||
|
||||
date = DateTime.Parse(date).ToShortDateString();
|
||||
|
||||
|
||||
|
||||
|
||||
Panel tmpPanel = new Panel();
|
||||
tmpPanel.Width = groupBoxTransactions.Width - SystemInformation.VerticalScrollBarWidth - 20;
|
||||
tmpPanel.Height = 50;
|
||||
@@ -910,27 +965,52 @@ namespace FireWallet
|
||||
AutoSize = true,
|
||||
Location = new Point(10, 25)
|
||||
};
|
||||
|
||||
|
||||
tmpPanel.Controls.Add(labelHash);
|
||||
|
||||
// Count inputs and outputs
|
||||
JArray inputs = JArray.Parse(tx["inputs"].ToString());
|
||||
JArray outputs = JArray.Parse(tx["outputs"].ToString());
|
||||
int inputCount = inputs.Count;
|
||||
int outputCount = outputs.Count;
|
||||
|
||||
decimal costHNS = decimal.Parse(txs[toGet - i - 1]["amount"].ToString());
|
||||
string cost = "";
|
||||
if (costHNS < 0)
|
||||
{
|
||||
cost = "Spent: " + (costHNS * -1).ToString() + " HNS";
|
||||
}
|
||||
else if (costHNS > 0)
|
||||
{
|
||||
cost = "Received: " + costHNS.ToString() + " HNS";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Label labelInputOutput = new Label()
|
||||
{
|
||||
Text = "Inputs: " + inputCount + " Outputs: " + outputCount,
|
||||
Text = "Inputs: " + inputCount + " Outputs: " + outputCount + "\n" + cost,
|
||||
AutoSize = true,
|
||||
Location = new Point(300, 20)
|
||||
Location = new Point(300, 5)
|
||||
};
|
||||
tmpPanel.Controls.Add(labelInputOutput);
|
||||
|
||||
|
||||
tmpPanel.Click += (sender, e) =>
|
||||
{
|
||||
TXForm txForm = new TXForm(this, tx);
|
||||
TXForm txForm = new TXForm(this, hash);
|
||||
txForm.Show();
|
||||
};
|
||||
foreach (Control c in tmpPanel.Controls)
|
||||
{
|
||||
c.Click += (sender, e) =>
|
||||
{
|
||||
TXForm txForm = new TXForm(this, hash);
|
||||
txForm.Show();
|
||||
};
|
||||
}
|
||||
|
||||
tmpControls[i] = tmpPanel;
|
||||
|
||||
|
||||
@@ -1107,6 +1187,7 @@ namespace FireWallet
|
||||
}
|
||||
|
||||
panelSettings.Show();
|
||||
panelSettings.Dock = DockStyle.Fill;
|
||||
buttonSettingsSave.Top = panelSettings.Height - buttonSettingsSave.Height - 10;
|
||||
labelSettingsSaved.Top = buttonSettingsSave.Top + 10;
|
||||
textBoxExTX.Text = userSettings["explorer-tx"];
|
||||
@@ -1363,6 +1444,7 @@ namespace FireWallet
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
this.Close();
|
||||
Thread.Sleep(1000);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1384,36 +1466,47 @@ namespace FireWallet
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
this.Close();
|
||||
Thread.Sleep(1000);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Check if npm installed
|
||||
testInstalled = new Process();
|
||||
testInstalled.StartInfo.FileName = "npm";
|
||||
testInstalled.StartInfo.Arguments = "-v";
|
||||
testInstalled.StartInfo.FileName = "cmd.exe";
|
||||
testInstalled.StartInfo.Arguments = "npm -v";
|
||||
testInstalled.StartInfo.RedirectStandardOutput = true;
|
||||
testInstalled.StartInfo.UseShellExecute = false;
|
||||
testInstalled.StartInfo.CreateNoWindow = true;
|
||||
testInstalled.StartInfo.CreateNoWindow = false;
|
||||
testInstalled.Start();
|
||||
// Wait 3 seconds and then kill
|
||||
Thread.Sleep(3000);
|
||||
testInstalled.Kill();
|
||||
outputInstalled = testInstalled.StandardOutput.ReadToEnd();
|
||||
testInstalled.WaitForExit();
|
||||
|
||||
if (outputInstalled.Length < 3)
|
||||
if (Regex.IsMatch(outputInstalled, @"^\d+\.\d+\.\d+$"))
|
||||
{
|
||||
AddLog("NPM is not installed");
|
||||
AddLog(outputInstalled);
|
||||
NotifyForm notifyForm = new NotifyForm("NPM is not installed\nPlease install it to install HSD dependencies");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
this.Close();
|
||||
Thread.Sleep(1000);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
AddLog("Prerequisites installed");
|
||||
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
startInfo.FileName = "git";
|
||||
startInfo.Arguments = $"clone {repositoryUrl} {destinationPath}";
|
||||
|
||||
if (repositoryUrl == "https://github.com/handshake-org/hsd.git")
|
||||
{
|
||||
startInfo.Arguments = $"clone --depth 1 --branch latest {repositoryUrl} {destinationPath}";
|
||||
}
|
||||
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.CreateNoWindow = hideScreen;
|
||||
@@ -1591,13 +1684,6 @@ namespace FireWallet
|
||||
domainTMP.Left = 10;
|
||||
domainTMP.BorderStyle = BorderStyle.FixedSingle;
|
||||
|
||||
// On Click open domain
|
||||
domainTMP.Click += new EventHandler((sender, e) =>
|
||||
{
|
||||
DomainForm domainForm = new DomainForm(this, name["name"].ToString(), userSettings["explorer-tx"], userSettings["explorer-domain"]);
|
||||
domainForm.Show();
|
||||
});
|
||||
|
||||
Label domainName = new Label();
|
||||
domainName.Text = Domains[i];
|
||||
domainName.Top = 5;
|
||||
@@ -1607,7 +1693,8 @@ namespace FireWallet
|
||||
|
||||
domainTMP.Controls.Add(domainName);
|
||||
|
||||
if (!name.ContainsKey("stats")) {
|
||||
if (!name.ContainsKey("stats"))
|
||||
{
|
||||
AddLog("Domain " + Domains[i] + " does not have stats");
|
||||
continue;
|
||||
}
|
||||
@@ -1636,8 +1723,23 @@ namespace FireWallet
|
||||
}
|
||||
|
||||
|
||||
// On Click open domain
|
||||
domainTMP.Click += new EventHandler((sender, e) =>
|
||||
{
|
||||
DomainForm domainForm = new DomainForm(this, name["name"].ToString(), userSettings["explorer-tx"], userSettings["explorer-domain"]);
|
||||
domainForm.Show();
|
||||
});
|
||||
|
||||
|
||||
foreach (Control c in domainTMP.Controls)
|
||||
{
|
||||
c.Click += new EventHandler((sender, e) =>
|
||||
{
|
||||
DomainForm domainForm = new DomainForm(this, name["name"].ToString(), userSettings["explorer-tx"], userSettings["explorer-domain"]);
|
||||
domainForm.Show();
|
||||
});
|
||||
}
|
||||
|
||||
panelDomainList.Controls.Add(domainTMP);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace FireWallet
|
||||
{
|
||||
MainForm mainForm;
|
||||
JObject tx;
|
||||
public TXForm(MainForm mainForm, JObject tx)
|
||||
string txid;
|
||||
public TXForm(MainForm mainForm, string txid)
|
||||
{
|
||||
InitializeComponent();
|
||||
// Theme
|
||||
@@ -29,16 +30,20 @@ namespace FireWallet
|
||||
}
|
||||
|
||||
this.mainForm = mainForm;
|
||||
this.tx = tx;
|
||||
|
||||
this.Text = "TX: " + tx["hash"].ToString();
|
||||
this.txid = txid;
|
||||
}
|
||||
|
||||
private async void TXForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
tx = JObject.Parse(await mainForm.APIGet("wallet/"+mainForm.account+"/tx/" + txid,true));
|
||||
|
||||
this.Text = "TX: " + tx["hash"].ToString();
|
||||
labelHash.Text = "Hash: " + tx["hash"].ToString();
|
||||
mainForm.AddLog("Viewing TX: " + tx["hash"].ToString());
|
||||
|
||||
// Disable scrolling on the panels until they are populated
|
||||
panelInputs.Visible = false;
|
||||
panelOutputs.Visible = false;
|
||||
|
||||
// For each input
|
||||
JArray inputs = (JArray)tx["inputs"];
|
||||
@@ -131,6 +136,9 @@ namespace FireWallet
|
||||
|
||||
panelOutputs.Controls.Add(PanelOutput);
|
||||
}
|
||||
|
||||
panelInputs.Visible = true;
|
||||
panelOutputs.Visible = true;
|
||||
}
|
||||
|
||||
private void Explorer_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -224,15 +224,15 @@
|
||||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:FireWallet"
|
||||
"ProductCode" = "8:{D203173F-39CF-4D8C-810D-FF6840540AF3}"
|
||||
"PackageCode" = "8:{419FAC68-35FF-48D7-AD7D-83813C7CF72A}"
|
||||
"ProductCode" = "8:{D85E3D97-B8F8-4212-9488-A48CF16CCF68}"
|
||||
"PackageCode" = "8:{D2DCB865-F096-4420-AE54-579B6159A7CF}"
|
||||
"UpgradeCode" = "8:{0C86F725-6B01-4173-AA05-3F0EDF481362}"
|
||||
"AspNetVersion" = "8:"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:FALSE"
|
||||
"ProductVersion" = "8:2.5"
|
||||
"ProductVersion" = "8:2.7"
|
||||
"Manufacturer" = "8:Nathan.Woodburn/"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:https://l.woodburn.au/discord"
|
||||
|
||||
15
hsd-ledger
15
hsd-ledger
@@ -136,20 +136,14 @@ async function sendRaw(wclient, nclient, config, ledger, args) { // Create a fun
|
||||
const network = Network.get(config.str('network')); // Get the network
|
||||
const id = config.str('wallet-id'); // Get the wallet id
|
||||
const acct = config.str('account-name'); // Get the account name
|
||||
const batch = args[0]; // Get the batch file location
|
||||
const nameslocation = args[1]; // Get the names file location
|
||||
// Log the arguments to the console (for debugging)
|
||||
|
||||
const batch = JSON.parse(args[0]); // Get the batch
|
||||
const names = JSON.parse(args[1]); // Get the names
|
||||
await wclient.execute('selectwallet', [id]); // Select the wallet
|
||||
|
||||
|
||||
const fs = require('fs'); // Import fs (used to read files)
|
||||
try {
|
||||
const data = fs.readFileSync(batch, 'utf8'); // Read the batch file
|
||||
const json = JSON.parse(data); // Parse the batch file as JSON
|
||||
const mtx = MTX.fromJSON(json.result); // Create a new MTX from the JSON
|
||||
|
||||
const namefile = fs.readFileSync(nameslocation, 'utf8'); // Read the names file
|
||||
const names = namefile.split(','); // Split the names file into an array
|
||||
const mtx = MTX.fromJSON(batch.result); // Create a new MTX from the JSON
|
||||
const hashes = {}; // Create an empty object to store the hashes
|
||||
for (const name of names) { // Loop through the names
|
||||
const hash = hashName(name); // Hash the name
|
||||
@@ -428,6 +422,7 @@ function usage(err) {
|
||||
console.log(' $ hsd-ledger createaccount <account-name> <account-index>');
|
||||
console.log(' $ hsd-ledger createaddress');
|
||||
console.log(' $ hsd-ledger sendtoaddress <address> <amount>');
|
||||
console.log(' $ hsd-ledger sendraw <batch> <names>');
|
||||
console.log(' $ hsd-ledger getwallets');
|
||||
console.log(' $ hsd-ledger getaccounts');
|
||||
console.log(' $ hsd-ledger getaccount <account-name>');
|
||||
|
||||
Reference in New Issue
Block a user