mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
1562 lines
33 KiB
Go
1562 lines
33 KiB
Go
// Code generated by falafel 0.9.1. DO NOT EDIT.
|
|
// source: lightning.proto
|
|
|
|
// +build js
|
|
|
|
package lnrpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
gateway "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
|
"google.golang.org/grpc"
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
)
|
|
|
|
func RegisterLightningJSONCallbacks(registry map[string]func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error))) {
|
|
|
|
marshaler := &gateway.JSONPb{
|
|
MarshalOptions: protojson.MarshalOptions{
|
|
UseProtoNames: true,
|
|
EmitUnpopulated: true,
|
|
},
|
|
}
|
|
|
|
registry["lnrpc.Lightning.WalletBalance"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &WalletBalanceRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.WalletBalance(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ChannelBalance"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ChannelBalanceRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ChannelBalance(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.GetTransactions"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &GetTransactionsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.GetTransactions(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.EstimateFee"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &EstimateFeeRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.EstimateFee(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.SendCoins"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &SendCoinsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.SendCoins(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ListUnspent"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListUnspentRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ListUnspent(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.SubscribeTransactions"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &GetTransactionsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
stream, err := client.SubscribeTransactions(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
go func() {
|
|
for {
|
|
select {
|
|
case <-stream.Context().Done():
|
|
callback("", stream.Context().Err())
|
|
return
|
|
default:
|
|
}
|
|
|
|
resp, err := stream.Recv()
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}()
|
|
}
|
|
|
|
registry["lnrpc.Lightning.SendMany"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &SendManyRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.SendMany(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.NewAddress"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &NewAddressRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.NewAddress(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.SignMessage"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &SignMessageRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.SignMessage(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.VerifyMessage"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &VerifyMessageRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.VerifyMessage(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ConnectPeer"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ConnectPeerRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ConnectPeer(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.DisconnectPeer"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &DisconnectPeerRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.DisconnectPeer(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ListPeers"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListPeersRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ListPeers(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.SubscribePeerEvents"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &PeerEventSubscription{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
stream, err := client.SubscribePeerEvents(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
go func() {
|
|
for {
|
|
select {
|
|
case <-stream.Context().Done():
|
|
callback("", stream.Context().Err())
|
|
return
|
|
default:
|
|
}
|
|
|
|
resp, err := stream.Recv()
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}()
|
|
}
|
|
|
|
registry["lnrpc.Lightning.GetInfo"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &GetInfoRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.GetInfo(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.GetRecoveryInfo"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &GetRecoveryInfoRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.GetRecoveryInfo(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.PendingChannels"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &PendingChannelsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.PendingChannels(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ListChannels"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListChannelsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ListChannels(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.SubscribeChannelEvents"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ChannelEventSubscription{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
stream, err := client.SubscribeChannelEvents(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
go func() {
|
|
for {
|
|
select {
|
|
case <-stream.Context().Done():
|
|
callback("", stream.Context().Err())
|
|
return
|
|
default:
|
|
}
|
|
|
|
resp, err := stream.Recv()
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}()
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ClosedChannels"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ClosedChannelsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ClosedChannels(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.OpenChannelSync"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &OpenChannelRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.OpenChannelSync(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.OpenChannel"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &OpenChannelRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
stream, err := client.OpenChannel(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
go func() {
|
|
for {
|
|
select {
|
|
case <-stream.Context().Done():
|
|
callback("", stream.Context().Err())
|
|
return
|
|
default:
|
|
}
|
|
|
|
resp, err := stream.Recv()
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}()
|
|
}
|
|
|
|
registry["lnrpc.Lightning.FundingStateStep"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &FundingTransitionMsg{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.FundingStateStep(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.CloseChannel"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &CloseChannelRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
stream, err := client.CloseChannel(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
go func() {
|
|
for {
|
|
select {
|
|
case <-stream.Context().Done():
|
|
callback("", stream.Context().Err())
|
|
return
|
|
default:
|
|
}
|
|
|
|
resp, err := stream.Recv()
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}()
|
|
}
|
|
|
|
registry["lnrpc.Lightning.AbandonChannel"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &AbandonChannelRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.AbandonChannel(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.SendPaymentSync"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &SendRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.SendPaymentSync(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.SendToRouteSync"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &SendToRouteRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.SendToRouteSync(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.AddInvoice"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &Invoice{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.AddInvoice(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ListInvoices"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListInvoiceRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ListInvoices(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.LookupInvoice"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &PaymentHash{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.LookupInvoice(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.SubscribeInvoices"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &InvoiceSubscription{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
stream, err := client.SubscribeInvoices(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
go func() {
|
|
for {
|
|
select {
|
|
case <-stream.Context().Done():
|
|
callback("", stream.Context().Err())
|
|
return
|
|
default:
|
|
}
|
|
|
|
resp, err := stream.Recv()
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}()
|
|
}
|
|
|
|
registry["lnrpc.Lightning.DecodePayReq"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &PayReqString{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.DecodePayReq(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ListPayments"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListPaymentsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ListPayments(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.DeleteAllPayments"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &DeleteAllPaymentsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.DeleteAllPayments(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.DescribeGraph"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ChannelGraphRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.DescribeGraph(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.GetNodeMetrics"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &NodeMetricsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.GetNodeMetrics(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.GetChanInfo"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ChanInfoRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.GetChanInfo(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.GetNodeInfo"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &NodeInfoRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.GetNodeInfo(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.QueryRoutes"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &QueryRoutesRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.QueryRoutes(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.GetNetworkInfo"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &NetworkInfoRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.GetNetworkInfo(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.StopDaemon"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &StopRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.StopDaemon(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.SubscribeChannelGraph"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &GraphTopologySubscription{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
stream, err := client.SubscribeChannelGraph(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
go func() {
|
|
for {
|
|
select {
|
|
case <-stream.Context().Done():
|
|
callback("", stream.Context().Err())
|
|
return
|
|
default:
|
|
}
|
|
|
|
resp, err := stream.Recv()
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}()
|
|
}
|
|
|
|
registry["lnrpc.Lightning.DebugLevel"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &DebugLevelRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.DebugLevel(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.FeeReport"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &FeeReportRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.FeeReport(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.UpdateChannelPolicy"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &PolicyUpdateRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.UpdateChannelPolicy(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ForwardingHistory"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ForwardingHistoryRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ForwardingHistory(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ExportChannelBackup"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ExportChannelBackupRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ExportChannelBackup(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ExportAllChannelBackups"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ChanBackupExportRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ExportAllChannelBackups(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.VerifyChanBackup"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ChanBackupSnapshot{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.VerifyChanBackup(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.RestoreChannelBackups"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &RestoreChanBackupRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.RestoreChannelBackups(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.SubscribeChannelBackups"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ChannelBackupSubscription{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
stream, err := client.SubscribeChannelBackups(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
go func() {
|
|
for {
|
|
select {
|
|
case <-stream.Context().Done():
|
|
callback("", stream.Context().Err())
|
|
return
|
|
default:
|
|
}
|
|
|
|
resp, err := stream.Recv()
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}()
|
|
}
|
|
|
|
registry["lnrpc.Lightning.BakeMacaroon"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &BakeMacaroonRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.BakeMacaroon(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ListMacaroonIDs"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListMacaroonIDsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ListMacaroonIDs(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.DeleteMacaroonID"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &DeleteMacaroonIDRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.DeleteMacaroonID(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
|
|
registry["lnrpc.Lightning.ListPermissions"] = func(ctx context.Context,
|
|
conn *grpc.ClientConn, reqJSON string, callback func(string, error)) {
|
|
|
|
req := &ListPermissionsRequest{}
|
|
err := marshaler.Unmarshal([]byte(reqJSON), req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
client := NewLightningClient(conn)
|
|
resp, err := client.ListPermissions(ctx, req)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
|
|
respBytes, err := marshaler.Marshal(resp)
|
|
if err != nil {
|
|
callback("", err)
|
|
return
|
|
}
|
|
callback(string(respBytes), nil)
|
|
}
|
|
}
|