1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798(*****************************************************************************)(* *)(* 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. *)(* *)(*****************************************************************************)openProtocolopenAlpha_contextopenClient_proto_contractsletgroup={Tezos_clic.name="contracts";title="Commands for managing the record of known contracts";}letcommands()=letopenTezos_clicin[command~group~desc:"Add a contract to the wallet."(args1(Raw_contract_alias.force_switch()))(prefixes["remember";"contract"]@@Raw_contract_alias.fresh_alias_param@@Raw_contract_alias.source_param@@stop)(funforcenamehashcctxt->letopenLwt_result_syntaxinlet*name=Raw_contract_alias.of_freshcctxtforcenameinRaw_contract_alias.add~forcecctxtnamehash);command~group~desc:"Remove a contract from the wallet."no_options(prefixes["forget";"contract"]@@Raw_contract_alias.alias_param@@stop)(fun()(name,_)cctxt->Raw_contract_alias.delcctxtname);command~group~desc:"Lists all known contracts in the wallet."no_options(fixed["list";"known";"contracts"])(fun()(cctxt:Protocol_client_context.full)->letopenLwt_result_syntaxinlet*contracts=list_contractscctxtinlet*!()=List.iter_s(fun(prefix,alias,contract)->cctxt#message"%s%s: %s"prefixalias(Contract.to_b58checkcontract))contractsinreturn_unit);command~group~desc:"Forget the entire wallet of known contracts."(args1(Raw_contract_alias.force_switch()))(fixed["forget";"all";"contracts"])(funforcecctxt->letopenLwt_result_syntaxinlet*()=fail_unlessforce(error_of_fmt"this can only used with option -force")inRaw_contract_alias.setcctxt[]);command~group~desc:"Display a contract from the wallet."no_options(prefixes["show";"known";"contract"]@@Raw_contract_alias.alias_param@@stop)(fun()(_,contract)(cctxt:Protocol_client_context.full)->letopenLwt_result_syntaxinlet*!()=cctxt#message"%a\n%!"Contract.ppcontractinreturn_unit);]