12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187(*****************************************************************************)(* *)(* 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_contextopenData_encodingleterror_encoding=def"error"~description:"The full list of RPC errors would be too long to include.\n\
It is available at RPC `/errors` (GET).\n\
Errors specific to protocol Alpha have an id that starts with \
`proto.alpha`."@@splitted~json:(conv(funerr->Data_encoding.Json.constructError_monad.error_encodingerr)(funjson->Data_encoding.Json.destructError_monad.error_encodingjson)json)~binary:Error_monad.error_encodingtype_successful_manager_operation_result=|Reveal_result:{consumed_gas:Z.t;}->Kind.revealsuccessful_manager_operation_result|Transaction_result:{storage:Script.exproption;big_map_diff:Contract.big_map_diffoption;balance_updates:Delegate.balance_updates;originated_contracts:Contract.tlist;consumed_gas:Z.t;storage_size:Z.t;paid_storage_size_diff:Z.t;allocated_destination_contract:bool;}->Kind.transactionsuccessful_manager_operation_result|Origination_result:{big_map_diff:Contract.big_map_diffoption;balance_updates:Delegate.balance_updates;originated_contracts:Contract.tlist;consumed_gas:Z.t;storage_size:Z.t;paid_storage_size_diff:Z.t;}->Kind.originationsuccessful_manager_operation_result|Delegation_result:{consumed_gas:Z.t;}->Kind.delegationsuccessful_manager_operation_resulttypepacked_successful_manager_operation_result=|Successful_manager_result:'kindsuccessful_manager_operation_result->packed_successful_manager_operation_resulttype'kindmanager_operation_result=|Appliedof'kindsuccessful_manager_operation_result|Backtrackedof'kindsuccessful_manager_operation_result*errorlistoption|Failed:'kindKind.manager*errorlist->'kindmanager_operation_result|Skipped:'kindKind.manager->'kindmanager_operation_resulttypepacked_internal_operation_result=|Internal_operation_result:'kindinternal_operation*'kindmanager_operation_result->packed_internal_operation_resultmoduleManager_result=structtype'kindcase=|MCase:{op_case:'kindOperation.Encoding.Manager_operations.case;encoding:'aData_encoding.t;kind:'kindKind.manager;iselect:packed_internal_operation_result->('kindinternal_operation*'kindmanager_operation_result)option;select:packed_successful_manager_operation_result->'kindsuccessful_manager_operation_resultoption;proj:'kindsuccessful_manager_operation_result->'a;inj:'a->'kindsuccessful_manager_operation_result;t:'kindmanager_operation_resultData_encoding.t;}->'kindcaseletmake~op_case~encoding~kind~iselect~select~proj~inj=let(Operation.Encoding.Manager_operations.MCase{name;_})=op_caseinlett=def(Format.asprintf"operation.alpha.operation_result.%s"name)@@union~tag_size:`Uint8[case(Tag0)~title:"Applied"(merge_objs(obj1(req"status"(constant"applied")))encoding)(funo->matchowith|Skipped_|Failed_|Backtracked_->None|Appliedo->(matchselect(Successful_manager_resulto)with|None->None|Someo->Some((),projo)))(fun((),x)->Applied(injx));case(Tag1)~title:"Failed"(obj2(req"status"(constant"failed"))(req"errors"(listerror_encoding)))(functionFailed(_,errs)->Some((),errs)|_->None)(fun((),errs)->Failed(kind,errs));case(Tag2)~title:"Skipped"(obj1(req"status"(constant"skipped")))(functionSkipped_->Some()|_->None)(fun()->Skippedkind);case(Tag3)~title:"Backtracked"(merge_objs(obj2(req"status"(constant"backtracked"))(opt"errors"(listerror_encoding)))encoding)(funo->matchowith|Skipped_|Failed_|Applied_->None|Backtracked(o,errs)->(matchselect(Successful_manager_resulto)with|None->None|Someo->Some(((),errs),projo)))(fun(((),errs),x)->Backtracked(injx,errs))]inMCase{op_case;encoding;kind;iselect;select;proj;inj;t}letreveal_case=make~op_case:Operation.Encoding.Manager_operations.reveal_case~encoding:Data_encoding.(obj1(dft"consumed_gas"zZ.zero))~iselect:(function|Internal_operation_result(({operation=Reveal_;_}asop),res)->Some(op,res)|_->None)~select:(function|Successful_manager_result(Reveal_result_asop)->Someop|_->None)~kind:Kind.Reveal_manager_kind~proj:(functionReveal_result{consumed_gas}->consumed_gas)~inj:(funconsumed_gas->Reveal_result{consumed_gas})lettransaction_case=make~op_case:Operation.Encoding.Manager_operations.transaction_case~encoding:(obj8(opt"storage"Script.expr_encoding)(opt"big_map_diff"Contract.big_map_diff_encoding)(dft"balance_updates"Delegate.balance_updates_encoding[])(dft"originated_contracts"(listContract.encoding)[])(dft"consumed_gas"zZ.zero)(dft"storage_size"zZ.zero)(dft"paid_storage_size_diff"zZ.zero)(dft"allocated_destination_contract"boolfalse))~iselect:(function|Internal_operation_result(({operation=Transaction_;_}asop),res)->Some(op,res)|_->None)~select:(function|Successful_manager_result(Transaction_result_asop)->Someop|_->None)~kind:Kind.Transaction_manager_kind~proj:(function|Transaction_result{storage;big_map_diff;balance_updates;originated_contracts;consumed_gas;storage_size;paid_storage_size_diff;allocated_destination_contract}->(storage,big_map_diff,balance_updates,originated_contracts,consumed_gas,storage_size,paid_storage_size_diff,allocated_destination_contract))~inj:(fun(storage,big_map_diff,balance_updates,originated_contracts,consumed_gas,storage_size,paid_storage_size_diff,allocated_destination_contract)->Transaction_result{storage;big_map_diff;balance_updates;originated_contracts;consumed_gas;storage_size;paid_storage_size_diff;allocated_destination_contract;})letorigination_case=make~op_case:Operation.Encoding.Manager_operations.origination_case~encoding:(obj6(opt"big_map_diff"Contract.big_map_diff_encoding)(dft"balance_updates"Delegate.balance_updates_encoding[])(dft"originated_contracts"(listContract.encoding)[])(dft"consumed_gas"zZ.zero)(dft"storage_size"zZ.zero)(dft"paid_storage_size_diff"zZ.zero))~iselect:(function|Internal_operation_result(({operation=Origination_;_}asop),res)->Some(op,res)|_->None)~select:(function|Successful_manager_result(Origination_result_asop)->Someop|_->None)~proj:(function|Origination_result{big_map_diff;balance_updates;originated_contracts;consumed_gas;storage_size;paid_storage_size_diff}->(big_map_diff,balance_updates,originated_contracts,consumed_gas,storage_size,paid_storage_size_diff))~kind:Kind.Origination_manager_kind~inj:(fun(big_map_diff,balance_updates,originated_contracts,consumed_gas,storage_size,paid_storage_size_diff)->Origination_result{big_map_diff;balance_updates;originated_contracts;consumed_gas;storage_size;paid_storage_size_diff;})letdelegation_case=make~op_case:Operation.Encoding.Manager_operations.delegation_case~encoding:Data_encoding.(obj1(dft"consumed_gas"zZ.zero))~iselect:(function|Internal_operation_result(({operation=Delegation_;_}asop),res)->Some(op,res)|_->None)~select:(function|Successful_manager_result(Delegation_result_asop)->Someop|_->None)~kind:Kind.Delegation_manager_kind~proj:(functionDelegation_result{consumed_gas}->consumed_gas)~inj:(funconsumed_gas->Delegation_result{consumed_gas})endletinternal_operation_result_encoding:packed_internal_operation_resultData_encoding.t=letmake(typekind)(Manager_result.MCaseres_case:kindManager_result.case)=let(Operation.Encoding.Manager_operations.MCaseop_case)=res_case.op_caseincase(Tagop_case.tag)~title:op_case.name(merge_objs(obj3(req"kind"(constantop_case.name))(req"source"Contract.encoding)(req"nonce"uint16))(merge_objsop_case.encoding(obj1(req"result"res_case.t))))(funop->matchres_case.iselectopwith|Some(op,res)->Some(((),op.source,op.nonce),(op_case.projop.operation,res))|None->None)(fun(((),source,nonce),(op,res))->letop={source;operation=op_case.injop;nonce}inInternal_operation_result(op,res))indef"operation.alpha.internal_operation_result"@@union[makeManager_result.reveal_case;makeManager_result.transaction_case;makeManager_result.origination_case;makeManager_result.delegation_case]type'kindcontents_result=|Endorsement_result:{balance_updates:Delegate.balance_updates;delegate:Signature.Public_key_hash.t;slots:intlist;}->Kind.endorsementcontents_result|Seed_nonce_revelation_result:Delegate.balance_updates->Kind.seed_nonce_revelationcontents_result|Double_endorsement_evidence_result:Delegate.balance_updates->Kind.double_endorsement_evidencecontents_result|Double_baking_evidence_result:Delegate.balance_updates->Kind.double_baking_evidencecontents_result|Activate_account_result:Delegate.balance_updates->Kind.activate_accountcontents_result|Proposals_result:Kind.proposalscontents_result|Ballot_result:Kind.ballotcontents_result|Manager_operation_result:{balance_updates:Delegate.balance_updates;operation_result:'kindmanager_operation_result;internal_operation_results:packed_internal_operation_resultlist;}->'kindKind.managercontents_resulttypepacked_contents_result=|Contents_result:'kindcontents_result->packed_contents_resulttypepacked_contents_and_result=|Contents_and_result:'kindOperation.contents*'kindcontents_result->packed_contents_and_resulttype('a,'b)eq=Eq:('a,'a)eqletequal_manager_kind:typeab.aKind.manager->bKind.manager->(a,b)eqoption=funkakb->match(ka,kb)with|(Kind.Reveal_manager_kind,Kind.Reveal_manager_kind)->SomeEq|(Kind.Reveal_manager_kind,_)->None|(Kind.Transaction_manager_kind,Kind.Transaction_manager_kind)->SomeEq|(Kind.Transaction_manager_kind,_)->None|(Kind.Origination_manager_kind,Kind.Origination_manager_kind)->SomeEq|(Kind.Origination_manager_kind,_)->None|(Kind.Delegation_manager_kind,Kind.Delegation_manager_kind)->SomeEq|(Kind.Delegation_manager_kind,_)->NonemoduleEncoding=structtype'kindcase=|Case:{op_case:'kindOperation.Encoding.case;encoding:'aData_encoding.t;select:packed_contents_result->'kindcontents_resultoption;mselect:packed_contents_and_result->('kindcontents*'kindcontents_result)option;proj:'kindcontents_result->'a;inj:'a->'kindcontents_result;}->'kindcaselettagged_casetagnameargsprojinj=letopenData_encodingincasetag~title:(String.capitalize_asciiname)(merge_objs(obj1(req"kind"(constantname)))args)(funx->matchprojxwithNone->None|Somex->Some((),x))(fun((),x)->injx)letendorsement_case=Case{op_case=Operation.Encoding.endorsement_case;encoding=obj3(req"balance_updates"Delegate.balance_updates_encoding)(req"delegate"Signature.Public_key_hash.encoding)(req"slots"(listuint8));select=(function|Contents_result(Endorsement_result_asop)->Someop|_->None);mselect=(function|Contents_and_result((Endorsement_asop),res)->Some(op,res)|_->None);proj=(function|Endorsement_result{balance_updates;delegate;slots}->(balance_updates,delegate,slots));inj=(fun(balance_updates,delegate,slots)->Endorsement_result{balance_updates;delegate;slots});}letseed_nonce_revelation_case=Case{op_case=Operation.Encoding.seed_nonce_revelation_case;encoding=obj1(req"balance_updates"Delegate.balance_updates_encoding);select=(function|Contents_result(Seed_nonce_revelation_result_asop)->Someop|_->None);mselect=(function|Contents_and_result((Seed_nonce_revelation_asop),res)->Some(op,res)|_->None);proj=(fun(Seed_nonce_revelation_resultbus)->bus);inj=(funbus->Seed_nonce_revelation_resultbus);}letdouble_endorsement_evidence_case=Case{op_case=Operation.Encoding.double_endorsement_evidence_case;encoding=obj1(req"balance_updates"Delegate.balance_updates_encoding);select=(function|Contents_result(Double_endorsement_evidence_result_asop)->Someop|_->None);mselect=(function|Contents_and_result((Double_endorsement_evidence_asop),res)->Some(op,res)|_->None);proj=(fun(Double_endorsement_evidence_resultbus)->bus);inj=(funbus->Double_endorsement_evidence_resultbus);}letdouble_baking_evidence_case=Case{op_case=Operation.Encoding.double_baking_evidence_case;encoding=obj1(req"balance_updates"Delegate.balance_updates_encoding);select=(function|Contents_result(Double_baking_evidence_result_asop)->Someop|_->None);mselect=(function|Contents_and_result((Double_baking_evidence_asop),res)->Some(op,res)|_->None);proj=(fun(Double_baking_evidence_resultbus)->bus);inj=(funbus->Double_baking_evidence_resultbus);}letactivate_account_case=Case{op_case=Operation.Encoding.activate_account_case;encoding=obj1(req"balance_updates"Delegate.balance_updates_encoding);select=(function|Contents_result(Activate_account_result_asop)->Someop|_->None);mselect=(function|Contents_and_result((Activate_account_asop),res)->Some(op,res)|_->None);proj=(fun(Activate_account_resultbus)->bus);inj=(funbus->Activate_account_resultbus);}letproposals_case=Case{op_case=Operation.Encoding.proposals_case;encoding=Data_encoding.empty;select=(function|Contents_result(Proposals_resultasop)->Someop|_->None);mselect=(function|Contents_and_result((Proposals_asop),res)->Some(op,res)|_->None);proj=(funProposals_result->());inj=(fun()->Proposals_result);}letballot_case=Case{op_case=Operation.Encoding.ballot_case;encoding=Data_encoding.empty;select=(function|Contents_result(Ballot_resultasop)->Someop|_->None);mselect=(function|Contents_and_result((Ballot_asop),res)->Some(op,res)|_->None);proj=(funBallot_result->());inj=(fun()->Ballot_result);}letmake_manager_case(typekind)(Operation.Encoding.Caseop_case:kindKind.managerOperation.Encoding.case)(Manager_result.MCaseres_case:kindManager_result.case)mselect=Case{op_case=Operation.Encoding.Caseop_case;encoding=obj3(req"balance_updates"Delegate.balance_updates_encoding)(req"operation_result"res_case.t)(dft"internal_operation_results"(listinternal_operation_result_encoding)[]);select=(function|Contents_result(Manager_operation_result({operation_result=Appliedres;_}asop))->(matchres_case.select(Successful_manager_resultres)with|Someres->Some(Manager_operation_result{opwithoperation_result=Appliedres})|None->None)|Contents_result(Manager_operation_result({operation_result=Backtracked(res,errs);_}asop))->(matchres_case.select(Successful_manager_resultres)with|Someres->Some(Manager_operation_result{opwithoperation_result=Backtracked(res,errs)})|None->None)|Contents_result(Manager_operation_result({operation_result=Skippedkind;_}asop))->(matchequal_manager_kindkindres_case.kindwith|None->None|SomeEq->Some(Manager_operation_result{opwithoperation_result=Skippedkind}))|Contents_result(Manager_operation_result({operation_result=Failed(kind,errs);_}asop))->(matchequal_manager_kindkindres_case.kindwith|None->None|SomeEq->Some(Manager_operation_result{opwithoperation_result=Failed(kind,errs)}))|Contents_resultBallot_result->None|Contents_result(Endorsement_result_)->None|Contents_result(Seed_nonce_revelation_result_)->None|Contents_result(Double_endorsement_evidence_result_)->None|Contents_result(Double_baking_evidence_result_)->None|Contents_result(Activate_account_result_)->None|Contents_resultProposals_result->None);mselect;proj=(fun(Manager_operation_result{balance_updates=bus;operation_result=r;internal_operation_results=rs})->(bus,r,rs));inj=(fun(bus,r,rs)->Manager_operation_result{balance_updates=bus;operation_result=r;internal_operation_results=rs;});}letreveal_case=make_manager_caseOperation.Encoding.reveal_caseManager_result.reveal_case(function|Contents_and_result((Manager_operation{operation=Reveal_;_}asop),res)->Some(op,res)|_->None)lettransaction_case=make_manager_caseOperation.Encoding.transaction_caseManager_result.transaction_case(function|Contents_and_result((Manager_operation{operation=Transaction_;_}asop),res)->Some(op,res)|_->None)letorigination_case=make_manager_caseOperation.Encoding.origination_caseManager_result.origination_case(function|Contents_and_result((Manager_operation{operation=Origination_;_}asop),res)->Some(op,res)|_->None)letdelegation_case=make_manager_caseOperation.Encoding.delegation_caseManager_result.delegation_case(function|Contents_and_result((Manager_operation{operation=Delegation_;_}asop),res)->Some(op,res)|_->None)endletcontents_result_encoding=letopenEncodinginletmake(Case{op_case=Operation.Encoding.Case{tag;name;_};encoding;mselect=_;select;proj;inj})=letprojx=matchselectxwithNone->None|Somex->Some(projx)inletinjx=Contents_result(injx)intagged_case(Tagtag)nameencodingprojinjindef"operation.alpha.contents_result"@@union[makeendorsement_case;makeseed_nonce_revelation_case;makedouble_endorsement_evidence_case;makedouble_baking_evidence_case;makeactivate_account_case;makeproposals_case;makeballot_case;makereveal_case;maketransaction_case;makeorigination_case;makedelegation_case]letcontents_and_result_encoding=letopenEncodinginletmake(Case{op_case=Operation.Encoding.Case{tag;name;encoding;proj;inj;_};mselect;encoding=meta_encoding;proj=meta_proj;inj=meta_inj;_})=letprojc=matchmselectcwith|Some(op,res)->Some(projop,meta_projres)|_->Noneinletinj(op,res)=Contents_and_result(injop,meta_injres)inletencoding=merge_objsencoding(obj1(req"metadata"meta_encoding))intagged_case(Tagtag)nameencodingprojinjindef"operation.alpha.operation_contents_and_result"@@union[makeendorsement_case;makeseed_nonce_revelation_case;makedouble_endorsement_evidence_case;makedouble_baking_evidence_case;makeactivate_account_case;makeproposals_case;makeballot_case;makereveal_case;maketransaction_case;makeorigination_case;makedelegation_case]type'kindcontents_result_list=|Single_result:'kindcontents_result->'kindcontents_result_list|Cons_result:'kindKind.managercontents_result*'restKind.managercontents_result_list->('kind*'rest)Kind.managercontents_result_listtypepacked_contents_result_list=|Contents_result_list:'kindcontents_result_list->packed_contents_result_listletcontents_result_list_encoding=letrecto_list=function|Contents_result_list(Single_resulto)->[Contents_resulto]|Contents_result_list(Cons_result(o,os))->Contents_resulto::to_list(Contents_result_listos)inletrecof_list=function|[]->Pervasives.failwith"cannot decode empty operation result"|[Contents_resulto]->Contents_result_list(Single_resulto)|Contents_resulto::os->(let(Contents_result_listos)=of_listosinmatch(o,os)with|(Manager_operation_result_,Single_result(Manager_operation_result_))->Contents_result_list(Cons_result(o,os))|(Manager_operation_result_,Cons_result_)->Contents_result_list(Cons_result(o,os))|_->Pervasives.failwith"cannot decode ill-formed operation result")indef"operation.alpha.contents_list_result"@@convto_listof_list(listcontents_result_encoding)type'kindcontents_and_result_list=|Single_and_result:'kindAlpha_context.contents*'kindcontents_result->'kindcontents_and_result_list|Cons_and_result:'kindKind.managerAlpha_context.contents*'kindKind.managercontents_result*'restKind.managercontents_and_result_list->('kind*'rest)Kind.managercontents_and_result_listtypepacked_contents_and_result_list=|Contents_and_result_list:'kindcontents_and_result_list->packed_contents_and_result_listletcontents_and_result_list_encoding=letrecto_list=function|Contents_and_result_list(Single_and_result(op,res))->[Contents_and_result(op,res)]|Contents_and_result_list(Cons_and_result(op,res,rest))->Contents_and_result(op,res)::to_list(Contents_and_result_listrest)inletrecof_list=function|[]->Pervasives.failwith"cannot decode empty combined operation result"|[Contents_and_result(op,res)]->Contents_and_result_list(Single_and_result(op,res))|Contents_and_result(op,res)::rest->(let(Contents_and_result_listrest)=of_listrestinmatch(op,rest)with|(Manager_operation_,Single_and_result(Manager_operation_,_))->Contents_and_result_list(Cons_and_result(op,res,rest))|(Manager_operation_,Cons_and_result(_,_,_))->Contents_and_result_list(Cons_and_result(op,res,rest))|_->Pervasives.failwith"cannot decode ill-formed combined operation result")inconvto_listof_list(Variable.listcontents_and_result_encoding)type'kindoperation_metadata={contents:'kindcontents_result_list}typepacked_operation_metadata=|Operation_metadata:'kindoperation_metadata->packed_operation_metadata|No_operation_metadata:packed_operation_metadataletoperation_metadata_encoding=def"operation.alpha.result"@@union[case(Tag0)~title:"Operation_metadata"contents_result_list_encoding(function|Operation_metadata{contents}->Some(Contents_result_listcontents)|_->None)(fun(Contents_result_listcontents)->Operation_metadata{contents});case(Tag1)~title:"No_operation_metadata"empty(functionNo_operation_metadata->Some()|_->None)(fun()->No_operation_metadata)]letkind_equal:typekindkind2.kindcontents->kind2contents_result->(kind,kind2)eqoption=funopres->match(op,res)with|(Endorsement_,Endorsement_result_)->SomeEq|(Endorsement_,_)->None|(Seed_nonce_revelation_,Seed_nonce_revelation_result_)->SomeEq|(Seed_nonce_revelation_,_)->None|(Double_endorsement_evidence_,Double_endorsement_evidence_result_)->SomeEq|(Double_endorsement_evidence_,_)->None|(Double_baking_evidence_,Double_baking_evidence_result_)->SomeEq|(Double_baking_evidence_,_)->None|(Activate_account_,Activate_account_result_)->SomeEq|(Activate_account_,_)->None|(Proposals_,Proposals_result)->SomeEq|(Proposals_,_)->None|(Ballot_,Ballot_result)->SomeEq|(Ballot_,_)->None|(Manager_operation{operation=Reveal_;_},Manager_operation_result{operation_result=Applied(Reveal_result_);_})->SomeEq|(Manager_operation{operation=Reveal_;_},Manager_operation_result{operation_result=Backtracked(Reveal_result_,_);_})->SomeEq|(Manager_operation{operation=Reveal_;_},Manager_operation_result{operation_result=Failed(Alpha_context.Kind.Reveal_manager_kind,_);_})->SomeEq|(Manager_operation{operation=Reveal_;_},Manager_operation_result{operation_result=SkippedAlpha_context.Kind.Reveal_manager_kind;_})->SomeEq|(Manager_operation{operation=Reveal_;_},_)->None|(Manager_operation{operation=Transaction_;_},Manager_operation_result{operation_result=Applied(Transaction_result_);_})->SomeEq|(Manager_operation{operation=Transaction_;_},Manager_operation_result{operation_result=Backtracked(Transaction_result_,_);_})->SomeEq|(Manager_operation{operation=Transaction_;_},Manager_operation_result{operation_result=Failed(Alpha_context.Kind.Transaction_manager_kind,_);_})->SomeEq|(Manager_operation{operation=Transaction_;_},Manager_operation_result{operation_result=SkippedAlpha_context.Kind.Transaction_manager_kind;_})->SomeEq|(Manager_operation{operation=Transaction_;_},_)->None|(Manager_operation{operation=Origination_;_},Manager_operation_result{operation_result=Applied(Origination_result_);_})->SomeEq|(Manager_operation{operation=Origination_;_},Manager_operation_result{operation_result=Backtracked(Origination_result_,_);_})->SomeEq|(Manager_operation{operation=Origination_;_},Manager_operation_result{operation_result=Failed(Alpha_context.Kind.Origination_manager_kind,_);_})->SomeEq|(Manager_operation{operation=Origination_;_},Manager_operation_result{operation_result=SkippedAlpha_context.Kind.Origination_manager_kind;_})->SomeEq|(Manager_operation{operation=Origination_;_},_)->None|(Manager_operation{operation=Delegation_;_},Manager_operation_result{operation_result=Applied(Delegation_result_);_})->SomeEq|(Manager_operation{operation=Delegation_;_},Manager_operation_result{operation_result=Backtracked(Delegation_result_,_);_})->SomeEq|(Manager_operation{operation=Delegation_;_},Manager_operation_result{operation_result=Failed(Alpha_context.Kind.Delegation_manager_kind,_);_})->SomeEq|(Manager_operation{operation=Delegation_;_},Manager_operation_result{operation_result=SkippedAlpha_context.Kind.Delegation_manager_kind;_})->SomeEq|(Manager_operation{operation=Delegation_;_},_)->Noneletreckind_equal_list:typekindkind2.kindcontents_list->kind2contents_result_list->(kind,kind2)eqoption=funcontentsres->match(contents,res)with|(Singleop,Single_resultres)->(matchkind_equalopreswithNone->None|SomeEq->SomeEq)|(Cons(op,ops),Cons_result(res,ress))->(matchkind_equalopreswith|None->None|SomeEq->(matchkind_equal_listopsresswithNone->None|SomeEq->SomeEq))|_->Noneletrecpack_contents_list:typekind.kindcontents_list->kindcontents_result_list->kindcontents_and_result_list=funcontentsres->match(contents,res)with|(Singleop,Single_resultres)->Single_and_result(op,res)|(Cons(op,ops),Cons_result(res,ress))->Cons_and_result(op,res,pack_contents_listopsress)|(Single(Manager_operation_),Cons_result(Manager_operation_result_,Single_result_))->.|(Cons(_,_),Single_result(Manager_operation_result{operation_result=Failed_;_}))->.|(Cons(_,_),Single_result(Manager_operation_result{operation_result=Skipped_;_}))->.|(Cons(_,_),Single_result(Manager_operation_result{operation_result=Applied_;_}))->.|(Cons(_,_),Single_result(Manager_operation_result{operation_result=Backtracked_;_}))->.|(Single_,Cons_result_)->.letrecunpack_contents_list:typekind.kindcontents_and_result_list->kindcontents_list*kindcontents_result_list=function|Single_and_result(op,res)->(Singleop,Single_resultres)|Cons_and_result(op,res,rest)->let(ops,ress)=unpack_contents_listrestin(Cons(op,ops),Cons_result(res,ress))letrecto_list=function|Contents_result_list(Single_resulto)->[Contents_resulto]|Contents_result_list(Cons_result(o,os))->Contents_resulto::to_list(Contents_result_listos)letrecof_list=function|[]->assertfalse|[Contents_resulto]->Contents_result_list(Single_resulto)|Contents_resulto::os->(let(Contents_result_listos)=of_listosinmatch(o,os)with|(Manager_operation_result_,Single_result(Manager_operation_result_))->Contents_result_list(Cons_result(o,os))|(Manager_operation_result_,Cons_result_)->Contents_result_list(Cons_result(o,os))|_->Pervasives.failwith"Operation result list of length > 1 should only contains manager \
operations result.")letoperation_data_and_metadata_encoding=def"operation.alpha.operation_with_metadata"@@union[case(Tag0)~title:"Operation_with_metadata"(obj2(req"contents"(dynamic_sizecontents_and_result_list_encoding))(opt"signature"Signature.encoding))(function|(Operation_data_,No_operation_metadata)->None|(Operation_dataop,Operation_metadatares)->(matchkind_equal_listop.contentsres.contentswith|None->Pervasives.failwith"cannot decode inconsistent combined operation result"|SomeEq->Some(Contents_and_result_list(pack_contents_listop.contentsres.contents),op.signature)))(fun(Contents_and_result_listcontents,signature)->let(op_contents,res_contents)=unpack_contents_listcontentsin(Operation_data{contents=op_contents;signature},Operation_metadata{contents=res_contents}));case(Tag1)~title:"Operation_without_metadata"(obj2(req"contents"(dynamic_sizeOperation.contents_list_encoding))(opt"signature"Signature.encoding))(function|(Operation_dataop,No_operation_metadata)->Some(Contents_listop.contents,op.signature)|(Operation_data_,Operation_metadata_)->None)(fun(Contents_listcontents,signature)->(Operation_data{contents;signature},No_operation_metadata))]typeblock_metadata={baker:Signature.Public_key_hash.t;level:Level.t;voting_period_kind:Voting_period.kind;nonce_hash:Nonce_hash.toption;consumed_gas:Z.t;deactivated:Signature.Public_key_hash.tlist;balance_updates:Delegate.balance_updates;}letblock_metadata_encoding=letopenData_encodingindef"block_header.alpha.metadata"@@conv(fun{baker;level;voting_period_kind;nonce_hash;consumed_gas;deactivated;balance_updates}->(baker,level,voting_period_kind,nonce_hash,consumed_gas,deactivated,balance_updates))(fun(baker,level,voting_period_kind,nonce_hash,consumed_gas,deactivated,balance_updates)->{baker;level;voting_period_kind;nonce_hash;consumed_gas;deactivated;balance_updates;})(obj7(req"baker"Signature.Public_key_hash.encoding)(req"level"Level.encoding)(req"voting_period_kind"Voting_period.kind_encoding)(req"nonce_hash"(optionNonce_hash.encoding))(req"consumed_gas"(check_size10n))(req"deactivated"(listSignature.Public_key_hash.encoding))(req"balance_updates"Delegate.balance_updates_encoding))