Skip to main content

PaymentObserver

Trait PaymentObserver 

Source
pub trait PaymentObserver: Send + Sync {
    // Required methods
    fn before_send<'life0, 'async_trait>(
        &'life0 self,
        payments: Vec<ProvisionalPayment>,
    ) -> Pin<Box<dyn Future<Output = Result<(), PaymentObserverError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn after_send<'life0, 'async_trait>(
        &'life0 self,
        updates: Vec<PaymentIdUpdate>,
    ) -> Pin<Box<dyn Future<Output = Result<(), PaymentObserverError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

This interface is used to observe outgoing Lightning, Spark, onchain Bitcoin and token payments.

before_send is called before a payment is made; if the implementation returns an error the payment is cancelled. after_send is called after a token payment has been broadcast to report its final payment id; it cannot cancel the payment and any error it returns is ignored.

Required Methods§

Source

fn before_send<'life0, 'async_trait>( &'life0 self, payments: Vec<ProvisionalPayment>, ) -> Pin<Box<dyn Future<Output = Result<(), PaymentObserverError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called before Lightning, Spark, onchain Bitcoin or token payments are made

Source

fn after_send<'life0, 'async_trait>( &'life0 self, updates: Vec<PaymentIdUpdate>, ) -> Pin<Box<dyn Future<Output = Result<(), PaymentObserverError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called after a token payment has been broadcast, mapping each provisional payment id reported by before_send to its final payment id

Implementors§