use of bisq.core.payment.PaymentAccount in project bisq-desktop by bisq-network.
the class OfferBookViewModelTest method getOKPayAccount.
private PaymentAccount getOKPayAccount(String currencyCode) {
PaymentAccount paymentAccount = new OKPayAccount();
paymentAccount.setSelectedTradeCurrency(new FiatCurrency(currencyCode));
return paymentAccount;
}
use of bisq.core.payment.PaymentAccount in project bisq-desktop by bisq-network.
the class MainViewModel method onBasicServicesInitialized.
private void onBasicServicesInitialized() {
log.info("onBasicServicesInitialized");
clock.start();
PaymentMethod.onAllServicesInitialized();
// disputeManager
disputeManager.onAllServicesInitialized();
disputeManager.getDisputesAsObservableList().addListener((ListChangeListener<Dispute>) change -> {
change.next();
onDisputesChangeListener(change.getAddedSubList(), change.getRemoved());
});
onDisputesChangeListener(disputeManager.getDisputesAsObservableList(), null);
// tradeManager
tradeManager.onAllServicesInitialized();
tradeManager.getTradableList().addListener((ListChangeListener<Trade>) c -> updateBalance());
tradeManager.getTradableList().addListener((ListChangeListener<Trade>) change -> onTradesChanged());
onTradesChanged();
// We handle the trade period here as we display a global popup if we reached dispute time
tradesAndUIReady = EasyBind.combine(isSplashScreenRemoved, tradeManager.pendingTradesInitializedProperty(), (a, b) -> a && b);
tradesAndUIReady.subscribe((observable, oldValue, newValue) -> {
if (newValue)
applyTradePeriodState();
});
tradeManager.setTakeOfferRequestErrorMessageHandler(errorMessage -> new Popup<>().warning(Res.get("popup.error.takeOfferRequestFailed", errorMessage)).show());
// walletService
btcWalletService.addBalanceListener(new BalanceListener() {
@Override
public void onBalanceChanged(Coin balance, Transaction tx) {
updateBalance();
}
});
openOfferManager.getObservableList().addListener((ListChangeListener<OpenOffer>) c -> updateBalance());
tradeManager.getTradableList().addListener((ListChangeListener<Trade>) c -> updateBalance());
openOfferManager.onAllServicesInitialized();
removeOffersWithoutAccountAgeWitness();
arbitratorManager.onAllServicesInitialized();
alertManager.alertMessageProperty().addListener((observable, oldValue, newValue) -> displayAlertIfPresent(newValue, false));
privateNotificationManager.privateNotificationProperty().addListener((observable, oldValue, newValue) -> displayPrivateNotification(newValue));
displayAlertIfPresent(alertManager.alertMessageProperty().get(), false);
p2PService.onAllServicesInitialized();
feeService.onAllServicesInitialized();
GUIUtil.setFeeService(feeService);
daoManager.onAllServicesInitialized(errorMessage -> new Popup<>().error(errorMessage).show());
tradeStatisticsManager.onAllServicesInitialized();
accountAgeWitnessService.onAllServicesInitialized();
priceFeedService.setCurrencyCodeOnInit();
filterManager.onAllServicesInitialized();
filterManager.addListener(filter -> {
if (filter != null) {
if (filter.getSeedNodes() != null && !filter.getSeedNodes().isEmpty())
new Popup<>().warning(Res.get("popup.warning.nodeBanned", Res.get("popup.warning.seed"))).show();
if (filter.getPriceRelayNodes() != null && !filter.getPriceRelayNodes().isEmpty())
new Popup<>().warning(Res.get("popup.warning.nodeBanned", Res.get("popup.warning.priceRelay"))).show();
}
});
setupBtcNumPeersWatcher();
setupP2PNumPeersWatcher();
updateBalance();
if (DevEnv.isDevMode()) {
preferences.setShowOwnOffersInOfferBook(true);
setupDevDummyPaymentAccounts();
}
fillPriceFeedComboBoxItems();
setupMarketPriceFeed();
swapPendingOfferFundingEntries();
showAppScreen.set(true);
String key = "remindPasswordAndBackup";
user.getPaymentAccountsAsObservable().addListener((SetChangeListener<PaymentAccount>) change -> {
if (!walletsManager.areWalletsEncrypted() && preferences.showAgain(key) && change.wasAdded()) {
new Popup<>().headLine(Res.get("popup.securityRecommendation.headline")).information(Res.get("popup.securityRecommendation.msg")).dontShowAgainId(key).show();
}
});
checkIfOpenOffersMatchTradeProtocolVersion();
if (walletsSetup.downloadPercentageProperty().get() == 1)
checkForLockedUpFunds();
allBasicServicesInitialized = true;
}
use of bisq.core.payment.PaymentAccount in project bisq-desktop by bisq-network.
the class FiatAccountsView method getPaymentMethodForm.
private PaymentMethodForm getPaymentMethodForm(PaymentMethod paymentMethod) {
final PaymentAccount paymentAccount = PaymentAccountFactory.getPaymentAccount(paymentMethod);
paymentAccount.init();
return getPaymentMethodForm(paymentMethod, paymentAccount);
}
use of bisq.core.payment.PaymentAccount in project bisq-desktop by bisq-network.
the class AltCoinAccountsView method buildForm.
// /////////////////////////////////////////////////////////////////////////////////////////
// Base form
// /////////////////////////////////////////////////////////////////////////////////////////
private void buildForm() {
addTitledGroupBg(root, gridRow, 1, Res.get("shared.manageAccounts"));
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, Res.get("account.altcoin.yourAltcoinAccounts"), Layout.FIRST_ROW_DISTANCE);
GridPane.setValignment(tuple.first, VPos.TOP);
// noinspection unchecked
paymentAccountsListView = tuple.second;
paymentAccountsListView.setPrefHeight(2 * Layout.LIST_ROW_HEIGHT + 14);
paymentAccountsListView.setCellFactory(new Callback<ListView<PaymentAccount>, ListCell<PaymentAccount>>() {
@Override
public ListCell<PaymentAccount> call(ListView<PaymentAccount> list) {
return new ListCell<PaymentAccount>() {
final Label label = new AutoTooltipLabel();
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new AutoTooltipButton("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{
label.setLayoutY(5);
removeButton.setId("icon-button");
AnchorPane.setRightAnchor(removeButton, 0d);
}
@Override
public void updateItem(final PaymentAccount item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
label.setText(item.getAccountName());
removeButton.setOnAction(e -> onDeleteAccount(item));
setGraphic(pane);
} else {
setGraphic(null);
}
}
};
}
});
Tuple3<Button, Button, Button> tuple3 = add3ButtonsAfterGroup(root, ++gridRow, Res.get("shared.addNewAccount"), Res.get("shared.ExportAccounts"), Res.get("shared.importAccounts"));
addAccountButton = tuple3.first;
exportButton = tuple3.second;
importButton = tuple3.third;
}
use of bisq.core.payment.PaymentAccount in project bisq-desktop by bisq-network.
the class AltCoinAccountsView method onSaveNewAccount.
// /////////////////////////////////////////////////////////////////////////////////////////
// UI actions
// /////////////////////////////////////////////////////////////////////////////////////////
private void onSaveNewAccount(PaymentAccount paymentAccount) {
TradeCurrency selectedTradeCurrency = paymentAccount.getSelectedTradeCurrency();
if (selectedTradeCurrency != null) {
String code = selectedTradeCurrency.getCode();
if (selectedTradeCurrency instanceof CryptoCurrency && ((CryptoCurrency) selectedTradeCurrency).isAsset()) {
String name = selectedTradeCurrency.getName();
new Popup<>().information(Res.get("account.altcoin.popup.wallet.msg", selectedTradeCurrency.getCodeAndName(), name, name)).closeButtonText(Res.get("account.altcoin.popup.wallet.confirm")).show();
}
switch(code) {
case "XMR":
new Popup<>().information(Res.get("account.altcoin.popup.xmr.msg")).useIUnderstandButton().show();
break;
case "ZEC":
new Popup<>().information(Res.get("account.altcoin.popup.ZEC.msg", "ZEC")).useIUnderstandButton().show();
break;
case "XZC":
new Popup<>().information(Res.get("account.altcoin.popup.XZC.msg", "XZC")).useIUnderstandButton().show();
break;
case "BCH":
case "BCHC":
new Popup<>().information(Res.get("account.altcoin.popup.bch")).useIUnderstandButton().show();
break;
case "BTG":
new Popup<>().information(Res.get("account.altcoin.popup.btg")).useIUnderstandButton().show();
break;
}
if (!model.getPaymentAccounts().stream().filter(e -> e.getAccountName() != null && e.getAccountName().equals(paymentAccount.getAccountName())).findAny().isPresent()) {
model.onSaveNewAccount(paymentAccount);
removeNewAccountForm();
} else {
new Popup<>().warning(Res.get("shared.accountNameAlreadyUsed")).show();
}
}
}
Aggregations