|
|
@ -1435,11 +1435,13 @@ struct tallyitem |
|
|
|
int nConf; |
|
|
|
vector<uint256> txids; |
|
|
|
bool fIsWatchonly; |
|
|
|
int nHeight; |
|
|
|
tallyitem() |
|
|
|
{ |
|
|
|
nAmount = 0; |
|
|
|
nConf = std::numeric_limits<int>::max(); |
|
|
|
fIsWatchonly = false; |
|
|
|
nHeight = 0; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
@ -1485,6 +1487,7 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts) |
|
|
|
tallyitem& item = mapTally[address]; |
|
|
|
item.nAmount += txout.nValue; // komodo_interest?
|
|
|
|
item.nConf = min(item.nConf, nDepth); |
|
|
|
item.nHeight = mapBlockIndex[wtx.hashBlock]->GetHeight(); |
|
|
|
item.txids.push_back(wtx.GetHash()); |
|
|
|
if (mine & ISMINE_WATCH_ONLY) |
|
|
|
item.fIsWatchonly = true; |
|
|
@ -1504,11 +1507,13 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts) |
|
|
|
CAmount nAmount = 0; |
|
|
|
int nConf = std::numeric_limits<int>::max(); |
|
|
|
bool fIsWatchonly = false; |
|
|
|
int nHeight=0; |
|
|
|
if (it != mapTally.end()) |
|
|
|
{ |
|
|
|
nAmount = (*it).second.nAmount; |
|
|
|
nConf = (*it).second.nConf; |
|
|
|
fIsWatchonly = (*it).second.fIsWatchonly; |
|
|
|
nHeight = (*it).second.nHeight; |
|
|
|
} |
|
|
|
|
|
|
|
if (fByAccounts) |
|
|
@ -1521,12 +1526,14 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts) |
|
|
|
else |
|
|
|
{ |
|
|
|
UniValue obj(UniValue::VOBJ); |
|
|
|
|
|
|
|
if(fIsWatchonly) |
|
|
|
obj.push_back(Pair("involvesWatchonly", true)); |
|
|
|
obj.push_back(Pair("address", EncodeDestination(dest))); |
|
|
|
obj.push_back(Pair("account", strAccount)); |
|
|
|
obj.push_back(Pair("amount", ValueFromAmount(nAmount))); |
|
|
|
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf))); |
|
|
|
obj.push_back(Pair("rawconfirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf))); |
|
|
|
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : komodo_dpowconfs(nHeight, nConf)))); |
|
|
|
UniValue transactions(UniValue::VARR); |
|
|
|
if (it != mapTally.end()) |
|
|
|
{ |
|
|
@ -1546,12 +1553,14 @@ UniValue ListReceived(const UniValue& params, bool fByAccounts) |
|
|
|
{ |
|
|
|
CAmount nAmount = (*it).second.nAmount; |
|
|
|
int nConf = (*it).second.nConf; |
|
|
|
int nHeight = (*it).second.nHeight; |
|
|
|
UniValue obj(UniValue::VOBJ); |
|
|
|
if((*it).second.fIsWatchonly) |
|
|
|
obj.push_back(Pair("involvesWatchonly", true)); |
|
|
|
obj.push_back(Pair("account", (*it).first)); |
|
|
|
obj.push_back(Pair("amount", ValueFromAmount(nAmount))); |
|
|
|
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf))); |
|
|
|
obj.push_back(Pair("rawconfirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf))); |
|
|
|
obj.push_back(Pair("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : komodo_dpowconfs(nHeight, nConf)))); |
|
|
|
ret.push_back(obj); |
|
|
|
} |
|
|
|
} |
|
|
@ -2957,7 +2966,9 @@ UniValue z_listunspent(const UniValue& params, bool fHelp) |
|
|
|
obj.push_back(Pair("txid", entry.jsop.hash.ToString())); |
|
|
|
obj.push_back(Pair("jsindex", (int)entry.jsop.js )); |
|
|
|
obj.push_back(Pair("jsoutindex", (int)entry.jsop.n)); |
|
|
|
obj.push_back(Pair("confirmations", entry.confirmations)); |
|
|
|
int nHeight = mapBlockIndex[entry.jsop.hash]->GetHeight(); |
|
|
|
obj.push_back(Pair("confirmations", komodo_dpowconfs(nHeight, entry.confirmations))); |
|
|
|
obj.push_back(Pair("rawconfirmations", entry.confirmations)); |
|
|
|
bool hasSproutSpendingKey = pwalletMain->HaveSproutSpendingKey(boost::get<libzcash::SproutPaymentAddress>(entry.address)); |
|
|
|
obj.push_back(Pair("spendable", hasSproutSpendingKey)); |
|
|
|
obj.push_back(Pair("address", EncodePaymentAddress(entry.address))); |
|
|
@ -2974,7 +2985,9 @@ UniValue z_listunspent(const UniValue& params, bool fHelp) |
|
|
|
UniValue obj(UniValue::VOBJ); |
|
|
|
obj.push_back(Pair("txid", entry.op.hash.ToString())); |
|
|
|
obj.push_back(Pair("outindex", (int)entry.op.n)); |
|
|
|
obj.push_back(Pair("confirmations", entry.confirmations)); |
|
|
|
int nHeight = mapBlockIndex[entry.op.hash]->GetHeight(); |
|
|
|
obj.push_back(Pair("confirmations", komodo_dpowconfs(nHeight, entry.confirmations))); |
|
|
|
obj.push_back(Pair("rawconfirmations", entry.confirmations)); |
|
|
|
libzcash::SaplingIncomingViewingKey ivk; |
|
|
|
libzcash::SaplingFullViewingKey fvk; |
|
|
|
pwalletMain->GetSaplingIncomingViewingKey(boost::get<libzcash::SaplingPaymentAddress>(entry.address), ivk); |
|
|
|