Default giver params
@@ -52,6 +52,10 @@ const DEFAULT_NETWORK_ADDRESS: &str = "http://localhost";
const ROOT_CONTRACTS_PATH: &str = "src/tests/contracts/";
const LOG_CGF_PATH: &str = "src/tests/log_cfg.yaml";
+const GIVER_ADDRESS_VAR: &str = "TON_GIVER_ADDRESS";
+const GIVER_SECRET_VAR: &str = "TON_GIVER_SECRET";
+const GIVER_KEYS_FILENAME: &str = "giverKeys.json";
+
struct SimpleLogger;
const MAX_LEVEL: log::LevelFilter = log::LevelFilter::Warn;
@@ -244,13 +248,29 @@ impl TestClient {
}
pub fn giver_address() -> String {
- const GIVER_ADDRESS_VAR: &str = "TON_GIVER_ADDRESS";
+ if Self::node_se() {
+ "0:b5e9240fc2d2f1ff8cbb1d1dee7fb7cae155e5f6320e585fcc685698994a19a5".to_owned()
+ } else {
std::env::var(GIVER_ADDRESS_VAR)
- .expect(&format!("Please set giver's address in {} environment variable", GIVER_ADDRESS_VAR))
+ .unwrap_or("0:2bb4a0e8391e7ea8877f4825064924bd41ce110fce97e939d3323999e1efbb13".to_owned())
+ }
}
pub fn giver_keys() -> KeyPair {
- const GIVER_KEYS_FILENAME: &str = "giverKeys.json";
+ if Self::node_se() {
+ KeyPair {
+ public: "2ada2e65ab8eeab09490e3521415f45b6e42df9c760a639bcf53957550b25a16".to_owned(),
+ secret: "172af540e43a524763dd53b26a066d472a97c4de37d5498170564510608250c3".to_owned(),
+ }
+ } else {
+ if let Ok(secret) = std::env::var(GIVER_SECRET_VAR) {
+ let secret_key = ed25519_dalek::SecretKey::from_bytes(&hex::decode(&secret).unwrap()).unwrap();
+ let public_key = ed25519_dalek::PublicKey::from(&secret_key);
+ KeyPair {
+ public: hex::encode(public_key.to_bytes()),
+ secret,
+ }
+ } else {
let keys_file = dirs::home_dir()
.expect("Error obtaining user's home dir")
.join(GIVER_KEYS_FILENAME);
@@ -260,6 +280,9 @@ impl TestClient {
serde_json::from_str(&keys)
.expect(&format!("Error parsing {:?} as JSON", &keys_file))
}
+ }
+
+ }
pub fn network_address() -> String {
std::env::var("TON_NETWORK_ADDRESS").unwrap_or(DEFAULT_NETWORK_ADDRESS.into())
