Line data Source code
1 : // Copyright (c) 2018-2020 The Bitcoin Core developers 2 : // Copyright (c) 2020-2021 The PIVX Core developers 3 : // Distributed under the MIT software license, see the accompanying 4 : // file COPYING or https://www.opensource.org/licenses/mit-license.php. 5 : 6 : #include "interfaces/wallet.h" 7 : #include "wallet.h" 8 : 9 : namespace interfaces { 10 : 11 0 : WalletBalances Wallet::getBalances() { 12 0 : WalletBalances result; 13 0 : CWallet::Balance balance = m_wallet.GetBalance(); 14 0 : result.balance = balance.m_mine_trusted + balance.m_mine_trusted_shield; 15 0 : result.unconfirmed_balance = balance.m_mine_untrusted_pending; 16 0 : result.immature_balance = balance.m_mine_immature; 17 0 : result.have_watch_only = m_wallet.HaveWatchOnly(); 18 0 : if (result.have_watch_only) { 19 0 : result.watch_only_balance = m_wallet.GetWatchOnlyBalance(); 20 0 : result.unconfirmed_watch_only_balance = m_wallet.GetUnconfirmedWatchOnlyBalance(); 21 0 : result.immature_watch_only_balance = m_wallet.GetImmatureWatchOnlyBalance(); 22 : } 23 0 : result.delegate_balance = balance.m_mine_cs_delegated_trusted; 24 0 : if (result.have_coldstaking) { // At the moment, the GUI is not using the cold staked balance. 25 0 : result.coldstaked_balance = m_wallet.GetColdStakingBalance(); 26 : } 27 0 : result.shielded_balance = balance.m_mine_trusted_shield; 28 0 : result.unconfirmed_shielded_balance = balance.m_mine_untrusted_shielded_balance; 29 0 : return result; 30 : } 31 : 32 : } // namespace interfaces