4 Commits

8 changed files with 110 additions and 18 deletions

View File

@@ -1,5 +1,6 @@
using System.Data; using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Net;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Windows.Forms.VisualStyles; using System.Windows.Forms.VisualStyles;
@@ -58,7 +59,7 @@ namespace FireWallet
List<Batch> temp = new List<Batch>(); List<Batch> temp = new List<Batch>();
foreach (Batch batch in batches) foreach (Batch batch in batches)
{ {
if (batch.domain != domain && batch.method != operation) if (batch.domain != domain || batch.method != operation)
{ {
temp.Add(batch); temp.Add(batch);
} }
@@ -122,7 +123,7 @@ namespace FireWallet
List<Batch> temp = new List<Batch>(); List<Batch> temp = new List<Batch>();
foreach (Batch batch in batches) foreach (Batch batch in batches)
{ {
if (batch.domain != domain && batch.method != operation) if (batch.domain != domain || batch.method != operation)
{ {
temp.Add(batch); temp.Add(batch);
} }
@@ -182,7 +183,7 @@ namespace FireWallet
List<Batch> temp = new List<Batch>(); List<Batch> temp = new List<Batch>();
foreach (Batch batch in batches) foreach (Batch batch in batches)
{ {
if (batch.domain != domain && batch.method != operation) if (batch.domain != domain || batch.method != operation)
{ {
temp.Add(batch); temp.Add(batch);
} }
@@ -238,7 +239,7 @@ namespace FireWallet
List<Batch> temp = new List<Batch>(); List<Batch> temp = new List<Batch>();
foreach (Batch batch in batches) foreach (Batch batch in batches)
{ {
if (batch.domain != domain && batch.method != operation) if (batch.domain != domain || batch.method != operation)
{ {
temp.Add(batch); temp.Add(batch);
} }
@@ -750,6 +751,10 @@ namespace FireWallet
{ {
AddBatch(b.domain, b.method, b.toAddress); AddBatch(b.domain, b.method, b.toAddress);
} }
else if (b.method == "UPDATE")
{
AddBatch(b.domain, b.method, b.update);
}
else else
{ {
AddBatch(b.domain, b.method); AddBatch(b.domain, b.method);
@@ -792,21 +797,26 @@ namespace FireWallet
req.Content = new StringContent(content); req.Content = new StringContent(content);
// Send request // Send request
HttpResponseMessage resp = await httpClient.SendAsync(req);
try try
{ {
resp.EnsureSuccessStatusCode(); HttpResponseMessage resp = await httpClient.SendAsync(req);
if (resp.StatusCode != HttpStatusCode.OK)
{
AddLog("Post Error: " + resp.StatusCode.ToString());
AddLog(await resp.Content.ReadAsStringAsync());
AddLog(content);
return "Error";
}
return await resp.Content.ReadAsStringAsync();
} }
catch (Exception ex) catch (Exception ex)
{ {
AddLog("Post Error: " + ex.Message); AddLog("Post Error: " + ex.Message);
AddLog(await resp.Content.ReadAsStringAsync());
AddLog(content);
return "Error"; return "Error";
} }
return await resp.Content.ReadAsStringAsync();
} }
} }
public class Batch public class Batch
@@ -868,6 +878,10 @@ namespace FireWallet
return "[\"UPDATE\", \"" + domain + "\", " + records + "]"; return "[\"UPDATE\", \"" + domain + "\", " + records + "]";
} }
else if (method == "UPDATE")
{
return "[\"UPDATE\", \"" + domain + "\", {\"records\":[]}]";
}
return "[\"" + method + "\", \"" + domain + "\"]"; return "[\"" + method + "\", \"" + domain + "\"]";
} }
} }

View File

@@ -72,7 +72,7 @@
comboBoxMode.FlatStyle = FlatStyle.Flat; comboBoxMode.FlatStyle = FlatStyle.Flat;
comboBoxMode.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); comboBoxMode.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
comboBoxMode.FormattingEnabled = true; comboBoxMode.FormattingEnabled = true;
comboBoxMode.Items.AddRange(new object[] { "OPEN", "BID", "REVEAL", "REDEEM", "RENEW", "TRANSFER", "FINALIZE", "CANCEL" }); comboBoxMode.Items.AddRange(new object[] { "OPEN", "BID", "REVEAL", "REDEEM", "REGISTER", "RENEW", "TRANSFER", "FINALIZE", "CANCEL" });
comboBoxMode.Location = new Point(346, 42); comboBoxMode.Location = new Point(346, 42);
comboBoxMode.Name = "comboBoxMode"; comboBoxMode.Name = "comboBoxMode";
comboBoxMode.Size = new Size(226, 29); comboBoxMode.Size = new Size(226, 29);

