Add BTC.getWalletBalance(xprv) and add API call to access that.

Also improved BTC.WalletAwareUTXOProvider to derive more keys itself
instead of throwing and relying on caller to do the work.
Added benefit of cleaning up caller code and being more efficient.
Needed because not all receiving/change addresses were being picked up.
This commit is contained in:
catbref
2020-08-04 16:37:44 +01:00
parent 91518464c2
commit cd07240ce7
3 changed files with 159 additions and 80 deletions

View File

@@ -73,4 +73,17 @@ public class BtcTests extends Common {
btc.buildSpend(xprv58, recipient, amount);
}
@Test
public void testGetWalletBalance() {
BTC btc = BTC.getInstance();
String xprv58 = "tprv8ZgxMBicQKsPdahhFSrCdvC1bsWyzHHZfTneTVqUXN6s1wEtZLwAkZXzFP6TYLg2aQMecZLXLre5bTVGajEB55L1HYJcawpdFG66STVAWPJ";
Long balance = btc.getWalletBalance(xprv58);
assertNotNull(balance);
System.out.println(BTC.format(balance));
}
}