Esempio n. 1
0
        private static void TestConnection()
        {
            CliConsole.WriteLine($"Connecting to {NodeManager.CurrentUri}");
            JsValue result = Engine.Execute("web3.clientVersion");

            if (result != JsValue.Null)
            {
                CliConsole.WriteGood("Connected");
            }
        }
Esempio n. 2
0
        private static void Test()
        {
            CliConsole.WriteLine($"Connecting to {_nodeManager.CurrentUri}");
            JsValue result = _engine.Execute("web3.clientVersion");

            if (result != JsValue.Null)
            {
                CliConsole.WriteGood("Connected");
            }
//            Console.WriteLine(_serializer.Serialize(result.ToObject(), true));
            CliConsole.WriteLine();
        }
Esempio n. 3
0
        private static void RunEvalLoop()
        {
            while (true)
            {
                try
                {
                    Console.Write("> ");

                    int    bufferSize = 1024 * 16;
                    string statement;
                    using (Stream inStream = Console.OpenStandardInput(bufferSize))
                    {
                        Console.SetIn(new StreamReader(inStream, Console.InputEncoding, false, bufferSize));
                        statement = Console.ReadLine();
                    }

                    if (statement == "exit")
                    {
                        break;
                    }

                    JsValue result = _engine.Execute(statement);
                    bool    isNull = result.IsNull();
                    Console.WriteLine(isNull ? "null" : result);
                }
                catch (Exception e)
                {
                    var color = Console.ForegroundColor;
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(e);
                    Console.ForegroundColor = color;
                }
            }
        }