btcpayserver/BTCPayServer/Payments/PayJoin/PayJoinExtensions.cs

26 lines
1.1 KiB
C#
Raw Permalink Normal View History

2021-12-31 08:59:02 +01:00
using BTCPayServer.BIP78.Sender;
2020-03-29 17:28:22 +02:00
using BTCPayServer.HostedServices;
using BTCPayServer.Payments.PayJoin.Sender;
2020-03-29 17:28:22 +02:00
using BTCPayServer.Services;
2020-01-06 13:57:32 +01:00
using Microsoft.Extensions.DependencyInjection;
2020-03-29 17:28:22 +02:00
using Microsoft.Extensions.Hosting;
2020-01-06 13:57:32 +01:00
namespace BTCPayServer.Payments.PayJoin
{
public static class PayJoinExtensions
{
2020-03-29 17:28:22 +02:00
public static void AddPayJoinServices(this IServiceCollection services)
2020-01-06 13:57:32 +01:00
{
2020-03-29 17:28:22 +02:00
services.AddSingleton<DelayedTransactionBroadcaster>();
services.AddSingleton<IHostedService, HostedServices.DelayedTransactionBroadcasterHostedService>();
services.AddSingleton<UTXOLocker>();
services.AddSingleton<IUTXOLocker>(provider => provider.GetRequiredService<UTXOLocker>());
services.AddSingleton<IPayjoinServerCommunicator, PayjoinServerCommunicator>();
2020-03-29 17:28:22 +02:00
services.AddSingleton<PayjoinClient>();
services.AddTransient<Socks5HttpClientHandler>();
services.AddHttpClient(PayjoinServerCommunicator.PayjoinOnionNamedClient)
2020-11-13 06:01:51 +01:00
.ConfigurePrimaryHttpMessageHandler<Socks5HttpClientHandler>();
2020-01-06 13:57:32 +01:00
}
}
}