123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687(*****************************************************************************)(* *)(* 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(RawContractAlias.force_switch()))(prefixes["remember";"contract"]@@RawContractAlias.fresh_alias_param@@RawContractAlias.source_param@@stop)(funforcenamehashcctxt->RawContractAlias.of_freshcctxtforcename>>=?funname->RawContractAlias.add~forcecctxtnamehash);command~group~desc:"Remove a contract from the wallet."no_options(prefixes["forget";"contract"]@@RawContractAlias.alias_param@@stop)(fun()(name,_)cctxt->RawContractAlias.delcctxtname);command~group~desc:"Lists all known contracts in the wallet."no_options(fixed["list";"known";"contracts"])(fun()(cctxt:Alpha_client_context.full)->list_contractscctxt>>=?funcontracts->List.iter_es(fun(prefix,alias,contract)->cctxt#message"%s%s: %s"prefixalias(Contract.to_b58checkcontract)>>=return)contracts);command~group~desc:"Forget the entire wallet of known contracts."(args1(RawContractAlias.force_switch()))(fixed["forget";"all";"contracts"])(funforcecctxt->fail_unlessforce(error_of_fmt"this can only used with option -force")>>=?fun()->RawContractAlias.setcctxt[]);command~group~desc:"Display a contract from the wallet."no_options(prefixes["show";"known";"contract"]@@RawContractAlias.alias_param@@stop)(fun()(_,contract)(cctxt:Alpha_client_context.full)->cctxt#message"%a\n%!"Contract.ppcontract>>=fun()->return_unit);]