Search in sources :

Example 1 with CryptoCurrency

use of io.bitsquare.locale.CryptoCurrency in project bitsquare by bitsquare.

the class AltCoinAccountsView method onSaveNewAccount.

///////////////////////////////////////////////////////////////////////////////////////////
// UI actions
///////////////////////////////////////////////////////////////////////////////////////////
private void onSaveNewAccount(PaymentAccount paymentAccount) {
    TradeCurrency selectedTradeCurrency = paymentAccount.getSelectedTradeCurrency();
    String code = selectedTradeCurrency.getCode();
    if (selectedTradeCurrency instanceof CryptoCurrency && ((CryptoCurrency) selectedTradeCurrency).isAsset()) {
        new Popup().information("Please be sure that you follow the requirements for the usage of " + selectedTradeCurrency.getCodeAndName() + " wallets as described on the " + selectedTradeCurrency.getName() + " web page.\n" + "Using wallets from centralized exchanges where you don't have your keys under your control or " + "using a not compatible wallet software can lead to loss of the traded funds!\n" + "The arbitrator is not a " + selectedTradeCurrency.getName() + " specialist and cannot help in such cases.").closeButtonText("I understand and confirm that I know which wallet I need to use.").show();
    }
    if (code.equals("XMR")) {
        new Popup().information("If you want to trade XMR on Bitsquare please be sure you understand and fulfill " + "the following requirements:\n\n" + "For sending XMR you need to use the Monero simple wallet with the " + "store-tx-info flag enabled (default in new versions).\n" + "Please be sure that you can access the tx key (use the get_tx_key command in simplewallet) as that " + "would be required in case of a dispute to enable the arbitrator to verify the XMR transfer with " + "the XMR checktx tool (http://xmr.llcoins.net/checktx.html).\n" + "At normal block explorers the transfer is not verifiable.\n\n" + "You need to provide the arbitrator the following data in case of a dispute:\n" + "- The tx private key\n" + "- The transaction hash\n" + "- The recipient's public address\n\n" + "If you cannot provide the above data or if you used an incompatible wallet it would result in losing the " + "dispute case. The XMR sender is responsible to be able to verify the XMR transfer to the " + "arbitrator in case of a dispute.\n\n" + "There is no payment ID required, just the normal public address.\n\n" + "If you are not sure about that process visit the Monero forum (https://forum.getmonero.org) to find more information.").closeButtonText("I understand").show();
    } else if (code.equals("ZEC")) {
        new Popup().information("When using ZEC you can only use the transparent addresses (starting with t) not " + "the z-addresses, because the arbitrator would not be able to verify the transaction with z-addresses.").closeButtonText("I understand").show();
    } else if (code.equals("XZC")) {
        new Popup().information("When using XZC you can only use the transparent transactions not " + "the private transactions, because the arbitrator would not be able to verify the private transactions.").closeButtonText("I understand").show();
    }
    if (!model.getPaymentAccounts().stream().filter(e -> {
        if (e.getAccountName() != null)
            return e.getAccountName().equals(paymentAccount.getAccountName());
        else
            return false;
    }).findAny().isPresent()) {
        model.onSaveNewAccount(paymentAccount);
        removeNewAccountForm();
    } else {
        new Popup().warning("That account name is already used in a saved account.\n" + "Please use another name.").show();
    }
}
Also used : Button(javafx.scene.control.Button) PaymentAccountFactory(io.bitsquare.payment.PaymentAccountFactory) PaymentMethod(io.bitsquare.payment.PaymentMethod) Popup(io.bitsquare.gui.main.overlays.popups.Popup) ListView(javafx.scene.control.ListView) ListCell(javafx.scene.control.ListCell) TradeCurrency(io.bitsquare.locale.TradeCurrency) Tuple2(io.bitsquare.common.util.Tuple2) PaymentMethodForm(io.bitsquare.gui.components.paymentmethods.PaymentMethodForm) Inject(javax.inject.Inject) PaymentAccount(io.bitsquare.payment.PaymentAccount) Layout(io.bitsquare.gui.util.Layout) VPos(javafx.geometry.VPos) Callback(javafx.util.Callback) GridPane(javafx.scene.layout.GridPane) BSFormatter(io.bitsquare.gui.util.BSFormatter) Label(javafx.scene.control.Label) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) UserThread(io.bitsquare.common.UserThread) ImageUtil(io.bitsquare.gui.util.ImageUtil) io.bitsquare.gui.util.validation(io.bitsquare.gui.util.validation) ActivatableViewAndModel(io.bitsquare.gui.common.view.ActivatableViewAndModel) TimeUnit(java.util.concurrent.TimeUnit) FormBuilder(io.bitsquare.gui.util.FormBuilder) Tuple3(io.bitsquare.common.util.Tuple3) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) CryptoCurrencyForm(io.bitsquare.gui.components.paymentmethods.CryptoCurrencyForm) FxmlView(io.bitsquare.gui.common.view.FxmlView) ChangeListener(javafx.beans.value.ChangeListener) TitledGroupBg(io.bitsquare.gui.components.TitledGroupBg) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) TradeCurrency(io.bitsquare.locale.TradeCurrency) Popup(io.bitsquare.gui.main.overlays.popups.Popup)

Example 2 with CryptoCurrency

use of io.bitsquare.locale.CryptoCurrency in project bitsquare by bitsquare.

the class FiatAccountsDataModel method onSaveNewAccount.

///////////////////////////////////////////////////////////////////////////////////////////
// UI actions
///////////////////////////////////////////////////////////////////////////////////////////
public void onSaveNewAccount(PaymentAccount paymentAccount) {
    user.addPaymentAccount(paymentAccount);
    TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
    List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
    if (singleTradeCurrency != null) {
        if (singleTradeCurrency instanceof FiatCurrency)
            preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
        else
            preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
    } else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
        tradeCurrencies.stream().forEach(tradeCurrency -> {
            if (tradeCurrency instanceof FiatCurrency)
                preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
            else
                preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
        });
    }
}
Also used : PaymentMethod(io.bitsquare.payment.PaymentMethod) ActivatableDataModel(io.bitsquare.gui.common.model.ActivatableDataModel) FiatCurrency(io.bitsquare.locale.FiatCurrency) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) Inject(com.google.inject.Inject) SetChangeListener(javafx.collections.SetChangeListener) TradeCurrency(io.bitsquare.locale.TradeCurrency) FXCollections(javafx.collections.FXCollections) Collectors(java.util.stream.Collectors) GUIUtil(io.bitsquare.gui.util.GUIUtil) ArrayList(java.util.ArrayList) PaymentAccount(io.bitsquare.payment.PaymentAccount) TradeManager(io.bitsquare.trade.TradeManager) Preferences(io.bitsquare.user.Preferences) User(io.bitsquare.user.User) List(java.util.List) CryptoCurrencyAccount(io.bitsquare.payment.CryptoCurrencyAccount) Stage(javafx.stage.Stage) OpenOfferManager(io.bitsquare.trade.offer.OpenOfferManager) ObservableList(javafx.collections.ObservableList) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) TradeCurrency(io.bitsquare.locale.TradeCurrency) FiatCurrency(io.bitsquare.locale.FiatCurrency)

Example 3 with CryptoCurrency

use of io.bitsquare.locale.CryptoCurrency in project bitsquare by bitsquare.

the class AltCoinAccountsDataModel method onSaveNewAccount.

///////////////////////////////////////////////////////////////////////////////////////////
// UI actions
///////////////////////////////////////////////////////////////////////////////////////////
public void onSaveNewAccount(PaymentAccount paymentAccount) {
    user.addPaymentAccount(paymentAccount);
    TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
    List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
    if (singleTradeCurrency != null) {
        if (singleTradeCurrency instanceof FiatCurrency)
            preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
        else
            preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
    } else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
        tradeCurrencies.stream().forEach(tradeCurrency -> {
            if (tradeCurrency instanceof FiatCurrency)
                preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
            else
                preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
        });
    }
}
Also used : PaymentMethod(io.bitsquare.payment.PaymentMethod) ActivatableDataModel(io.bitsquare.gui.common.model.ActivatableDataModel) FiatCurrency(io.bitsquare.locale.FiatCurrency) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) Inject(com.google.inject.Inject) SetChangeListener(javafx.collections.SetChangeListener) TradeCurrency(io.bitsquare.locale.TradeCurrency) FXCollections(javafx.collections.FXCollections) Collectors(java.util.stream.Collectors) GUIUtil(io.bitsquare.gui.util.GUIUtil) ArrayList(java.util.ArrayList) PaymentAccount(io.bitsquare.payment.PaymentAccount) TradeManager(io.bitsquare.trade.TradeManager) Preferences(io.bitsquare.user.Preferences) User(io.bitsquare.user.User) List(java.util.List) CryptoCurrencyAccount(io.bitsquare.payment.CryptoCurrencyAccount) Stage(javafx.stage.Stage) OpenOfferManager(io.bitsquare.trade.offer.OpenOfferManager) ObservableList(javafx.collections.ObservableList) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) TradeCurrency(io.bitsquare.locale.TradeCurrency) FiatCurrency(io.bitsquare.locale.FiatCurrency)

Example 4 with CryptoCurrency

use of io.bitsquare.locale.CryptoCurrency in project bitsquare by bitsquare.

the class OfferBookViewModelTest method getCryptoAccount.

private PaymentAccount getCryptoAccount(String currencyCode) {
    PaymentAccount paymentAccount = new CryptoCurrencyAccount();
    paymentAccount.addCurrency(new CryptoCurrency(currencyCode, null));
    return paymentAccount;
}
Also used : CryptoCurrency(io.bitsquare.locale.CryptoCurrency)

Aggregations

CryptoCurrency (io.bitsquare.locale.CryptoCurrency)4 TradeCurrency (io.bitsquare.locale.TradeCurrency)3 PaymentAccount (io.bitsquare.payment.PaymentAccount)3 PaymentMethod (io.bitsquare.payment.PaymentMethod)3 Inject (com.google.inject.Inject)2 ActivatableDataModel (io.bitsquare.gui.common.model.ActivatableDataModel)2 GUIUtil (io.bitsquare.gui.util.GUIUtil)2 FiatCurrency (io.bitsquare.locale.FiatCurrency)2 CryptoCurrencyAccount (io.bitsquare.payment.CryptoCurrencyAccount)2 TradeManager (io.bitsquare.trade.TradeManager)2 OpenOfferManager (io.bitsquare.trade.offer.OpenOfferManager)2 Preferences (io.bitsquare.user.Preferences)2 User (io.bitsquare.user.User)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 FXCollections (javafx.collections.FXCollections)2 ObservableList (javafx.collections.ObservableList)2 SetChangeListener (javafx.collections.SetChangeListener)2 Stage (javafx.stage.Stage)2