fedimint_gw_client

Trait IGatewayClientV1

Source
pub trait IGatewayClientV1:
    Debug
    + Send
    + Sync {
    // Required methods
    fn verify_preimage_authentication<'life0, 'async_trait>(
        &'life0 self,
        payment_hash: Hash,
        preimage_auth: Hash,
        contract: OutgoingContractAccount,
    ) -> Pin<Box<dyn Future<Output = Result<(), OutgoingPaymentError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn verify_pruned_invoice<'life0, 'async_trait>(
        &'life0 self,
        payment_data: PaymentData,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_routing_fees<'life0, 'async_trait>(
        &'life0 self,
        federation_id: FederationId,
    ) -> Pin<Box<dyn Future<Output = Option<RoutingFees>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_client<'life0, 'life1, 'async_trait>(
        &'life0 self,
        federation_id: &'life1 FederationId,
    ) -> Pin<Box<dyn Future<Output = Option<Spanned<ClientHandleArc>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_client_for_invoice<'life0, 'async_trait>(
        &'life0 self,
        payment_data: PaymentData,
    ) -> Pin<Box<dyn Future<Output = Option<Spanned<ClientHandleArc>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn pay<'life0, 'async_trait>(
        &'life0 self,
        payment_data: PaymentData,
        max_delay: u64,
        max_fee: Amount,
    ) -> Pin<Box<dyn Future<Output = Result<PayInvoiceResponse, LightningRpcError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn complete_htlc<'life0, 'async_trait>(
        &'life0 self,
        htlc_response: InterceptPaymentResponse,
    ) -> Pin<Box<dyn Future<Output = Result<(), LightningRpcError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: '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 them is expressed as a trait. The gateway handles operations that require Lightning node access or database access.

Required Methods§

Source

fn verify_preimage_authentication<'life0, 'async_trait>( &'life0 self, payment_hash: Hash, preimage_auth: Hash, contract: OutgoingContractAccount, ) -> Pin<Box<dyn Future<Output = Result<(), OutgoingPaymentError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Verifies that the supplied preimage_auth is the same as the preimage_auth that initiated the payment.

If it is not, then this will return an error because this client is not authorized to receive the preimage.

Source

fn verify_pruned_invoice<'life0, 'async_trait>( &'life0 self, payment_data: PaymentData, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Verify that the lightning node supports private payments if a pruned invoice is supplied.

Source

fn get_routing_fees<'life0, 'async_trait>( &'life0 self, federation_id: FederationId, ) -> Pin<Box<dyn Future<Output = Option<RoutingFees>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves the federation’s routing fees from the federation’s config.

Source

fn get_client<'life0, 'life1, 'async_trait>( &'life0 self, federation_id: &'life1 FederationId, ) -> Pin<Box<dyn Future<Output = Option<Spanned<ClientHandleArc>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve a client given a federation ID, used for swapping ecash between federations.

Source

fn get_client_for_invoice<'life0, 'async_trait>( &'life0 self, payment_data: PaymentData, ) -> Pin<Box<dyn Future<Output = Option<Spanned<ClientHandleArc>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn pay<'life0, 'async_trait>( &'life0 self, payment_data: PaymentData, max_delay: u64, max_fee: Amount, ) -> Pin<Box<dyn Future<Output = Result<PayInvoiceResponse, LightningRpcError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Pay a Lightning invoice using the gateway’s lightning node.

Source

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

Use the gateway’s lightning node to send a complete HTLC response.

Implementors§