123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)(* Copyright (c) 2019 Nomadic Labs <contact@nomadic-labs.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. *)(* *)(*****************************************************************************)openProtocol_client_contextopenProtocolopenAlpha_contexttypeerror+=Bad_tez_argofstring*string(* Arg_name * value *)typeerror+=Bad_max_priorityofstringtypeerror+=Bad_minimal_feesofstringtypeerror+=Bad_max_waiting_timeofstringtypeerror+=Bad_endorsement_delayofstringtypeerror+=Bad_preserved_levelsofstringtypeerror+=Forbidden_Negative_intofstringlet()=register_error_kind`Permanent~id:"badTezArg"~title:"Bad Tez Arg"~description:"Invalid \xEA\x9C\xA9 notation in parameter."~pp:(funppf(arg_name,literal)->Format.fprintfppf"Invalid \xEA\x9C\xA9 notation in parameter %s: '%s'"arg_nameliteral)Data_encoding.(obj2(req"parameter"string)(req"literal"string))(function|Bad_tez_arg(parameter,literal)->Some(parameter,literal)|_->None)(fun(parameter,literal)->Bad_tez_arg(parameter,literal));register_error_kind`Permanent~id:"badMaxPriorityArg"~title:"Bad -max-priority arg"~description:"invalid priority in -max-priority"~pp:(funppfliteral->Format.fprintfppf"invalid priority '%s' in -max-priority"literal)Data_encoding.(obj1(req"parameter"string))(functionBad_max_priorityparameter->Someparameter|_->None)(funparameter->Bad_max_priorityparameter);register_error_kind`Permanent~id:"badMinimalFeesArg"~title:"Bad -minimal-fees arg"~description:"invalid fee threshold in -fee-threshold"~pp:(funppfliteral->Format.fprintfppf"invalid minimal fees '%s'"literal)Data_encoding.(obj1(req"parameter"string))(functionBad_minimal_feesparameter->Someparameter|_->None)(funparameter->Bad_minimal_feesparameter);register_error_kind`Permanent~id:"badMaxWaitingTimeArg"~title:"Bad -max-waiting-time arg"~description:"invalid duration in -max-waiting-time"~pp:(funppfliteral->Format.fprintfppf"Bad argument value for -max-waiting-time. Expected an integer, but \
given '%s'"literal)Data_encoding.(obj1(req"parameter"string))(functionBad_max_waiting_timeparameter->Someparameter|_->None)(funparameter->Bad_max_waiting_timeparameter);register_error_kind`Permanent~id:"badEndorsementDelayArg"~title:"Bad -endorsement-delay arg"~description:"invalid duration in -endorsement-delay"~pp:(funppfliteral->Format.fprintfppf"Bad argument value for -endorsement-delay. Expected an integer, but \
given '%s'"literal)Data_encoding.(obj1(req"parameter"string))(functionBad_endorsement_delayparameter->Someparameter|_->None)(funparameter->Bad_endorsement_delayparameter);register_error_kind`Permanent~id:"badPreservedLevelsArg"~title:"Bad -preserved-levels arg"~description:"invalid number of levels in -preserved-levels"~pp:(funppfliteral->Format.fprintfppf"Bad argument value for -preserved_levels. Expected a positive \
integer, but given '%s'"literal)Data_encoding.(obj1(req"parameter"string))(functionBad_preserved_levelsparameter->Someparameter|_->None)(funparameter->Bad_preserved_levelsparameter);register_error_kind`Permanent~id:"ForbiddenNegativeInt"~title:"Forbidden negative int"~description:"invalid number, must a non negative natural "Data_encoding.(obj1(req"invalid_natural"string))~pp:(funppfliteral->Format.fprintfppf"Bad argument value for natural. Expected a non negative integer, but \
given '%s'"literal)(functionForbidden_Negative_intstr->Somestr|_->None)(funstr->Forbidden_Negative_intstr)letstring_parameter=Tezos_clic.parameter(fun_x->returnx)letint_parameter=Tezos_clic.parameter(fun_p->tryreturn(int_of_stringp)with_->failwith"Cannot read int")leturi_parameter=Tezos_clic.parameter(fun_x->return(Uri.of_stringx))letbytes_of_prefixed_strings=matchifString.lengths<2||s.[0]<>'0'||s.[1]<>'x'thenNoneelseHex.to_bytes(`Hex(String.subs2(String.lengths-2)))with|Somes->returns|None->failwith"Invalid bytes, expecting hexadecimal notation (e.g. 0x1234abcd)"letbytes_parameter=Tezos_clic.parameter(fun_s->bytes_of_prefixed_strings)letparse_file~from_text~read_file~path=letopenLwt_result_syntaxinlet*content=read_filepathinfrom_textcontentletfile_or_text~from_text~read_file=Client_aliases.parse_alternatives[("file",funpath->parse_file~from_text~read_file~path);("text",from_text);]letfile_or_text_parameter~from_text()=Tezos_clic.parameter(fun(cctxt:#Client_context.full)->file_or_text~from_text~read_file:cctxt#read_file)letjson_parameter=letfrom_texts=matchData_encoding.Json.from_stringswith|Okjson->returnjson|Errorerr->failwith"'%s' is not a valid JSON-encoded value: %s"serrinfile_or_text_parameter~from_text()letdata_parameter=letopenLwt_syntaxinletfrom_textinput=return@@Tezos_micheline.Micheline_parser.no_parsing_error@@Michelson_v1_parser.parse_expressioninputinfile_or_text_parameter~from_text()letentrypoint_parameter=Tezos_clic.parameter(fun_str->Lwt.return@@Environment.wrap_tzresult@@Entrypoint.of_string_laxstr)letinit_arg=Tezos_clic.default_arg~long:"init"~placeholder:"data"~doc:"initial value of the contract's storage"~default:"Unit"string_parameterletglobal_constant_param~name~descnext=Tezos_clic.param~name~descstring_parameternextletarg_arg=Tezos_clic.arg~long:"arg"~placeholder:"data"~doc:"argument passed to the contract's script, if needed"string_parameterletdefault_arg_arg=Tezos_clic.arg~long:"default-arg"~placeholder:"data"~doc:"default argument passed to each contract's script, if needed"string_parameterletdelegate_arg=Client_keys_v0.Public_key_hash.source_arg~long:"delegate"~placeholder:"address"~doc:"delegate of the contract\nMust be a known address."()letsource_arg=Tezos_clic.arg~long:"source"~placeholder:"address"~doc:"source of the deposits to be paid\nMust be a known address."string_parameterletentrypoint_arg=Tezos_clic.arg~long:"entrypoint"~placeholder:"name"~doc:"entrypoint of the smart contract"entrypoint_parameterletdefault_entrypoint_arg=Tezos_clic.arg~long:"default-entrypoint"~placeholder:"name"~doc:"default entrypoint of the smart contracts"entrypoint_parameterletforce_switch=Tezos_clic.switch~long:"force"~short:'f'~doc:"disables the node's injection checks\n\
Force the injection of branch-invalid operation or force the injection \
of block without a fitness greater than the current head."()letno_endorse_switch=Tezos_clic.switch~long:"no-endorse"~doc:"Do not let the client automatically endorse a block that it baked."()letminimal_timestamp_switch=Tezos_clic.switch~long:"minimal-timestamp"~doc:"Use the minimal timestamp instead of the current date as timestamp of \
the baked block."()lettez_format="Text format: `DDDDDDD.DDDDDD`.\n\
Tez and mutez and separated by a period sign. Trailing and pending zeroes \
are allowed."lettez_parameterparam=Tezos_clic.parameter(fun_s->matchTez.of_stringswith|Sometez->returntez|None->fail(Bad_tez_arg(param,s)))lettez_arg~default~parameter~doc=Tezos_clic.default_arg~long:parameter~placeholder:"amount"~doc~default(tez_parameter("--"^parameter))lettez_opt_arg~parameter~doc=Tezos_clic.arg~long:parameter~placeholder:"amount"~doc(tez_parameter("--"^parameter))lettez_param~name~descnext=Tezos_clic.param~name~desc:(desc^" in \xEA\x9C\xA9\n"^tez_format)(tez_parametername)nextletnon_negative_z_parameter=Tezos_clic.parameter(fun_s->tryletv=Z.of_stringsinerror_whenCompare.Z.(v<Z.zero)(Forbidden_Negative_ints)>>?=fun()->returnvwith_->failwith"Invalid number, must be a non negative number.")letnon_negative_z_param~name~descnext=Tezos_clic.param~name~descnon_negative_z_parameternextletnon_negative_parameter=Tezos_clic.parameter(fun_s->matchint_of_string_optswith|Someiwheni>=0->returni|_->failwith"Parameter should be a non-negative integer literal")letfee_arg=Tezos_clic.arg~long:"fee"~placeholder:"amount"~doc:"fee in \xEA\x9C\xA9 to pay to the baker"(tez_parameter"--fee")letdefault_fee_arg=Tezos_clic.arg~long:"default-fee"~placeholder:"amount"~doc:"default fee in \xEA\x9C\xA9 to pay to the baker for each transaction"(tez_parameter"--default-fee")letlevel_kind=Tezos_clic.parameter(fun_s->matchOption.bind(Script_int.of_strings)Script_int.is_natwith|Somen->returnn|None->failwith"invalid level (must be a positive number)")letlevel_arg=Tezos_clic.arg~long:"level"~placeholder:"level"~doc:"Set the level to be returned by the LEVEL instruction"level_kindletraw_level_parameter=Tezos_clic.parameter(fun_s->matchInt32.of_string_optswith|Someiwheni>=0l->Lwt.return@@Environment.wrap_tzresult(Raw_level.of_int32i)|_->failwith"'%s' is not a valid level (should be a non-negative int32 value)"s)lettimestamp_parameter=Tezos_clic.parameter(fun_s->matchScript_timestamp.of_stringswith|Sometime->returntime|None->failwith"invalid timestamp, must be either a RFC 3339 string or a number \
of seconds since epoch.")letnow_arg=Tezos_clic.arg~long:"now"~placeholder:"timestamp"~doc:"Set the timestamp to be returned by the NOW instruction. Allowed format \
are RFC 3339 (YYYY-MM-DDTHH:MM:SSZ) or number of seconds since epoch."timestamp_parameterletgas_limit_kind=Tezos_clic.parameter(fun_s->tryletv=Z.of_stringsinreturn(Gas.Arith.integral_exnv)with_->failwith"invalid gas limit (must be a positive number)")letgas_limit_arg=Tezos_clic.arg~long:"gas-limit"~short:'G'~placeholder:"amount"~doc:"Set the gas limit of the transaction instead of letting the client \
decide based on a simulation"gas_limit_kindletdefault_gas_limit_arg=Tezos_clic.arg~long:"default-gas-limit"~short:'G'~placeholder:"amount"~doc:"Set the default gas limit for each transaction instead of letting the \
client decide based on a simulation"gas_limit_kindletrun_gas_limit_arg=Tezos_clic.arg~long:"gas"~short:'G'~doc:"Initial quantity of gas for typechecking and execution"~placeholder:"gas"gas_limit_kindletunlimited_gas_arg=Tezos_clic.switch~long:"unlimited-gas"~doc:"Allows interpretation with virtually unlimited gas"()letstorage_limit_kind=Tezos_clic.parameter(fun_s->tryletv=Z.of_stringsinassert(Compare.Z.(v>=Z.zero));returnvwith_->failwith"invalid storage limit (must be a positive number of bytes)")letstorage_limit_arg=Tezos_clic.arg~long:"storage-limit"~short:'S'~placeholder:"amount"~doc:"Set the storage limit of the transaction instead of letting the client \
decide based on a simulation"storage_limit_kindletdefault_storage_limit_arg=Tezos_clic.arg~long:"default-storage-limit"~short:'S'~placeholder:"amount"~doc:"Set the default storage limit for each transaction instead of letting \
the client decide based on a simulation"storage_limit_kindletcounter_arg=letopenTezos_clicinarg~long:"counter"~short:'C'~placeholder:"counter"~doc:"Set the counter to be used by the transaction"non_negative_z_parameterletmax_priority_arg=letopenTezos_clicinarg~long:"max-priority"~placeholder:"slot"~doc:"maximum allowed baking slot"(parameter(fun_s->tryreturn(int_of_strings)with_->fail(Bad_max_prioritys)))letdefault_minimal_fees=matchTez.of_mutez100LwithNone->assertfalse|Somet->tletdefault_minimal_nanotez_per_gas_unit=Q.of_int100letdefault_minimal_nanotez_per_byte=Q.of_int1000letminimal_fees_arg=Tezos_clic.default_arg~long:"minimal-fees"~placeholder:"amount"~doc:"exclude operations with fees lower than this threshold (in tez)"~default:(Tez.to_stringdefault_minimal_fees)(Tezos_clic.parameter(fun_s->matchTez.of_stringswith|Somet->returnt|None->fail(Bad_minimal_feess)))letminimal_nanotez_per_gas_unit_arg=Tezos_clic.default_arg~long:"minimal-nanotez-per-gas-unit"~placeholder:"amount"~doc:"exclude operations with fees per gas lower than this threshold (in \
nanotez)"~default:(Q.to_stringdefault_minimal_nanotez_per_gas_unit)(Tezos_clic.parameter(fun_s->tryreturn(Q.of_strings)with_->fail(Bad_minimal_feess)))letminimal_nanotez_per_byte_arg=Tezos_clic.default_arg~long:"minimal-nanotez-per-byte"~placeholder:"amount"~default:(Q.to_stringdefault_minimal_nanotez_per_byte)~doc:"exclude operations with fees per byte lower than this threshold (in \
nanotez)"(Tezos_clic.parameter(fun_s->tryreturn(Q.of_strings)with_->fail(Bad_minimal_feess)))letreplace_by_fees_arg=Tezos_clic.switch~long:"replace"~doc:"Replace an existing pending transaction from the same source, if any, \
with another one with higher fees. There are no guarantees that the \
first operation will not be included or that the second one will be. \
But, only one of the operations at most will end in a block (in \
precheck mode)."()letsuccessor_level_arg=Tezos_clic.switch~long:"simulate-successor-level"~doc:"Make the simulate on the successor level of the current head."()letpreserved_levels_arg=Tezos_clic.default_arg~long:"preserved-levels"~placeholder:"threshold"~doc:"Number of effective levels kept in the accuser's memory"~default:"200"(Tezos_clic.parameter(fun_s->tryletpreserved_cycles=int_of_stringsinifpreserved_cycles<0thenfail(Bad_preserved_levelss)elsereturnpreserved_cycleswith_->fail(Bad_preserved_levelss)))letno_print_source_flag=Tezos_clic.switch~long:"no-print-source"~short:'q'~doc:"don't print the source code\n\
If an error is encountered, the client will print the contract's source \
code by default.\n\
This option disables this behaviour."()letno_confirmation=Tezos_clic.switch~long:"no-confirmation"~doc:"don't print wait for the operation to be confirmed."()letsignature_parameter=Tezos_clic.parameter(fun_cctxts->matchTezos_crypto.Signature.V0.of_b58check_optswith|Somes->returns|None->failwith"Not given a valid signature")letunparsing_mode_parameter=Tezos_clic.parameter~autocomplete:(fun_cctxt->return["Readable";"Optimized";"Optimized_legacy"])(fun_cctxts->matchswith|"Readable"->returnScript_ir_unparser.Readable|"Optimized"->returnScript_ir_unparser.Optimized|"Optimized_legacy"->returnScript_ir_unparser.Optimized_legacy|_->failwith"Unknown unparsing mode %s"s)letunparsing_mode_arg~default=Tezos_clic.default_arg~long:"unparsing-mode"~placeholder:"mode"~doc:"Unparsing mode to use\n\
One of \"Readable\", \"Optimized\", or \"Optimized_legacy\".\n\
This option affects the way the values of the following Michelson types \
are represented:\n\
- timestamp: the Readable representation is a RFC3339 string, the \
Optimized and Optimized_legacy representations are the number of \
seconds since Epoch\n\
- key, signature, key_hash, address, contract, chain_id: the Readable \
representation is a Base58Check string, the Optimized and \
Optimized_legacy representations are byte sequences\n\
- nested pairs: in Readable mode, the Pair constructor is used even \
with arity bigger than 2 such as in Pair 0 1 2; in Optimized_legacy \
mode, the Pair constructor is always use with arity 2 such as in Pair 0 \
(Pair 1 2); in Optimized mode, a sequence is used if there are at least \
4 elements and the behavior is the same as in Optimized_legacy mode \
otherwise.\n"~defaultunparsing_mode_parameterletenforce_indentation_flag=Tezos_clic.switch~long:"enforce-indentation"~doc:"Check that the Micheline expression passed to this command is \
well-indented."()letdisplay_names_flag=Tezos_clic.switch~long:"display-names"~doc:"Print names of scripts passed to this command"()moduleDaemon=structletbaking_switch=Tezos_clic.switch~long:"baking"~short:'B'~doc:"run the baking daemon"()letendorsement_switch=Tezos_clic.switch~long:"endorsement"~short:'E'~doc:"run the endorsement daemon"()letdenunciation_switch=Tezos_clic.switch~long:"denunciation"~short:'D'~doc:"run the denunciation daemon"()endmoduleTx_rollup=structlettx_rollup_address_parameter=Tezos_clic.parameter(fun_s->matchTx_rollup.of_b58check_optswith|Somec->returnc|None->failwith"Parameter '%s' is an invalid transaction rollup address encoded \
in a base58 string."s)lettx_rollup_address_param?(name="transaction rollup address")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[Transaction rollup address encoded in a base58 \
string.@]@]"usage)tx_rollup_address_parameternextletlevel_parameter=Tezos_clic.parameter(fun_s->matchInt32.of_string_optswith|Someiwheni>=0l->Lwt.return@@Environment.wrap_tzresult(Tx_rollup_level.of_int32i)|_->failwith"'%s' is not a valid transaction rollup level (should be a non \
negative int32 value)"s)letlevel_param?(name="tx rollup level")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[Transaction rollup level encoded in a non negative \
int32.@]@]"usage)level_parameternextletcontext_hash_parameter=Tezos_clic.parameter(fun_s->matchContext_hash.of_b58check_optswith|Somehash->returnhash|None->failwith"%s is not a valid notation for a context hash encoded in a \
base58 string"s)letcontext_hash_param?(name="context hash")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[Context hash encoded in a base58 string.@]@]"usage)context_hash_parameternextletmessage_result_path_parameter=Tezos_clic.map_parameter~f:(funjson->tryData_encoding.Json.destructTx_rollup_commitment.Merkle.path_encodingjsonwithData_encoding.Json.Cannot_destruct(_path,exn)->Stdlib.failwith(Format.asprintf"Invalid JSON for a message result path: %a"(funppf->Data_encoding.Json.print_errorppf)exn))json_parameterletmessage_result_path_param?(name="message result path")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[Merkle path (JSON encoded) for a message result hash \
in a commitment.\n\
The JSON should be a list of base58-encoded message result \
hashes.@]@]"usage)message_result_path_parameternextlettickets_dispatch_info_parameter=Tezos_clic.map_parameter~f:(funjson->tryData_encoding.Json.destructTx_rollup_reveal.encodingjsonwithData_encoding.Json.Cannot_destruct(_path,exn)->Stdlib.failwith(Format.asprintf"Invalid JSON for tickets dispatch info: %a"(funppf->Data_encoding.Json.print_errorppf)exn))json_parameterlettickets_dispatch_info_param?(name="tickets information")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[Tickets related information are encoded in a JSON with \
the following format: {\"contents\": <tickets content>,\"ty\": \
<tickets type>, \"ticketer\": <ticketer contract address>, \
\"amount\": <withdrawn amount>, \"\"claimer\": <new owner's public \
key hash>}@]@]"usage)tickets_dispatch_info_parameternextletmessage_result_hash_parameter=Tezos_clic.parameter(fun_s->matchTx_rollup_message_result_hash.of_b58check_optswith|Somehash->returnhash|None->failwith"%s is not a valid notation for a withdraw list hash"s)letmessage_result_hash_param?(name="message result hash")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[Message result hash encoded in a base58 string.@]@]"usage)message_result_hash_parameternextletwithdraw_list_hash_parameter=Tezos_clic.parameter(fun_s->matchTx_rollup_withdraw_list_hash.of_b58check_optswith|Somehash->returnhash|None->failwith"%s is not a valid notation for a withdraw list hash"s)letwithdraw_list_hash_param?(name="withdraw list hash")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[Withdraw list hash encoded in a base58 string.@]@]"usage)withdraw_list_hash_parameternextletcommitment_hash_parameter=Tezos_clic.parameter(fun_s->matchTx_rollup_commitment_hash.of_b58check_optswith|Somehash->returnhash|None->failwith"%s is not a valid notation for a commitment hash"s)letcommitment_hash_param?(name="commitment hash")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[Commitment hash encoded in a base58 string.@]@]"usage)commitment_hash_parameternextletcommitment_hash_arg?(long="commitment-hash")?(placeholder="commitment hash")~usage()=Tezos_clic.arg~long~doc:(Format.sprintf"@[@[%s@]@.@[Commitment hash encoded in a base58 string.@]@]"usage)~placeholdercommitment_hash_parameterletmessage_parameter=Tezos_clic.map_parameter~f:(funjson->tryData_encoding.Json.destructTx_rollup_message.encodingjsonwithData_encoding.Json.Cannot_destruct(_path,exn)->Stdlib.failwith(Format.asprintf"Invalid json for a message: %a"(funppf->Data_encoding.Json.print_errorppf)exn))json_parameterletmessage_param?(name="message")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[Message are encoded in a JSON with one of the \
following format: {\"batch\": bytes} or {\"deposit\": {\"sender\": \
<depositer public key hash>; \"destination\": <layer 2 destination \
(address or index)>;\"ticket_hash\": <hash of the tickets> \
;\"amount\": <deposited amount> }}.@]@]"usage)message_parameternextletmessage_path_parameter=Tezos_clic.map_parameter~f:(funjson->tryData_encoding.Json.destructTx_rollup_inbox.Merkle.path_encodingjsonwithData_encoding.Json.Cannot_destruct(_path,exn)->Stdlib.failwith(Format.asprintf"Invalid json for a message path: %a"(funppf->Data_encoding.Json.print_errorppf)exn))json_parameterletmessage_path_param?(name="message path")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[\n\
Merkle path (JSON encoded) for a message in an inbox. The JSON \
should be a list of base58-encoded message hashes.@]@]"usage)message_path_parameternextletproof_parameter=Tezos_clic.map_parameter~f:(funjson->tryData_encoding.Json.destructTx_rollup_l2_proof.encodingjsonwithData_encoding.Json.Cannot_destruct(_path,exn)->Stdlib.failwith(Format.asprintf"Invalid json for a tx_rollup proof: %a"(funppf->Data_encoding.Json.print_errorppf)exn))json_parameterletproof_param?(name="rejection proof")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[Rejection proof are stream encoded in a JSON. See \
documentation of transaction rollup for more information.@]@]"usage)proof_parameternextletinbox_root_hash_parameter=Tezos_clic.parameter(fun_s->matchTx_rollup_inbox.Merkle.root_of_b58check_optswith|Somehash->returnhash|None->failwith"%s is not a valid B58-encoded notation for an inbox merkle root"s)letinbox_root_hash_param?(name="inbox root hash")~usagenext=Tezos_clic.param~name~desc:(Format.sprintf"@[@[%s@]@.@[Root's hash of a merkelized inbox list, encoded in a \
base58 string.@]@]"usage)inbox_root_hash_parameternextendmoduleSc_rollup_params=structletsc_rollup_address_parameter=Tezos_clic.parameter(fun_s->matchAlpha_context.Sc_rollup.Address.of_b58check_optswith|Somec->returnc|None->failwith"Parameter '%s' is an invalid smart contract rollup address \
encoded in a base58 string."s)letrollup_kind_parameter=Tezos_clic.parameter(fun_name->matchSc_rollup.Kind.pvm_of_name~namewith|None->failwith"Parameter '%s' is not a valid rollup name (must be one of %s)"name(String.concat", "Sc_rollup.Kind.all_names)|Somek->returnk)letboot_sector_parameter=letfrom_texts=return(fun(moduleR:Sc_rollup.PVM.S)->R.parse_boot_sectors|>function|None->failwith"Invalid boot sector"|Someboot_sector->returnboot_sector)infile_or_text_parameter~from_text()letmessages_parameter=letopenLwt_result_syntaxinletfrom_jsontext=tryreturn(`Json(Ezjsonm.from_stringtext))withEzjsonm.Parse_error_->failwith"Given text is not valid JSON: '%s'"textinletfrom_bin_file(cctxt:#Client_context.full)path=let*bin=cctxt#read_filepathinreturn(`Binbin)inletfrom_json_file(cctxt:#Client_context.full)path=let*json_string=cctxt#read_filepathinfrom_jsonjson_stringinTezos_clic.parameter(fun(cctxt:#Client_context.full)p->Client_aliases.parse_alternatives[("text",from_json);("file",from_json_filecctxt);("bin",from_bin_filecctxt);]p)letcommitment_hash_parameter=Tezos_clic.parameter(fun_commitment_hash->matchSc_rollup.Commitment.Hash.of_b58check_optcommitment_hashwith|None->failwith"Parameter '%s' is not a valid B58-encoded rollup commitment hash"commitment_hash|Somehash->returnhash)letunchecked_payload_parameter=file_or_text_parameter~from_text:return()letcompressed_state_parameter=Tezos_clic.parameter(fun_state_hash->matchSc_rollup.State_hash.of_b58check_optstate_hashwith|None->failwith"Parameter '%s' is not a valid B58-encoded compressed state"state_hash|Somehash->returnhash)letnumber_of_ticks_parameter=Tezos_clic.parameter(fun_nb_of_ticks->matchInt64.of_string_optnb_of_tickswith|Somenb_of_ticks->(matchSc_rollup.Number_of_ticks.of_valuenb_of_tickswith|None->failwith"Parameter '%Ld' is out of bounds, it should be between %Ld \
and %Ld"nb_of_ticksSc_rollup.Number_of_ticks.min_valueSc_rollup.Number_of_ticks.max_value|Somenb_of_ticks->returnnb_of_ticks)|None->failwith"'%s' is not valid, should be a int64 value"nb_of_ticks)endletfee_parameter_args=letopenTezos_clicinletforce_low_fee_arg=switch~long:"force-low-fee"~doc:"Don't check that the fee is lower than the estimated default value"()inletfee_cap_arg=default_arg~long:"fee-cap"~placeholder:"amount"~default:"1.0"~doc:"Set the fee cap"(parameter(fun_s->matchTez.of_stringswith|Somet->returnt|None->failwith"Bad fee cap"))inletburn_cap_arg=default_arg~long:"burn-cap"~placeholder:"amount"~default:"0"~doc:"Set the burn cap"(parameter(fun_s->matchTez.of_stringswith|Somet->returnt|None->failwith"Bad burn cap"))inmap_arg~f:(fun_cctxt(minimal_fees,minimal_nanotez_per_byte,minimal_nanotez_per_gas_unit,force_low_fee,fee_cap,burn_cap)->return{Injection.minimal_fees;minimal_nanotez_per_byte;minimal_nanotez_per_gas_unit;force_low_fee;fee_cap;burn_cap;})(aggregate(args6minimal_fees_argminimal_nanotez_per_byte_argminimal_nanotez_per_gas_unit_argforce_low_fee_argfee_cap_argburn_cap_arg))