File tree Expand file tree Collapse file tree
lightning-liquidity/src/lsps5 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,9 +30,9 @@ pub enum LSPS5ServiceEvent {
3030 /// via their registered webhook.
3131 ///
3232 /// The LSP should send an HTTP POST to the [`url`], using the
33- /// JSON-serialized [`notification`] as the body and including the `headers`.
34- /// If the HTTP request fails, the LSP may implement a retry policy according to its
35- /// implementation preferences.
33+ /// JSON-serialized [`notification`] (via [`WebhookNotification::to_request_body`]) as the body
34+ /// and including the `headers`. If the HTTP request fails, the LSP may implement a retry
35+ /// policy according to its implementation preferences.
3636 ///
3737 /// The notification is signed using the LSP's node ID to ensure authenticity
3838 /// when received by the client. The client verifies this signature using
Original file line number Diff line number Diff line change @@ -565,6 +565,12 @@ impl WebhookNotification {
565565 pub fn onion_message_incoming ( ) -> Self {
566566 Self { method : WebhookNotificationMethod :: LSPS5OnionMessageIncoming }
567567 }
568+
569+ /// Encodes this notification into JSON which can be sent as the body of an HTTP request to
570+ /// deliver the notification.
571+ pub fn to_request_body ( & self ) -> String {
572+ serde_json:: to_string ( self ) . unwrap ( )
573+ }
568574}
569575
570576impl Serialize for WebhookNotification {
You can’t perform that action at this time.
0 commit comments