Skip to main content

erc8004_search/
lib.rs

1//! # erc8004-search
2//!
3//! Rust SDK for the [ERC-8004 Semantic Search Service](https://github.com/qntx/erc8004-search-service).
4//!
5//! Provides a typed, ergonomic client for querying on-chain AI agent registrations
6//! via semantic search, with built-in [x402](https://www.x402.org/) payment support.
7//!
8//! ## Quick Start
9//!
10//! ```rust,ignore
11//! use erc8004_search::SearchClient;
12//! use alloy_signer_local::PrivateKeySigner;
13//!
14//! let signer: PrivateKeySigner = "0x...".parse()?;
15//! let client = SearchClient::builder()
16//!     .evm_signer(signer)
17//!     .build()?;
18//!
19//! let response = client.search("DeFi lending agent").await?;
20//! for result in &response.results {
21//!     println!("#{} {} (score: {:.3})", result.rank, result.name, result.score);
22//! }
23//! ```
24//!
25//! ## Custom Endpoint
26//!
27//! ```rust,ignore
28//! use erc8004_search::SearchClient;
29//! use alloy_signer_local::PrivateKeySigner;
30//!
31//! let signer: PrivateKeySigner = "0x...".parse()?;
32//! let client = SearchClient::builder()
33//!     .base_url("https://custom.example.com")
34//!     .evm_signer(signer)
35//!     .build()?;
36//! ```
37//!
38//! ## Feature Flags
39//!
40//! - **`evm`** *(default)* — EVM chain payment support via `r402-evm`
41//! - **`solana`** — Solana chain payment support via `r402-svm`
42
43mod client;
44mod error;
45mod types;
46
47pub use client::{DEFAULT_BASE_URL, SearchClient, SearchClientBuilder};
48pub use error::{Error, Result};
49pub use types::{
50    ApiFeatures, ApiLimits, CapabilitiesResponse, ErrorResponse, Filters, HealthResponse,
51    PaginationMeta, Protocol, ProviderInfo, ResultMetadata, SearchRequest, SearchResponse,
52    SearchResultItem, ServiceHealth, TrustModel, WalletFilter,
53};
54
55// Re-export x402 payment types for convenience.
56pub use r402::scheme::{FirstMatch, MaxAmount, PaymentSelector, PreferChain};
57#[cfg(feature = "evm")]
58pub use r402_evm::Eip155ExactClient;
59pub use r402_http::client::X402Client;