C-Lightning Client is shipped with LightningPay
package.
More info about C-Lightning (Github Project)
using (var client = CLightningClient.New("tcp://127.0.0.1:9835"))
{
//Your code...
}
You can retrieve a code sample with LND Client here : C-Lightning Client Sample
LightningPay.DependencyInjection
package adds extension method to create the C-Lightning Client with .NET Core Dependency Injection in your startup file :
public void ConfigureServices(IServiceCollection services)
{
///...
services.AddCLightningClient(new Uri("tcp://127.0.0.1:9835"));
}
Once you register LightningPay
, you can use the client in any object by dependency injection in constructor :
private readonly ILightningClient lightningClient;
public HomeController(ILightningClient lightningClient)
{
this.lightningClient = lightningClient;
}
You can retrieve a code samples used Dependency Injection in the Visual Studio Solution WebApp.sln
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddCLightningClient(new Uri("tcp://127.0.0.1:9835"));
}