Sending end of the wallet
Most of the logic to build a transaction that sends coin to another party. Still requires more debugging and clean up. Main changes and additions are: * Update to serde 1.0 * API endpoint to retrieve an Output * Output is now Serialize and Deserialize * Wallet configuration * Command line for the send operation * Wallet data checker to update created outputs into confirmed * Wallet-specific configuration
This commit is contained in:
+3
-2
@@ -26,8 +26,9 @@ use rest::Error;
|
||||
/// returns a JSON object. Handles request building, JSON deserialization and
|
||||
/// response code checking.
|
||||
pub fn get<'a, T>(url: &'a str) -> Result<T, Error>
|
||||
where T: Deserialize
|
||||
where for<'de> T: Deserialize<'de>
|
||||
{
|
||||
println!("get {}", url);
|
||||
let client = hyper::Client::new();
|
||||
let res = check_error(client.get(url).send())?;
|
||||
serde_json::from_reader(res)
|
||||
@@ -40,7 +41,7 @@ pub fn get<'a, T>(url: &'a str) -> Result<T, Error>
|
||||
/// checking.
|
||||
pub fn post<'a, IN, OUT>(url: &'a str, input: &IN) -> Result<OUT, Error>
|
||||
where IN: Serialize,
|
||||
OUT: Deserialize
|
||||
for<'de> OUT: Deserialize<'de>
|
||||
{
|
||||
let in_json = serde_json::to_string(input)
|
||||
.map_err(|e| Error::Internal(format!("Could not serialize data to JSON: {}", e)))?;
|
||||
|
||||
Reference in New Issue
Block a user