|
@@ -1,55 +1,66 @@
|
|
-using System;
|
|
|
|
-using System.Threading.Tasks;
|
|
|
|
-using System.Collections.Generic;
|
|
|
|
-
|
|
|
|
-namespace HyperCube.Models
|
|
|
|
-{
|
|
|
|
- public enum Role { Admin = 0, Verifier, User }
|
|
|
|
-
|
|
|
|
- public class Account
|
|
|
|
- {
|
|
|
|
- public static Dictionary<string, Account> loaded = new();
|
|
|
|
- public static Account current;
|
|
|
|
- public string eth_address { get; set; }
|
|
|
|
-
|
|
|
|
- /// <summary>
|
|
|
|
- /// Internal ID
|
|
|
|
- /// </summary>
|
|
|
|
- public uint ID { get; set; }
|
|
|
|
- /// <summary>
|
|
|
|
- /// ASP Identity ID
|
|
|
|
- /// </summary>
|
|
|
|
- public string UUID { get; set; }
|
|
|
|
- public string Name { get; set; }
|
|
|
|
- public string Email { get; set; }
|
|
|
|
- public Role AccRole { get; set; }
|
|
|
|
-
|
|
|
|
- public Account()
|
|
|
|
- {
|
|
|
|
|
|
+using System;
|
|
|
|
+using System.Numerics;
|
|
|
|
+using System.Threading.Tasks;
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
+
|
|
|
|
+namespace HyperCube.Models
|
|
|
|
+{
|
|
|
|
+ public enum Role { Admin = 0, Verifier, User }
|
|
|
|
+
|
|
|
|
+ public class Account
|
|
|
|
+ {
|
|
|
|
+ public static Dictionary<string, Account> loaded = new();
|
|
|
|
+ public static Account current;
|
|
|
|
+ public string eth_address { get; set; }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Internal ID
|
|
|
|
+ /// </summary>
|
|
|
|
+ public uint ID { get; set; }
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// ASP Identity ID
|
|
|
|
+ /// </summary>
|
|
|
|
+ public string UUID { get; set; }
|
|
|
|
+ public string Name { get; set; }
|
|
|
|
+ public string Email { get; set; }
|
|
|
|
+ public Role AccRole { get; set; }
|
|
|
|
+
|
|
|
|
+ public Account()
|
|
|
|
+ {
|
|
}
|
|
}
|
|
|
|
|
|
public static Account GetCurrent()
|
|
public static Account GetCurrent()
|
|
{
|
|
{
|
|
return current;
|
|
return current;
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
public static Account Find(string email)
|
|
public static Account Find(string email)
|
|
{
|
|
{
|
|
|
|
+ if (email == null)
|
|
|
|
+ return null;
|
|
if (loaded.ContainsKey(email))
|
|
if (loaded.ContainsKey(email))
|
|
return loaded[email];
|
|
return loaded[email];
|
|
else
|
|
else
|
|
return null;
|
|
return null;
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static BigInteger ConvertBalance(string hex)
|
|
|
|
+ {
|
|
|
|
+ string newHex = hex.Remove(0, 2);
|
|
|
|
+ var balance = System.Numerics.BigInteger.Parse("0"+ newHex, System.Globalization.NumberStyles.HexNumber );
|
|
|
|
+ Console.WriteLine($"ConvertBalance {hex} {balance}");
|
|
|
|
+ return balance;
|
|
|
|
+ }
|
|
|
|
+
|
|
public static async void InitializeAccounts()
|
|
public static async void InitializeAccounts()
|
|
{
|
|
{
|
|
loaded = await MySQLConnector.Instance().SQLSelectASPUsers();
|
|
loaded = await MySQLConnector.Instance().SQLSelectASPUsers();
|
|
Console.WriteLine("InitializeAccounts");
|
|
Console.WriteLine("InitializeAccounts");
|
|
}
|
|
}
|
|
|
|
|
|
- public async static Task GetEthAddress()
|
|
|
|
|
|
+ public async Task GetEthAddress()
|
|
{
|
|
{
|
|
- var addr = await Blockchain.GetMain().CreateBlockchainAccount();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+ var addr = await Blockchain.GetMain().CreateBlockchainAccount(this);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|