From dde7b2f672fcd5891024822c273f1c43ec64b6bc Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Sat, 3 Feb 2024 17:00:07 +0000 Subject: [PATCH] chore: use cashu-crab git dep --- Cargo.lock | 2 ++ Cargo.toml | 4 ++-- src/error.rs | 13 ------------- src/main.rs | 2 +- src/types.rs | 18 ------------------ 5 files changed, 5 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e566cb5..6852f87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -398,6 +398,7 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cashu" version = "0.4.1-ALPHA" +source = "git+https://github.com/thesimplekid/cashu-crab?rev=be2b51b#be2b51b25a508f1e85486b0d65dbd48186c0606b" dependencies = [ "base64 0.21.4", "bip32", @@ -456,6 +457,7 @@ dependencies = [ [[package]] name = "cashu-sdk" version = "0.1.0" +source = "git+https://github.com/thesimplekid/cashu-crab?rev=be2b51b#be2b51b25a508f1e85486b0d65dbd48186c0606b" dependencies = [ "async-trait", "bip39", diff --git a/Cargo.toml b/Cargo.toml index f9ed9eb..4355567 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,8 +33,8 @@ time = "0.3.22" chrono = "0.4.26" clap = { version = "4.3.14", features = ["env", "default", "derive"]} anyhow = "1.0.71" -# cashu-sdk = { git = "https://github.com/thesimplekid/cashu-crab", rev = "e06973a", default-features = false, features = ["mint", "all-nuts", "redb"] } -cashu-sdk = { path = "../cashu-crab/main/crates/cashu-sdk", default-features = false, features = ["mint", "all-nuts", "redb"] } +cashu-sdk = { git = "https://github.com/thesimplekid/cashu-crab", rev = "be2b51b", default-features = false, features = ["mint", "all-nuts", "redb"] } +# cashu-sdk = { path = "../cashu-crab/main/crates/cashu-sdk", default-features = false, features = ["mint", "all-nuts", "redb"] } bitcoin = { version = "0.30.0", features = ["no-std"] } serde = "1.0.164" serde_json = "1.0.96" diff --git a/src/error.rs b/src/error.rs index 3af5c62..8b026fd 100644 --- a/src/error.rs +++ b/src/error.rs @@ -48,19 +48,6 @@ pub struct ErrorResponse { error: String, } -impl ErrorResponse { - pub fn new(code: u16, error: &str) -> Self { - Self { - code, - error: error.to_string(), - } - } - - pub fn as_json(&self) -> String { - serde_json::to_string(self).unwrap() - } -} - impl IntoResponse for Error { fn into_response(self) -> Response { match self { diff --git a/src/main.rs b/src/main.rs index dee4e2a..f4c2af5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -100,7 +100,7 @@ async fn main() -> anyhow::Result<()> { Ok(_) => (), Err(_e) => { // Create the parent directory if it doesn't exist - fs::create_dir_all(&last_pay_path.parent().unwrap())?; + fs::create_dir_all(last_pay_path.parent().unwrap())?; // Attempt to create the file let mut fs = File::create(&last_pay_path).unwrap(); diff --git a/src/types.rs b/src/types.rs index 877a258..befc2ea 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,23 +1,5 @@ -use anyhow::Result; -use cashu_sdk::nuts::nut02::Id; use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct KeysetInfo { - pub id: Id, - pub valid_from: u64, - pub valid_to: Option, - pub secret: String, - pub derivation_path: String, - pub max_order: u8, -} - -impl KeysetInfo { - pub fn as_json(&self) -> Result { - Ok(serde_json::to_string(self)?) - } -} - #[derive(Debug, Clone, Serialize, Deserialize)] pub enum LnMessage { PaymentReceived,