mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2025-12-06 16:43:01 +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
|
@@ -539,13 +539,7 @@ namespace FireWallet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamWriter sw = new StreamWriter(dir + "hsd-ledger/bin/names.txt");
|
string domainslist = string.Join(",", batches.Select(batch => "\\\"" + batch.domain + "\\\""));
|
||||||
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();
|
|
||||||
|
|
||||||
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();
|
||||||
@@ -558,7 +552,9 @@ namespace FireWallet
|
|||||||
proc.StartInfo.RedirectStandardError = true;
|
proc.StartInfo.RedirectStandardError = true;
|
||||||
proc.StartInfo.FileName = "node.exe";
|
proc.StartInfo.FileName = "node.exe";
|
||||||
proc.StartInfo.WorkingDirectory = dir + "hsd-ledger/bin/";
|
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();
|
var outputBuilder = new StringBuilder();
|
||||||
|
|
||||||
// Event handler for capturing output data
|
// Event handler for capturing output data
|
||||||
@@ -590,6 +586,8 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
AddLog(args);
|
||||||
|
AddLog(proc.StandardError.ReadToEnd());
|
||||||
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();
|
||||||
notifyError.Dispose();
|
notifyError.Dispose();
|
||||||
|
|||||||
@@ -32,36 +32,7 @@ namespace FireWallet
|
|||||||
this.explorerTX = explorerTX;
|
this.explorerTX = explorerTX;
|
||||||
this.explorerName = explorerName;
|
this.explorerName = explorerName;
|
||||||
this.mainForm = mainForm;
|
this.mainForm = mainForm;
|
||||||
}
|
this.theme = mainForm.theme;
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply theme
|
// Apply theme
|
||||||
this.BackColor = ColorTranslator.FromHtml(theme["background"]);
|
this.BackColor = ColorTranslator.FromHtml(theme["background"]);
|
||||||
@@ -73,35 +44,12 @@ namespace FireWallet
|
|||||||
// Need to specify this for each groupbox to override the black text
|
// Need to specify this for each groupbox to override the black text
|
||||||
foreach (Control c in Controls)
|
foreach (Control c in Controls)
|
||||||
{
|
{
|
||||||
ThemeControl(c);
|
mainForm.ThemeControl(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyTransparency(mainForm.theme);
|
||||||
|
|
||||||
|
|
||||||
// Transparancy
|
|
||||||
applyTransparency(theme);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void ThemeControl(Control c)
|
#region Theme
|
||||||
{
|
|
||||||
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"]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applyTransparency(Dictionary<string, string> theme)
|
private void applyTransparency(Dictionary<string, string> theme)
|
||||||
{
|
{
|
||||||
if (theme.ContainsKey("transparent-mode"))
|
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
|
// Required for mica effect
|
||||||
internal enum AccentState
|
internal enum AccentState
|
||||||
{
|
{
|
||||||
@@ -209,7 +137,6 @@ namespace FireWallet
|
|||||||
|
|
||||||
private void DomainForm_Load(object sender, EventArgs e)
|
private void DomainForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UpdateTheme();
|
|
||||||
own = false;
|
own = false;
|
||||||
StreamReader sr = new StreamReader(dir + "node.txt");
|
StreamReader sr = new StreamReader(dir + "node.txt");
|
||||||
nodeSettings = new Dictionary<string, string>();
|
nodeSettings = new Dictionary<string, string>();
|
||||||
@@ -330,6 +257,14 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
labelStatusMain.Text = "Error";
|
labelStatusMain.Text = "Error";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (labelStatusReserved.Text == "True")
|
||||||
|
{
|
||||||
|
buttonActionAlt.Hide();
|
||||||
|
buttonActionMain.Hide();
|
||||||
|
groupBoxAction.Text = "Reserved";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<PackageIcon>HSDBatcher.png</PackageIcon>
|
<PackageIcon>HSDBatcher.png</PackageIcon>
|
||||||
<RepositoryUrl>https://github.com/Nathanwoodburn/FireWallet</RepositoryUrl>
|
<RepositoryUrl>https://github.com/Nathanwoodburn/FireWallet</RepositoryUrl>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<Version>2.5</Version>
|
<Version>2.7</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
30
FireWallet/MainForm.Designer.cs
generated
30
FireWallet/MainForm.Designer.cs
generated
@@ -59,7 +59,6 @@ namespace FireWallet
|
|||||||
buttonNavSend = new Button();
|
buttonNavSend = new Button();
|
||||||
buttonNavPortfolio = new Button();
|
buttonNavPortfolio = new Button();
|
||||||
panelPortfolio = new Panel();
|
panelPortfolio = new Panel();
|
||||||
buttonRenewAll = new Button();
|
|
||||||
buttonRevealAll = new Button();
|
buttonRevealAll = new Button();
|
||||||
groupBoxTransactions = new GroupBox();
|
groupBoxTransactions = new GroupBox();
|
||||||
groupBoxinfo = new GroupBox();
|
groupBoxinfo = new GroupBox();
|
||||||
@@ -70,6 +69,7 @@ namespace FireWallet
|
|||||||
labelBalanceTotal = new Label();
|
labelBalanceTotal = new Label();
|
||||||
labelLocked = new Label();
|
labelLocked = new Label();
|
||||||
labelBalance = new Label();
|
labelBalance = new Label();
|
||||||
|
buttonRenewAll = new Button();
|
||||||
panelSend = new Panel();
|
panelSend = new Panel();
|
||||||
checkBoxSendSubFee = new CheckBox();
|
checkBoxSendSubFee = new CheckBox();
|
||||||
buttonSendMax = new Button();
|
buttonSendMax = new Button();
|
||||||
@@ -400,18 +400,6 @@ namespace FireWallet
|
|||||||
panelPortfolio.TabIndex = 7;
|
panelPortfolio.TabIndex = 7;
|
||||||
panelPortfolio.Visible = false;
|
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
|
||||||
//
|
//
|
||||||
buttonRevealAll.FlatStyle = FlatStyle.Flat;
|
buttonRevealAll.FlatStyle = FlatStyle.Flat;
|
||||||
@@ -518,6 +506,18 @@ namespace FireWallet
|
|||||||
labelBalance.TabIndex = 0;
|
labelBalance.TabIndex = 0;
|
||||||
labelBalance.Text = "labelBalance";
|
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
|
||||||
//
|
//
|
||||||
panelSend.Controls.Add(checkBoxSendSubFee);
|
panelSend.Controls.Add(checkBoxSendSubFee);
|
||||||
@@ -792,7 +792,7 @@ namespace FireWallet
|
|||||||
panelSettings.Controls.Add(buttonSettingsSave);
|
panelSettings.Controls.Add(buttonSettingsSave);
|
||||||
panelSettings.Controls.Add(groupBoxSettingsExplorer);
|
panelSettings.Controls.Add(groupBoxSettingsExplorer);
|
||||||
panelSettings.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
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.Name = "panelSettings";
|
||||||
panelSettings.Size = new Size(930, 550);
|
panelSettings.Size = new Size(930, 550);
|
||||||
panelSettings.TabIndex = 19;
|
panelSettings.TabIndex = 19;
|
||||||
@@ -1007,6 +1007,7 @@ namespace FireWallet
|
|||||||
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(panelSettings);
|
||||||
Controls.Add(panelaccount);
|
Controls.Add(panelaccount);
|
||||||
Controls.Add(panelPortfolio);
|
Controls.Add(panelPortfolio);
|
||||||
Controls.Add(panelRecieve);
|
Controls.Add(panelRecieve);
|
||||||
@@ -1014,7 +1015,6 @@ namespace FireWallet
|
|||||||
Controls.Add(panelSend);
|
Controls.Add(panelSend);
|
||||||
Controls.Add(panelNav);
|
Controls.Add(panelNav);
|
||||||
Controls.Add(statusStripmain);
|
Controls.Add(statusStripmain);
|
||||||
Controls.Add(panelSettings);
|
|
||||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||||
Name = "MainForm";
|
Name = "MainForm";
|
||||||
Opacity = 0D;
|
Opacity = 0D;
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ namespace FireWallet
|
|||||||
UpdateTheme();
|
UpdateTheme();
|
||||||
if (await LoadNode() != true) this.Close();
|
if (await LoadNode() != true) this.Close();
|
||||||
|
|
||||||
|
|
||||||
|
if (this.Disposing || this.IsDisposed) return;
|
||||||
|
|
||||||
if (userSettings.ContainsKey("hide-splash"))
|
if (userSettings.ContainsKey("hide-splash"))
|
||||||
{
|
{
|
||||||
if (userSettings["hide-splash"] == "false")
|
if (userSettings["hide-splash"] == "false")
|
||||||
@@ -89,6 +92,11 @@ namespace FireWallet
|
|||||||
AddLog("Loaded");
|
AddLog("Loaded");
|
||||||
Opacity = 1;
|
Opacity = 1;
|
||||||
batchMode = false;
|
batchMode = false;
|
||||||
|
// Pull form to front
|
||||||
|
this.WindowState = FormWindowState.Minimized;
|
||||||
|
this.Show();
|
||||||
|
this.WindowState = FormWindowState.Normal;
|
||||||
|
|
||||||
textBoxaccountpassword.Focus();
|
textBoxaccountpassword.Focus();
|
||||||
}
|
}
|
||||||
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
private void MainForm_Closing(object sender, FormClosingEventArgs e)
|
||||||
@@ -213,7 +221,8 @@ namespace FireWallet
|
|||||||
if (hideScreen)
|
if (hideScreen)
|
||||||
{
|
{
|
||||||
hsdProcess.StartInfo.RedirectStandardError = true;
|
hsdProcess.StartInfo.RedirectStandardError = true;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
hsdProcess.StartInfo.RedirectStandardError = false;
|
hsdProcess.StartInfo.RedirectStandardError = false;
|
||||||
}
|
}
|
||||||
@@ -298,6 +307,7 @@ namespace FireWallet
|
|||||||
#region Logging
|
#region Logging
|
||||||
public void AddLog(string message)
|
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);
|
StreamWriter sw = new StreamWriter(dir + "log.txt", true);
|
||||||
sw.WriteLine(DateTime.Now.ToString() + ": " + message);
|
sw.WriteLine(DateTime.Now.ToString() + ": " + message);
|
||||||
sw.Dispose();
|
sw.Dispose();
|
||||||
@@ -592,11 +602,15 @@ namespace FireWallet
|
|||||||
watchOnly = true;
|
watchOnly = true;
|
||||||
toolStripStatusLabelLedger.Text = "Cold Wallet";
|
toolStripStatusLabelLedger.Text = "Cold Wallet";
|
||||||
toolStripStatusLabelLedger.Visible = true;
|
toolStripStatusLabelLedger.Visible = true;
|
||||||
|
buttonRevealAll.Visible = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
watchOnly = false;
|
watchOnly = false;
|
||||||
toolStripStatusLabelLedger.Visible = false;
|
toolStripStatusLabelLedger.Visible = false;
|
||||||
|
buttonRevealAll.Visible = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -738,10 +752,9 @@ namespace FireWallet
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<string> APIPost(string path, bool wallet, string content)
|
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
|
return "";
|
||||||
content = "{\"passphrase\": \"password\" ,\"timeout\": 60}";
|
|
||||||
}
|
}
|
||||||
string key = nodeSettings["Key"];
|
string key = nodeSettings["Key"];
|
||||||
string ip = nodeSettings["IP"];
|
string ip = nodeSettings["IP"];
|
||||||
@@ -767,6 +780,8 @@ namespace FireWallet
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
AddLog("Post Error: " + ex.Message);
|
AddLog("Post Error: " + ex.Message);
|
||||||
|
AddLog(await resp.Content.ReadAsStringAsync());
|
||||||
|
AddLog("Content: " + content);
|
||||||
return "Error";
|
return "Error";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -835,6 +850,7 @@ namespace FireWallet
|
|||||||
decimal progress = Convert.ToDecimal(chain["progress"].ToString());
|
decimal progress = Convert.ToDecimal(chain["progress"].ToString());
|
||||||
labelSyncPercent.Text = "Sync: " + decimal.Round(progress * 100, 2) + "%";
|
labelSyncPercent.Text = "Sync: " + decimal.Round(progress * 100, 2) + "%";
|
||||||
|
|
||||||
|
|
||||||
// Exit if set to 0 TXs
|
// Exit if set to 0 TXs
|
||||||
if (userSettings.ContainsKey("portfolio-tx"))
|
if (userSettings.ContainsKey("portfolio-tx"))
|
||||||
{
|
{
|
||||||
@@ -854,28 +870,67 @@ namespace FireWallet
|
|||||||
labelPendingCount.Text = "Unconfirmed TX: " + pendingTxs.Count.ToString();
|
labelPendingCount.Text = "Unconfirmed TX: " + pendingTxs.Count.ToString();
|
||||||
|
|
||||||
|
|
||||||
// Get TX's
|
// Check how many TX there are
|
||||||
APIresponse = await APIGet("wallet/" + account + "/tx/history", true);
|
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")
|
if (APIresponse == "Error")
|
||||||
{
|
{
|
||||||
AddLog("GetInfo Error");
|
AddLog("GetInfo Error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JArray txs = JArray.Parse(APIresponse);
|
JObject TXGET = JObject.Parse(APIresponse);
|
||||||
int txCount = txs.Count;
|
|
||||||
if (txCount > groupBoxTransactions.Height / 55) txCount = (int)Math.Floor(groupBoxTransactions.Height / 55.0);
|
// Check for error
|
||||||
if (userSettings.ContainsKey("portfolio-tx")) txCount = Convert.ToInt32(userSettings["portfolio-tx"]);
|
if (TXGET["error"].ToString() != "")
|
||||||
if (txCount > txs.Count) txCount = txs.Count;
|
{
|
||||||
Control[] tmpControls = new Control[txCount];
|
AddLog("GetInfo Error");
|
||||||
for (int i = 0; i < txCount; i++)
|
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
|
// 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 hash = tx["hash"].ToString();
|
||||||
string date = tx["mdate"].ToString();
|
string date = tx["mdate"].ToString();
|
||||||
|
|
||||||
|
date = DateTime.Parse(date).ToShortDateString();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Panel tmpPanel = new Panel();
|
Panel tmpPanel = new Panel();
|
||||||
tmpPanel.Width = groupBoxTransactions.Width - SystemInformation.VerticalScrollBarWidth - 20;
|
tmpPanel.Width = groupBoxTransactions.Width - SystemInformation.VerticalScrollBarWidth - 20;
|
||||||
tmpPanel.Height = 50;
|
tmpPanel.Height = 50;
|
||||||
@@ -913,24 +968,49 @@ namespace FireWallet
|
|||||||
|
|
||||||
tmpPanel.Controls.Add(labelHash);
|
tmpPanel.Controls.Add(labelHash);
|
||||||
|
|
||||||
// Count inputs and outputs
|
|
||||||
JArray inputs = JArray.Parse(tx["inputs"].ToString());
|
JArray inputs = JArray.Parse(tx["inputs"].ToString());
|
||||||
JArray outputs = JArray.Parse(tx["outputs"].ToString());
|
JArray outputs = JArray.Parse(tx["outputs"].ToString());
|
||||||
int inputCount = inputs.Count;
|
int inputCount = inputs.Count;
|
||||||
int outputCount = outputs.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()
|
Label labelInputOutput = new Label()
|
||||||
{
|
{
|
||||||
Text = "Inputs: " + inputCount + " Outputs: " + outputCount,
|
Text = "Inputs: " + inputCount + " Outputs: " + outputCount + "\n" + cost,
|
||||||
AutoSize = true,
|
AutoSize = true,
|
||||||
Location = new Point(300, 20)
|
Location = new Point(300, 5)
|
||||||
};
|
};
|
||||||
tmpPanel.Controls.Add(labelInputOutput);
|
tmpPanel.Controls.Add(labelInputOutput);
|
||||||
|
|
||||||
|
|
||||||
tmpPanel.Click += (sender, e) =>
|
tmpPanel.Click += (sender, e) =>
|
||||||
{
|
{
|
||||||
TXForm txForm = new TXForm(this, tx);
|
TXForm txForm = new TXForm(this, hash);
|
||||||
txForm.Show();
|
txForm.Show();
|
||||||
};
|
};
|
||||||
|
foreach (Control c in tmpPanel.Controls)
|
||||||
|
{
|
||||||
|
c.Click += (sender, e) =>
|
||||||
|
{
|
||||||
|
TXForm txForm = new TXForm(this, hash);
|
||||||
|
txForm.Show();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
tmpControls[i] = tmpPanel;
|
tmpControls[i] = tmpPanel;
|
||||||
|
|
||||||
|
|
||||||
@@ -1107,6 +1187,7 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
|
|
||||||
panelSettings.Show();
|
panelSettings.Show();
|
||||||
|
panelSettings.Dock = DockStyle.Fill;
|
||||||
buttonSettingsSave.Top = panelSettings.Height - buttonSettingsSave.Height - 10;
|
buttonSettingsSave.Top = panelSettings.Height - buttonSettingsSave.Height - 10;
|
||||||
labelSettingsSaved.Top = buttonSettingsSave.Top + 10;
|
labelSettingsSaved.Top = buttonSettingsSave.Top + 10;
|
||||||
textBoxExTX.Text = userSettings["explorer-tx"];
|
textBoxExTX.Text = userSettings["explorer-tx"];
|
||||||
@@ -1363,6 +1444,7 @@ namespace FireWallet
|
|||||||
notifyForm.ShowDialog();
|
notifyForm.ShowDialog();
|
||||||
notifyForm.Dispose();
|
notifyForm.Dispose();
|
||||||
this.Close();
|
this.Close();
|
||||||
|
Thread.Sleep(1000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1384,36 +1466,47 @@ namespace FireWallet
|
|||||||
notifyForm.ShowDialog();
|
notifyForm.ShowDialog();
|
||||||
notifyForm.Dispose();
|
notifyForm.Dispose();
|
||||||
this.Close();
|
this.Close();
|
||||||
|
Thread.Sleep(1000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check if npm installed
|
// Check if npm installed
|
||||||
testInstalled = new Process();
|
testInstalled = new Process();
|
||||||
testInstalled.StartInfo.FileName = "npm";
|
testInstalled.StartInfo.FileName = "cmd.exe";
|
||||||
testInstalled.StartInfo.Arguments = "-v";
|
testInstalled.StartInfo.Arguments = "npm -v";
|
||||||
testInstalled.StartInfo.RedirectStandardOutput = true;
|
testInstalled.StartInfo.RedirectStandardOutput = true;
|
||||||
testInstalled.StartInfo.UseShellExecute = false;
|
testInstalled.StartInfo.UseShellExecute = false;
|
||||||
testInstalled.StartInfo.CreateNoWindow = true;
|
testInstalled.StartInfo.CreateNoWindow = false;
|
||||||
testInstalled.Start();
|
testInstalled.Start();
|
||||||
|
// Wait 3 seconds and then kill
|
||||||
|
Thread.Sleep(3000);
|
||||||
|
testInstalled.Kill();
|
||||||
outputInstalled = testInstalled.StandardOutput.ReadToEnd();
|
outputInstalled = testInstalled.StandardOutput.ReadToEnd();
|
||||||
testInstalled.WaitForExit();
|
testInstalled.WaitForExit();
|
||||||
|
if (Regex.IsMatch(outputInstalled, @"^\d+\.\d+\.\d+$"))
|
||||||
if (outputInstalled.Length < 3)
|
|
||||||
{
|
{
|
||||||
AddLog("NPM is not installed");
|
AddLog("NPM is not installed");
|
||||||
|
AddLog(outputInstalled);
|
||||||
NotifyForm notifyForm = new NotifyForm("NPM is not installed\nPlease install it to install HSD dependencies");
|
NotifyForm notifyForm = new NotifyForm("NPM is not installed\nPlease install it to install HSD dependencies");
|
||||||
notifyForm.ShowDialog();
|
notifyForm.ShowDialog();
|
||||||
notifyForm.Dispose();
|
notifyForm.Dispose();
|
||||||
this.Close();
|
this.Close();
|
||||||
|
Thread.Sleep(1000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddLog("Prerequisites installed");
|
||||||
|
|
||||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||||
startInfo.FileName = "git";
|
startInfo.FileName = "git";
|
||||||
startInfo.Arguments = $"clone {repositoryUrl} {destinationPath}";
|
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.RedirectStandardOutput = true;
|
||||||
startInfo.UseShellExecute = false;
|
startInfo.UseShellExecute = false;
|
||||||
startInfo.CreateNoWindow = hideScreen;
|
startInfo.CreateNoWindow = hideScreen;
|
||||||
@@ -1591,13 +1684,6 @@ namespace FireWallet
|
|||||||
domainTMP.Left = 10;
|
domainTMP.Left = 10;
|
||||||
domainTMP.BorderStyle = BorderStyle.FixedSingle;
|
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();
|
Label domainName = new Label();
|
||||||
domainName.Text = Domains[i];
|
domainName.Text = Domains[i];
|
||||||
domainName.Top = 5;
|
domainName.Top = 5;
|
||||||
@@ -1607,7 +1693,8 @@ namespace FireWallet
|
|||||||
|
|
||||||
domainTMP.Controls.Add(domainName);
|
domainTMP.Controls.Add(domainName);
|
||||||
|
|
||||||
if (!name.ContainsKey("stats")) {
|
if (!name.ContainsKey("stats"))
|
||||||
|
{
|
||||||
AddLog("Domain " + Domains[i] + " does not have stats");
|
AddLog("Domain " + Domains[i] + " does not have stats");
|
||||||
continue;
|
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);
|
panelDomainList.Controls.Add(domainTMP);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
MainForm mainForm;
|
MainForm mainForm;
|
||||||
JObject tx;
|
JObject tx;
|
||||||
public TXForm(MainForm mainForm, JObject tx)
|
string txid;
|
||||||
|
public TXForm(MainForm mainForm, string txid)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
// Theme
|
// Theme
|
||||||
@@ -29,16 +30,20 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.mainForm = mainForm;
|
this.mainForm = mainForm;
|
||||||
this.tx = tx;
|
this.txid = txid;
|
||||||
|
|
||||||
this.Text = "TX: " + tx["hash"].ToString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void TXForm_Load(object sender, EventArgs e)
|
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();
|
labelHash.Text = "Hash: " + tx["hash"].ToString();
|
||||||
mainForm.AddLog("Viewing TX: " + 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
|
// For each input
|
||||||
JArray inputs = (JArray)tx["inputs"];
|
JArray inputs = (JArray)tx["inputs"];
|
||||||
@@ -131,6 +136,9 @@ namespace FireWallet
|
|||||||
|
|
||||||
panelOutputs.Controls.Add(PanelOutput);
|
panelOutputs.Controls.Add(PanelOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
panelInputs.Visible = true;
|
||||||
|
panelOutputs.Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Explorer_Click(object sender, EventArgs e)
|
private void Explorer_Click(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -224,15 +224,15 @@
|
|||||||
{
|
{
|
||||||
"Name" = "8:Microsoft Visual Studio"
|
"Name" = "8:Microsoft Visual Studio"
|
||||||
"ProductName" = "8:FireWallet"
|
"ProductName" = "8:FireWallet"
|
||||||
"ProductCode" = "8:{D203173F-39CF-4D8C-810D-FF6840540AF3}"
|
"ProductCode" = "8:{D85E3D97-B8F8-4212-9488-A48CF16CCF68}"
|
||||||
"PackageCode" = "8:{419FAC68-35FF-48D7-AD7D-83813C7CF72A}"
|
"PackageCode" = "8:{D2DCB865-F096-4420-AE54-579B6159A7CF}"
|
||||||
"UpgradeCode" = "8:{0C86F725-6B01-4173-AA05-3F0EDF481362}"
|
"UpgradeCode" = "8:{0C86F725-6B01-4173-AA05-3F0EDF481362}"
|
||||||
"AspNetVersion" = "8:"
|
"AspNetVersion" = "8:"
|
||||||
"RestartWWWService" = "11:FALSE"
|
"RestartWWWService" = "11:FALSE"
|
||||||
"RemovePreviousVersions" = "11:TRUE"
|
"RemovePreviousVersions" = "11:TRUE"
|
||||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||||
"InstallAllUsers" = "11:FALSE"
|
"InstallAllUsers" = "11:FALSE"
|
||||||
"ProductVersion" = "8:2.5"
|
"ProductVersion" = "8:2.7"
|
||||||
"Manufacturer" = "8:Nathan.Woodburn/"
|
"Manufacturer" = "8:Nathan.Woodburn/"
|
||||||
"ARPHELPTELEPHONE" = "8:"
|
"ARPHELPTELEPHONE" = "8:"
|
||||||
"ARPHELPLINK" = "8:https://l.woodburn.au/discord"
|
"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 network = Network.get(config.str('network')); // Get the network
|
||||||
const id = config.str('wallet-id'); // Get the wallet id
|
const id = config.str('wallet-id'); // Get the wallet id
|
||||||
const acct = config.str('account-name'); // Get the account name
|
const acct = config.str('account-name'); // Get the account name
|
||||||
const batch = args[0]; // Get the batch file location
|
// Log the arguments to the console (for debugging)
|
||||||
const nameslocation = args[1]; // Get the names file location
|
|
||||||
|
|
||||||
|
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
|
await wclient.execute('selectwallet', [id]); // Select the wallet
|
||||||
|
|
||||||
|
|
||||||
const fs = require('fs'); // Import fs (used to read files)
|
|
||||||
try {
|
try {
|
||||||
const data = fs.readFileSync(batch, 'utf8'); // Read the batch file
|
const mtx = MTX.fromJSON(batch.result); // Create a new MTX from the JSON
|
||||||
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 hashes = {}; // Create an empty object to store the hashes
|
const hashes = {}; // Create an empty object to store the hashes
|
||||||
for (const name of names) { // Loop through the names
|
for (const name of names) { // Loop through the names
|
||||||
const hash = hashName(name); // Hash the name
|
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 createaccount <account-name> <account-index>');
|
||||||
console.log(' $ hsd-ledger createaddress');
|
console.log(' $ hsd-ledger createaddress');
|
||||||
console.log(' $ hsd-ledger sendtoaddress <address> <amount>');
|
console.log(' $ hsd-ledger sendtoaddress <address> <amount>');
|
||||||
|
console.log(' $ hsd-ledger sendraw <batch> <names>');
|
||||||
console.log(' $ hsd-ledger getwallets');
|
console.log(' $ hsd-ledger getwallets');
|
||||||
console.log(' $ hsd-ledger getaccounts');
|
console.log(' $ hsd-ledger getaccounts');
|
||||||
console.log(' $ hsd-ledger getaccount <account-name>');
|
console.log(' $ hsd-ledger getaccount <account-name>');
|
||||||
|
|||||||
Reference in New Issue
Block a user