4 Commits

8 changed files with 110 additions and 18 deletions

View File

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

View File

@@ -72,7 +72,7 @@
comboBoxMode.FlatStyle = FlatStyle.Flat;
comboBoxMode.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
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.Name = "comboBoxMode";
comboBoxMode.Size = new Size(226, 29);

View File

@@ -263,6 +263,21 @@ namespace FireWallet
}
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")
{
batches = new Batch[0];

View File

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

View File

@@ -279,6 +279,14 @@ namespace FireWallet
string contentDNS = "{\"method\": \"getnameresource\", \"params\": [\"" + domain + "\"]}";
string responseDNS = await APIPost("", false, contentDNS);
JObject jObjectDNS = JObject.Parse(responseDNS);
if (jObjectDNS["result"].ToString() == "")
{
// Not registered
groupBoxDNS.Visible = false;
return;
}
JObject result = (JObject)jObjectDNS["result"];
JArray records = (JArray)result["records"];
// For each record
@@ -814,7 +822,14 @@ namespace FireWallet
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 response = await APIPost("", true, content);

View File

@@ -58,6 +58,7 @@ namespace FireWallet
labelaccountusername = new Label();
buttonaccountnew = new Button();
panelNav = new Panel();
buttonNavBids = new Button();
buttonNavSettings = new Button();
buttonBatch = new Button();
buttonNavDomains = new Button();
@@ -126,6 +127,7 @@ namespace FireWallet
textBoxExAddr = new TextBox();
labelSettings4 = new Label();
textBoxExTX = new TextBox();
panelBids = new Panel();
statusStripmain.SuspendLayout();
panelaccount.SuspendLayout();
groupBoxaccount.SuspendLayout();
@@ -353,6 +355,7 @@ namespace FireWallet
//
// panelNav
//
panelNav.Controls.Add(buttonNavBids);
panelNav.Controls.Add(buttonNavSettings);
panelNav.Controls.Add(buttonBatch);
panelNav.Controls.Add(buttonNavDomains);
@@ -365,6 +368,19 @@ namespace FireWallet
panelNav.Size = new Size(114, 553);
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.FlatStyle = FlatStyle.Flat;
@@ -382,7 +398,7 @@ namespace FireWallet
//
buttonBatch.FlatStyle = FlatStyle.Flat;
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.Size = new Size(89, 30);
buttonBatch.TabIndex = 3;
@@ -395,7 +411,7 @@ namespace FireWallet
//
buttonNavDomains.FlatStyle = FlatStyle.Flat;
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.Size = new Size(89, 30);
buttonNavDomains.TabIndex = 2;
@@ -408,7 +424,7 @@ namespace FireWallet
//
buttonNavReceive.FlatStyle = FlatStyle.Flat;
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.Size = new Size(89, 30);
buttonNavReceive.TabIndex = 1;
@@ -449,7 +465,7 @@ namespace FireWallet
panelPortfolio.Controls.Add(groupBoxTransactions);
panelPortfolio.Controls.Add(groupBoxinfo);
panelPortfolio.Controls.Add(groupBoxbalance);
panelPortfolio.Location = new Point(140, 35);
panelPortfolio.Location = new Point(1036, 129);
panelPortfolio.Name = "panelPortfolio";
panelPortfolio.Size = new Size(956, 538);
panelPortfolio.TabIndex = 7;
@@ -1105,11 +1121,20 @@ namespace FireWallet
textBoxExTX.Size = new Size(307, 29);
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
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1152, 575);
Controls.Add(panelBids);
Controls.Add(panelDomains);
Controls.Add(panelSend);
Controls.Add(panelSettings);
@@ -1251,5 +1276,7 @@ namespace FireWallet
private Label labelDomainSort;
private ToolStripSeparator toolStripSeparator1;
private ToolStripMenuItem otherProjectsToolStripMenuItem;
private Button buttonNavBids;
private Panel panelBids;
}
}

View File

@@ -1314,6 +1314,7 @@ namespace FireWallet
panelRecieve.Hide();
panelDomains.Hide();
panelSettings.Hide();
panelBids.Hide();
buttonNavPortfolio.BackColor = ColorTranslator.FromHtml(Theme["background"]);
buttonNavPortfolio.ForeColor = ColorTranslator.FromHtml(Theme["foreground"]);
buttonNavSend.BackColor = ColorTranslator.FromHtml(Theme["background"]);
@@ -1324,6 +1325,8 @@ namespace FireWallet
buttonNavDomains.ForeColor = ColorTranslator.FromHtml(Theme["foreground"]);
buttonNavSettings.BackColor = ColorTranslator.FromHtml(Theme["background"]);
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)
{
@@ -1346,6 +1349,19 @@ namespace FireWallet
numericUpDownTXCount.Value = int.Parse(UserSettings["portfolio-tx"]);
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
#region Send
@@ -1595,8 +1611,6 @@ namespace FireWallet
if (!WatchOnly)
{
AddLog("Sending " + amount.ToString() + " HNS to " + address);
string content = "{\"method\": \"sendtoaddress\",\"params\": [ \"" + address + "\", " +
amount.ToString() + ", \"\", \"\", " + subtractFee + " ]}";
string output = await APIPost("", true, content);

View File

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