-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from bennyhodl/transport
Lightning & Nostr transport v2
- Loading branch information
Showing
21 changed files
with
674 additions
and
178 deletions.
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
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
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
File renamed without changes.
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,33 @@ | ||
use anyhow::Result; | ||
use bitcoin::key::rand::Fill; | ||
use bitcoin::Network; | ||
use ddk::builder::Builder; | ||
use ddk::oracle::memory::MemoryOracle; | ||
use ddk::storage::memory::MemoryStorage; | ||
use ddk::transport::nostr::NostrDlc; | ||
use std::sync::Arc; | ||
|
||
type NostrDdk = ddk::DlcDevKit<NostrDlc, MemoryStorage, MemoryOracle>; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
let mut seed_bytes = [0u8; 32]; | ||
seed_bytes.try_fill(&mut bitcoin::key::rand::thread_rng())?; | ||
|
||
let transport = | ||
Arc::new(NostrDlc::new(&seed_bytes, "wss://nostr.dlcdevkit.com", Network::Regtest).await?); | ||
let storage = Arc::new(MemoryStorage::new()); | ||
let oracle_client = Arc::new(MemoryOracle::default()); | ||
|
||
let mut builder = Builder::new(); | ||
builder.set_seed_bytes(seed_bytes); | ||
builder.set_transport(transport.clone()); | ||
builder.set_storage(storage.clone()); | ||
builder.set_oracle(oracle_client.clone()); | ||
|
||
let ddk: NostrDdk = builder.finish().await?; | ||
|
||
ddk.start().expect("couldn't start ddk"); | ||
|
||
loop {} | ||
} |
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
Oops, something went wrong.