-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//! Holds a payment handler allowing to create and pay [BOLT 12] offers and refunds. | ||
//! | ||
//! [BOLT 12]: https://github.com/lightning/bolts/blob/master/12-offer-encoding.md | ||
use crate::config::Config; | ||
use crate::connection::ConnectionManager; | ||
use crate::logger::FilesystemLogger; | ||
use crate::payment::payment_store::PaymentStore; | ||
use crate::peer_store::PeerStore; | ||
use crate::types::{ChannelManager, KeysManager}; | ||
|
||
use std::sync::{Arc, RwLock}; | ||
|
||
/// A payment handler allowing to create and pay [BOLT 12] offers and refunds. | ||
/// | ||
/// Should be retrieved by calling [`Node::bolt12_payment`]. | ||
/// | ||
/// [BOLT 12]: https://github.com/lightning/bolts/blob/master/12-offer-encoding.md | ||
/// [`Node::bolt12_payment`]: crate::Node::bolt12_payment | ||
pub struct Bolt12PaymentHandler { | ||
runtime: Arc<RwLock<Option<tokio::runtime::Runtime>>>, | ||
channel_manager: Arc<ChannelManager>, | ||
connection_manager: Arc<ConnectionManager<Arc<FilesystemLogger>>>, | ||
keys_manager: Arc<KeysManager>, | ||
payment_store: Arc<PaymentStore<Arc<FilesystemLogger>>>, | ||
peer_store: Arc<PeerStore<Arc<FilesystemLogger>>>, | ||
config: Arc<Config>, | ||
logger: Arc<FilesystemLogger>, | ||
} | ||
|
||
impl Bolt12PaymentHandler { | ||
pub(crate) fn new( | ||
runtime: Arc<RwLock<Option<tokio::runtime::Runtime>>>, | ||
channel_manager: Arc<ChannelManager>, | ||
connection_manager: Arc<ConnectionManager<Arc<FilesystemLogger>>>, | ||
keys_manager: Arc<KeysManager>, payment_store: Arc<PaymentStore<Arc<FilesystemLogger>>>, | ||
peer_store: Arc<PeerStore<Arc<FilesystemLogger>>>, config: Arc<Config>, | ||
logger: Arc<FilesystemLogger>, | ||
) -> Self { | ||
Self { | ||
runtime, | ||
channel_manager, | ||
connection_manager, | ||
keys_manager, | ||
payment_store, | ||
peer_store, | ||
config, | ||
logger, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
//! Objects for different types of payments. | ||
mod bolt11; | ||
mod bolt12; | ||
mod onchain; | ||
pub(crate) mod payment_store; | ||
mod spontaneous; | ||
|
||
pub use bolt11::Bolt11PaymentHandler; | ||
pub use bolt12::Bolt12PaymentHandler; | ||
pub use onchain::OnchainPaymentHandler; | ||
pub use payment_store::{LSPFeeLimits, PaymentDetails, PaymentDirection, PaymentStatus}; | ||
pub use spontaneous::SpontaneousPaymentHandler; |