Skip to content

Commit ae841ed

Browse files
random-zebraFuzzbawls
authored andcommitted
[RPC] use json object as output of mintzerocoin
txid and time fields can be grouped outside of the mints list as it is the same transaction. Github-Pull: #1218 Rebased-From: f80b5e9
1 parent 5539b01 commit ae841ed

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3354,17 +3354,20 @@ UniValue mintzerocoin(const UniValue& params, bool fHelp)
33543354
" ]\n"
33553355

33563356
"\nResult:\n"
3357-
"[\n"
3358-
" {\n"
3359-
" \"txid\": \"xxx\", (string) Transaction ID.\n"
3360-
" \"value\": amount, (numeric) Minted amount.\n"
3361-
" \"pubcoin\": \"xxx\", (string) Pubcoin in hex format.\n"
3362-
" \"randomness\": \"xxx\", (string) Hex encoded randomness.\n"
3363-
" \"serial\": \"xxx\", (string) Serial in hex format.\n"
3364-
" \"time\": nnn (numeric) Time to mint this transaction.\n"
3365-
" }\n"
3366-
" ,...\n"
3367-
"]\n"
3357+
"{\n"
3358+
" \"txid\": \"xxx\", (string) Transaction ID.\n"
3359+
" \"time\": nnn (numeric) Time to mint this transaction.\n"
3360+
" \"mints\":\n"
3361+
" [\n"
3362+
" {\n"
3363+
" \"denomination\": nnn, (numeric) Minted denomination.\n"
3364+
" \"pubcoin\": \"xxx\", (string) Pubcoin in hex format.\n"
3365+
" \"randomness\": \"xxx\", (string) Hex encoded randomness.\n"
3366+
" \"serial\": \"xxx\", (string) Serial in hex format.\n"
3367+
" },\n"
3368+
" ...\n"
3369+
" ]\n"
3370+
"}\n"
33683371

33693372
"\nExamples:\n"
33703373
"\nMint 50 from anywhere\n" +
@@ -3432,20 +3435,22 @@ UniValue mintzerocoin(const UniValue& params, bool fHelp)
34323435
if (strError != "")
34333436
throw JSONRPCError(RPC_WALLET_ERROR, strError);
34343437

3438+
UniValue retObj(UniValue::VOBJ);
3439+
retObj.push_back(Pair("txid", wtx.GetHash().ToString()));
3440+
retObj.push_back(Pair("time", GetTimeMillis() - nTime));
34353441
UniValue arrMints(UniValue::VARR);
34363442
for (CDeterministicMint dMint : vDMints) {
34373443
UniValue m(UniValue::VOBJ);
3438-
m.push_back(Pair("txid", wtx.GetHash().ToString()));
3439-
m.push_back(Pair("value", ValueFromAmount(libzerocoin::ZerocoinDenominationToAmount(dMint.GetDenomination()))));
3444+
m.push_back(Pair("denomination", ValueFromAmount(libzerocoin::ZerocoinDenominationToAmount(dMint.GetDenomination()))));
34403445
m.push_back(Pair("pubcoinhash", dMint.GetPubcoinHash().GetHex()));
34413446
m.push_back(Pair("serialhash", dMint.GetSerialHash().GetHex()));
34423447
m.push_back(Pair("seedhash", dMint.GetSeedHash().GetHex()));
34433448
m.push_back(Pair("count", (int64_t)dMint.GetCount()));
3444-
m.push_back(Pair("time", GetTimeMillis() - nTime));
34453449
arrMints.push_back(m);
34463450
}
3451+
retObj.push_back(Pair("mints", arrMints));
34473452

3448-
return arrMints;
3453+
return retObj;
34493454
}
34503455

34513456
UniValue spendzerocoin(const UniValue& params, bool fHelp)

0 commit comments

Comments
 (0)