diff --git a/src/parse_config.ml b/src/parse_config.ml index 5e191bd8..044873fb 100644 --- a/src/parse_config.ml +++ b/src/parse_config.ml @@ -178,7 +178,22 @@ let yes_no = function | s -> fail "expected `YES`/`NO` value, got `%s`" s let uri s = Uri.of_string s -let amount s = s |> Amount.of_string |> unwrap + +let amount = + let currency = ref None in + fun s -> + let amount = s |> Amount.of_string |> unwrap in + match !currency with + | None -> + currency := Some amount.currency; + amount + | Some cur -> ( + match String.equal amount.currency cur with + | false -> + fail "only one kind of currency is supported, found: `%s` and `%s`." + amount.currency cur + | true -> amount) + let duration s = Config_duration.(s |> parse |> to_time_span) let ed25519 s =