Merge branch 'develop'

This commit is contained in:
Nathan Woodburn 2023-07-15 21:31:01 +10:00
commit 74061afe13
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
9 changed files with 255 additions and 372 deletions

View File

@ -29,43 +29,24 @@
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DomainForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DomainForm));
groupBoxInfo = new GroupBox();
labelInfo = new Label();
labelName = new Label(); labelName = new Label();
buttonExplorer = new Button(); buttonExplorer = new Button();
buttonRenew = new Button(); buttonRenew = new Button();
buttonTransfer = new Button(); buttonTransfer = new Button();
groupBoxManage = new GroupBox(); groupBoxManage = new GroupBox();
labelTransfer = new Label();
textBoxTransferAddress = new TextBox(); textBoxTransferAddress = new TextBox();
buttonCancel = new Button(); buttonCancel = new Button();
buttonFinalize = new Button(); buttonFinalize = new Button();
groupBoxDNS = new GroupBox(); groupBoxSign = new GroupBox();
panelDNS = new Panel(); textBoxSignature = new TextBox();
groupBoxInfo.SuspendLayout(); buttonSign = new Button();
textBoxSignMessage = new TextBox();
labelSignMessage = new Label();
groupBoxManage.SuspendLayout(); groupBoxManage.SuspendLayout();
groupBoxDNS.SuspendLayout(); groupBoxSign.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// groupBoxInfo
//
groupBoxInfo.Controls.Add(labelInfo);
groupBoxInfo.Font = new Font("Segoe UI", 14F, FontStyle.Regular, GraphicsUnit.Point);
groupBoxInfo.Location = new Point(12, 52);
groupBoxInfo.Name = "groupBoxInfo";
groupBoxInfo.Size = new Size(280, 163);
groupBoxInfo.TabIndex = 0;
groupBoxInfo.TabStop = false;
groupBoxInfo.Text = "Info";
//
// labelInfo
//
labelInfo.AutoSize = true;
labelInfo.Location = new Point(6, 28);
labelInfo.Name = "labelInfo";
labelInfo.Size = new Size(45, 25);
labelInfo.TabIndex = 0;
labelInfo.Text = "Info";
//
// labelName // labelName
// //
labelName.AutoSize = true; labelName.AutoSize = true;
@ -94,7 +75,7 @@
buttonRenew.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); buttonRenew.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonRenew.Location = new Point(6, 31); buttonRenew.Location = new Point(6, 31);
buttonRenew.Name = "buttonRenew"; buttonRenew.Name = "buttonRenew";
buttonRenew.Size = new Size(89, 30); buttonRenew.Size = new Size(141, 30);
buttonRenew.TabIndex = 1; buttonRenew.TabIndex = 1;
buttonRenew.Text = "Renew"; buttonRenew.Text = "Renew";
buttonRenew.UseVisualStyleBackColor = true; buttonRenew.UseVisualStyleBackColor = true;
@ -104,7 +85,7 @@
// //
buttonTransfer.FlatStyle = FlatStyle.Flat; buttonTransfer.FlatStyle = FlatStyle.Flat;
buttonTransfer.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); buttonTransfer.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonTransfer.Location = new Point(375, 67); buttonTransfer.Location = new Point(655, 70);
buttonTransfer.Name = "buttonTransfer"; buttonTransfer.Name = "buttonTransfer";
buttonTransfer.Size = new Size(89, 30); buttonTransfer.Size = new Size(89, 30);
buttonTransfer.TabIndex = 1; buttonTransfer.TabIndex = 1;
@ -114,33 +95,43 @@
// //
// groupBoxManage // groupBoxManage
// //
groupBoxManage.Controls.Add(labelTransfer);
groupBoxManage.Controls.Add(textBoxTransferAddress); groupBoxManage.Controls.Add(textBoxTransferAddress);
groupBoxManage.Controls.Add(buttonRenew); groupBoxManage.Controls.Add(buttonRenew);
groupBoxManage.Controls.Add(buttonCancel); groupBoxManage.Controls.Add(buttonCancel);
groupBoxManage.Controls.Add(buttonFinalize); groupBoxManage.Controls.Add(buttonFinalize);
groupBoxManage.Controls.Add(buttonTransfer); groupBoxManage.Controls.Add(buttonTransfer);
groupBoxManage.Font = new Font("Segoe UI", 14F, FontStyle.Regular, GraphicsUnit.Point); groupBoxManage.Font = new Font("Segoe UI", 14F, FontStyle.Regular, GraphicsUnit.Point);
groupBoxManage.Location = new Point(298, 52); groupBoxManage.Location = new Point(12, 52);
groupBoxManage.Name = "groupBoxManage"; groupBoxManage.Name = "groupBoxManage";
groupBoxManage.Size = new Size(470, 163); groupBoxManage.Size = new Size(756, 136);
groupBoxManage.TabIndex = 2; groupBoxManage.TabIndex = 2;
groupBoxManage.TabStop = false; groupBoxManage.TabStop = false;
groupBoxManage.Text = "Manage"; groupBoxManage.Text = "Manage";
// //
// labelTransfer
//
labelTransfer.AutoSize = true;
labelTransfer.Location = new Point(6, 72);
labelTransfer.Name = "labelTransfer";
labelTransfer.Size = new Size(83, 25);
labelTransfer.TabIndex = 3;
labelTransfer.Text = "Transfer:";
//
// textBoxTransferAddress // textBoxTransferAddress
// //
textBoxTransferAddress.Location = new Point(6, 66); textBoxTransferAddress.Location = new Point(95, 68);
textBoxTransferAddress.Name = "textBoxTransferAddress"; textBoxTransferAddress.Name = "textBoxTransferAddress";
textBoxTransferAddress.Size = new Size(363, 32); textBoxTransferAddress.Size = new Size(554, 32);
textBoxTransferAddress.TabIndex = 2; textBoxTransferAddress.TabIndex = 2;
// //
// buttonCancel // buttonCancel
// //
buttonCancel.FlatStyle = FlatStyle.Flat; buttonCancel.FlatStyle = FlatStyle.Flat;
buttonCancel.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); buttonCancel.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonCancel.Location = new Point(6, 67); buttonCancel.Location = new Point(242, 70);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(89, 30); buttonCancel.Size = new Size(141, 30);
buttonCancel.TabIndex = 1; buttonCancel.TabIndex = 1;
buttonCancel.Text = "Cancel"; buttonCancel.Text = "Cancel";
buttonCancel.UseVisualStyleBackColor = true; buttonCancel.UseVisualStyleBackColor = true;
@ -151,44 +142,75 @@
// //
buttonFinalize.FlatStyle = FlatStyle.Flat; buttonFinalize.FlatStyle = FlatStyle.Flat;
buttonFinalize.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); buttonFinalize.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
buttonFinalize.Location = new Point(6, 67); buttonFinalize.Location = new Point(95, 70);
buttonFinalize.Name = "buttonFinalize"; buttonFinalize.Name = "buttonFinalize";
buttonFinalize.Size = new Size(89, 30); buttonFinalize.Size = new Size(141, 30);
buttonFinalize.TabIndex = 1; buttonFinalize.TabIndex = 1;
buttonFinalize.Text = "Finalize"; buttonFinalize.Text = "Finalize";
buttonFinalize.UseVisualStyleBackColor = true; buttonFinalize.UseVisualStyleBackColor = true;
buttonFinalize.Visible = false; buttonFinalize.Visible = false;
buttonFinalize.Click += buttonFinalize_Click; buttonFinalize.Click += buttonFinalize_Click;
// //
// groupBoxDNS // groupBoxSign
// //
groupBoxDNS.Controls.Add(panelDNS); groupBoxSign.Controls.Add(textBoxSignature);
groupBoxDNS.Location = new Point(12, 221); groupBoxSign.Controls.Add(buttonSign);
groupBoxDNS.Name = "groupBoxDNS"; groupBoxSign.Controls.Add(textBoxSignMessage);
groupBoxDNS.Size = new Size(756, 224); groupBoxSign.Controls.Add(labelSignMessage);
groupBoxDNS.TabIndex = 3; groupBoxSign.Font = new Font("Segoe UI", 14F, FontStyle.Regular, GraphicsUnit.Point);
groupBoxDNS.TabStop = false; groupBoxSign.Location = new Point(12, 194);
groupBoxDNS.Text = "DNS"; groupBoxSign.Name = "groupBoxSign";
groupBoxSign.Size = new Size(756, 257);
groupBoxSign.TabIndex = 3;
groupBoxSign.TabStop = false;
groupBoxSign.Text = "Sign";
// //
// panelDNS // textBoxSignature
// //
panelDNS.AutoSize = true; textBoxSignature.Location = new Point(484, 56);
panelDNS.Dock = DockStyle.Fill; textBoxSignature.Multiline = true;
panelDNS.Location = new Point(3, 19); textBoxSignature.Name = "textBoxSignature";
panelDNS.Name = "panelDNS"; textBoxSignature.ReadOnly = true;
panelDNS.Size = new Size(750, 202); textBoxSignature.Size = new Size(260, 156);
panelDNS.TabIndex = 0; textBoxSignature.TabIndex = 3;
//
// buttonSign
//
buttonSign.Location = new Point(606, 218);
buttonSign.Name = "buttonSign";
buttonSign.Size = new Size(138, 33);
buttonSign.TabIndex = 2;
buttonSign.Text = "Sign";
buttonSign.UseVisualStyleBackColor = true;
buttonSign.Click += buttonSign_Click;
//
// textBoxSignMessage
//
textBoxSignMessage.Location = new Point(6, 56);
textBoxSignMessage.Multiline = true;
textBoxSignMessage.Name = "textBoxSignMessage";
textBoxSignMessage.Size = new Size(472, 156);
textBoxSignMessage.TabIndex = 1;
textBoxSignMessage.TextChanged += textBoxSignMessage_TextChanged;
//
// labelSignMessage
//
labelSignMessage.AutoSize = true;
labelSignMessage.Location = new Point(6, 28);
labelSignMessage.Name = "labelSignMessage";
labelSignMessage.Size = new Size(90, 25);
labelSignMessage.TabIndex = 0;
labelSignMessage.Text = "Message:";
// //
// DomainForm // DomainForm
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(780, 457); ClientSize = new Size(780, 457);
Controls.Add(groupBoxDNS); Controls.Add(groupBoxSign);
Controls.Add(groupBoxManage); Controls.Add(groupBoxManage);
Controls.Add(buttonExplorer); Controls.Add(buttonExplorer);
Controls.Add(labelName); Controls.Add(labelName);
Controls.Add(groupBoxInfo);
FormBorderStyle = FormBorderStyle.Fixed3D; FormBorderStyle = FormBorderStyle.Fixed3D;
Icon = (Icon)resources.GetObject("$this.Icon"); Icon = (Icon)resources.GetObject("$this.Icon");
MaximizeBox = false; MaximizeBox = false;
@ -197,29 +219,28 @@
ShowInTaskbar = false; ShowInTaskbar = false;
Text = "DomainsForm"; Text = "DomainsForm";
Load += DomainForm_Load; Load += DomainForm_Load;
groupBoxInfo.ResumeLayout(false);
groupBoxInfo.PerformLayout();
groupBoxManage.ResumeLayout(false); groupBoxManage.ResumeLayout(false);
groupBoxManage.PerformLayout(); groupBoxManage.PerformLayout();
groupBoxDNS.ResumeLayout(false); groupBoxSign.ResumeLayout(false);
groupBoxDNS.PerformLayout(); groupBoxSign.PerformLayout();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
#endregion #endregion
private GroupBox groupBoxInfo;
private Label labelName; private Label labelName;
private Button buttonExplorer; private Button buttonExplorer;
private Label labelInfo;
private Button buttonRenew; private Button buttonRenew;
private Button buttonTransfer; private Button buttonTransfer;
private GroupBox groupBoxManage; private GroupBox groupBoxManage;
private TextBox textBoxTransferAddress; private TextBox textBoxTransferAddress;
private Button buttonFinalize; private Button buttonFinalize;
private Button buttonCancel; private Button buttonCancel;
private GroupBox groupBoxDNS; private Label labelTransfer;
private Panel panelDNS; private GroupBox groupBoxSign;
private TextBox textBoxSignMessage;
private Label labelSignMessage;
private Button buttonSign;
private TextBox textBoxSignature;
} }
} }

