monaco-sdk 0.8.1

Typed Rust client for the Monaco REST API — generated from the OpenAPI specification
Documentation
mod common;

use common::authenticate_and_faucet;

/// Contract-level check: the faucet endpoint authenticates, mints at least
/// one asset, and returns a tx hash per minted entry. We intentionally do
/// not poll the balance endpoint here — the faucet submits an on-chain
/// transfer whose indexing latency is environment-dependent, and we don't
/// want this SDK test to fail when the indexer is slow or offline.
#[tokio::test]
#[ignore = "requires running API server"]
async fn mint_tokens_returns_tx_hashes() {
    let (_token, _address, _signer, mint) = authenticate_and_faucet().await;

    let minted = mint.minted.expect("minted field should be present");
    assert!(
        !minted.is_empty(),
        "faucet should mint at least one asset for a fresh wallet; failed={:?}",
        mint.failed
    );

    for token in &minted {
        assert!(
            token.asset_id.is_some(),
            "minted entry missing asset_id: {token:?}"
        );
        assert!(
            token.amount.as_deref().is_some_and(|s| !s.is_empty()),
            "minted entry missing amount: {token:?}",
        );
        assert!(
            token
                .tx_hash
                .as_deref()
                .is_some_and(|s| s.starts_with("0x") && s.len() == 66),
            "minted entry should have a 0x-prefixed tx hash: {token:?}",
        );
    }
}

/// A fresh wallet's first call should report that one request has been
/// consumed from the 24h window. With the current 1/24h-per-address limit
/// on develop that means exactly 0 remaining after the mint. If the limit
/// is ever raised, this assertion will fail loudly and prompt us to
/// update both the test and any downstream docs — which is the behavior
/// we want from a release smoke test.
#[tokio::test]
#[ignore = "requires running API server"]
async fn fresh_wallet_consumes_rate_limit_slot() {
    let (_token, _address, _signer, mint) = authenticate_and_faucet().await;
    // remaining_requests_24h is an `Option<u32>`; when the server reports
    // the field we can assert the documented value. If the server omits it
    // entirely we stay quiet to keep the test tolerant of contract drift.
    if let Some(remaining) = mint.remaining_requests_24h {
        assert_eq!(
            remaining, 0,
            "fresh wallet's first mint should consume the single 24h slot (1/24h limit on develop), got {remaining}"
        );
    }
}