View File

@@ -263,6 +263,21 @@ namespace FireWallet
} }
this.Close(); this.Close();
} }
else if (comboBoxMode.Text == "REGISTER")
{
batches = new Batch[0];
foreach (string domain in listBoxDomains.Items)
{
if (domain != "")
{
Batch[] newBatch = new Batch[batches.Length + 1];
Array.Copy(batches, newBatch, batches.Length);
newBatch[newBatch.Length - 1] = new Batch(domain,"UPDATE",new DNS[0]);
batches = newBatch;
}
}
this.Close();
}
else if (comboBoxMode.Text == "TRANSFER") else if (comboBoxMode.Text == "TRANSFER")
{ {
batches = new Batch[0]; batches = new Batch[0];

View File

@@ -363,6 +363,12 @@ namespace FireWallet
string contentDNS = "{\"method\": \"getnameresource\", \"params\": [\"" + domain + "\"]}"; string contentDNS = "{\"method\": \"getnameresource\", \"params\": [\"" + domain + "\"]}";
string responseDNS = await APIPost("", false, contentDNS); string responseDNS = await APIPost("", false, contentDNS);
JObject jObjectDNS = JObject.Parse(responseDNS); JObject jObjectDNS = JObject.Parse(responseDNS);
if (jObjectDNS["result"].ToString() == "")
{
return;
}
JObject result = (JObject)jObjectDNS["result"]; JObject result = (JObject)jObjectDNS["result"];
JArray records = (JArray)result["records"]; JArray records = (JArray)result["records"];
// For each record // For each record

View File

@@ -279,6 +279,14 @@ namespace FireWallet
string contentDNS = "{\"method\": \"getnameresource\", \"params\": [\"" + domain + "\"]}"; string contentDNS = "{\"method\": \"getnameresource\", \"params\": [\"" + domain + "\"]}";
string responseDNS = await APIPost("", false, contentDNS); string responseDNS = await APIPost("", false, contentDNS);
JObject jObjectDNS = JObject.Parse(responseDNS); JObject jObjectDNS = JObject.Parse(responseDNS);
if (jObjectDNS["result"].ToString() == "")
{
// Not registered
groupBoxDNS.Visible = false;
return;
}
JObject result = (JObject)jObjectDNS["result"]; JObject result = (JObject)jObjectDNS["result"];
JArray records = (JArray)result["records"]; JArray records = (JArray)result["records"];
// For each record // For each record
@@ -814,7 +822,14 @@ namespace FireWallet
if (!DNSEdit.cancel) if (!DNSEdit.cancel)
{ {
string records = string.Join(", ", DNSEdit.DNSrecords.Select(record => record.ToString())); string records = "";
if (DNSEdit.DNSrecords != null)
{
if (DNSEdit.DNSrecords.Count() > 0)
{
records = string.Join(", ", DNSEdit.DNSrecords.Select(record => record.ToString()));
}
}
string content = "{\"method\": \"sendupdate\", \"params\": [\"" + domain + "\", {\"records\": [" + records + "]}]}"; string content = "{\"method\": \"sendupdate\", \"params\": [\"" + domain + "\", {\"records\": [" + records + "]}]}";
string response = await APIPost("", true, content); string response = await APIPost("", true, content);

View File

@@ -58,6 +58,7 @@ namespace FireWallet
labelaccountusername = new Label(); labelaccountusername = new Label();
buttonaccountnew = new Button(); buttonaccountnew = new Button();
panelNav = new Panel(); panelNav = new Panel();
buttonNavBids = new Button();
buttonNavSettings = new Button(); buttonNavSettings = new Button();
buttonBatch = new Button(); buttonBatch = new Button();
buttonNavDomains = new Button(); buttonNavDomains = new Button();
@@ -126,6 +127,7 @@ namespace FireWallet
textBoxExAddr = new TextBox(); textBoxExAddr = new TextBox();
labelSettings4 = new Label(); labelSettings4 = new Label();
textBoxExTX = new TextBox(); textBoxExTX = new TextBox();
panelBids = new Panel();
statusStripmain.SuspendLayout(); statusStripmain.SuspendLayout();
panelaccount.SuspendLayout(); panelaccount.SuspendLayout();
groupBoxaccount.SuspendLayout(); groupBoxaccount.SuspendLayout();
@@ -353,6 +355,7 @@ namespace FireWallet
// //
// panelNav // panelNav
// //
panelNav.Controls.Add(buttonNavBids);
panelNav.Controls.Add(buttonNavSettings); panelNav.Controls.Add(buttonNavSettings);
panelNav.Controls.Add(buttonBatch); panelNav.Controls.Add(buttonBatch);
panelNav.Controls.Add(buttonNavDomains); panelNav.Controls.Add(buttonNavDomains);
@@ -365,6 +368,19 @@ namespace FireWallet
panelNav.Size = new Size(114, 553); panelNav.Size = new Size(114, 553);
panelNav.TabIndex = 6; panelNav.TabIndex = 6;
// //
// buttonNavBids
//
buttonNavBids.FlatStyle = FlatStyle.Flat;
buttonNavBids.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonNavBids.Location = new Point(12, 245);
buttonNavBids.Name = "buttonNavBids";
buttonNavBids.Size = new Size(89, 30);
buttonNavBids.TabIndex = 5;
buttonNavBids.TabStop = false;
buttonNavBids.Text = "Bids";
buttonNavBids.UseVisualStyleBackColor = true;
buttonNavBids.Click += buttonNavBids_Click;
//
// buttonNavSettings // buttonNavSettings
// //
buttonNavSettings.FlatStyle = FlatStyle.Flat; buttonNavSettings.FlatStyle = FlatStyle.Flat;
@@ -382,7 +398,7 @@ namespace FireWallet
// //
buttonBatch.FlatStyle = FlatStyle.Flat; buttonBatch.FlatStyle = FlatStyle.Flat;
buttonBatch.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); buttonBatch.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonBatch.Location = new Point(12, 245); buttonBatch.Location = new Point(12, 300);
buttonBatch.Name = "buttonBatch"; buttonBatch.Name = "buttonBatch";
buttonBatch.Size = new Size(89, 30); buttonBatch.Size = new Size(89, 30);
buttonBatch.TabIndex = 3; buttonBatch.TabIndex = 3;
@@ -395,7 +411,7 @@ namespace FireWallet
// //
buttonNavDomains.FlatStyle = FlatStyle.Flat; buttonNavDomains.FlatStyle = FlatStyle.Flat;
buttonNavDomains.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); buttonNavDomains.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonNavDomains.Location = new Point(12, 189); buttonNavDomains.Location = new Point(12, 190);
buttonNavDomains.Name = "buttonNavDomains"; buttonNavDomains.Name = "buttonNavDomains";
buttonNavDomains.Size = new Size(89, 30); buttonNavDomains.Size = new Size(89, 30);
buttonNavDomains.TabIndex = 2; buttonNavDomains.TabIndex = 2;
@@ -408,7 +424,7 @@ namespace FireWallet
// //
buttonNavReceive.FlatStyle = FlatStyle.Flat; buttonNavReceive.FlatStyle = FlatStyle.Flat;
buttonNavReceive.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); buttonNavReceive.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonNavReceive.Location = new Point(12, 134); buttonNavReceive.Location = new Point(12, 135);
buttonNavReceive.Name = "buttonNavReceive"; buttonNavReceive.Name = "buttonNavReceive";
buttonNavReceive.Size = new Size(89, 30); buttonNavReceive.Size = new Size(89, 30);
buttonNavReceive.TabIndex = 1; buttonNavReceive.TabIndex = 1;
@@ -449,7 +465,7 @@ namespace FireWallet
panelPortfolio.Controls.Add(groupBoxTransactions); panelPortfolio.Controls.Add(groupBoxTransactions);
panelPortfolio.Controls.Add(groupBoxinfo); panelPortfolio.Controls.Add(groupBoxinfo);
panelPortfolio.Controls.Add(groupBoxbalance); panelPortfolio.Controls.Add(groupBoxbalance);
panelPortfolio.Location = new Point(140, 35); panelPortfolio.Location = new Point(1036, 129);
panelPortfolio.Name = "panelPortfolio"; panelPortfolio.Name = "panelPortfolio";
panelPortfolio.Size = new Size(956, 538); panelPortfolio.Size = new Size(956, 538);
panelPortfolio.TabIndex = 7; panelPortfolio.TabIndex = 7;
@@ -1105,11 +1121,20 @@ namespace FireWallet
textBoxExTX.Size = new Size(307, 29); textBoxExTX.Size = new Size(307, 29);
textBoxExTX.TabIndex = 1; textBoxExTX.TabIndex = 1;
// //
// panelBids
//
panelBids.Location = new Point(143, 44);
panelBids.Name = "panelBids";
panelBids.Size = new Size(868, 484);
panelBids.TabIndex = 20;
panelBids.Visible = false;
//
// MainForm // MainForm
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1152, 575); ClientSize = new Size(1152, 575);
Controls.Add(panelBids);
Controls.Add(panelDomains); Controls.Add(panelDomains);
Controls.Add(panelSend); Controls.Add(panelSend);
Controls.Add(panelSettings); Controls.Add(panelSettings);
@@ -1251,5 +1276,7 @@ namespace FireWallet
private Label labelDomainSort; private Label labelDomainSort;
private ToolStripSeparator toolStripSeparator1; private ToolStripSeparator toolStripSeparator1;
private ToolStripMenuItem otherProjectsToolStripMenuItem; private ToolStripMenuItem otherProjectsToolStripMenuItem;
private Button buttonNavBids;
private Panel panelBids;
} }
} }

