// No longer needed: use serde_json and ethers-core utilities directly.

#[cfg(not(target_arch = "wasm32"))]
pub async fn http_post(url: &str, body: &str) -> Result<serde_json::Value, EvmError> {
    let resp = reqwest::Client::new()
        .post(url)
        .header("content-type", "application/json")
        .body(body.to_owned())
        .send()
        .await
        .map_err(|e| EvmError::Rpc(e.to_string()))?;
    let json = resp.json().await.map_err(|e| EvmError::Rpc(e.to_string()))?;
    Ok(json)
}

#[cfg(target_arch = "wasm32")]
pub async fn http_post(url: &str, body: &str) -> Result<serde_json::Value, EvmError> {
    use gloo_net::http::Request;
    let resp = Request::post(url)
        .header("content-type", "application/json")
        .body(body).map_err(|e| EvmError::Rpc(e.to_string()))?
        .send().await.map_err(|e| EvmError::Rpc(e.to_string()))?;
    let json = resp.json().await.map_err(|e| EvmError::Rpc(e.to_string()))?;
    Ok(json)
}
