@@ -4680,6 +4680,42 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
4680
4680
. arg ( lot_selection_arg ( ) )
4681
4681
. arg ( lot_numbers_arg ( ) ) ,
4682
4682
)
4683
+ . subcommand (
4684
+ SubCommand :: with_name ( "drop" )
4685
+ . about ( "Manually drop SOL/tokens from an account" )
4686
+ . arg (
4687
+ Arg :: with_name ( "token" )
4688
+ . value_name ( "SOL or SPL Token" )
4689
+ . takes_value ( true )
4690
+ . required ( true )
4691
+ . validator ( is_valid_token_or_sol)
4692
+ . help ( "Token type" ) ,
4693
+ )
4694
+ . arg (
4695
+ Arg :: with_name ( "address" )
4696
+ . value_name ( "ADDRESS" )
4697
+ . takes_value ( true )
4698
+ . required ( true )
4699
+ . validator ( is_valid_pubkey)
4700
+ . help ( "Account that the SOL/tokens should be dropped from" ) ,
4701
+ )
4702
+ . arg (
4703
+ Arg :: with_name ( "amount" )
4704
+ . value_name ( "AMOUNT" )
4705
+ . takes_value ( true )
4706
+ . validator ( is_amount)
4707
+ . required ( true )
4708
+ . help ( "Amount of SOL/tokens to drop" ) ,
4709
+ )
4710
+ . arg (
4711
+ Arg :: with_name ( "confirm" )
4712
+ . long ( "confirm" )
4713
+ . takes_value ( false )
4714
+ . help ( "Confirm the operation" ) ,
4715
+ )
4716
+ . arg ( lot_selection_arg ( ) )
4717
+ . arg ( lot_numbers_arg ( ) ) ,
4718
+ )
4683
4719
. subcommand (
4684
4720
SubCommand :: with_name ( "ls" )
4685
4721
. about ( "List registered accounts" )
@@ -6308,6 +6344,33 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
6308
6344
)
6309
6345
. await ?;
6310
6346
}
6347
+ ( "drop" , Some ( arg_matches) ) => {
6348
+ let address = pubkey_of ( arg_matches, "address" ) . unwrap ( ) ;
6349
+ let token = MaybeToken :: from ( value_t ! ( arg_matches, "token" , Token ) . ok ( ) ) ;
6350
+ let ui_amount = value_t_or_exit ! ( arg_matches, "amount" , f64 ) ;
6351
+ let lot_numbers = lot_numbers_of ( arg_matches, "lot_numbers" ) ;
6352
+ let lot_selection_method =
6353
+ value_t_or_exit ! ( arg_matches, "lot_selection" , LotSelectionMethod ) ;
6354
+ let confirm = arg_matches. is_present ( "confirm" ) ;
6355
+
6356
+ if !confirm {
6357
+ println ! (
6358
+ "Add --confirm to drop {} from {} ({})" ,
6359
+ token. format_ui_amount( ui_amount) ,
6360
+ address,
6361
+ token
6362
+ ) ;
6363
+ return Ok ( ( ) ) ;
6364
+ }
6365
+
6366
+ db. record_drop (
6367
+ address,
6368
+ token,
6369
+ token. amount ( ui_amount) ,
6370
+ lot_selection_method,
6371
+ lot_numbers,
6372
+ ) ?;
6373
+ }
6311
6374
( "ls" , Some ( arg_matches) ) => {
6312
6375
let all = arg_matches. is_present ( "all" ) ;
6313
6376
let summary = arg_matches. is_present ( "summary" ) ;
0 commit comments