Skip to content

Commit

Permalink
Update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Mar 18, 2024
1 parent 9b38d99 commit 9d2af37
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 32 deletions.
39 changes: 24 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ clap = { version = "4.1.14", features = ["derive"] }
home = "0.5.4"
bitcoin = "0.30.2"
lightning-invoice = { version = "0.29.0", features = ["serde"] }
nostr = { version = "0.28.0", features = ["nip47"] }
nostr-sdk = { version = "0.28.0", features = ["nip47"] }
nostr = { version = "0.29.0", features = ["nip47"] }
nostr-sdk = { version = "0.29.0", features = ["nip47"] }
tonic_openssl_lnd = "0.2.0"
tokio = { version = "1.26.0", features = ["full"] }
tokio-stream = "0.1.11"
secp256k1 = { version = "0.27", features = ["bitcoin_hashes", "global-context", "rand-std", "serde"] }
serde = "1.0"
serde_json = "1.0"
url = { version = "2", features = ["serde"] }
Expand Down
23 changes: 9 additions & 14 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@ use anyhow::anyhow;
use async_lock::RwLock;
use bitcoin::hashes::hex::FromHex;
use bitcoin::hashes::{sha256, Hash};
use bitcoin::secp256k1::rand::rngs::OsRng;
use bitcoin::secp256k1::{SecretKey, ThirtyTwoByteHash};
use clap::Parser;
use lightning_invoice::{Bolt11Invoice, Bolt11InvoiceDescription};
use log::{debug, error, info};
use nostr::nips::nip47::{
ErrorCode, GetBalanceResponseResult, LookupInvoiceResponseResult, MakeInvoiceResponseResult,
Method, NIP47Error, NostrWalletConnectURI, PayInvoiceResponseResult, Request, RequestParams,
Response, ResponseResult,
};
use nostr::nips::nip47::{Request, Response};
use nostr::prelude::*;
use nostr::Keys;
use nostr_sdk::{Client, RelayPoolNotification};
use secp256k1::rand::rngs::OsRng;
use secp256k1::{SecretKey, ThirtyTwoByteHash};
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::fs::{create_dir_all, File};
Expand Down Expand Up @@ -167,7 +162,7 @@ async fn event_loop(
.pubkey(keys.server_keys().public_key())
.since(Timestamp::now());

client.subscribe(vec![subscription]).await;
client.subscribe(vec![subscription], None).await;

info!("Listening for nip 47 requests...");

Expand Down Expand Up @@ -197,7 +192,7 @@ async fn event_loop(

match tokio::time::timeout(
Duration::from_secs(60),
handle_nwc_request(event, keys, config, &client, tracker, lnd),
handle_nwc_request(*event, keys, config, &client, tracker, lnd),
)
.await
{
Expand Down Expand Up @@ -377,7 +372,7 @@ async fn handle_nwc_params(
// verify amount, convert to msats
match error_msg {
None => {
let pubkey = secp256k1::PublicKey::from_str(&params.pubkey)?;
let pubkey = bitcoin::secp256k1::PublicKey::from_str(&params.pubkey)?;
match pay_keysend(
pubkey,
params.preimage,
Expand Down Expand Up @@ -607,7 +602,7 @@ async fn pay_invoice(
}

async fn pay_keysend(
pubkey: secp256k1::PublicKey,
pubkey: bitcoin::secp256k1::PublicKey,
preimage: Option<String>,
tlv_records: Vec<KeysendTLVRecord>,
amount_msats: u64,
Expand Down Expand Up @@ -681,8 +676,8 @@ async fn pay_keysend(

#[derive(Debug, Clone, Deserialize, Serialize)]
struct Nip47Keys {
server_key: secp256k1::SecretKey,
user_key: secp256k1::SecretKey,
server_key: SecretKey,
user_key: SecretKey,
#[serde(default)]
sent_info: bool,
}
Expand Down

0 comments on commit 9d2af37

Please sign in to comment.