RPC call to get unconfirmed balance on a watch only wallet We have a bitcoin core client running on a production machine. This machine cannot have the private key so each address is added as watch only.

So far it has worked perfectly, but recently we need to display the btc amount that is waiting confirmation and the amount that is confirmed (at least 1 confirmation)

bitcoin-rpc getbalance * 0 true
bitcoin-rpc getunconfirmedbalance


these are the two methods that I've found online that should work, but they are not working.

getbalance returns only the confirmed amount and getunconfirmedbalance returns always 0

How can I get the unconfirmed balance on a watch only wallet?
You can use the getbalances command. It will return all of the balances belonging to the wallet, including ones the wallet can sign for, watch only things, trusted (confirmed transactions and unconfirmed change), and immature coinbase outputs.

Here is the help output for it.

getbalances
Returns an object with all balances in BTC.

Result:
{
    "mine": {                        (object) balances from outputs that the wallet can sign
      "trusted": xxx                 (numeric) trusted balance (outputs created by the wallet or confirmed outputs)
      "untrusted_pending": xxx       (numeric) untrusted pending balance (outputs created by others that are in the mempool)
      "immature": xxx                (numeric) balance from immature coinbase outputs
      "used": xxx                    (numeric) (only present if avoid_reuse is set) balance from coins sent to addresses that were previously spent from (potentially privacy violating)
    },
    "watchonly": {                   (object) watchonly balances (not present if wallet does not watch anything)
      "trusted": xxx                 (numeric) trusted balance (outputs created by the wallet or confirmed outputs)
      "untrusted_pending": xxx       (numeric) untrusted pending balance (outputs created by others that are in the mempool)
      "immature": xxx                (numeric) balance from immature coinbase outputs
    },
}