forked from fedimint/fedimint-clientd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
40 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
use axum::extract::State; | ||
use axum::Json; | ||
use serde::Serialize; | ||
|
||
use crate::cashu::Keyset; | ||
use crate::error::AppError; | ||
use crate::state::AppState; | ||
|
||
#[derive(Serialize)] | ||
#[serde(rename_all = "lowercase")] | ||
pub struct KeysetsResponse { | ||
keysets: Vec<Keyset>, | ||
} | ||
|
||
#[axum_macros::debug_handler] | ||
pub async fn handle_keysets(State(_state): State<AppState>) -> Result<(), AppError> { | ||
// TODO: Implement this function | ||
Ok(()) | ||
pub async fn handle_keysets( | ||
State(state): State<AppState>, | ||
) -> Result<Json<KeysetsResponse>, AppError> { | ||
let mut keysets = Vec::<Keyset>::new(); | ||
let ids = state.multimint.ids().await; | ||
for id in ids { | ||
keysets.push(Keyset::from(id)) | ||
} | ||
|
||
Ok(Json(KeysetsResponse { keysets })) | ||
} |