Пример #1
0
        public WalletClient(IServiceProvider serviceProvider, IOptions <Configuration.Node> nodeOptions, IOptions <Configuration.Token> tokenOptions, IOptions <Configuration.Block> blockOptions)
        {
            var nodeConfiguration  = nodeOptions.Value;
            var tokenConfiguration = tokenOptions.Value;

            _blockConfiguration = blockOptions.Value;

            _serviceProvider = serviceProvider;
            _appLifeTime     = serviceProvider.GetService <IApplicationLifetime>();

            _walletClient = new Client.WalletClient(nodeConfiguration.Ip + ":" + nodeConfiguration.Port);
            _logger       = new Logger(serviceProvider.GetService <ILoggerFactory>().CreateLogger("WalletClient"));
            _token        = new Token(tokenConfiguration.Id, tokenConfiguration.Name, _logger, _walletClient);

            _actionHandler = new ActionHandler(_logger, _token, _blockConfiguration);

            if (_blockConfiguration.SyncCount <= 0)
            {
                _logger.Log.LogWarning(Logger.SynchronizationDisabled, "The synchronization is disabled, because 'syncCount' in 'blockchain.json' is zero!");
                return;
            }

            _synchronizeBlocksThread = new Thread(SynchronizeBlocks);
        }
Пример #2
0
 public ActionHandler(Logger logger, Token token, Configuration.Block blockConfiguration)
 {
     _logger             = logger;
     _token              = token;
     _blockConfiguration = blockConfiguration;
 }