public void Setup() { var urls = new[] { "http://localhost:8545/" }; var jsonRpcClientProxy = new JsonRpcClientProxy(new DefaultHttpClient(new HttpClient(), new EthereumJsonSerializer(), LimboLogs.Instance), urls, LimboLogs.Instance); _jsonRpcWalletClientProxy = new JsonRpcWalletClientProxy(jsonRpcClientProxy); }
private void InitData() { var httpClient = new HttpClient(); var urls = new[] { DefaultUrl }; var jsonRpcClientProxy = new JsonRpcClientProxy(new DefaultHttpClient(httpClient, new EthereumJsonSerializer(), LimboLogs.Instance, 0), urls, LimboLogs.Instance); _ethJsonRpcClientProxy = new EthJsonRpcClientProxy(jsonRpcClientProxy); }
public PeersApp() : base("Peers") { string[] urls = { DefaultUrl }; var logger = LimboLogs.Instance; var serializer = new EthereumJsonSerializer(); var httpClient = new HttpClient(); var defaultHttpClient = new DefaultHttpClient(httpClient, serializer, logger, int.MaxValue); var proxy = new JsonRpcClientProxy(defaultHttpClient, urls, logger); _adminRpc = new AdminJsonRpcClientProxy(proxy); MenuBar menu = new MenuBar(new MenuBarItem[] { new MenuBarItem("_File", new MenuItem[] { new MenuItem("_Quit", "", () => { Application.RequestStop(); }) }), }); ListView view = new ListView() { X = 0, Y = 1, Width = Dim.Fill(), Height = Dim.Fill() - 1, }; view.AllowsAll(); Add(menu, view); bool UpdateTimer(MainLoop mainLoop) { _adminRpc.admin_peers(true).ContinueWith( t => Application.MainLoop.Invoke(() => { Title = $"Last Peers Update {DateTime.Now}"; view.SetSourceAsync(t.Result.Result.Select(ToPeerInfoRow).OrderByDescending(r => r.Reputation).ToArray()); }) ); return(true); } var token = Application.MainLoop.AddTimeout(TimeSpan.FromSeconds(10), UpdateTimer); }
static async Task Main(string[] args) { Application.Init(); var addressesModule = new AddressesModule(); addressesModule.AddressesSelected += async(_, data) => { var urls = new[] { data.nodeAddress }; var httpClient = new HttpClient(); AddAuthorizationHeader(httpClient, data.nodeAddress); var jsonRpcClientProxy = new JsonRpcClientProxy(new DefaultHttpClient(httpClient, new EthereumJsonSerializer(), LimboLogs.Instance, int.MaxValue), urls, LimboLogs.Instance); var jsonRpcWalletClientProxy = new JsonRpcWalletClientProxy(jsonRpcClientProxy); var ethJsonRpcClientProxy = new EthJsonRpcClientProxy(jsonRpcClientProxy); var dataModule = new DataModule(ethJsonRpcClientProxy, data.address); dataModule.TransferClicked += async(_, e) => { var transferModule = new TransferModule(ethJsonRpcClientProxy, jsonRpcWalletClientProxy, e.Address, e.Balance); var transferWindow = await transferModule.InitAsync(); Application.Top.Add(transferWindow); Application.Run(transferWindow); }; var dataWindow = await dataModule.InitAsync(); Application.Top.Add(dataWindow); Application.Run(dataWindow); }; Application.Top.Add(await addressesModule.InitAsync()); Application.Run(); }
public void Init() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; this.service = JsonRpcClientProxy <TestService> .Create("localhost", 1666); }
public void WrongAddress() { this.service = JsonRpcClientProxy <TestService> .Create("nosuchhost", 1666); this.service.test(); }
public void WrongPort() { this.service = JsonRpcClientProxy <TestService> .Create("localhost", 1333); this.service.test(); }
static async Task Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += (_, e) => { Application.Top.Running = false; Application.RequestStop(); Application.Shutdown(); Console.WriteLine($"There was an error.{Environment.NewLine}{e.ExceptionObject}"); }; Application.Init(); var httpClient = new HttpClient(); var urls = new[] { DefaultUrl }; var jsonRpcClientProxyMaxRetries = new JsonRpcClientProxy(new DefaultHttpClient(httpClient, new EthereumJsonSerializer(), LimboLogs.Instance, int.MaxValue), urls, LimboLogs.Instance); var ethJsonRpcClientProxyMaxRetries = new EthJsonRpcClientProxy(jsonRpcClientProxyMaxRetries); var jsonRpcWalletClientProxyMaxRetries = new JsonRpcWalletClientProxy(jsonRpcClientProxyMaxRetries); var runnerValidator = new RunnerValidator(httpClient, DefaultUrl); var networkModule = new NetworkModule(); networkModule.NetworkSelected += async(_, network) => { var initModule = new InitModule(ethJsonRpcClientProxyMaxRetries, runnerValidator, network); initModule.OptionSelected += async(_, optionInfo) => { var addressesModule = new AddressesModule(optionInfo, jsonRpcWalletClientProxyMaxRetries); addressesModule.AddressesSelected += async(_, addressesEvent) => { urls = new[] { addressesEvent.NodeAddress }; AddAuthorizationHeader(httpClient, addressesEvent.NodeAddress); Application.MainLoop.Invoke(async() => { var balanceModule = new BalanceModule(ethJsonRpcClientProxyMaxRetries, addressesEvent.AccountAddress); balanceModule.TransferClicked += async(_, transferEvent) => { var transferModule = new TransferModule(ethJsonRpcClientProxyMaxRetries, jsonRpcWalletClientProxyMaxRetries, transferEvent.Address, transferEvent.Balance); var transferWindow = await transferModule.InitAsync(); Application.Top.Add(transferWindow); Application.Run(transferWindow); }; var balanceWindow = await balanceModule.InitAsync(); Application.Top.Add(balanceWindow); Application.Run(balanceWindow); }); }; var addressesWindow = await addressesModule.InitAsync(); Application.Top.Add(addressesWindow); Application.Run(addressesWindow); }; var initWindow = await initModule.InitAsync(); Application.Top.Add(initWindow); Application.Run(initWindow); }; var networkWindow = await networkModule.InitAsync(); Application.Top.Add(networkWindow); Application.Run(); }