package tezos-protocol-alpha

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

This module provides an API for extracting tickets of arbitrary types from an OCaml values, given a type-witness.

type ex_ticket =
  1. | Ex_ticket : 'a Script_typed_ir.comparable_ty * 'a Script_typed_ir.ticket -> ex_ticket

A type for representing existentially quantified tickets (tickets with different types of payloads). An ex_ticket value consists of:

  • A type-witness representing the type of the content of the ticket.
  • A ticket value of the particular content type.
val tickets_of_value : Alpha_context.context -> include_lazy:bool -> 'a Script_typed_ir.ty -> 'a -> (ex_ticket list * Alpha_context.context, Tezos_protocol_environment_alpha__Environment.Error_monad.error Tezos_protocol_environment_alpha__Environment.Error_monad.trace) result Lwt.t

tickets_of_value ctxt ~include_lazy ty value extracts all tickets from the given shape ty and value value. The include_lazy flag determines whether or not to traverse lazy structures (values from the context). In case the include_lazy flag is true, any big-map contained in the value must have an empty overlay or else an error of type Unsupported_non_empty_overlay is returned. The reason for this restriction is that we assume that all lazy big-map diffs should be applied before calling this function. Dealing with non-empty overlays would be possible in theory, but practically difficult. The challenge is to distinguish between overlapping keys between the context and the overlay.