Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/07-supported-chains.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Each network has a canonical chain identifier. Endpoint discovery and transport
| BSC | `eip155:56` |
| Avalanche | `eip155:43114` |
| Etherlink | `eip155:42793` |
| Monad | `eip155:143` |
| Tempo | `eip155:4217` |
| Hyperliquid | `eip155:999` |

Expand Down Expand Up @@ -93,6 +94,7 @@ optimism → eip155:10
bsc → eip155:56
avalanche → eip155:43114
etherlink → eip155:42793
monad → eip155:143
tempo → eip155:4217
hyperliquid → eip155:999
solana → solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
Expand Down
21 changes: 21 additions & 0 deletions ows/crates/ows-core/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ pub const KNOWN_CHAINS: &[Chain] = &[
chain_type: ChainType::Evm,
chain_id: "eip155:42793",
},
Chain {
name: "monad",
chain_type: ChainType::Evm,
chain_id: "eip155:143",
},
Chain {
name: "solana",
chain_type: ChainType::Solana,
Expand Down Expand Up @@ -501,6 +506,22 @@ mod tests {
assert_eq!(chain.chain_id, "eip155:42793");
}

#[test]
fn test_parse_chain_monad_alias() {
let chain = parse_chain("monad").unwrap();
assert_eq!(chain.name, "monad");
assert_eq!(chain.chain_type, ChainType::Evm);
assert_eq!(chain.chain_id, "eip155:143");
}

#[test]
fn test_parse_chain_monad_caip2() {
let chain = parse_chain("eip155:143").unwrap();
assert_eq!(chain.name, "monad");
assert_eq!(chain.chain_type, ChainType::Evm);
assert_eq!(chain.chain_id, "eip155:143");
}

#[test]
fn test_parse_chain_caip2() {
let chain = parse_chain("eip155:42161").unwrap();
Expand Down
4 changes: 3 additions & 1 deletion ows/crates/ows-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl Config {
"eip155:43114".into(),
"https://api.avax.network/ext/bc/C/rpc".into(),
);
rpc.insert("eip155:143".into(), "https://rpc.monad.xyz".into());
Comment thread
cursor[bot] marked this conversation as resolved.
rpc.insert(
"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp".into(),
"https://api.mainnet-beta.solana.com".into(),
Expand Down Expand Up @@ -199,6 +200,7 @@ mod tests {
Some("https://polygon-rpc.com")
);
assert_eq!(config.rpc_url("eip155:9745"), Some("https://rpc.plasma.to"));
assert_eq!(config.rpc_url("eip155:143"), Some("https://rpc.monad.xyz"));
assert_eq!(
config.rpc_url("solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"),
Some("https://api.mainnet-beta.solana.com")
Expand Down Expand Up @@ -266,7 +268,7 @@ mod tests {
fn test_load_or_default_nonexistent() {
let config = Config::load_or_default_from(std::path::Path::new("/nonexistent/config.json"));
// Should have all default RPCs
assert_eq!(config.rpc.len(), 23);
assert_eq!(config.rpc.len(), 24);
assert_eq!(config.rpc_url("eip155:1"), Some("https://eth.llamarpc.com"));
assert_eq!(
config.rpc_url("near:mainnet"),
Expand Down
16 changes: 16 additions & 0 deletions ows/crates/ows-pay/src/chains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ mod tests {
);
}

#[test]
fn resolve_monad_name() {
assert_eq!(resolve_chain_type("monad"), Some(ChainType::Evm));
}

#[test]
fn resolve_monad_caip2() {
assert_eq!(resolve_chain_type("eip155:143"), Some(ChainType::Evm));
}

#[test]
fn display_monad() {
assert_eq!(display_name("monad"), "monad");
assert_eq!(display_name("eip155:143"), "monad");
}

#[test]
fn resolve_unknown_caip2_known_namespace() {
// Chain not in KNOWN_CHAINS but namespace is recognized.
Expand Down