package octez-l2-libs
Octez layer2 libraries
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/octez-l2-libs.smart-rollup/dictionary_encoding.ml.html
Source file dictionary_encoding.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
(*****************************************************************************) (* *) (* SPDX-License-Identifier: MIT *) (* SPDX-FileCopyrightText: 2024 Functori <contact@functori.com> *) (* *) (*****************************************************************************) let dictionary_encoding ~keys ~string_of_key ~key_of_string ~value_encoding = let open Data_encoding in let schema = let open Json_schema in let value_schema key = Data_encoding.Json.schema (value_encoding key) in let value_schema_r key = root (value_schema key) in let kind = Object { properties = List.map (fun key -> (string_of_key key, value_schema_r key, false, None)) keys; pattern_properties = []; additional_properties = None; min_properties = 0; max_properties = None; schema_dependencies = []; property_dependencies = []; } in update (element kind) (value_schema (List.hd keys |> WithExceptions.Option.get ~loc:__LOC__) (* Dummy for definitions *)) in conv ~schema (fun map -> let fields = map |> List.map (fun (k, v) -> ( string_of_key k, Data_encoding.Json.construct (value_encoding k) v )) in `O fields) (function | `O fields -> List.map (fun (k, v) -> let k = key_of_string k in (k, Data_encoding.Json.destruct (value_encoding k) v)) fields | _ -> assert false) Data_encoding.Json.encoding
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>