+ fix taler_amount: lookup_denomination_key

This commit is contained in:
swrup 2025-12-07 04:05:15 +01:00
parent 0c8ea5ba65
commit 27a940deed
3 changed files with 51 additions and 6 deletions

View file

@ -1,10 +1,13 @@
(* TODO
how to fix postgres/caqti tuple type?
try something with OID?
need to add boilerplate in each query for amounts *)
open Crypto
module Caqti_type = struct
include Caqti_type
(* TODO add a dune stanza like for prelude:
"(flags (:standard -open Prelude))" *)
(* we want to use int64 timestamps,
not postgresql built-in timestamp type *)
let ptime : Ptime.t option t = Timestamp.caqti
@ -110,8 +113,10 @@ let lookup_denomination_key =
Caqti_type.(
denomination_hash
->? t10 time time time time amount amount amount amount amount age_mask)
"SELECT valid_from, expire_withdraw, expire_deposit, expire_legal, coin, \
fee_withdraw, fee_deposit, fee_refresh, fee_refund, age_mask FROM \
"SELECT valid_from, expire_withdraw, expire_deposit, expire_legal, \
(coin).val, (coin).frac, (fee_withdraw).val, (fee_withdraw).frac, \
(fee_deposit).val, (fee_deposit).frac, (fee_refresh).val, \
(fee_refresh).frac, (fee_refund).val, (fee_refund).frac, age_mask FROM \
denominations WHERE denom_pub_hash=$1"
in
fun (module Conn : CONN) (h_denom_pub : DenominationHash.t) ->