This commit is contained in:
parent
4754517d8f
commit
70fe6ce314
8 changed files with 163 additions and 6 deletions
|
|
@ -117,3 +117,5 @@ let bin_nbo =
|
|||
|+ field beint32 (fun t -> t.fraction)
|
||||
|+ field (bytes currency_len) (fun t -> pad_currency t.currency)
|
||||
|> sealr
|
||||
|
||||
let dummy_value = "DUMMY:0.0" |> of_string |> Result.get_ok
|
||||
|
|
|
|||
|
|
@ -25,3 +25,7 @@ val jsont : t Jsont.t
|
|||
(* only for encoding *)
|
||||
val bin : t Bin.t
|
||||
val bin_nbo : t Bin.t
|
||||
|
||||
(* TODO
|
||||
dummy value to use as placeholder for WIP *)
|
||||
val dummy_value : t
|
||||
|
|
|
|||
|
|
@ -433,13 +433,10 @@ module Global_fees = struct
|
|||
purse_timeout;
|
||||
master_sig;
|
||||
} =
|
||||
(* TODO what is kyc_timeout, kyc_fee ? *)
|
||||
let dummy_amount =
|
||||
Amount.make ~sign:None ~currency:"EUR" ~value:0_L ~fraction:0_l
|
||||
|> Result.get_ok
|
||||
in
|
||||
(* TODO KYC
|
||||
what is kyc_timeout, kyc_fee ? *)
|
||||
let kyc_timeout = None in
|
||||
let kyc_fee = dummy_amount in
|
||||
let kyc_fee = Amount.dummy_value in
|
||||
(* * *)
|
||||
let open Bin_sig.GlobalFees in
|
||||
verify_f ~f:Sm.verify_with_master_key master_sig
|
||||
|
|
|
|||
|
|
@ -23,6 +23,23 @@ let of_span_exn = function
|
|||
|
||||
(* -- *)
|
||||
|
||||
(* TODO
|
||||
this doesn't handle "never" value, and truncate time *)
|
||||
let of_string s =
|
||||
match Float.of_string_opt s with
|
||||
| None -> Error "Timestamp.of_string failure: not a float"
|
||||
| Some v -> (
|
||||
match Ptime.of_float_s v with
|
||||
| None -> Error "Timestamp.of_string failure"
|
||||
| Some v -> Ok (Some v))
|
||||
|
||||
let pp fmt t =
|
||||
match t with
|
||||
| None -> Fmt.pf fmt {|"never"|}
|
||||
| Some v ->
|
||||
let v = Ptime.to_float_s v in
|
||||
Fmt.pf fmt {|%f|} v
|
||||
|
||||
(* microseconds since the UNIX Epoch, or "never" if None *)
|
||||
let jsont =
|
||||
let number_or_never_jsont =
|
||||
|
|
@ -80,6 +97,23 @@ let compare a b =
|
|||
module Span = struct
|
||||
type t = span
|
||||
|
||||
(* TODO
|
||||
this doesn't handle "never" value, and truncate time *)
|
||||
let of_string s =
|
||||
match Float.of_string_opt s with
|
||||
| None -> Error "Timestamp.Span.of_string failure: not a float"
|
||||
| Some v -> (
|
||||
match Ptime.Span.of_float_s v with
|
||||
| None -> Error "Timestamp.Span.of_string failure"
|
||||
| Some v -> Ok (Some v))
|
||||
|
||||
let pp fmt t =
|
||||
match t with
|
||||
| None -> Fmt.pf fmt {|"forever"|}
|
||||
| Some v ->
|
||||
let v = Ptime.Span.to_float_s v in
|
||||
Fmt.pf fmt {|%f|} v
|
||||
|
||||
let to_int64 ptime = ptime |> Ptime.Span.to_float_s |> Int64.of_float
|
||||
|
||||
let of_int64 i =
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ type span = Ptime.Span.t option
|
|||
module Span : sig
|
||||
type t = span
|
||||
|
||||
val of_string : string -> (t, string) result
|
||||
val pp : Stdlib.Format.formatter -> t -> unit
|
||||
|
||||
(* - *)
|
||||
|
||||
val jsont : t Jsont.t
|
||||
val bin : t Bin.t
|
||||
val bin_nbo : t Bin.t
|
||||
|
|
@ -21,6 +26,10 @@ val add_span_exn : t -> span -> t
|
|||
val of_span_exn : span -> t
|
||||
val compare : t -> t -> int option
|
||||
|
||||
(* used for offline tool argument conversion *)
|
||||
val of_string : string -> (t, string) result
|
||||
val pp : Stdlib.Format.formatter -> t -> unit
|
||||
|
||||
(* - *)
|
||||
val jsont : t Jsont.t
|
||||
val bin : t Bin.t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue