WalletPocketHD extends AbstractWallet { @Override public Address getReceiveAddress() { return currentAddress(RECEIVE_FUNDS); } WalletPocketHD(DeterministicKey rootKey, CoinType coinType,
                          @Nullable KeyCrypter keyCrypter, @Nullable KeyParameter key);   WalletPocketHD(SimpleHDKeyChain keys, CoinType coinType);   WalletPocketHD(String id, SimpleHDKeyChain keys, CoinType coinType); int getAccountIndex(); @Override boolean isEquals(WalletAccount other); @Override boolean isEncryptable(); @Override boolean isEncrypted(); @Nullable @Override KeyCrypter getKeyCrypter(); @Override void encrypt(KeyCrypter keyCrypter, KeyParameter aesKey); @Override void decrypt(KeyParameter aesKey); SendRequest sendCoinsOffline(Address address, Coin amount); SendRequest sendCoinsOffline(Address address, Coin amount, @Nullable String password); SendRequest sendCoinsOffline(Address address, Coin amount, @Nullable KeyParameter aesKey); @Override boolean isAddressMine(Address address); @Override boolean isPubKeyHashMine(byte[] pubkeyHash); @Override boolean isWatchedScript(Script script); @Override boolean isPubKeyMine(byte[] pubkey); @Override boolean isPayToScriptHashMine(byte[] payToScriptHash); void completeAndSignTx(SendRequest request); void completeTx(SendRequest req); void signTransaction(SendRequest req); @Nullable @Override ECKey findKeyFromPubHash(byte[] pubkeyHash); @Nullable @Override ECKey findKeyFromPubKey(byte[] pubkey); @Nullable @Override RedeemData findRedeemDataFromScriptHash(byte[] bytes); @Override Address getChangeAddress(); @Override Address getReceiveAddress(); @Override Address getRefundAddress(); Address getReceiveAddress(boolean isManualAddressManagement); Address getRefundAddress(boolean isManualAddressManagement); @Nullable Address getLastUsedAddress(SimpleHDKeyChain.KeyPurpose purpose); boolean canCreateFreshReceiveAddress(); Address getFreshReceiveAddress(); Address getFreshReceiveAddress(boolean isManualAddressManagement); int getNumberIssuedReceiveAddresses(); List<Address> getIssuedReceiveAddresses(); Set<Address> getUsedAddresses(); Address getAddress(SimpleHDKeyChain.KeyPurpose purpose,
                              boolean isManualAddressManagement); List<Address> getActiveAddresses(); void markAddressAsUsed(Address address); @Override String toString();  }
@Test public void testSendingAndBalances() throws Exception { DeterministicHierarchy h = new DeterministicHierarchy(masterKey); WalletPocketHD account1 = new WalletPocketHD(h.get(BTC.getBip44Path(0), false, true), BTC, null, null); WalletPocketHD account2 = new WalletPocketHD(h.get(BTC.getBip44Path(1), false, true), BTC, null, null); WalletPocketHD account3 = new WalletPocketHD(h.get(BTC.getBip44Path(2), false, true), BTC, null, null); Transaction tx = new Transaction(BTC); tx.addOutput(BTC.oneCoin().toCoin(), account1.getReceiveAddress()); account1.addNewTransactionIfNeeded(tx); assertEquals(BTC.value("1"), account1.getBalance()); assertEquals(BTC.value("0"), account2.getBalance()); assertEquals(BTC.value("0"), account3.getBalance()); send(Coin.CENT.multiply(5), account1, account2); assertEquals(BTC.value("0.95"), account1.getBalance()); assertEquals(BTC.value("0.05"), account2.getBalance()); assertEquals(BTC.value("0"), account3.getBalance()); send(Coin.CENT.multiply(7), account1, account3); assertEquals(BTC.value("0.88"), account1.getBalance()); assertEquals(BTC.value("0.05"), account2.getBalance()); assertEquals(BTC.value("0.07"), account3.getBalance()); send(Coin.CENT.multiply(3), account2, account3); assertEquals(BTC.value("0.88"), account1.getBalance()); assertEquals(BTC.value("0.02"), account2.getBalance()); assertEquals(BTC.value("0.1"), account3.getBalance()); }