View File

@@ -1314,6 +1314,7 @@ namespace FireWallet
panelRecieve.Hide(); panelRecieve.Hide();
panelDomains.Hide(); panelDomains.Hide();
panelSettings.Hide(); panelSettings.Hide();
panelBids.Hide();
buttonNavPortfolio.BackColor = ColorTranslator.FromHtml(Theme["background"]); buttonNavPortfolio.BackColor = ColorTranslator.FromHtml(Theme["background"]);
buttonNavPortfolio.ForeColor = ColorTranslator.FromHtml(Theme["foreground"]); buttonNavPortfolio.ForeColor = ColorTranslator.FromHtml(Theme["foreground"]);
buttonNavSend.BackColor = ColorTranslator.FromHtml(Theme["background"]); buttonNavSend.BackColor = ColorTranslator.FromHtml(Theme["background"]);
@@ -1324,6 +1325,8 @@ namespace FireWallet
buttonNavDomains.ForeColor = ColorTranslator.FromHtml(Theme["foreground"]); buttonNavDomains.ForeColor = ColorTranslator.FromHtml(Theme["foreground"]);
buttonNavSettings.BackColor = ColorTranslator.FromHtml(Theme["background"]); buttonNavSettings.BackColor = ColorTranslator.FromHtml(Theme["background"]);
buttonNavSettings.ForeColor = ColorTranslator.FromHtml(Theme["foreground"]); buttonNavSettings.ForeColor = ColorTranslator.FromHtml(Theme["foreground"]);
buttonNavBids.BackColor = ColorTranslator.FromHtml(Theme["background"]);
buttonNavBids.ForeColor = ColorTranslator.FromHtml(Theme["foreground"]);
} }
private void buttonNavSettings_Click(object sender, EventArgs e) private void buttonNavSettings_Click(object sender, EventArgs e)
{ {
@@ -1346,6 +1349,19 @@ namespace FireWallet
numericUpDownTXCount.Value = int.Parse(UserSettings["portfolio-tx"]); numericUpDownTXCount.Value = int.Parse(UserSettings["portfolio-tx"]);
labelSettingsSaved.Hide(); labelSettingsSaved.Hide();
} }
private void buttonNavBids_Click(object sender, EventArgs e)
{
hidePages();
if (Theme.ContainsKey("selected-bg") && Theme.ContainsKey("selected-fg"))
{
buttonNavBids.BackColor = ColorTranslator.FromHtml(Theme["selected-bg"]);
buttonNavBids.ForeColor = ColorTranslator.FromHtml(Theme["selected-fg"]);
}
panelBids.Show();
panelBids.Dock = DockStyle.Fill;
}
#endregion #endregion
#region Send #region Send
@@ -1595,8 +1611,6 @@ namespace FireWallet
if (!WatchOnly) if (!WatchOnly)
{ {
AddLog("Sending " + amount.ToString() + " HNS to " + address);
string content = "{\"method\": \"sendtoaddress\",\"params\": [ \"" + address + "\", " + string content = "{\"method\": \"sendtoaddress\",\"params\": [ \"" + address + "\", " +
amount.ToString() + ", \"\", \"\", " + subtractFee + " ]}"; amount.ToString() + ", \"\", \"\", " + subtractFee + " ]}";
string output = await APIPost("", true, content); string output = await APIPost("", true, content);

View File

@@ -173,4 +173,5 @@ You should check this file if you have any issues with the application.
# Support # 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 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. 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.
Also you can send HNS directly to `@firewallet`