mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-12-25 23:38:15 +11:00
main: Import wallets and rescan
This commit is contained in:
parent
4a4527657c
commit
0f84462a03
36
FireWallet/MainForm.Designer.cs
generated
36
FireWallet/MainForm.Designer.cs
generated
@ -90,6 +90,8 @@ namespace FireWallet
|
||||
labelDomainSearch = new Label();
|
||||
textBoxDomainSearch = new TextBox();
|
||||
panelSettings = new Panel();
|
||||
groupBoxSettingsWallet = new GroupBox();
|
||||
buttonSettingsRescan = new Button();
|
||||
buttonSeed = new Button();
|
||||
groupBoxSettingsMisc = new GroupBox();
|
||||
labelSettings8 = new Label();
|
||||
@ -122,6 +124,7 @@ namespace FireWallet
|
||||
panelDomains.SuspendLayout();
|
||||
groupBoxDomains.SuspendLayout();
|
||||
panelSettings.SuspendLayout();
|
||||
groupBoxSettingsWallet.SuspendLayout();
|
||||
groupBoxSettingsMisc.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownTXCount).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownConfirmations).BeginInit();
|
||||
@ -400,7 +403,7 @@ namespace FireWallet
|
||||
groupBoxinfo.Controls.Add(labelHeight);
|
||||
groupBoxinfo.Location = new Point(281, 3);
|
||||
groupBoxinfo.Name = "groupBoxinfo";
|
||||
groupBoxinfo.Size = new Size(232, 104);
|
||||
groupBoxinfo.Size = new Size(250, 104);
|
||||
groupBoxinfo.TabIndex = 8;
|
||||
groupBoxinfo.TabStop = false;
|
||||
groupBoxinfo.Text = "Info";
|
||||
@ -717,7 +720,7 @@ namespace FireWallet
|
||||
//
|
||||
// panelSettings
|
||||
//
|
||||
panelSettings.Controls.Add(buttonSeed);
|
||||
panelSettings.Controls.Add(groupBoxSettingsWallet);
|
||||
panelSettings.Controls.Add(groupBoxSettingsMisc);
|
||||
panelSettings.Controls.Add(labelSettingsSaved);
|
||||
panelSettings.Controls.Add(buttonSettingsSave);
|
||||
@ -729,12 +732,34 @@ namespace FireWallet
|
||||
panelSettings.TabIndex = 19;
|
||||
panelSettings.Visible = false;
|
||||
//
|
||||
// groupBoxSettingsWallet
|
||||
//
|
||||
groupBoxSettingsWallet.Controls.Add(buttonSettingsRescan);
|
||||
groupBoxSettingsWallet.Controls.Add(buttonSeed);
|
||||
groupBoxSettingsWallet.Location = new Point(507, 16);
|
||||
groupBoxSettingsWallet.Name = "groupBoxSettingsWallet";
|
||||
groupBoxSettingsWallet.Size = new Size(420, 194);
|
||||
groupBoxSettingsWallet.TabIndex = 9;
|
||||
groupBoxSettingsWallet.TabStop = false;
|
||||
groupBoxSettingsWallet.Text = "Wallet Controls";
|
||||
//
|
||||
// buttonSettingsRescan
|
||||
//
|
||||
buttonSettingsRescan.FlatStyle = FlatStyle.Flat;
|
||||
buttonSettingsRescan.Location = new Point(6, 20);
|
||||
buttonSettingsRescan.Name = "buttonSettingsRescan";
|
||||
buttonSettingsRescan.Size = new Size(98, 53);
|
||||
buttonSettingsRescan.TabIndex = 8;
|
||||
buttonSettingsRescan.Text = "Rescan";
|
||||
buttonSettingsRescan.UseVisualStyleBackColor = true;
|
||||
buttonSettingsRescan.Click += Rescan_Click;
|
||||
//
|
||||
// buttonSeed
|
||||
//
|
||||
buttonSeed.FlatStyle = FlatStyle.Flat;
|
||||
buttonSeed.Location = new Point(507, 7);
|
||||
buttonSeed.Location = new Point(297, 15);
|
||||
buttonSeed.Name = "buttonSeed";
|
||||
buttonSeed.Size = new Size(157, 68);
|
||||
buttonSeed.Size = new Size(117, 53);
|
||||
buttonSeed.TabIndex = 8;
|
||||
buttonSeed.Text = "Seed Phrase";
|
||||
buttonSeed.UseVisualStyleBackColor = true;
|
||||
@ -951,6 +976,7 @@ namespace FireWallet
|
||||
groupBoxDomains.ResumeLayout(false);
|
||||
panelSettings.ResumeLayout(false);
|
||||
panelSettings.PerformLayout();
|
||||
groupBoxSettingsWallet.ResumeLayout(false);
|
||||
groupBoxSettingsMisc.ResumeLayout(false);
|
||||
groupBoxSettingsMisc.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownTXCount).EndInit();
|
||||
@ -1037,5 +1063,7 @@ namespace FireWallet
|
||||
private NumericUpDown numericUpDownTXCount;
|
||||
private Label labelSettings7;
|
||||
private Button buttonSeed;
|
||||
private GroupBox groupBoxSettingsWallet;
|
||||
private Button buttonSettingsRescan;
|
||||
}
|
||||
}
|
@ -415,11 +415,11 @@ namespace FireWallet
|
||||
private async Task<bool> Login()
|
||||
{
|
||||
string path = "wallet/" + account + "/unlock";
|
||||
|
||||
|
||||
string content = "{\"passphrase\": \"" + password + "\",\"timeout\": 60}";
|
||||
if (password == "")
|
||||
{
|
||||
AddLog("No password entered");
|
||||
// For some reason, the API doesn't like an empty password, so we'll just use a default one
|
||||
content = "{\"passphrase\": \"password\" ,\"timeout\": 60}";
|
||||
}
|
||||
|
||||
@ -1200,6 +1200,8 @@ namespace FireWallet
|
||||
textBoxDomainSearch.Text = domainSearch;
|
||||
}
|
||||
|
||||
|
||||
#region Settings
|
||||
private void buttonSettingsSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
StreamWriter sw = new StreamWriter(dir + "settings.txt");
|
||||
@ -1214,14 +1216,10 @@ namespace FireWallet
|
||||
LoadSettings();
|
||||
labelSettingsSaved.Show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async void buttonSeed_Click(object sender, EventArgs e)
|
||||
{
|
||||
string path = "wallet/" + account + "/master";
|
||||
string response = await APIGet(path, true);
|
||||
AddLog(response);
|
||||
JObject resp = JObject.Parse(response);
|
||||
if (resp["encrypted"].ToString() == "False")
|
||||
{
|
||||
@ -1271,5 +1269,21 @@ namespace FireWallet
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private async void Rescan_Click(object sender, EventArgs e)
|
||||
{
|
||||
string content = "{\"height\": 0}";
|
||||
string response = await APIPost("rescan", true, content);
|
||||
if (!response.Contains("true"))
|
||||
{
|
||||
AddLog("Error starting rescan");
|
||||
AddLog(response);
|
||||
return;
|
||||
}
|
||||
AddLog("Starting rescan");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
77
FireWallet/NewAccountForm.Designer.cs
generated
77
FireWallet/NewAccountForm.Designer.cs
generated
@ -37,15 +37,18 @@
|
||||
buttonImport = new Button();
|
||||
buttonNew = new Button();
|
||||
groupBoxNew = new GroupBox();
|
||||
textBoxNewPass2 = new TextBox();
|
||||
textBoxNewPass1 = new TextBox();
|
||||
label4 = new Label();
|
||||
textBoxNewName = new TextBox();
|
||||
label5 = new Label();
|
||||
label3 = new Label();
|
||||
label2 = new Label();
|
||||
textBoxNewPass1 = new TextBox();
|
||||
textBoxNewPass2 = new TextBox();
|
||||
label5 = new Label();
|
||||
groupBoxSeed = new GroupBox();
|
||||
textBoxSeedPhrase = new TextBox();
|
||||
groupBoxMode.SuspendLayout();
|
||||
groupBoxNew.SuspendLayout();
|
||||
groupBoxSeed.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonNext
|
||||
@ -157,6 +160,22 @@
|
||||
groupBoxNew.Text = "New Wallet";
|
||||
groupBoxNew.Visible = false;
|
||||
//
|
||||
// textBoxNewPass2
|
||||
//
|
||||
textBoxNewPass2.Location = new Point(128, 136);
|
||||
textBoxNewPass2.Name = "textBoxNewPass2";
|
||||
textBoxNewPass2.Size = new Size(316, 29);
|
||||
textBoxNewPass2.TabIndex = 8;
|
||||
textBoxNewPass2.UseSystemPasswordChar = true;
|
||||
//
|
||||
// textBoxNewPass1
|
||||
//
|
||||
textBoxNewPass1.Location = new Point(128, 90);
|
||||
textBoxNewPass1.Name = "textBoxNewPass1";
|
||||
textBoxNewPass1.Size = new Size(316, 29);
|
||||
textBoxNewPass1.TabIndex = 7;
|
||||
textBoxNewPass1.UseSystemPasswordChar = true;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
@ -175,6 +194,15 @@
|
||||
textBoxNewName.TabIndex = 5;
|
||||
textBoxNewName.TextChanged += textBoxNewName_TextChanged;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(38, 139);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(70, 21);
|
||||
label5.TabIndex = 1;
|
||||
label5.Text = "Confirm:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
@ -193,36 +221,33 @@
|
||||
label2.TabIndex = 0;
|
||||
label2.Text = "Name:";
|
||||
//
|
||||
// textBoxNewPass1
|
||||
// groupBoxSeed
|
||||
//
|
||||
textBoxNewPass1.Location = new Point(128, 90);
|
||||
textBoxNewPass1.Name = "textBoxNewPass1";
|
||||
textBoxNewPass1.Size = new Size(316, 29);
|
||||
textBoxNewPass1.TabIndex = 7;
|
||||
textBoxNewPass1.UseSystemPasswordChar = true;
|
||||
groupBoxSeed.Controls.Add(textBoxSeedPhrase);
|
||||
groupBoxSeed.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point);
|
||||
groupBoxSeed.Location = new Point(125, 22);
|
||||
groupBoxSeed.Name = "groupBoxSeed";
|
||||
groupBoxSeed.Size = new Size(450, 319);
|
||||
groupBoxSeed.TabIndex = 5;
|
||||
groupBoxSeed.TabStop = false;
|
||||
groupBoxSeed.Text = "Seed Phrase";
|
||||
groupBoxSeed.Visible = false;
|
||||
//
|
||||
// textBoxNewPass2
|
||||
// textBoxSeedPhrase
|
||||
//
|
||||
textBoxNewPass2.Location = new Point(128, 136);
|
||||
textBoxNewPass2.Name = "textBoxNewPass2";
|
||||
textBoxNewPass2.Size = new Size(316, 29);
|
||||
textBoxNewPass2.TabIndex = 8;
|
||||
textBoxNewPass2.UseSystemPasswordChar = true;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(38, 139);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(70, 21);
|
||||
label5.TabIndex = 1;
|
||||
label5.Text = "Confirm:";
|
||||
textBoxSeedPhrase.Location = new Point(6, 25);
|
||||
textBoxSeedPhrase.Multiline = true;
|
||||
textBoxSeedPhrase.Name = "textBoxSeedPhrase";
|
||||
textBoxSeedPhrase.PlaceholderText = "pistol air cabbage high conduct party powder inject jungle knee spell derive";
|
||||
textBoxSeedPhrase.Size = new Size(438, 288);
|
||||
textBoxSeedPhrase.TabIndex = 0;
|
||||
//
|
||||
// NewAccountForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(680, 430);
|
||||
Controls.Add(groupBoxSeed);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonNext);
|
||||
Controls.Add(groupBoxNew);
|
||||
@ -237,6 +262,8 @@
|
||||
groupBoxMode.PerformLayout();
|
||||
groupBoxNew.ResumeLayout(false);
|
||||
groupBoxNew.PerformLayout();
|
||||
groupBoxSeed.ResumeLayout(false);
|
||||
groupBoxSeed.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -257,5 +284,7 @@
|
||||
private TextBox textBoxNewPass2;
|
||||
private TextBox textBoxNewPass1;
|
||||
private Label label5;
|
||||
private GroupBox groupBoxSeed;
|
||||
private TextBox textBoxSeedPhrase;
|
||||
}
|
||||
}
|
@ -52,7 +52,11 @@ namespace FireWallet
|
||||
|
||||
private void buttonImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
// TODO - Import wallet
|
||||
page = 2;
|
||||
groupBoxNew.Show();
|
||||
buttonNext.Show();
|
||||
buttonNext.Enabled = false;
|
||||
groupBoxNew.Text = "Import Wallet";
|
||||
}
|
||||
|
||||
private void buttonCold_Click(object sender, EventArgs e)
|
||||
@ -76,23 +80,31 @@ namespace FireWallet
|
||||
|
||||
private async void buttonNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (textBoxNewPass1 == null)
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Please enter a password");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
return;
|
||||
}
|
||||
if (textBoxNewPass1.Text.Length < 8)
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Password must be at least 8 characters");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
return;
|
||||
}
|
||||
if (textBoxNewPass1.Text != textBoxNewPass2.Text)
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Passwords do not match");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
if (page == 1)
|
||||
{
|
||||
if (textBoxNewPass1 == null)
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Please enter a password");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
return;
|
||||
}
|
||||
if (textBoxNewPass1.Text != textBoxNewPass2.Text)
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Passwords do not match");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create new wallet
|
||||
buttonNext.Enabled = false;
|
||||
string path = "wallet/" + textBoxNewName.Text;
|
||||
@ -107,8 +119,38 @@ namespace FireWallet
|
||||
return;
|
||||
}
|
||||
mainForm.AddLog("Created wallet: " + textBoxNewName.Text);
|
||||
NotifyForm notify2 = new NotifyForm("Created wallet: " + textBoxNewName.Text);
|
||||
notify2.ShowDialog();
|
||||
notify2.Dispose();
|
||||
this.Close();
|
||||
}
|
||||
else if (page == 2)
|
||||
{
|
||||
groupBoxSeed.Show();
|
||||
buttonNext.Text = "Import";
|
||||
page = 3;
|
||||
|
||||
|
||||
}
|
||||
else if (page == 3)
|
||||
{
|
||||
// Create new wallet
|
||||
buttonNext.Enabled = false;
|
||||
string path = "wallet/" + textBoxNewName.Text;
|
||||
string content = "{\"passphrase\":\"" + textBoxNewPass1.Text + "\",\"mnemonic\":\"" + textBoxSeedPhrase.Text +"\"}";
|
||||
string response = await APIPut(path, true, content);
|
||||
if (response == "Error")
|
||||
{
|
||||
NotifyForm notify = new NotifyForm("Error creating wallet");
|
||||
notify.ShowDialog();
|
||||
notify.Dispose();
|
||||
buttonNext.Enabled = true;
|
||||
return;
|
||||
}
|
||||
mainForm.AddLog("Created wallet: " + textBoxNewName.Text);
|
||||
NotifyForm notify2 = new NotifyForm("Imported wallet: " + textBoxNewName.Text);
|
||||
notify2.ShowDialog();
|
||||
notify2.Dispose();
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user