pub fn get_evm_network(
local: bool,
network_id: Option<u8>,
) -> Result<Network, Error>
Expand description
Initialize the EVM Network.
Try to obtain it first from environment variables. If that fails and local
is true,
try to get it from hardcoded values. Lastly, attempt to obtain it based on the network ID,
where 1 is reserved for the mainnet, 2 is reserved for the alpha network, and any other value
between 3 and 255 is reserved for testnets. In the case of a testnet, the network to use must
be configured via the environment variables. We can’t just default to Sepolia because sometimes
we want to use Anvil.
If all of these fail an error will be returned. It doesn’t really make sense to have a default for the EVM network. Doing so actually results in confusion for users where sometimes payments can be rejected because they are on the wrong network.