offline tool: add drain cmd

This commit is contained in:
swrup 2026-02-03 22:29:29 +01:00
parent 17be86bfd4
commit cdfae5347f
2 changed files with 66 additions and 2 deletions

View file

@ -13,6 +13,11 @@ module Arg = struct
Arg.Conv.make ~docv:"relative time argument"
~parser:Timestamp.Span.of_string ~pp:Timestamp.Span.pp ()
let b32 =
let pp fmt v = Fmt.pf fmt "%s" (B32.encode v) in
Arg.Conv.make ~docv:"Crockford's Base32 encoded argument" ~parser:B32.decode
~pp ()
let amount =
Arg.Conv.make ~docv:"amount argument" ~parser:Amount.of_string ~pp:Amount.pp
()
@ -224,6 +229,32 @@ let global_fees_cmd =
~account_fee ~purse_fee ~history_expiration ~purse_account_limit
~purse_timeout
let drain_cmd =
let doc =
"Drain profits from the exchange. The actual drain requires running the \
taler-exchange-drain tool."
in
let debit_account_section =
Arg.(required & opt (some string) None & info [ "debit_account_section" ])
in
let credit_payto_uri =
Arg.(required & opt (some string) None & info [ "credit_payto_uri" ])
in
let wtid = Arg.(required & opt (some b32) None & info [ "wtid" ]) in
let date = Arg.(required & opt (some timestamp) None & info [ "date" ]) in
let amount = Arg.(required & opt (some amount) None & info [ "amount" ]) in
Cmd.make (Cmd.info "drain" ~doc)
@@
let+ output = output
and+ master_key = master_key
and+ debit_account_section = debit_account_section
and+ credit_payto_uri = credit_payto_uri
and+ wtid = wtid
and+ date = date
and+ amount = amount in
drain ~output ~master_key ~debit_account_section ~credit_payto_uri ~wtid ~date
~amount
let cli =
let info =
let doc = "MTE Offline CLI tool" in
@ -241,6 +272,7 @@ let cli =
disable_auditor_cmd;
wire_fee_cmd;
global_fees_cmd;
drain_cmd;
]
let main () = Cmd.eval_result cli
@ -253,6 +285,8 @@ let () = if !Sys.interactive then () else exit (main ())
-> how to build WireSetupMessage?
we need additional data to craft master_sig
maybe supposed to be found in the full payto-uri?
/management/drain
/management/aml-officers
/management/partners *)
-> /aml
/management/partners
-> /wads *)