Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #8 from zerocurrencycoin/v3.0.1
Browse files Browse the repository at this point in the history
V3.0.1
  • Loading branch information
CryptoForge authored Aug 15, 2019
2 parents a10b336 + 2c71d8a commit 34469b2
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 80 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ src/univalue/gen
*.pb.cc
*.pb.h
.vscode
.vs

*.log
*.trs
Expand Down Expand Up @@ -115,4 +116,4 @@ contrib/debian/files
contrib/debian/substvars
packages
SimpleWallet/bin
SimpleWallet/obj
SimpleWallet/obj
Binary file modified SimpleWallet.v12.suo
Binary file not shown.
41 changes: 41 additions & 0 deletions SimpleWallet/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Globalization;
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand All @@ -8,13 +10,52 @@ namespace SimpleWallet
{
static class Program
{
static void SetDefaultCulture(CultureInfo culture)
{
Type type = typeof(CultureInfo);

try
{
type.InvokeMember("s_userDefaultCulture",
BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Static,
null,
culture,
new object[] { culture });

type.InvokeMember("s_userDefaultUICulture",
BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Static,
null,
culture,
new object[] { culture });
}
catch { }

try
{
type.InvokeMember("m_userDefaultCulture",
BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Static,
null,
culture,
new object[] { culture });

type.InvokeMember("m_userDefaultUICulture",
BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Static,
null,
culture,
new object[] { culture });
}
catch { }
}


private const string AppMutexName = "37A1DGRT-G58J-6t45-915E-DB85D5929426-ZERO";
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
SetDefaultCulture( new CultureInfo("en-US"));
bool mutexCreated = false;
System.Threading.Mutex appMutex = new System.Threading.Mutex(false, AppMutexName, out mutexCreated);
//You could abort here if the mutex existed already, or you could abort
Expand Down
4 changes: 2 additions & 2 deletions SimpleWallet/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyVersion("2.0.1.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]
166 changes: 91 additions & 75 deletions SimpleWallet/api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -672,101 +672,117 @@ public void stopWallet()
List<Types.Transaction> transactions = new List<Types.Transaction>();

for (int i = 0; i < parse.Count; i++) {
try
{

Int64 sproutSpends = 0;
Int64 sproutSends = 0;
Int64 vpub_old = 0;
Int64 vpub_new = 0;
Int64 sends = 0;
String varianceType = "";

if (parse[i].spends.totalSpends != "0.00000000") {

for (int j = 0; j < parse[i].sends.transparentSends.Count; j++) {
transactions.Add(new Types.Transaction("send", parse[i].confirmations, parse[i].sends.transparentSends[j].amount, parse[i].time, parse[i].sends.transparentSends[j].address, parse[i].txid));
}
for (int j = 0; j < parse[i].sends.saplingSends.Count; j++) {
transactions.Add(new Types.Transaction("send", parse[i].confirmations, parse[i].sends.saplingSends[j].amount, parse[i].time, parse[i].sends.saplingSends[j].address, parse[i].txid));
}
Int64 sproutSpends = 0;
Int64 sproutSends = 0;
Int64 vpub_old = 0;
Int64 vpub_new = 0;
Int64 sends = 0;
String varianceType = "";

//Sprout
for (int j = 0; j < parse[i].sends.sproutSends.Count; j++)
{
vpub_old += Convert.ToInt64(Convert.ToDouble(parse[i].sends.sproutSends[j].vpub_old) * 10e8);
vpub_new += Convert.ToInt64(Convert.ToDouble(parse[i].sends.sproutSends[j].vpub_new) * 10e8);
}

if (parse[i].sends.sproutSends.Count != 0)
if (parse[i].spends.totalSpends != "0.00000000")
{
for (int j = 0; j < parse[i].spends.sproutSpends.Count; j++)

for (int j = 0; j < parse[i].sends.transparentSends.Count; j++)
{
sproutSpends = Convert.ToInt64(Convert.ToDouble(parse[i].spends.sproutSpends[j].amount) * 10e8);
transactions.Add(new Types.Transaction("send", parse[i].confirmations, parse[i].sends.transparentSends[j].amount, parse[i].time, parse[i].sends.transparentSends[j].address, parse[i].txid));
}
for (int j = 0; j < parse[i].sends.saplingSends.Count; j++)
{
transactions.Add(new Types.Transaction("send", parse[i].confirmations, parse[i].sends.saplingSends[j].amount, parse[i].time, parse[i].sends.saplingSends[j].address, parse[i].txid));
}
}

sproutSends = -(vpub_old - vpub_new) + sproutSpends;
if (sproutSends != 0)
{
transactions.Add(new Types.Transaction("send", parse[i].confirmations, Convert.ToString(Convert.ToDouble(sproutSends) / 10e8), parse[i].time, "Encypted Sprout Z Address", parse[i].txid));
}
// End Sprout
//Sprout
for (int j = 0; j < parse[i].sends.sproutSends.Count; j++)
{
vpub_old += Convert.ToInt64(Convert.ToDouble(parse[i].sends.sproutSends[j].vpub_old) * 10e8);
vpub_new += Convert.ToInt64(Convert.ToDouble(parse[i].sends.sproutSends[j].vpub_new) * 10e8);
}

sends = sproutSends + Convert.ToInt64(Convert.ToDouble(parse[i].sends.totalSends) * 10e8);
if (parse[i].sends.sproutSends.Count != 0)
{
for (int j = 0; j < parse[i].spends.sproutSpends.Count; j++)
{
sproutSpends = Convert.ToInt64(Convert.ToDouble(parse[i].spends.sproutSpends[j].amount) * 10e8);
}
}

Int64 sendVariance = Convert.ToInt64(Convert.ToDouble(parse[i].spends.totalSpends) * 10e8) - sends;
sproutSends = -(vpub_old - vpub_new) + sproutSpends;
if (sproutSends != 0)
{
transactions.Add(new Types.Transaction("send", parse[i].confirmations, Convert.ToString(Convert.ToDouble(sproutSends) / 10e8), parse[i].time, "Encypted Sprout Z Address", parse[i].txid));
}
// End Sprout

if (sendVariance != 0)
{
Boolean missingKey = Convert.ToBoolean(parse[i].spends.missingSpendingKeys);
Boolean missingOVK = Convert.ToBoolean(parse[i].sends.missingSaplingOVK);
sends = sproutSends + Convert.ToInt64(Convert.ToDouble(parse[i].sends.totalSends) * 10e8);

Int64 sendVariance = Convert.ToInt64(Convert.ToDouble(parse[i].spends.totalSpends) * 10e8) - sends;

if (sendVariance != 0)
{
Boolean missingKey = Convert.ToBoolean(parse[i].spends.missingSpendingKeys);
Boolean missingOVK = Convert.ToBoolean(parse[i].sends.missingSaplingOVK);
varianceType = "receive";

if (missingKey == false && missingOVK == false)
{
if (sendVariance < 0) { varianceType = "send"; }
transactions.Add(new Types.Transaction(varianceType, parse[i].confirmations, Convert.ToString(Convert.ToDouble(sendVariance) / 10e8), parse[i].time, "Transaction Fee", parse[i].txid));
sends += sendVariance;
}
else if (missingKey == true && missingOVK == false)
{
transactions.Add(new Types.Transaction(varianceType, parse[i].confirmations, Convert.ToString(Convert.ToDouble(sendVariance) / 10e8), parse[i].time, "Missing Spending Key Adj & Fee", parse[i].txid));
sends += sendVariance;
}
else if (missingKey == false && missingOVK == true)
{
transactions.Add(new Types.Transaction(varianceType, parse[i].confirmations, Convert.ToString(Convert.ToDouble(sendVariance) / 10e8), parse[i].time, "Encypted Sapling Z Address & Fee", parse[i].txid));
sends += sendVariance;
}

}

Int64 totalSpends = Convert.ToInt64(Convert.ToDouble(parse[i].spends.totalSpends) * 10e8);
varianceType = "receive";
if (totalSpends - sends < 0) { varianceType = "send"; }

if (missingKey == false && missingOVK == false)
if (sends != totalSpends)
{
if (sendVariance < 0) { varianceType = "send";}
transactions.Add(new Types.Transaction(varianceType, parse[i].confirmations, Convert.ToString(Convert.ToDouble(sendVariance) / 10e8), parse[i].time, "Transaction Fee", parse[i].txid));
sends += sendVariance;
transactions.Add(new Types.Transaction(varianceType, parse[i].confirmations, Convert.ToString(Convert.ToDouble(totalSpends - sends) / 10e8), parse[i].time, "Multiple Issue Adjustment & Fee", parse[i].txid));
}
else if (missingKey == true && missingOVK == false)
}
if (parse[i].received.totalReceived != "0.00000000")
{
String transType = "";
if (Convert.ToBoolean(parse[i].coinbase) == true)
{
transactions.Add(new Types.Transaction(varianceType, parse[i].confirmations, Convert.ToString(Convert.ToDouble(sendVariance) / 10e8), parse[i].time, "Missing Spending Key Adj & Fee", parse[i].txid));
sends += sendVariance;
transType = parse[i].category;
}
else if (missingKey == false && missingOVK == true)
else
{
transactions.Add(new Types.Transaction(varianceType, parse[i].confirmations, Convert.ToString(Convert.ToDouble(sendVariance) / 10e8), parse[i].time, "Encypted Sapling Z Address & Fee", parse[i].txid));
sends += sendVariance;
transType = "receive";
}
for (int j = 0; j < parse[i].received.transparentReceived.Count; j++)
{
transactions.Add(new Types.Transaction(transType, parse[i].confirmations, parse[i].received.transparentReceived[j].amount, parse[i].time, parse[i].received.transparentReceived[j].address, parse[i].txid));
}
for (int j = 0; j < parse[i].received.saplingReceived.Count; j++)
{
transactions.Add(new Types.Transaction(transType, parse[i].confirmations, parse[i].received.saplingReceived[j].amount, parse[i].time, parse[i].received.saplingReceived[j].address, parse[i].txid));
}
for (int j = 0; j < parse[i].received.sproutReceived.Count; j++)
{
transactions.Add(new Types.Transaction(transType, parse[i].confirmations, parse[i].received.sproutReceived[j].amount, parse[i].time, parse[i].received.sproutReceived[j].address, parse[i].txid));
}

}

Int64 totalSpends = Convert.ToInt64(Convert.ToDouble(parse[i].spends.totalSpends) * 10e8);
varianceType = "receive";
if (totalSpends - sends < 0) { varianceType = "send"; }

if (sends != totalSpends)
{
transactions.Add(new Types.Transaction(varianceType, parse[i].confirmations, Convert.ToString(Convert.ToDouble(totalSpends - sends) / 10e8), parse[i].time, "Multiple Issue Adjustment & Fee", parse[i].txid));
}
}
if (parse[i].received.totalReceived != "0.00000000") {
String transType = "";
if (Convert.ToBoolean(parse[i].coinbase) == true) {
transType = parse[i].category;
} else {
transType = "receive";
}
for (int j = 0; j < parse[i].received.transparentReceived.Count; j++) {
transactions.Add(new Types.Transaction(transType, parse[i].confirmations, parse[i].received.transparentReceived[j].amount, parse[i].time, parse[i].received.transparentReceived[j].address, parse[i].txid));
}
for (int j = 0; j < parse[i].received.saplingReceived.Count; j++) {
transactions.Add(new Types.Transaction(transType, parse[i].confirmations, parse[i].received.saplingReceived[j].amount, parse[i].time, parse[i].received.saplingReceived[j].address, parse[i].txid));
}
for (int j = 0; j < parse[i].received.sproutReceived.Count; j++) {
transactions.Add(new Types.Transaction(transType, parse[i].confirmations, parse[i].received.sproutReceived[j].amount, parse[i].time, parse[i].received.sproutReceived[j].address, parse[i].txid));
}
catch
{

}

}

return transactions;
Expand Down
2 changes: 1 addition & 1 deletion SimpleWallet/executor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public String executeMasternode(List<String> command, String dataToGet)
public bool checkParamsFile(String file1, String file2, String file3, String file4, String file5)
{
bool ret = false;
String webLink = "https://z.cash/downloads/";
String webLink = "https://download.z.cash/downloads/";
String file1Link = webLink + file1;
String file2Link = webLink + file2;
String file3Link = webLink + file3;
Expand Down
2 changes: 1 addition & 1 deletion SimpleWallet/types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public delegate void DaemonEventHandler(object sender,
DaemonEventArgs e);
public class Types
{
public static String version = "Zero Simple Wallet - Version 2.0.0";
public static String version = "Zero Simple Wallet - Version 2.0.1";

public static String startCommandsFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
"\\zero\\simplewallet\\commands.dat";
Expand Down

0 comments on commit 34469b2

Please sign in to comment.