MCPcopy Index your code
hub / github.com/BitVM/BitVM / handle_depositor

Method handle_depositor

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

Source from the content-addressed store, hash-verified

195 }
196
197 pub async fn handle_depositor(&mut self, matches: &ArgMatches) -> Response {
198 let pubkey =
199 PublicKey::from_str(matches.get_one::<String>("DEPOSITOR_PUBLIC_KEY").unwrap());
200 if pubkey.is_err() {
201 return Response::new(
202 ResponseStatus::NOK(
203 "Invalid public key. Use bitcoin public key format.".to_string(),
204 ),
205 None,
206 );
207 }
208 if matches.subcommand_matches("pegin_deposit_tx").is_some() {
209 return self
210 .handle_pegin_deposit_tx_command(
211 &pubkey.unwrap(),
212 matches.subcommand_matches("pegin_deposit_tx").unwrap(),
213 )
214 .await;
215 }
216 if matches.subcommand_matches("pegin_confirm_tx").is_some() {
217 return self
218 .handle_pegin_confirm_tx_command(
219 &pubkey.unwrap(),
220 matches.subcommand_matches("pegin_confirm_tx").unwrap(),
221 )
222 .await;
223 }
224 if matches.subcommand_matches("pegin_refund_tx").is_some() {
225 return self
226 .handle_pegin_refund_tx_command(
227 &pubkey.unwrap(),
228 matches.subcommand_matches("pegin_refund_tx").unwrap(),
229 )
230 .await;
231 }
232
233 self.sync().await;
234 let result = self
235 .client
236 .get_depositor_status(&pubkey.clone().unwrap())
237 .await;
238
239 match result.len() {
240 len if len > 0 => {
241 let data =
242 Some(serde_json::to_value(result).expect("Failed to merge value vector"));
243 Response::new(ResponseStatus::OK, data)
244 }
245 _ => Response::new(
246 ResponseStatus::NOK("Depositor not found.".to_string()),
247 None,
248 ),
249 }
250 }
251
252 pub fn withdrawer_command() -> Command {
253 Command::new("withdrawer")

Callers 1

mainFunction · 0.80

Calls 7

get_depositor_statusMethod · 0.80
cloneMethod · 0.80
lenMethod · 0.80
syncMethod · 0.45

Tested by

no test coverage detected