mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-12-25 23:38:15 +11:00
main: Added reveal and renew all buttons
This commit is contained in:
parent
72be43e16d
commit
f4900cf9d6
@ -1,5 +1,6 @@
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Principal;
|
||||
@ -489,6 +490,11 @@ namespace FireWallet
|
||||
NotifyForm notifyForm = new NotifyForm("Error: \nBatch output addresses would exceed lookahead\nYour batch might have too many TXs.");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
} else if (jObject["error"].ToString().Contains("Name is not registered"))
|
||||
{
|
||||
NotifyForm notifyForm = new NotifyForm("Error: \nName is not registered\nRemember you can't renew domains in transfer");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
58
FireWallet/MainForm.Designer.cs
generated
58
FireWallet/MainForm.Designer.cs
generated
@ -59,6 +59,8 @@ namespace FireWallet
|
||||
buttonNavSend = new Button();
|
||||
buttonNavPortfolio = new Button();
|
||||
panelPortfolio = new Panel();
|
||||
buttonRenewAll = new Button();
|
||||
buttonRevealAll = new Button();
|
||||
groupBoxTransactions = new GroupBox();
|
||||
groupBoxinfo = new GroupBox();
|
||||
labelPendingCount = new Label();
|
||||
@ -87,6 +89,7 @@ namespace FireWallet
|
||||
textBoxReceiveAddress = new TextBox();
|
||||
labelReceive1 = new Label();
|
||||
panelDomains = new Panel();
|
||||
buttonExportDomains = new Button();
|
||||
groupBoxDomains = new GroupBox();
|
||||
panelDomainList = new Panel();
|
||||
labelDomainSearch = new Label();
|
||||
@ -174,6 +177,7 @@ namespace FireWallet
|
||||
toolStripStatusLabelLedger.Name = "toolStripStatusLabelLedger";
|
||||
toolStripStatusLabelLedger.Size = new Size(71, 17);
|
||||
toolStripStatusLabelLedger.Text = "Cold Wallet:";
|
||||
toolStripStatusLabelLedger.Visible = false;
|
||||
//
|
||||
// toolStripSplitButtonlogout
|
||||
//
|
||||
@ -386,15 +390,40 @@ namespace FireWallet
|
||||
//
|
||||
// panelPortfolio
|
||||
//
|
||||
panelPortfolio.Controls.Add(buttonRevealAll);
|
||||
panelPortfolio.Controls.Add(groupBoxTransactions);
|
||||
panelPortfolio.Controls.Add(groupBoxinfo);
|
||||
panelPortfolio.Controls.Add(groupBoxbalance);
|
||||
panelPortfolio.Location = new Point(1085, 47);
|
||||
panelPortfolio.Location = new Point(1065, 80);
|
||||
panelPortfolio.Name = "panelPortfolio";
|
||||
panelPortfolio.Size = new Size(956, 538);
|
||||
panelPortfolio.TabIndex = 7;
|
||||
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.FlatStyle = FlatStyle.Flat;
|
||||
buttonRevealAll.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonRevealAll.Location = new Point(537, 12);
|
||||
buttonRevealAll.Name = "buttonRevealAll";
|
||||
buttonRevealAll.Size = new Size(89, 44);
|
||||
buttonRevealAll.TabIndex = 9;
|
||||
buttonRevealAll.Text = "Reveal All";
|
||||
buttonRevealAll.UseVisualStyleBackColor = true;
|
||||
buttonRevealAll.Click += buttonRevealAll_Click;
|
||||
//
|
||||
// groupBoxTransactions
|
||||
//
|
||||
groupBoxTransactions.Dock = DockStyle.Bottom;
|
||||
@ -632,7 +661,7 @@ namespace FireWallet
|
||||
panelRecieve.Controls.Add(labelReceive2);
|
||||
panelRecieve.Controls.Add(textBoxReceiveAddress);
|
||||
panelRecieve.Controls.Add(labelReceive1);
|
||||
panelRecieve.Location = new Point(117, 34);
|
||||
panelRecieve.Location = new Point(1140, 24);
|
||||
panelRecieve.Name = "panelRecieve";
|
||||
panelRecieve.Size = new Size(995, 523);
|
||||
panelRecieve.TabIndex = 17;
|
||||
@ -692,15 +721,29 @@ namespace FireWallet
|
||||
//
|
||||
// panelDomains
|
||||
//
|
||||
panelDomains.Controls.Add(buttonRenewAll);
|
||||
panelDomains.Controls.Add(buttonExportDomains);
|
||||
panelDomains.Controls.Add(groupBoxDomains);
|
||||
panelDomains.Controls.Add(labelDomainSearch);
|
||||
panelDomains.Controls.Add(textBoxDomainSearch);
|
||||
panelDomains.Location = new Point(1129, 22);
|
||||
panelDomains.Location = new Point(120, 48);
|
||||
panelDomains.Name = "panelDomains";
|
||||
panelDomains.Size = new Size(920, 536);
|
||||
panelDomains.TabIndex = 18;
|
||||
panelDomains.Visible = false;
|
||||
//
|
||||
// buttonExportDomains
|
||||
//
|
||||
buttonExportDomains.FlatStyle = FlatStyle.Flat;
|
||||
buttonExportDomains.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
buttonExportDomains.Location = new Point(351, 9);
|
||||
buttonExportDomains.Name = "buttonExportDomains";
|
||||
buttonExportDomains.Size = new Size(102, 32);
|
||||
buttonExportDomains.TabIndex = 3;
|
||||
buttonExportDomains.Text = "Export";
|
||||
buttonExportDomains.UseVisualStyleBackColor = true;
|
||||
buttonExportDomains.Click += export_Click;
|
||||
//
|
||||
// groupBoxDomains
|
||||
//
|
||||
groupBoxDomains.Controls.Add(panelDomainList);
|
||||
@ -749,7 +792,7 @@ namespace FireWallet
|
||||
panelSettings.Controls.Add(buttonSettingsSave);
|
||||
panelSettings.Controls.Add(groupBoxSettingsExplorer);
|
||||
panelSettings.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
panelSettings.Location = new Point(121, 21);
|
||||
panelSettings.Location = new Point(1065, 211);
|
||||
panelSettings.Name = "panelSettings";
|
||||
panelSettings.Size = new Size(930, 550);
|
||||
panelSettings.TabIndex = 19;
|
||||
@ -965,13 +1008,13 @@ namespace FireWallet
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1152, 575);
|
||||
Controls.Add(panelaccount);
|
||||
Controls.Add(panelPortfolio);
|
||||
Controls.Add(panelRecieve);
|
||||
Controls.Add(panelSettings);
|
||||
Controls.Add(panelDomains);
|
||||
Controls.Add(panelSend);
|
||||
Controls.Add(panelPortfolio);
|
||||
Controls.Add(panelNav);
|
||||
Controls.Add(statusStripmain);
|
||||
Controls.Add(panelSettings);
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
Name = "MainForm";
|
||||
Opacity = 0D;
|
||||
@ -1091,5 +1134,8 @@ namespace FireWallet
|
||||
private Button buttonSettingsRescan;
|
||||
private ToolStripStatusLabel toolStripStatusLabelLedger;
|
||||
private Button buttonAddressVerify;
|
||||
private Button buttonRevealAll;
|
||||
private Button buttonExportDomains;
|
||||
private Button buttonRenewAll;
|
||||
}
|
||||
}
|
@ -218,7 +218,8 @@ namespace FireWallet
|
||||
hsdProcess.Start();
|
||||
// Wait for HSD to start
|
||||
await Task.Delay(2000);
|
||||
} catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog("HSD Failed to start");
|
||||
AddLog(ex.Message);
|
||||
@ -556,9 +557,18 @@ namespace FireWallet
|
||||
path = "wallet/" + account + "";
|
||||
APIresponse = await APIGet(path, true);
|
||||
JObject jObject = JObject.Parse(APIresponse);
|
||||
if (jObject["watchOnly"].ToString() == "True") watchOnly = true;
|
||||
else watchOnly = false;
|
||||
toolStripStatusLabelLedger.Text = "Cold Wallet: " + watchOnly.ToString();
|
||||
if (jObject["watchOnly"].ToString() == "True")
|
||||
{
|
||||
watchOnly = true;
|
||||
toolStripStatusLabelLedger.Text = "Cold Wallet";
|
||||
toolStripStatusLabelLedger.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
watchOnly = false;
|
||||
toolStripStatusLabelLedger.Visible = false;
|
||||
}
|
||||
|
||||
|
||||
if (watchOnly)
|
||||
{
|
||||
@ -583,7 +593,7 @@ namespace FireWallet
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
account = comboBoxaccount.Text;
|
||||
password = textBoxaccountpassword.Text;
|
||||
bool loggedin = await Login();
|
||||
@ -623,6 +633,7 @@ namespace FireWallet
|
||||
{
|
||||
password = ""; // Clear password from memory as soon as possible
|
||||
toolStripSplitButtonlogout.Visible = false;
|
||||
toolStripStatusLabelLedger.Visible = false;
|
||||
string path = "wallet/" + account + "/lock";
|
||||
string content = "";
|
||||
string APIresponse = await APIPost(path, true, content);
|
||||
@ -946,7 +957,7 @@ namespace FireWallet
|
||||
await UpdateBalance();
|
||||
GetTXHistory();
|
||||
labelBalance.Text = "Available: " + balance.ToString() + " HNS";
|
||||
labelLocked.Text = "Locked: " + balanceLocked.ToString() + " HNS";
|
||||
labelLocked.Text = "Locked: " + balanceLocked.ToString() + " HNS*";
|
||||
labelBalanceTotal.Text = "Total: " + (balance + balanceLocked).ToString() + " HNS";
|
||||
if (theme.ContainsKey("selected-bg") && theme.ContainsKey("selected-fg"))
|
||||
{
|
||||
@ -1438,12 +1449,15 @@ namespace FireWallet
|
||||
#endregion
|
||||
#region Domains
|
||||
public string[] Domains { get; set; }
|
||||
public string[] DomainsRenewable { get; set; }
|
||||
private async void UpdateDomains()
|
||||
{
|
||||
string response = await APIGet("wallet/" + account + "/name?own=true", true);
|
||||
JArray names = JArray.Parse(response);
|
||||
Domains = new string[names.Count];
|
||||
DomainsRenewable = new string[names.Count];
|
||||
int i = 0;
|
||||
int renewable = 0;
|
||||
panelDomainList.Controls.Clear();
|
||||
foreach (JObject name in names)
|
||||
{
|
||||
@ -1468,9 +1482,9 @@ namespace FireWallet
|
||||
domainName.Left = 5;
|
||||
domainName.AutoSize = true;
|
||||
|
||||
|
||||
|
||||
domainTMP.Controls.Add(domainName);
|
||||
|
||||
|
||||
Label expiry = new Label();
|
||||
JObject stats = JObject.Parse(name["stats"].ToString());
|
||||
if (stats.ContainsKey("daysUntilExpire"))
|
||||
@ -1480,15 +1494,61 @@ namespace FireWallet
|
||||
expiry.AutoSize = true;
|
||||
expiry.Left = domainTMP.Width - expiry.Width - 100;
|
||||
domainTMP.Controls.Add(expiry);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Add to domains renewable
|
||||
DomainsRenewable[renewable] = Domains[i];
|
||||
renewable++;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
expiry.Text = "Expires: Not Registered yet";
|
||||
expiry.Top = 5;
|
||||
expiry.AutoSize = true;
|
||||
expiry.Left = domainTMP.Width - expiry.Width - 100;
|
||||
domainTMP.Controls.Add(expiry);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
panelDomainList.Controls.Add(domainTMP);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
private async void buttonRevealAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
string content = "{\"method\": \"sendreveal\"}";
|
||||
string response = await APIPost("", true, content);
|
||||
AddLog(response);
|
||||
if (response == "Error")
|
||||
{
|
||||
AddLog("Error sending reveal");
|
||||
NotifyForm notifyForm = new NotifyForm("Error sending reveal");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
}
|
||||
JObject resp = JObject.Parse(response);
|
||||
if (resp["error"] != null)
|
||||
{
|
||||
AddLog("Error sending reveal");
|
||||
AddLog(resp["error"].ToString());
|
||||
JObject error = JObject.Parse(resp["error"].ToString());
|
||||
NotifyForm notifyForm = new NotifyForm("Error sending reveal\n" + error["message"].ToString());
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
}
|
||||
if (resp.ContainsKey("result"))
|
||||
{
|
||||
JObject result = JObject.Parse(resp["result"].ToString());
|
||||
string hash = result["hash"].ToString();
|
||||
NotifyForm notifyForm = new NotifyForm("Reveal sent\n" + hash, "Explorer", userSettings["explorer-tx"] + hash);
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
}
|
||||
}
|
||||
private void textBoxDomainSearch_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyValue == 13)
|
||||
@ -1654,11 +1714,37 @@ namespace FireWallet
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void export_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Filter = "CSV file (*.csv)|*.csv";
|
||||
saveFileDialog.Title = "Export";
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
StreamWriter sw = new StreamWriter(saveFileDialog.FileName);
|
||||
foreach (string domain in DomainsRenewable)
|
||||
{
|
||||
if (domain == null) break;
|
||||
sw.WriteLine(domain);
|
||||
}
|
||||
sw.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void buttonRenewAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DomainsRenewable == null)
|
||||
{
|
||||
NotifyForm notifyForm = new NotifyForm("No domains found\nMake sure you have synced your domains by visiting the domain page");
|
||||
notifyForm.ShowDialog();
|
||||
notifyForm.Dispose();
|
||||
return;
|
||||
}
|
||||
foreach (string domain in DomainsRenewable)
|
||||
{
|
||||
if (domain == null) break;
|
||||
AddBatch(domain, "RENEW");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user