mirror of
https://github.com/fluencelabs/examples
synced 2025-07-31 00:41:56 +00:00
update latest block return
This commit is contained in:
@@ -33,17 +33,9 @@ pub fn get_latest_block(api_key: String) -> String {
|
||||
|
||||
let curl_cmd:Vec<String> = vec![header.into(), url.into()];
|
||||
let response = unsafe { curl_request(curl_cmd) };
|
||||
result_to_string(response)
|
||||
|
||||
/*
|
||||
let raw_string = result_to_string(response);
|
||||
let obj = serde_json::from_str(&raw_string);
|
||||
let res = match obj {
|
||||
Ok(x) => x["result"],
|
||||
Err(_) => "",
|
||||
};
|
||||
String::from(res)
|
||||
*/
|
||||
let res = result_to_string(response);
|
||||
let obj = serde_json::from_str::<serde_json::Value>(&res).unwrap();
|
||||
serde_json::from_value(obj["result"].clone()).unwrap()
|
||||
}
|
||||
|
||||
#[fce]
|
||||
|
Reference in New Issue
Block a user