pub fn get_network_provider<N: NetworkConfiguration>(
network: &N,
custom_rpc_urls: Option<Vec<RpcConfig>>,
) -> Result<N::Provider, ProviderError>Expand description
Creates a network-specific provider instance based on the provided configuration.
§Type Parameters
N: The type of the network, which must implement theNetworkConfigurationtrait. This determines the specific provider type (N::Provider) and how to obtain public RPC URLs.
§Arguments
network: A reference to the network configuration object (&N).custom_rpc_urls: AnOption<Vec<RpcConfig>>. IfSomeand not empty, these URLs are used to configure the provider. IfNoneorSomebut empty, the function falls back to using the public RPC URLs defined by thenetwork’sNetworkConfigurationimplementation.
§Returns
Ok(N::Provider): An instance of the network-specific provider on success.Err(ProviderError): An error if configuration fails, such as when no custom URLs are provided and the network has no public RPC URLs defined (ProviderError::NetworkConfiguration).