|
@@ -1,61 +1,62 @@
|
|
|
-using System;
|
|
|
-using System.Numerics;
|
|
|
-using System.Threading.Tasks;
|
|
|
-using System.Collections.Generic;
|
|
|
-
|
|
|
-namespace HyperCube.Models
|
|
|
-{
|
|
|
- public enum Role { Admin = 1, Verifier, User }
|
|
|
-
|
|
|
- public class AccountModel
|
|
|
- {
|
|
|
- public static Dictionary<string, AccountModel> Loaded = new();
|
|
|
- public static AccountModel Current;
|
|
|
- public string eth_address { 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 AccountModel()
|
|
|
- {
|
|
|
- }
|
|
|
-
|
|
|
- public static AccountModel GetCurrent()
|
|
|
- {
|
|
|
- return Current;
|
|
|
- }
|
|
|
-
|
|
|
- public static AccountModel Find(string uuid)
|
|
|
- {
|
|
|
- if (uuid == null)
|
|
|
- return null;
|
|
|
- if (Loaded.ContainsKey(uuid))
|
|
|
- return Loaded[uuid];
|
|
|
- else
|
|
|
- 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()
|
|
|
- {
|
|
|
- Loaded = await MySQLConnector.Instance().SQLSelectASPUsers();
|
|
|
- Console.WriteLine("InitializeAccounts");
|
|
|
- }
|
|
|
-
|
|
|
- public async Task GetEthAddress()
|
|
|
- {
|
|
|
- var addr = await Blockchain.GetMain().CreateBlockchainAccount(this);
|
|
|
+using System;
|
|
|
+using System.Numerics;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using System.Collections.Generic;
|
|
|
+using Console = HyperCube.Utils.AdvConsole;
|
|
|
+
|
|
|
+namespace HyperCube.Models
|
|
|
+{
|
|
|
+ public enum Role { Admin = 1, Verifier, User }
|
|
|
+
|
|
|
+ public class AccountModel
|
|
|
+ {
|
|
|
+ public static Dictionary<string, AccountModel> Loaded = new();
|
|
|
+ public static AccountModel Current;
|
|
|
+ public string eth_address { 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 AccountModel()
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ public static AccountModel GetCurrent()
|
|
|
+ {
|
|
|
+ return Current;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static AccountModel Find(string uuid)
|
|
|
+ {
|
|
|
+ if (uuid == null)
|
|
|
+ return null;
|
|
|
+ if (Loaded.ContainsKey(uuid))
|
|
|
+ return Loaded[uuid];
|
|
|
+ else
|
|
|
+ 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()
|
|
|
+ {
|
|
|
+ Loaded = await MySQLConnector.Instance().SQLSelectASPUsers();
|
|
|
+ Console.WriteLine("InitializeAccounts");
|
|
|
+ }
|
|
|
+
|
|
|
+ public async Task GetEthAddress()
|
|
|
+ {
|
|
|
+ var addr = await Blockchain.GetMain().CreateBlockchainAccount(this);
|
|
|
}
|
|
|
|
|
|
public async Task<string> GetBalance()
|
|
@@ -65,6 +66,6 @@ namespace HyperCube.Models
|
|
|
string balance = balanceInt.ToString();
|
|
|
//Console.WriteLine($"GetBalance {balance}");
|
|
|
return balance;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|