package tezos-protocol-alpha
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c6df840ebbf115e454db949028c595bec558a59a66cade73b52a6d099d6fa4d4
sha512=d8aee903b9fe130d73176bc8ec38b78c9ff65317da3cb4f3415f09af0c625b4384e7498201fdb61aa39086a7d5d409d0ab3423f9bc3ab989a680cf444a79bc13
doc/tezos_raw_protocol_alpha/Tezos_raw_protocol_alpha/Ticket_scanner/index.html
Module Tezos_raw_protocol_alpha.Ticket_scannerSource
This module provides an API for extracting tickets of arbitrary types from an OCaml values, given a type-witness.
type ex_ticket = | 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.
A type-witness that contains information about which branches of a type 'a include tickets. This value is used for traversing only the relevant branches of values when scanning for tickets.
val type_has_tickets :
Alpha_context.context ->
('a, _) Script_typed_ir.ty ->
('a has_tickets * Alpha_context.context)
Tezos_protocol_environment_alpha.Error_monad.tzresulttype_has_tickets ctxt ty returns a has_tickets witness of the given shape ty.
val tickets_of_value :
Alpha_context.context ->
include_lazy:bool ->
'a has_tickets ->
'a ->
(ex_ticket list * Alpha_context.context)
Tezos_protocol_environment_alpha.Error_monad.tzresult
Tezos_protocol_environment_alpha.Lwt.ttickets_of_value ctxt ~include_lazy ht value extracts all tickets from the given value, using the type-witness ht. 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.
val tickets_of_node :
Alpha_context.context ->
include_lazy:bool ->
'a has_tickets ->
Alpha_context.Script.node ->
(ex_ticket list * Alpha_context.context)
Tezos_protocol_environment_alpha.Error_monad.tzresult
Tezos_protocol_environment_alpha.Lwt.ttickets_of_node ctxt ~include_lazy ht node extracts all tickets from the given node, using the type-witness ht.If ht indicates that values of the corresponding type may not contain tickets, the node value is not parsed. 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.
has_tickets ht returns whether or not the type of the given has_tickets witness ht has tickets.
val ex_ticket_size :
Alpha_context.context ->
ex_ticket ->
(Saturation_repr.may_saturate Saturation_repr.t * Alpha_context.context)
Tezos_protocol_environment_alpha.Error_monad.tzresult
Tezos_protocol_environment_alpha.Lwt.tex_ticket_size ctxt ex_ticket returns the size of the in-memory representation of ex_ticket in bytes.
val ex_token_and_amount_of_ex_ticket :
ex_ticket ->
Ticket_token.ex_token * Script_typed_ir.ticket_amountex_token_and_amount_of_ex_ticket ex_ticket returns the token and amount of the given ticket ex_ticket.