Exemplo n.º 1
0
        public Home()
        {
            InitializeComponent();

            var f = Directory.GetFiles(".", "*.csv");

            if (f.Any())
            {
                tbPathToDump.Text = f[0];
            }

            IsTestnet    = bool.Parse(ConfigurationManager.AppSettings["IsTestnet"]);
            _login       = ConfigurationManager.AppSettings["Login"];
            _privateKeys = new List <byte[]>
            {
                Base58.DecodePrivateWif(ConfigurationManager.AppSettings["PrivateActiveWif"])
            };

            HttpClient = new RepeatHttpClient();
            Api        = new OperationManager(HttpClient)
            {
                ChainUrl  = ConfigurationManager.AppSettings["ChainUrl"], // path to EOS node
                WalletUrl = ConfigurationManager.AppSettings["WalletUrl"] // path to EOS Wallet (if needed)
            };

            Load        += Home_Load;
            FormClosing += Home_FormClosing;
        }
Exemplo n.º 2
0
        protected virtual void OneTimeSetUp()
        {
            if (User == null)
            {
                User = new UserInfo
                {
                    Login            = ConfigurationManager.AppSettings["Login"],
                    PrivateOwnerWif  = ConfigurationManager.AppSettings["PrivateOwnerWif"],
                    PublicOwnerWif   = ConfigurationManager.AppSettings["PublicOwnerWif"],
                    PrivateActiveWif = ConfigurationManager.AppSettings["PrivateActiveWif"],
                    PublicActiveWif  = ConfigurationManager.AppSettings["PublicActiveWif"],
                    Password         = ConfigurationManager.AppSettings["Password"]
                };
            }

            if (Api == null)
            {
                HttpClient = new RepeatHttpClient();
                Api        = new OperationManager(HttpClient)
                {
                    ChainUrl  = ConfigurationManager.AppSettings["ChainUrl"],
                    WalletUrl = ConfigurationManager.AppSettings["WalletUrl"]
                };
            }
        }
Exemplo n.º 3
0
        protected override void OneTimeSetUp()
        {
            HttpClient  = new RepeatHttpClient();
            HttpManager = new HttpManager(HttpClient);
            Api         = new OperationManager(HttpManager);

            WebSocketManager = new WebSocketManager();
        }
Exemplo n.º 4
0
 protected virtual void OneTimeSetUp()
 {
     if (Api == null)
     {
         var httpClient  = new RepeatHttpClient();
         var httpManager = new HttpManager(httpClient);
         Api = new OperationManager(httpManager);
         var url = ConfigurationManager.AppSettings["MainnetHttp"];
         httpManager.UrlToConnect = url;
         //Assert.IsTrue(Api.ConnectToAsync(url, CancellationToken.None).Result, "Сan`t connect to the node");
     }
     // Assert.IsTrue(Api.IsConnected, "Сan`t connect to the node");
 }
Exemplo n.º 5
0
        public async Task TestFailedNode(string url)
        {
            var sw = new Stopwatch();

            Console.WriteLine(url);

            sw.Start();
            var token       = CancellationToken.None;
            var httpClient  = new RepeatHttpClient();
            var httpManager = new HttpManager(httpClient);
            var api         = new OperationManager(httpManager);

            httpManager.UrlToConnect = url;
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);

            sw.Restart();
            var resp1 = await api.ProtocolVersionAsync(token)
                        .ConfigureAwait(false);

            Assert.IsFalse(resp1.IsError);
            Console.WriteLine($"{resp1.Result}");
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);

            sw.Restart();
            var resp2 = await api.NetVersionAsync(CancellationToken.None)
                        .ConfigureAwait(false);

            Assert.IsFalse(resp2.IsError);
            Console.WriteLine($"{resp2.Result}");
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);

            sw.Restart();
            var resp3 = await api.BlockNumberAsync(CancellationToken.None)
                        .ConfigureAwait(false);

            Assert.IsFalse(resp3.IsError);
            Console.WriteLine($"{resp3.Result}");
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);

            sw.Restart();
            var resp4 = await api.GetBlockByNumberAsync(resp3.Result.Value, true, CancellationToken.None)
                        .ConfigureAwait(false);

            Assert.IsFalse(resp4.IsError);
            Console.WriteLine($"{resp4.Result}");
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);

            sw.Restart();
            var resp5 = await api.GetTransactionReceiptAsync(new HexValue("0x9959ddd050dbcd23f9732e5c3870813eaf8155d081d10785694420160dc7e747"), CancellationToken.None)
                        .ConfigureAwait(false);

            Assert.IsFalse(resp5.IsError);
            Assert.IsFalse(resp5.Result == null);
            Console.WriteLine($"{resp5.Result}");
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);

            sw.Restart();
            var resp6 = await api.GetBlockByNumberAsync(4837041, true, CancellationToken.None)
                        .ConfigureAwait(false);

            Assert.IsFalse(resp6.IsError);
            Assert.IsFalse(resp6.Result == null);
            Assert.IsTrue(resp6.Result.Transactions.Length == 221);
            Console.WriteLine($"{resp6.Result}");
            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds);
        }