Skip to content

Commit 4051cb2

Browse files
committed
Add ERC-8004 trustless agent registry support with new Cargo feature, client integration, and wallet method
- Add erc8004 dependency to workspace and machi package - Add "erc8004" Cargo feature (depends on wallet) and include in "full" feature set - Export Erc8004Network and RegistrationFile types in prelude when erc8004 feature enabled - Add WalletError::Erc8004 variant and erc8004() constructor for registry errors - Add evm/erc8004.rs module (conditionally compiled) - Add EvmWallet::erc8004_client() method to
1 parent 2e8e74c commit 4051cb2

File tree

10 files changed

+933
-1
lines changed

10 files changed

+933
-1
lines changed

Cargo.lock

Lines changed: 432 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ async-trait = "0.1"
1919
base64 = "0.22"
2020
convert_case = "0.11.0"
2121
darling = "0.23.0"
22+
erc8004 = "0.2"
2223
futures = "0.3"
2324
kobe = { version = "0.4", default-features = false, features = ["std", "rand"] }
2425
kobe-eth = { version = "0.4", default-features = false, features = ["std", "rand"] }

machi/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ a2a = ["ra2a"]
1818
mcp = ["rmcp"]
1919
wallet = ["kobe", "kobe-eth", "alloy"]
2020
x402 = ["wallet", "dep:x402-reqwest", "dep:x402-chain-eip155", "dep:x402-types", "dep:reqwest-middleware"]
21+
erc8004 = ["wallet", "dep:erc8004"]
2122
toolkit = []
2223
memory-sqlite = ["dep:rusqlite"]
2324
schema = ["dep:schemars"]
24-
full = ["openai", "ollama", "derive", "a2a", "mcp", "wallet", "x402", "toolkit", "memory-sqlite", "schema"]
25+
full = ["openai", "ollama", "derive", "a2a", "mcp", "wallet", "x402", "erc8004", "toolkit", "memory-sqlite", "schema"]
2526

2627
[dependencies]
2728
alloy = { workspace = true, optional = true }
2829
async-stream.workspace = true
2930
async-trait.workspace = true
3031
base64.workspace = true
32+
erc8004 = { workspace = true, optional = true }
3133
futures.workspace = true
3234
kobe = { workspace = true, optional = true }
3335
kobe-eth = { workspace = true, optional = true }

machi/src/prelude.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,7 @@ pub use crate::wallet::X402HttpClient;
7676
pub use crate::wallet::{
7777
DerivationStyle, DerivedAddress, EvmChain, EvmWallet, HdWallet, Wallet, WalletError,
7878
};
79+
#[cfg(feature = "erc8004")]
80+
pub use crate::wallet::{Erc8004Network, RegistrationFile};
7981
#[cfg(feature = "derive")]
8082
pub use machi_derive::tool;

machi/src/wallet/error.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ pub enum WalletError {
3535
#[cfg(feature = "x402")]
3636
#[error("x402 payment error: {0}")]
3737
Payment(String),
38+
39+
/// ERC-8004 registry interaction error.
40+
#[cfg(feature = "erc8004")]
41+
#[error("ERC-8004 error: {0}")]
42+
Erc8004(String),
3843
}
3944

4045
impl WalletError {
@@ -74,6 +79,13 @@ impl WalletError {
7479
pub fn payment(msg: impl Into<String>) -> Self {
7580
Self::Payment(msg.into())
7681
}
82+
83+
/// Create an ERC-8004 registry error.
84+
#[cfg(feature = "erc8004")]
85+
#[must_use]
86+
pub fn erc8004(msg: impl Into<String>) -> Self {
87+
Self::Erc8004(msg.into())
88+
}
7789
}
7890

7991
impl From<WalletError> for crate::tool::ToolError {

0 commit comments

Comments
 (0)