2018-01-16 01:09:25 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Copyright (c) 2014 - 2016. *)
|
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2018-02-05 22:23:18 +04:00
|
|
|
open Proto_alpha
|
2018-02-11 22:17:39 +04:00
|
|
|
open Alpha_context
|
2018-01-16 01:09:25 +04:00
|
|
|
|
2018-02-12 01:36:49 +04:00
|
|
|
val fail : string -> string -> string -> 'a
|
|
|
|
(** Raises [Failed] with the passed parameters
|
|
|
|
(expected value, actual value, and message). *)
|
|
|
|
|
|
|
|
val fail_msg : ('a, Format.formatter, unit, 'b) format4 -> 'a
|
|
|
|
(** [fail_msg m] is equivalent to [fail "" "" m]. *)
|
|
|
|
|
|
|
|
val equal_string : ?msg:string -> string -> string -> unit
|
|
|
|
(** Same as [equal], but specialized for [string] values. *)
|
|
|
|
|
|
|
|
val equal : ?eq:('a -> 'a -> bool) -> ?prn:('a -> string) -> ?msg:string -> 'a -> 'a -> unit
|
2018-01-16 01:09:25 +04:00
|
|
|
|
|
|
|
(** Functions capturing common assertion scenarios and error monads helpers *)
|
|
|
|
|
|
|
|
(** Converts a tzresult from the Environment's error monad to a tzresult of the
|
|
|
|
top level error monad *)
|
2018-02-05 22:23:18 +04:00
|
|
|
val wrap_result : 'a proto_tzresult -> 'a tzresult
|
2018-01-16 01:09:25 +04:00
|
|
|
|
|
|
|
(** Converts a tzresult Lwt.t from the Environment's error monad to a tzresult Lwt.t
|
|
|
|
of the top level error monad *)
|
2018-02-05 22:23:18 +04:00
|
|
|
val wrap : 'a proto_tzresult -> 'a tzresult Lwt.t
|
2018-01-16 01:09:25 +04:00
|
|
|
|
|
|
|
(** Binds a top level error monad function with an Environment's error monad
|
|
|
|
tzresult Lwt.t *)
|
|
|
|
val ( >>=?? ) :
|
2018-02-05 22:23:18 +04:00
|
|
|
'a proto_tzresult Lwt.t -> ('a -> 'b tzresult Lwt.t) -> 'b tzresult Lwt.t
|
2018-01-16 01:09:25 +04:00
|
|
|
|
|
|
|
(** Binds a top level error monad function with an Environment's error monad
|
|
|
|
tzresult *)
|
2018-02-05 22:23:18 +04:00
|
|
|
val ( >>?? ) : 'a proto_tzresult -> ('a -> 'b tzresult) -> 'b tzresult
|
2018-01-16 01:09:25 +04:00
|
|
|
|
|
|
|
(** Partially binds a top level error monad function with an Environment's
|
|
|
|
error monad tzresult *)
|
2018-02-05 22:23:18 +04:00
|
|
|
val ( >>?= ) : 'a proto_tzresult Lwt.t -> ('a tzresult -> 'b Lwt.t) -> 'b Lwt.t
|
2018-01-16 01:09:25 +04:00
|
|
|
|
2018-02-05 22:23:18 +04:00
|
|
|
val tmp_map : ('a -> 'b proto_tzresult) -> 'a list -> 'b list proto_tzresult
|
2018-01-16 01:09:25 +04:00
|
|
|
|
2018-02-05 22:23:18 +04:00
|
|
|
val ok : ?msg:string -> 'a proto_tzresult -> 'a proto_tzresult Lwt.t
|
2018-01-16 01:09:25 +04:00
|
|
|
|
|
|
|
val ok_contract : ?msg:string ->
|
2018-02-05 22:23:18 +04:00
|
|
|
(('a * 'b option) * 'c) proto_tzresult ->
|
|
|
|
(('a * 'b option) * 'c) proto_tzresult Lwt.t
|
2018-01-16 01:09:25 +04:00
|
|
|
|
|
|
|
exception No_error
|
|
|
|
|
|
|
|
val no_error : ?msg:string -> ('a, 'b) result -> 'a
|
|
|
|
val equal_pkh :
|
|
|
|
?msg:string -> Ed25519.Public_key_hash.t option ->
|
|
|
|
Ed25519.Public_key_hash.t option -> unit
|
|
|
|
val equal_int64 : ?msg:string -> Int64.t -> Int64.t -> unit
|
|
|
|
val equal_int : ?msg:string -> int -> int -> unit
|
|
|
|
val equal_tez : ?msg:string -> Tez.t -> Tez.t -> unit
|
|
|
|
val equal_balance :
|
|
|
|
tc:context -> ?msg:string ->
|
|
|
|
Contract.contract * Tez.t ->
|
2018-02-05 22:23:18 +04:00
|
|
|
unit proto_tzresult Lwt.t
|
2018-01-16 01:09:25 +04:00
|
|
|
val equal_cents_balance :
|
|
|
|
tc:context -> ?msg:string ->
|
|
|
|
Contract.contract * int ->
|
2018-02-05 22:23:18 +04:00
|
|
|
unit proto_tzresult Lwt.t
|
2018-01-16 01:09:25 +04:00
|
|
|
val ecoproto_error :
|
2018-02-05 22:23:18 +04:00
|
|
|
(proto_error -> bool) -> error -> bool
|
2018-01-16 01:09:25 +04:00
|
|
|
|
|
|
|
val generic_economic_error : msg:string -> 'a tzresult -> unit
|
|
|
|
val economic_error :
|
2018-02-05 22:23:18 +04:00
|
|
|
msg:string -> (proto_error -> bool) -> 'a tzresult -> unit
|
2018-01-16 01:09:25 +04:00
|
|
|
val ill_typed_data_error : msg:string -> 'a tzresult -> unit
|
|
|
|
val ill_typed_return_error : msg:string -> 'a tzresult -> unit
|
|
|
|
val double_endorsement : msg:string -> 'a tzresult -> unit
|
|
|
|
val contain_error_alpha :
|
|
|
|
?msg:string -> f:('a -> bool) -> ('b, 'a list) result -> unit
|
2018-02-05 22:23:18 +04:00
|
|
|
val unknown_contract : msg:string -> 'a proto_tzresult -> unit
|
|
|
|
val non_existing_contract : msg:string -> 'a proto_tzresult -> unit
|
|
|
|
val balance_too_low : msg:string -> 'a proto_tzresult -> unit
|
2018-01-16 01:09:25 +04:00
|
|
|
val non_spendable : msg:string -> 'a tzresult -> unit
|
|
|
|
val inconsistent_pkh : msg:string -> 'a tzresult -> unit
|
|
|
|
val non_delegatable : msg:string -> 'a tzresult -> unit
|
|
|
|
|