mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-29 16:30:55 +00:00
feat: upgrade to rust-nostr 0.32
This commit is contained in:
parent
6996e30889
commit
b396c8a695
443
src-tauri/Cargo.lock
generated
443
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@ rust-version = "1.70"
|
||||
tauri-build = { version = "2.0.0-beta", features = [] }
|
||||
|
||||
[dependencies]
|
||||
nostr-sdk = { version = "0.31", features = ["sqlite"] }
|
||||
nostr-sdk = { version = "0.32", features = ["sqlite"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
@ -139,9 +139,10 @@ fn main() {
|
||||
tauri::async_runtime::block_on(async move {
|
||||
// Create nostr connection
|
||||
let database = SQLiteDatabase::open(home_dir.join("Lume/lume.db")).await;
|
||||
let opts = Options::new().automatic_authentication(true);
|
||||
let client = match database {
|
||||
Ok(db) => ClientBuilder::default().database(db).build(),
|
||||
Err(_) => ClientBuilder::default().build(),
|
||||
Ok(db) => ClientBuilder::default().database(db).opts(opts).build(),
|
||||
Err(_) => ClientBuilder::default().opts(opts).build(),
|
||||
};
|
||||
|
||||
// Add bootstrap relays
|
||||
|
@ -279,15 +279,12 @@ pub async fn set_nwc(uri: &str, state: State<'_, Nostr>) -> Result<bool, String>
|
||||
let client = &state.client;
|
||||
|
||||
if let Ok(nwc_uri) = NostrWalletConnectURI::from_str(uri) {
|
||||
if let Ok(nwc) = NWC::new(nwc_uri).await {
|
||||
let keyring = Entry::new("Lume Secret Storage", "NWC").unwrap();
|
||||
let _ = keyring.set_password(uri);
|
||||
let _ = client.set_zapper(nwc).await;
|
||||
let nwc = NWC::new(nwc_uri);
|
||||
let keyring = Entry::new("Lume Secret Storage", "NWC").unwrap();
|
||||
let _ = keyring.set_password(uri);
|
||||
let _ = client.set_zapper(nwc).await;
|
||||
|
||||
Ok(true)
|
||||
} else {
|
||||
Err("URI is not valid".into())
|
||||
}
|
||||
Ok(true)
|
||||
} else {
|
||||
Err("Set NWC failed".into())
|
||||
}
|
||||
@ -302,12 +299,10 @@ pub async fn load_nwc(state: State<'_, Nostr>) -> Result<bool, String> {
|
||||
match keyring.get_password() {
|
||||
Ok(val) => {
|
||||
let uri = NostrWalletConnectURI::from_str(&val).unwrap();
|
||||
if let Ok(nwc) = NWC::new(uri).await {
|
||||
client.set_zapper(nwc).await;
|
||||
Ok(true)
|
||||
} else {
|
||||
Err("Cannot connect to NWC".into())
|
||||
}
|
||||
let nwc = NWC::new(uri);
|
||||
client.set_zapper(nwc).await;
|
||||
|
||||
Ok(true)
|
||||
}
|
||||
Err(_) => Ok(false),
|
||||
}
|
||||
@ -321,14 +316,11 @@ pub async fn get_balance() -> Result<String, String> {
|
||||
match keyring.get_password() {
|
||||
Ok(val) => {
|
||||
let uri = NostrWalletConnectURI::from_str(&val).unwrap();
|
||||
if let Ok(nwc) = NWC::new(uri).await {
|
||||
if let Ok(balance) = nwc.get_balance().await {
|
||||
Ok(balance.to_string())
|
||||
} else {
|
||||
Err("Get balance failed".into())
|
||||
}
|
||||
let nwc = NWC::new(uri);
|
||||
if let Ok(balance) = nwc.get_balance().await {
|
||||
Ok(balance.to_string())
|
||||
} else {
|
||||
Err("Cannot connect to NWC".into())
|
||||
Err("Get balance failed".into())
|
||||
}
|
||||
}
|
||||
Err(_) => Err("Something wrong".into()),
|
||||
|
Loading…
Reference in New Issue
Block a user