mirror of
https://github.com/creating2morrow/neveko.git
synced 2024-12-22 19:49:24 +00:00
fixup tx proxy args
This commit is contained in:
parent
ffee9de424
commit
348725ad4c
6 changed files with 45 additions and 30 deletions
|
@ -87,9 +87,14 @@ async fn find_tunnels() {
|
|||
debug!("creating http tunnel");
|
||||
create_http_proxy();
|
||||
}
|
||||
let env = utils::get_release_env();
|
||||
// only use tx proxy on mainnet
|
||||
if env == utils::ReleaseEnvironment::Production {
|
||||
if !has_tx_proxy_tunnel && !utils::is_using_remote_node() {
|
||||
debug!("creating tx proxy tunnel");
|
||||
create_tx_proxy_tunnel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Called on application startup for i2p tunnel creation,
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
use crate::{
|
||||
args,
|
||||
i2p,
|
||||
proof,
|
||||
reqres,
|
||||
utils, i2p,
|
||||
utils,
|
||||
};
|
||||
use clap::Parser;
|
||||
use diqwest::WithDigestAuth;
|
||||
|
@ -124,7 +125,7 @@ pub fn start_daemon() {
|
|||
let tx_proxy = format!("i2p,{}", utils::get_i2p_http_proxy());
|
||||
let port = get_daemon_port();
|
||||
let destination = i2p::get_destination(Some(port));
|
||||
let anon_inbound = format!("{}:{},8", destination, port);
|
||||
let anon_inbound = format!("{},127.0.0.1:{},8", destination, port);
|
||||
if release_env == utils::ReleaseEnvironment::Development {
|
||||
let args = ["--data-dir", &blockchain_dir, "--stagenet", "--detach"];
|
||||
let output = Command::new(format!("{}/monerod", bin_dir))
|
||||
|
@ -133,7 +134,8 @@ pub fn start_daemon() {
|
|||
.expect("monerod failed to start");
|
||||
debug!("{:?}", output.stdout);
|
||||
} else {
|
||||
let args = ["
|
||||
let args = [
|
||||
"
|
||||
--data-dir",
|
||||
&blockchain_dir,
|
||||
"--tx-proxy",
|
||||
|
@ -736,7 +738,9 @@ pub async fn submit_multisig(tx_data_hex: String) -> reqres::XmrRpcSubmitMultisi
|
|||
.await
|
||||
{
|
||||
Ok(response) => {
|
||||
let res = response.json::<reqres::XmrRpcSubmitMultisigResponse>().await;
|
||||
let res = response
|
||||
.json::<reqres::XmrRpcSubmitMultisigResponse>()
|
||||
.await;
|
||||
debug!("{} response: {:?}", RpcFields::SubmitMultisig.value(), res);
|
||||
match res {
|
||||
Ok(res) => res,
|
||||
|
|
|
@ -12,16 +12,13 @@ use log::{
|
|||
};
|
||||
use rocket::serde::json::Json;
|
||||
|
||||
|
||||
/*
|
||||
TODOs(c2m):
|
||||
- API to validate payment and import multisig info
|
||||
- API to upload gpg encrypted tracking number
|
||||
release tracking (locker code?) when txset is released
|
||||
- update order status
|
||||
- API to validate payment and import multisig info, update to multisig complete
|
||||
- API to upload gpg encrypted tracking number, update order to shipped
|
||||
release tracking (locker code?) when txset is released, update to delivered
|
||||
*/
|
||||
|
||||
|
||||
enum StatusType {
|
||||
_Delivered,
|
||||
MultisigMissing,
|
||||
|
@ -157,7 +154,8 @@ pub fn modify(o: Json<Order>) -> Order {
|
|||
/// Sign and submit multisig
|
||||
pub async fn sign_and_submit_multisig(
|
||||
orid: &String,
|
||||
tx_data_hex: &String) -> reqres::XmrRpcSubmitMultisigResponse {
|
||||
tx_data_hex: &String,
|
||||
) -> reqres::XmrRpcSubmitMultisigResponse {
|
||||
info!("signing and submitting multisig");
|
||||
let r_sign: reqres::XmrRpcSignMultisigResponse =
|
||||
monero::sign_multisig(String::from(tx_data_hex)).await;
|
||||
|
@ -168,3 +166,13 @@ pub async fn sign_and_submit_multisig(
|
|||
}
|
||||
r_submit
|
||||
}
|
||||
|
||||
pub async fn validate_order_for_ship() -> bool {
|
||||
info!("validating order for shipment");
|
||||
// import multisig info
|
||||
|
||||
// check balance and unlock_time
|
||||
|
||||
// update the order status to multisig complete
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@ async fn rocket() -> _ {
|
|||
routes![
|
||||
controller::get_order,
|
||||
controller::sign_and_submit_multisig,
|
||||
controller::update_order],
|
||||
controller::update_order
|
||||
],
|
||||
)
|
||||
.mount("/orders", routes![controller::get_orders])
|
||||
.mount("/products", routes![controller::get_products])
|
||||
|
|
|
@ -98,7 +98,7 @@ pub async fn create_order(
|
|||
Custom(Status::Created, Json(m_order))
|
||||
}
|
||||
|
||||
/// TODO: Customer order retreival. Must send `signature`
|
||||
/// TODO(c2m): Customer order retreival. Must send `signature`
|
||||
///
|
||||
/// which is the order id signed by the wallet.
|
||||
///
|
||||
|
@ -157,11 +157,8 @@ pub async fn rx_multisig_message(
|
|||
/// multisig info, check balance and sanity check `unlock_time`.
|
||||
///
|
||||
/// Protected: true
|
||||
#[post("/", data = "<message>")]
|
||||
pub async fn request_shipment(
|
||||
_jwp: proof::PaymentProof,
|
||||
message: Json<models::Message>,
|
||||
) -> Custom<Json<models::Message>> {
|
||||
//validate_order_for_ship();
|
||||
#[post("/")]
|
||||
pub async fn request_shipment(_jwp: proof::PaymentProof) -> Custom<Json<models::Message>> {
|
||||
order::validate_order_for_ship().await;
|
||||
Custom(Status::Ok, Json(Default::default()))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue