mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
Add missing file
This commit is contained in:
parent
8973c75bbc
commit
9b12c7bc57
1 changed files with 31 additions and 0 deletions
31
BTCPayServer/Services/LightningClientFactoryService.cs
Normal file
31
BTCPayServer/Services/LightningClientFactoryService.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using BTCPayServer.Lightning;
|
||||
|
||||
namespace BTCPayServer.Services
|
||||
{
|
||||
public class LightningClientFactoryService
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
|
||||
public LightningClientFactoryService(IHttpClientFactory httpClientFactory)
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
}
|
||||
|
||||
public ILightningClient Create(LightningConnectionString lightningConnectionString, BTCPayNetwork network)
|
||||
{
|
||||
if (lightningConnectionString == null)
|
||||
throw new ArgumentNullException(nameof(lightningConnectionString));
|
||||
if (network == null)
|
||||
throw new ArgumentNullException(nameof(network));
|
||||
return new Lightning.LightningClientFactory(network.NBitcoinNetwork)
|
||||
{
|
||||
HttpClient = _httpClientFactory.CreateClient($"{network.CryptoCode}: Lightning client")
|
||||
}.Create(lightningConnectionString);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue