use of network.bisq.api.model.WalletAddressList in project bisq-api by mrosseel.
the class BisqProxy method getWalletAddresses.
public WalletAddressList getWalletAddresses(WalletAddressPurpose purpose) {
final Stream<AddressEntry> addressEntryStream;
if (WalletAddressPurpose.SEND_FUNDS.equals(purpose)) {
addressEntryStream = tradeManager.getAddressEntriesForAvailableBalanceStream();
} else if (WalletAddressPurpose.RESERVED_FUNDS.equals(purpose)) {
addressEntryStream = getReservedFundsAddressEntryStream();
} else if (WalletAddressPurpose.LOCKED_FUNDS.equals(purpose)) {
addressEntryStream = getLockedFundsAddressEntryStream();
} else if (WalletAddressPurpose.RECEIVE_FUNDS.equals(purpose)) {
addressEntryStream = btcWalletService.getAvailableAddressEntries().stream();
} else {
addressEntryStream = btcWalletService.getAddressEntryListAsImmutableList().stream();
}
final List<WalletAddress> walletAddresses = addressEntryStream.map(entry -> convertAddressEntryToWalletAddress(entry, btcWalletService)).collect(toList());
final WalletAddressList walletAddressList = new WalletAddressList();
walletAddressList.walletAddresses = walletAddresses;
walletAddressList.total = walletAddresses.size();
return walletAddressList;
}
Aggregations