| | | 1 | | using Microsoft.Extensions.DependencyInjection; |
| | | 2 | | using NLightning.Infrastructure.Bitcoin.Builders.Interfaces; |
| | | 3 | | using NLightning.Infrastructure.Bitcoin.Wallet; |
| | | 4 | | using NLightning.Infrastructure.Bitcoin.Wallet.Interfaces; |
| | | 5 | | |
| | | 6 | | namespace NLightning.Infrastructure.Bitcoin; |
| | | 7 | | |
| | | 8 | | using Builders; |
| | | 9 | | using Crypto.Functions; |
| | | 10 | | using Domain.Protocol.Interfaces; |
| | | 11 | | using Infrastructure.Crypto.Interfaces; |
| | | 12 | | using Protocol.Factories; |
| | | 13 | | using Services; |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Extension methods for setting up Bitcoin infrastructure services in an IServiceCollection. |
| | | 17 | | /// </summary> |
| | | 18 | | public static class DependencyInjection |
| | | 19 | | { |
| | | 20 | | /// <summary> |
| | | 21 | | /// Adds Bitcoin infrastructure services to the specified IServiceCollection. |
| | | 22 | | /// </summary> |
| | | 23 | | /// <param name="services">The IServiceCollection to add services to.</param> |
| | | 24 | | /// <returns>The same service collection so that multiple calls can be chained.</returns> |
| | | 25 | | public static IServiceCollection AddBitcoinInfrastructure(this IServiceCollection services) |
| | | 26 | | { |
| | | 27 | | // Register Singletons |
| | 0 | 28 | | services.AddSingleton<IBitcoinWallet, BitcoinWalletService>(); |
| | 0 | 29 | | services.AddSingleton<IBlockchainMonitor, BlockchainMonitorService>(); |
| | 0 | 30 | | services.AddSingleton<ICommitmentKeyDerivationService, CommitmentKeyDerivationService>(); |
| | 0 | 31 | | services.AddSingleton<ICommitmentTransactionBuilder, CommitmentTransactionBuilder>(); |
| | 0 | 32 | | services.AddSingleton<IEcdh, Ecdh>(); |
| | 0 | 33 | | services.AddSingleton<IFundingOutputBuilder, FundingOutputBuilder>(); |
| | 0 | 34 | | services.AddSingleton<IKeyDerivationService, KeyDerivationService>(); |
| | 0 | 35 | | services.AddSingleton<ITlvConverterFactory, TlvConverterFactory>(); |
| | | 36 | | |
| | 0 | 37 | | return services; |
| | | 38 | | } |
| | | 39 | | } |