btcpayserver/BTCPayServer/Payments/PayJoin/Sender/PayjoinServerCommunicator.cs
Andrew Camilleri 49ae62b02e
Use library for Payjoin Sender (#2158)
* Use library for Payjoin Sender

* update payjoin sender to use new package and reduce code

* fix using statements
2021-03-01 22:44:53 +09:00

24 lines
786 B
C#

using System;
using System.Net.Http;
using BTCPayServer.BIP78.Sender;
namespace BTCPayServer.Payments.PayJoin.Sender
{
public class PayjoinServerCommunicator : HttpClientPayjoinServerCommunicator
{
private readonly IHttpClientFactory _httpClientFactory;
public const string PayjoinOnionNamedClient = "payjoin.onion";
public const string PayjoinClearnetNamedClient = "payjoin.clearnet";
public PayjoinServerCommunicator(IHttpClientFactory httpClientFactory)
{
_httpClientFactory = httpClientFactory;
}
protected override HttpClient CreateHttpClient(Uri uri)
{
return _httpClientFactory.CreateClient(uri.IsOnion() ? PayjoinOnionNamedClient : PayjoinClearnetNamedClient);
}
}
}