mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2025-12-06 08:33:00 +11:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
6218b337fb
|
|||
|
79350570fd
|
|||
|
88c6b5afe0
|
|||
|
f06bc5b711
|
|||
|
42536e47bb
|
|||
|
404a47ec79
|
|||
|
c3abd0b4de
|
|||
|
41a38e2af1
|
|||
|
699b1051d4
|
|||
|
14cb5453dc
|
|||
|
5323a8ff0d
|
|||
|
2572b17898
|
|||
|
a8f425434e
|
|||
|
07c9618837
|
|||
|
eccc584b2c
|
|||
|
cf2f68f2b3
|
|||
|
5eb80bcd06
|
|||
|
7c38bfc755
|
|||
|
d4620af384
|
|||
|
15cb4efaf1
|
|||
|
18607358bf
|
|||
|
6db6d02e9e
|
|||
|
3eda3d7419
|
|||
|
3f6c2bdded
|
|||
|
2bfca908a9
|
|||
|
531d41a413
|
|||
|
960af0b169
|
@@ -538,14 +538,8 @@ namespace FireWallet
|
|||||||
notifyForm.Dispose();
|
notifyForm.Dispose();
|
||||||
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();
|
||||||
@@ -640,17 +638,45 @@ namespace FireWallet
|
|||||||
openFileDialog.Title = "Open Batch";
|
openFileDialog.Title = "Open Batch";
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
StreamReader sr = new StreamReader(openFileDialog.FileName);
|
try
|
||||||
string line;
|
|
||||||
string[] domains = new string[0];
|
|
||||||
while ((line = sr.ReadLine()) != null)
|
|
||||||
{
|
{
|
||||||
string[] split = line.Split(',');
|
StreamReader sr = new StreamReader(openFileDialog.FileName);
|
||||||
try
|
string line;
|
||||||
|
string[] domains = new string[0];
|
||||||
|
while ((line = sr.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
if (split.Length > 2)
|
string[] split = line.Split(',');
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (split[1] == "UPDATE")
|
if (split.Length > 2)
|
||||||
|
{
|
||||||
|
if (split[1] == "UPDATE")
|
||||||
|
{
|
||||||
|
// Select operation and import domains
|
||||||
|
string[] newDomains = new string[domains.Length + 1];
|
||||||
|
for (int i = 0; i < domains.Length; i++)
|
||||||
|
{
|
||||||
|
newDomains[i] = domains[i];
|
||||||
|
}
|
||||||
|
newDomains[domains.Length] = split[0];
|
||||||
|
domains = newDomains;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (split.Length == 2)
|
||||||
|
{
|
||||||
|
AddBatch(split[0], split[1]);
|
||||||
|
}
|
||||||
|
else if (split.Length == 3)
|
||||||
|
{
|
||||||
|
AddBatch(split[0], split[1], split[2]);
|
||||||
|
}
|
||||||
|
else if (split.Length == 4)
|
||||||
|
{
|
||||||
|
AddBatch(split[0], split[1], Convert.ToDecimal(split[2]), Convert.ToDecimal(split[3]));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Select operation and import domains
|
// Select operation and import domains
|
||||||
string[] newDomains = new string[domains.Length + 1];
|
string[] newDomains = new string[domains.Length + 1];
|
||||||
@@ -658,68 +684,49 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
newDomains[i] = domains[i];
|
newDomains[i] = domains[i];
|
||||||
}
|
}
|
||||||
newDomains[domains.Length] = split[0];
|
newDomains[domains.Length] = line.Trim();
|
||||||
domains = newDomains;
|
domains = newDomains;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
if (split.Length == 2)
|
|
||||||
{
|
{
|
||||||
AddBatch(split[0], split[1]);
|
AddLog("Error importing batch: " + ex.Message);
|
||||||
}
|
NotifyForm notifyForm = new NotifyForm("Error importing batch");
|
||||||
else if (split.Length == 3)
|
notifyForm.ShowDialog();
|
||||||
{
|
notifyForm.Dispose();
|
||||||
AddBatch(split[0], split[1], split[2]);
|
|
||||||
}
|
|
||||||
else if (split.Length == 4)
|
|
||||||
{
|
|
||||||
AddBatch(split[0], split[1], Convert.ToDecimal(split[2]), Convert.ToDecimal(split[3]));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Select operation and import domains
|
|
||||||
string[] newDomains = new string[domains.Length + 1];
|
|
||||||
for (int i = 0; i < domains.Length; i++)
|
|
||||||
{
|
|
||||||
newDomains[i] = domains[i];
|
|
||||||
}
|
|
||||||
newDomains[domains.Length] = line.Trim();
|
|
||||||
domains = newDomains;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
if (domains.Length > 0)
|
||||||
{
|
{
|
||||||
AddLog("Error importing batch: " + ex.Message);
|
BatchImportForm batchImportForm = new BatchImportForm(domains);
|
||||||
NotifyForm notifyForm = new NotifyForm("Error importing batch");
|
batchImportForm.ShowDialog();
|
||||||
notifyForm.ShowDialog();
|
if (batchImportForm.batches != null)
|
||||||
notifyForm.Dispose();
|
{
|
||||||
|
foreach (Batch b in batchImportForm.batches)
|
||||||
|
{
|
||||||
|
if (b.method == "BID")
|
||||||
|
{
|
||||||
|
AddBatch(b.domain, b.method, b.bid, b.lockup);
|
||||||
|
}
|
||||||
|
else if (b.method == "TRANSFER")
|
||||||
|
{
|
||||||
|
AddBatch(b.domain, b.method, b.toAddress);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddBatch(b.domain, b.method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
sr.Dispose();
|
||||||
if (domains.Length > 0)
|
} catch (Exception ex)
|
||||||
{
|
{
|
||||||
BatchImportForm batchImportForm = new BatchImportForm(domains);
|
AddLog("Error importing batch: " + ex.Message);
|
||||||
batchImportForm.ShowDialog();
|
NotifyForm notifyForm = new NotifyForm("Error importing batch\nMake sure the file is in not in use");
|
||||||
if (batchImportForm.batches != null)
|
notifyForm.ShowDialog();
|
||||||
{
|
notifyForm.Dispose();
|
||||||
foreach (Batch b in batchImportForm.batches)
|
|
||||||
{
|
|
||||||
if (b.method == "BID")
|
|
||||||
{
|
|
||||||
AddBatch(b.domain, b.method, b.bid, b.lockup);
|
|
||||||
}
|
|
||||||
else if (b.method == "TRANSFER")
|
|
||||||
{
|
|
||||||
AddBatch(b.domain, b.method, b.toAddress);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AddBatch(b.domain, b.method);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sr.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -264,8 +264,6 @@ namespace FireWallet
|
|||||||
buttonActionAlt.Hide();
|
buttonActionAlt.Hide();
|
||||||
buttonActionMain.Hide();
|
buttonActionMain.Hide();
|
||||||
groupBoxAction.Text = "Reserved";
|
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.6</Version>
|
<Version>3.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -27,8 +27,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DnsClient" Version="1.7.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="QRCoder" Version="1.4.3" />
|
<PackageReference Include="QRCoder" Version="1.4.3" />
|
||||||
|
<PackageReference Include="Yubico.YubiKey" Version="1.7.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
159
FireWallet/MainForm.Designer.cs
generated
159
FireWallet/MainForm.Designer.cs
generated
@@ -41,6 +41,10 @@ namespace FireWallet
|
|||||||
toolStripStatusLabelaccount = new ToolStripStatusLabel();
|
toolStripStatusLabelaccount = new ToolStripStatusLabel();
|
||||||
toolStripStatusLabelLedger = new ToolStripStatusLabel();
|
toolStripStatusLabelLedger = new ToolStripStatusLabel();
|
||||||
toolStripSplitButtonlogout = new ToolStripSplitButton();
|
toolStripSplitButtonlogout = new ToolStripSplitButton();
|
||||||
|
toolStripDropDownButtonHelp = new ToolStripDropDownButton();
|
||||||
|
githubToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
websiteToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
supportDiscordServerToolStripMenuItem = new ToolStripMenuItem();
|
||||||
timerNodeStatus = new System.Windows.Forms.Timer(components);
|
timerNodeStatus = new System.Windows.Forms.Timer(components);
|
||||||
panelaccount = new Panel();
|
panelaccount = new Panel();
|
||||||
groupBoxaccount = new GroupBox();
|
groupBoxaccount = new GroupBox();
|
||||||
@@ -59,7 +63,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,7 +73,9 @@ 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();
|
||||||
|
labelSendingHIPAddress = new Label();
|
||||||
checkBoxSendSubFee = new CheckBox();
|
checkBoxSendSubFee = new CheckBox();
|
||||||
buttonSendMax = new Button();
|
buttonSendMax = new Button();
|
||||||
buttonSendHNS = new Button();
|
buttonSendHNS = new Button();
|
||||||
@@ -82,6 +87,7 @@ namespace FireWallet
|
|||||||
labelSendingAmount = new Label();
|
labelSendingAmount = new Label();
|
||||||
labelSendingTo = new Label();
|
labelSendingTo = new Label();
|
||||||
labelSendPrompt = new Label();
|
labelSendPrompt = new Label();
|
||||||
|
labelHIPArrow = new Label();
|
||||||
panelRecieve = new Panel();
|
panelRecieve = new Panel();
|
||||||
buttonAddressVerify = new Button();
|
buttonAddressVerify = new Button();
|
||||||
pictureBoxReceiveQR = new PictureBox();
|
pictureBoxReceiveQR = new PictureBox();
|
||||||
@@ -89,6 +95,8 @@ namespace FireWallet
|
|||||||
textBoxReceiveAddress = new TextBox();
|
textBoxReceiveAddress = new TextBox();
|
||||||
labelReceive1 = new Label();
|
labelReceive1 = new Label();
|
||||||
panelDomains = new Panel();
|
panelDomains = new Panel();
|
||||||
|
labelDomainSort = new Label();
|
||||||
|
comboBoxDomainSort = new ComboBox();
|
||||||
buttonExportDomains = new Button();
|
buttonExportDomains = new Button();
|
||||||
groupBoxDomains = new GroupBox();
|
groupBoxDomains = new GroupBox();
|
||||||
panelDomainList = new Panel();
|
panelDomainList = new Panel();
|
||||||
@@ -96,6 +104,7 @@ namespace FireWallet
|
|||||||
textBoxDomainSearch = new TextBox();
|
textBoxDomainSearch = new TextBox();
|
||||||
panelSettings = new Panel();
|
panelSettings = new Panel();
|
||||||
groupBoxSettingsWallet = new GroupBox();
|
groupBoxSettingsWallet = new GroupBox();
|
||||||
|
buttonSettingsYubikey = new Button();
|
||||||
buttonSettingsRescan = new Button();
|
buttonSettingsRescan = new Button();
|
||||||
buttonSeed = new Button();
|
buttonSeed = new Button();
|
||||||
groupBoxSettingsMisc = new GroupBox();
|
groupBoxSettingsMisc = new GroupBox();
|
||||||
@@ -139,7 +148,7 @@ namespace FireWallet
|
|||||||
// statusStripmain
|
// statusStripmain
|
||||||
//
|
//
|
||||||
statusStripmain.Dock = DockStyle.Top;
|
statusStripmain.Dock = DockStyle.Top;
|
||||||
statusStripmain.Items.AddRange(new ToolStripItem[] { toolStripStatusLabelNetwork, toolStripStatusLabelstatus, toolStripStatusLabelaccount, toolStripStatusLabelLedger, toolStripSplitButtonlogout });
|
statusStripmain.Items.AddRange(new ToolStripItem[] { toolStripStatusLabelNetwork, toolStripStatusLabelstatus, toolStripStatusLabelaccount, toolStripStatusLabelLedger, toolStripSplitButtonlogout, toolStripDropDownButtonHelp });
|
||||||
statusStripmain.Location = new Point(0, 0);
|
statusStripmain.Location = new Point(0, 0);
|
||||||
statusStripmain.Name = "statusStripmain";
|
statusStripmain.Name = "statusStripmain";
|
||||||
statusStripmain.Size = new Size(1152, 22);
|
statusStripmain.Size = new Size(1152, 22);
|
||||||
@@ -190,6 +199,39 @@ namespace FireWallet
|
|||||||
toolStripSplitButtonlogout.Visible = false;
|
toolStripSplitButtonlogout.Visible = false;
|
||||||
toolStripSplitButtonlogout.ButtonClick += Logout;
|
toolStripSplitButtonlogout.ButtonClick += Logout;
|
||||||
//
|
//
|
||||||
|
// toolStripDropDownButtonHelp
|
||||||
|
//
|
||||||
|
toolStripDropDownButtonHelp.DisplayStyle = ToolStripItemDisplayStyle.Text;
|
||||||
|
toolStripDropDownButtonHelp.DropDownItems.AddRange(new ToolStripItem[] { githubToolStripMenuItem, websiteToolStripMenuItem, supportDiscordServerToolStripMenuItem });
|
||||||
|
toolStripDropDownButtonHelp.Image = (Image)resources.GetObject("toolStripDropDownButtonHelp.Image");
|
||||||
|
toolStripDropDownButtonHelp.ImageTransparentColor = Color.Magenta;
|
||||||
|
toolStripDropDownButtonHelp.Margin = new Padding(20, 2, 0, 0);
|
||||||
|
toolStripDropDownButtonHelp.Name = "toolStripDropDownButtonHelp";
|
||||||
|
toolStripDropDownButtonHelp.Size = new Size(45, 20);
|
||||||
|
toolStripDropDownButtonHelp.Text = "Help";
|
||||||
|
toolStripDropDownButtonHelp.ToolTipText = "Help";
|
||||||
|
//
|
||||||
|
// githubToolStripMenuItem
|
||||||
|
//
|
||||||
|
githubToolStripMenuItem.Name = "githubToolStripMenuItem";
|
||||||
|
githubToolStripMenuItem.Size = new Size(194, 22);
|
||||||
|
githubToolStripMenuItem.Text = "Github";
|
||||||
|
githubToolStripMenuItem.Click += githubToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// websiteToolStripMenuItem
|
||||||
|
//
|
||||||
|
websiteToolStripMenuItem.Name = "websiteToolStripMenuItem";
|
||||||
|
websiteToolStripMenuItem.Size = new Size(194, 22);
|
||||||
|
websiteToolStripMenuItem.Text = "Website";
|
||||||
|
websiteToolStripMenuItem.Click += websiteToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// supportDiscordServerToolStripMenuItem
|
||||||
|
//
|
||||||
|
supportDiscordServerToolStripMenuItem.Name = "supportDiscordServerToolStripMenuItem";
|
||||||
|
supportDiscordServerToolStripMenuItem.Size = new Size(194, 22);
|
||||||
|
supportDiscordServerToolStripMenuItem.Text = "Support Discord Server";
|
||||||
|
supportDiscordServerToolStripMenuItem.Click += supportDiscordServerToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// timerNodeStatus
|
// timerNodeStatus
|
||||||
//
|
//
|
||||||
timerNodeStatus.Enabled = true;
|
timerNodeStatus.Enabled = true;
|
||||||
@@ -200,7 +242,7 @@ namespace FireWallet
|
|||||||
//
|
//
|
||||||
panelaccount.BackColor = Color.Transparent;
|
panelaccount.BackColor = Color.Transparent;
|
||||||
panelaccount.Controls.Add(groupBoxaccount);
|
panelaccount.Controls.Add(groupBoxaccount);
|
||||||
panelaccount.Location = new Point(1082, 211);
|
panelaccount.Location = new Point(132, 30);
|
||||||
panelaccount.Name = "panelaccount";
|
panelaccount.Name = "panelaccount";
|
||||||
panelaccount.Size = new Size(1074, 642);
|
panelaccount.Size = new Size(1074, 642);
|
||||||
panelaccount.TabIndex = 1;
|
panelaccount.TabIndex = 1;
|
||||||
@@ -400,18 +442,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,8 +548,21 @@ 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(labelSendingHIPAddress);
|
||||||
panelSend.Controls.Add(checkBoxSendSubFee);
|
panelSend.Controls.Add(checkBoxSendSubFee);
|
||||||
panelSend.Controls.Add(buttonSendMax);
|
panelSend.Controls.Add(buttonSendMax);
|
||||||
panelSend.Controls.Add(buttonSendHNS);
|
panelSend.Controls.Add(buttonSendHNS);
|
||||||
@@ -531,12 +574,23 @@ namespace FireWallet
|
|||||||
panelSend.Controls.Add(labelSendingAmount);
|
panelSend.Controls.Add(labelSendingAmount);
|
||||||
panelSend.Controls.Add(labelSendingTo);
|
panelSend.Controls.Add(labelSendingTo);
|
||||||
panelSend.Controls.Add(labelSendPrompt);
|
panelSend.Controls.Add(labelSendPrompt);
|
||||||
panelSend.Location = new Point(1113, 42);
|
panelSend.Controls.Add(labelHIPArrow);
|
||||||
|
panelSend.Location = new Point(880, 441);
|
||||||
panelSend.Name = "panelSend";
|
panelSend.Name = "panelSend";
|
||||||
panelSend.Size = new Size(974, 521);
|
panelSend.Size = new Size(974, 521);
|
||||||
panelSend.TabIndex = 2;
|
panelSend.TabIndex = 2;
|
||||||
panelSend.Visible = false;
|
panelSend.Visible = false;
|
||||||
//
|
//
|
||||||
|
// labelSendingHIPAddress
|
||||||
|
//
|
||||||
|
labelSendingHIPAddress.AutoSize = true;
|
||||||
|
labelSendingHIPAddress.Location = new Point(375, 130);
|
||||||
|
labelSendingHIPAddress.Name = "labelSendingHIPAddress";
|
||||||
|
labelSendingHIPAddress.Size = new Size(64, 15);
|
||||||
|
labelSendingHIPAddress.TabIndex = 17;
|
||||||
|
labelSendingHIPAddress.Text = "To Address";
|
||||||
|
labelSendingHIPAddress.Visible = false;
|
||||||
|
//
|
||||||
// checkBoxSendSubFee
|
// checkBoxSendSubFee
|
||||||
//
|
//
|
||||||
checkBoxSendSubFee.AutoSize = true;
|
checkBoxSendSubFee.AutoSize = true;
|
||||||
@@ -579,11 +633,11 @@ namespace FireWallet
|
|||||||
//
|
//
|
||||||
labelSendingError.AutoSize = true;
|
labelSendingError.AutoSize = true;
|
||||||
labelSendingError.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
labelSendingError.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
labelSendingError.Location = new Point(615, 131);
|
labelSendingError.Location = new Point(679, 130);
|
||||||
labelSendingError.Name = "labelSendingError";
|
labelSendingError.Name = "labelSendingError";
|
||||||
labelSendingError.Size = new Size(52, 21);
|
labelSendingError.Size = new Size(78, 21);
|
||||||
labelSendingError.TabIndex = 13;
|
labelSendingError.TabIndex = 13;
|
||||||
labelSendingError.Text = "label1";
|
labelSendingError.Text = "labelError";
|
||||||
labelSendingError.Visible = false;
|
labelSendingError.Visible = false;
|
||||||
//
|
//
|
||||||
// labelSendingFee
|
// labelSendingFee
|
||||||
@@ -654,6 +708,17 @@ namespace FireWallet
|
|||||||
labelSendPrompt.TabIndex = 0;
|
labelSendPrompt.TabIndex = 0;
|
||||||
labelSendPrompt.Text = "Send HNS";
|
labelSendPrompt.Text = "Send HNS";
|
||||||
//
|
//
|
||||||
|
// labelHIPArrow
|
||||||
|
//
|
||||||
|
labelHIPArrow.AutoSize = true;
|
||||||
|
labelHIPArrow.Font = new Font("Segoe UI", 18F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
labelHIPArrow.Location = new Point(346, 119);
|
||||||
|
labelHIPArrow.Name = "labelHIPArrow";
|
||||||
|
labelHIPArrow.Size = new Size(32, 32);
|
||||||
|
labelHIPArrow.TabIndex = 18;
|
||||||
|
labelHIPArrow.Text = "⮡ ";
|
||||||
|
labelHIPArrow.Visible = false;
|
||||||
|
//
|
||||||
// panelRecieve
|
// panelRecieve
|
||||||
//
|
//
|
||||||
panelRecieve.Controls.Add(buttonAddressVerify);
|
panelRecieve.Controls.Add(buttonAddressVerify);
|
||||||
@@ -721,17 +786,42 @@ namespace FireWallet
|
|||||||
//
|
//
|
||||||
// panelDomains
|
// panelDomains
|
||||||
//
|
//
|
||||||
|
panelDomains.Controls.Add(labelDomainSort);
|
||||||
|
panelDomains.Controls.Add(comboBoxDomainSort);
|
||||||
panelDomains.Controls.Add(buttonRenewAll);
|
panelDomains.Controls.Add(buttonRenewAll);
|
||||||
panelDomains.Controls.Add(buttonExportDomains);
|
panelDomains.Controls.Add(buttonExportDomains);
|
||||||
panelDomains.Controls.Add(groupBoxDomains);
|
panelDomains.Controls.Add(groupBoxDomains);
|
||||||
panelDomains.Controls.Add(labelDomainSearch);
|
panelDomains.Controls.Add(labelDomainSearch);
|
||||||
panelDomains.Controls.Add(textBoxDomainSearch);
|
panelDomains.Controls.Add(textBoxDomainSearch);
|
||||||
panelDomains.Location = new Point(120, 48);
|
panelDomains.Location = new Point(861, 364);
|
||||||
panelDomains.Name = "panelDomains";
|
panelDomains.Name = "panelDomains";
|
||||||
panelDomains.Size = new Size(920, 536);
|
panelDomains.Size = new Size(920, 536);
|
||||||
panelDomains.TabIndex = 18;
|
panelDomains.TabIndex = 18;
|
||||||
panelDomains.Visible = false;
|
panelDomains.Visible = false;
|
||||||
//
|
//
|
||||||
|
// labelDomainSort
|
||||||
|
//
|
||||||
|
labelDomainSort.AutoSize = true;
|
||||||
|
labelDomainSort.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
labelDomainSort.Location = new Point(638, 15);
|
||||||
|
labelDomainSort.Name = "labelDomainSort";
|
||||||
|
labelDomainSort.Size = new Size(42, 21);
|
||||||
|
labelDomainSort.TabIndex = 12;
|
||||||
|
labelDomainSort.Text = "Sort:";
|
||||||
|
//
|
||||||
|
// comboBoxDomainSort
|
||||||
|
//
|
||||||
|
comboBoxDomainSort.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxDomainSort.FlatStyle = FlatStyle.Flat;
|
||||||
|
comboBoxDomainSort.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
comboBoxDomainSort.FormattingEnabled = true;
|
||||||
|
comboBoxDomainSort.Items.AddRange(new object[] { "Default", "Alphabetical", "Expiring", "Value" });
|
||||||
|
comboBoxDomainSort.Location = new Point(686, 12);
|
||||||
|
comboBoxDomainSort.Name = "comboBoxDomainSort";
|
||||||
|
comboBoxDomainSort.Size = new Size(121, 29);
|
||||||
|
comboBoxDomainSort.TabIndex = 11;
|
||||||
|
comboBoxDomainSort.DropDownClosed += comboBoxDomainSort_DropDownClosed;
|
||||||
|
//
|
||||||
// buttonExportDomains
|
// buttonExportDomains
|
||||||
//
|
//
|
||||||
buttonExportDomains.FlatStyle = FlatStyle.Flat;
|
buttonExportDomains.FlatStyle = FlatStyle.Flat;
|
||||||
@@ -792,7 +882,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(848, 306);
|
||||||
panelSettings.Name = "panelSettings";
|
panelSettings.Name = "panelSettings";
|
||||||
panelSettings.Size = new Size(930, 550);
|
panelSettings.Size = new Size(930, 550);
|
||||||
panelSettings.TabIndex = 19;
|
panelSettings.TabIndex = 19;
|
||||||
@@ -800,6 +890,7 @@ namespace FireWallet
|
|||||||
//
|
//
|
||||||
// groupBoxSettingsWallet
|
// groupBoxSettingsWallet
|
||||||
//
|
//
|
||||||
|
groupBoxSettingsWallet.Controls.Add(buttonSettingsYubikey);
|
||||||
groupBoxSettingsWallet.Controls.Add(buttonSettingsRescan);
|
groupBoxSettingsWallet.Controls.Add(buttonSettingsRescan);
|
||||||
groupBoxSettingsWallet.Controls.Add(buttonSeed);
|
groupBoxSettingsWallet.Controls.Add(buttonSeed);
|
||||||
groupBoxSettingsWallet.Location = new Point(507, 16);
|
groupBoxSettingsWallet.Location = new Point(507, 16);
|
||||||
@@ -809,6 +900,17 @@ namespace FireWallet
|
|||||||
groupBoxSettingsWallet.TabStop = false;
|
groupBoxSettingsWallet.TabStop = false;
|
||||||
groupBoxSettingsWallet.Text = "Wallet Controls";
|
groupBoxSettingsWallet.Text = "Wallet Controls";
|
||||||
//
|
//
|
||||||
|
// buttonSettingsYubikey
|
||||||
|
//
|
||||||
|
buttonSettingsYubikey.FlatStyle = FlatStyle.Flat;
|
||||||
|
buttonSettingsYubikey.Location = new Point(6, 133);
|
||||||
|
buttonSettingsYubikey.Name = "buttonSettingsYubikey";
|
||||||
|
buttonSettingsYubikey.Size = new Size(98, 50);
|
||||||
|
buttonSettingsYubikey.TabIndex = 9;
|
||||||
|
buttonSettingsYubikey.Text = "YubiKey";
|
||||||
|
buttonSettingsYubikey.UseVisualStyleBackColor = true;
|
||||||
|
buttonSettingsYubikey.Click += buttonSettingsYubikey_Click;
|
||||||
|
//
|
||||||
// buttonSettingsRescan
|
// buttonSettingsRescan
|
||||||
//
|
//
|
||||||
buttonSettingsRescan.FlatStyle = FlatStyle.Flat;
|
buttonSettingsRescan.FlatStyle = FlatStyle.Flat;
|
||||||
@@ -1008,13 +1110,13 @@ namespace FireWallet
|
|||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(1152, 575);
|
ClientSize = new Size(1152, 575);
|
||||||
Controls.Add(panelaccount);
|
Controls.Add(panelaccount);
|
||||||
Controls.Add(panelPortfolio);
|
Controls.Add(panelSettings);
|
||||||
Controls.Add(panelRecieve);
|
|
||||||
Controls.Add(panelDomains);
|
Controls.Add(panelDomains);
|
||||||
Controls.Add(panelSend);
|
Controls.Add(panelSend);
|
||||||
|
Controls.Add(panelPortfolio);
|
||||||
|
Controls.Add(panelRecieve);
|
||||||
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;
|
||||||
@@ -1137,5 +1239,14 @@ namespace FireWallet
|
|||||||
private Button buttonRevealAll;
|
private Button buttonRevealAll;
|
||||||
private Button buttonExportDomains;
|
private Button buttonExportDomains;
|
||||||
private Button buttonRenewAll;
|
private Button buttonRenewAll;
|
||||||
|
private ToolStripDropDownButton toolStripDropDownButtonHelp;
|
||||||
|
private ToolStripMenuItem githubToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem websiteToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem supportDiscordServerToolStripMenuItem;
|
||||||
|
private Label labelHIPArrow;
|
||||||
|
private Label labelSendingHIPAddress;
|
||||||
|
private ComboBox comboBoxDomainSort;
|
||||||
|
private Label labelDomainSort;
|
||||||
|
private Button buttonSettingsYubikey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,9 +7,14 @@ using QRCoder;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Security.Policy;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using DnsClient;
|
||||||
|
using DnsClient.Protocol;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using System.Net.Security;
|
||||||
|
// Used to use Yubikey to login
|
||||||
|
using Yubico.YubiKey;
|
||||||
|
using Yubico.YubiKey.Piv;
|
||||||
|
|
||||||
namespace FireWallet
|
namespace FireWallet
|
||||||
{
|
{
|
||||||
@@ -48,6 +53,14 @@ namespace FireWallet
|
|||||||
timerNodeStatus.Stop();
|
timerNodeStatus.Stop();
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
UpdateTheme();
|
UpdateTheme();
|
||||||
|
// Theme drop down
|
||||||
|
foreach (ToolStripMenuItem c in toolStripDropDownButtonHelp.DropDownItems)
|
||||||
|
{
|
||||||
|
c.ForeColor = ColorTranslator.FromHtml(theme["foreground"]);
|
||||||
|
c.BackColor = ColorTranslator.FromHtml(theme["background"]);
|
||||||
|
}
|
||||||
|
toolStripDropDownButtonHelp.DropDown.BackColor = ColorTranslator.FromHtml(theme["background"]);
|
||||||
|
|
||||||
if (await LoadNode() != true) this.Close();
|
if (await LoadNode() != true) this.Close();
|
||||||
|
|
||||||
|
|
||||||
@@ -183,27 +196,36 @@ namespace FireWallet
|
|||||||
AddLog("Starting HSD");
|
AddLog("Starting HSD");
|
||||||
toolStripStatusLabelstatus.Text = "Status: HSD Starting";
|
toolStripStatusLabelstatus.Text = "Status: HSD Starting";
|
||||||
|
|
||||||
if (!Directory.Exists(dir + "hsd"))
|
string hsdPath = dir + "hsd\\bin\\hsd.exe";
|
||||||
|
if (nodeSettings.ContainsKey("HSD-command"))
|
||||||
{
|
{
|
||||||
NotifyForm Notifyinstall = new NotifyForm("Installing hsd\nThis may take a few minutes\nDo not close FireWallet", false);
|
if (nodeSettings["HSD-command"].Contains("{default-dir}"))
|
||||||
Notifyinstall.Show();
|
{
|
||||||
// Wait for the notification to show
|
if (!Directory.Exists(dir + "hsd"))
|
||||||
await Task.Delay(1000);
|
{
|
||||||
|
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 repositoryUrl = "https://github.com/handshake-org/hsd.git";
|
||||||
string destinationPath = dir + "hsd";
|
string destinationPath = dir + "hsd";
|
||||||
CloneRepository(repositoryUrl, destinationPath);
|
CloneRepository(repositoryUrl, destinationPath);
|
||||||
|
|
||||||
Notifyinstall.CloseNotification();
|
Notifyinstall.CloseNotification();
|
||||||
Notifyinstall.Dispose();
|
Notifyinstall.Dispose();
|
||||||
}
|
}
|
||||||
if (!Directory.Exists(dir + "hsd\\node_modules"))
|
if (!Directory.Exists(dir + "hsd\\node_modules"))
|
||||||
{
|
{
|
||||||
AddLog("HSD install failed");
|
AddLog("HSD install failed");
|
||||||
this.Close();
|
this.Close();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
hsdProcess = new Process();
|
hsdProcess = new Process();
|
||||||
|
|
||||||
bool hideScreen = true;
|
bool hideScreen = true;
|
||||||
@@ -221,7 +243,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;
|
||||||
}
|
}
|
||||||
@@ -230,17 +253,45 @@ namespace FireWallet
|
|||||||
hsdProcess.StartInfo.RedirectStandardOutput = false;
|
hsdProcess.StartInfo.RedirectStandardOutput = false;
|
||||||
hsdProcess.StartInfo.UseShellExecute = false;
|
hsdProcess.StartInfo.UseShellExecute = false;
|
||||||
hsdProcess.StartInfo.FileName = "node.exe";
|
hsdProcess.StartInfo.FileName = "node.exe";
|
||||||
hsdProcess.StartInfo.Arguments = dir + "hsd/bin/hsd --agent=FireWallet --index-tx --index-address --api-key " + nodeSettings["Key"];
|
|
||||||
|
|
||||||
string bobPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Bob\\hsd_data";
|
if (nodeSettings.ContainsKey("HSD-command"))
|
||||||
if (Directory.Exists(bobPath))
|
|
||||||
{
|
{
|
||||||
hsdProcess.StartInfo.Arguments = hsdProcess.StartInfo.Arguments + " --prefix " + bobPath;
|
AddLog("Using custom HSD command");
|
||||||
|
string command = nodeSettings["HSD-command"];
|
||||||
|
command = command.Replace("{default-dir}", dir + "hsd\\bin\\hsd");
|
||||||
|
|
||||||
|
string bobPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Bob\\hsd_data";
|
||||||
|
if (Directory.Exists(bobPath))
|
||||||
|
{
|
||||||
|
command = command.Replace("{Bob}", bobPath);
|
||||||
|
}
|
||||||
|
else if (command.Contains("{Bob}"))
|
||||||
|
{
|
||||||
|
AddLog("Bob not found, using default HSD command");
|
||||||
|
command = dir + "hsd\\bin\\hsd --agent=FireWallet --index-tx --index-address --api-key " + nodeSettings["Key"];
|
||||||
|
}
|
||||||
|
|
||||||
|
command = command.Replace("{key}", nodeSettings["Key"]);
|
||||||
|
hsdProcess.StartInfo.Arguments = command;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddLog("Using default HSD command");
|
||||||
|
hsdProcess.StartInfo.Arguments = dir + "hsd\\bin\\hsd --agent=FireWallet --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();
|
hsdProcess.Start();
|
||||||
// Wait for HSD to start
|
// Wait for HSD to start
|
||||||
await Task.Delay(2000);
|
await Task.Delay(2000);
|
||||||
|
|
||||||
// Check if HSD is running
|
// Check if HSD is running
|
||||||
if (hsdProcess.HasExited)
|
if (hsdProcess.HasExited)
|
||||||
{
|
{
|
||||||
@@ -307,6 +358,18 @@ namespace FireWallet
|
|||||||
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;
|
if (message.Contains("Get Error: No connection could be made because the target machine actively refused it")) return;
|
||||||
|
|
||||||
|
// If file size is over 1MB, rename it to old.log.txt
|
||||||
|
if (File.Exists(dir + "log.txt"))
|
||||||
|
{
|
||||||
|
FileInfo fi = new FileInfo(dir + "log.txt");
|
||||||
|
if (fi.Length > 1000000)
|
||||||
|
{
|
||||||
|
if (File.Exists(dir + "old.log.txt")) File.Delete(dir + "old.log.txt"); // Delete old log file as it is super old
|
||||||
|
File.Move(dir + "log.txt", dir + "old.log.txt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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();
|
||||||
@@ -601,11 +664,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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -634,7 +701,27 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
|
|
||||||
account = comboBoxaccount.Text;
|
account = comboBoxaccount.Text;
|
||||||
password = textBoxaccountpassword.Text;
|
|
||||||
|
if (textBoxaccountpassword.Text == "")
|
||||||
|
{
|
||||||
|
if (File.Exists(dir + account + ".yubikey"))
|
||||||
|
{
|
||||||
|
// Check if yubikey is plugged in
|
||||||
|
var devices = YubiKeyDevice.FindAll();
|
||||||
|
if (devices.Count() > 0)
|
||||||
|
{
|
||||||
|
// Get key from yubikey
|
||||||
|
password = YubiUnlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else password = textBoxaccountpassword.Text;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool loggedin = await Login();
|
bool loggedin = await Login();
|
||||||
if (loggedin)
|
if (loggedin)
|
||||||
{
|
{
|
||||||
@@ -866,7 +953,7 @@ namespace FireWallet
|
|||||||
|
|
||||||
|
|
||||||
// Check how many TX there are
|
// Check how many TX there are
|
||||||
APIresponse = await APIGet("wallet/"+ account,true);
|
APIresponse = await APIGet("wallet/" + account, true);
|
||||||
JObject wallet = JObject.Parse(APIresponse);
|
JObject wallet = JObject.Parse(APIresponse);
|
||||||
if (!wallet.ContainsKey("balance"))
|
if (!wallet.ContainsKey("balance"))
|
||||||
{
|
{
|
||||||
@@ -883,7 +970,14 @@ namespace FireWallet
|
|||||||
int toSkip = TotalTX - toGet;
|
int toSkip = TotalTX - toGet;
|
||||||
|
|
||||||
// GET TXs
|
// GET TXs
|
||||||
APIresponse = await APIPost("", true, "{\"method\": \"listtransactions\",\"params\": [\"default\"," +toGet+","+ toSkip+ "]}");
|
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")
|
||||||
{
|
{
|
||||||
@@ -891,7 +985,7 @@ namespace FireWallet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JObject TXGET = JObject.Parse(APIresponse);
|
JObject TXGET = JObject.Parse(APIresponse);
|
||||||
|
|
||||||
// Check for error
|
// Check for error
|
||||||
if (TXGET["error"].ToString() != "")
|
if (TXGET["error"].ToString() != "")
|
||||||
{
|
{
|
||||||
@@ -901,6 +995,7 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
|
|
||||||
JArray txs = JArray.Parse(TXGET["result"].ToString());
|
JArray txs = JArray.Parse(TXGET["result"].ToString());
|
||||||
|
if (toGet > txs.Count) toGet = txs.Count; // In case there are less TXs than expected (usually happens when the get TX's fails)
|
||||||
Control[] tmpControls = new Control[toGet];
|
Control[] tmpControls = new Control[toGet];
|
||||||
for (int i = 0; i < toGet; i++)
|
for (int i = 0; i < toGet; i++)
|
||||||
{
|
{
|
||||||
@@ -950,7 +1045,7 @@ namespace FireWallet
|
|||||||
AutoSize = true,
|
AutoSize = true,
|
||||||
Location = new Point(10, 25)
|
Location = new Point(10, 25)
|
||||||
};
|
};
|
||||||
|
|
||||||
tmpPanel.Controls.Add(labelHash);
|
tmpPanel.Controls.Add(labelHash);
|
||||||
|
|
||||||
JArray inputs = JArray.Parse(tx["inputs"].ToString());
|
JArray inputs = JArray.Parse(tx["inputs"].ToString());
|
||||||
@@ -958,7 +1053,7 @@ namespace FireWallet
|
|||||||
int inputCount = inputs.Count;
|
int inputCount = inputs.Count;
|
||||||
int outputCount = outputs.Count;
|
int outputCount = outputs.Count;
|
||||||
|
|
||||||
int costHNS = int.Parse(txs[toGet - i - 1]["amount"].ToString());
|
decimal costHNS = decimal.Parse(txs[toGet - i - 1]["amount"].ToString());
|
||||||
string cost = "";
|
string cost = "";
|
||||||
if (costHNS < 0)
|
if (costHNS < 0)
|
||||||
{
|
{
|
||||||
@@ -968,10 +1063,10 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
cost = "Received: " + costHNS.ToString() + " HNS";
|
cost = "Received: " + costHNS.ToString() + " HNS";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Label labelInputOutput = new Label()
|
Label labelInputOutput = new Label()
|
||||||
{
|
{
|
||||||
@@ -1014,17 +1109,17 @@ namespace FireWallet
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string response = await APIGet("fee", false);
|
string response = await APIPost("", false, "{\"method\": \"estimatefee\",\"params\": [ 3 ]}");
|
||||||
JObject resp = JObject.Parse(response);
|
JObject resp = JObject.Parse(response);
|
||||||
decimal fee = Convert.ToDecimal(resp["rate"].ToString());
|
string result = resp["result"].ToString();
|
||||||
fee = fee / 1000000;
|
decimal fee = decimal.Parse(result);
|
||||||
if (fee < 0.0001m) fee = 1;
|
if (fee < 0.001m) fee = 1;
|
||||||
|
|
||||||
return fee.ToString();
|
return fee.ToString();
|
||||||
//return resp["rate"].ToString();
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
AddLog("GetFee Error");
|
||||||
return "1";
|
return "1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1090,6 +1185,7 @@ namespace FireWallet
|
|||||||
labelSendingMax.Text = "Max: " + balance.ToString() + " HNS";
|
labelSendingMax.Text = "Max: " + balance.ToString() + " HNS";
|
||||||
textBoxSendingTo.Focus();
|
textBoxSendingTo.Focus();
|
||||||
string fee = await GetFee();
|
string fee = await GetFee();
|
||||||
|
|
||||||
labelSendingFee.Text = "Est. Fee: " + fee + " HNS";
|
labelSendingFee.Text = "Est. Fee: " + fee + " HNS";
|
||||||
labelSendingError.Hide();
|
labelSendingError.Hide();
|
||||||
|
|
||||||
@@ -1141,6 +1237,8 @@ namespace FireWallet
|
|||||||
groupBoxDomains.Width = panelDomains.Width - 20;
|
groupBoxDomains.Width = panelDomains.Width - 20;
|
||||||
groupBoxDomains.Left = 10;
|
groupBoxDomains.Left = 10;
|
||||||
groupBoxDomains.Height = panelDomains.Height - groupBoxDomains.Top - 10;
|
groupBoxDomains.Height = panelDomains.Height - groupBoxDomains.Top - 10;
|
||||||
|
comboBoxDomainSort.SelectedIndex = 0;
|
||||||
|
|
||||||
UpdateDomains();
|
UpdateDomains();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1172,6 +1270,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"];
|
||||||
@@ -1184,14 +1283,96 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Send
|
#region Send
|
||||||
|
|
||||||
|
// Store TLSA hash
|
||||||
|
public string TLSA { get; set; }
|
||||||
private async void textBoxSendingTo_Leave(object sender, EventArgs e)
|
private async void textBoxSendingTo_Leave(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
labelSendingError.Hide();
|
||||||
|
labelHIPArrow.Hide();
|
||||||
|
labelSendingHIPAddress.Hide();
|
||||||
if (textBoxSendingTo.Text == "") return;
|
if (textBoxSendingTo.Text == "") return;
|
||||||
if (textBoxSendingTo.Text.Substring(0, 1) == "@")
|
if (textBoxSendingTo.Text.Substring(0, 1) == "@")
|
||||||
{
|
{
|
||||||
labelSendingError.Show();
|
string domain = textBoxSendingTo.Text.Substring(1);
|
||||||
labelSendingError.Text = "HIP-02 Not supported yet";
|
|
||||||
return;
|
try
|
||||||
|
{
|
||||||
|
IPAddress iPAddress = null;
|
||||||
|
TLSA = "";
|
||||||
|
|
||||||
|
|
||||||
|
// Create an instance of LookupClient using the custom options
|
||||||
|
NameServer nameServer = new NameServer(IPAddress.Parse("127.0.0.1"), 5350);
|
||||||
|
var options = new LookupClientOptions(nameServer);
|
||||||
|
options.EnableAuditTrail = true;
|
||||||
|
options.UseTcpOnly = true;
|
||||||
|
options.Recursion = true;
|
||||||
|
options.UseCache = false;
|
||||||
|
options.RequestDnsSecRecords = true;
|
||||||
|
options.Timeout = TimeSpan.FromSeconds(5);
|
||||||
|
|
||||||
|
|
||||||
|
var client = new LookupClient(options);
|
||||||
|
|
||||||
|
|
||||||
|
// Perform the DNS lookup for the specified domain using DNSSec
|
||||||
|
|
||||||
|
var result = client.Query(domain, QueryType.A);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Display the DNS lookup results
|
||||||
|
foreach (var record in result.Answers.OfType<ARecord>())
|
||||||
|
{
|
||||||
|
iPAddress = record.Address;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iPAddress == null)
|
||||||
|
{
|
||||||
|
labelSendingError.Show();
|
||||||
|
labelSendingError.Text = "HIP-02 lookup failed";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get TLSA record
|
||||||
|
var resultTLSA = client.Query("_443._tcp." + domain, QueryType.TLSA);
|
||||||
|
foreach (var record in resultTLSA.Answers.OfType<TlsaRecord>())
|
||||||
|
{
|
||||||
|
TLSA = record.CertificateAssociationDataAsString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string url = "https://" + iPAddress.ToString() + "/.well-known/wallets/HNS";
|
||||||
|
var handler = new HttpClientHandler();
|
||||||
|
|
||||||
|
handler.ServerCertificateCustomValidationCallback = ValidateServerCertificate;
|
||||||
|
|
||||||
|
// Create an instance of HttpClient with the custom handler
|
||||||
|
using (var httpclient = new HttpClient(handler))
|
||||||
|
{
|
||||||
|
httpclient.DefaultRequestHeaders.Add("Host", domain);
|
||||||
|
// Send a GET request to the specified URL
|
||||||
|
HttpResponseMessage response = httpclient.GetAsync(url).Result;
|
||||||
|
|
||||||
|
// Response
|
||||||
|
string address = response.Content.ReadAsStringAsync().Result;
|
||||||
|
|
||||||
|
labelSendingHIPAddress.Text = address;
|
||||||
|
labelSendingHIPAddress.Show();
|
||||||
|
labelHIPArrow.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AddLog(ex.Message);
|
||||||
|
labelSendingError.Show();
|
||||||
|
labelSendingError.Text = "HIP-02 lookup failed";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1216,6 +1397,67 @@ namespace FireWallet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
|
||||||
|
{
|
||||||
|
// Customize the certificate validation logic here if needed
|
||||||
|
|
||||||
|
// Return true to accept the certificate or false to reject it
|
||||||
|
X509Certificate2 cert2 = new X509Certificate2(certificate);
|
||||||
|
|
||||||
|
|
||||||
|
var rsaPublicKey = (RSA)cert2.PublicKey.Key;
|
||||||
|
|
||||||
|
// Calculate the SHA-256 hash of the public key
|
||||||
|
using (var sha256 = SHA256.Create())
|
||||||
|
{
|
||||||
|
byte[] publicKeyBytes = rsaPublicKey.ExportSubjectPublicKeyInfo();
|
||||||
|
byte[] publicKeyHash = sha256.ComputeHash(publicKeyBytes);
|
||||||
|
|
||||||
|
// Convert the hash value to hexadecimal format
|
||||||
|
string hexFingerprint = ByteArrayToHexString(publicKeyHash);
|
||||||
|
|
||||||
|
if (hexFingerprint == TLSA)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddLog("TLSA mismatch");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static string ByteArrayToHexString(byte[] bytes)
|
||||||
|
{
|
||||||
|
StringBuilder hex = new StringBuilder(bytes.Length * 2);
|
||||||
|
foreach (byte b in bytes)
|
||||||
|
{
|
||||||
|
hex.AppendFormat("{0:X2}", b);
|
||||||
|
}
|
||||||
|
return hex.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetHash(HashAlgorithm hashAlgorithm, byte[] input)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Convert the input string to a byte array and compute the hash.
|
||||||
|
byte[] data = hashAlgorithm.ComputeHash(input);
|
||||||
|
|
||||||
|
// Create a new Stringbuilder to collect the bytes
|
||||||
|
// and create a string.
|
||||||
|
var sBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
// Loop through each byte of the hashed data
|
||||||
|
// and format each one as a hexadecimal string.
|
||||||
|
for (int i = 0; i < data.Length; i++)
|
||||||
|
{
|
||||||
|
sBuilder.Append(data[i].ToString("x2"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the hexadecimal string.
|
||||||
|
return sBuilder.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
private void textBoxSendingAmount_Leave(object sender, EventArgs e)
|
private void textBoxSendingAmount_Leave(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
decimal amount = 0;
|
decimal amount = 0;
|
||||||
@@ -1243,6 +1485,10 @@ namespace FireWallet
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string address = textBoxSendingTo.Text;
|
string address = textBoxSendingTo.Text;
|
||||||
|
if (labelHIPArrow.Visible)
|
||||||
|
{
|
||||||
|
address = labelSendingHIPAddress.Text;
|
||||||
|
}
|
||||||
bool valid = await ValidAddress(address);
|
bool valid = await ValidAddress(address);
|
||||||
if (!valid)
|
if (!valid)
|
||||||
{
|
{
|
||||||
@@ -1658,6 +1904,33 @@ namespace FireWallet
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
int renewable = 0;
|
int renewable = 0;
|
||||||
panelDomainList.Controls.Clear();
|
panelDomainList.Controls.Clear();
|
||||||
|
|
||||||
|
// Sort the domains
|
||||||
|
switch (comboBoxDomainSort.Text)
|
||||||
|
{
|
||||||
|
case "Default":
|
||||||
|
break;
|
||||||
|
case "Alphabetical":
|
||||||
|
names = new JArray(names.OrderBy(obj => (string)obj["name"]));
|
||||||
|
break;
|
||||||
|
case "Expiring":
|
||||||
|
names = new JArray(names.OrderBy(obj =>
|
||||||
|
{
|
||||||
|
JToken daysUntilExpireToken = obj["stats"]?["daysUntilExpire"];
|
||||||
|
return (int)(daysUntilExpireToken ?? int.MaxValue);
|
||||||
|
}));
|
||||||
|
break;
|
||||||
|
case "Value":
|
||||||
|
// Sort by most valuable first
|
||||||
|
names = new JArray(names.OrderByDescending(obj =>
|
||||||
|
{
|
||||||
|
JToken valueToken = obj?["value"];
|
||||||
|
return (int)(valueToken ?? 0);
|
||||||
|
}));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach (JObject name in names)
|
foreach (JObject name in names)
|
||||||
{
|
{
|
||||||
Domains[i] = name["name"].ToString();
|
Domains[i] = name["name"].ToString();
|
||||||
@@ -1677,7 +1950,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;
|
||||||
}
|
}
|
||||||
@@ -1716,8 +1990,8 @@ namespace FireWallet
|
|||||||
|
|
||||||
foreach (Control c in domainTMP.Controls)
|
foreach (Control c in domainTMP.Controls)
|
||||||
{
|
{
|
||||||
c.Click += new EventHandler((sender, e) =>
|
c.Click += new EventHandler((sender, e) =>
|
||||||
{
|
{
|
||||||
DomainForm domainForm = new DomainForm(this, name["name"].ToString(), userSettings["explorer-tx"], userSettings["explorer-domain"]);
|
DomainForm domainForm = new DomainForm(this, name["name"].ToString(), userSettings["explorer-tx"], userSettings["explorer-domain"]);
|
||||||
domainForm.Show();
|
domainForm.Show();
|
||||||
});
|
});
|
||||||
@@ -1741,7 +2015,7 @@ namespace FireWallet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JObject resp = JObject.Parse(response);
|
JObject resp = JObject.Parse(response);
|
||||||
if (resp["error"] != null)
|
if (resp["error"].ToString() != "")
|
||||||
{
|
{
|
||||||
AddLog("Error sending reveal");
|
AddLog("Error sending reveal");
|
||||||
AddLog(resp["error"].ToString());
|
AddLog(resp["error"].ToString());
|
||||||
@@ -1957,5 +2231,197 @@ namespace FireWallet
|
|||||||
AddBatch(domain, "RENEW");
|
AddBatch(domain, "RENEW");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void githubToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// Open the GitHub page
|
||||||
|
ProcessStartInfo psi = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "https://github.com/Nathanwoodburn/FireWallet/",
|
||||||
|
UseShellExecute = true
|
||||||
|
};
|
||||||
|
Process.Start(psi);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void websiteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ProcessStartInfo psi = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "https://firewallet",
|
||||||
|
UseShellExecute = true
|
||||||
|
};
|
||||||
|
Process.Start(psi);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void supportDiscordServerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ProcessStartInfo psi = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "https://l.woodburn.au/discord",
|
||||||
|
UseShellExecute = true
|
||||||
|
};
|
||||||
|
Process.Start(psi);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void comboBoxDomainSort_DropDownClosed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UpdateDomains();
|
||||||
|
}
|
||||||
|
#region yubikey
|
||||||
|
static bool PinSubmitter(KeyEntryData pin)
|
||||||
|
{
|
||||||
|
string s = "123456";
|
||||||
|
var s_b = Encoding.UTF8.GetBytes(s);
|
||||||
|
pin.SubmitValue(s_b);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
private void buttonSettingsYubikey_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (password.Length < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NotifyForm notifyForm = new NotifyForm("Insert Yubikey\nThis will use your yubikey to encrypt your account password.");
|
||||||
|
notifyForm.ShowDialog();
|
||||||
|
notifyForm.Dispose();
|
||||||
|
var devices = YubiKeyDevice.FindAll();
|
||||||
|
if (devices.Count() != 1)
|
||||||
|
{
|
||||||
|
NotifyForm notifyForm2 = new NotifyForm("Please insert your yubikey and try again.");
|
||||||
|
notifyForm2.ShowDialog();
|
||||||
|
notifyForm2.Dispose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NotifyForm yubiLoadingForm = new NotifyForm("Encrypting. . .", false);
|
||||||
|
yubiLoadingForm.Show();
|
||||||
|
// Wait for the form to load
|
||||||
|
Application.DoEvents();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//Assumes there is exactly one yubikey connected and it has a RSA2048 certificate in slot 9d
|
||||||
|
//PIV PIN is assumed to be 123456
|
||||||
|
|
||||||
|
var ykDevice = devices.First();
|
||||||
|
PivSession piv = new(ykDevice);
|
||||||
|
|
||||||
|
piv.KeyCollector += PinSubmitter;
|
||||||
|
piv.VerifyPin();
|
||||||
|
|
||||||
|
var slot = PivSlot.KeyManagement;
|
||||||
|
|
||||||
|
X509Certificate2 cert = piv.GetCertificate(slot);
|
||||||
|
if (cert.SignatureAlgorithm.FriendlyName != "sha256RSA")
|
||||||
|
throw new CryptographicException("Certificate must be RSA with SHA256");
|
||||||
|
|
||||||
|
var publicKey = cert.GetRSAPublicKey() ?? throw new CryptographicException("Couldn't get public key from certificate.");
|
||||||
|
|
||||||
|
Aes aesFirst = Aes.Create();
|
||||||
|
|
||||||
|
var encryptedKey = publicKey.Encrypt(aesFirst.Key, RSAEncryptionPadding.Pkcs1);
|
||||||
|
var decryptedKey = piv.Decrypt(slot, encryptedKey);
|
||||||
|
|
||||||
|
//MessageBox.Show($"aesFirst.Key.Length: {aesFirst.Key.Length}");
|
||||||
|
//MessageBox.Show($"encryptedKey.Length: {encryptedKey.Length}");
|
||||||
|
//MessageBox.Show($"decryptedKey.Length: {decryptedKey.Length}");
|
||||||
|
|
||||||
|
// split the message into blocks of 128 bytes
|
||||||
|
|
||||||
|
string message = password;
|
||||||
|
int blockSize = 128;
|
||||||
|
int blockCount = (int)Math.Ceiling((double)message.Length / blockSize);
|
||||||
|
|
||||||
|
string[] strings = new string[blockCount];
|
||||||
|
FileStream sw = new FileStream(dir + account + ".yubikey", FileMode.Create, FileAccess.Write);
|
||||||
|
|
||||||
|
for (int i = 0; i < blockCount; i++)
|
||||||
|
{
|
||||||
|
int size = Math.Min(blockSize, message.Length - i * blockSize);
|
||||||
|
strings[i] = message.Substring(i * blockSize, size);
|
||||||
|
|
||||||
|
byte[] bytes = Encoding.ASCII.GetBytes(strings[i]);
|
||||||
|
var encryptedBytes = publicKey.Encrypt(bytes, RSAEncryptionPadding.Pkcs1);
|
||||||
|
sw.Write(encryptedBytes, 0, encryptedBytes.Length);
|
||||||
|
}
|
||||||
|
sw.Close();
|
||||||
|
sw.Dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AddLog(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
yubiLoadingForm.CloseNotification();
|
||||||
|
}
|
||||||
|
private string YubiUnlock()
|
||||||
|
{
|
||||||
|
NotifyForm yubiLoadingForm = new NotifyForm("Decrypting. . .", false);
|
||||||
|
yubiLoadingForm.Show();
|
||||||
|
// Wait for the form to load
|
||||||
|
Application.DoEvents();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
//Assumes there is exactly one yubikey connected and it has a RSA2048 certificate in slot 9d
|
||||||
|
//PIV PIN is assumed to be 123456
|
||||||
|
var devices = YubiKeyDevice.FindAll();
|
||||||
|
var ykDevice = devices.First();
|
||||||
|
PivSession piv = new(ykDevice);
|
||||||
|
|
||||||
|
piv.KeyCollector += PinSubmitter;
|
||||||
|
piv.VerifyPin();
|
||||||
|
|
||||||
|
var slot = PivSlot.KeyManagement;
|
||||||
|
|
||||||
|
X509Certificate2 cert = piv.GetCertificate(slot);
|
||||||
|
if (cert.SignatureAlgorithm.FriendlyName != "sha256RSA")
|
||||||
|
throw new CryptographicException("Certificate must be RSA with SHA256");
|
||||||
|
|
||||||
|
var publicKey = cert.GetRSAPublicKey() ?? throw new CryptographicException("Couldn't get public key from certificate.");
|
||||||
|
|
||||||
|
Aes aesFirst = Aes.Create();
|
||||||
|
|
||||||
|
var encryptedKey = publicKey.Encrypt(aesFirst.Key, RSAEncryptionPadding.Pkcs1);
|
||||||
|
var decryptedKey = piv.Decrypt(slot, encryptedKey);
|
||||||
|
|
||||||
|
byte[] input = File.ReadAllBytes(dir + account + ".yubikey");
|
||||||
|
|
||||||
|
// decrypt the input
|
||||||
|
|
||||||
|
int blockSize = 256;
|
||||||
|
int blockCount = (int)Math.Ceiling((double)input.Length / blockSize);
|
||||||
|
|
||||||
|
byte[][] blocks = new byte[blockCount][];
|
||||||
|
byte[] decripted = new byte[blockCount * blockSize];
|
||||||
|
string output = "";
|
||||||
|
for (int i = 0; i < blockCount; i++)
|
||||||
|
{
|
||||||
|
int size = Math.Min(blockSize, input.Length - i * blockSize);
|
||||||
|
blocks[i] = new byte[size];
|
||||||
|
Array.Copy(input, i * blockSize, blocks[i], 0, size);
|
||||||
|
var paddedDecryptedBytes = piv.Decrypt(slot, blocks[i]);
|
||||||
|
byte[] decryptedBytes;
|
||||||
|
bool couldParse = Yubico.YubiKey.Cryptography.RsaFormat.TryParsePkcs1Decrypt(paddedDecryptedBytes, out decryptedBytes);
|
||||||
|
Array.Copy(decryptedBytes, 0, decripted, i * blockSize, decryptedBytes.Length);
|
||||||
|
|
||||||
|
output += Encoding.ASCII.GetString(decryptedBytes);
|
||||||
|
}
|
||||||
|
yubiLoadingForm.CloseNotification();
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
AddLog(ex.Message);
|
||||||
|
yubiLoadingForm.CloseNotification();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,10 +120,19 @@
|
|||||||
<metadata name="statusStripmain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="statusStripmain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>133, 17</value>
|
<value>133, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<data name="toolStripDropDownButtonHelp.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||||
|
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb
|
||||||
|
J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj
|
||||||
|
CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN
|
||||||
|
AAAAAElFTkSuQmCC
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
<metadata name="timerNodeStatus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="timerNodeStatus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>269, 17</value>
|
<value>269, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
|
||||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
AAABAAEAAAAAAAEAIAB2pAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAOEAAADAAgGAAAAfG+p9QAAIABJ
|
AAABAAEAAAAAAAEAIAB2pAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAOEAAADAAgGAAAAfG+p9QAAIABJ
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace FireWallet
|
|||||||
|
|
||||||
panelInputs.Controls.Add(PanelInput);
|
panelInputs.Controls.Add(PanelInput);
|
||||||
}
|
}
|
||||||
|
panelInputs.Visible = true;
|
||||||
// For each output
|
// For each output
|
||||||
JArray outputs = (JArray)tx["outputs"];
|
JArray outputs = (JArray)tx["outputs"];
|
||||||
foreach (JObject output in outputs)
|
foreach (JObject output in outputs)
|
||||||
@@ -136,8 +136,6 @@ namespace FireWallet
|
|||||||
|
|
||||||
panelOutputs.Controls.Add(PanelOutput);
|
panelOutputs.Controls.Add(PanelOutput);
|
||||||
}
|
}
|
||||||
|
|
||||||
panelInputs.Visible = true;
|
|
||||||
panelOutputs.Visible = true;
|
panelOutputs.Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
29
FireWallet/TransferForm.Designer.cs
generated
29
FireWallet/TransferForm.Designer.cs
generated
@@ -36,6 +36,8 @@
|
|||||||
label2 = new Label();
|
label2 = new Label();
|
||||||
textBoxAddress = new TextBox();
|
textBoxAddress = new TextBox();
|
||||||
labelError = new Label();
|
labelError = new Label();
|
||||||
|
labelSendingHIPAddress = new Label();
|
||||||
|
labelHIPArrow = new Label();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// buttonTransfer
|
// buttonTransfer
|
||||||
@@ -105,18 +107,41 @@
|
|||||||
// labelError
|
// labelError
|
||||||
//
|
//
|
||||||
labelError.AutoSize = true;
|
labelError.AutoSize = true;
|
||||||
labelError.Location = new Point(46, 139);
|
labelError.Location = new Point(492, 139);
|
||||||
labelError.Name = "labelError";
|
labelError.Name = "labelError";
|
||||||
labelError.Size = new Size(98, 15);
|
labelError.Size = new Size(98, 15);
|
||||||
labelError.TabIndex = 6;
|
labelError.TabIndex = 6;
|
||||||
labelError.Text = "Address not valid";
|
labelError.Text = "Address not valid";
|
||||||
labelError.Visible = false;
|
labelError.Visible = false;
|
||||||
//
|
//
|
||||||
|
// labelSendingHIPAddress
|
||||||
|
//
|
||||||
|
labelSendingHIPAddress.AutoSize = true;
|
||||||
|
labelSendingHIPAddress.Location = new Point(75, 150);
|
||||||
|
labelSendingHIPAddress.Name = "labelSendingHIPAddress";
|
||||||
|
labelSendingHIPAddress.Size = new Size(64, 15);
|
||||||
|
labelSendingHIPAddress.TabIndex = 19;
|
||||||
|
labelSendingHIPAddress.Text = "To Address";
|
||||||
|
labelSendingHIPAddress.Visible = false;
|
||||||
|
//
|
||||||
|
// labelHIPArrow
|
||||||
|
//
|
||||||
|
labelHIPArrow.AutoSize = true;
|
||||||
|
labelHIPArrow.Font = new Font("Segoe UI", 18F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
labelHIPArrow.Location = new Point(46, 139);
|
||||||
|
labelHIPArrow.Name = "labelHIPArrow";
|
||||||
|
labelHIPArrow.Size = new Size(32, 32);
|
||||||
|
labelHIPArrow.TabIndex = 20;
|
||||||
|
labelHIPArrow.Text = "⮡ ";
|
||||||
|
labelHIPArrow.Visible = false;
|
||||||
|
//
|
||||||
// TransferForm
|
// TransferForm
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(602, 340);
|
ClientSize = new Size(602, 340);
|
||||||
|
Controls.Add(labelSendingHIPAddress);
|
||||||
|
Controls.Add(labelHIPArrow);
|
||||||
Controls.Add(labelError);
|
Controls.Add(labelError);
|
||||||
Controls.Add(textBoxAddress);
|
Controls.Add(textBoxAddress);
|
||||||
Controls.Add(label2);
|
Controls.Add(label2);
|
||||||
@@ -143,5 +168,7 @@
|
|||||||
private Label label2;
|
private Label label2;
|
||||||
private TextBox textBoxAddress;
|
private TextBox textBoxAddress;
|
||||||
private Label labelError;
|
private Label labelError;
|
||||||
|
private Label labelSendingHIPAddress;
|
||||||
|
private Label labelHIPArrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,8 @@ using System.Net;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using DnsClient.Protocol;
|
||||||
|
using DnsClient;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace FireWallet
|
namespace FireWallet
|
||||||
@@ -46,16 +48,19 @@ namespace FireWallet
|
|||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string address = "";
|
||||||
private async void buttonTransfer_Click(object sender, EventArgs e)
|
private async void buttonTransfer_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!await MainForm.ValidAddress(textBoxAddress.Text))
|
updateAddress();
|
||||||
|
|
||||||
|
if (!await MainForm.ValidAddress(address))
|
||||||
{
|
{
|
||||||
labelError.Show();
|
labelError.Show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string content = "{\"method\": \"sendtransfer\",\"params\": [ \"" + Domain + "\", \"" +
|
string content = "{\"method\": \"sendtransfer\",\"params\": [ \"" + Domain + "\", \"" +
|
||||||
textBoxAddress.Text + "\"]}";
|
address + "\"]}";
|
||||||
string output = await MainForm.APIPost("", true, content);
|
string output = await MainForm.APIPost("", true, content);
|
||||||
JObject APIresp = JObject.Parse(output);
|
JObject APIresp = JObject.Parse(output);
|
||||||
if (APIresp["error"].ToString() != "")
|
if (APIresp["error"].ToString() != "")
|
||||||
@@ -78,14 +83,113 @@ namespace FireWallet
|
|||||||
|
|
||||||
private async void buttonBatch_Click(object sender, EventArgs e)
|
private async void buttonBatch_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!await MainForm.ValidAddress(textBoxAddress.Text))
|
updateAddress();
|
||||||
|
|
||||||
|
if (!await MainForm.ValidAddress(address))
|
||||||
{
|
{
|
||||||
labelError.Show();
|
labelError.Show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainForm.AddBatch(Domain, "TRANSFER", textBoxAddress.Text);
|
MainForm.AddBatch(Domain, "TRANSFER", address);
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateAddress()
|
||||||
|
{
|
||||||
|
labelError.Hide();
|
||||||
|
|
||||||
|
if (textBoxAddress.Text.Length < 1)
|
||||||
|
{
|
||||||
|
address = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (textBoxAddress.Text.Substring(0, 1) == "@")
|
||||||
|
{
|
||||||
|
string domain = textBoxAddress.Text.Substring(1);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IPAddress iPAddress = null;
|
||||||
|
|
||||||
|
|
||||||
|
// Create an instance of LookupClient using the custom options
|
||||||
|
NameServer nameServer = new NameServer(IPAddress.Parse("127.0.0.1"), 5350);
|
||||||
|
var options = new LookupClientOptions(nameServer);
|
||||||
|
options.EnableAuditTrail = true;
|
||||||
|
options.UseTcpOnly = true;
|
||||||
|
options.Recursion = true;
|
||||||
|
options.UseCache = false;
|
||||||
|
options.RequestDnsSecRecords = true;
|
||||||
|
options.Timeout = TimeSpan.FromSeconds(5);
|
||||||
|
|
||||||
|
|
||||||
|
var client = new LookupClient(options);
|
||||||
|
|
||||||
|
|
||||||
|
// Perform the DNS lookup for the specified domain using DNSSec
|
||||||
|
|
||||||
|
var result = client.Query(domain, QueryType.A);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Display the DNS lookup results
|
||||||
|
foreach (var record in result.Answers.OfType<ARecord>())
|
||||||
|
{
|
||||||
|
iPAddress = record.Address;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iPAddress == null)
|
||||||
|
{
|
||||||
|
labelError.Show();
|
||||||
|
labelError.Text = "HIP-02 lookup failed";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get TLSA record
|
||||||
|
var resultTLSA = client.Query("_443._tcp." + domain, QueryType.TLSA);
|
||||||
|
foreach (var record in resultTLSA.Answers.OfType<TlsaRecord>())
|
||||||
|
{
|
||||||
|
MainForm.TLSA = record.CertificateAssociationDataAsString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string url = "https://" + iPAddress.ToString() + "/.well-known/wallets/HNS";
|
||||||
|
var handler = new HttpClientHandler();
|
||||||
|
|
||||||
|
handler.ServerCertificateCustomValidationCallback = MainForm.ValidateServerCertificate;
|
||||||
|
|
||||||
|
// Create an instance of HttpClient with the custom handler
|
||||||
|
using (var httpclient = new HttpClient(handler))
|
||||||
|
{
|
||||||
|
httpclient.DefaultRequestHeaders.Add("Host", domain);
|
||||||
|
// Send a GET request to the specified URL
|
||||||
|
HttpResponseMessage response = httpclient.GetAsync(url).Result;
|
||||||
|
|
||||||
|
// Response
|
||||||
|
string address = response.Content.ReadAsStringAsync().Result;
|
||||||
|
|
||||||
|
labelSendingHIPAddress.Text = address;
|
||||||
|
this.address = address;
|
||||||
|
labelSendingHIPAddress.Show();
|
||||||
|
labelHIPArrow.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MainForm.AddLog(ex.Message);
|
||||||
|
labelError.Show();
|
||||||
|
labelError.Text = "HIP-02 lookup failed";
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
address = textBoxAddress.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -224,15 +224,15 @@
|
|||||||
{
|
{
|
||||||
"Name" = "8:Microsoft Visual Studio"
|
"Name" = "8:Microsoft Visual Studio"
|
||||||
"ProductName" = "8:FireWallet"
|
"ProductName" = "8:FireWallet"
|
||||||
"ProductCode" = "8:{CA9B8BF8-C03C-4C1F-BF5E-768B5897DB34}"
|
"ProductCode" = "8:{007B0A5E-57B9-4DB7-AABE-5A3631A89BEB}"
|
||||||
"PackageCode" = "8:{A830408F-C770-4E8D-BEE3-22D4736728B5}"
|
"PackageCode" = "8:{546D4209-3E58-4144-A9DC-E659A2482DD4}"
|
||||||
"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.6"
|
"ProductVersion" = "8:3.0"
|
||||||
"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"
|
||||||
|
|||||||
22
README.md
22
README.md
@@ -60,6 +60,9 @@ You can change the number of transactions shown in the `portfolio-tx:` settings.
|
|||||||
<br><br>
|
<br><br>
|
||||||
## Sending HNS
|
## Sending HNS
|
||||||

|

|
||||||
|
This page lets you send HNS to Handshake addresses or domains using [HIP-02](https://github.com/handshake-org/HIPs/blob/master/HIP-0002.md).
|
||||||
|
To use HIP-02 you need to have HSD resolver (or any HNS compatible DNS resolver) listening on port 5350 (default HSD port).
|
||||||
|
To enter a domain to use HIP-02 you need to prefix the domain with `@` (eg. `@nathan.woodburn`).
|
||||||
|
|
||||||
## Receiving HNS or Domains
|
## Receiving HNS or Domains
|
||||||
The receive page shows your current HNS address.
|
The receive page shows your current HNS address.
|
||||||
@@ -104,6 +107,8 @@ The "CANCEL" transaction type is used to cancel an transfer.
|
|||||||
|
|
||||||
At the momemt "UPDATE" or coin only transactions are not supported.
|
At the momemt "UPDATE" or coin only transactions are not supported.
|
||||||
|
|
||||||
|
|
||||||
|
Please not that the import syntax for BIDs is BID,LOCKUP where LOCKUP is (BID+BLIND)
|
||||||

|

|
||||||
|
|
||||||
## Exporting
|
## Exporting
|
||||||
@@ -134,6 +139,15 @@ This file stores the node (HSD/Bob connection) settings.
|
|||||||
The Network is the network you want to connect to (default is `0` for Mainnet).
|
The Network is the network you want to connect to (default is `0` for Mainnet).
|
||||||
If you delete this file, FireWallet will show the node setup screen on next startup.
|
If you delete this file, FireWallet will show the node setup screen on next startup.
|
||||||
|
|
||||||
|
You can set a custom HSD launch command by setting the `hsd-command` key.
|
||||||
|
The default launch is the same as this
|
||||||
|
```yaml
|
||||||
|
HSD-command: {default-dir} --agent=FireWallet --index-tx --index-address --api-key {key} --prefix {Bob}
|
||||||
|
```
|
||||||
|
The `{default-dir}` will be replaced with the HSD directory `%appdata%\FireWallet\hsd\`.
|
||||||
|
The `{key}` will be replaced with the API key from the node.txt file.
|
||||||
|
The `{Bob}` will be replaced with the Bob wallet HSD data directory `%appdata%\Bob\hsd_data\` this is used to sync FireWallet with Bob's accounts and also stops you needing to sync the chain twice.
|
||||||
|
|
||||||
## theme.txt
|
## theme.txt
|
||||||
This file stores the theme settings.
|
This file stores the theme settings.
|
||||||
The theme is the color scheme of the application.
|
The theme is the color scheme of the application.
|
||||||
@@ -142,4 +156,10 @@ There are 4 modes: `off` is disabled, `mica` is windows app style, `key` is to m
|
|||||||
|
|
||||||
## log.txt
|
## log.txt
|
||||||
This file stores the logs for the application.
|
This file stores the logs for the application.
|
||||||
You should check this file if you have any issues with the application.
|
You should check this file if you have any issues with the application.
|
||||||
|
|
||||||
|
|
||||||
|
# Support
|
||||||
|
If you have any issues with the application you can open an issue on GitHub or contact me on Discord (NathanWoodburn on most Handshake servers).
|
||||||
|
|
||||||
|
If you would like to support this project you can find out how at https://nathan.woodburn.au/#donate or you can help by contributing to the project on GitHub.
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
IP: 127.0.0.1
|
IP: 127.0.0.1
|
||||||
Network: 0
|
Network: 0
|
||||||
Key: my-super-secret-api-key
|
Key: my-super-secret-api-key
|
||||||
|
HSD: False
|
||||||
|
HSD-command: {default-dir} --agent=FireWallet --index-tx --index-address --api-key {key} --prefix {Bob}
|
||||||
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