hop-cli 0.2.61

Interact with Hop in your terminal
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use anyhow::Result;

use super::types::Balance;
use crate::state::http::HttpClient;

pub async fn get_project_balance(http: &HttpClient, project_id: &str) -> Result<Balance> {
    let balance = http
        .request::<Balance>(
            "GET",
            &format!("/projects/{project_id}/finance/balance"),
            None,
        )
        .await?
        .ok_or_else(|| anyhow::anyhow!("Error while parsing response"))?;

    Ok(balance)
}