diff --git a/bindings/cdk-js/src/nuts/nut06.rs b/bindings/cdk-js/src/nuts/nut06.rs index 37e4f7cd..dbbb1912 100644 --- a/bindings/cdk-js/src/nuts/nut06.rs +++ b/bindings/cdk-js/src/nuts/nut06.rs @@ -77,7 +77,7 @@ impl JsMintInfo { description_long: Option, contact: Option>, nuts: JsValue, - mint_icon_url: Option, + icon_url: Option, motd: Option, time: Option, ) -> Result { @@ -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 { - self.inner.mint_icon_url.clone() + pub fn icon_url(&self) -> Option { + self.inner.icon_url.clone() } /// Get motd diff --git a/crates/cdk-mintd/example.config.toml b/crates/cdk-mintd/example.config.toml index 9d468dd6..db408fe0 100644 --- a/crates/cdk-mintd/example.config.toml +++ b/crates/cdk-mintd/example.config.toml @@ -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 = "" diff --git a/crates/cdk-mintd/src/config.rs b/crates/cdk-mintd/src/config.rs index a4c42846..16a2a7f7 100644 --- a/crates/cdk-mintd/src/config.rs +++ b/crates/cdk-mintd/src/config.rs @@ -117,7 +117,7 @@ pub struct MintInfo { /// long description pub description_long: Option, /// url to the mint icon - pub mint_icon_url: Option, + pub icon_url: Option, /// message of the day that the wallet must display to the user pub motd: Option, /// Nostr publickey diff --git a/crates/cdk-mintd/src/main.rs b/crates/cdk-mintd/src/main.rs index 67278e27..10de11c1 100644 --- a/crates/cdk-mintd/src/main.rs +++ b/crates/cdk-mintd/src/main.rs @@ -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 { diff --git a/crates/cdk-sqlite/src/wallet/migrations/20240902151515_icon_url.sql b/crates/cdk-sqlite/src/wallet/migrations/20240902151515_icon_url.sql new file mode 100644 index 00000000..bd672d4b --- /dev/null +++ b/crates/cdk-sqlite/src/wallet/migrations/20240902151515_icon_url.sql @@ -0,0 +1 @@ +ALTER TABLE mint RENAME COLUMN mint_icon_url TO icon_url; diff --git a/crates/cdk-sqlite/src/wallet/mod.rs b/crates/cdk-sqlite/src/wallet/mod.rs index e55e18c5..f45c6bb4 100644 --- a/crates/cdk-sqlite/src/wallet/mod.rs +++ b/crates/cdk-sqlite/src/wallet/mod.rs @@ -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 { let description_long: Option = row.try_get("description_long").map_err(Error::from)?; let row_contact: Option = row.try_get("contact").map_err(Error::from)?; let row_nuts: Option = row.try_get("nuts").map_err(Error::from)?; - let mint_icon_url: Option = row.try_get("mint_icon_url").map_err(Error::from)?; + let icon_url: Option = row.try_get("icon_url").map_err(Error::from)?; let motd: Option = row.try_get("motd").map_err(Error::from)?; let time: Option = row.try_get("mint_time").map_err(Error::from)?; @@ -787,7 +787,7 @@ fn sqlite_row_to_mint_info(row: &SqliteRow) -> Result { 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), }) diff --git a/crates/cdk/src/nuts/nut06.rs b/crates/cdk/src/nuts/nut06.rs index 9346818f..fb41fe10 100644 --- a/crates/cdk/src/nuts/nut06.rs +++ b/crates/cdk/src/nuts/nut06.rs @@ -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, + pub icon_url: Option, /// message of the day that the wallet must display to the user #[serde(skip_serializing_if = "Option::is_none")] pub motd: Option, @@ -153,12 +153,12 @@ impl MintInfo { } /// Set mint icon url - pub fn mint_icon_url(self, mint_icon_url: S) -> Self + pub fn icon_url(self, icon_url: S) -> Self where S: Into, { 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": [