mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-22 07:04:56 +01:00
feat: signature on mint witness
This commit is contained in:
@@ -10,7 +10,7 @@ use cdk::cdk_database::{self, WalletDatabase};
|
||||
use cdk::mint_url::MintUrl;
|
||||
use cdk::nuts::{
|
||||
CurrencyUnit, Id, KeySetInfo, Keys, MeltQuoteState, MintInfo, MintQuoteState, Proof, PublicKey,
|
||||
SpendingConditions, State,
|
||||
SecretKey, SpendingConditions, State,
|
||||
};
|
||||
use cdk::secret::Secret;
|
||||
use cdk::types::ProofInfo;
|
||||
@@ -347,8 +347,8 @@ WHERE id=?
|
||||
sqlx::query(
|
||||
r#"
|
||||
INSERT OR REPLACE INTO mint_quote
|
||||
(id, mint_url, amount, unit, request, state, expiry)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?);
|
||||
(id, mint_url, amount, unit, request, state, expiry, secret_key)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?);
|
||||
"#,
|
||||
)
|
||||
.bind(quote.id.to_string())
|
||||
@@ -358,6 +358,7 @@ VALUES (?, ?, ?, ?, ?, ?, ?);
|
||||
.bind(quote.request)
|
||||
.bind(quote.state.to_string())
|
||||
.bind(quote.expiry as i64)
|
||||
.bind(quote.secret_key.map(|p| p.to_string()))
|
||||
.execute(&self.pool)
|
||||
.await
|
||||
.map_err(Error::from)?;
|
||||
@@ -832,9 +833,14 @@ fn sqlite_row_to_mint_quote(row: &SqliteRow) -> Result<MintQuote, Error> {
|
||||
let row_request: String = row.try_get("request").map_err(Error::from)?;
|
||||
let row_state: String = row.try_get("state").map_err(Error::from)?;
|
||||
let row_expiry: i64 = row.try_get("expiry").map_err(Error::from)?;
|
||||
let row_secret: Option<String> = row.try_get("secret_key").map_err(Error::from)?;
|
||||
|
||||
let state = MintQuoteState::from_str(&row_state)?;
|
||||
|
||||
let secret_key = row_secret
|
||||
.map(|key| SecretKey::from_str(&key))
|
||||
.transpose()?;
|
||||
|
||||
Ok(MintQuote {
|
||||
id: row_id,
|
||||
mint_url: MintUrl::from_str(&row_mint_url)?,
|
||||
@@ -843,6 +849,7 @@ fn sqlite_row_to_mint_quote(row: &SqliteRow) -> Result<MintQuote, Error> {
|
||||
request: row_request,
|
||||
state,
|
||||
expiry: row_expiry as u64,
|
||||
secret_key,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user