package octez-protocol-003-PsddFKi3-libs
Octez protocol 003-PsddFKi3 libraries
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/octez-protocol-003-PsddFKi3-libs.client/client_proto_programs.ml.html
Source file client_proto_programs.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) open Protocol open Alpha_context open Tezos_micheline open Michelson_v1_printer module Program = Client_aliases.Alias (struct type t = Michelson_v1_parser.parsed Micheline_parser.parsing_result include Compare.Make (struct type nonrec t = t let compare = Micheline_parser.compare Michelson_v1_parser.compare_parsed end) let encoding = Data_encoding.conv (fun ({Michelson_v1_parser.source; _}, _) -> source) (fun source -> Michelson_v1_parser.parse_toplevel source) Data_encoding.string let of_source source = return (Michelson_v1_parser.parse_toplevel source) let to_source ({Michelson_v1_parser.source; _}, _) = return source let name = "script" end) let print_errors (cctxt : #Client_context.printer) errs ~show_source ~parsed = cctxt#warning "%a" (Michelson_v1_error_reporter.report_errors ~details:false ~show_source ~parsed) errs >>= fun () -> cctxt#error "error running script" >>= fun () -> return_unit let print_big_map_diff ppf = function | None -> () | Some diff -> Format.fprintf ppf "@[<v 2>map diff:@,%a@]@," (Format.pp_print_list ~pp_sep:Format.pp_print_space (fun ppf Contract.{diff_key; diff_value; _} -> Format.fprintf ppf "%s %a%a" (match diff_value with None -> "-" | Some _ -> "+") print_expr diff_key (fun ppf -> function | None -> () | Some x -> Format.fprintf ppf "-> %a" print_expr x) diff_value)) diff let print_run_result (cctxt : #Client_context.printer) ~show_source ~parsed = function | Ok (storage, operations, maybe_diff) -> cctxt#message "@[<v 0>@[<v 2>storage@,\ %a@]@,\ @[<v 2>emitted operations@,\ %a@]@,\ @[%a@]@]@." print_expr storage (Format.pp_print_list Operation_result.pp_internal_operation) operations print_big_map_diff maybe_diff >>= fun () -> return_unit | Error errs -> print_errors cctxt errs ~show_source ~parsed let print_trace_result (cctxt : #Client_context.printer) ~show_source ~parsed = function | Ok (storage, operations, trace, maybe_big_map_diff) -> cctxt#message "@[<v 0>@[<v 2>storage@,\ %a@]@,\ @[<v 2>emitted operations@,\ %a@]@,\ %a@[<v 2>@[<v 2>trace@,\ %a@]@]@." print_expr storage (Format.pp_print_list Operation_result.pp_internal_operation) operations print_big_map_diff maybe_big_map_diff print_execution_trace trace >>= fun () -> return_unit | Error errs -> print_errors cctxt errs ~show_source ~parsed let run (cctxt : #Alpha_client_context.rpc_context) ~(chain : Chain_services.chain) ~block ?(amount = Tez.fifty_cents) ~(program : Michelson_v1_parser.parsed) ~(storage : Michelson_v1_parser.parsed) ~(input : Michelson_v1_parser.parsed) () = Alpha_services.Helpers.Scripts.run_code cctxt (chain, block) program.expanded (storage.expanded, input.expanded, amount) let trace (cctxt : #Alpha_client_context.rpc_context) ~(chain : Chain_services.chain) ~block ?(amount = Tez.fifty_cents) ~(program : Michelson_v1_parser.parsed) ~(storage : Michelson_v1_parser.parsed) ~(input : Michelson_v1_parser.parsed) () = Alpha_services.Helpers.Scripts.trace_code cctxt (chain, block) program.expanded (storage.expanded, input.expanded, amount) let typecheck_data cctxt ~(chain : Chain_services.chain) ~block ?gas ~(data : Michelson_v1_parser.parsed) ~(ty : Michelson_v1_parser.parsed) () = Alpha_services.Helpers.Scripts.typecheck_data cctxt (chain, block) (data.expanded, ty.expanded, gas) let typecheck_program cctxt ~(chain : Chain_services.chain) ~block ?gas (program : Michelson_v1_parser.parsed) = Alpha_services.Helpers.Scripts.typecheck_code cctxt (chain, block) (program.expanded, gas) let print_typecheck_result ~emacs ~show_types ~print_source_on_error program res (cctxt : #Client_context.printer) = if emacs then let type_map, errs, _gas = match res with | Ok (type_map, gas) -> (type_map, [], Some gas) | Error (Environment.Ecoproto_error (Script_tc_errors.Ill_typed_contract (_, type_map)) :: _ as errs) -> (type_map, errs, None) | Error errs -> ([], errs, None) in cctxt#message "(@[<v 0>(types . %a)@ (errors . %a)@])" Michelson_v1_emacs.print_type_map (program, type_map) Michelson_v1_emacs.report_errors (program, errs) >>= fun () -> return_unit else match res with | Ok (type_map, gas) -> let program = Michelson_v1_printer.inject_types type_map program in cctxt#message "@[<v 0>Well typed@,Gas remaining: %a@]" Gas.pp gas >>= fun () -> if show_types then cctxt#message "%a" Micheline_printer.print_expr program >>= fun () -> return_unit else return_unit | Error errs -> cctxt#warning "%a" (Michelson_v1_error_reporter.report_errors ~details:show_types ~show_source:print_source_on_error ~parsed:program) errs >>= fun () -> cctxt#error "ill-typed script"
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>