mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-22 15:14:51 +01:00
nut06: mint_icon_url -> icon_url
This commit is contained in:
committed by
thesimplekid
parent
e67dc15ce6
commit
5a14ddbc67
@@ -77,7 +77,7 @@ impl JsMintInfo {
|
||||
description_long: Option<String>,
|
||||
contact: Option<Vec<JsContactInfo>>,
|
||||
nuts: JsValue,
|
||||
mint_icon_url: Option<String>,
|
||||
icon_url: Option<String>,
|
||||
motd: Option<String>,
|
||||
time: Option<u64>,
|
||||
) -> Result<JsMintInfo> {
|
||||
@@ -91,7 +91,7 @@ impl JsMintInfo {
|
||||
contact: contact
|
||||
.map(|contacts| contacts.iter().map(|c| c.deref().clone()).collect()),
|
||||
nuts: serde_wasm_bindgen::from_value(nuts).map_err(into_err)?,
|
||||
mint_icon_url,
|
||||
icon_url,
|
||||
motd,
|
||||
time,
|
||||
},
|
||||
@@ -145,8 +145,8 @@ impl JsMintInfo {
|
||||
|
||||
/// Get mint icon url
|
||||
#[wasm_bindgen(getter)]
|
||||
pub fn mint_icon_url(&self) -> Option<String> {
|
||||
self.inner.mint_icon_url.clone()
|
||||
pub fn icon_url(&self) -> Option<String> {
|
||||
self.inner.icon_url.clone()
|
||||
}
|
||||
|
||||
/// Get motd
|
||||
|
||||
@@ -14,7 +14,7 @@ mnemonic = ""
|
||||
# description = "These are not real sats for testing only"
|
||||
# description_long = "A longer mint for testing"
|
||||
# motd = "Hello world"
|
||||
# mint_icon_url = "https://this-is-a-mint-icon-url.com/icon.png"
|
||||
# icon_url = "https://this-is-a-mint-icon-url.com/icon.png"
|
||||
# contact_email = "hello@cashu.me"
|
||||
# Nostr pubkey of mint (Hex)
|
||||
# contact_nostr_public_key = ""
|
||||
|
||||
@@ -117,7 +117,7 @@ pub struct MintInfo {
|
||||
/// long description
|
||||
pub description_long: Option<String>,
|
||||
/// url to the mint icon
|
||||
pub mint_icon_url: Option<String>,
|
||||
pub icon_url: Option<String>,
|
||||
/// message of the day that the wallet must display to the user
|
||||
pub motd: Option<String>,
|
||||
/// Nostr publickey
|
||||
|
||||
@@ -407,8 +407,8 @@ async fn main() -> anyhow::Result<()> {
|
||||
mint_info = mint_info.pubkey(pubkey);
|
||||
}
|
||||
|
||||
if let Some(mint_icon_url) = &settings.mint_info.mint_icon_url {
|
||||
mint_info = mint_info.mint_icon_url(mint_icon_url);
|
||||
if let Some(icon_url) = &settings.mint_info.icon_url {
|
||||
mint_info = mint_info.icon_url(icon_url);
|
||||
}
|
||||
|
||||
if let Some(motd) = settings.mint_info.motd {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE mint RENAME COLUMN mint_icon_url TO icon_url;
|
||||
@@ -90,7 +90,7 @@ impl WalletDatabase for WalletSqliteDatabase {
|
||||
description_long,
|
||||
contact,
|
||||
nuts,
|
||||
mint_icon_url,
|
||||
icon_url,
|
||||
motd,
|
||||
time,
|
||||
) = match mint_info {
|
||||
@@ -103,7 +103,7 @@ impl WalletDatabase for WalletSqliteDatabase {
|
||||
description_long,
|
||||
contact,
|
||||
nuts,
|
||||
mint_icon_url,
|
||||
icon_url,
|
||||
motd,
|
||||
time,
|
||||
} = mint_info;
|
||||
@@ -116,7 +116,7 @@ impl WalletDatabase for WalletSqliteDatabase {
|
||||
description_long,
|
||||
contact.map(|c| serde_json::to_string(&c).ok()),
|
||||
serde_json::to_string(&nuts).ok(),
|
||||
mint_icon_url,
|
||||
icon_url,
|
||||
motd,
|
||||
time,
|
||||
)
|
||||
@@ -127,7 +127,7 @@ impl WalletDatabase for WalletSqliteDatabase {
|
||||
sqlx::query(
|
||||
r#"
|
||||
INSERT OR REPLACE INTO mint
|
||||
(mint_url, name, pubkey, version, description, description_long, contact, nuts, mint_icon_url, motd, mint_time)
|
||||
(mint_url, name, pubkey, version, description, description_long, contact, nuts, icon_url, motd, mint_time)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
|
||||
"#,
|
||||
)
|
||||
@@ -139,7 +139,7 @@ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
|
||||
.bind(description_long)
|
||||
.bind(contact)
|
||||
.bind(nuts)
|
||||
.bind(mint_icon_url)
|
||||
.bind(icon_url)
|
||||
.bind(motd)
|
||||
.bind(time.map(|v| v as i64))
|
||||
.execute(&self.pool)
|
||||
@@ -773,7 +773,7 @@ fn sqlite_row_to_mint_info(row: &SqliteRow) -> Result<MintInfo, Error> {
|
||||
let description_long: Option<String> = row.try_get("description_long").map_err(Error::from)?;
|
||||
let row_contact: Option<String> = row.try_get("contact").map_err(Error::from)?;
|
||||
let row_nuts: Option<String> = row.try_get("nuts").map_err(Error::from)?;
|
||||
let mint_icon_url: Option<String> = row.try_get("mint_icon_url").map_err(Error::from)?;
|
||||
let icon_url: Option<String> = row.try_get("icon_url").map_err(Error::from)?;
|
||||
let motd: Option<String> = row.try_get("motd").map_err(Error::from)?;
|
||||
let time: Option<i64> = row.try_get("mint_time").map_err(Error::from)?;
|
||||
|
||||
@@ -787,7 +787,7 @@ fn sqlite_row_to_mint_info(row: &SqliteRow) -> Result<MintInfo, Error> {
|
||||
nuts: row_nuts
|
||||
.and_then(|n| serde_json::from_str(&n).ok())
|
||||
.unwrap_or_default(),
|
||||
mint_icon_url,
|
||||
icon_url,
|
||||
motd,
|
||||
time: time.map(|t| t as u64),
|
||||
})
|
||||
|
||||
@@ -75,7 +75,7 @@ pub struct MintInfo {
|
||||
pub nuts: Nuts,
|
||||
/// Mint's icon URL
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub mint_icon_url: Option<String>,
|
||||
pub icon_url: Option<String>,
|
||||
/// message of the day that the wallet must display to the user
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub motd: Option<String>,
|
||||
@@ -153,12 +153,12 @@ impl MintInfo {
|
||||
}
|
||||
|
||||
/// Set mint icon url
|
||||
pub fn mint_icon_url<S>(self, mint_icon_url: S) -> Self
|
||||
pub fn icon_url<S>(self, icon_url: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Self {
|
||||
mint_icon_url: Some(mint_icon_url.into()),
|
||||
icon_url: Some(icon_url.into()),
|
||||
..self
|
||||
}
|
||||
}
|
||||
@@ -417,7 +417,7 @@ mod tests {
|
||||
}
|
||||
],
|
||||
"motd": "Message to display to users.",
|
||||
"mint_icon_url": "https://this-is-a-mint-icon-url.com/icon.png",
|
||||
"icon_url": "https://this-is-a-mint-icon-url.com/icon.png",
|
||||
"nuts": {
|
||||
"4": {
|
||||
"methods": [
|
||||
@@ -460,7 +460,7 @@ mod tests {
|
||||
["email", "contact@me.com"]
|
||||
],
|
||||
"motd": "Message to display to users.",
|
||||
"mint_icon_url": "https://this-is-a-mint-icon-url.com/icon.png",
|
||||
"icon_url": "https://this-is-a-mint-icon-url.com/icon.png",
|
||||
"nuts": {
|
||||
"4": {
|
||||
"methods": [
|
||||
|
||||
Reference in New Issue
Block a user