-2

I'm currently attempting to add the Arbitrum Goerli Testnet as a new network, but I'm encountering difficulties. Despite following the steps, I'm not receiving any prompts or notifications on my screen. Specifically, I'm not seeing the expected pop-up window that should allow me to confirm the addition of the new network.

I'm uncertain about what might be causing this issue. I've double-checked my code, but I can't seem to identify the problem. Could someone kindly review the steps below and point out any potential mistakes?

 pub async fn add_network(&self) -> Result<(), ()> {
        println!("Inside add_network function"); // Debugging print
    
        let provider = self.provider.deref();
        let provider: Provider<Eip1193> = provider.borrow_mut().clone();
        
        let params = GeorliNetwork {
            chain_id: "0x66EED".to_string(),
            chain_name: "Arbitrum Goerli Testnet".to_string(),
            rpc_urls: vec!["http://goerli-rollup.arbitrum.io/rpc".to_string()],
        };
        
        // Add the Goerli network
        let res: Result<(), ProviderError> = provider.request("wallet_addEthereumChain", &params).await;
    
        // Check the result and handle any errors
        if let Err(error) = res { 
            println!("Error occurred: {:?}", error); // Debugging print
            return Err(()); // Return error so caller knows the function failed.
        }
        println!("Network added successfully"); // Debugging print
        Ok(())
    }

0 Answers0