diff --git a/tools/offline.ml b/tools/offline.ml index cf2adb37..6d0e2196 100644 --- a/tools/offline.ml +++ b/tools/offline.ml @@ -2,6 +2,9 @@ open Cmdliner open Cmdliner.Term.Syntax open Offline_impl +let base_url = Uri.of_string "http://localhost:3434/" +let default_master_offline_key_file = "data/master_offline_private_key" + module Arg = struct include Arg @@ -16,9 +19,16 @@ module Arg = struct let amount = Arg.Conv.make ~docv:"amount argument" ~parser:Amount.of_string ~pp:Amount.pp () + + let url = + let parser path = +let full_url path = + Uri.with_path base_url path |> Uri.to_string +in + Arg.Conv.make ~docv:"amount argument" ~parser ~pp + () end -let default_master_offline_key_file = "data/master_offline_private_key" (* let default_response_file = "response.json" let default_request_file = "request.json" @@ -103,6 +113,18 @@ let revoke_signkey_cmd = let+ output = output and+ master_key = master_key and+ signkey = signkey in revoke_signkey ~output ~master_key ~signkey +let enable_auditor_cmd = + let doc = "Enable an auditor." in + let auditor_url = + Arg.(required & opt (some url) None & info [ "auditor_url" ]) + in + Cmd.make (Cmd.info "global-fees" ~doc) + @@ + let+ output = output + and+ master_key = master_key + and+ auditor_url = auditor_url in + enable_auditor ~output ~master_key ~auditor_url + let global_fees_cmd = let doc = "Provides global fee configuration." in let start_date = diff --git a/tools/offline_impl.ml b/tools/offline_impl.ml index c6e38015..eadc948f 100644 --- a/tools/offline_impl.ml +++ b/tools/offline_impl.ml @@ -9,9 +9,6 @@ let read_master_key_file filename = let* master_key = read_file filename in Crypto.EddsaPrivateKey.of_octets master_key -let base_url = Uri.of_string "http://localhost:3434/" -let full_url path = Uri.with_path base_url path |> Uri.to_string - let download ~output = let open Bos in let uri = full_url "/management/keys/" in @@ -135,3 +132,7 @@ let global_fees ~output ~master_key ~start_date ~end_date ~history_fee let* s = Api.encode Api.GlobalFees.jsont global_fees in let* () = write_file output s in Ok () + +[@@@ocaml.warning "-27"] + +let enable_auditor ~output ~master_key ~auditor_url = assert false