@@ -609,7 +609,7 @@ static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
609
609
return NullUniValue;
610
610
}
611
611
612
- if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 )
612
+ if (request.fHelp || request.params .size () < 1 || request.params .size () > 3 )
613
613
throw std::runtime_error (
614
614
" getreceivedbyaddress \" address\" ( minconf )\n "
615
615
" \n Returns the total amount received by the given address in transactions with at least minconf confirmations.\n "
@@ -692,7 +692,7 @@ static UniValue getreceivedbylabel(const JSONRPCRequest& request)
692
692
return NullUniValue;
693
693
}
694
694
695
- if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 )
695
+ if (request.fHelp || request.params .size () < 1 || request.params .size () > 3 )
696
696
throw std::runtime_error (
697
697
" getreceivedbylabel \" label\" ( minconf )\n "
698
698
" \n Returns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.\n "
@@ -1285,7 +1285,7 @@ static UniValue ListReceived(CWallet * const pwallet, const UniValue& params, bo
1285
1285
1286
1286
bool has_filtered_address = false ;
1287
1287
CTxDestination filtered_address = CNoDestination ();
1288
- if (!by_label && params. size () > 3 && params[3 ].get_str () != " " ) {
1288
+ if (!by_label && params[ 3 ]. isStr () && params[3 ].get_str () != " " ) {
1289
1289
if (!IsValidDestinationString (params[3 ].get_str ())) {
1290
1290
throw JSONRPCError (RPC_WALLET_ERROR, " address_filter parameter was invalid" );
1291
1291
}
@@ -1395,7 +1395,7 @@ static UniValue ListReceived(CWallet * const pwallet, const UniValue& params, bo
1395
1395
if (fIsWatchonly )
1396
1396
obj.pushKV (" involvesWatchonly" , true );
1397
1397
obj.pushKV (" address" , EncodeDestination (address));
1398
- obj.pushKV (" amount" , AmountMapToUniv (mapAmount, " " ));
1398
+ obj.pushKV (" amount" , AmountMapToUniv (mapAmount, strasset ));
1399
1399
obj.pushKV (" confirmations" , (nConf == std::numeric_limits<int >::max () ? 0 : nConf));
1400
1400
obj.pushKV (" label" , label);
1401
1401
UniValue transactions (UniValue::VARR);
@@ -1894,13 +1894,14 @@ static UniValue gettransaction(const JSONRPCRequest& request)
1894
1894
return NullUniValue;
1895
1895
}
1896
1896
1897
- if (request.fHelp || request.params .size () < 1 || request.params .size () > 2 )
1897
+ if (request.fHelp || request.params .size () < 1 || request.params .size () > 3 )
1898
1898
throw std::runtime_error (
1899
1899
" gettransaction \" txid\" ( include_watchonly )\n "
1900
1900
" \n Get detailed information about in-wallet transaction <txid>\n "
1901
1901
" \n Arguments:\n "
1902
1902
" 1. \" txid\" (string, required) The transaction id\n "
1903
1903
" 2. \" include_watchonly\" (bool, optional, default=false) Whether to include watch-only addresses in balance calculation and details[]\n "
1904
+ " 3. \" assetlabel\" (string, optional) Hex asset id or asset label for balance.\n "
1904
1905
" \n Result:\n "
1905
1906
" {\n "
1906
1907
" \" amount\" : x.xxx, (numeric) The transaction amount in " + CURRENCY_UNIT + " \n "
@@ -1952,6 +1953,11 @@ static UniValue gettransaction(const JSONRPCRequest& request)
1952
1953
if (request.params [1 ].get_bool ())
1953
1954
filter = filter | ISMINE_WATCH_ONLY;
1954
1955
1956
+ std::string asset = " " ;
1957
+ if (request.params [2 ].isStr () && !request.params [2 ].get_str ().empty ()) {
1958
+ asset = request.params [2 ].get_str ();
1959
+ }
1960
+
1955
1961
UniValue entry (UniValue::VOBJ);
1956
1962
auto it = pwallet->mapWallet .find (hash);
1957
1963
if (it == pwallet->mapWallet .end ()) {
@@ -1973,7 +1979,7 @@ static UniValue gettransaction(const JSONRPCRequest& request)
1973
1979
nFee[::policyAsset] = wtx.IsFromMe (filter) ? total_out - nDebit[::policyAsset] : 0 ;
1974
1980
}
1975
1981
1976
- entry.pushKV (" amount" , AmountMapToUniv (nNet - nFee, " " ));
1982
+ entry.pushKV (" amount" , AmountMapToUniv (nNet - nFee, asset ));
1977
1983
if (wtx.IsFromMe (filter))
1978
1984
entry.pushKV (" fee" , AmountMapToUniv (nFee, " " ));
1979
1985
@@ -6251,12 +6257,12 @@ static const CRPCCommand commands[] =
6251
6257
{ " wallet" , " encryptwallet" , &encryptwallet, {" passphrase" } },
6252
6258
{ " wallet" , " getaddressesbylabel" , &getaddressesbylabel, {" label" } },
6253
6259
{ " wallet" , " getaddressinfo" , &getaddressinfo, {" address" } },
6254
- { " wallet" , " getbalance" , &getbalance, {" dummy" ," minconf" ," include_watchonly" } },
6260
+ { " wallet" , " getbalance" , &getbalance, {" dummy" ," minconf" ," include_watchonly" , " assetlabel " } },
6255
6261
{ " wallet" , " getnewaddress" , &getnewaddress, {" label" ," address_type" } },
6256
6262
{ " wallet" , " getrawchangeaddress" , &getrawchangeaddress, {" address_type" } },
6257
- { " wallet" , " getreceivedbyaddress" , &getreceivedbyaddress, {" address" ," minconf" } },
6258
- { " wallet" , " getreceivedbylabel" , &getreceivedbylabel, {" label" ," minconf" } },
6259
- { " wallet" , " gettransaction" , &gettransaction, {" txid" ," include_watchonly" } },
6263
+ { " wallet" , " getreceivedbyaddress" , &getreceivedbyaddress, {" address" ," minconf" , " assetlabel " } },
6264
+ { " wallet" , " getreceivedbylabel" , &getreceivedbylabel, {" label" ," minconf" , " assetlabel " } },
6265
+ { " wallet" , " gettransaction" , &gettransaction, {" txid" ," include_watchonly" , " assetlabel " } },
6260
6266
{ " wallet" , " getunconfirmedbalance" , &getunconfirmedbalance, {} },
6261
6267
{ " wallet" , " getwalletinfo" , &getwalletinfo, {} },
6262
6268
{ " wallet" , " importaddress" , &importaddress, {" address" ," label" ," rescan" ," p2sh" } },
@@ -6269,7 +6275,7 @@ static const CRPCCommand commands[] =
6269
6275
{ " wallet" , " listaddressgroupings" , &listaddressgroupings, {} },
6270
6276
{ " wallet" , " listlabels" , &listlabels, {" purpose" } },
6271
6277
{ " wallet" , " listlockunspent" , &listlockunspent, {} },
6272
- { " wallet" , " listreceivedbyaddress" , &listreceivedbyaddress, {" minconf" ," include_empty" ," include_watchonly" ," address_filter" } },
6278
+ { " wallet" , " listreceivedbyaddress" , &listreceivedbyaddress, {" minconf" ," include_empty" ," include_watchonly" ," address_filter" , " assetlabel " } },
6273
6279
{ " wallet" , " listreceivedbylabel" , &listreceivedbylabel, {" minconf" ," include_empty" ," include_watchonly" } },
6274
6280
{ " wallet" , " listsinceblock" , &listsinceblock, {" blockhash" ," target_confirmations" ," include_watchonly" ," include_removed" } },
6275
6281
{ " wallet" , " listtransactions" , &listtransactions, {" dummy" ," count" ," skip" ," include_watchonly" } },
0 commit comments