mirror of
https://github.com/creating2morrow/neveko.git
synced 2024-12-22 11:39:22 +00:00
enable multisig from prepare_multisig
This commit is contained in:
parent
20cafa906f
commit
2171dafdbf
5 changed files with 18 additions and 61 deletions
|
@ -101,7 +101,6 @@ NEVidebla-EKOnomia (invisible economy)
|
|||
* can be overriden with remote node
|
||||
* use the `--remote-node` flag
|
||||
* [monero-wallet-rpc](https://www.getmonero.org/downloads/#cli) - (not included) interface for xmr wallet ops
|
||||
* [monero-wallet-cli](https://www.getmonero.org/downloads/#cli) - enable experimental multisig
|
||||
* [i2p-zero](https://github.com/creating2morrow/i2p-zero/releases/tag/v1.21-neveko) - (not included) tunnel creation and http proxy
|
||||
|
||||
most of the complex logic stays in neveko-core, exported from [lib.rs](./neveko-core/src/lib.rs)
|
||||
|
|
|
@ -787,10 +787,14 @@ pub async fn prepare_wallet() -> reqres::XmrRpcPrepareResponse {
|
|||
info!("executing {}", RpcFields::Prepare.value());
|
||||
let client = reqwest::Client::new();
|
||||
let host = get_rpc_host();
|
||||
let req = reqres::XmrRpcRequest {
|
||||
let params = reqres::XmrRpcPrepareParams {
|
||||
enable_experimental_multisig: true,
|
||||
};
|
||||
let req = reqres::XmrRpcPrepareRequest {
|
||||
jsonrpc: RpcFields::JsonRpcVersion.value(),
|
||||
id: RpcFields::Id.value(),
|
||||
method: RpcFields::Prepare.value(),
|
||||
params,
|
||||
};
|
||||
let login: RpcLogin = get_rpc_creds();
|
||||
match client
|
||||
|
@ -1577,56 +1581,3 @@ pub async fn p_get_transactions(
|
|||
}
|
||||
|
||||
// End XMR daemon methods
|
||||
|
||||
/// enable multisig - `monero-wallet-cli --password <> --wallet-file <> set
|
||||
/// enable-multisig-experimental 1`
|
||||
pub fn enable_experimental_multisig(wallet_file: &String) {
|
||||
warn!("Enabling experimental multisig...");
|
||||
let bin_dir = get_monero_location();
|
||||
let user = std::env::var("USER").unwrap_or(utils::empty_string());
|
||||
let file_path = format!(
|
||||
"/home/{}/.{}/stagenet/wallet/{}",
|
||||
&user,
|
||||
crate::APP_NAME,
|
||||
&wallet_file
|
||||
);
|
||||
let wallet_password = utils::empty_string();
|
||||
let release_env = utils::get_release_env();
|
||||
let args = if release_env == utils::ReleaseEnvironment::Production {
|
||||
vec![
|
||||
"--password",
|
||||
&wallet_password,
|
||||
"--wallet-file",
|
||||
&file_path,
|
||||
"set",
|
||||
"enable-multisig-experimental",
|
||||
"1",
|
||||
]
|
||||
} else {
|
||||
vec![
|
||||
"--stagenet",
|
||||
"--password",
|
||||
&wallet_password,
|
||||
"--wallet-file",
|
||||
&file_path,
|
||||
"set",
|
||||
"enable-multisig-experimental",
|
||||
"1",
|
||||
]
|
||||
};
|
||||
let mut output = Command::new(format!("{}/monero-wallet-cli", bin_dir))
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.args(args)
|
||||
.spawn()
|
||||
.expect("failed to enable experimental msig");
|
||||
let _ = std::io::stdout().flush();
|
||||
let mut stdin = output.stdin.take().expect("Failed to open stdin");
|
||||
std::thread::spawn(move || {
|
||||
stdin
|
||||
.write_all(&wallet_password.as_bytes())
|
||||
.expect("Failed to write to stdin");
|
||||
});
|
||||
let d_output = output.wait_with_output().expect("Failed to read stdout");
|
||||
debug!("{:?}", d_output);
|
||||
}
|
||||
|
|
|
@ -72,9 +72,7 @@ pub async fn create(j_order: Json<reqres::OrderRequest>) -> Order {
|
|||
monero::close_wallet(&orid, &wallet_password).await;
|
||||
return Default::default();
|
||||
}
|
||||
// enable multisig
|
||||
monero::close_wallet(&orid, &order_wallet_password).await;
|
||||
monero::enable_experimental_multisig(&orid);
|
||||
debug!("insert order: {:?}", &new_order);
|
||||
let s = db::Interface::async_open().await;
|
||||
// inject adjudicator separately, modifying the order model is mendokusai
|
||||
|
@ -826,7 +824,5 @@ pub async fn init_adjudicator_wallet(orid: &String) {
|
|||
if !m_wallet {
|
||||
log::error!("failed to create adjudicator wallet");
|
||||
}
|
||||
// enable multisig
|
||||
monero::close_wallet(&orid, &password).await;
|
||||
monero::enable_experimental_multisig(&orid);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,11 @@ pub struct XmrRpcOpenWalletParams {
|
|||
pub password: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct XmrRpcPrepareParams {
|
||||
pub enable_experimental_multisig: bool
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct XmrRpcMakeParams {
|
||||
pub multisig_info: Vec<String>,
|
||||
|
@ -226,6 +231,14 @@ pub struct XmrRpcBalanceRequest {
|
|||
pub params: XmrRpcBalanceParams,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct XmrRpcPrepareRequest {
|
||||
pub jsonrpc: String,
|
||||
pub id: String,
|
||||
pub method: String,
|
||||
pub params: XmrRpcPrepareParams,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct XmrRpcMakeRequest {
|
||||
pub jsonrpc: String,
|
||||
|
|
|
@ -1841,9 +1841,7 @@ fn send_prepare_info_req(
|
|||
let _ = tx.send(utils::empty_string());
|
||||
return;
|
||||
}
|
||||
// enable multisig
|
||||
monero::close_wallet(&w_orid, &wallet_password).await;
|
||||
monero::enable_experimental_multisig(&w_orid);
|
||||
monero::open_wallet(&w_orid, &wallet_password).await;
|
||||
let prepare_info = monero::prepare_wallet().await;
|
||||
let ref_prepare_info: &String = &prepare_info.result.multisig_info;
|
||||
|
|
Loading…
Reference in a new issue