From 1b95398a041ea110cb00bf1a2fbb42c490fc7cde Mon Sep 17 00:00:00 2001 From: Cesar Rodas Date: Fri, 3 Jan 2025 14:36:57 -0300 Subject: [PATCH] Rename cdk-common to cashu, as suggested by @thesimplekid --- Cargo.lock | 58 +++++++++---------- crates/{cdk-common => cashu}/Cargo.toml | 6 +- crates/{cdk-common => cashu}/src/amount.rs | 0 crates/{cdk-common => cashu}/src/common.rs | 0 crates/{cdk-common => cashu}/src/database.rs | 0 crates/{cdk-common => cashu}/src/dhke.rs | 0 crates/{cdk-common => cashu}/src/error.rs | 0 crates/{cdk-common => cashu}/src/lib.rs | 2 +- crates/{cdk-common => cashu}/src/lightning.rs | 0 crates/{cdk-common => cashu}/src/mint.rs | 0 crates/{cdk-common => cashu}/src/mint_url.rs | 0 crates/{cdk-common => cashu}/src/nuts/mod.rs | 0 .../src/nuts/nut00/mod.rs | 0 .../src/nuts/nut00/token.rs | 0 .../src/nuts/nut01/mod.rs | 0 .../src/nuts/nut01/public_key.rs | 0 .../src/nuts/nut01/secret_key.rs | 0 .../{cdk-common => cashu}/src/nuts/nut02.rs | 0 .../{cdk-common => cashu}/src/nuts/nut03.rs | 0 .../{cdk-common => cashu}/src/nuts/nut04.rs | 0 .../{cdk-common => cashu}/src/nuts/nut05.rs | 0 .../{cdk-common => cashu}/src/nuts/nut06.rs | 0 .../{cdk-common => cashu}/src/nuts/nut07.rs | 0 .../{cdk-common => cashu}/src/nuts/nut08.rs | 0 .../{cdk-common => cashu}/src/nuts/nut09.rs | 0 .../{cdk-common => cashu}/src/nuts/nut10.rs | 0 .../src/nuts/nut11/mod.rs | 0 .../src/nuts/nut11/serde_p2pk_witness.rs | 0 .../{cdk-common => cashu}/src/nuts/nut12.rs | 0 .../{cdk-common => cashu}/src/nuts/nut13.rs | 0 .../src/nuts/nut14/mod.rs | 0 .../src/nuts/nut14/serde_htlc_witness.rs | 0 .../{cdk-common => cashu}/src/nuts/nut15.rs | 0 .../src/nuts/nut17/mod.rs | 0 .../src/nuts/nut17/ws.rs | 0 .../{cdk-common => cashu}/src/nuts/nut18.rs | 0 .../{cdk-common => cashu}/src/nuts/nut19.rs | 0 .../{cdk-common => cashu}/src/nuts/nut20.rs | 0 .../src/pub_sub/index.rs | 0 .../{cdk-common => cashu}/src/pub_sub/mod.rs | 0 crates/{cdk-common => cashu}/src/secret.rs | 0 crates/{cdk-common => cashu}/src/signatory.rs | 0 crates/{cdk-common => cashu}/src/util/hex.rs | 0 crates/{cdk-common => cashu}/src/util/mod.rs | 0 crates/{cdk-common => cashu}/src/wallet.rs | 0 crates/cdk-redb/Cargo.toml | 2 +- crates/cdk-redb/src/error.rs | 14 ++--- crates/cdk-redb/src/migrations.rs | 4 +- crates/cdk-redb/src/mint/migrations.rs | 6 +- crates/cdk-redb/src/mint/mod.rs | 12 ++-- crates/cdk-redb/src/wallet/migrations.rs | 2 +- crates/cdk-redb/src/wallet/mod.rs | 12 ++-- crates/cdk-sqlite/Cargo.toml | 2 +- crates/cdk-sqlite/src/mint/error.rs | 18 +++--- crates/cdk-sqlite/src/mint/mod.rs | 16 ++--- crates/cdk-sqlite/src/wallet/error.rs | 18 +++--- crates/cdk-sqlite/src/wallet/mod.rs | 14 ++--- crates/cdk/Cargo.toml | 4 +- crates/cdk/src/cdk_database/mint_memory.rs | 6 +- crates/cdk/src/cdk_database/mod.rs | 2 +- crates/cdk/src/cdk_database/wallet_memory.rs | 2 +- crates/cdk/src/lib.rs | 2 +- crates/cdk/src/mint/builder.rs | 2 +- crates/cdk/src/mint/melt.rs | 2 +- crates/cdk/src/mint/mod.rs | 10 ++-- crates/cdk/src/mint/subscription/manager.rs | 6 +- .../src/mint/subscription/on_subscription.rs | 8 +-- crates/cdk/src/pub_sub/mod.rs | 6 +- crates/cdk/src/wallet/mod.rs | 4 +- crates/cdk/src/wallet/multi_mint_wallet.rs | 2 +- 70 files changed, 121 insertions(+), 121 deletions(-) rename crates/{cdk-common => cashu}/Cargo.toml (81%) rename crates/{cdk-common => cashu}/src/amount.rs (100%) rename crates/{cdk-common => cashu}/src/common.rs (100%) rename crates/{cdk-common => cashu}/src/database.rs (100%) rename crates/{cdk-common => cashu}/src/dhke.rs (100%) rename crates/{cdk-common => cashu}/src/error.rs (100%) rename crates/{cdk-common => cashu}/src/lib.rs (94%) rename crates/{cdk-common => cashu}/src/lightning.rs (100%) rename crates/{cdk-common => cashu}/src/mint.rs (100%) rename crates/{cdk-common => cashu}/src/mint_url.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/mod.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut00/mod.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut00/token.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut01/mod.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut01/public_key.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut01/secret_key.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut02.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut03.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut04.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut05.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut06.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut07.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut08.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut09.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut10.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut11/mod.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut11/serde_p2pk_witness.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut12.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut13.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut14/mod.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut14/serde_htlc_witness.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut15.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut17/mod.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut17/ws.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut18.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut19.rs (100%) rename crates/{cdk-common => cashu}/src/nuts/nut20.rs (100%) rename crates/{cdk-common => cashu}/src/pub_sub/index.rs (100%) rename crates/{cdk-common => cashu}/src/pub_sub/mod.rs (100%) rename crates/{cdk-common => cashu}/src/secret.rs (100%) rename crates/{cdk-common => cashu}/src/signatory.rs (100%) rename crates/{cdk-common => cashu}/src/util/hex.rs (100%) rename crates/{cdk-common => cashu}/src/util/mod.rs (100%) rename crates/{cdk-common => cashu}/src/wallet.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index ec3b7c867..b3bb18c6c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -682,6 +682,32 @@ dependencies = [ "serde_json", ] +[[package]] +name = "cashu" +version = "0.6.0" +dependencies = [ + "anyhow", + "async-trait", + "bip39", + "bitcoin 0.32.5", + "cbor-diag", + "ciborium", + "futures", + "instant", + "lightning-invoice", + "once_cell", + "rand", + "reqwest", + "serde", + "serde_json", + "serde_with", + "thiserror 2.0.9", + "tracing", + "url", + "utoipa", + "uuid", +] + [[package]] name = "cast" version = "0.3.0" @@ -737,8 +763,8 @@ dependencies = [ "bech32 0.9.1", "bip39", "bitcoin 0.32.5", + "cashu", "cbor-diag", - "cdk-common", "ciborium", "criterion", "futures", @@ -820,32 +846,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "cdk-common" -version = "0.6.0" -dependencies = [ - "anyhow", - "async-trait", - "bip39", - "bitcoin 0.32.5", - "cbor-diag", - "ciborium", - "futures", - "instant", - "lightning-invoice", - "once_cell", - "rand", - "reqwest", - "serde", - "serde_json", - "serde_with", - "thiserror 2.0.9", - "tracing", - "url", - "utoipa", - "uuid", -] - [[package]] name = "cdk-fake-wallet" version = "0.6.0" @@ -985,7 +985,7 @@ name = "cdk-redb" version = "0.6.0" dependencies = [ "async-trait", - "cdk-common", + "cashu", "lightning-invoice", "redb", "serde", @@ -1016,7 +1016,7 @@ version = "0.6.0" dependencies = [ "async-trait", "bitcoin 0.32.5", - "cdk-common", + "cashu", "lightning-invoice", "serde_json", "sqlx", diff --git a/crates/cdk-common/Cargo.toml b/crates/cashu/Cargo.toml similarity index 81% rename from crates/cdk-common/Cargo.toml rename to crates/cashu/Cargo.toml index 649783f05..97a202d45 100644 --- a/crates/cdk-common/Cargo.toml +++ b/crates/cashu/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "cdk-common" +name = "cashu" version = "0.6.0" edition = "2021" -description = "CDK shared types and crypto utilities" -rust-version = "1.63.0" # MSRV +description = "Cashu shared types and crypto utilities, used as the foundation for the CDK and their crates" +rust-version = "1.63.0" # MSRV [features] swagger = ["dep:utoipa"] diff --git a/crates/cdk-common/src/amount.rs b/crates/cashu/src/amount.rs similarity index 100% rename from crates/cdk-common/src/amount.rs rename to crates/cashu/src/amount.rs diff --git a/crates/cdk-common/src/common.rs b/crates/cashu/src/common.rs similarity index 100% rename from crates/cdk-common/src/common.rs rename to crates/cashu/src/common.rs diff --git a/crates/cdk-common/src/database.rs b/crates/cashu/src/database.rs similarity index 100% rename from crates/cdk-common/src/database.rs rename to crates/cashu/src/database.rs diff --git a/crates/cdk-common/src/dhke.rs b/crates/cashu/src/dhke.rs similarity index 100% rename from crates/cdk-common/src/dhke.rs rename to crates/cashu/src/dhke.rs diff --git a/crates/cdk-common/src/error.rs b/crates/cashu/src/error.rs similarity index 100% rename from crates/cdk-common/src/error.rs rename to crates/cashu/src/error.rs diff --git a/crates/cdk-common/src/lib.rs b/crates/cashu/src/lib.rs similarity index 94% rename from crates/cdk-common/src/lib.rs rename to crates/cashu/src/lib.rs index 0d9a827d4..0da4c8744 100644 --- a/crates/cdk-common/src/lib.rs +++ b/crates/cashu/src/lib.rs @@ -1,4 +1,4 @@ -//! CDK shared types and functions. +//! Cashu shared types and functions. //! //! This crate is the base foundation to build things that can interact with the CDK (Cashu //! Development Kit) and their internal crates. diff --git a/crates/cdk-common/src/lightning.rs b/crates/cashu/src/lightning.rs similarity index 100% rename from crates/cdk-common/src/lightning.rs rename to crates/cashu/src/lightning.rs diff --git a/crates/cdk-common/src/mint.rs b/crates/cashu/src/mint.rs similarity index 100% rename from crates/cdk-common/src/mint.rs rename to crates/cashu/src/mint.rs diff --git a/crates/cdk-common/src/mint_url.rs b/crates/cashu/src/mint_url.rs similarity index 100% rename from crates/cdk-common/src/mint_url.rs rename to crates/cashu/src/mint_url.rs diff --git a/crates/cdk-common/src/nuts/mod.rs b/crates/cashu/src/nuts/mod.rs similarity index 100% rename from crates/cdk-common/src/nuts/mod.rs rename to crates/cashu/src/nuts/mod.rs diff --git a/crates/cdk-common/src/nuts/nut00/mod.rs b/crates/cashu/src/nuts/nut00/mod.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut00/mod.rs rename to crates/cashu/src/nuts/nut00/mod.rs diff --git a/crates/cdk-common/src/nuts/nut00/token.rs b/crates/cashu/src/nuts/nut00/token.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut00/token.rs rename to crates/cashu/src/nuts/nut00/token.rs diff --git a/crates/cdk-common/src/nuts/nut01/mod.rs b/crates/cashu/src/nuts/nut01/mod.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut01/mod.rs rename to crates/cashu/src/nuts/nut01/mod.rs diff --git a/crates/cdk-common/src/nuts/nut01/public_key.rs b/crates/cashu/src/nuts/nut01/public_key.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut01/public_key.rs rename to crates/cashu/src/nuts/nut01/public_key.rs diff --git a/crates/cdk-common/src/nuts/nut01/secret_key.rs b/crates/cashu/src/nuts/nut01/secret_key.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut01/secret_key.rs rename to crates/cashu/src/nuts/nut01/secret_key.rs diff --git a/crates/cdk-common/src/nuts/nut02.rs b/crates/cashu/src/nuts/nut02.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut02.rs rename to crates/cashu/src/nuts/nut02.rs diff --git a/crates/cdk-common/src/nuts/nut03.rs b/crates/cashu/src/nuts/nut03.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut03.rs rename to crates/cashu/src/nuts/nut03.rs diff --git a/crates/cdk-common/src/nuts/nut04.rs b/crates/cashu/src/nuts/nut04.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut04.rs rename to crates/cashu/src/nuts/nut04.rs diff --git a/crates/cdk-common/src/nuts/nut05.rs b/crates/cashu/src/nuts/nut05.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut05.rs rename to crates/cashu/src/nuts/nut05.rs diff --git a/crates/cdk-common/src/nuts/nut06.rs b/crates/cashu/src/nuts/nut06.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut06.rs rename to crates/cashu/src/nuts/nut06.rs diff --git a/crates/cdk-common/src/nuts/nut07.rs b/crates/cashu/src/nuts/nut07.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut07.rs rename to crates/cashu/src/nuts/nut07.rs diff --git a/crates/cdk-common/src/nuts/nut08.rs b/crates/cashu/src/nuts/nut08.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut08.rs rename to crates/cashu/src/nuts/nut08.rs diff --git a/crates/cdk-common/src/nuts/nut09.rs b/crates/cashu/src/nuts/nut09.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut09.rs rename to crates/cashu/src/nuts/nut09.rs diff --git a/crates/cdk-common/src/nuts/nut10.rs b/crates/cashu/src/nuts/nut10.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut10.rs rename to crates/cashu/src/nuts/nut10.rs diff --git a/crates/cdk-common/src/nuts/nut11/mod.rs b/crates/cashu/src/nuts/nut11/mod.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut11/mod.rs rename to crates/cashu/src/nuts/nut11/mod.rs diff --git a/crates/cdk-common/src/nuts/nut11/serde_p2pk_witness.rs b/crates/cashu/src/nuts/nut11/serde_p2pk_witness.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut11/serde_p2pk_witness.rs rename to crates/cashu/src/nuts/nut11/serde_p2pk_witness.rs diff --git a/crates/cdk-common/src/nuts/nut12.rs b/crates/cashu/src/nuts/nut12.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut12.rs rename to crates/cashu/src/nuts/nut12.rs diff --git a/crates/cdk-common/src/nuts/nut13.rs b/crates/cashu/src/nuts/nut13.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut13.rs rename to crates/cashu/src/nuts/nut13.rs diff --git a/crates/cdk-common/src/nuts/nut14/mod.rs b/crates/cashu/src/nuts/nut14/mod.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut14/mod.rs rename to crates/cashu/src/nuts/nut14/mod.rs diff --git a/crates/cdk-common/src/nuts/nut14/serde_htlc_witness.rs b/crates/cashu/src/nuts/nut14/serde_htlc_witness.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut14/serde_htlc_witness.rs rename to crates/cashu/src/nuts/nut14/serde_htlc_witness.rs diff --git a/crates/cdk-common/src/nuts/nut15.rs b/crates/cashu/src/nuts/nut15.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut15.rs rename to crates/cashu/src/nuts/nut15.rs diff --git a/crates/cdk-common/src/nuts/nut17/mod.rs b/crates/cashu/src/nuts/nut17/mod.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut17/mod.rs rename to crates/cashu/src/nuts/nut17/mod.rs diff --git a/crates/cdk-common/src/nuts/nut17/ws.rs b/crates/cashu/src/nuts/nut17/ws.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut17/ws.rs rename to crates/cashu/src/nuts/nut17/ws.rs diff --git a/crates/cdk-common/src/nuts/nut18.rs b/crates/cashu/src/nuts/nut18.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut18.rs rename to crates/cashu/src/nuts/nut18.rs diff --git a/crates/cdk-common/src/nuts/nut19.rs b/crates/cashu/src/nuts/nut19.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut19.rs rename to crates/cashu/src/nuts/nut19.rs diff --git a/crates/cdk-common/src/nuts/nut20.rs b/crates/cashu/src/nuts/nut20.rs similarity index 100% rename from crates/cdk-common/src/nuts/nut20.rs rename to crates/cashu/src/nuts/nut20.rs diff --git a/crates/cdk-common/src/pub_sub/index.rs b/crates/cashu/src/pub_sub/index.rs similarity index 100% rename from crates/cdk-common/src/pub_sub/index.rs rename to crates/cashu/src/pub_sub/index.rs diff --git a/crates/cdk-common/src/pub_sub/mod.rs b/crates/cashu/src/pub_sub/mod.rs similarity index 100% rename from crates/cdk-common/src/pub_sub/mod.rs rename to crates/cashu/src/pub_sub/mod.rs diff --git a/crates/cdk-common/src/secret.rs b/crates/cashu/src/secret.rs similarity index 100% rename from crates/cdk-common/src/secret.rs rename to crates/cashu/src/secret.rs diff --git a/crates/cdk-common/src/signatory.rs b/crates/cashu/src/signatory.rs similarity index 100% rename from crates/cdk-common/src/signatory.rs rename to crates/cashu/src/signatory.rs diff --git a/crates/cdk-common/src/util/hex.rs b/crates/cashu/src/util/hex.rs similarity index 100% rename from crates/cdk-common/src/util/hex.rs rename to crates/cashu/src/util/hex.rs diff --git a/crates/cdk-common/src/util/mod.rs b/crates/cashu/src/util/mod.rs similarity index 100% rename from crates/cdk-common/src/util/mod.rs rename to crates/cashu/src/util/mod.rs diff --git a/crates/cdk-common/src/wallet.rs b/crates/cashu/src/wallet.rs similarity index 100% rename from crates/cdk-common/src/wallet.rs rename to crates/cashu/src/wallet.rs diff --git a/crates/cdk-redb/Cargo.toml b/crates/cdk-redb/Cargo.toml index b9578d9a1..9da5fd18b 100644 --- a/crates/cdk-redb/Cargo.toml +++ b/crates/cdk-redb/Cargo.toml @@ -17,7 +17,7 @@ wallet = [] [dependencies] async-trait = "0.1" -cdk-common = { path = "../cdk-common", version = "0.6.0", default-features = false } +cashu = { path = "../cashu", version = "0.6.0", default-features = false } redb = "2.1.0" thiserror = "1" tracing = { version = "0.1", default-features = false, features = [ diff --git a/crates/cdk-redb/src/error.rs b/crates/cdk-redb/src/error.rs index a4a51a001..a5eb33c2d 100644 --- a/crates/cdk-redb/src/error.rs +++ b/crates/cdk-redb/src/error.rs @@ -33,22 +33,22 @@ pub enum Error { ParseInt(#[from] ParseIntError), /// CDK Database Error #[error(transparent)] - CDKDatabase(#[from] cdk_common::database::Error), + CDKDatabase(#[from] cashu::database::Error), /// CDK Mint Url Error #[error(transparent)] - CDKMintUrl(#[from] cdk_common::mint_url::Error), + CDKMintUrl(#[from] cashu::mint_url::Error), /// CDK Error #[error(transparent)] - CDK(#[from] cdk_common::error::Error), + CDK(#[from] cashu::error::Error), /// NUT00 Error #[error(transparent)] - CDKNUT00(#[from] cdk_common::nuts::nut00::Error), + CDKNUT00(#[from] cashu::nuts::nut00::Error), /// NUT02 Error #[error(transparent)] - CDKNUT02(#[from] cdk_common::nuts::nut02::Error), + CDKNUT02(#[from] cashu::nuts::nut02::Error), /// DHKE Error #[error(transparent)] - DHKE(#[from] cdk_common::dhke::Error), + DHKE(#[from] cashu::dhke::Error), /// Unknown Mint Info #[error("Unknown mint info")] UnknownMintInfo, @@ -60,7 +60,7 @@ pub enum Error { UnknownDatabaseVersion, } -impl From for cdk_common::database::Error { +impl From for cashu::database::Error { fn from(e: Error) -> Self { Self::Database(Box::new(e)) } diff --git a/crates/cdk-redb/src/migrations.rs b/crates/cdk-redb/src/migrations.rs index 0a40068d1..28fd6746b 100644 --- a/crates/cdk-redb/src/migrations.rs +++ b/crates/cdk-redb/src/migrations.rs @@ -1,8 +1,8 @@ use std::collections::HashMap; use std::sync::Arc; -use cdk_common::mint_url::MintUrl; -use cdk_common::{Amount, CurrencyUnit, MeltQuoteState, MintQuoteState}; +use cashu::mint_url::MintUrl; +use cashu::{Amount, CurrencyUnit, MeltQuoteState, MintQuoteState}; use redb::{Database, ReadableTable, TableDefinition}; use serde::{Deserialize, Serialize}; diff --git a/crates/cdk-redb/src/mint/migrations.rs b/crates/cdk-redb/src/mint/migrations.rs index 3dafb99a5..03ea33384 100644 --- a/crates/cdk-redb/src/mint/migrations.rs +++ b/crates/cdk-redb/src/mint/migrations.rs @@ -3,9 +3,9 @@ use std::collections::HashMap; use std::str::FromStr; use std::sync::Arc; -use cdk_common::mint::MintQuote; -use cdk_common::mint_url::MintUrl; -use cdk_common::{Amount, CurrencyUnit, MintQuoteState, Proof, State}; +use cashu::mint::MintQuote; +use cashu::mint_url::MintUrl; +use cashu::{Amount, CurrencyUnit, MintQuoteState, Proof, State}; use lightning_invoice::Bolt11Invoice; use redb::{ Database, MultimapTableDefinition, ReadableMultimapTable, ReadableTable, TableDefinition, diff --git a/crates/cdk-redb/src/mint/mod.rs b/crates/cdk-redb/src/mint/mod.rs index 89385f45b..93f6a47a6 100644 --- a/crates/cdk-redb/src/mint/mod.rs +++ b/crates/cdk-redb/src/mint/mod.rs @@ -7,12 +7,12 @@ use std::str::FromStr; use std::sync::Arc; use async_trait::async_trait; -use cdk_common::common::LnKey; -use cdk_common::database::{self, MintDatabase}; -use cdk_common::dhke::hash_to_curve; -use cdk_common::mint::{self, MintKeySetInfo, MintQuote}; -use cdk_common::nut00::ProofsMethods; -use cdk_common::{ +use cashu::common::LnKey; +use cashu::database::{self, MintDatabase}; +use cashu::dhke::hash_to_curve; +use cashu::mint::{self, MintKeySetInfo, MintQuote}; +use cashu::nut00::ProofsMethods; +use cashu::{ BlindSignature, CurrencyUnit, Id, MeltBolt11Request, MeltQuoteState, MintQuoteState, Proof, Proofs, PublicKey, State, }; diff --git a/crates/cdk-redb/src/wallet/migrations.rs b/crates/cdk-redb/src/wallet/migrations.rs index 27f113325..03a1e8e6c 100644 --- a/crates/cdk-redb/src/wallet/migrations.rs +++ b/crates/cdk-redb/src/wallet/migrations.rs @@ -3,7 +3,7 @@ use std::ops::Deref; use std::str::FromStr; use std::sync::Arc; -use cdk_common::mint_url::MintUrl; +use cashu::mint_url::MintUrl; use redb::{ Database, MultimapTableDefinition, ReadableMultimapTable, ReadableTable, TableDefinition, }; diff --git a/crates/cdk-redb/src/wallet/mod.rs b/crates/cdk-redb/src/wallet/mod.rs index ff7a84788..6c88cf001 100644 --- a/crates/cdk-redb/src/wallet/mod.rs +++ b/crates/cdk-redb/src/wallet/mod.rs @@ -7,12 +7,12 @@ use std::str::FromStr; use std::sync::Arc; use async_trait::async_trait; -use cdk_common::common::ProofInfo; -use cdk_common::database::WalletDatabase; -use cdk_common::mint_url::MintUrl; -use cdk_common::util::unix_time; -use cdk_common::wallet::{self, MintQuote}; -use cdk_common::{ +use cashu::common::ProofInfo; +use cashu::database::WalletDatabase; +use cashu::mint_url::MintUrl; +use cashu::util::unix_time; +use cashu::wallet::{self, MintQuote}; +use cashu::{ database, CurrencyUnit, Id, KeySetInfo, Keys, MintInfo, PublicKey, SpendingConditions, State, }; use redb::{Database, MultimapTableDefinition, ReadableTable, TableDefinition}; diff --git a/crates/cdk-sqlite/Cargo.toml b/crates/cdk-sqlite/Cargo.toml index 02a7caa5e..784a8b110 100644 --- a/crates/cdk-sqlite/Cargo.toml +++ b/crates/cdk-sqlite/Cargo.toml @@ -17,7 +17,7 @@ wallet = [] [dependencies] async-trait = "0.1" -cdk-common = { path = "../cdk-common", version = "0.6.0", default-features = false } +cashu = { path = "../cashu", version = "0.6.0", default-features = false } bitcoin = { version = "0.32.2", default-features = false } sqlx = { version = "0.6.3", default-features = false, features = [ "runtime-tokio-rustls", diff --git a/crates/cdk-sqlite/src/mint/error.rs b/crates/cdk-sqlite/src/mint/error.rs index e4c185fda..027b92418 100644 --- a/crates/cdk-sqlite/src/mint/error.rs +++ b/crates/cdk-sqlite/src/mint/error.rs @@ -10,31 +10,31 @@ pub enum Error { SQLX(#[from] sqlx::Error), /// NUT00 Error #[error(transparent)] - CDKNUT00(#[from] cdk_common::nuts::nut00::Error), + CDKNUT00(#[from] cashu::nuts::nut00::Error), /// NUT01 Error #[error(transparent)] - CDKNUT01(#[from] cdk_common::nuts::nut01::Error), + CDKNUT01(#[from] cashu::nuts::nut01::Error), /// NUT02 Error #[error(transparent)] - CDKNUT02(#[from] cdk_common::nuts::nut02::Error), + CDKNUT02(#[from] cashu::nuts::nut02::Error), /// NUT04 Error #[error(transparent)] - CDKNUT04(#[from] cdk_common::nuts::nut04::Error), + CDKNUT04(#[from] cashu::nuts::nut04::Error), /// NUT05 Error #[error(transparent)] - CDKNUT05(#[from] cdk_common::nuts::nut05::Error), + CDKNUT05(#[from] cashu::nuts::nut05::Error), /// NUT07 Error #[error(transparent)] - CDKNUT07(#[from] cdk_common::nuts::nut07::Error), + CDKNUT07(#[from] cashu::nuts::nut07::Error), /// Secret Error #[error(transparent)] - CDKSECRET(#[from] cdk_common::secret::Error), + CDKSECRET(#[from] cashu::secret::Error), /// BIP32 Error #[error(transparent)] BIP32(#[from] bitcoin::bip32::Error), /// Mint Url Error #[error(transparent)] - MintUrl(#[from] cdk_common::mint_url::Error), + MintUrl(#[from] cashu::mint_url::Error), /// Could Not Initialize Database #[error("Could not initialize database")] CouldNotInitialize, @@ -46,7 +46,7 @@ pub enum Error { Serde(#[from] serde_json::Error), } -impl From for cdk_common::database::Error { +impl From for cashu::database::Error { fn from(e: Error) -> Self { Self::Database(Box::new(e)) } diff --git a/crates/cdk-sqlite/src/mint/mod.rs b/crates/cdk-sqlite/src/mint/mod.rs index d0c6dbe0e..4b71b2a02 100644 --- a/crates/cdk-sqlite/src/mint/mod.rs +++ b/crates/cdk-sqlite/src/mint/mod.rs @@ -7,14 +7,14 @@ use std::time::Duration; use async_trait::async_trait; use bitcoin::bip32::DerivationPath; -use cdk_common::common::LnKey; -use cdk_common::database::{self, MintDatabase}; -use cdk_common::mint::{self, MintKeySetInfo, MintQuote}; -use cdk_common::mint_url::MintUrl; -use cdk_common::nut00::ProofsMethods; -use cdk_common::nut05::QuoteState; -use cdk_common::secret::Secret; -use cdk_common::{ +use cashu::common::LnKey; +use cashu::database::{self, MintDatabase}; +use cashu::mint::{self, MintKeySetInfo, MintQuote}; +use cashu::mint_url::MintUrl; +use cashu::nut00::ProofsMethods; +use cashu::nut05::QuoteState; +use cashu::secret::Secret; +use cashu::{ Amount, BlindSignature, BlindSignatureDleq, CurrencyUnit, Id, MeltBolt11Request, MeltQuoteState, MintQuoteState, PaymentMethod, Proof, Proofs, PublicKey, SecretKey, State, }; diff --git a/crates/cdk-sqlite/src/wallet/error.rs b/crates/cdk-sqlite/src/wallet/error.rs index 66514cfea..e76458a2c 100644 --- a/crates/cdk-sqlite/src/wallet/error.rs +++ b/crates/cdk-sqlite/src/wallet/error.rs @@ -13,28 +13,28 @@ pub enum Error { Serde(#[from] serde_json::Error), /// NUT00 Error #[error(transparent)] - CDKNUT00(#[from] cdk_common::nuts::nut00::Error), + CDKNUT00(#[from] cashu::nuts::nut00::Error), /// NUT01 Error #[error(transparent)] - CDKNUT01(#[from] cdk_common::nuts::nut01::Error), + CDKNUT01(#[from] cashu::nuts::nut01::Error), /// NUT02 Error #[error(transparent)] - CDKNUT02(#[from] cdk_common::nuts::nut02::Error), + CDKNUT02(#[from] cashu::nuts::nut02::Error), /// NUT04 Error #[error(transparent)] - CDKNUT04(#[from] cdk_common::nuts::nut04::Error), + CDKNUT04(#[from] cashu::nuts::nut04::Error), /// NUT05 Error #[error(transparent)] - CDKNUT05(#[from] cdk_common::nuts::nut05::Error), + CDKNUT05(#[from] cashu::nuts::nut05::Error), /// NUT07 Error #[error(transparent)] - CDKNUT07(#[from] cdk_common::nuts::nut07::Error), + CDKNUT07(#[from] cashu::nuts::nut07::Error), /// Secret Error #[error(transparent)] - CDKSECRET(#[from] cdk_common::secret::Error), + CDKSECRET(#[from] cashu::secret::Error), /// Mint Url #[error(transparent)] - MintUrl(#[from] cdk_common::mint_url::Error), + MintUrl(#[from] cashu::mint_url::Error), /// BIP32 Error #[error(transparent)] BIP32(#[from] bitcoin::bip32::Error), @@ -46,7 +46,7 @@ pub enum Error { InvalidDbPath, } -impl From for cdk_common::database::Error { +impl From for cashu::database::Error { fn from(e: Error) -> Self { Self::Database(Box::new(e)) } diff --git a/crates/cdk-sqlite/src/wallet/mod.rs b/crates/cdk-sqlite/src/wallet/mod.rs index fa2bb4899..31e18f35f 100644 --- a/crates/cdk-sqlite/src/wallet/mod.rs +++ b/crates/cdk-sqlite/src/wallet/mod.rs @@ -5,13 +5,13 @@ use std::path::Path; use std::str::FromStr; use async_trait::async_trait; -use cdk_common::common::ProofInfo; -use cdk_common::database::WalletDatabase; -use cdk_common::mint_url::MintUrl; -use cdk_common::nuts::{MeltQuoteState, MintQuoteState}; -use cdk_common::secret::Secret; -use cdk_common::wallet::{self, MintQuote}; -use cdk_common::{ +use cashu::common::ProofInfo; +use cashu::database::WalletDatabase; +use cashu::mint_url::MintUrl; +use cashu::nuts::{MeltQuoteState, MintQuoteState}; +use cashu::secret::Secret; +use cashu::wallet::{self, MintQuote}; +use cashu::{ database, Amount, CurrencyUnit, Id, KeySetInfo, Keys, MintInfo, Proof, PublicKey, SecretKey, SpendingConditions, State, }; diff --git a/crates/cdk/Cargo.toml b/crates/cdk/Cargo.toml index 0d1089bc9..6b28d8181 100644 --- a/crates/cdk/Cargo.toml +++ b/crates/cdk/Cargo.toml @@ -14,14 +14,14 @@ license = "MIT" default = ["mint", "wallet"] mint = ["dep:futures"] # We do not commit to a MSRV with swagger enabled -swagger = ["mint", "dep:utoipa", "cdk-common/swagger"] +swagger = ["mint", "dep:utoipa", "cashu/swagger"] wallet = ["dep:reqwest"] bench = [] http_subscription = [] [dependencies] -cdk-common = { path = "../cdk-common", version = "0.6.0", default-features = false } +cashu = { path = "../cashu", version = "0.6.0", default-features = false } cbor-diag = "0.1.12" arc-swap = "1.7.1" async-trait = "0.1" diff --git a/crates/cdk/src/cdk_database/mint_memory.rs b/crates/cdk/src/cdk_database/mint_memory.rs index 86ec3577e..2cec6948b 100644 --- a/crates/cdk/src/cdk_database/mint_memory.rs +++ b/crates/cdk/src/cdk_database/mint_memory.rs @@ -4,9 +4,9 @@ use std::collections::HashMap; use std::sync::Arc; use async_trait::async_trait; -use cdk_common::database::{Error, MintDatabase}; -use cdk_common::mint::MintKeySetInfo; -use cdk_common::nut00::ProofsMethods; +use cashu::database::{Error, MintDatabase}; +use cashu::mint::MintKeySetInfo; +use cashu::nut00::ProofsMethods; use tokio::sync::{Mutex, RwLock}; use uuid::Uuid; diff --git a/crates/cdk/src/cdk_database/mod.rs b/crates/cdk/src/cdk_database/mod.rs index e2ec6458a..0aeeb6156 100644 --- a/crates/cdk/src/cdk_database/mod.rs +++ b/crates/cdk/src/cdk_database/mod.rs @@ -6,6 +6,6 @@ pub mod mint_memory; pub mod wallet_memory; /// re-export types -pub use cdk_common::database::{Error, MintDatabase, WalletDatabase}; +pub use cashu::database::{Error, MintDatabase, WalletDatabase}; #[cfg(feature = "wallet")] pub use wallet_memory::WalletMemoryDatabase; diff --git a/crates/cdk/src/cdk_database/wallet_memory.rs b/crates/cdk/src/cdk_database/wallet_memory.rs index 5c2785db4..fd1b5be46 100644 --- a/crates/cdk/src/cdk_database/wallet_memory.rs +++ b/crates/cdk/src/cdk_database/wallet_memory.rs @@ -4,7 +4,7 @@ use std::collections::{HashMap, HashSet}; use std::sync::Arc; use async_trait::async_trait; -use cdk_common::database::{Error, WalletDatabase}; +use cashu::database::{Error, WalletDatabase}; use tokio::sync::RwLock; use crate::mint_url::MintUrl; diff --git a/crates/cdk/src/lib.rs b/crates/cdk/src/lib.rs index 27c3c96f0..0cd7bf965 100644 --- a/crates/cdk/src/lib.rs +++ b/crates/cdk/src/lib.rs @@ -15,7 +15,7 @@ pub mod pub_sub; /// Re-export amount type #[doc(hidden)] -pub use cdk_common::{ +pub use cashu::{ amount, common as types, dhke, error::{self, Error}, lightning as cdk_lightning, lightning_invoice, mint_url, nuts, secret, util, Amount, diff --git a/crates/cdk/src/mint/builder.rs b/crates/cdk/src/mint/builder.rs index d40e2b122..286e64ef3 100644 --- a/crates/cdk/src/mint/builder.rs +++ b/crates/cdk/src/mint/builder.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; use std::sync::Arc; use anyhow::anyhow; -use cdk_common::database::{self, MintDatabase}; +use cashu::database::{self, MintDatabase}; use super::nut17::SupportedMethods; use super::nut19::{self, CachedEndpoint}; diff --git a/crates/cdk/src/mint/melt.rs b/crates/cdk/src/mint/melt.rs index f2679b522..99d4ff4f8 100644 --- a/crates/cdk/src/mint/melt.rs +++ b/crates/cdk/src/mint/melt.rs @@ -2,7 +2,7 @@ use std::collections::HashSet; use std::str::FromStr; use anyhow::bail; -use cdk_common::nut00::ProofsMethods; +use cashu::nut00::ProofsMethods; use lightning_invoice::Bolt11Invoice; use tracing::instrument; use uuid::Uuid; diff --git a/crates/cdk/src/mint/mod.rs b/crates/cdk/src/mint/mod.rs index 0d7a16478..b57a8682a 100644 --- a/crates/cdk/src/mint/mod.rs +++ b/crates/cdk/src/mint/mod.rs @@ -6,9 +6,9 @@ use std::sync::Arc; use bitcoin::bip32::{ChildNumber, DerivationPath, Xpriv}; use bitcoin::secp256k1::{self, Secp256k1}; -use cdk_common::common::{LnKey, QuoteTTL}; -use cdk_common::database::{self, MintDatabase}; -use cdk_common::mint::MintKeySetInfo; +use cashu::common::{LnKey, QuoteTTL}; +use cashu::database::{self, MintDatabase}; +use cashu::mint::MintKeySetInfo; use config::SwappableConfig; use futures::StreamExt; use serde::{Deserialize, Serialize}; @@ -39,7 +39,7 @@ pub mod subscription; mod swap; pub use builder::{MintBuilder, MintMeltLimits}; -pub use cdk_common::mint::{MeltQuote, MintQuote}; +pub use cashu::mint::{MeltQuote, MintQuote}; /// Cashu Mint #[derive(Clone)] @@ -566,7 +566,7 @@ mod tests { use std::collections::HashSet; use bitcoin::Network; - use cdk_common::common::{LnKey, QuoteTTL}; + use cashu::common::{LnKey, QuoteTTL}; use secp256k1::Secp256k1; use uuid::Uuid; diff --git a/crates/cdk/src/mint/subscription/manager.rs b/crates/cdk/src/mint/subscription/manager.rs index 70610b692..3e246ae6d 100644 --- a/crates/cdk/src/mint/subscription/manager.rs +++ b/crates/cdk/src/mint/subscription/manager.rs @@ -2,9 +2,9 @@ use std::ops::Deref; use std::sync::Arc; -use cdk_common::database::{self, MintDatabase}; -use cdk_common::nut17::Notification; -use cdk_common::NotificationPayload; +use cashu::database::{self, MintDatabase}; +use cashu::nut17::Notification; +use cashu::NotificationPayload; use uuid::Uuid; use super::OnSubscription; diff --git a/crates/cdk/src/mint/subscription/on_subscription.rs b/crates/cdk/src/mint/subscription/on_subscription.rs index 08d1f1696..d2723ee15 100644 --- a/crates/cdk/src/mint/subscription/on_subscription.rs +++ b/crates/cdk/src/mint/subscription/on_subscription.rs @@ -3,10 +3,10 @@ //! This module contains the code that is triggered when a new subscription is created. use std::sync::Arc; -use cdk_common::database::{self, MintDatabase}; -use cdk_common::nut17::Notification; -use cdk_common::pub_sub::OnNewSubscription; -use cdk_common::NotificationPayload; +use cashu::database::{self, MintDatabase}; +use cashu::nut17::Notification; +use cashu::pub_sub::OnNewSubscription; +use cashu::NotificationPayload; use uuid::Uuid; use crate::nuts::{MeltQuoteBolt11Response, MintQuoteBolt11Response, ProofState, PublicKey}; diff --git a/crates/cdk/src/pub_sub/mod.rs b/crates/cdk/src/pub_sub/mod.rs index 532a14cc0..1bccc636a 100644 --- a/crates/cdk/src/pub_sub/mod.rs +++ b/crates/cdk/src/pub_sub/mod.rs @@ -15,9 +15,9 @@ use std::ops::{Deref, DerefMut}; use std::sync::atomic::{self, AtomicUsize}; use std::sync::Arc; -pub use cdk_common::pub_sub::index::{Index, Indexable, SubscriptionGlobalId}; -use cdk_common::pub_sub::OnNewSubscription; -pub use cdk_common::pub_sub::SubId; +pub use cashu::pub_sub::index::{Index, Indexable, SubscriptionGlobalId}; +use cashu::pub_sub::OnNewSubscription; +pub use cashu::pub_sub::SubId; use tokio::sync::{mpsc, RwLock}; use tokio::task::JoinHandle; diff --git a/crates/cdk/src/wallet/mod.rs b/crates/cdk/src/wallet/mod.rs index e3c062521..e09543d14 100644 --- a/crates/cdk/src/wallet/mod.rs +++ b/crates/cdk/src/wallet/mod.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use bitcoin::bip32::Xpriv; use bitcoin::Network; -use cdk_common::database::{self, WalletDatabase}; +use cashu::database::{self, WalletDatabase}; use client::MintConnector; use getrandom::getrandom; pub use multi_mint_wallet::MultiMintWallet; @@ -41,7 +41,7 @@ pub mod subscription; mod swap; pub mod util; -pub use cdk_common::wallet as types; +pub use cashu::wallet as types; use crate::nuts::nut00::ProofsMethods; diff --git a/crates/cdk/src/wallet/multi_mint_wallet.rs b/crates/cdk/src/wallet/multi_mint_wallet.rs index 59c3f3954..1af72c0d3 100644 --- a/crates/cdk/src/wallet/multi_mint_wallet.rs +++ b/crates/cdk/src/wallet/multi_mint_wallet.rs @@ -7,7 +7,7 @@ use std::collections::{BTreeMap, HashMap}; use std::str::FromStr; use std::sync::Arc; -use cdk_common::wallet::WalletKey; +use cashu::wallet::WalletKey; use tokio::sync::Mutex; use tracing::instrument;