fedimint_gwv2_client

Trait IGatewayClientV2

Source
pub trait IGatewayClientV2:
    Debug
    + Send
    + Sync {
    // Required methods
    fn complete_htlc<'life0, 'async_trait>(
        &'life0 self,
        htlc_response: InterceptPaymentResponse,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_direct_swap<'life0, 'life1, 'async_trait>(
        &'life0 self,
        invoice: &'life1 Bolt11Invoice,
    ) -> Pin<Box<dyn Future<Output = Result<Option<(IncomingContract, ClientHandleArc)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn pay<'life0, 'async_trait>(
        &'life0 self,
        invoice: Bolt11Invoice,
        max_delay: u64,
        max_fee: Amount,
    ) -> Pin<Box<dyn Future<Output = Result<[u8; 32], LightningRpcError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn min_contract_amount<'life0, 'life1, 'async_trait>(
        &'life0 self,
        federation_id: &'life1 FederationId,
        amount: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Amount>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

An interface between module implementation and the general Gateway

To abstract away and decouple the core gateway from the modules, the interface between the is expressed as a trait. The core gateway handles LNv2 operations that require access to the database or lightning node.

Required Methods§

Source

fn complete_htlc<'life0, 'async_trait>( &'life0 self, htlc_response: InterceptPaymentResponse, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Use the gateway’s lightning node to complete a payment

Source

fn is_direct_swap<'life0, 'life1, 'async_trait>( &'life0 self, invoice: &'life1 Bolt11Invoice, ) -> Pin<Box<dyn Future<Output = Result<Option<(IncomingContract, ClientHandleArc)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Determines if the payment can be completed using a direct swap to another federation.

A direct swap is determined by checking the gateway’s connected lightning node against the invoice’s payee lightning node. If they are the same, then the gateway can use another client to complete the payment be swapping ecash instead of a payment over the Lightning network.

Source

fn pay<'life0, 'async_trait>( &'life0 self, invoice: Bolt11Invoice, max_delay: u64, max_fee: Amount, ) -> Pin<Box<dyn Future<Output = Result<[u8; 32], LightningRpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initiates a payment over the Lightning network.

Source

fn min_contract_amount<'life0, 'life1, 'async_trait>( &'life0 self, federation_id: &'life1 FederationId, amount: u64, ) -> Pin<Box<dyn Future<Output = Result<Amount>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Computes the minimum contract amount necessary for making an outgoing payment.

The minimum contract amount must contain transaction fees to cover the gateway’s transaction fee and optionally additional fee to cover the gateway’s Lightning fee if the payment goes over the Lightning network.

Implementors§