add result.ml; polymorphic variant errors + refacto

This commit is contained in:
swrup 2026-03-26 06:23:42 +01:00 committed by Swrup
parent 9fd3b5a3cc
commit 42b0ec1445
36 changed files with 949 additions and 954 deletions

View file

@ -43,30 +43,29 @@ module Arg = struct
in
Arg.Conv.make ~docv:"relative time argument" ~parser ~pp ()
let amount =
Arg.Conv.make ~docv:"amount argument" ~parser:Amount.of_string ~pp:Amount.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
()
let eddsa_pub =
let parser s = Eddsa.pub_of_b32 s in
let pp fmt key =
let s = Eddsa.pub_to_b32 key in
Fmt.pf fmt "%s" s
in
Arg.Conv.make ~docv:"eddsa public key argument" ~parser ~pp ()
Arg.Conv.make ~docv:"eddsa public key argument" ~parser:Eddsa.pub_of_b32 ~pp
()
let rsa_pub =
let parser s = Rsa.pub_of_b32 s in
let pp fmt key =
let s = Rsa.pub_to_b32 key in
Fmt.pf fmt "%s" s
in
Arg.Conv.make ~docv:"rsa public key argument" ~parser ~pp ()
Arg.Conv.make ~docv:"rsa public key argument" ~parser:Rsa.pub_of_b32 ~pp ()
end
let master_key =
@ -151,10 +150,8 @@ let compute_denomination_hash_cmd =
Cmd.make (Cmd.info "compute-denomination-hash" ~doc)
@@
let+ rsa_pub = rsa_pub in
rsa_pub
|> Hash.DenominationHash.hash_of_rsa
|> Hash.DenominationHash.to_b32
|> Fmt.pr "%s@.";
let open Hash.DenominationHash in
Fmt.pr "%a@." pp (hash rsa_pub);
Ok ()
let revoke_signkey_cmd =
@ -322,11 +319,11 @@ let drain_cmd =
and+ master_key = master_key
and+ debit_account_section = debit_account_section
and+ credit_payto_uri = credit_payto_uri
and+ wtid = wtid
and+ wtid_octets = wtid
and+ date = date
and+ amount = amount in
drain ~output ~master_key ~debit_account_section ~credit_payto_uri ~wtid ~date
~amount
drain ~output ~master_key ~debit_account_section ~credit_payto_uri
~wtid_octets ~date ~amount
let cli =
let info =