morpho-rs-api 0.1.0

Rust API library for querying Morpho V1 (MetaMorpho) and V2 vaults via GraphQL
Documentation

Morpho Vaults Rust API Library

This crate provides a Rust client for querying Morpho V1 (MetaMorpho) and V2 vaults via their GraphQL API.

Example

use morpho_rs_api::{VaultClient, VaultV1Client, VaultV2Client, Chain, VaultFiltersV1};

#[tokio::main]
async fn main() -> Result<(), morpho_rs_api::ApiError> {
    // Use separate clients for V1 and V2
    let v1_client = VaultV1Client::new();
    let v2_client = VaultV2Client::new();

    // Get whitelisted V1 vaults on Ethereum
    let v1_vaults = v1_client.get_whitelisted_vaults(Some(Chain::EthMainnet)).await?;

    // Get V2 vaults on Base
    let v2_vaults = v2_client.get_vaults_by_chain(Chain::BaseMainnet).await?;

    // Or use the combined client for unified queries
    let client = VaultClient::new();
    let all_vaults = client.get_whitelisted_vaults(Some(Chain::EthMainnet)).await?;

    Ok(())
}