Skip to main content

Crate erc8183

Crate erc8183 

Source
Expand description

§ERC-8183: Agentic Commerce Protocol Rust SDK

A type-safe, ergonomic Rust SDK for interacting with ERC-8183 on-chain contracts.

ERC-8183 defines the Agentic Commerce Protocol: a job with escrowed budget, six states (Open → Funded → Submitted → Completed | Rejected | Expired), and an evaluator who alone may mark the job completed. The client funds the job; the provider submits work; the evaluator attests completion or rejection.

§Quick Start

use alloy::primitives::{Address, U256};
use alloy::providers::ProviderBuilder;
use erc8183::{Erc8183, Network, types::CreateJobParams};

// 1. Connect using the built-in RPC URL
let network = Network::MonadMainnet;
let provider = ProviderBuilder::new()
    .connect_http(network.rpc_url().parse()?);

// 2. Create client and get a job handle
let client = Erc8183::new(provider).with_network(network);
let job = client.job()?;

// 3. Create a job (requires signer-enabled provider)
let params = CreateJobParams::new(
    Address::ZERO,                // deferred provider
    "0xEvaluator...".parse()?,    // evaluator
    U256::from(1_700_000_000u64), // expiredAt
    "Build a REST API",           // description
);
let job_id = job.create_job(params).await?;

// 4. Query job data
let data = job.get_job(job_id).await?;
println!("{data}"); // "Job #1 [Open] budget=0 client=0x... provider=0x..."

§Architecture

The SDK is designed around the alloy provider abstraction:

Re-exports§

pub use client::Erc8183;
pub use error::Result;
pub use error::SdkError;
pub use networks::Network;

Modules§

client
The top-level Erc8183 client for interacting with the Agentic Commerce Protocol.
contracts
Contract bindings for the ERC-8183 Agentic Commerce Protocol.
error
Typed error definitions for the ERC-8183 SDK.
hooks
Hook development helpers for the ERC-8183 Agentic Commerce Protocol.
job
Job operations for the Agentic Commerce Protocol.
networks
Pre-configured network definitions with known contract addresses.
types
Core domain types for the ERC-8183 SDK.