Skip to content

Commit 008d0dc

Browse files
committed
Add an option to specify which Bitcoin wallet should be used
This commit fixes issue rgb-archive#6
1 parent 7812b9e commit 008d0dc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ fn main() {
3636
.value_name("DIRECTORY")
3737
.help("Sets a data directory")
3838
.takes_value(true))
39+
.arg(Arg::with_name("rpcwallet")
40+
.short("w")
41+
.long("rpcwallet")
42+
.value_name("WALLET NAME")
43+
.help("Sets the Bitcoin core's wallet name")
44+
.takes_value(true))
3945
.subcommand(SubCommand::with_name("issueasset")
4046
.about("Issue a new asset")
4147
.arg(Arg::with_name("title")
@@ -111,9 +117,11 @@ fn main() {
111117
let default_rgb_dir = home_dir().unwrap().join(".rgb");
112118
let datadir = Path::new(matches.value_of("datadir").unwrap_or(default_rgb_dir.to_str().unwrap()));
113119

120+
let rpc_wallet_path = matches.value_of("rpcwallet").unwrap_or("");
121+
114122
let config = kaleidoscope::Config::load_from(datadir);
115123
let mut database = database::Database::new(datadir);
116-
let mut client = jsonrpc::client::Client::new("http://".to_owned() + &config.rpcconnect + &":".to_owned() + &config.rpcport.to_string(), Some(config.rpcuser.clone()), Some(config.rpcpassword.clone()));
124+
let mut client = jsonrpc::client::Client::new(format!("http://{}:{}/wallet/{}", config.rpcconnect, config.rpcport.to_string(), rpc_wallet_path), Some(config.rpcuser.clone()), Some(config.rpcpassword.clone()));
117125

118126
// ---------------------------
119127

0 commit comments

Comments
 (0)