| 787 | } |
| 788 | |
| 789 | Value getcontractinfo(const Array& params, bool fHelp) { |
| 790 | if (fHelp || params.size() != 1) |
| 791 | throw runtime_error( |
| 792 | "getcontractinfo \"contract regid\"\n" |
| 793 | "\nget contract information.\n" |
| 794 | "\nArguments:\n" |
| 795 | "1. \"contract regid\" (string, required) the contract regid.\n" |
| 796 | "\nReturn an object contains contract information\n" |
| 797 | "\nExamples:\n" + |
| 798 | HelpExampleCli("getcontractinfo", "1-1") + "\nAs json rpc call\n" + |
| 799 | HelpExampleRpc("getcontractinfo", "1-1")); |
| 800 | |
| 801 | CRegID regid(params[0].get_str()); |
| 802 | if (regid.IsEmpty() || !pCdMan->pContractCache->HasContract(regid)) { |
| 803 | throw JSONRPCError(RPC_INVALID_PARAMS, "Invalid contract regid."); |
| 804 | } |
| 805 | |
| 806 | CUniversalContractStore contractStore; |
| 807 | if (!pCdMan->pContractCache->GetContract(regid, contractStore)) { |
| 808 | throw JSONRPCError(RPC_DATABASE_ERROR, "Failed to acquire contract from db."); |
| 809 | } |
| 810 | |
| 811 | Object obj = contractStore.ToJson(); |
| 812 | obj.insert(obj.begin(), Pair("contract_regid", regid.ToString())); |
| 813 | |
| 814 | return obj; |
| 815 | } |
| 816 | |
| 817 | Value listtxcache(const Array& params, bool fHelp) { |
| 818 | if (fHelp || params.size() != 0) { |
nothing calls this directly
no test coverage detected