mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 07:11:36 +02:00
This commit is contained in:
@@ -74,7 +74,7 @@ fn comments() -> HashMap<String, String> {
|
||||
.to_string(),
|
||||
);
|
||||
retval.insert(
|
||||
"node_api_secret_path".to_string().replace("/", "\\"),
|
||||
"node_api_secret_path".to_string(),
|
||||
"
|
||||
#location of the node api secret for basic auth on the Grin API
|
||||
"
|
||||
|
||||
+17
-17
@@ -34,6 +34,7 @@ use crate::util::logger::LoggingConfig;
|
||||
/// Wallet configuration file name
|
||||
pub const WALLET_CONFIG_FILE_NAME: &str = "grin-wallet.toml";
|
||||
const WALLET_LOG_FILE_NAME: &str = "grin-wallet.log";
|
||||
/// .grin folder, usually in home/.grin
|
||||
pub const GRIN_HOME: &str = ".grin";
|
||||
/// Wallet data directory
|
||||
pub const GRIN_WALLET_DIR: &str = "wallet_data";
|
||||
@@ -211,22 +212,26 @@ pub fn initial_setup_wallet(
|
||||
// Update paths relative to current dir, assumes node secret is in user home
|
||||
default_config.update_paths(&wallet_path, &node_path);
|
||||
// Write config file, otherwise defaults will be writen
|
||||
default_config.write_to_file(
|
||||
&default_config
|
||||
.config_file_path
|
||||
.clone()
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap(),
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
);
|
||||
default_config
|
||||
.write_to_file(
|
||||
&default_config
|
||||
.config_file_path
|
||||
.clone()
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap(),
|
||||
false,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.unwrap_or_else(|e| {
|
||||
panic!("Error creating config file: {}", e);
|
||||
});
|
||||
(wallet_path, default_config)
|
||||
}
|
||||
|
||||
true => {
|
||||
let mut path = config_path.clone();
|
||||
let mut path = wallet_path.clone();
|
||||
path.pop();
|
||||
(
|
||||
path,
|
||||
@@ -335,13 +340,8 @@ impl GlobalWalletConfig {
|
||||
Some(secret_path.to_str().unwrap().to_owned());
|
||||
let mut node_secret_path = node_home.clone();
|
||||
node_secret_path.push(API_SECRET_FILE_NAME);
|
||||
dbg!("Voor update, path to node to set to:{}", &node_secret_path);
|
||||
self.members.as_mut().unwrap().wallet.node_api_secret_path =
|
||||
Some(node_secret_path.to_str().unwrap().to_owned());
|
||||
dbg!(
|
||||
"Na update, path to node:{}",
|
||||
&self.members.as_mut().unwrap().wallet.node_api_secret_path
|
||||
);
|
||||
let mut log_path = wallet_home.clone();
|
||||
log_path.push(WALLET_LOG_FILE_NAME);
|
||||
self.members
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
use crate::api::TLSConfig;
|
||||
use crate::apiwallet::{try_slatepack_sync_workflow, Owner};
|
||||
use crate::config::{TorConfig, WalletConfig, WALLET_CONFIG_FILE_NAME};
|
||||
use crate::core::{core, global};
|
||||
use crate::config::{TorConfig, WalletConfig};
|
||||
use crate::core::core;
|
||||
use crate::error::Error;
|
||||
use crate::impls::PathToSlatepack;
|
||||
use crate::impls::SlateGetter as _;
|
||||
@@ -82,12 +82,13 @@ where
|
||||
K: keychain::Keychain + 'static,
|
||||
{
|
||||
// Assume global chain type has already been initialized.
|
||||
let chain_type = global::get_chain_type();
|
||||
|
||||
let mut w_lock = owner_api.wallet_inst.lock();
|
||||
let p = w_lock.lc_provider()?;
|
||||
// Config and updating of config was moved to main, avoid overwriting with default value
|
||||
//p.create_config(&chain_type, WALLET_CONFIG_FILE_NAME, None, None, None)?;
|
||||
// Config creation was moved to main, only create new if config is ot in arguments
|
||||
// let chain_type = global::get_chain_type();
|
||||
// args.config, config: &WalletConfig) {
|
||||
// p.create_config(&chain_type, WALLET_CONFIG_FILE_NAME, None, None, None)?;
|
||||
// }
|
||||
p.create_wallet(
|
||||
None,
|
||||
args.recovery_phrase,
|
||||
|
||||
@@ -128,8 +128,8 @@ impl NodeClient for HTTPNodeClient {
|
||||
verified: Some(false),
|
||||
});
|
||||
} else {
|
||||
error!("Unable to contact Node to get version info: {}", e);
|
||||
warn!("Warning: You might need to correct 'node_api_secret_path' in your 'grin-wallet.toml' file");
|
||||
error!("Unable to contact Node to get version info: {}, check your node is running", e);
|
||||
warn!("Warning: a) Node is offline, or b) 'node_api_secret_path' in 'grin-wallet.toml' is set incorrectly");
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ fn real_main() -> i32 {
|
||||
let res = args.value_of("top_level_dir");
|
||||
match res {
|
||||
Some(d) => {
|
||||
current_dir = Some(PathBuf::from(d));
|
||||
current_dir = Some(PathBuf::from(d.replace("/", "\\")));
|
||||
}
|
||||
None => {
|
||||
warn!("Argument --top_level_dir needs a value. Defaulting to current directory")
|
||||
@@ -138,10 +138,8 @@ fn real_main() -> i32 {
|
||||
"Using wallet configuration file at {}",
|
||||
config.config_file_path.as_ref().unwrap().to_str().unwrap()
|
||||
);
|
||||
println!("here3");
|
||||
log_build_info();
|
||||
|
||||
dbg!(&config.members.as_mut().unwrap().wallet.node_api_secret_path);
|
||||
global::init_global_chain_type(
|
||||
config
|
||||
.members
|
||||
@@ -156,7 +154,6 @@ fn real_main() -> i32 {
|
||||
global::init_global_accept_fee_base(config.members.as_ref().unwrap().wallet.accept_fee_base());
|
||||
|
||||
let wallet_config = config.clone().members.unwrap().wallet;
|
||||
dbg!(&config.members.as_mut().unwrap().wallet.node_api_secret_path);
|
||||
let node_client = HTTPNodeClient::new(&wallet_config.check_node_api_http_addr, None).unwrap();
|
||||
cmd::wallet_command(&args, config, node_client)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user