Exemplo n.º 1
0
 /// <summary>
 /// Service for handling on-chain balance
 /// </summary>
 /// <param name="keysRepository"></param>
 /// <param name="nbXplorerClientProvider"></param>
 public WalletService(IKeysRepository keysRepository, INBXplorerClientProvider nbXplorerClientProvider, ILogger <WalletService> logger, RepositoryProvider repositoryProvider)
 {
     _keysRepository          = keysRepository;
     _nbXplorerClientProvider = nbXplorerClientProvider;
     _logger             = logger;
     _repositoryProvider = repositoryProvider;
 }
Exemplo n.º 2
0
 public PeerManagerProvider(
     INBXplorerClientProvider nbXplorerClientProvider,
     NRustLightningNetworkProvider networkProvider,
     IKeysRepository keysRepository,
     ILoggerFactory loggerFactory,
     ChannelProvider channelProvider,
     IOptions <Config> config
     )
 {
     foreach (var n in networkProvider.GetAll())
     {
         var nbx = nbXplorerClientProvider.TryGetClient(n);
         if (nbx != null)
         {
             var b      = new NbXplorerBroadcaster(nbx, loggerFactory.CreateLogger <NbXplorerBroadcaster>());
             var feeEst = new NbXplorerFeeEstimator(loggerFactory.CreateLogger <NbXplorerFeeEstimator>(),
                                                    channelProvider.GetFeeRateChannel(n).Reader);
             var chainWatchInterface =
                 new NbxChainWatchInterface(nbx, loggerFactory.CreateLogger <NbxChainWatchInterface>(), n);
             var peerManSeed = new byte[32];
             RandomUtils.GetBytes(peerManSeed);
             var logger          = new NativeLogger(loggerFactory.CreateLogger <NativeLogger>());
             var nbitcoinNetwork = n.NBitcoinNetwork;
             var conf            = config.Value.RustLightningConfig;
             var peerMan         = PeerManager.Create(peerManSeed.AsSpan(), nbitcoinNetwork, conf, chainWatchInterface, keysRepository, b,
                                                      logger, feeEst, 400000);
             _peerManagers.Add(n.CryptoCode, peerMan);
         }
     }
 }
Exemplo n.º 3
0
 public AccountFacade(IKeysRepository keysRepository, IUserRepository userRepository,
                      IEmailSender sender, UserSettings userSettings)
 {
     _keysRepository = keysRepository;
     _userRepository = userRepository;
     _sender         = sender;
     _userSettings   = userSettings;
 }
Exemplo n.º 4
0
 public InfoController(IKeysRepository keysRepository, IOptions <Config> config, P2PConnectionHandler connectionHandler, NRustLightningNetworkProvider networkProvider, RepositoryProvider repositoryProvider)
 {
     this.keysRepository = keysRepository;
     _connectionHandler  = connectionHandler;
     _networkProvider    = networkProvider;
     _repositoryProvider = repositoryProvider;
     this.config         = config.Value;
 }
Exemplo n.º 5
0
 public DBTrieInvoiceRepository(IOptions <Config> conf, IKeysRepository keysRepository, ISystemClock systemClock, NRustLightningNetworkProvider networkProvider, ILogger <DBTrieInvoiceRepository> logger)
 {
     _dbPath          = conf.Value.InvoiceDBFilePath;
     _keysRepository  = keysRepository;
     _systemClock     = systemClock;
     _networkProvider = networkProvider;
     _logger          = logger;
     _engine          = DBTrieEngine.OpenFromFolder(_dbPath).Result;
     _engine.ConfigurePagePool(new PagePool(pageSize: conf.Value.DBCacheMB));
 }
        public void Initialize()
        {
            _userRepository  = new InMemoryUserRepository();
            _keysRepository  = new InMemoryKeysRepository();
            _groupRepository = new InMemoryGroupRepository();
            _eventRepository = new InMemoryEventRepository();
            _publisher       = new Mock <IEventPublisher>();
            userSettings     = new UserSettings("");

            _emailSender = new Mock <IEmailSender>();
        }
Exemplo n.º 7
0
 public InvoiceService(IRepository repository, EventAggregator eventAggregator, PeerManagerProvider peerManagerProvider, NRustLightningNetworkProvider networkProvider, ILogger <InvoiceService> logger, IOptions <Config> config, IKeysRepository keysRepository)
 {
     _repository          = repository;
     _eventAggregator     = eventAggregator;
     _peerManagerProvider = peerManagerProvider;
     _networkProvider     = networkProvider;
     _logger         = logger;
     _config         = config;
     _keysRepository = keysRepository;
     _pool           = MemoryPool <byte> .Shared;
 }
Exemplo n.º 8
0
        public ApiKeyController(IKeysView view)
        {
            APIKeysFileExistingChecker checker = new APIKeysFileExistingChecker(Environment.CurrentDirectory);

            if (!checker.IsAPIKeysFileExists)
            {
                checker.CreateKeysConfingFile();
            }
            _view = view;
            _view.SetInputHandler(this);

            _keysRepository = new APIKeysRepository(checker.ConfigFilePath);
            CurrentKey      = _keysRepository.FindCurrentAPIKey();

            _view.ShowCurrentKey(CurrentKey);
            _view.ShowAvailableKeys <APIKeyEntity>(_keysRepository.ReadAPIKeys());
        }
 public PeerManagerProvider(
     INBXplorerClientProvider nbXplorerClientProvider,
     NRustLightningNetworkProvider networkProvider,
     IKeysRepository keysRepository,
     ILoggerFactory loggerFactory,
     ChannelProvider channelProvider,
     IOptions <Config> config,
     RepositoryProvider repositoryProvider,
     EventAggregator eventAggregator
     )
 {
     _nbXplorerClientProvider = nbXplorerClientProvider;
     _networkProvider         = networkProvider;
     _keysRepository          = keysRepository;
     _loggerFactory           = loggerFactory;
     _logger             = loggerFactory.CreateLogger <PeerManagerProvider>();
     _channelProvider    = channelProvider;
     _config             = config;
     _repositoryProvider = repositoryProvider;
     _eventAggregator    = eventAggregator;
 }
        public TestPeerManagerProvider(IBroadcaster broadcaster, IFeeEstimator feeEstimator, IChainWatchInterface chainWatchInterface, IOptions <Config> config, ILoggerFactory loggerFactory, IKeysRepository keysRepository)
        {
            _broadcaster         = broadcaster;
            _feeEstimator        = feeEstimator;
            _chainWatchInterface = chainWatchInterface;
            var seed          = new byte[32];
            var n             = NBitcoin.Network.RegTest;
            var conf          = config.Value.RustLightningConfig;
            var logger        = new NativeLogger(loggerFactory.CreateLogger <NativeLogger>());
            var keysInterface = new KeysManager(seed, DateTime.UnixEpoch);

            _peerManager =
                PeerManager.Create(seed.AsSpan(), n, conf, chainWatchInterface, keysInterface, broadcaster, logger, feeEstimator, 100);
        }
Exemplo n.º 11
0
 public StubWalletService(IKeysRepository keysRepository)
 {
     _keysRepository = keysRepository;
 }