|
|
@@ -11,7 +11,7 @@ use serde_json::Value;
|
|
|
use crate::http_tool::RestTool;
|
|
|
use crate::response_base::ResponseData;
|
|
|
use sha2::Sha512;
|
|
|
-use tracing::{error, info};
|
|
|
+use tracing::{error, info, trace};
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
pub struct GateSwapRest {
|
|
|
@@ -403,6 +403,32 @@ impl GateSwapRest {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ //查询合约账户变更历史
|
|
|
+ pub async fn get_account_detali(&mut self) -> ResponseData {
|
|
|
+ let params = serde_json::json!({
|
|
|
+ });
|
|
|
+ let data = self.request("GET".to_string(),
|
|
|
+ "/api/v4".to_string(),
|
|
|
+ format!("/options/accounts"),
|
|
|
+ true,
|
|
|
+ params.to_string(),
|
|
|
+ ).await;
|
|
|
+ data
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询主账号下-子账户列表
|
|
|
+ pub async fn get_sub_accounts(&mut self) -> ResponseData {
|
|
|
+ let params = serde_json::json!({
|
|
|
+ });
|
|
|
+ let data = self.request("GET".to_string(),
|
|
|
+ "/api/v4".to_string(),
|
|
|
+ format!("/sub_accounts"),
|
|
|
+ true,
|
|
|
+ params.to_string(),
|
|
|
+ ).await;
|
|
|
+ data
|
|
|
+ }
|
|
|
+
|
|
|
/*******************************************************************************************************/
|
|
|
/*****************************************工具函数********************************************************/
|
|
|
/*******************************************************************************************************/
|
|
|
@@ -573,11 +599,12 @@ impl GateSwapRest {
|
|
|
let response = request_builder.send().await.unwrap();
|
|
|
let is_success = response.status().is_success(); // 先检查状态码
|
|
|
let text = response.text().await.unwrap();
|
|
|
+ trace!("text:{}",text.clone());
|
|
|
return if is_success {
|
|
|
self.on_success_data(&text)
|
|
|
} else {
|
|
|
self.on_error_data(&text, &addrs_url, ¶ms)
|
|
|
- }
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
pub fn on_success_data(&mut self, text: &String) -> ResponseData {
|