network-defaults: make defaults a bit more dynamic

By attaching network defaults to the selector enum, we can get them
either from DEFAULT_NETWORK or a selector passed as a dependency.
Hopefully this opens up some venues for being able to toggle between
networks at runtime.
This commit is contained in:
Jon Häggblad
2022-03-01 12:15:53 +01:00
parent b7bc713cd4
commit 2cf4393386
19 changed files with 681 additions and 164 deletions
+4 -5
View File
@@ -1,11 +1,10 @@
use network_defaults::{
default_api_endpoints, default_network, default_nymd_endpoints, DEFAULT_MIXNET_CONTRACT_ADDRESS,
};
use network_defaults::{default_api_endpoints, default_nymd_endpoints, DEFAULT_NETWORK};
use validator_client::nymd::QueryNymdClient;
pub(crate) fn new_nymd_client() -> validator_client::Client<QueryNymdClient> {
let network = default_network();
let mixnet_contract = DEFAULT_MIXNET_CONTRACT_ADDRESS.to_string();
let network = DEFAULT_NETWORK;
// WIP(JON): remove me, should pick up from network variable passed as first argument
let mixnet_contract = network.mixnet_contract_address().to_string();
let nymd_url = default_nymd_endpoints()[0].clone();
let api_url = default_api_endpoints()[0].clone();