Skip to content

Commit

Permalink
Allow POST request for staking endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreLeGuen committed Dec 5, 2023
1 parent 41d1ea1 commit 5e25f6c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ async fn router() -> anyhow::Result<Router> {
.route("/balancesfull", post(get_balances_full))
.with_state((sql_client.clone(), ft_service.clone(), kitwallet))
.route("/staking", get(get_staking_report))
.route("/staking", post(get_staking_report))
.with_state((sql_client.clone(), ft_service.clone()))
.route("/lockup", get(get_lockup_balances))
.with_state((sql_client, ft_service))
Expand Down Expand Up @@ -633,9 +634,15 @@ struct StakingDeposit {
}

async fn get_staking_report(
Query(params): Query<DateAndAccounts>,
params: Option<Query<DateAndAccounts>>,
State((sql_client, ft_service)): State<(SqlClient, FtService)>,
body: Option<Json<DateAndAccounts>>,
) -> Result<Response<Body>, AppError> {
let params = match params {
Some(params) => params.0,
None => body.unwrap().0,
};

let date: DateTime<chrono::Utc> = DateTime::parse_from_rfc3339(&params.date).unwrap().into();
let start_nanos = date.timestamp_nanos() as u128;

Expand Down

0 comments on commit 5e25f6c

Please sign in to comment.