agentswap 0.13.0

AgentSwap CLI for requesting quotes, inspecting tokens and pools, managing intents, and registering an API key against the AgentSwap service.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Read-only market service calls shared by CLI commands and MCP tools.
// Exports: tokens and pool lookup helpers.
// Deps: crate::{client, tokens}, eyre.

use crate::client::Client;
use crate::tokens::{chain_name_to_id, unknown_chain_id};
use eyre::{eyre, Result};

pub async fn tokens(client: &Client) -> Result<serde_json::Value> {
    client.tokens().await
}

pub async fn pool(client: &Client, chain_id: &str, address: &str) -> Result<serde_json::Value> {
    let chain_id =
        chain_name_to_id(chain_id).ok_or_else(|| eyre!("{}", unknown_chain_id(chain_id)))?;
    client.pool(chain_id, address).await
}