Exemple #1
0
        public CliEngine(ICliConsole cliConsole)
        {
            _cliConsole = cliConsole;
            JintEngine  = new Engine();
            JintEngine.SetValue("gasPrice", (double)20.GWei());
            JintEngine.SetValue("load", new Action <string>(LoadFile));
            JintEngine.SetValue("log", new Action <JsValue>(v =>
            {
//                File.AppendAllText("C:\\temp\\cli.txt", v.ToString());
                Colorful.Console.WriteLine(v.ToString());
            }));

            JintEngine.Global.FastAddProperty("window", JintEngine.Global, false, false, false);

            ObjectInstance console = JintEngine.Object.Construct(Arguments.Empty);

            JintEngine.SetValue("console", console);
            console.Put("log", new DelegateWrapper(JintEngine, new Action <JsValue>(v =>
            {
//                File.AppendAllText("C:\\temp\\cli.txt", v.ToString());
                Colorful.Console.WriteLine(v.ToString());
            })), false);

            JintEngine.ClrTypeConverter = new FallbackTypeConverter(JintEngine.ClrTypeConverter, new BigIntegerTypeConverter());
        }
Exemple #2
0
        public NodeManager(ICliEngine cliEngine, IJsonSerializer serializer, ICliConsole cliConsole, ILogManager logManager)
        {
            _cliEngine  = cliEngine ?? throw new ArgumentNullException(nameof(cliEngine));
            _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
            _cliConsole = cliConsole ?? throw new ArgumentNullException(nameof(cliConsole));
            _logManager = logManager ?? throw new ArgumentNullException(nameof(logManager));

            _jsonParser = new JsonParser(_cliEngine.JintEngine);
        }
Exemple #3
0
        public void Setup()
        {
            _serializer    = new EthereumJsonSerializer();
            _jsonRpcClient = Substitute.For <IJsonRpcClient>();
            _engine        = new CliEngine(_cliConsole);
            NodeManager nodeManager = new NodeManager(_engine, _serializer, _cliConsole, LimboLogs.Instance);

            nodeManager.SwitchClient(_jsonRpcClient);
            ICliConsole     cliConsole   = Substitute.For <ICliConsole>();
            CliModuleLoader moduleLoader = new CliModuleLoader(_engine, nodeManager, cliConsole);

            moduleLoader.LoadModule(typeof(ProofCliModule));
        }
Exemple #4
0
 public CliModuleLoader(ICliEngine engine, IJsonRpcClient client, ICliConsole cliConsole)
 {
     _engine     = engine ?? throw new ArgumentNullException(nameof(engine));
     _client     = client ?? throw new ArgumentNullException(nameof(client));
     _cliConsole = cliConsole ?? throw new ArgumentNullException(nameof(cliConsole));
 }
 public StatementHistoryManager(ICliConsole cliConsole)
 {
     _cliConsole = cliConsole;
 }
Exemple #6
0
 public CliLogger(ICliConsole cliConsole)
 {
     _cliConsole = cliConsole;
 }