mirror of
https://github.com/daywalker90/cln-nip47.git
synced 2026-08-13 12:33:43 +02:00
update for nostr 0.45 release version
This commit is contained in:
parent
e535fd7dfe
commit
b6b558e9b8
8 changed files with 323 additions and 229 deletions
492
Cargo.lock
generated
492
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -24,8 +24,8 @@ parking_lot = "0.12"
|
|||
# "nip04",
|
||||
# "nip44",
|
||||
# ] }
|
||||
nostr = { version = "0.45.0-alpha.4", features = ["nip47", "nip04", "nip44"] }
|
||||
nostr-sdk = { version = "0.45.0-alpha.4" }
|
||||
nostr = { version = "0.45.1", features = ["nip47", "nip04", "nip44"] }
|
||||
nostr-sdk = { version = "0.45.1" }
|
||||
|
||||
futures = "0.3"
|
||||
|
||||
|
|
|
|||
15
src/nwc.rs
15
src/nwc.rs
|
|
@ -4,18 +4,11 @@ use anyhow::anyhow;
|
|||
use cln_plugin::Plugin;
|
||||
use futures::StreamExt;
|
||||
use nostr::{
|
||||
Event,
|
||||
EventBuilder,
|
||||
EventId,
|
||||
Filter,
|
||||
Keys,
|
||||
Kind,
|
||||
PublicKey,
|
||||
SecretKey,
|
||||
Tag,
|
||||
Timestamp,
|
||||
event::FinalizeEventAsync,
|
||||
event::{Event, EventBuilder, EventId, FinalizeEventAsync, Kind, Tag},
|
||||
filter::Filter,
|
||||
key::{Keys, PublicKey, SecretKey},
|
||||
nips::{nip04, nip44, nip47},
|
||||
types::Timestamp,
|
||||
};
|
||||
use nostr_sdk::{
|
||||
client::{self, Client, ClientNotification},
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ use std::str::FromStr;
|
|||
|
||||
use cln_plugin::Plugin;
|
||||
use cln_rpc::primitives::Sha256;
|
||||
use nostr::{nips::nip47, Timestamp};
|
||||
use nostr::{nips::nip47, types::Timestamp};
|
||||
|
||||
use crate::{
|
||||
hold::{invoice_request::Description, CancelRequest, InvoiceRequest, SettleRequest},
|
||||
hold::{CancelRequest, InvoiceRequest, SettleRequest, invoice_request::Description},
|
||||
nwc_notifications::holdinvoice_accepted_handler,
|
||||
structs::PluginState,
|
||||
};
|
||||
|
|
@ -66,7 +66,7 @@ async fn make_hold_invoice(
|
|||
return Err(nip47::NIP47Error {
|
||||
code: nip47::ErrorCode::Other,
|
||||
message: "Could not convert description hash to bytes".to_owned(),
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
Some(Description::Hash(desc_hash_bytes))
|
||||
|
|
@ -83,7 +83,7 @@ async fn make_hold_invoice(
|
|||
return Err(nip47::NIP47Error {
|
||||
code: nip47::ErrorCode::Other,
|
||||
message: "Invalid payment hash".to_owned(),
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ async fn cancel_hold_invoice(
|
|||
return Err(nip47::NIP47Error {
|
||||
code: nip47::ErrorCode::Other,
|
||||
message: "Invalid payment hash".to_owned(),
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ async fn settle_hold_invoice(
|
|||
return Err(nip47::NIP47Error {
|
||||
code: nip47::ErrorCode::Other,
|
||||
message: "Invalid preimage".to_owned(),
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use cln_rpc::{
|
|||
},
|
||||
primitives::Sha256,
|
||||
};
|
||||
use nostr::{Timestamp, nips::nip47};
|
||||
use nostr::{nips::nip47, types::Timestamp};
|
||||
use tonic::transport::Channel;
|
||||
|
||||
use crate::{
|
||||
|
|
|
|||
|
|
@ -17,12 +17,9 @@ use cln_rpc::{
|
|||
primitives::Sha256,
|
||||
};
|
||||
use nostr::{
|
||||
EventBuilder,
|
||||
Kind,
|
||||
Tag,
|
||||
Timestamp,
|
||||
event::FinalizeEventAsync,
|
||||
event::{EventBuilder, FinalizeEventAsync, Kind, Tag},
|
||||
nips::{nip04, nip44, nip47},
|
||||
types::Timestamp,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,11 @@ use cln_rpc::model::requests::{
|
|||
DeldatastoreRequest,
|
||||
ListdatastoreRequest,
|
||||
};
|
||||
use nostr::{Keys, SecretKey, Timestamp, nips::nip47::NostrWalletConnectUri};
|
||||
use nostr::{
|
||||
key::{Keys, SecretKey},
|
||||
nips::nip47::NostrWalletConnectUri,
|
||||
types::Timestamp,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
use std::{collections::HashMap, path::PathBuf, str::FromStr, sync::Arc};
|
||||
|
||||
use cln_rpc::ClnRpc;
|
||||
use nostr::{nips::nip47::NostrWalletConnectUri, types::RelayUrl};
|
||||
use nostr_sdk::client;
|
||||
use nostr::{
|
||||
key::{Keys, PublicKey},
|
||||
nips::nip47::NostrWalletConnectUri,
|
||||
types::RelayUrl,
|
||||
};
|
||||
use nostr_sdk::client::Client;
|
||||
use parking_lot::Mutex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::oneshot;
|
||||
|
|
@ -33,9 +37,9 @@ impl PluginState {
|
|||
}
|
||||
|
||||
pub struct WalletService {
|
||||
pub client: client::Client,
|
||||
pub client_pubkey: nostr::PublicKey,
|
||||
pub wallet_secret: nostr::Keys,
|
||||
pub client: Client,
|
||||
pub client_pubkey: PublicKey,
|
||||
pub wallet_secret: Keys,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue