| 1117 | |
| 1118 | |
| 1119 | extern Value getdexoperator(const Array& params, bool fHelp) { |
| 1120 | if (fHelp || params.size() != 1) { |
| 1121 | throw runtime_error( |
| 1122 | "getdexoperator dex_id\n" |
| 1123 | "\nget dex operator by dex_id.\n" |
| 1124 | "\nArguments:\n" |
| 1125 | "1.\"dex_id\": (numeric, required) dex id\n" |
| 1126 | "\nResult: dex_operator detail\n" |
| 1127 | "\nExamples:\n" |
| 1128 | + HelpExampleCli("getdexoperator", "10") |
| 1129 | + "\nAs json rpc call\n" |
| 1130 | + HelpExampleRpc("getdexoperator", "10") |
| 1131 | ); |
| 1132 | } |
| 1133 | |
| 1134 | uint32_t dexOrderId = params[0].get_int(); |
| 1135 | DexOperatorDetail dexOperator; |
| 1136 | if (!pCdMan->pDexCache->GetDexOperator(dexOrderId, dexOperator)) |
| 1137 | throw JSONRPCError(RPC_INVALID_PARAMS, strprintf("dex operator does not exist! dex_id=%lu", dexOrderId)); |
| 1138 | |
| 1139 | Object obj = DexOperatorToJson(*pCdMan->pAccountCache, dexOperator); |
| 1140 | obj.insert(obj.begin(), Pair("id", (uint64_t)dexOrderId)); |
| 1141 | return obj; |
| 1142 | } |
| 1143 | |
| 1144 | extern Value getdexoperatorbyowner(const Array& params, bool fHelp) { |
| 1145 | if (fHelp || params.size() != 1) { |
nothing calls this directly
no test coverage detected