123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2022 Nomadic Labs, <contact@nomadic-labs.com> *)(* Copyright (c) 2023 TriliTech, <contact@trili.tech> *)(* Copyright (c) 2023 Marigold, <contact@marigold.dev> *)(* *)(* 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. *)(* *)(*****************************************************************************)moduleMake(Mapper:sigvalof_bytes:bytes->Dac_plugin.hashend):Dac_plugin.T=structletto_bytes=Dac_plugin.hash_to_bytesletto_reveal_hashdac_hash=dac_hash|>to_bytes|>Data_encoding.Binary.of_bytes_exnProtocol.Sc_rollup_reveal_hash.encodingletof_reveal_hashreveal_hash=reveal_hash|>Data_encoding.Binary.to_bytes_exnProtocol.Sc_rollup_reveal_hash.encoding|>Mapper.of_bytesletof_hexhex=Protocol.Sc_rollup_reveal_hash.of_hexhex|>Option.mapof_reveal_hashletto_hexhash=to_reveal_hashhash|>Protocol.Sc_rollup_reveal_hash.to_hexletencoding=letbinary=Data_encoding.convto_reveal_hashof_reveal_hashProtocol.Sc_rollup_reveal_hash.encodinginData_encoding.((* Hexifies the hash when encoding in json. *)splitted~binary~json:(conv_with_guardto_hex(funstr->Result.of_option~error:"Not a valid hash"(of_hexstr))(string'Plain)))letequalh1h2=Protocol.Sc_rollup_reveal_hash.equal(to_reveal_hashh1)(to_reveal_hashh2)letdac_hash_to_proto_supported_hashes=function|Dac_plugin.Blake2B->Protocol.Sc_rollup_reveal_hash.Blake2Bletproto_to_dac_hash_supported_hashes=function|Protocol.Sc_rollup_reveal_hash.Blake2B->Dac_plugin.Blake2Blethash_string~(scheme:Dac_plugin.supported_hashes)?keystrings=Protocol.Sc_rollup_reveal_hash.hash_string~scheme:(dac_hash_to_proto_supported_hashesscheme)?keystrings|>of_reveal_hashlethash_bytes~(scheme:Dac_plugin.supported_hashes)?keybytes=Protocol.Sc_rollup_reveal_hash.hash_bytes~scheme:(dac_hash_to_proto_supported_hashesscheme)?keybytes|>of_reveal_hashletscheme_of_hashhash=to_reveal_hashhash|>Protocol.Sc_rollup_reveal_hash.scheme_of_hash|>proto_to_dac_hash_supported_hashesletsize~scheme=Protocol.Sc_rollup_reveal_hash.size~scheme:(dac_hash_to_proto_supported_hashesscheme)moduleProto=Registerer.Registeredendletmake_plugin:(bytes->Dac_plugin.hash)->(moduleDac_plugin.T)=funof_bytes->letmodulePlugin=Make(structletof_bytes=of_bytesend)in(modulePlugin)let()=Dac_plugin.registermake_plugin