@@ -91,30 +91,24 @@ async fn resolve_fork_hash_http(client: &HttpClient, fork_block_hash: Option<Str
9191 Ok ( res)
9292}
9393
94- async fn fetch_para_id ( url : String ) -> eyre:: Result < u32 > {
95- // Connect to the node (adjust URL for your local foundry-polkadot/anvil-polkadot node)
96- // let ws_url = "ws://127.0.0.1:9944"; // or appropriate RPC/WS endpoint
97- let api = OnlineClient :: < PolkadotConfig > :: from_url ( url) . await ?;
98-
99- // Name of runtime API – check your runtime’s implementation, but typical is something like:
100- let api_name = "ParachainInfo_parachainId" ;
101-
102- // Call the runtime API at the latest block (None)
103- let para_id: u32 = api
104- . rpc ( )
105- . call_runtime_api ( api_name, None , ( ) )
106- . await ?;
94+ // async fn fetch_para_id(url: String) -> eyre::Result<u32> {
95+ // // Connect to the node (adjust URL for your local foundry-polkadot/anvil-polkadot node)
96+ // // let ws_url = "ws://127.0.0.1:9944"; // or appropriate RPC/WS endpoint
97+ // let api = OnlineClient::<PolkadotConfig>::from_url(url).await?;
10798
108- println ! ( "Parachain ID: {}" , para_id) ;
109- Ok ( ( ) )
110- }
99+ // // Name of runtime API – check your runtime’s implementation, but typical is something like:
100+ // let api_name = "ParachainInfo_parachainId";
111101
112- async fn fetch_methods ( client : & HttpClient ) -> eyre:: Result < u32 > {
113- let res: String = client. request ( "system_chain" , rpc_params ! [ ] ) . await ?;
114- print ! ( "methods {:#?}" , res) ;
115- Ok ( 0 )
102+ // // Call the runtime API at the latest block (None)
103+ // let para_id: u32 = api
104+ // .rpc()
105+ // .call_runtime_api(api_name, None, ())
106+ // .await?;
107+
108+ // println!("Parachain ID: {}", para_id);
109+ // Ok(())
110+ // }
116111
117- }
118112
119113async fn fetch_sync_spec_http ( client : & HttpClient , at_hex_opt : Option < String > ) -> eyre:: Result < Vec < u8 > > {
120114 let pb = ProgressBar :: new_spinner ( ) ;
@@ -343,9 +337,9 @@ pub fn new(
343337 anvil_config : & AnvilNodeConfig ,
344338 mut config : Configuration ,
345339) -> Result < ( Service , TaskManager ) , ServiceError > {
346- let c;
340+ // let c;
347341 //let mut para_id = 0;
348- if let Some ( ref fork_url) = anvil_config. fork_url {
342+ if let Some ( ref fork_url) = anvil_config. eth_rpc_url {
349343 let http_url = fork_url. clone ( ) ;
350344 let fork_block_hash = anvil_config. fork_block_hash . clone ( ) ;
351345 let spec_or_top = std:: thread:: spawn ( move || -> eyre:: Result < Result < Vec < u8 > , Map < String , Value > > > {
@@ -363,7 +357,7 @@ pub fn new(
363357 let at_hex = resolve_fork_hash_http ( & http, fork_block_hash) . await ?;
364358 // fetch_methods(&http).await;
365359 // let id = fetch_methods(&http).await?;
366- fetch_para_id ( fork_url) . await ?;
360+ // fetch_para_id(fork_url).await?;
367361 // para_id = id;
368362 let try_sync = fetch_sync_spec_http ( & http, Some ( at_hex. clone ( ) ) ) . await ;
369363 match try_sync {
@@ -386,12 +380,12 @@ pub fn new(
386380 sc_chain_spec:: GenericChainSpec :: from_json_bytes ( spec_bytes)
387381 . map_err ( |e| ServiceError :: Other ( format ! ( "from_json_bytes failed: {e}" ) ) ) ?;
388382 config. chain_spec = Box :: new ( new_spec) ;
389- c = new_spec;
383+ // c = new_spec;
390384
391385 }
392386 Err ( top_map) => {
393387 config. chain_spec = build_forked_chainspec_from_raw_top ( top_map) ?;
394- c = build_forked_chainspec_from_raw_top ( top_map) ?;
388+ // c = build_forked_chainspec_from_raw_top(top_map)?;
395389 }
396390 }
397391 }
0 commit comments