offline tool: add drain cmd
This commit is contained in:
parent
17be86bfd4
commit
f1d33bf53f
2 changed files with 75 additions and 11 deletions
|
|
@ -1,3 +1,16 @@
|
|||
(* TODO
|
||||
all management operations:
|
||||
/management/wire
|
||||
/management/wire/disable
|
||||
-> how to build WireSetupMessage?
|
||||
we need additional data to craft master_sig
|
||||
maybe supposed to be found in the full payto-uri?
|
||||
|
||||
/management/aml-officers
|
||||
-> /aml
|
||||
/management/partners
|
||||
-> /wads *)
|
||||
|
||||
open Cmdliner
|
||||
open Cmdliner.Term.Syntax
|
||||
open Offline_impl
|
||||
|
|
@ -13,6 +26,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 +242,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,18 +285,8 @@ let cli =
|
|||
disable_auditor_cmd;
|
||||
wire_fee_cmd;
|
||||
global_fees_cmd;
|
||||
drain_cmd;
|
||||
]
|
||||
|
||||
let main () = Cmd.eval_result cli
|
||||
let () = if !Sys.interactive then () else exit (main ())
|
||||
|
||||
(* TODO
|
||||
all management operations:
|
||||
/management/wire
|
||||
/management/wire/disable
|
||||
-> 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 *)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue