| 1142 | } |
| 1143 | |
| 1144 | extern Value getdexoperatorbyowner(const Array& params, bool fHelp) { |
| 1145 | if (fHelp || params.size() != 1) { |
| 1146 | throw runtime_error( |
| 1147 | "getdexoperatorbyowner owner_addr\n" |
| 1148 | "\nget dex operator by dex operator owner.\n" |
| 1149 | "\nArguments:\n" |
| 1150 | "1.\"owner_addr\": (string, required) owner address\n" |
| 1151 | "\nResult: dex_operator detail\n" |
| 1152 | "\nExamples:\n" |
| 1153 | + HelpExampleCli("getdexoperatorbyowner", "10-1") |
| 1154 | + "\nAs json rpc call\n" |
| 1155 | + HelpExampleRpc("getdexoperatorbyowner", "10-1") |
| 1156 | ); |
| 1157 | } |
| 1158 | |
| 1159 | const CUserID &userId = RPC_PARAM::GetUserId(params[0]); |
| 1160 | |
| 1161 | CAccount account = RPC_PARAM::GetUserAccount(*pCdMan->pAccountCache, userId); |
| 1162 | if (!account.IsRegistered()) |
| 1163 | throw JSONRPCError(RPC_INVALID_PARAMS, strprintf("account not registered! uid=%s", userId.ToDebugString())); |
| 1164 | |
| 1165 | DexOperatorDetail dexOperator; |
| 1166 | uint32_t dexOrderId = 0; |
| 1167 | if (!pCdMan->pDexCache->GetDexOperatorByOwner(account.regid, dexOrderId, dexOperator)) |
| 1168 | throw JSONRPCError(RPC_INVALID_PARAMS, strprintf("the owner account dos not have a dex operator! uid=%s", userId.ToDebugString())); |
| 1169 | |
| 1170 | Object obj = DexOperatorToJson(*pCdMan->pAccountCache, dexOperator); |
| 1171 | obj.insert(obj.begin(), Pair("id", (uint64_t)dexOrderId)); |
| 1172 | return obj; |
| 1173 | } |
| 1174 | |
| 1175 | extern Value getdexorderfee(const Array& params, bool fHelp) { |
| 1176 | if (fHelp || params.size() < 2 || params.size() > 3) { |
nothing calls this directly
no test coverage detected