MCPcopy Create free account
hub / github.com/BitVM/BitVM / handle_withdrawer

Method handle_withdrawer

bridge/src/client/cli/query_command.rs:258–295  ·  view source on GitHub ↗
(
        &mut self,
        matches: &ArgMatches,
        destination_network: DestinationNetwork,
    )

Source from the content-addressed store, hash-verified

256 }
257
258 pub async fn handle_withdrawer(
259 &mut self,
260 matches: &ArgMatches,
261 destination_network: DestinationNetwork,
262 ) -> Response {
263 let chain_address = Address::from_str(
264 matches
265 .get_one::<String>("WITHDRAWER_CHAIN_ADDRESS")
266 .unwrap(),
267 );
268 if chain_address.is_err() {
269 return Response::new(
270 ResponseStatus::NOK(format!(
271 "Invalid chain address. Use {} address format.",
272 destination_network
273 )),
274 None,
275 );
276 }
277
278 self.sync().await;
279 let result = self
280 .client
281 .get_withdrawer_status(chain_address.unwrap().to_string().as_str())
282 .await;
283
284 match result.len() {
285 len if len > 0 => {
286 let data =
287 Some(serde_json::to_value(result).expect("Failed to merge value vector"));
288 Response::new(ResponseStatus::OK, data)
289 }
290 _ => Response::new(
291 ResponseStatus::NOK("Withdrawer not found.".to_string()),
292 None,
293 ),
294 }
295 }
296
297 pub fn history_command() -> Command {
298 Command::new("history")

Callers 1

mainFunction · 0.80

Calls 3

get_withdrawer_statusMethod · 0.80
lenMethod · 0.80
syncMethod · 0.45

Tested by

no test coverage detected