ido improvements & fixes (WIP)

This commit is contained in:
Hossein Zoda 2026-06-09 02:51:31 +03:00
parent b1df63c6c4
commit 856b374a6d
2 changed files with 292 additions and 140 deletions

File diff suppressed because one or more lines are too long

View file

@ -56,6 +56,26 @@ pub async fn list_idos(
Ok(cached_ok(serde_json::to_value(items).unwrap(), CACHE_NONE))
}
/// Get a single IDO by id token ID. Returns null if not found.
#[get("/by-id/<id>")]
pub async fn get_ido_by_id(
id: &str,
db: &State<DB>,
) -> CachedApiResult<Value> {
let blob = display_hex_to_blob::<TokenID>(id).map_err(|e| {
bad_request(
ApiErrorCode::InvalidParameters,
&format!("Invalid offering_token_id: {e}"),
)
})?;
let item = crate::db::ido::get_ido_by_preinit_txid(&db.ido_r, blob)
.await
.map_err(db_error)?;
Ok(cached_ok(serde_json::to_value(item).unwrap(), CACHE_NONE))
}
/// Get a single IDO by its offering token ID. Returns null if not found.
#[get("/by-offering-token/<offering_token_id>")]
pub async fn get_ido_by_offering_token(