diff --git a/src/models/profiles/queries.rs b/src/models/profiles/queries.rs index 2b410bd..783651a 100644 --- a/src/models/profiles/queries.rs +++ b/src/models/profiles/queries.rs @@ -398,10 +398,9 @@ pub async fn search_profile_by_did( let rows = if let Some(currency) = did.currency() { // If currency is Ethereum, // search over extra fields must be case insensitive. - #[allow(unreachable_patterns)] let value_op = match currency { Currency::Ethereum => "ILIKE", - _ => "LIKE", + Currency::Monero => "LIKE", }; // This query does not scan user_account.wallet_address because // login addresses are private. diff --git a/src/utils/currencies.rs b/src/utils/currencies.rs index 1ece1b9..7d30ca8 100644 --- a/src/utils/currencies.rs +++ b/src/utils/currencies.rs @@ -8,12 +8,14 @@ use super::caip2::ChainId; #[derive(Debug, PartialEq)] pub enum Currency { Ethereum, + Monero, } impl Currency { fn code(&self) -> String { match self { Self::Ethereum => "ETH", + Self::Monero => "XMR", }.to_string() } @@ -29,6 +31,7 @@ impl Currency { pub fn normalize_address(&self, address: &str) -> String { match self { Self::Ethereum => address.to_lowercase(), + Self::Monero => address.to_string(), } } } @@ -37,6 +40,7 @@ impl From<&Currency> for ChainId { fn from(value: &Currency) -> Self { let (namespace, reference) = match value { Currency::Ethereum => ("eip155", "1"), + Currency::Monero => unimplemented!(), }; Self { namespace: namespace.to_string(), @@ -72,6 +76,7 @@ pub fn validate_wallet_address( return Err(ValidationError("address is not lowercase")); }; }, + Currency::Monero => (), // no validation }; Ok(()) }