1+ // This file is Copyright its original authors, visible in version control
2+ // history.
3+ //
4+ // This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
5+ // or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
7+ // You may not use this file except in accordance with one or both of these
8+ // licenses.
9+
110//! Contains LSPS1 event types
211
312use super :: msgs:: { ChannelInfo , OptionsSupported , OrderId , OrderParams , OrderPayment } ;
@@ -10,62 +19,103 @@ use bitcoin::secp256k1::PublicKey;
1019/// An event which an LSPS1 client should take some action in response to.
1120#[ derive( Clone , Debug , PartialEq , Eq ) ]
1221pub enum LSPS1ClientEvent {
13- /// TODO
22+ /// Information from the LSP about their supported protocol options.
23+ ///
24+ /// You must check whether LSP supports the parameters the client wants and then call
25+ /// [`LSPS1ClientHandler::place_order`] to place an order.
26+ ///
27+ /// [`LSPS1ClientHandler::place_order`]: crate::lsps1::client::LSPS1ClientHandler::place_order
1428 GetInfoResponse {
15- /// TODO
29+ /// This is a randomly generated identifier used to track the channel state.
30+ ///
31+ /// It is not related in anyway to the eventual lightning channel id.
32+ /// It needs to be passed to [`LSPS1ClientHandler::place_order`].
33+ ///
34+ /// [`LSPS1ClientHandler::place_order`]: crate::lsps1::client::LSPS1ClientHandler::place_order
1635 id : u128 ,
17- /// TODO
36+ /// An identifier to track messages received.
1837 request_id : RequestId ,
19- /// TODO
38+ /// The node id of the LSP that provided this response.
2039 counterparty_node_id : PublicKey ,
21- /// TODO
40+ /// The website of the LSP.
2241 website : String ,
23- /// TODO
42+ /// All options supported by the LSP.
2443 options_supported : OptionsSupported ,
2544 } ,
26- /// TODO
45+ /// Confirmation from the LSP about the order created by the client.
46+ ///
47+ /// When the payment is confirmed, the LSP will open a channel to you
48+ /// with the below agreed upon parameters.
49+ ///
50+ /// You must pay the invoice if you want to continue and then
51+ /// call [`LSPS1ClientHandler::check_order_status`] with the order id
52+ /// to get information from LSP about progress of the order.
53+ ///
54+ /// [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status
2755 DisplayOrder {
28- /// TODO
56+ /// This is a randomly generated identifier used to track the channel state.
57+ /// It is not related in anyway to the eventual lightning channel id.
58+ /// It needs to be passed to [`LSPS1ClientHandler::check_order_status`].
59+ ///
60+ /// [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status
2961 id : u128 ,
30- /// TODO
62+ /// The node id of the LSP.
3163 counterparty_node_id : PublicKey ,
32- /// TODO
64+ /// The order created by client and approved by LSP.
3365 order : OrderParams ,
34- /// TODO
66+ /// The details regarding payment of the order
3567 payment : OrderPayment ,
36- /// TODO
68+ /// The details regarding state of the channel ordered.
3769 channel : Option < ChannelInfo > ,
3870 } ,
3971}
4072
4173/// An event which an LSPS1 server should take some action in response to.
4274#[ derive( Clone , Debug , PartialEq , Eq ) ]
4375pub enum LSPS1ServiceEvent {
44- /// TODO
76+ /// A client has selected the parameters to use from the supported options of the LSP
77+ /// and would like to open a channel with the given payment parameters.
78+ ///
79+ /// You must call [`LSPS1ServiceHandler::send_invoice_for_order`] to
80+ /// generate a complete invoice including the details regarding the
81+ /// payment and order id for this order for the client.
82+ ///
83+ /// [`LSPS1ServiceHandler::send_invoice_for_order`]: crate::lsps1::service::LSPS1ServiceHandler::send_invoice_for_order
4584 CreateInvoice {
46- /// TODO
85+ /// An identifier that must be passed to [`LSPS1ServiceHandler::send_invoice_for_order`].
86+ ///
87+ /// [`LSPS1ServiceHandler::send_invoice_for_order`]: crate::lsps1::service::LSPS1ServiceHandler::send_invoice_for_order
4788 request_id : RequestId ,
48- /// TODO
89+ /// The node id of the client making the information request.
4990 counterparty_node_id : PublicKey ,
50- /// TODO
91+ /// The order requested by the client.
5192 order : OrderParams ,
5293 } ,
53- /// TODO
94+ /// A request from client to check the status of the payment.
95+ ///
96+ /// An event to poll for checking payment status either onchain or lightning.
97+ ///
98+ /// You must call [`LSPS1ServiceHandler::update_order_status`] to update the client
99+ /// regarding the status of the payment and order.
100+ ///
101+ /// [`LSPS1ServiceHandler::update_order_status`]: crate::lsps1::service::LSPS1ServiceHandler::update_order_status
54102 CheckPaymentConfirmation {
55- /// TODO
103+ /// An identifier that must be passed to [`LSPS1ServiceHandler::update_order_status`].
104+ ///
105+ /// [`LSPS1ServiceHandler::update_order_status`]: crate::lsps1::service::LSPS1ServiceHandler::update_order_status
56106 request_id : RequestId ,
57- /// TODO
107+ /// The node id of the client making the information request.
58108 counterparty_node_id : PublicKey ,
59- /// TODO
109+ /// The order id of order with pending payment.
60110 order_id : OrderId ,
61111 } ,
62- /// TODO
112+ /// If error is encountered, refund the amount if paid by the client.
63113 Refund {
64- /// TODO
114+ /// An identifier.
65115 request_id : RequestId ,
66- /// TODO
116+ /// The node id of the client making the information request.
67117 counterparty_node_id : PublicKey ,
68- /// TODO
118+ /// The order id of the refunded order.
69119 order_id : OrderId ,
70120 } ,
71121}
0 commit comments