Files
nym/explorer-api/src/client.rs
T
Bogdan-Ștefan Neacşu fadff7888b Feature/reuse init owner (#970)
* Save gateway owner for later use in erc20 bandwidth request

* Pass owner in network monitor

* Switch to variable length owner address

* Add erc20 bridge contract in validator client

* Check bandwidth credential refers to gateway

* Check the owner of the gateway from the eth event

* Fix wasm client

* Hack to avoid unused warning on coconut path

* Hacked, one-time payment

* Remove print

* Update arg format

* Fix token check

* Fix native template

* Use utokens instead of full token

... when talking to eth

* Fix parse event for new field

* Fix socks5 template

* Add estimation of gas call

* Make fs backup more reliable

* Fix clippy

* Fix unused import

* Update waiting time

* Remove defaults from run, as it they should be set on init

* Remove debugging prints

* Replaced unwrap with error

* Fix build

* Make eth contract address dependent of network

* Use tokio for sleep

* Add approve before spending token on bandwidth

* Put bandwidth claim only at the beginning of the process
2022-02-17 11:56:11 +01:00

23 lines
757 B
Rust

use network_defaults::{
default_api_endpoints, default_network, default_nymd_endpoints, DEFAULT_MIXNET_CONTRACT_ADDRESS,
};
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 nymd_url = default_nymd_endpoints()[0].clone();
let api_url = default_api_endpoints()[0].clone();
let client_config = validator_client::Config::new(
network,
nymd_url,
api_url,
Some(mixnet_contract.parse().unwrap()),
None,
None,
);
validator_client::Client::new_query(client_config).expect("Failed to connect to nymd!")
}