mirror of
https://github.com/aljazceru/cdk.git
synced 2026-01-08 07:26:02 +01:00
Introduce cashu to host the shared types, traits and other common code (#519)
--------- Co-authored-by: thesimplekid <tsk@thesimplekid.com>
This commit is contained in:
@@ -13,28 +13,28 @@ pub enum Error {
|
||||
Serde(#[from] serde_json::Error),
|
||||
/// NUT00 Error
|
||||
#[error(transparent)]
|
||||
CDKNUT00(#[from] cdk::nuts::nut00::Error),
|
||||
CDKNUT00(#[from] cdk_common::nuts::nut00::Error),
|
||||
/// NUT01 Error
|
||||
#[error(transparent)]
|
||||
CDKNUT01(#[from] cdk::nuts::nut01::Error),
|
||||
CDKNUT01(#[from] cdk_common::nuts::nut01::Error),
|
||||
/// NUT02 Error
|
||||
#[error(transparent)]
|
||||
CDKNUT02(#[from] cdk::nuts::nut02::Error),
|
||||
CDKNUT02(#[from] cdk_common::nuts::nut02::Error),
|
||||
/// NUT04 Error
|
||||
#[error(transparent)]
|
||||
CDKNUT04(#[from] cdk::nuts::nut04::Error),
|
||||
CDKNUT04(#[from] cdk_common::nuts::nut04::Error),
|
||||
/// NUT05 Error
|
||||
#[error(transparent)]
|
||||
CDKNUT05(#[from] cdk::nuts::nut05::Error),
|
||||
CDKNUT05(#[from] cdk_common::nuts::nut05::Error),
|
||||
/// NUT07 Error
|
||||
#[error(transparent)]
|
||||
CDKNUT07(#[from] cdk::nuts::nut07::Error),
|
||||
CDKNUT07(#[from] cdk_common::nuts::nut07::Error),
|
||||
/// Secret Error
|
||||
#[error(transparent)]
|
||||
CDKSECRET(#[from] cdk::secret::Error),
|
||||
CDKSECRET(#[from] cdk_common::secret::Error),
|
||||
/// Mint Url
|
||||
#[error(transparent)]
|
||||
MintUrl(#[from] cdk::mint_url::Error),
|
||||
MintUrl(#[from] cdk_common::mint_url::Error),
|
||||
/// BIP32 Error
|
||||
#[error(transparent)]
|
||||
BIP32(#[from] bitcoin::bip32::Error),
|
||||
@@ -46,7 +46,7 @@ pub enum Error {
|
||||
InvalidDbPath,
|
||||
}
|
||||
|
||||
impl From<Error> for cdk::cdk_database::Error {
|
||||
impl From<Error> for cdk_common::database::Error {
|
||||
fn from(e: Error) -> Self {
|
||||
Self::Database(Box::new(e))
|
||||
}
|
||||
|
||||
@@ -5,17 +5,16 @@ use std::path::Path;
|
||||
use std::str::FromStr;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use cdk::amount::Amount;
|
||||
use cdk::cdk_database::{self, WalletDatabase};
|
||||
use cdk::mint_url::MintUrl;
|
||||
use cdk::nuts::{
|
||||
CurrencyUnit, Id, KeySetInfo, Keys, MeltQuoteState, MintInfo, MintQuoteState, Proof, PublicKey,
|
||||
SecretKey, SpendingConditions, State,
|
||||
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::{
|
||||
database, Amount, CurrencyUnit, Id, KeySetInfo, Keys, MintInfo, Proof, PublicKey, SecretKey,
|
||||
SpendingConditions, State,
|
||||
};
|
||||
use cdk::secret::Secret;
|
||||
use cdk::types::ProofInfo;
|
||||
use cdk::wallet;
|
||||
use cdk::wallet::MintQuote;
|
||||
use error::Error;
|
||||
use sqlx::sqlite::{SqliteConnectOptions, SqlitePool, SqliteRow};
|
||||
use sqlx::{ConnectOptions, Row};
|
||||
@@ -54,7 +53,7 @@ impl WalletSqliteDatabase {
|
||||
.expect("Could not run migrations");
|
||||
}
|
||||
|
||||
async fn set_proof_state(&self, y: PublicKey, state: State) -> Result<(), cdk_database::Error> {
|
||||
async fn set_proof_state(&self, y: PublicKey, state: State) -> Result<(), database::Error> {
|
||||
sqlx::query(
|
||||
r#"
|
||||
UPDATE proof
|
||||
@@ -74,7 +73,7 @@ impl WalletSqliteDatabase {
|
||||
|
||||
#[async_trait]
|
||||
impl WalletDatabase for WalletSqliteDatabase {
|
||||
type Err = cdk_database::Error;
|
||||
type Err = database::Error;
|
||||
|
||||
#[instrument(skip(self, mint_info))]
|
||||
async fn add_mint(
|
||||
|
||||
Reference in New Issue
Block a user