|
@@ -10,7 +10,7 @@ namespace HyperCube.Models
|
|
public class Blockchain
|
|
public class Blockchain
|
|
{
|
|
{
|
|
public static bool newData = false;
|
|
public static bool newData = false;
|
|
- public static List<Blockchain> loaded = new();
|
|
|
|
|
|
+ public static Dictionary<string, Blockchain> loaded = new();
|
|
public Dictionary<int, SmartContract> contracts = new();
|
|
public Dictionary<int, SmartContract> contracts = new();
|
|
public int port;
|
|
public int port;
|
|
public string url;
|
|
public string url;
|
|
@@ -38,9 +38,9 @@ namespace HyperCube.Models
|
|
|
|
|
|
public async Task<string> Initialize()
|
|
public async Task<string> Initialize()
|
|
{
|
|
{
|
|
- await ListAccounts();
|
|
|
|
- if (!loaded.Contains(this))
|
|
|
|
- loaded.Add(this);
|
|
|
|
|
|
+ string addr = await ListAccounts();
|
|
|
|
+ if (!loaded.ContainsKey(addr))
|
|
|
|
+ loaded.Add(addr, this);
|
|
Console.WriteLine("loaded blockchains " + loaded.Count);
|
|
Console.WriteLine("loaded blockchains " + loaded.Count);
|
|
|
|
|
|
LoadContracts();
|
|
LoadContracts();
|
|
@@ -124,7 +124,7 @@ namespace HyperCube.Models
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|
|
|
|
|
|
- public async Task ListAccounts()
|
|
|
|
|
|
+ public async Task<string> ListAccounts()
|
|
{
|
|
{
|
|
string answer = "no";
|
|
string answer = "no";
|
|
//{ "jsonrpc":"2.0","method":"eth_getCode","params":["0x938cae6f6c21ed9d55196e96ef880f562e530553", "latest" ],"id":1}
|
|
//{ "jsonrpc":"2.0","method":"eth_getCode","params":["0x938cae6f6c21ed9d55196e96ef880f562e530553", "latest" ],"id":1}
|
|
@@ -142,6 +142,7 @@ namespace HyperCube.Models
|
|
Console.WriteLine("Json addr " + jsonDe.result[0]);
|
|
Console.WriteLine("Json addr " + jsonDe.result[0]);
|
|
var methodName = (string)jsonDe.name;
|
|
var methodName = (string)jsonDe.name;
|
|
newData = true;
|
|
newData = true;
|
|
|
|
+ return address;
|
|
}
|
|
}
|
|
|
|
|
|
public string GetAddress()
|
|
public string GetAddress()
|