Browse Source

add memo as hex and str to z_listreceivedaddress

pull/149/head
DenioD 4 years ago
parent
commit
84eb65c7bb
  1. 11
      src/wallet/rpchushwallet.cpp
  2. 2
      src/wallet/rpcwallet.cpp

11
src/wallet/rpchushwallet.cpp

@ -202,8 +202,19 @@ void zsTxReceivedToJSON(const CWalletTx& wtx, UniValue& received, CAmount& total
if (pt) {
auto note = pt.get();
auto pt_unwrapped = pt.get();
auto memo = pt_unwrapped.memo();
obj.push_back(Pair("address",EncodePaymentAddress(addr)));
obj.push_back(Pair("amount", ValueFromAmount(CAmount(note.value()))));
obj.push_back(Pair("memo", HexStr(memo)));
if (memo[0] <= 0xf4) {
auto end = std::find_if(memo.rbegin(), memo.rend(), [](unsigned char v) { return v != 0; });
std::string memoStr(memo.begin(), end.base());
if (utf8::is_valid(memoStr)) {
obj.push_back(Pair("memoStr", memoStr));
}
}
obj.push_back(Pair("shieldedOutputIndex",i));
//Check Change Status

2
src/wallet/rpcwallet.cpp

@ -3401,6 +3401,8 @@ UniValue z_listreceivedaddress(const UniValue& params, bool fHelp,const CPubKey&
" \"saplingReceived\": [{ An Array of utxos/notes received for sapling addresses\n"
" \"address\": \"zeroaddress\", (string) Shielded address (z-address)\n"
" \"amount\": x.xxxx, (numeric) Value of output being received " + CURRENCY_UNIT + ", positive for receives\n"
" \"memo\": xxxxx, (string) hexademical string representation of memo field\n"
" \"memoStr\" : \"memo\", (string) Only returned if memo contains valid UTF-8 text.\n"
" \"sheildedOutputIndex\": n, (numeric) The index of the ShieledOutput\n"
" \"change\": true/false (string) The note is change. This can result from sending funds\n"
" to the same address they came from, or incomplete useage\n"

Loading…
Cancel
Save