MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / getdexoperatorbyowner

Function getdexoperatorbyowner

src/rpc/rpcdex.cpp:1144–1173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1142}
1143
1144extern 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
1175extern Value getdexorderfee(const Array& params, bool fHelp) {
1176 if (fHelp || params.size() < 2 || params.size() > 3) {

Callers

nothing calls this directly

Calls 11

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
JSONRPCErrorFunction · 0.85
DexOperatorToJsonFunction · 0.85
PairClass · 0.85
IsRegisteredMethod · 0.80
ToDebugStringMethod · 0.80
GetDexOperatorByOwnerMethod · 0.80
sizeMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected