Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ env_logger = "0.10"
cln-grpc = "0.4"
cln-rpc = "0.4"
cln-plugin = "0.4"
tonic = "0.11"

vls-core = "^0.14"
vls-persist = "^0.14"
Expand Down
13 changes: 7 additions & 6 deletions libs/gl-client-py/glclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,21 +448,22 @@ def stream_log(self):
break
yield nodepb.LogEntry.FromString(bytes(n))

def stream_incoming(self):
stream = self.inner.stream_incoming(b"")
def stream_custommsg(self):
stream = self.inner.stream_custommsg(b"")
while True:
n = stream.next()
if n is None:
break
yield nodepb.IncomingPayment.FromString(bytes(n))
yield nodepb.Custommsg.FromString(bytes(n))

def stream_custommsg(self):
stream = self.inner.stream_custommsg(b"")
def stream_node_events(self):
"""Stream node events (invoice payments, peer changes, etc.) as they occur."""
stream = self.inner.stream_node_events(b"")
while True:
n = stream.next()
if n is None:
break
yield nodepb.Custommsg.FromString(bytes(n))
yield nodepb.NodeEvent.FromString(bytes(n))

def send_custommsg(self, node_id: str, msg: bytes) -> clnpb.SendcustommsgResponse:
uri = "/cln.Node/SendCustomMsg"
Expand Down
47 changes: 43 additions & 4 deletions libs/gl-client-py/glclient/greenlight.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ service Node {
//
// Currently includes off-chain payments received matching an
// invoice or spontaneus paymens through keysend.
rpc StreamIncoming(StreamIncomingFilter) returns (stream IncomingPayment) {}

// Stream the logs as they are produced by the node
//
Expand All @@ -43,6 +42,14 @@ service Node {
// replayed if the stream is interrupted.
rpc StreamCustommsg(StreamCustommsgRequest) returns (stream Custommsg) {}

// Stream node events in real-time.
//
// This is a unified event stream that delivers various node events
// as they occur, including invoice updates, peer changes, channel
// state changes, and balance updates. Events are not persisted and
// will not be replayed if the stream is interrupted.
rpc StreamNodeEvents(NodeEventsRequest) returns (stream NodeEvent) {}

//////////////////////////////// HSM Messages ////////////////////////
//
// The following messages are related to communicating HSM
Expand Down Expand Up @@ -113,9 +120,6 @@ message Amount {
}
}

// Options to stream_incoming to specify what to stream.
message StreamIncomingFilter {
}

message TlvField {
uint64 type = 1;
Expand Down Expand Up @@ -243,3 +247,38 @@ message LspInvoiceResponse {
bytes payment_hash = 4;
bytes payment_secret = 5;
}

// Request for streaming node events. Currently empty but defined as
// its own message type to allow adding filters in the future (e.g.,
// filter by event type, invoice label, etc.)
message NodeEventsRequest {
}

// A real-time event from the node. Uses oneof to discriminate between
// different event types.
message NodeEvent {
oneof event {
InvoicePaid invoice_paid = 1;
// Future event types:
// PeerConnected peer_connected = 2;
// PeerDisconnected peer_disconnected = 3;
// ChannelStateChanged channel_state_changed = 4;
// BalanceChanged balance_changed = 5;
}
}

// Event emitted when an invoice is paid.
message InvoicePaid {
// The payment hash of the paid invoice.
bytes payment_hash = 1;
// The bolt11 invoice string.
string bolt11 = 2;
// The preimage that proves payment.
bytes preimage = 3;
// The label assigned to the invoice.
string label = 4;
// Amount received in millisatoshis.
uint64 amount_msat = 5;
// Extra TLV fields included in the payment.
repeated TlvField extratlvs = 6;
}
86 changes: 45 additions & 41 deletions libs/gl-client-py/glclient/greenlight_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading