@@ -92,31 +92,6 @@ async fn resolve_fork_hash_http(client: &HttpClient, fork_block_hash: Option<Str
9292 Ok ( res)
9393}
9494
95- async fn fetch_para_id ( url : String ) -> eyre:: Result < u32 > {
96- // Connect to the node (adjust URL for your local foundry-polkadot/anvil-polkadot node)
97- // let ws_url = "ws://127.0.0.1:9944"; // or appropriate RPC/WS endpoint
98- let api = OnlineClient :: < PolkadotConfig > :: from_url ( url) . await ?;
99-
100- // Name of runtime API – check your runtime’s implementation, but typical is something like:
101- let api_name = "ParachainInfo_parachainId" ;
102-
103- // Call the runtime API at the latest block (None)
104- let para_id: u32 = api
105- . rpc ( )
106- . call_runtime_api ( api_name, None , ( ) )
107- . await ?;
108-
109- println ! ( "Parachain ID: {}" , para_id) ;
110- Ok ( ( ) )
111- }
112-
113- async fn fetch_methods ( client : & HttpClient ) -> eyre:: Result < u32 > {
114- let res: String = client. request ( "system_chain" , rpc_params ! [ ] ) . await ?;
115- print ! ( "methods {:#?}" , res) ;
116- Ok ( 0 )
117-
118- }
119-
12095async fn fetch_sync_spec_http ( client : & HttpClient , at_hex_opt : Option < String > ) -> eyre:: Result < Vec < u8 > > {
12196 let pb = ProgressBar :: new_spinner ( ) ;
12297 pb. set_style (
@@ -331,8 +306,6 @@ pub fn new(
331306 anvil_config : & AnvilNodeConfig ,
332307 mut config : Configuration ,
333308) -> Result < ( Service , TaskManager ) , ServiceError > {
334- let c;
335- //let mut para_id = 0;
336309 if let Some ( ref fork_url) = anvil_config. fork_url {
337310 let http_url = fork_url. clone ( ) ;
338311 let fork_block_hash = anvil_config. fork_block_hash . clone ( ) ;
@@ -349,10 +322,6 @@ pub fn new(
349322 . build ( http_url)
350323 . map_err ( |e| eyre:: eyre!( "http client build error: {e}" ) ) ?;
351324 let at_hex = resolve_fork_hash_http ( & http, fork_block_hash) . await ?;
352- // fetch_methods(&http).await;
353- // let id = fetch_methods(&http).await?;
354- fetch_para_id ( fork_url) . await ?;
355- // para_id = id;
356325 let try_sync = fetch_sync_spec_http ( & http, Some ( at_hex. clone ( ) ) ) . await ;
357326 match try_sync {
358327 Ok ( spec_bytes) => Ok ( Ok ( spec_bytes) ) ,
@@ -374,12 +343,10 @@ pub fn new(
374343 sc_chain_spec:: GenericChainSpec :: from_json_bytes ( spec_bytes)
375344 . map_err ( |e| ServiceError :: Other ( format ! ( "from_json_bytes failed: {e}" ) ) ) ?;
376345 config. chain_spec = Box :: new ( new_spec) ;
377- c = new_spec;
378-
379346 }
380347 Err ( top_map) => {
381348 config. chain_spec = build_forked_chainspec_from_raw_top ( top_map) ?;
382- c = build_forked_chainspec_from_raw_top ( top_map ) ? ;
349+
383350 }
384351 }
385352 }
0 commit comments