Skip to content

Commit

Permalink
Add send/receive to LN and testnet4
Browse files Browse the repository at this point in the history
  • Loading branch information
223880 committed Oct 11, 2024
1 parent 497df82 commit 3e88eaf
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/lightning/payments/receive.rs
Original file line number Diff line number Diff line change
@@ -1 +1,53 @@
use crate::lightning::{
invoice::Invoice,
keysend::{Keysend, KeysendResponse},
payment::{Payment, PaymentStatus},
utils::{get_invoice_amount, get_invoice_expiry},
};

fn main () {
let invoice = Invoice {
amount: 1000,
description: "test".to_string(),
description_hash: None,
expiry: 1000,
payment_hash: None,
payment_hash_algo: None,
payment_secret: None,
timestamp: None,
min_final_cltv_expiry: None,
fallback_address: None,
routing_info: None,
routes: None,
features: None,
signature: None,
};

}

impl Invoice {
pub fn new(amount: u64, description: String) -> Self {
Self {
amount,
description,
description_hash: None,
expiry: 1000,
payment_hash: None,
payment_hash_algo: None,
payment_secret: None,
timestamp: None,
min_final_cltv_expiry: None,
fallback_address: None,
routing_info: None,
routes: None,
features: None,
signature: None,
}
}
pub fn get_invoice_amount(&self) -> u64 {
self.amount
}
pub fn get_invoice_expiry(&self) -> u64 {
self.expiry
}
}
34 changes: 34 additions & 0 deletions src/lightning/payments/send.rs
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
use ldk_node::LightningNode;
use lightning::ln::channelmanager::ChannelManager;
use lightning::invoice::Invoice;

fn main () {
let node = LightningNode::new();
let channel_manager = ChannelManager::new();
let invoice = Invoice::new();
}

impl LightningNode {
pub fn new() -> Self {
LightningNode {
channel_manager: ChannelManager::new(),
invoice: Invoice::new(),
}
}
}

impl ChannelManager {
pub fn new() -> Self {
ChannelManager {
channels: Vec::new(),
}
}
}

impl Invoice {
pub fn new() -> Self {
Invoice {
amount: 0,
description: String::new(),
}
}
}
1 change: 1 addition & 0 deletions src/on-chain/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn main() {
Network::Testnet,
Network::Signet,
Network::Regtest,
Network::Testnet4
];

// Example: Print the genesis block for each network
Expand Down

0 comments on commit 3e88eaf

Please sign in to comment.