Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
lassemand committed Dec 4, 2024
1 parent 9f4911a commit 31921d5
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions backend-rust/src/graphql_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4918,17 +4918,16 @@ pub struct CredentialsUpdated {
#[derive(SimpleObject, serde::Serialize, serde::Deserialize)]
#[graphql(complex)]
pub struct DataRegistered {
data_as_hex: String
data_as_hex: String,
}

#[ComplexObject]
impl DataRegistered {
async fn decoded(&self) -> ApiResult<DecodedText> {
let decoded_data = hex::decode(&self.data_as_hex)
.map_err(|e| {
error!("Invalid hex encoding {:?} in a controlled environment", e);
ApiError::InternalError("Failed to decode hex data".to_string())
})?;
let decoded_data = hex::decode(&self.data_as_hex).map_err(|e| {
error!("Invalid hex encoding {:?} in a controlled environment", e);
ApiError::InternalError("Failed to decode hex data".to_string())
})?;

Ok(DecodedText::from_bytes(decoded_data.as_slice()))
}
Expand Down Expand Up @@ -5024,11 +5023,10 @@ pub struct TransferMemo {
#[ComplexObject]
impl TransferMemo {
async fn decoded(&self) -> ApiResult<DecodedText> {
let decoded_data = hex::decode(&self.raw_hex)
.map_err(|e| {
error!("Invalid hex encoding {:?} in a controlled environment", e);
ApiError::InternalError("Failed to decode hex data".to_string())
})?;
let decoded_data = hex::decode(&self.raw_hex).map_err(|e| {
error!("Invalid hex encoding {:?} in a controlled environment", e);
ApiError::InternalError("Failed to decode hex data".to_string())
})?;

Ok(DecodedText::from_bytes(decoded_data.as_slice()))
}
Expand Down

0 comments on commit 31921d5

Please sign in to comment.