Skip to content

Commit

Permalink
add DotNetLightning.ClnRpc
Browse files Browse the repository at this point in the history
This commit adds a new project for calling c-lightning from .NET
in a typesafe way.
Most of the codes are auto-generated from client generator built in
ref: ElementsProject/lightning#5201

It must be updated after ElementsProject/lightning#5216 gets merged.
So that all the generation logics is defined in this repo.
But this is good enough for temporary solution.
  • Loading branch information
joemphilips committed May 5, 2022
1 parent fdb92c8 commit 4c0b066
Show file tree
Hide file tree
Showing 5 changed files with 3,534 additions and 0 deletions.
15 changes: 15 additions & 0 deletions DotNetLightning.sln
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AEZ", "src\AEZ\AEZ.csproj",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AEZ.Tests", "tests\AEZ.Tests\AEZ.Tests.csproj", "{95F08554-B415-4B0F-8E65-754A1CFE7513}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "DotNetLightning.ClnRpc", "src\DotNetLightning.ClnRpc\DotNetLightning.ClnRpc.fsproj", "{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -176,6 +178,18 @@ Global
{95F08554-B415-4B0F-8E65-754A1CFE7513}.Release|x64.Build.0 = Release|Any CPU
{95F08554-B415-4B0F-8E65-754A1CFE7513}.Release|x86.ActiveCfg = Release|Any CPU
{95F08554-B415-4B0F-8E65-754A1CFE7513}.Release|x86.Build.0 = Release|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Debug|x64.ActiveCfg = Debug|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Debug|x64.Build.0 = Debug|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Debug|x86.ActiveCfg = Debug|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Debug|x86.Build.0 = Debug|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Release|Any CPU.Build.0 = Release|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Release|x64.ActiveCfg = Release|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Release|x64.Build.0 = Release|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Release|x86.ActiveCfg = Release|Any CPU
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{594F2275-AF8E-4AFC-B8DC-7D6048C872CA} = {84B95569-6BD8-48B4-A942-CBBC9462B6D4}
Expand All @@ -190,5 +204,6 @@ Global
{C34D4C62-BEBE-4333-8EB8-9CDDEF331E1B} = {E6F1DC30-D346-4E86-8F58-20CFAAB19448}
{411563BA-49FA-4707-B3ED-E66C5B288264} = {84B95569-6BD8-48B4-A942-CBBC9462B6D4}
{95F08554-B415-4B0F-8E65-754A1CFE7513} = {E6F1DC30-D346-4E86-8F58-20CFAAB19448}
{39ED1BF2-14D8-45C1-B062-F8B5B612C75F} = {84B95569-6BD8-48B4-A942-CBBC9462B6D4}
EndGlobalSection
EndGlobal
153 changes: 153 additions & 0 deletions src/DotNetLightning.ClnRpc/Client.Methods.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@

/// This file was automatically generated using following command:
/// ```bash
/// msggen
/// ```
///
/// Do not edit this file, it'll be overwritten. Rather edit the schema that
/// This file was generated from
namespace DotNetLightning.ClnRpc


open System.Runtime.InteropServices
open System.Runtime.CompilerServices
open System.Threading
open System.Threading.Tasks



[<System.CodeDom.Compiler.GeneratedCode("msggen", "")>]
[<Extension;AbstractClass;Sealed>]
type ClnClientExtensions =
[<Extension>]
static member GetinfoAsync(this: ClnClient, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.GetinfoResponse>("getinfo", null, ct=ct)
[<Extension>]
static member ListPeersAsync(this: ClnClient, req: Requests.ListpeersRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.ListpeersResponse>(Request.ListPeers req, ct=ct)
[<Extension>]
static member ListFundsAsync(this: ClnClient, req: Requests.ListfundsRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.ListfundsResponse>(Request.ListFunds req, ct=ct)
[<Extension>]
static member SendPayAsync(this: ClnClient, req: Requests.SendpayRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.SendpayResponse>(Request.SendPay req, ct=ct)
[<Extension>]
static member ListChannelsAsync(this: ClnClient, req: Requests.ListchannelsRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.ListchannelsResponse>(Request.ListChannels req, ct=ct)
[<Extension>]
static member AddGossipAsync(this: ClnClient, req: Requests.AddgossipRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync(Request.AddGossip req, ct=ct) :> Task
[<Extension>]
static member AutoCleanInvoiceAsync(this: ClnClient, req: Requests.AutocleaninvoiceRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.AutocleaninvoiceResponse>(Request.AutoCleanInvoice req, ct=ct)
[<Extension>]
static member CheckMessageAsync(this: ClnClient, req: Requests.CheckmessageRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.CheckmessageResponse>(Request.CheckMessage req, ct=ct)
[<Extension>]
static member CloseAsync(this: ClnClient, req: Requests.CloseRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.CloseResponse>(Request.Close req, ct=ct)
[<Extension>]
static member ConnectPeerAsync(this: ClnClient, req: Requests.ConnectRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.ConnectResponse>(Request.ConnectPeer req, ct=ct)
[<Extension>]
static member CreateInvoiceAsync(this: ClnClient, req: Requests.CreateinvoiceRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.CreateinvoiceResponse>(Request.CreateInvoice req, ct=ct)
[<Extension>]
static member DatastoreAsync(this: ClnClient, req: Requests.DatastoreRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.DatastoreResponse>(Request.Datastore req, ct=ct)
[<Extension>]
static member CreateOnionAsync(this: ClnClient, req: Requests.CreateonionRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.CreateonionResponse>(Request.CreateOnion req, ct=ct)
[<Extension>]
static member DelDatastoreAsync(this: ClnClient, req: Requests.DeldatastoreRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.DeldatastoreResponse>(Request.DelDatastore req, ct=ct)
[<Extension>]
static member DelExpiredInvoiceAsync(this: ClnClient, req: Requests.DelexpiredinvoiceRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync(Request.DelExpiredInvoice req, ct=ct) :> Task
[<Extension>]
static member DelInvoiceAsync(this: ClnClient, req: Requests.DelinvoiceRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.DelinvoiceResponse>(Request.DelInvoice req, ct=ct)
[<Extension>]
static member InvoiceAsync(this: ClnClient, req: Requests.InvoiceRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.InvoiceResponse>(Request.Invoice req, ct=ct)
[<Extension>]
static member ListDatastoreAsync(this: ClnClient, req: Requests.ListdatastoreRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.ListdatastoreResponse>(Request.ListDatastore req, ct=ct)
[<Extension>]
static member ListInvoicesAsync(this: ClnClient, req: Requests.ListinvoicesRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.ListinvoicesResponse>(Request.ListInvoices req, ct=ct)
[<Extension>]
static member SendOnionAsync(this: ClnClient, req: Requests.SendonionRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.SendonionResponse>(Request.SendOnion req, ct=ct)
[<Extension>]
static member ListSendPaysAsync(this: ClnClient, req: Requests.ListsendpaysRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.ListsendpaysResponse>(Request.ListSendPays req, ct=ct)
[<Extension>]
static member ListTransactionsAsync(this: ClnClient, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.ListtransactionsResponse>("listtransactions", null, ct=ct)
[<Extension>]
static member PayAsync(this: ClnClient, req: Requests.PayRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.PayResponse>(Request.Pay req, ct=ct)
[<Extension>]
static member ListNodesAsync(this: ClnClient, req: Requests.ListnodesRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.ListnodesResponse>(Request.ListNodes req, ct=ct)
[<Extension>]
static member WaitAnyInvoiceAsync(this: ClnClient, req: Requests.WaitanyinvoiceRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.WaitanyinvoiceResponse>(Request.WaitAnyInvoice req, ct=ct)
[<Extension>]
static member WaitInvoiceAsync(this: ClnClient, req: Requests.WaitinvoiceRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.WaitinvoiceResponse>(Request.WaitInvoice req, ct=ct)
[<Extension>]
static member WaitSendPayAsync(this: ClnClient, req: Requests.WaitsendpayRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.WaitsendpayResponse>(Request.WaitSendPay req, ct=ct)
[<Extension>]
static member NewAddrAsync(this: ClnClient, req: Requests.NewaddrRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.NewaddrResponse>(Request.NewAddr req, ct=ct)
[<Extension>]
static member WithdrawAsync(this: ClnClient, req: Requests.WithdrawRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.WithdrawResponse>(Request.Withdraw req, ct=ct)
[<Extension>]
static member KeySendAsync(this: ClnClient, req: Requests.KeysendRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.KeysendResponse>(Request.KeySend req, ct=ct)
[<Extension>]
static member FundPsbtAsync(this: ClnClient, req: Requests.FundpsbtRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.FundpsbtResponse>(Request.FundPsbt req, ct=ct)
[<Extension>]
static member SendPsbtAsync(this: ClnClient, req: Requests.SendpsbtRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.SendpsbtResponse>(Request.SendPsbt req, ct=ct)
[<Extension>]
static member SignPsbtAsync(this: ClnClient, req: Requests.SignpsbtRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.SignpsbtResponse>(Request.SignPsbt req, ct=ct)
[<Extension>]
static member UtxoPsbtAsync(this: ClnClient, req: Requests.UtxopsbtRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.UtxopsbtResponse>(Request.UtxoPsbt req, ct=ct)
[<Extension>]
static member TxDiscardAsync(this: ClnClient, req: Requests.TxdiscardRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.TxdiscardResponse>(Request.TxDiscard req, ct=ct)
[<Extension>]
static member TxPrepareAsync(this: ClnClient, req: Requests.TxprepareRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.TxprepareResponse>(Request.TxPrepare req, ct=ct)
[<Extension>]
static member TxSendAsync(this: ClnClient, req: Requests.TxsendRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.TxsendResponse>(Request.TxSend req, ct=ct)
[<Extension>]
static member DisconnectAsync(this: ClnClient, req: Requests.DisconnectRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync(Request.Disconnect req, ct=ct) :> Task
[<Extension>]
static member FeeratesAsync(this: ClnClient, req: Requests.FeeratesRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.FeeratesResponse>(Request.Feerates req, ct=ct)
[<Extension>]
static member GetRouteAsync(this: ClnClient, req: Requests.GetrouteRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.GetrouteResponse>(Request.GetRoute req, ct=ct)
[<Extension>]
static member ListForwardsAsync(this: ClnClient, req: Requests.ListforwardsRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.ListforwardsResponse>(Request.ListForwards req, ct=ct)
[<Extension>]
static member ListPaysAsync(this: ClnClient, req: Requests.ListpaysRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.ListpaysResponse>(Request.ListPays req, ct=ct)
[<Extension>]
static member PingAsync(this: ClnClient, req: Requests.PingRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.PingResponse>(Request.Ping req, ct=ct)
[<Extension>]
static member SignMessageAsync(this: ClnClient, req: Requests.SignmessageRequest, [<Optional;DefaultParameterValue(CancellationToken())>] ct: CancellationToken) =
this.SendCommandAsync<Responses.SignmessageResponse>(Request.SignMessage req, ct=ct)
Loading

0 comments on commit 4c0b066

Please sign in to comment.