Skip to content

Commit dc95cd0

Browse files
authored
Merge pull request #134 from franklad/feat/tempo-chain-alias
feat: add Tempo and Hyperliquid chain aliases
2 parents decf5c4 + 7708e9d commit dc95cd0

File tree

3 files changed

+58
-2
lines changed

3 files changed

+58
-2
lines changed

docs/07-supported-chains.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Each network has a canonical chain identifier. Endpoint discovery and transport
5757
| BSC | `eip155:56` |
5858
| Avalanche | `eip155:43114` |
5959
| Etherlink | `eip155:42793` |
60+
| Tempo | `eip155:4217` |
61+
| Hyperliquid | `eip155:999` |
6062

6163
### Non-EVM Networks
6264

@@ -88,6 +90,8 @@ optimism → eip155:10
8890
bsc → eip155:56
8991
avalanche → eip155:43114
9092
etherlink → eip155:42793
93+
tempo → eip155:4217
94+
hyperliquid → eip155:999
9195
solana → solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
9296
bitcoin → bip122:000000000019d6689c085ae165831e93
9397
cosmos → cosmos:cosmoshub-4

ows/crates/ows-core/src/chain.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ pub const KNOWN_CHAINS: &[Chain] = &[
180180
chain_type: ChainType::Nano,
181181
chain_id: "nano:mainnet",
182182
},
183+
Chain {
184+
name: "tempo",
185+
chain_type: ChainType::Evm,
186+
chain_id: "eip155:4217",
187+
},
188+
Chain {
189+
name: "hyperliquid",
190+
chain_type: ChainType::Evm,
191+
chain_id: "eip155:999",
192+
},
183193
];
184194

185195
/// Parse a chain string into a `Chain`. Accepts:
@@ -575,6 +585,38 @@ mod tests {
575585
assert!(parse_chain("unknown_chain").is_err());
576586
}
577587

588+
#[test]
589+
fn test_parse_chain_tempo_alias() {
590+
let chain = parse_chain("tempo").unwrap();
591+
assert_eq!(chain.name, "tempo");
592+
assert_eq!(chain.chain_type, ChainType::Evm);
593+
assert_eq!(chain.chain_id, "eip155:4217");
594+
}
595+
596+
#[test]
597+
fn test_parse_chain_tempo_caip2() {
598+
let chain = parse_chain("eip155:4217").unwrap();
599+
assert_eq!(chain.name, "tempo");
600+
assert_eq!(chain.chain_type, ChainType::Evm);
601+
assert_eq!(chain.chain_id, "eip155:4217");
602+
}
603+
604+
#[test]
605+
fn test_parse_chain_hyperliquid_alias() {
606+
let chain = parse_chain("hyperliquid").unwrap();
607+
assert_eq!(chain.name, "hyperliquid");
608+
assert_eq!(chain.chain_type, ChainType::Evm);
609+
assert_eq!(chain.chain_id, "eip155:999");
610+
}
611+
612+
#[test]
613+
fn test_parse_chain_hyperliquid_caip2() {
614+
let chain = parse_chain("eip155:999").unwrap();
615+
assert_eq!(chain.name, "hyperliquid");
616+
assert_eq!(chain.chain_type, ChainType::Evm);
617+
assert_eq!(chain.chain_id, "eip155:999");
618+
}
619+
578620
#[test]
579621
fn test_all_chain_types() {
580622
assert_eq!(ALL_CHAIN_TYPES.len(), 10);

ows/crates/ows-core/src/config.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ impl Config {
7474
"https://s.devnet.rippletest.net:51234".into(),
7575
);
7676
rpc.insert("nano:mainnet".into(), "https://rpc.nano.to".into());
77+
rpc.insert("eip155:4217".into(), "https://rpc.tempo.xyz".into());
78+
rpc.insert(
79+
"eip155:999".into(),
80+
"https://rpc.hyperliquid.xyz/evm".into(),
81+
);
7782
rpc
7883
}
7984
}
@@ -212,12 +217,17 @@ mod tests {
212217
config.rpc_url("ton:mainnet"),
213218
Some("https://toncenter.com/api/v2")
214219
);
220+
assert_eq!(config.rpc_url("eip155:4217"), Some("https://rpc.tempo.xyz"));
221+
assert_eq!(
222+
config.rpc_url("eip155:999"),
223+
Some("https://rpc.hyperliquid.xyz/evm")
224+
);
215225
}
216226

217227
#[test]
218228
fn test_rpc_lookup_miss() {
219229
let config = Config::default();
220-
assert_eq!(config.rpc_url("eip155:999"), None);
230+
assert_eq!(config.rpc_url("eip155:99999"), None);
221231
}
222232

223233
#[test]
@@ -254,7 +264,7 @@ mod tests {
254264
fn test_load_or_default_nonexistent() {
255265
let config = Config::load_or_default_from(std::path::Path::new("/nonexistent/config.json"));
256266
// Should have all default RPCs
257-
assert_eq!(config.rpc.len(), 19);
267+
assert_eq!(config.rpc.len(), 21);
258268
assert_eq!(config.rpc_url("eip155:1"), Some("https://eth.llamarpc.com"));
259269
}
260270

0 commit comments

Comments
 (0)