123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125(*****************************************************************************)(* *)(* 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. *)(* *)(*****************************************************************************)openAlpha_contextletcustom_root=RPC_path.open_rootmoduleSeed=structmoduleS=structopenData_encodingletseed=RPC_service.post_service~description:"Seed of the cycle to which the block belongs."~query:RPC_query.empty~input:empty~output:Seed.seed_encodingRPC_path.(custom_root/"context"/"seed")endlet()=letopenServices_registrationinregister0S.seedbeginfunctxt()()->letl=Level.currentctxtinSeed.for_cyclectxtl.cycleendletgetctxtblock=RPC_context.make_call0S.seedctxtblock()()endmoduleNonce=structtypeinfo=|RevealedofNonce.t|MissingofNonce_hash.t|Forgottenletinfo_encoding=letopenData_encodinginunion[case(Tag0)~title:"Revealed"(obj1(req"nonce"Nonce.encoding))(functionRevealednonce->Somenonce|_->None)(funnonce->Revealednonce);case(Tag1)~title:"Missing"(obj1(req"hash"Nonce_hash.encoding))(functionMissingnonce->Somenonce|_->None)(funnonce->Missingnonce);case(Tag2)~title:"Forgotten"empty(functionForgotten->Some()|_->None)(fun()->Forgotten);]moduleS=structletget=RPC_service.get_service~description:"Info about the nonce of a previous block."~query:RPC_query.empty~output:info_encodingRPC_path.(custom_root/"context"/"nonces"/:Raw_level.rpc_arg)endletregister()=letopenServices_registrationinregister1S.getbeginfunctxtraw_level()()->letlevel=Level.from_rawctxtraw_levelinNonce.getctxtlevel>>=function|Ok(Revealednonce)->return(Revealednonce)|Ok(Unrevealed{nonce_hash;_})->return(Missingnonce_hash)|Error_->returnForgottenendletgetctxtblocklevel=RPC_context.make_call1S.getctxtblocklevel()()endmoduleContract=Contract_servicesmoduleConstants=Constants_servicesmoduleDelegate=Delegate_servicesmoduleHelpers=Helpers_servicesmoduleForge=Helpers_services.ForgemoduleParse=Helpers_services.Parseletregister()=Contract.register();Constants.register();Delegate.register();Helpers.register();Nonce.register()