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
+
1
10
//! Contains LSPS1 event types
2
11
3
12
use super :: msgs:: { ChannelInfo , OptionsSupported , OrderId , OrderParams , OrderPayment } ;
@@ -10,62 +19,103 @@ use bitcoin::secp256k1::PublicKey;
10
19
/// An event which an LSPS1 client should take some action in response to.
11
20
#[ derive( Clone , Debug , PartialEq , Eq ) ]
12
21
pub 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
14
28
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
16
35
id : u128 ,
17
- /// TODO
36
+ /// An identifier to track messages received.
18
37
request_id : RequestId ,
19
- /// TODO
38
+ /// The node id of the LSP that provided this response.
20
39
counterparty_node_id : PublicKey ,
21
- /// TODO
40
+ /// The website of the LSP.
22
41
website : String ,
23
- /// TODO
42
+ /// All options supported by the LSP.
24
43
options_supported : OptionsSupported ,
25
44
} ,
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
27
55
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
29
61
id : u128 ,
30
- /// TODO
62
+ /// The node id of the LSP.
31
63
counterparty_node_id : PublicKey ,
32
- /// TODO
64
+ /// The order created by client and approved by LSP.
33
65
order : OrderParams ,
34
- /// TODO
66
+ /// The details regarding payment of the order
35
67
payment : OrderPayment ,
36
- /// TODO
68
+ /// The details regarding state of the channel ordered.
37
69
channel : Option < ChannelInfo > ,
38
70
} ,
39
71
}
40
72
41
73
/// An event which an LSPS1 server should take some action in response to.
42
74
#[ derive( Clone , Debug , PartialEq , Eq ) ]
43
75
pub 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
45
84
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
47
88
request_id : RequestId ,
48
- /// TODO
89
+ /// The node id of the client making the information request.
49
90
counterparty_node_id : PublicKey ,
50
- /// TODO
91
+ /// The order requested by the client.
51
92
order : OrderParams ,
52
93
} ,
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
54
102
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
56
106
request_id : RequestId ,
57
- /// TODO
107
+ /// The node id of the client making the information request.
58
108
counterparty_node_id : PublicKey ,
59
- /// TODO
109
+ /// The order id of order with pending payment.
60
110
order_id : OrderId ,
61
111
} ,
62
- /// TODO
112
+ /// If error is encountered, refund the amount if paid by the client.
63
113
Refund {
64
- /// TODO
114
+ /// An identifier.
65
115
request_id : RequestId ,
66
- /// TODO
116
+ /// The node id of the client making the information request.
67
117
counterparty_node_id : PublicKey ,
68
- /// TODO
118
+ /// The order id of the refunded order.
69
119
order_id : OrderId ,
70
120
} ,
71
121
}
0 commit comments