33use std:: sync:: Arc ;
44
55use ractor:: { port:: OutputPortSubscriber , OutputPort } ;
6+ use serde:: { Deserialize , Serialize } ;
67
78use crate :: {
89 fiber:: { payment:: PaymentStatus , types:: Hash256 } ,
910 invoice:: CkbInvoiceStatus ,
1011} ;
1112
12- #[ derive( Clone , Debug , Eq , PartialEq ) ]
13+ #[ derive( Clone , Debug , Eq , PartialEq , Serialize , Deserialize ) ]
1314pub enum InvoiceUpdatedPayload {
1415 /// The invoice is open and can be paid.
1516 Open ,
@@ -28,7 +29,7 @@ pub enum InvoiceUpdatedPayload {
2829 /// The invoice is paid.
2930 Paid ,
3031}
31- #[ derive( Clone , Debug , Eq , PartialEq ) ]
32+ #[ derive( Clone , Debug , Eq , PartialEq , Serialize , Deserialize ) ]
3233pub struct InvoiceUpdatedEvent {
3334 pub invoice_hash : Hash256 ,
3435 pub payload : InvoiceUpdatedPayload ,
@@ -61,7 +62,7 @@ impl InvoiceUpdatedEvent {
6162}
6263
6364// but with additional information for downstream services.
64- #[ derive( Clone , Debug , Eq , PartialEq ) ]
65+ #[ derive( Clone , Debug , Eq , PartialEq , Serialize , Deserialize ) ]
6566pub enum PaymentUpdatedPayload {
6667 /// initial status, payment session is created, no HTLC is sent
6768 Created ,
@@ -72,7 +73,7 @@ pub enum PaymentUpdatedPayload {
7273 /// related HTLC is failed
7374 Failed ,
7475}
75- #[ derive( Clone , Debug , Eq , PartialEq ) ]
76+ #[ derive( Clone , Debug , Eq , PartialEq , Serialize , Deserialize ) ]
7677pub struct PaymentUpdatedEvent {
7778 pub payment_hash : Hash256 ,
7879 pub payload : PaymentUpdatedPayload ,
@@ -104,7 +105,7 @@ impl PaymentUpdatedEvent {
104105}
105106
106107/// Message sent from Store to publisher.
107- #[ derive( Clone , Debug , Eq , PartialEq ) ]
108+ #[ derive( Clone , Debug , Eq , PartialEq , Serialize , Deserialize ) ]
108109pub enum StoreUpdatedEvent {
109110 InvoiceUpdated ( InvoiceUpdatedEvent ) ,
110111 PaymentUpdated ( PaymentUpdatedEvent ) ,
0 commit comments