Cleanup of wallet owner API, rustdoc documentation (#2036)
* doc start * rustfmt * tightening up wallet owner API * rustfmt * remove burn tx functions * more tx api documentation * rustfmt
This commit is contained in:
@@ -222,31 +222,31 @@ where
|
||||
api.retrieve_txs(update_from_node, tx_id, tx_slate_id)
|
||||
}
|
||||
|
||||
fn dump_stored_tx(
|
||||
fn retrieve_stored_tx(
|
||||
&self,
|
||||
req: &Request<Body>,
|
||||
api: APIOwner<T, C, K>,
|
||||
) -> Result<Transaction, Error> {
|
||||
) -> Result<(bool, Option<Transaction>), Error> {
|
||||
let params = parse_params(req);
|
||||
if let Some(id_string) = params.get("id") {
|
||||
match id_string[0].parse() {
|
||||
Ok(id) => match api.dump_stored_tx(id, false, "") {
|
||||
Ok(tx) => Ok(tx),
|
||||
Ok(id) => match api.retrieve_txs(true, Some(id), None) {
|
||||
Ok((_, txs)) => Ok((txs[0].confirmed, txs[0].get_stored_tx())),
|
||||
Err(e) => {
|
||||
error!("dump_stored_tx: failed with error: {}", e);
|
||||
error!("retrieve_stored_tx: failed with error: {}", e);
|
||||
Err(e)
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
error!("dump_stored_tx: could not parse id: {}", e);
|
||||
error!("retrieve_stored_tx: could not parse id: {}", e);
|
||||
Err(ErrorKind::TransactionDumpError(
|
||||
"dump_stored_tx: cannot dump transaction. Could not parse id in request.",
|
||||
"retrieve_stored_tx: cannot dump transaction. Could not parse id in request.",
|
||||
).into())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Err(ErrorKind::TransactionDumpError(
|
||||
"dump_stored_tx: Cannot dump transaction. Missing id param in request.",
|
||||
"retrieve_stored_tx: Cannot retrieve transaction. Missing id param in request.",
|
||||
).into())
|
||||
}
|
||||
}
|
||||
@@ -292,7 +292,7 @@ where
|
||||
"retrieve_summary_info" => json_response(&self.retrieve_summary_info(req, api)?),
|
||||
"node_height" => json_response(&self.node_height(req, api)?),
|
||||
"retrieve_txs" => json_response(&self.retrieve_txs(req, api)?),
|
||||
"dump_stored_tx" => json_response(&self.dump_stored_tx(req, api)?),
|
||||
"retrieve_stored_tx" => json_response(&self.retrieve_stored_tx(req, api)?),
|
||||
_ => response(StatusCode::BAD_REQUEST, ""),
|
||||
})
|
||||
}
|
||||
@@ -440,18 +440,6 @@ where
|
||||
)
|
||||
}
|
||||
|
||||
fn issue_burn_tx(
|
||||
&self,
|
||||
_req: Request<Body>,
|
||||
mut api: APIOwner<T, C, K>,
|
||||
) -> Box<Future<Item = (), Error = Error> + Send> {
|
||||
// TODO: Args
|
||||
Box::new(match api.issue_burn_tx(60, 10, 1000) {
|
||||
Ok(_) => ok(()),
|
||||
Err(e) => err(e),
|
||||
})
|
||||
}
|
||||
|
||||
fn handle_post_request(&self, req: Request<Body>) -> WalletResponseFuture {
|
||||
let api = APIOwner::new(self.wallet.clone());
|
||||
match req
|
||||
@@ -478,10 +466,6 @@ where
|
||||
self.post_tx(req, api)
|
||||
.and_then(|_| ok(response(StatusCode::OK, ""))),
|
||||
),
|
||||
"issue_burn_tx" => Box::new(
|
||||
self.issue_burn_tx(req, api)
|
||||
.and_then(|_| ok(response(StatusCode::OK, ""))),
|
||||
),
|
||||
_ => Box::new(err(ErrorKind::GenericError(
|
||||
"Unknown error handling post request".to_owned(),
|
||||
).into())),
|
||||
|
||||
Reference in New Issue
Block a user