123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116(*****************************************************************************)(* *)(* SPDX-License-Identifier: MIT *)(* Copyright (c) 2023 Nomadic Labs, <contact@nomadic-labs.com> *)(* Copyright (c) 2023 Functori, <contact@functori.com> *)(*****************************************************************************)typesigner={alias:string;pkh:Signature.public_key_hash;pk:Signature.public_key;sk:Client_keys.sk_uri;}letget_signercctxtpkh=letopenLwt_result_syntaxinlet*alias,pk,sk=Client_keys.get_keycctxtpkhinreturn{alias;pkh;pk;sk}typetez={mutez:int64}typefee_parameter={minimal_fees:tez;minimal_nanotez_per_byte:Q.t;minimal_nanotez_per_gas_unit:Q.t;force_low_fee:bool;fee_cap:tez;burn_cap:tez;}(* Encoding for Tez amounts, replicated from mempool. *)lettez_encoding=letopenData_encodinginletdecode{mutez}=Z.of_int64mutezinletencode=Json.wrap_error(funi->{mutez=Z.to_int64i})inData_encoding.def"mutez"~title:"A millionth of a tez"~description:"One million mutez make a tez (1 tez = 1e6 mutez)"(convdecodeencoden)(* Encoding for nano-Tez amounts, replicated from mempool. *)letnanotez_encoding=letopenData_encodingindef"nanotez"~title:"A thousandth of a mutez"~description:"One thousand nanotez make a mutez (1 tez = 1e9 nanotez)"(conv(funq->(q.Q.num,q.Q.den))(fun(num,den)->{Q.num;den})(tup2zz))letfee_parameter_encoding~(default_fee_parameter:fee_parameter)=letopenData_encodinginconv(fun{minimal_fees;minimal_nanotez_per_byte;minimal_nanotez_per_gas_unit;force_low_fee;fee_cap;burn_cap;}->(minimal_fees,minimal_nanotez_per_byte,minimal_nanotez_per_gas_unit,force_low_fee,fee_cap,burn_cap))(fun(minimal_fees,minimal_nanotez_per_byte,minimal_nanotez_per_gas_unit,force_low_fee,fee_cap,burn_cap)->{minimal_fees;minimal_nanotez_per_byte;minimal_nanotez_per_gas_unit;force_low_fee;fee_cap;burn_cap;})(obj6(dft"minimal-fees"~description:"Exclude operations with lower fees"tez_encodingdefault_fee_parameter.minimal_fees)(dft"minimal-nanotez-per-byte"~description:"Exclude operations with lower fees per byte"nanotez_encodingdefault_fee_parameter.minimal_nanotez_per_byte)(dft"minimal-nanotez-per-gas-unit"~description:"Exclude operations with lower gas fees"nanotez_encodingdefault_fee_parameter.minimal_nanotez_per_gas_unit)(dft"force-low-fee"~description:"Don't check that the fee is lower than the estimated default"booldefault_fee_parameter.force_low_fee)(dft"fee-cap"~description:"The fee cap"tez_encodingdefault_fee_parameter.fee_cap)(dft"burn-cap"~description:"The burn cap"tez_encodingdefault_fee_parameter.burn_cap))