View File

@ -6,17 +6,17 @@ namespace FireWalletLite
{ {
public partial class DomainForm : Form public partial class DomainForm : Form
{ {
private MainForm main; private MainForm Main;
private string domain; private string Domain;
public DomainForm(MainForm main, string domain) public DomainForm(MainForm main, string domain)
{ {
InitializeComponent(); InitializeComponent();
this.main = main; this.Main = main;
this.domain = domain; this.Domain = domain;
this.Text = domain + "/"; Text = domain + "/";
// Theme form // Theme form
this.BackColor = ColorTranslator.FromHtml(main.Theme["background"]); BackColor = ColorTranslator.FromHtml(main.Theme["background"]);
this.ForeColor = ColorTranslator.FromHtml(main.Theme["foreground"]); ForeColor = ColorTranslator.FromHtml(main.Theme["foreground"]);
foreach (Control control in Controls) foreach (Control control in Controls)
{ {
main.ThemeControl(control); main.ThemeControl(control);
@ -28,105 +28,45 @@ namespace FireWalletLite
{ {
ProcessStartInfo psi = new ProcessStartInfo ProcessStartInfo psi = new ProcessStartInfo
{ {
FileName = main.DomainExplorer + domain, FileName = Main.DomainExplorer + Domain,
UseShellExecute = true UseShellExecute = true
}; };
Process.Start(psi); Process.Start(psi);
} }
private async void GetName()
{
try
{
string content = "{\"method\": \"getnameinfo\", \"params\": [\"" + domain + "\"]}";
string response = await main.APIPost("", false, content);
JObject jObject = JObject.Parse(response);
// Get block height
string Nodeinfo = await main.APIGet("", false);
JObject jObjectInfo = JObject.Parse(Nodeinfo);
JObject chain = (JObject)jObjectInfo["chain"];
int height = Convert.ToInt32(chain["height"]);
labelInfo.Text = "";
if (jObject.ContainsKey("result"))
{
JObject result = (JObject)jObject["result"];
JObject start = (JObject)result["start"];
if (start["reserved"].ToString().ToLower() == "true") labelInfo.Text = "Reserved for ICANN domain owner\n";
if (result.ContainsKey("info"))
{
try
{
JObject info = (JObject)result["info"];
string state = info["state"].ToString();
JObject stats = (JObject)info["stats"];
if (info["transfer"].ToString() != "0")
{
labelInfo.Text += "Transferring\n";
int TransferEnd = Convert.ToInt32(stats["transferLockupEnd"].ToString());
textBoxTransferAddress.Hide();
buttonTransfer.Hide();
if (height >= TransferEnd)
{
buttonFinalize.Show();
}
else
{
labelInfo.Text += "Finalize in " + (TransferEnd - height).ToString() + " blocks\n";
buttonCancel.Show();
}
}
if (state == "CLOSED")
{
string expires = "Expires in ~" + stats["daysUntilExpire"].ToString() + " days\n";
labelInfo.Text += expires;
}
else labelInfo.Text += state + "\n";
// Get DNS if the domain isn't in auction
if (state == "CLOSED") GetDNS();
}
catch (Exception ex)
{
// No info -> Domain not in wallet
labelInfo.Text = "No info in node";
}
}
}
else
{
labelInfo.Text = "Error getting Name";
}
}
catch (Exception ex)
{
main.AddLog(ex.Message);
}
if (!main.Domains.Contains(domain))
{
groupBoxManage.Hide();
}
}
private void DomainForm_Load(object sender, EventArgs e) private void DomainForm_Load(object sender, EventArgs e)
{ {
GetName(); if (!File.Exists(Main.dir + "domains.json")) return;
JArray domains = JArray.Parse(File.ReadAllText(Main.dir + "domains.json"));
foreach (JObject domain in domains)
{
if (domain["name"].ToString() == Domain)
{
if (domain.ContainsKey("status"))
{
switch (domain["status"].ToString())
{
case "transferring":
buttonFinalize.Visible = true;
buttonCancel.Visible = true;
buttonTransfer.Visible = false;
textBoxTransferAddress.Visible = false;
break;
case "closed":
buttonCancel.Visible = false;
buttonFinalize.Visible = false;
break;
}
}
}
}
} }
private async void buttonRenew_Click(object sender, EventArgs e) private async void buttonRenew_Click(object sender, EventArgs e)
{ {
string content = "{\"method\": \"renew\", \"params\": [\"" + domain + "\"]}"; string content = "{\"method\": \"renew\", \"params\": [\"" + Domain + "\"]}";
string response = await main.APIPost("", true, content); string response = await Main.APIPost("", true, content);
if (response == "Error") if (response == "Error")
{ {
NotifyForm notify = new NotifyForm("Error renewing domain"); NotifyForm notify = new NotifyForm("Error renewing domain");
@ -137,12 +77,12 @@ namespace FireWalletLite
JObject jObject = JObject.Parse(response); JObject jObject = JObject.Parse(response);
if (jObject.ContainsKey("result")) if (jObject.ContainsKey("result"))
{ {
main.AddLog(jObject["result"].ToString()); Main.AddLog(jObject["result"].ToString());
JObject result = (JObject)jObject["result"]; JObject result = (JObject)jObject["result"];
if (result.ContainsKey("txid")) if (result.ContainsKey("txid"))
{ {
string txid = result["txid"].ToString(); string txid = result["txid"].ToString();
NotifyForm notify = new NotifyForm("Renewed domain", "Explorer", main.TXExplorer + txid); NotifyForm notify = new NotifyForm("Renewed domain", "Explorer", Main.TXExplorer + txid);
notify.ShowDialog(); notify.ShowDialog();
notify.Dispose(); notify.Dispose();
} }
@ -158,14 +98,14 @@ namespace FireWalletLite
NotifyForm notify = new NotifyForm("Error renewing domain"); NotifyForm notify = new NotifyForm("Error renewing domain");
notify.ShowDialog(); notify.ShowDialog();
notify.Dispose(); notify.Dispose();
main.AddLog(jObject.ToString()); Main.AddLog(jObject.ToString());
} }
} }
private async void buttonTransfer_Click(object sender, EventArgs e) private async void buttonTransfer_Click(object sender, EventArgs e)
{ {
string address = textBoxTransferAddress.Text; string address = textBoxTransferAddress.Text;
bool valid = await main.ValidAddress(address); bool valid = await Main.ValidAddress(address);
if (!valid) if (!valid)
{ {
NotifyForm notify = new NotifyForm("Invalid address"); NotifyForm notify = new NotifyForm("Invalid address");
@ -173,8 +113,9 @@ namespace FireWalletLite
notify.Dispose(); notify.Dispose();
return; return;
} }
string content = "{\"method\": \"transfer\", \"params\": [\"" + domain + "\", \"" + address + "\"]}"; string path = "wallet/" + Main.Account + "/transfer";
string response = await main.APIPost("", true, content); string content = "{\"passphrase\": \"" + Main.Password + "\", \"name\": \"" + Domain + "\", \"broadcast\": true, \"sign\": true, \"address\": \"" + address + "\"}";
string response = await Main.APIPost(path, true, content);
if (response == "Error") if (response == "Error")
{ {
NotifyForm notify = new NotifyForm("Error transferring domain"); NotifyForm notify = new NotifyForm("Error transferring domain");
@ -183,78 +124,152 @@ namespace FireWalletLite
return; return;
} }
JObject jObject = JObject.Parse(response); JObject jObject = JObject.Parse(response);
if (jObject.ContainsKey("result")) if (jObject.ContainsKey("hash"))
{ {
main.AddLog(jObject["result"].ToString()); string txid = jObject["hash"].ToString();
JObject result = (JObject)jObject["result"]; NotifyForm notify = new NotifyForm("Transferred domain", "Explorer", Main.TXExplorer + txid);
if (result.ContainsKey("txid"))
{
string txid = result["txid"].ToString();
NotifyForm notify = new NotifyForm("Renewed domain", "Explorer", main.TXExplorer + txid);
notify.ShowDialog(); notify.ShowDialog();
notify.Dispose(); notify.Dispose();
AddDomainInfo("transferring");
} }
else else
{ {
NotifyForm notify = new NotifyForm("Error renewing domain"); NotifyForm notify = new NotifyForm("Error transferring domain");
notify.ShowDialog(); notify.ShowDialog();
notify.Dispose(); notify.Dispose();
} }
} }
else
{
NotifyForm notify = new NotifyForm("Error renewing domain");
notify.ShowDialog();
notify.Dispose();
main.AddLog(jObject.ToString());
}
}
private void buttonFinalize_Click(object sender, EventArgs e) private void buttonFinalize_Click(object sender, EventArgs e)
{ {
string content = "{\"method\": \"finalize\", \"params\": [\"" + domain + "\"]}"; string path = "wallet/" + Main.Account + "/finalize";
string response = main.APIPost("", true, content).Result; string content = "{\"passphrase\": \"" + Main.Password + "\", \"name\": \"" + Domain + "\", \"broadcast\": true, \"sign\": true}";
string response = Main.APIPost(path, true, content).Result;
if (response == "Error") if (response == "Error")
{ {
NotifyForm notify = new NotifyForm("Error finalizing tranfer"); NotifyForm notify = new NotifyForm("Error finalizing transfer");
notify.ShowDialog(); notify.ShowDialog();
notify.Dispose(); notify.Dispose();
return; return;
} }
JObject jObject = JObject.Parse(response); JObject jObject = JObject.Parse(response);
if (jObject.ContainsKey("result")) if (jObject.ContainsKey("hash"))
{ {
main.AddLog(jObject["result"].ToString()); string txid = jObject["hash"].ToString();
JObject result = (JObject)jObject["result"]; NotifyForm notify = new NotifyForm("Finalized domain", "Explorer", Main.TXExplorer + txid);
if (result.ContainsKey("txid"))
{
string txid = result["txid"].ToString();
NotifyForm notify = new NotifyForm("Finalized tranfer", "Explorer", main.TXExplorer + txid);
notify.ShowDialog(); notify.ShowDialog();
notify.Dispose(); notify.Dispose();
AddDomainInfo("closed");
} }
else else
{ {
NotifyForm notify = new NotifyForm("Error finalizing tranfer"); NotifyForm notify = new NotifyForm("Error finalizing domain");
notify.ShowDialog(); notify.ShowDialog();
notify.Dispose(); notify.Dispose();
} }
} }
else
{
NotifyForm notify = new NotifyForm("Error finalizing tranfer");
notify.ShowDialog();
notify.Dispose();
main.AddLog(jObject.ToString());
}
}
private void buttonCancel_Click(object sender, EventArgs e) private void buttonCancel_Click(object sender, EventArgs e)
{ {
string content = "{\"method\": \"cancel\", \"params\": [\"" + domain + "\"]}"; string path = "wallet/" + Main.Account + "/cancel";
string response = main.APIPost("", true, content).Result; string content = "{\"passphrase\": \"" + Main.Password + "\", \"name\": \"" + Domain + "\", \"broadcast\": true, \"sign\": true}";
string response = Main.APIPost(path, true, content).Result;
if (response == "Error") if (response == "Error")
{ {
NotifyForm notify = new NotifyForm("Error cancelling tranfer"); NotifyForm notify = new NotifyForm("Error cancelling transfer");
notify.ShowDialog();
notify.Dispose();
return;
}
JObject jObject = JObject.Parse(response);
if (jObject.ContainsKey("hash"))
{
string txid = jObject["hash"].ToString();
NotifyForm notify = new NotifyForm("Canceled transfer", "Explorer", Main.TXExplorer + txid);
notify.ShowDialog();
notify.Dispose();
AddDomainInfo("closed");
}
else
{
NotifyForm notify = new NotifyForm("Error cancelling transfer");
notify.ShowDialog();
notify.Dispose();
}
}
private void AddDomainInfo(string status)
{
if (File.Exists(Main.dir + "domains.json"))
{
bool found = false;
JArray domains = JArray.Parse(File.ReadAllText(Main.dir + "domains.json"));
foreach (JObject domain in domains)
{
if (domain["name"].ToString() == Domain)
{
found = true;
if (domain.ContainsKey("status"))
{
domain["status"] = status;
}
else
{
domain.Add("status", status);
}
}
}
if (!found)
{
JObject domain = new JObject();
domain["name"] = Domain;
domain["status"] = status;
domains.Add(domain);
}
File.WriteAllText(Main.dir + "domains.json", domains.ToString());
}
else
{
JArray domains = new JArray();
JObject domain = new JObject();
domain["name"] = Domain;
domain["status"] = status;
domains.Add(domain);
File.WriteAllText(Main.dir + "domains.json", domains.ToString());
}
}
private async void buttonSign_Click(object sender, EventArgs e)
{
if (buttonSign.Text == "Save")
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Text File|*.txt";
saveFileDialog.Title = "Save Signature";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
JObject signature = new JObject();
signature["domain"] = Domain;
signature["message"] = textBoxSignMessage.Text;
signature["signature"] = textBoxSignature.Text;
signature["time"] = DateTime.Now.ToString();
File.WriteAllText(saveFileDialog.FileName, signature.ToString());
}
return;
}
if (textBoxSignMessage.Text == "")
{
NotifyForm notify = new NotifyForm("Enter a message to sign");
notify.ShowDialog();
notify.Dispose();
return;
}
string content = "{\"method\": \"signmessagewithname\", \"params\": [\"" + Domain + "\", \"" + textBoxSignMessage.Text + "\"]}";
string response = await Main.APIPost("", true, content);
if (response == "Error")
{
NotifyForm notify = new NotifyForm("Error signing message");
notify.ShowDialog(); notify.ShowDialog();
notify.Dispose(); notify.Dispose();
return; return;
@ -262,131 +277,21 @@ namespace FireWalletLite
JObject jObject = JObject.Parse(response); JObject jObject = JObject.Parse(response);
if (jObject.ContainsKey("result")) if (jObject.ContainsKey("result"))
{ {
main.AddLog(jObject["result"].ToString()); textBoxSignature.Text = jObject["result"].ToString();
JObject result = (JObject)jObject["result"]; buttonSign.Text = "Save";
if (result.ContainsKey("txid"))
{
string txid = result["txid"].ToString();
NotifyForm notify = new NotifyForm("Cancelled tranfer", "Explorer", main.TXExplorer + txid);
notify.ShowDialog();
notify.Dispose();
} }
else else
{ {
NotifyForm notify = new NotifyForm("Error cancelling tranfer"); Main.AddLog(response);
NotifyForm notify = new NotifyForm("Error signing message");
notify.ShowDialog(); notify.ShowDialog();
notify.Dispose(); notify.Dispose();
} }
} }
else
private void textBoxSignMessage_TextChanged(object sender, EventArgs e)
{ {
NotifyForm notify = new NotifyForm("Error cancelling tranfer"); buttonSign.Text = "Sign";
notify.ShowDialog();
notify.Dispose();
main.AddLog(jObject.ToString());
}
}
// Get DNS records for domain. Not implemented yet
private async void GetDNS()
{
// Get DNS records
string contentDNS = "{\"method\": \"getnameresource\", \"params\": [\"" + domain + "\"]}";
string responseDNS = await main.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
int i = 0;
foreach (JObject record in records)
{
Panel DNSPanel = new Panel();
// Count for scroll width
DNSPanel.Width = panelDNS.Width - SystemInformation.VerticalScrollBarWidth - 2;
DNSPanel.Height = 60;
DNSPanel.BorderStyle = BorderStyle.FixedSingle;
DNSPanel.Top = 62 * i;
Label DNSType = new Label();
DNSType.Text = record["type"].ToString();
DNSType.Location = new System.Drawing.Point(10, 10);
DNSType.AutoSize = true;
DNSType.Font = new Font(DNSType.Font.FontFamily, 11.0f, FontStyle.Bold);
DNSPanel.Controls.Add(DNSType);
switch (DNSType.Text)
{
case "NS":
Label DNSNS = new Label();
DNSNS.Text = record["ns"].ToString();
DNSNS.Location = new System.Drawing.Point(10, 30);
DNSNS.AutoSize = true;
DNSPanel.Controls.Add(DNSNS);
break;
case "GLUE4":
case "GLUE6":
Label DNSNS1 = new Label();
DNSNS1.Text = record["ns"].ToString();
DNSNS1.Location = new System.Drawing.Point(10, 30);
DNSNS1.AutoSize = true;
DNSPanel.Controls.Add(DNSNS1);
Label address = new Label();
address.Text = record["address"].ToString();
address.Location = new System.Drawing.Point(DNSNS1.Left + DNSNS1.Width + 20, 30);
address.AutoSize = true;
DNSPanel.Controls.Add(address);
break;
case "DS":
Label keyTag = new Label();
keyTag.Text = record["keyTag"].ToString();
keyTag.Location = new System.Drawing.Point(10, 30);
keyTag.AutoSize = true;
DNSPanel.Controls.Add(keyTag);
Label algorithm = new Label();
algorithm.Text = record["algorithm"].ToString();
algorithm.Location = new System.Drawing.Point(keyTag.Left + keyTag.Width + 10, 30);
algorithm.AutoSize = true;
DNSPanel.Controls.Add(algorithm);
Label digestType = new Label();
digestType.Text = record["digestType"].ToString();
digestType.Location = new System.Drawing.Point(algorithm.Left + algorithm.Width + 10, 30);
digestType.AutoSize = true;
DNSPanel.Controls.Add(digestType);
Label digest = new Label();
digest.Text = record["digest"].ToString();
digest.Location = new System.Drawing.Point(digestType.Left + digestType.Width + 10, 30);
digest.AutoSize = true;
DNSPanel.Controls.Add(digest);
break;
case "TXT":
JArray txts = (JArray)record["txt"];
int j = 0;
foreach (string txt in txts)
{
Label DNSTXT = new Label();
DNSTXT.Text = txt;
DNSTXT.Location = new System.Drawing.Point(10, 30 + (j * 20));
DNSTXT.AutoSize = true;
DNSPanel.Controls.Add(DNSTXT);
DNSPanel.Height = 60 + (j * 20);
j++;
}
break;
}
panelDNS.Controls.Add(DNSPanel);
i++;
}
} }
} }
} }

View File

@ -1,13 +1,4 @@
using System; using FireWallet;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FireWallet;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace FireWalletLite namespace FireWalletLite

View File

@ -1,5 +1,4 @@
using System.Diagnostics; using System.Diagnostics;
using System.Net;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using FireWallet; using FireWallet;
@ -9,7 +8,7 @@ namespace FireWalletLite
{ {
#region Constants #region Constants
MainForm mainForm = new MainForm(); MainForm mainForm = new MainForm();
bool hideScreen = true; bool hideScreen = false;
Process HSDProcess; Process HSDProcess;
#endregion #endregion

View File

@ -1,10 +1,6 @@
using System.Data; using System.Diagnostics;
using System.Diagnostics;
using System.DirectoryServices.ActiveDirectory;
using System.Runtime.InteropServices;
using FireWallet; using FireWallet;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using static QRCoder.PayloadGenerator;
namespace FireWalletLite namespace FireWalletLite
{ {
@ -35,8 +31,8 @@ namespace FireWalletLite
public Dictionary<string, string> Theme { get; set; } public Dictionary<string, string> Theme { get; set; }
HttpClient httpClient = new HttpClient(); HttpClient httpClient = new HttpClient();
Decimal Balance { get; set; } Decimal Balance { get; set; }
String Account = "primary"; public String Account = "primary";
String Password { get; set; } public String Password { get; set; }
#endregion #endregion
public MainForm() public MainForm()
{ {
@ -247,7 +243,6 @@ namespace FireWalletLite
string port = "1203"; string port = "1203";
if (wallet) port = port + "9"; if (wallet) port = port + "9";
else port = port + "7"; else port = port + "7";
HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, "http://" + ip + ":" + port + "/" + path); HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Post, "http://" + ip + ":" + port + "/" + path);
//req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes("x:" + key))); //req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes("x:" + key)));
req.Content = new StringContent(content); req.Content = new StringContent(content);

View File

@ -1,15 +1,5 @@
using System; using System.Diagnostics;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FireWallet namespace FireWallet
{ {

View File

@ -1,13 +1,4 @@
using System; using QRCoder;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using QRCoder;
namespace FireWalletLite namespace FireWalletLite
{ {

View File

@ -1,13 +1,4 @@
using System; using FireWallet;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FireWallet;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace FireWalletLite namespace FireWalletLite

View File

@ -12,20 +12,20 @@ First run flow:
Login only requires password as this wallet is made to only use the `primary` wallet. Login only requires password as this wallet is made to only use the `primary` wallet.
Main Page includes This wallet supports
- Balance - Displaying balance
- Domain Count - Domain list and expiration date
- Domain List
- Renew expiring domains button - Renew expiring domains button
- Recieve HNS button (opens a window with address, copy button, and QR code) - Displaying receiving address
- Send HNS button (opens a window with address, amount, and send button) - Sending HNS
- Sign message
This wallet does not (and will never) support This wallet does not (and will never) support
- Creating new wallets - Creating new wallets
- Auctions (bidding, revealing, etc) - Auctions (bidding, revealing, etc)
- Multisig wallets - Multisig wallets
- Hardware wallets - Hardware wallets
- DNS management (a simple DNS managment page might be added in the future) - DNS management
If you want to use a wallet with more features, please use [Fire Wallet](https://firewallet.au) or [Bob Wallet](https://bobwallet.io) instead. If you want to use a wallet with more features, please use [Fire Wallet](https://firewallet.au) or [Bob Wallet](https://bobwallet.io) instead.