javabitcoinj

Bitcoinj getting estimate balance of wallet


Simple question, i am simply trying to get the estimated balance.

When i send money id like to get the estimated balance while that transaction is pending. NOT BALANCE but ESTIMATED BALANCE. Please check link below.

https://bitcoinj.github.io/javadoc/0.14/org/bitcoinj/wallet/Wallet.BalanceType.html

I read this page, but im having trouble trying to understand how i have to type this out.

This is my current method.

public static String gbal() {
        if(MainPage.ModeStatus == true){
            String[] bal = kit.wallet().getBalance().toFriendlyString().split(" BTC");
            return bal[0];
        }else{
            return "1";
        }
    }

Solution

  • BalanceType.ESTIMATED
    

    Simple as that.