(
&self,
matches: &ArgMatches,
destination_network: DestinationNetwork,
)
| 364 | } |
| 365 | |
| 366 | pub async fn handle_transactions( |
| 367 | &self, |
| 368 | matches: &ArgMatches, |
| 369 | destination_network: DestinationNetwork, |
| 370 | ) -> Response { |
| 371 | let args = vec![ |
| 372 | "DEPOSITOR_PUBLIC_KEY".to_string(), |
| 373 | "DESTINATION_CHAIN_ADDRESS".into(), |
| 374 | "OUTPOINT".into(), |
| 375 | "SATS".into(), |
| 376 | ]; |
| 377 | let validate_result = match validate(matches, args, destination_network) { |
| 378 | Ok(result) => result, |
| 379 | Err(err) => return err, |
| 380 | }; |
| 381 | let (pubkey, chain_address, outpoint, satoshis) = match &validate_result[..] { |
| 382 | [arg1, arg2, arg3, arg4, ..] => match (arg1, arg2, arg3, arg4) { |
| 383 | ( |
| 384 | ArgType::DepositorPublicKey(pubkey), |
| 385 | ArgType::ChainAddress(chain_address), |
| 386 | ArgType::OutPoint(outpoint), |
| 387 | ArgType::Satoshis(satoshis), |
| 388 | ) => (pubkey, chain_address, outpoint, satoshis), |
| 389 | _ => unreachable!(), |
| 390 | }, |
| 391 | _ => unreachable!(), |
| 392 | }; |
| 393 | let x_only_pubkey = XOnlyPublicKey::from(*pubkey); |
| 394 | |
| 395 | // do not need to sync |
| 396 | let result = self |
| 397 | .client |
| 398 | .get_depositor_transactions( |
| 399 | &pubkey.clone(), |
| 400 | &x_only_pubkey, |
| 401 | Input { |
| 402 | outpoint: *outpoint, |
| 403 | amount: *satoshis, |
| 404 | }, |
| 405 | chain_address.to_string().as_str(), |
| 406 | ) |
| 407 | .await; |
| 408 | |
| 409 | match result { |
| 410 | Ok(result) => Response::new(ResponseStatus::OK, Some(result)), |
| 411 | Err(err) => Response::new(ResponseStatus::NOK(err), None), |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | pub fn signatures_command() -> Command { |
| 416 | Command::new("signatures") |
no test coverage detected