diff --git a/xmtp_cryptography/src/signature.rs b/xmtp_cryptography/src/signature.rs index 40bf589f0..6011d4517 100644 --- a/xmtp_cryptography/src/signature.rs +++ b/xmtp_cryptography/src/signature.rs @@ -114,14 +114,14 @@ pub fn h160addr_to_string(bytes: H160) -> String { /// Check if an string is a valid ethereum address (valid hex and length 20). pub fn is_valid_ethereum_address>(address: S) -> bool { let address = address.as_ref(); - let address = address.strip_prefix(&"0x").unwrap_or(&address); + let address = address.strip_prefix("0x").unwrap_or(address); if address.len() != 40 { return false; } for char in address.chars() { - if !char.is_digit(16) { + if !char.is_ascii_hexdigit() { return false; } } diff --git a/xmtp_mls/src/groups/intents.rs b/xmtp_mls/src/groups/intents.rs index f43270d95..5e634b99d 100644 --- a/xmtp_mls/src/groups/intents.rs +++ b/xmtp_mls/src/groups/intents.rs @@ -74,11 +74,11 @@ impl AddMembersIntentData { Self { account_addresses } } - pub(crate) fn to_bytes(self) -> Result, IntentError> { + pub(crate) fn to_bytes(&self) -> Result, IntentError> { let mut buf = Vec::new(); AddMembersData { version: Some(AddMembersVersion::V1(AddMembersV1 { - account_addresses: self.account_addresses, + account_addresses: self.account_addresses.clone(), })), } .encode(&mut buf) @@ -116,12 +116,12 @@ impl RemoveMembersIntentData { Self { account_addresses } } - pub(crate) fn to_bytes(self) -> Vec { + pub(crate) fn to_bytes(&self) -> Vec { let mut buf = Vec::new(); RemoveMembersData { version: Some(RemoveMembersVersion::V1(RemoveMembersV1 { - account_addresses: self.account_addresses, + account_addresses: self.account_addresses.clone(), })), } .encode(&mut buf)