Skip to content

Commit

Permalink
remove unused function in rpc_service
Browse files Browse the repository at this point in the history
  • Loading branch information
Tguntenaar committed Dec 19, 2024
1 parent 4b6c500 commit 24b2a63
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions src/rpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,48 +149,4 @@ impl RpcService {
}
}
}

pub async fn query(
&self,
method_name: String,
block_id: i64,
args_base64: String,
) -> Result<String, Status> {
let args = json!({
"request_type": "call_function",
"account_id": self.contract.0.to_string(),
"block_id": block_id,
"method_name": method_name,
"args_base64": args_base64
});

println!("Querying args: {:?}", args);

let result: Result<Data<QueryResponse>, _> = self
.contract
.call_function("query", args)
.unwrap()
.read_only()
.fetch_from(&self.network)
.await;

match result {
Ok(res) => {
// From ascii code to string
let decoded = res
.data
.result
.result
.iter()
.map(|c| *c as u8 as char)
.collect();
// Should return JSON object?
Ok(decoded)
}
Err(e) => {
eprintln!("Failed to query: {:?}", e);
Err(Status::InternalServerError)
}
}
}
}

0 comments on commit 24b2a63

Please sign in to comment.