Skip to content

Commit

Permalink
Merge pull request #352 from mimisavage/fix-342
Browse files Browse the repository at this point in the history
feat(admin/quest_boost): add hex conversion for quest user addresses
  • Loading branch information
Marchand-Nicolas authored Dec 16, 2024
2 parents 6d4e36c + 5a1e886 commit 1728727
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/endpoints/admin/quest_boost/get_quest_users.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::middleware::auth::auth_middleware;
use crate::utils::verify_quest_auth;
use crate::utils::to_hex;
use crate::{
models::{AppState, CompletedTaskDocument, QuestDocument, QuestTaskDocument},
utils::get_error,
Expand All @@ -14,6 +15,7 @@ use futures::TryStreamExt;
use mongodb::bson::doc;
use serde::Deserialize;
use serde_json::json;
use starknet::core::types::FieldElement;
use std::collections::HashSet;
use std::sync::Arc;

Expand Down Expand Up @@ -79,7 +81,10 @@ pub async fn get_quest_users_handler(
.map(|task: CompletedTaskDocument| task.address().to_string())
.collect();

let users_list: Vec<String> = user_set.into_iter().collect();
let users_list: Vec<String> = user_set
.into_iter()
.filter_map(|addr| FieldElement::from_dec_str(&addr).ok().map(to_hex))
.collect();
users_list
}
Err(e) => return get_error(format!("Error processing completed tasks: {}", e)),
Expand Down

0 comments on commit 1728727

Please sign in to comment.