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, types::CreateJobParams};

// 1. Create an alloy provider (any transport works: HTTP, WS, IPC)
let provider = ProviderBuilder::new()
    .connect_http("https://eth.llamarpc.com".parse()?);

// 2. Wrap it with the ERC-8183 client (no official deployment yet)
let client = Erc8183::new(provider)
    .with_address("0x1234...".parse()?);

// 3. Get a job handle for contract interactions
let job_handle = client.job()?;

// 4. 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_handle.create_job(&params).await?;
println!("Created job: {job_id}");

// 5. Query job data
let job = job_handle.get_job(job_id).await?;
println!("Job status: {}", job.status);

§Architecture

The SDK is designed around the alloy provider abstraction:

  • Erc8183 — The top-level client, generic over P: Provider. Accepts any alloy provider the user has already configured.
  • JobHandle — All job lifecycle operations: create, fund, submit, complete, reject, and query.
  • Network — Pre-configured network addresses for known deployments.
  • types — Domain types: JobStatus, Job, CreateJobParams, etc.
  • contracts — Raw alloy sol! bindings for the AgenticCommerce contract and the optional IACPHook interface.

Re-exports§

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

Modules§

client
The top-level Erc8183 client for interacting with the Agentic Commerce Protocol.
contracts
Contract bindings generated via inline Solidity interfaces.
error
Typed error definitions for the ERC-8183 SDK.
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.