btcpayserver/BTCPayServer/Payments/PayJoin/PayJoinExtensions.cs

26 lines
1.1 KiB
C#
Raw Normal View History

2021-12-31 16:59:02 +09:00
using BTCPayServer.BIP78.Sender;
2020-03-30 00:28:22 +09:00
using BTCPayServer.HostedServices;
using BTCPayServer.Payments.PayJoin.Sender;
2020-03-30 00:28:22 +09:00
using BTCPayServer.Services;
2020-01-06 13:57:32 +01:00
using Microsoft.Extensions.DependencyInjection;
2020-03-30 00:28:22 +09:00
using Microsoft.Extensions.Hosting;
2020-01-06 13:57:32 +01:00
namespace BTCPayServer.Payments.PayJoin
{
public static class PayJoinExtensions
{
2020-03-30 00:28:22 +09:00
public static void AddPayJoinServices(this IServiceCollection services)
2020-01-06 13:57:32 +01:00
{
2020-03-30 00:28:22 +09: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-30 00:28:22 +09:00
services.AddSingleton<PayjoinClient>();
services.AddTransient<Socks5HttpClientHandler>();
services.AddHttpClient(PayjoinServerCommunicator.PayjoinOnionNamedClient)
2020-11-13 14:01:51 +09:00
.ConfigurePrimaryHttpMessageHandler<Socks5HttpClientHandler>();
2020-01-06 13:57:32 +01:00
}
}
}