Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file sc_rollup_rpc.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266(*****************************************************************************)(* *)(* SPDX-License-Identifier: MIT *)(* Copyright (c) 2021-2023 Nomadic Labs <contact@nomadic-labs.com> *)(* Copyright (c) 2022-2023 TriliTech <contact@trili.tech> *)(* Copyright (c) 2023 Functori <contact@functori.com> *)(* Copyright (c) 2023 Marigold <contact@marigold.dev> *)(*****************************************************************************)openRPC_coreletget_global_block_ticks?(block="head")()=makeGET["global";"block";block;"ticks"]JSON.as_intletget_global_block_state_hash?(block="head")()=makeGET["global";"block";block;"state_hash"]JSON.as_stringletget_global_block_total_ticks?(block="head")()=makeGET["global";"block";block;"total_ticks"]JSON.as_intletget_global_block_state_current_level?(block="head")()=makeGET["global";"block";block;"state_current_level"]JSON.as_intletget_global_block_status?(block="head")()=makeGET["global";"block";block;"status"]JSON.as_stringletget_global_block_outbox?(block="cemented")~outbox_level()=makeGET["global";"block";block;"outbox";string_of_intoutbox_level;"messages"]Fun.idletget_global_smart_rollup_address()=makeGET["global";"smart_rollup_address"]JSON.as_stringletget_global_block_aux?(block="head")?(path=[])()=makeGET(["global";"block";block]@path)Fun.idletget_global_block=get_global_block_aux~path:[]letget_global_block_inbox?(block="head")()=makeGET["global";"block";block;"inbox"]RPC.smart_rollup_inbox_from_jsonletget_global_block_hash=get_global_block_aux~path:["hash"]letget_global_block_level=get_global_block_aux~path:["level"]letget_global_block_num_messages=get_global_block_aux~path:["num_messages"]letget_global_tezos_head()=makeGET["global";"tezos_head"]Fun.idletget_global_tezos_level()=makeGET["global";"tezos_level"]Fun.idtypeslot_header={level:int;commitment:string;index:int}letget_global_block_dal_slot_headers?(block="head")()=makeGET["global";"block";block;"dal";"slot_headers"](funjson->JSON.(as_listjson|>List.map(funobj->{level=obj|->"level"|>as_int;commitment=obj|->"commitment"|>as_string;index=obj|->"index"|>as_int;})))letget_local_batcher_queue()=makeGET["local";"batcher";"queue"](funjson->JSON.as_listjson|>List.map@@funo->letid=JSON.(o|->"id"|>as_string)inlethex_msg=JSON.(o|->"message"|->"content"|>as_string)in(id,Hex.to_string(`Hexhex_msg)))letget_local_batcher_queue_msg_id~msg_id=makeGET["local";"batcher";"queue";msg_id](funjson->ifJSON.is_nulljsonthenfailwith"Message is not in the queue"elselethex_msg=JSON.(json|->"content"|>as_string)in(Hex.to_string(`Hexhex_msg),JSON.(json|->"status"|>as_string)))typesimulation_result={state_hash:string;status:string;output:JSON.t;inbox_level:int;num_ticks:int;insights:stringoptionlist;}letpost_global_block_simulate?(block="head")?(reveal_pages=[])?(insight_requests=[])messages=letmessages_json=`A(List.map(funs->`StringHex.(of_strings|>show))messages)inletreveal_json=matchreveal_pageswith|[]->[]|pages->[("reveal_pages",`A(List.map(funs->`StringHex.(of_strings|>show))pages));]inletinsight_requests_json=letinsight_request_jsoninsight_request=letinsight_request_kind,key=matchinsight_requestwith|`Pvm_state_keykey->("pvm_state",key)|`Durable_storage_keykey->("durable_storage",key)inletx=`A(List.map(funs->`Strings)key)in`O[("kind",`Stringinsight_request_kind);("key",x)]in[("insight_requests",`A(List.mapinsight_request_jsoninsight_requests))]inletdata=Data(`O((("messages",messages_json)::reveal_json)@insight_requests_json))inmakePOST["global";"block";block;"simulate"]~data(funobj->JSON.{state_hash=obj|->"state_hash"|>as_string;status=obj|->"status"|>as_string;output=obj|->"output";inbox_level=obj|->"inbox_level"|>as_int;num_ticks=obj|->"num_ticks"|>as_string|>int_of_string;insights=obj|->"insights"|>as_list|>List.mapas_string_opt;})letget_global_block_dal_processed_slots?(block="head")()=makeGET["global";"block";block;"dal";"processed_slots"](funjson->JSON.as_listjson|>List.map(funobj->letindex=JSON.(obj|->"index"|>as_int)inletstatus=JSON.(obj|->"status"|>as_string)in(index,status)))typecommitment_and_hash={commitment:RPC.smart_rollup_commitment;hash:string;}typecommitment_info={commitment_and_hash:commitment_and_hash;first_published_at_level:intoption;published_at_level:intoption;}letcommitment_with_hash_from_jsonjson=lethash,commitment_json=(JSON.get"hash"json,JSON.get"commitment"json)in{hash=JSON.as_stringhash;commitment=RPC.smart_rollup_commitment_from_jsoncommitment_json;}letcommitment_info_from_jsonjson=lethash,commitment_json,first_published_at_level,published_at_level=(JSON.get"hash"json,JSON.get"commitment"json,JSON.get"first_published_at_level"json,JSON.get"published_at_level"json)in{commitment_and_hash={hash=JSON.as_stringhash;commitment=RPC.smart_rollup_commitment_from_jsoncommitment_json;};first_published_at_level=first_published_at_level|>JSON.as_opt|>Option.mapJSON.as_int;published_at_level=published_at_level|>JSON.as_opt|>Option.mapJSON.as_int;}letget_global_last_stored_commitment()=makeGET["global";"last_stored_commitment"]commitment_with_hash_from_jsonletget_local_last_published_commitment()=makeGET["local";"last_published_commitment"]commitment_info_from_jsonletget_local_commitments~commitment_hash()=makeGET["local";"commitments";commitment_hash]commitment_info_from_jsontypegc_info={last_gc_level:int;first_available_level:int}letget_local_gc_info()=makeGET["local";"gc_info"](funobj->{last_gc_level=JSON.(obj|->"last_gc_level"|>as_int);first_available_level=JSON.(obj|->"first_available_level"|>as_int);})letget_global_block_state?(block="head")~key()=make~query_string:[("key",key)]GET["global";"block";block;"state"](funjson->letout=JSON.as_stringjsoninletbytes=`Hexout|>Hex.to_bytesinbytes)type'output_typedurable_state_operation=|Value:stringoptiondurable_state_operation|Length:int64optiondurable_state_operation|Subkeys:stringlistdurable_state_operationletstring_of_durable_state_operation(typea)(x:adurable_state_operation)=matchxwithValue->"value"|Length->"length"|Subkeys->"subkeys"letget_global_block_durable_state_value?(block="head")~pvm_kind~operation~key()=letop=string_of_durable_state_operationoperationinletf:typek.kdurable_state_operation->JSON.t->k=funoperation->matchoperationwith|Value->JSON.as_string_opt|Length->JSON.as_int64_opt|Subkeys->funjson->List.mapJSON.as_string(JSON.as_listjson)inmake~query_string:[("key",String.trimkey)]GET["global";"block";block;"durable";pvm_kind;op](foperation)letpost_local_batcher_injection~messages=letdata=Data(`A(List.map(funs->`StringHex.(of_strings|>show))messages))inmakePOST["local";"batcher";"injection"]~dataJSON.(funjson->as_listjson|>List.mapas_string)typeoutbox_proof={commitment_hash:string;proof:string}letoutbox_proof_simple?(block="head")~outbox_level~message_index()=letopenRPC_coreinletquery_string=[("index",string_of_intmessage_index)]inmake~query_stringGET["global";"block";block;"helpers";"proofs";"outbox";string_of_intoutbox_level;"messages";](funjson->letopenJSONinletcommitment_hash=json|->"commitment"|>as_stringinletproof_string=json|->"proof"|>as_stringin(* There is 0x return in the proof hash as it is a hex *)letproof_hex=sf"0x%s"proof_stringinSome{commitment_hash;proof=proof_hex})