forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cln-grpc: Add generation of grpc protobuf file from schema
- Loading branch information
Showing
7 changed files
with
431 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cln-grpc-wrongdir: | ||
$(MAKE) -C .. cln-grpc-all | ||
|
||
CLN_GRPC_EXAMPLES := | ||
CLN_GRPC_GENALL = cln-grpc/proto/node.proto | ||
DEFAULT_TARGETS += $(CLN_GRPC_EXAMPLES) $(CLN_GRPC_GENALL) | ||
|
||
$(CLN_GRPC_GENALL): $(JSON_SCHEMA) | ||
PYTHONPATH=contrib/msggen python3 contrib/msggen/msggen/__main__.py | ||
|
||
cln-grpc-all: ${CLN_GRPC_GENALL} ${CLN_GRPC_EXAMPLES} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
syntax = "proto3"; | ||
package cln; | ||
|
||
// This file was automatically derived from the JSON-RPC schemas in | ||
// `doc/schemas`. Do not edit this file manually as it would get | ||
// overwritten. | ||
|
||
import "primitives.proto"; | ||
|
||
service Node { | ||
rpc Getinfo(GetinfoRequest) returns (GetinfoResponse) {} | ||
rpc ListFunds(ListfundsRequest) returns (ListfundsResponse) {} | ||
rpc ListChannels(ListchannelsRequest) returns (ListchannelsResponse) {} | ||
rpc AddGossip(AddgossipRequest) returns (AddgossipResponse) {} | ||
rpc AutoCleanInvoice(AutocleaninvoiceRequest) returns (AutocleaninvoiceResponse) {} | ||
rpc CheckMessage(CheckmessageRequest) returns (CheckmessageResponse) {} | ||
rpc Close(CloseRequest) returns (CloseResponse) {} | ||
} | ||
|
||
message GetinfoRequest { | ||
} | ||
|
||
message GetinfoResponse { | ||
bytes id = 1; | ||
string alias = 2; | ||
bytes color = 3; | ||
uint32 num_peers = 4; | ||
uint32 num_pending_channels = 5; | ||
uint32 num_active_channels = 6; | ||
uint32 num_inactive_channels = 7; | ||
string version = 8; | ||
string lightning_dir = 9; | ||
uint32 blockheight = 10; | ||
string network = 11; | ||
Amount fees_collected_msat = 12; | ||
repeated GetinfoAddress address = 13; | ||
repeated GetinfoBinding binding = 14; | ||
optional string warning_bitcoind_sync = 15; | ||
optional string warning_lightningd_sync = 16; | ||
} | ||
|
||
message GetinfoAddress { | ||
// Getinfo.address[].type | ||
enum GetinfoAddressType { | ||
DNS = 0; | ||
IPV4 = 1; | ||
IPV6 = 2; | ||
TORV2 = 3; | ||
TORV3 = 4; | ||
WEBSOCKET = 5; | ||
} | ||
GetinfoAddressType item_type = 1; | ||
uint32 port = 2; | ||
optional string address = 3; | ||
} | ||
|
||
message GetinfoBinding { | ||
// Getinfo.binding[].type | ||
enum GetinfoBindingType { | ||
LOCAL_SOCKET = 0; | ||
IPV4 = 1; | ||
IPV6 = 2; | ||
TORV2 = 3; | ||
TORV3 = 4; | ||
} | ||
GetinfoBindingType item_type = 1; | ||
optional string address = 2; | ||
optional uint32 port = 3; | ||
optional string socket = 4; | ||
} | ||
|
||
message ListfundsRequest { | ||
optional bool spent = 1; | ||
} | ||
|
||
message ListfundsResponse { | ||
repeated ListfundsOutputs outputs = 1; | ||
repeated ListfundsChannels channels = 2; | ||
} | ||
|
||
message ListfundsOutputs { | ||
// ListFunds.outputs[].status | ||
enum ListfundsOutputsStatus { | ||
UNCONFIRMED = 0; | ||
CONFIRMED = 1; | ||
SPENT = 2; | ||
} | ||
bytes txid = 1; | ||
uint32 output = 2; | ||
Amount amount_msat = 3; | ||
bytes scriptpubkey = 4; | ||
optional string address = 5; | ||
optional bytes redeemscript = 6; | ||
ListfundsOutputsStatus status = 7; | ||
optional uint32 blockheight = 8; | ||
} | ||
|
||
message ListfundsChannels { | ||
bytes peer_id = 1; | ||
Amount our_amount_msat = 2; | ||
Amount amount_msat = 3; | ||
bytes funding_txid = 4; | ||
uint32 funding_output = 5; | ||
bool connected = 6; | ||
ChannelState state = 7; | ||
optional string short_channel_id = 8; | ||
} | ||
|
||
message ListchannelsRequest { | ||
optional string short_channel_id = 1; | ||
optional bytes source = 2; | ||
optional bytes destination = 3; | ||
} | ||
|
||
message ListchannelsResponse { | ||
repeated ListchannelsChannels channels = 1; | ||
} | ||
|
||
message ListchannelsChannels { | ||
bytes source = 1; | ||
bytes destination = 2; | ||
bool public = 3; | ||
Amount amount_msat = 4; | ||
uint32 message_flags = 5; | ||
uint32 channel_flags = 6; | ||
bool active = 7; | ||
uint32 last_update = 8; | ||
uint32 base_fee_millisatoshi = 9; | ||
uint32 fee_per_millionth = 10; | ||
uint32 delay = 11; | ||
Amount htlc_minimum_msat = 12; | ||
optional Amount htlc_maximum_msat = 13; | ||
bytes features = 14; | ||
} | ||
|
||
message AddgossipRequest { | ||
bytes message = 1; | ||
} | ||
|
||
message AddgossipResponse { | ||
} | ||
|
||
message AutocleaninvoiceRequest { | ||
optional uint64 expired_by = 1; | ||
optional uint64 cycle_seconds = 2; | ||
} | ||
|
||
message AutocleaninvoiceResponse { | ||
bool enabled = 1; | ||
optional uint64 expired_by = 2; | ||
optional uint64 cycle_seconds = 3; | ||
} | ||
|
||
message CheckmessageRequest { | ||
string message = 1; | ||
string zbase = 2; | ||
optional bytes pubkey = 3; | ||
} | ||
|
||
message CheckmessageResponse { | ||
bool verified = 1; | ||
optional bytes pubkey = 2; | ||
} | ||
|
||
message CloseRequest { | ||
bytes id = 1; | ||
optional uint32 unilateraltimeout = 2; | ||
optional string destination = 3; | ||
optional string fee_negotiation_step = 4; | ||
optional bytes wrong_funding = 5; | ||
optional bool force_lease_closed = 6; | ||
} | ||
|
||
message CloseResponse { | ||
// Close.type | ||
enum CloseType { | ||
MUTUAL = 0; | ||
UNILATERAL = 1; | ||
UNOPENED = 2; | ||
} | ||
CloseType item_type = 1; | ||
optional bytes tx = 2; | ||
optional bytes txid = 3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
syntax = "proto3"; | ||
package cln; | ||
|
||
message Amount { | ||
oneof unit { | ||
uint64 millisatoshi = 1; | ||
uint64 satoshi = 2; | ||
uint64 bitcoin = 3; | ||
bool all = 4; | ||
bool any = 5; | ||
} | ||
} | ||
|
||
enum ChannelSide { | ||
IN = 0; | ||
OUT = 1; | ||
} | ||
|
||
enum ChannelState { | ||
Openingd = 0; | ||
ChanneldAwaitingLockin = 1; | ||
ChanneldNormal = 2; | ||
ChanneldShuttingDown = 3; | ||
ClosingdSigexchange = 4; | ||
ClosingdComplete = 5; | ||
AwaitingUnilateral = 6; | ||
FundingSpendSeen = 7; | ||
Onchain = 8; | ||
DualopendOpenInit = 9; | ||
DualopendAwaitingLockin = 10; | ||
} | ||
|
||
message ChannelStateChangeCause {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.