Skip to content

Commit ebfa1c2

Browse files
committed
Merge branch 'main' of https://github.com/qntx/erc8004
2 parents 75102a4 + 229c006 commit ebfa1c2

3 files changed

Lines changed: 90 additions & 58 deletions

File tree

Cargo.lock

Lines changed: 59 additions & 58 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
@@ -8,6 +8,7 @@ version = "0.2.3"
88
edition = "2024"
99
license = "MIT OR Apache-2.0"
1010
repository = "https://github.com/qntx/erc8004"
11+
description = "ERC-8004 Trustless Agents Rust SDK."
1112

1213
[workspace.dependencies]
1314
erc8004 = { path = "erc8004" }

erc8004/src/networks.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,36 @@ impl Network {
122122
}
123123
}
124124

125+
/// All known ERC-8004 network variants.
126+
pub const ALL: &[Self] = &[
127+
Self::EthereumMainnet,
128+
Self::EthereumSepolia,
129+
Self::BaseMainnet,
130+
Self::BaseSepolia,
131+
Self::PolygonMainnet,
132+
Self::PolygonAmoy,
133+
Self::ArbitrumMainnet,
134+
Self::ArbitrumSepolia,
135+
Self::CeloMainnet,
136+
Self::CeloAlfajores,
137+
Self::GnosisMainnet,
138+
Self::ScrollMainnet,
139+
Self::ScrollSepolia,
140+
Self::TaikoMainnet,
141+
Self::MonadMainnet,
142+
Self::MonadTestnet,
143+
Self::BscMainnet,
144+
Self::BscTestnet,
145+
];
146+
147+
/// Look up a [`Network`] by its EIP-155 chain ID.
148+
///
149+
/// Returns [`None`] if the chain ID is not a known ERC-8004 deployment.
150+
#[must_use]
151+
pub fn from_chain_id(chain_id: u64) -> Option<Self> {
152+
Self::ALL.iter().find(|n| n.chain_id() == chain_id).copied()
153+
}
154+
125155
/// Returns the `eip155:{chainId}` namespace prefix for agent registry identifiers.
126156
#[must_use]
127157
pub fn agent_registry_prefix(self) -> String {

0 commit comments

Comments
 (0)