diff --git a/NodeView/Components/Config/Validator.razor b/NodeView/Components/Config/Validator.razor index f252dd1..32d572d 100644 --- a/NodeView/Components/Config/Validator.razor +++ b/NodeView/Components/Config/Validator.razor @@ -30,12 +30,12 @@ @@ -71,6 +71,12 @@ public string? name { get; set;} [Parameter] public List? validators { get; set; } + private string explorerUrl = ""; + + protected override async Task OnInitializedAsync() + { + explorerUrl = await localStorage.GetItemAsync("explorerUrl"); + } public async Task OpenOrder(string StakerAddress) { diff --git a/NodeView/Pages/Config/Contracts.razor b/NodeView/Pages/Config/Contracts.razor index 89708f1..6255c76 100644 --- a/NodeView/Pages/Config/Contracts.razor +++ b/NodeView/Pages/Config/Contracts.razor @@ -20,13 +20,13 @@
- @@ -39,6 +39,7 @@ @code { private List? contractAddresses = null; + private string explorerUrl = ""; protected override async Task OnInitializedAsync() { var resolver = new Resolver(localStorage); @@ -49,6 +50,8 @@ catch (Exception ex) { Console.WriteLine(ex.Message); } + + explorerUrl = await localStorage.GetItemAsync("explorerUrl"); } } \ No newline at end of file diff --git a/NodeView/Pages/Explorer/StakingHistory.razor b/NodeView/Pages/Explorer/StakingHistory.razor index 9169829..2ee0abc 100644 --- a/NodeView/Pages/Explorer/StakingHistory.razor +++ b/NodeView/Pages/Explorer/StakingHistory.razor @@ -147,7 +147,7 @@ }
- @data.StakerAddress + @data.StakerAddress
@@ -162,7 +162,7 @@ @@ -196,6 +196,7 @@ @code { + private string explorerUrl = ""; private string fromBlock { get; set; } = "0"; private string toBlock { get; set; } = "9999999"; private string network_state { get; set; } = ""; @@ -248,6 +249,7 @@ var resolver = new Resolver(localStorage); stakingService = await resolver.GetStakingService(); contractBuilder = LitContracts.RawABI.get_staking_contract_abi(stakingService.ContractHandler.ContractAddress); + explorerUrl = await localStorage.GetItemAsync("explorerUrl"); await LoadHistory(); } diff --git a/NodeView/Pages/Index.razor b/NodeView/Pages/Index.razor index 49748e8..5d6ab10 100644 --- a/NodeView/Pages/Index.razor +++ b/NodeView/Pages/Index.razor @@ -26,7 +26,7 @@ + rpc_api_type = networks[copy].rpc_api_type; explorerUrl = networks[copy].explorerUrl; SetAllValues(copy); }"> } @@ -65,11 +65,15 @@
RPC API Type (1 = BlockScout, 2 = OtterScan) - +
RPC API Url - + +
+
+ Explorer Url +
@@ -159,6 +163,7 @@ public string rpc_api_url; public int rpc_api_type; + public string? explorerUrl; } string? networkName; string? chainUrl; @@ -167,13 +172,15 @@ byte env = 0; string? rpc_api_url; int rpc_api_type = 1; + string? explorerUrl; LitNetwork[] networks = new LitNetwork[] { new LitNetwork() { name = "Localhost", env=0, url = "http://127.0.0.1:8545", chainId=0 , resolverAddress = "0x5FbDB2315678afecb367f032d93F642f64180aa3" , selected=false , rpc_api_url ="http://127.0.0.1:8545", rpc_api_type = 2 }, - new LitNetwork() { name = "DevInternal", env=0, url = "https://lit-protocol.calderachain.xyz/http", chainId=175177, resolverAddress = "0xFFb9afC9e8B731CB5d4194ec728657875510a8C8", selected=false, rpc_api_url = "https://lit-protocol.calderaexplorer.xyz/api", rpc_api_type = 1 }, - new LitNetwork() { name = "Cayenne", env=0, url = "https://lit-protocol.calderachain.xyz/http", chainId=175177 , resolverAddress = "0xb82f2dB0B486F1ef698CC88F0d521D873eb04d03" , selected=false, rpc_api_url = "https://lit-protocol.calderaexplorer.xyz/api", rpc_api_type = 1 }, - new LitNetwork() { name = "Manzano", env=0, url = "https://lit-protocol.calderachain.xyz/http", chainId=175177 , resolverAddress = "0x9F0Ede26261451C5E784DC799D71ECf766EB7562" , selected=false, rpc_api_url = "https://lit-protocol.calderaexplorer.xyz/api", rpc_api_type = 1 }, - new LitNetwork() { name = "Habanero", env=2, url ="https://lit-protocol.calderachain.xyz/http", chainId=175177 , resolverAddress = "0xe5a7C5d908EE8996332F488cE5f636d4EBff8522" , selected=false, rpc_api_url = "https://lit-protocol.calderaexplorer.xyz/api", rpc_api_type = 1 }, + new LitNetwork() { name = "DevInternal", env=0, url = "https://lit-protocol.calderachain.xyz/http", chainId=175177, resolverAddress = "0xFFb9afC9e8B731CB5d4194ec728657875510a8C8", selected=false, rpc_api_url = "https://lit-protocol.calderaexplorer.xyz/api", rpc_api_type = 1, explorerUrl = "https://lit-protocol.calderaexplorer.xyz/address/" }, + new LitNetwork() { name = "Cayenne", env=0, url = "https://lit-protocol.calderachain.xyz/http", chainId=175177 , resolverAddress = "0xb82f2dB0B486F1ef698CC88F0d521D873eb04d03" , selected=false, rpc_api_url = "https://lit-protocol.calderaexplorer.xyz/api", rpc_api_type = 1, explorerUrl = "https://lit-protocol.calderaexplorer.xyz/address/" }, + new LitNetwork() { name = "Manzano", env=0, url = "https://lit-protocol.calderachain.xyz/http", chainId=175177 , resolverAddress = "0x9F0Ede26261451C5E784DC799D71ECf766EB7562" , selected=false, rpc_api_url = "https://lit-protocol.calderaexplorer.xyz/api", rpc_api_type = 1, explorerUrl = "https://lit-protocol.calderaexplorer.xyz/address/" }, + new LitNetwork() { name = "Habanero", env=2, url ="https://lit-protocol.calderachain.xyz/http", chainId=175177 , resolverAddress = "0xe5a7C5d908EE8996332F488cE5f636d4EBff8522" , selected=false, rpc_api_url = "https://lit-protocol.calderaexplorer.xyz/api", rpc_api_type = 1, explorerUrl = "https://lit-protocol.calderaexplorer.xyz/address/" }, + new LitNetwork() { name = "DatilDev", env=0, url = "https://vesuvius-rpc.litprotocol.com/", chainId=2311, resolverAddress = "0xD19B7A9D4c6B9612742B16a795C46B649E62ba54", selected=false, rpc_api_url = "https://vesuvius-explorer.litprotocol.com/api", rpc_api_type = 1, explorerUrl = "https://vesuvius-explorer.litprotocol.com/address/" }, }; protected override async Task OnInitializedAsync() { @@ -195,6 +202,8 @@ if ( await localStorage.ContainKeyAsync("rpc_api_type") ) rpc_api_type = await localStorage.GetItemAsync("rpc_api_type"); + explorerUrl = await localStorage.GetItemAsync("explorerUrl"); + if ( string.IsNullOrEmpty( explorerUrl ) ) explorerUrl = "https://lit-protocol.calderaexplorer.xyz/address/"; for (int i =0 ;i < networks.Length; i++) { @@ -213,6 +222,7 @@ await localStorage.SetItemAsync("privateKey", defaultPrivateKey); await localStorage.SetItemAsync("rpc_api_type", rpc_api_type); await localStorage.SetItemAsync("rpc_api_url", rpc_api_url); + await localStorage.SetItemAsync("explorerUrl", explorerUrl); } async void ResolverAddressChanged(ChangeEventArgs e) { @@ -285,4 +295,18 @@ } } + async void ExplorerUrlChanged(ChangeEventArgs e) + { + + if ( e.Value == null ) return; + if ( string.IsNullOrEmpty( e.Value.ToString() ) ) return; + + try { + explorerUrl = e.Value.ToString(); + await localStorage.SetItemAsync("explorerUrl", explorerUrl); + } catch (Exception ex) { + Console.WriteLine(ex.Message); + } + } + } \ No newline at end of file diff --git a/SharedService/Resolver.cs b/SharedService/Resolver.cs index df6a81a..4a6a5db 100644 --- a/SharedService/Resolver.cs +++ b/SharedService/Resolver.cs @@ -46,7 +46,9 @@ public enum ContractType ReleaseRegister, Staking, StakingBalances, - WLIT + WLIT, + StylusContractP256, + StylusContractK256 } public class Resolver{ @@ -114,6 +116,8 @@ public static byte[] keccak256(string tx_bytes) { ContractType.Staking => keccak256("STAKING"), ContractType.StakingBalances => keccak256("STAKING_BALANCES"), ContractType.WLIT => keccak256("WLIT"), + ContractType.StylusContractP256 => keccak256("HD_KEY_DERIVER_CONTRACT_P256"), + ContractType.StylusContractK256 => keccak256("HD_KEY_DERIVER_CONTRACT_K256"), _ => null, }; if (typ == null) diff --git a/SimpleNodeOps/Components/Config/Validator.razor b/SimpleNodeOps/Components/Config/Validator.razor index 871cde3..d6541d3 100644 --- a/SimpleNodeOps/Components/Config/Validator.razor +++ b/SimpleNodeOps/Components/Config/Validator.razor @@ -29,12 +29,12 @@ @@ -69,6 +69,12 @@ public string? name { get; set;} [Parameter] public List? validators { get; set; } + private string explorerUrl = ""; + + protected override async Task OnInitializedAsync() + { + explorerUrl = await localStorage.GetItemAsync("explorerUrl"); + } } \ No newline at end of file diff --git a/SimpleNodeOps/Shared/MainLayout.razor b/SimpleNodeOps/Shared/MainLayout.razor index 32f3629..21c0916 100644 --- a/SimpleNodeOps/Shared/MainLayout.razor +++ b/SimpleNodeOps/Shared/MainLayout.razor @@ -30,13 +30,13 @@ switch (network_name) { case "cayenne": - await SetNetwork("Cayenne", "https://lit-protocol.calderachain.xyz/http", 0, "0xb82f2dB0B486F1ef698CC88F0d521D873eb04d03", "https://lit-protocol.calderaexplorer.xyz/api", 1); + await SetNetwork("Cayenne", "https://lit-protocol.calderachain.xyz/http", 0, "0xb82f2dB0B486F1ef698CC88F0d521D873eb04d03", "https://lit-protocol.calderaexplorer.xyz/api", 1, "https://lit-protocol.calderaexplorer.xyz/address/"); break; case "manzano": - await SetNetwork("Manzano", "https://lit-protocol.calderachain.xyz/http", 0, "0x9F0Ede26261451C5E784DC799D71ECf766", "https://lit-protocol.calderaexplorer.xyz/api", 1); + await SetNetwork("Manzano", "https://lit-protocol.calderachain.xyz/http", 0, "0x9F0Ede26261451C5E784DC799D71ECf766", "https://lit-protocol.calderaexplorer.xyz/api", 1, "https://lit-protocol.calderaexplorer.xyz/address/"); break; default: // this is habanero - await SetNetwork("Habanero", "https://lit-protocol.calderachain.xyz/http", 2, "0xe5a7C5d908EE8996332F488cE5f636d4EBff8522", "https://lit-protocol.calderaexplorer.xyz/api", 1); + await SetNetwork("Habanero", "https://lit-protocol.calderachain.xyz/http", 2, "0xe5a7C5d908EE8996332F488cE5f636d4EBff8522", "https://lit-protocol.calderaexplorer.xyz/api", 1, "https://lit-protocol.calderaexplorer.xyz/address/"); break; } @@ -44,7 +44,7 @@ } - private async Task SetNetwork(string name, string url, int env, string resolverAddress, string rpc_api_url, int rpc_api_type) + private async Task SetNetwork(string name, string url, int env, string resolverAddress, string rpc_api_url, int rpc_api_type, string explorerUrl) { Console.WriteLine("SetNetwork:" + name); var defaultPrivateKey = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; @@ -55,6 +55,7 @@ await localStorage.SetItemAsync("privateKey", defaultPrivateKey); await localStorage.SetItemAsync("rpc_api_type", rpc_api_type); await localStorage.SetItemAsync("rpc_api_url", rpc_api_url); + await localStorage.SetItemAsync("explorerUrl", explorerUrl); } } \ No newline at end of file