@@ -139,7 +139,7 @@ impl Config {
139139 /// that has an `[amp]` section. The `AmpConfig.address` string is parsed
140140 /// into a `Uri`; this is expected to always succeed because
141141 /// `ChainSection::validate` already rejects invalid URIs.
142- pub fn amp_chain_configs ( & self ) -> Result < HashMap < String , AmpChainConfig > > {
142+ pub fn amp_chain_configs ( & self ) -> Result < HashMap < ChainName , AmpChainConfig > > {
143143 let mut map = HashMap :: new ( ) ;
144144 for ( chain_name, chain) in & self . chains . chains {
145145 if let Some ( amp) = & chain. amp {
@@ -152,7 +152,7 @@ impl Config {
152152 )
153153 } ) ?;
154154 map. insert (
155- chain_name. clone ( ) ,
155+ chain_name. as_str ( ) . into ( ) ,
156156 AmpChainConfig {
157157 address : uri,
158158 token : amp. token . clone ( ) ,
@@ -1375,8 +1375,8 @@ mod tests {
13751375 use crate :: config:: { default_polling_interval, ChainSection , Web3Rule } ;
13761376
13771377 use super :: {
1378- AmpConfig , Chain , Config , FirehoseProvider , Provider , ProviderDetails , Shard , Transport ,
1379- Web3Provider ,
1378+ AmpConfig , Chain , ChainName , Config , FirehoseProvider , Provider , ProviderDetails , Shard ,
1379+ Transport , Web3Provider ,
13801380 } ;
13811381 use graph:: blockchain:: BlockchainKind ;
13821382 use graph:: firehose:: SubgraphLimit ;
@@ -2425,9 +2425,11 @@ fdw_pool_size = [
24252425
24262426 // Only mainnet (with amp) should be in the map
24272427 assert_eq ! ( map. len( ) , 1 ) ;
2428- assert ! ( !map. contains_key( "sepolia" ) ) ;
2428+ assert ! ( !map. contains_key( & ChainName :: from ( "sepolia" ) ) ) ;
24292429
2430- let mainnet = map. get ( "mainnet" ) . expect ( "mainnet should be in map" ) ;
2430+ let mainnet = map
2431+ . get ( & ChainName :: from ( "mainnet" ) )
2432+ . expect ( "mainnet should be in map" ) ;
24312433 assert_eq ! ( mainnet. address. to_string( ) , "http://localhost:50051/" ) ;
24322434 assert_eq ! ( mainnet. token. as_deref( ) , Some ( "my-token" ) ) ;
24332435 assert_eq ! ( mainnet. context_dataset, "eth" ) ;
@@ -2563,7 +2565,9 @@ fdw_pool_size = [
25632565 } ;
25642566
25652567 let map = config. amp_chain_configs ( ) . unwrap ( ) ;
2566- let mainnet = map. get ( "mainnet" ) . expect ( "mainnet should be in map" ) ;
2568+ let mainnet = map
2569+ . get ( & ChainName :: from ( "mainnet" ) )
2570+ . expect ( "mainnet should be in map" ) ;
25672571
25682572 // Identifiers with special characters should be double-quoted
25692573 assert_eq ! ( mainnet. context_dataset, "\" ns/data@v1\" " ) ;
@@ -2603,7 +2607,9 @@ fdw_pool_size = [
26032607 } ;
26042608
26052609 let map = config. amp_chain_configs ( ) . unwrap ( ) ;
2606- let mainnet = map. get ( "mainnet" ) . expect ( "mainnet should be in map" ) ;
2610+ let mainnet = map
2611+ . get ( & ChainName :: from ( "mainnet" ) )
2612+ . expect ( "mainnet should be in map" ) ;
26072613
26082614 // Simple identifiers should be lowercased and unquoted
26092615 assert_eq ! ( mainnet. context_dataset, "eth" ) ;
0 commit comments