upgrade cln dependencies and rust edition

This commit is contained in:
daywalker90 2026-04-03 10:13:47 +02:00
parent 4fdc9e0265
commit 01b48646a6
No known key found for this signature in database
7 changed files with 478 additions and 345 deletions

783
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
[package]
name = "cln-nip47"
version = "0.1.7"
edition = "2021"
edition = "2024"
rust-version = "1.85.0"
[dependencies]
@ -12,10 +12,10 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["fs", "sync", "rt-multi-thread"] }
cln-rpc = "0.5"
# cln-rpc = { path = "../lightning/cln-rpc/", version = "^0.4" }
cln-plugin = "0.5"
# cln-plugin = { path = "../lightning/plugins/", version = "^0.4" }
cln-rpc = "0.6"
# cln-rpc = { path = "../lightning/cln-rpc/", version = "^0.6" }
cln-plugin = "0.6"
# cln-plugin = { path = "../lightning/plugins/", version = "^0.6" }
parking_lot = "0.12"
# nostr-sdk = { git = "https://github.com/rust-nostr/nostr.git", rev = "f7122f5", features = ["nip47", "nip04", "nip44"]}

View file

@ -2,11 +2,11 @@ use std::{path::Path, time::Duration};
use anyhow::anyhow;
use cln_plugin::{
options::{ConfigOption, DefaultBooleanConfigOption, StringArrayConfigOption},
Builder,
Plugin,
options::{ConfigOption, DefaultBooleanConfigOption, StringArrayConfigOption},
};
use cln_rpc::{model::requests::ListdatastoreRequest, ClnRpc};
use cln_rpc::{ClnRpc, model::requests::ListdatastoreRequest};
use nostr_sdk::nips::nip47;
use nwc::run_nwc;
use nwc_notifications::{payment_received_handler, payment_sent_handler};
@ -63,10 +63,12 @@ pub const WALLET_NOTIFICATIONS: [nip47::NotificationType; 2] = [
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
std::env::set_var(
"CLN_PLUGIN_LOG",
"cln_plugin=info,cln_rpc=info,cln_nip47=debug,info",
);
unsafe {
std::env::set_var(
"CLN_PLUGIN_LOG",
"cln_plugin=info,cln_rpc=info,cln_nip47=debug,info",
);
};
log_panics::init();
let state;

View file

@ -3,9 +3,6 @@ use std::{borrow::Cow, time::Duration};
use anyhow::anyhow;
use cln_plugin::Plugin;
use nostr_sdk::{
client,
nips::{nip04, nip44, nip47},
nostr::{Filter, Kind, Tag},
Alphabet,
Client,
Event,
@ -20,10 +17,15 @@ use nostr_sdk::{
SingleLetterTag,
TagKind,
Timestamp,
client,
nips::{nip04, nip44, nip47},
nostr::{Filter, Kind, Tag},
};
use tokio::{sync::oneshot, time};
use crate::{
OPT_NOTIFICATIONS,
STARTUP_DELAY,
nwc_balance::get_balance_response,
nwc_hold::{
cancel_hold_invoice_response,
@ -38,8 +40,6 @@ use crate::{
structs::{NwcStore, PluginState},
tasks::budget_task,
util::{build_capabilities, build_notifications_vec, is_read_only_nwc},
OPT_NOTIFICATIONS,
STARTUP_DELAY,
};
pub async fn run_nwc(
@ -145,7 +145,7 @@ pub async fn run_nwc(
break;
}
Err(e) => log::warn!("NWC handler for `{label_clone}` had an error: {e}"),
};
}
}
});

View file

@ -47,6 +47,7 @@ async fn get_balance(
.call_typed(&ListpeerchannelsRequest {
id: None,
short_channel_id: None,
channel_id: None,
})
.await
.map_err(|e| nip47::NIP47Error {

View file

@ -64,7 +64,7 @@ async fn get_info(
let methods = build_methods_vec(is_read_only_nwc(&nwc_store), &plugin);
Ok(nip47::GetInfoResponse {
alias: get_info.alias,
alias: Some(get_info.alias),
color: Some(get_info.color),
pubkey: Some(pubkey),
network: Some(network),

View file

@ -318,6 +318,7 @@ async fn pay_with_xpay_full(
retry_for: None,
layers: None,
invstring: params.invoice,
payer_note: None,
})
.await
.map_err(|e| map_cln_error_to_nip47(&e, id, true))?;