add gold and silver, refactor money types to traditional and crypto

This commit is contained in:
woodser 2023-05-15 17:10:01 -04:00
parent 65bc78d3d7
commit 29706339ef
210 changed files with 2629 additions and 2373 deletions

View file

@ -42,7 +42,7 @@ import static haveno.desktop.util.Colors.AVATAR_RED;
@Slf4j
public class PeerInfoIconTrading extends PeerInfoIcon {
private final AccountAgeWitnessService accountAgeWitnessService;
private boolean isFiatCurrency;
private boolean isTraditionalCurrency;
public PeerInfoIconTrading(NodeAddress nodeAddress,
String role,
@ -99,7 +99,7 @@ public class PeerInfoIconTrading extends PeerInfoIcon {
offer = trade.getOffer();
}
checkNotNull(offer, "Offer must not be null");
isFiatCurrency = offer.isFiatOffer();
isTraditionalCurrency = offer.isTraditionalOffer();
initialize(role, offer, trade, privateNotificationManager, useDevPrivilegeKeys);
}
@ -120,19 +120,19 @@ public class PeerInfoIconTrading extends PeerInfoIcon {
createAvatar(getRingColor(offer, trade, accountAge, signAge));
addMouseListener(numTrades, privateNotificationManager, trade, offer, preferences, useDevPrivilegeKeys,
isFiatCurrency, accountAge, signAge, peersAccount.third, peersAccount.fourth, peersAccount.fifth);
isTraditionalCurrency, accountAge, signAge, peersAccount.third, peersAccount.fourth, peersAccount.fifth);
}
@Override
protected String getAccountAgeTooltip(Long accountAge) {
return isFiatCurrency ? super.getAccountAgeTooltip(accountAge) : "";
return isTraditionalCurrency ? super.getAccountAgeTooltip(accountAge) : "";
}
protected Color getRingColor(Offer offer, Trade Trade, Long accountAge, Long signAge) {
// outer circle
// for altcoins we always display green
// for cryptos we always display green
Color ringColor = AVATAR_GREEN;
if (isFiatCurrency) {
if (isTraditionalCurrency) {
switch (accountAgeWitnessService.getPeersAccountAgeCategory(hasChargebackRisk(Trade, offer) ? signAge : accountAge)) {
case TWO_MONTHS_OR_MORE:
ringColor = AVATAR_GREEN;

View file

@ -29,7 +29,7 @@ import haveno.core.payment.InstantCryptoCurrencyAccount;
import haveno.core.payment.PaymentAccount;
import haveno.core.payment.payload.AssetAccountPayload;
import haveno.core.payment.payload.PaymentAccountPayload;
import haveno.core.payment.validation.AltCoinAddressValidator;
import haveno.core.payment.validation.CryptoAddressValidator;
import haveno.core.util.coin.CoinFormatter;
import haveno.core.util.validation.InputValidator;
import haveno.desktop.components.AutocompleteComboBox;
@ -54,7 +54,7 @@ import static haveno.desktop.util.GUIUtil.getComboBoxButtonCell;
public class AssetsForm extends PaymentMethodForm {
public static final String INSTANT_TRADE_NEWS = "instantTradeNews0.9.5";
private final AssetAccount assetAccount;
private final AltCoinAddressValidator altCoinAddressValidator;
private final CryptoAddressValidator altCoinAddressValidator;
private final FilterManager filterManager;
private InputTextField addressInputTextField;
@ -72,7 +72,7 @@ public class AssetsForm extends PaymentMethodForm {
public AssetsForm(PaymentAccount paymentAccount,
AccountAgeWitnessService accountAgeWitnessService,
AltCoinAddressValidator altCoinAddressValidator,
CryptoAddressValidator altCoinAddressValidator,
InputValidator inputValidator,
GridPane gridPane,
int gridRow,
@ -94,12 +94,12 @@ public class AssetsForm extends PaymentMethodForm {
currencyComboBox.setPrefWidth(250);
tradeInstantCheckBox = addLabelCheckBox(gridPane, ++gridRow,
Res.get("payment.altcoin.tradeInstantCheckbox"), 10);
Res.get("payment.crypto.tradeInstantCheckbox"), 10);
tradeInstantCheckBox.setSelected(tradeInstant);
tradeInstantCheckBox.setOnAction(e -> {
tradeInstant = tradeInstantCheckBox.isSelected();
if (tradeInstant)
new Popup().information(Res.get("payment.altcoin.tradeInstant.popup")).show();
new Popup().information(Res.get("payment.crypto.tradeInstant.popup")).show();
paymentLimitationsTextField.setText(getLimitationsText());
});
@ -109,7 +109,7 @@ public class AssetsForm extends PaymentMethodForm {
gridPane.getChildren().add(tradeInstantCheckBox);
addressInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow,
Res.get("payment.altcoin.address"));
Res.get("payment.crypto.address"));
addressInputTextField.setValidator(altCoinAddressValidator);
addressInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
@ -148,7 +148,7 @@ public class AssetsForm extends PaymentMethodForm {
@Override
public void updateFromInputs() {
if (addressInputTextField != null && assetAccount.getSingleTradeCurrency() != null)
addressInputTextField.setPromptText(Res.get("payment.altcoin.address.dyn",
addressInputTextField.setPromptText(Res.get("payment.crypto.address.dyn",
assetAccount.getSingleTradeCurrency().getName()));
super.updateFromInputs();
}
@ -167,12 +167,12 @@ public class AssetsForm extends PaymentMethodForm {
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
Res.get(assetAccount.getPaymentMethod().getId()));
Tuple3<Label, TextField, VBox> tuple2 = addCompactTopLabelTextField(gridPane, ++gridRow,
Res.get("payment.altcoin.address"), assetAccount.getAddress());
Res.get("payment.crypto.address"), assetAccount.getAddress());
TextField field = tuple2.second;
field.setMouseTransparent(false);
final TradeCurrency singleTradeCurrency = assetAccount.getSingleTradeCurrency();
final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.altcoin"),
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.crypto"),
nameAndCode);
addLimitations(true);
}
@ -190,10 +190,10 @@ public class AssetsForm extends PaymentMethodForm {
@Override
protected void addTradeCurrencyComboBox() {
currencyComboBox = FormBuilder.<TradeCurrency>addLabelAutocompleteComboBox(gridPane, ++gridRow, Res.get("payment.altcoin"),
currencyComboBox = FormBuilder.<TradeCurrency>addLabelAutocompleteComboBox(gridPane, ++gridRow, Res.get("payment.crypto"),
Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
currencyComboBox.setPromptText(Res.get("payment.select.altcoin"));
currencyComboBox.setButtonCell(getComboBoxButtonCell(Res.get("payment.select.altcoin"), currencyComboBox));
currencyComboBox.setPromptText(Res.get("payment.select.crypto"));
currencyComboBox.setButtonCell(getComboBoxButtonCell(Res.get("payment.select.crypto"), currencyComboBox));
currencyComboBox.getEditor().focusedProperty().addListener(observable ->
currencyComboBox.setPromptText(""));
@ -224,7 +224,7 @@ public class AssetsForm extends PaymentMethodForm {
updateFromInputs();
if (tradeCurrency != null && tradeCurrency.getCode().equals("BSQ")) {
new Popup().information(Res.get("payment.select.altcoin.bsq.warning")).show();
new Popup().information(Res.get("payment.select.crypto.bsq.warning")).show();
}
});
}

View file

@ -24,7 +24,7 @@ import haveno.core.locale.BankUtil;
import haveno.core.locale.Country;
import haveno.core.locale.CountryUtil;
import haveno.core.locale.CurrencyUtil;
import haveno.core.locale.FiatCurrency;
import haveno.core.locale.TraditionalCurrency;
import haveno.core.locale.Res;
import haveno.core.locale.TradeCurrency;
import haveno.core.payment.CountryBasedPaymentAccount;
@ -363,7 +363,7 @@ abstract class BankForm extends GeneralBankForm {
}
private void onTradeCurrencySelected(TradeCurrency tradeCurrency) {
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(selectedCountry.code);
TraditionalCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(selectedCountry.code);
applyTradeCurrency(tradeCurrency, defaultCurrency);
}

View file

@ -76,7 +76,7 @@ public class CashByMailForm extends PaymentMethodForm {
gridRowFrom = gridRow + 1;
addTradeCurrencyComboBox();
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedTraditionalCurrencies()));
InputTextField contactField = addInputTextField(gridPane, ++gridRow,
Res.get("payment.cashByMail.contact"));

View file

@ -24,7 +24,7 @@ import haveno.core.locale.BankUtil;
import haveno.core.locale.Country;
import haveno.core.locale.CountryUtil;
import haveno.core.locale.CurrencyUtil;
import haveno.core.locale.FiatCurrency;
import haveno.core.locale.TraditionalCurrency;
import haveno.core.locale.Res;
import haveno.core.locale.TradeCurrency;
import haveno.core.payment.CountryBasedPaymentAccount;
@ -318,7 +318,7 @@ public class CashDepositForm extends GeneralBankForm {
}
private void onTradeCurrencySelected(TradeCurrency tradeCurrency) {
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(selectedCountry.code);
TraditionalCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(selectedCountry.code);
applyTradeCurrency(tradeCurrency, defaultCurrency);
}

View file

@ -23,7 +23,7 @@ import haveno.core.account.witness.AccountAgeWitnessService;
import haveno.core.locale.Country;
import haveno.core.locale.CountryUtil;
import haveno.core.locale.CurrencyUtil;
import haveno.core.locale.FiatCurrency;
import haveno.core.locale.TraditionalCurrency;
import haveno.core.locale.Res;
import haveno.core.locale.TradeCurrency;
import haveno.core.offer.Offer;
@ -134,7 +134,7 @@ public class F2FForm extends PaymentMethodForm {
}
private void onTradeCurrencySelected(TradeCurrency tradeCurrency) {
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(selectedCountry.code);
TraditionalCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(selectedCountry.code);
applyTradeCurrency(tradeCurrency, defaultCurrency);
}

View file

@ -23,7 +23,7 @@ import haveno.common.util.Utilities;
import haveno.core.account.witness.AccountAgeWitness;
import haveno.core.account.witness.AccountAgeWitnessService;
import haveno.core.locale.CurrencyUtil;
import haveno.core.locale.FiatCurrency;
import haveno.core.locale.TraditionalCurrency;
import haveno.core.locale.Res;
import haveno.core.locale.TradeCurrency;
import haveno.core.offer.Offer;
@ -99,7 +99,7 @@ public abstract class PaymentMethodForm {
protected void addTradeCurrencyComboBox() {
currencyComboBox = FormBuilder.addComboBox(gridPane, ++gridRow, Res.get("shared.currency"));
currencyComboBox.setPromptText(Res.get("list.currency.select"));
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getMainFiatCurrencies()));
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getMainTraditionalCurrencies()));
currencyComboBox.setConverter(new StringConverter<>() {
@Override
public String toString(TradeCurrency tradeCurrency) {
@ -265,7 +265,7 @@ public abstract class PaymentMethodForm {
}
}
void applyTradeCurrency(TradeCurrency tradeCurrency, FiatCurrency defaultCurrency) {
void applyTradeCurrency(TradeCurrency tradeCurrency, TraditionalCurrency defaultCurrency) {
if (!defaultCurrency.equals(tradeCurrency)) {
new Popup().warning(Res.get("payment.foreign.currency"))
.actionButtonText(Res.get("shared.yes"))

View file

@ -18,7 +18,7 @@
package haveno.desktop.components.paymentmethods;
import haveno.core.account.witness.AccountAgeWitnessService;
import haveno.core.locale.FiatCurrency;
import haveno.core.locale.TraditionalCurrency;
import haveno.core.locale.Res;
import haveno.core.payment.PaymentAccount;
import haveno.core.payment.PerfectMoneyAccount;
@ -50,7 +50,7 @@ public class PerfectMoneyForm extends GeneralAccountNumberForm {
@Override
public void addTradeCurrency() {
addTradeCurrencyComboBox();
currencyComboBox.setItems(FXCollections.observableArrayList(new FiatCurrency("USD"), new FiatCurrency("EUR")));
currencyComboBox.setItems(FXCollections.observableArrayList(new TraditionalCurrency("USD"), new TraditionalCurrency("EUR")));
}
@Override

View file

@ -22,7 +22,7 @@ import haveno.core.account.witness.AccountAgeWitnessService;
import haveno.core.locale.BankUtil;
import haveno.core.locale.Country;
import haveno.core.locale.CurrencyUtil;
import haveno.core.locale.FiatCurrency;
import haveno.core.locale.TraditionalCurrency;
import haveno.core.locale.Res;
import haveno.core.locale.TradeCurrency;
import haveno.core.payment.CountryBasedPaymentAccount;
@ -100,7 +100,7 @@ public class WesternUnionForm extends PaymentMethodForm {
}
private void onTradeCurrencySelected(TradeCurrency tradeCurrency) {
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(selectedCountry.code);
TraditionalCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(selectedCountry.code);
applyTradeCurrency(tradeCurrency, defaultCurrency);
}

View file

@ -273,8 +273,8 @@ public class MainViewModel implements ViewModel, HavenoSetup.HavenoSetupListener
UserThread.execute(() -> getShowAppScreen().set(true));
// We only show the popup if the user has already set up any fiat account. For new users it is not a rule
// change and for altcoins its not relevant.
// We only show the popup if the user has already set up any traditional account. For new users it is not a rule
// change and for crypto its not relevant.
String key = "newFeatureDuplicateOffer";
if (DontShowAgainLookup.showAgain(key)) {
UserThread.runAfter(() -> {

View file

@ -26,13 +26,13 @@
AnchorPane.bottomAnchor="0" AnchorPane.leftAnchor="0"
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
xmlns:fx="http://javafx.com/fxml">
<Tab fx:id="fiatAccountsTab" closable="false">
<Tab fx:id="traditionalAccountsTab" closable="false">
<ScrollPane fitToWidth="true" hbarPolicy="NEVER"
fitToHeight="true"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"/>
</Tab>
<Tab fx:id="altcoinAccountsTab" closable="false">
<Tab fx:id="cryptoAccountsTab" closable="false">
<ScrollPane fitToWidth="true" hbarPolicy="NEVER"
fitToHeight="true"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"

View file

@ -27,12 +27,12 @@ import haveno.desktop.common.view.FxmlView;
import haveno.desktop.common.view.View;
import haveno.desktop.common.view.ViewLoader;
import haveno.desktop.main.MainView;
import haveno.desktop.main.account.content.altcoinaccounts.AltCoinAccountsView;
import haveno.desktop.main.account.content.backup.BackupView;
import haveno.desktop.main.account.content.fiataccounts.FiatAccountsView;
import haveno.desktop.main.account.content.cryptoaccounts.CryptoAccountsView;
import haveno.desktop.main.account.content.notifications.MobileNotificationsView;
import haveno.desktop.main.account.content.password.PasswordView;
import haveno.desktop.main.account.content.seedwords.SeedWordsView;
import haveno.desktop.main.account.content.traditionalaccounts.TraditionalAccountsView;
import haveno.desktop.main.account.content.walletinfo.WalletInfoView;
import haveno.desktop.main.account.register.arbitrator.ArbitratorRegistrationView;
import haveno.desktop.main.account.register.mediator.MediatorRegistrationView;
@ -57,7 +57,7 @@ import java.util.List;
public class AccountView extends ActivatableView<TabPane, Void> {
@FXML
Tab fiatAccountsTab, altcoinAccountsTab, notificationTab,
Tab traditionalAccountsTab, cryptoAccountsTab, notificationTab,
passwordTab, seedWordsTab, walletInfoTab, backupTab;
private Navigation.Listener navigationListener;
@ -88,8 +88,8 @@ public class AccountView extends ActivatableView<TabPane, Void> {
root.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
fiatAccountsTab.setText(Res.get("account.menu.paymentAccount").toUpperCase());
altcoinAccountsTab.setText(Res.get("account.menu.altCoinsAccountView").toUpperCase());
traditionalAccountsTab.setText(Res.get("account.menu.paymentAccount").toUpperCase());
cryptoAccountsTab.setText(Res.get("account.menu.altCoinsAccountView").toUpperCase());
notificationTab.setText(Res.get("account.menu.notifications").toUpperCase());
passwordTab.setText(Res.get("account.menu.password").toUpperCase());
seedWordsTab.setText(Res.get("account.menu.seedWords").toUpperCase());
@ -99,13 +99,13 @@ public class AccountView extends ActivatableView<TabPane, Void> {
navigationListener = (viewPath, data) -> {
if (viewPath.size() == 3 && viewPath.indexOf(AccountView.class) == 1) {
if (arbitratorRegistrationTab == null && viewPath.get(2).equals(ArbitratorRegistrationView.class)) {
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
} else if (mediatorRegistrationTab == null && viewPath.get(2).equals(MediatorRegistrationView.class)) {
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
} else if (refundAgentRegistrationTab == null && viewPath.get(2).equals(RefundAgentRegistrationView.class)) {
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
} else if (signingTab == null && viewPath.get(2).equals(SigningView.class)) {
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
} else {
loadView(viewPath.tip());
}
@ -151,10 +151,10 @@ public class AccountView extends ActivatableView<TabPane, Void> {
navigation.navigateTo(MainView.class, AccountView.class, RefundAgentRegistrationView.class);
} else if (signingTab != null && !selectedTab.equals(signingTab)) {
navigation.navigateTo(MainView.class, AccountView.class, SigningView.class);
} else if (newValue == fiatAccountsTab && selectedTab != fiatAccountsTab) {
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
} else if (newValue == altcoinAccountsTab && selectedTab != altcoinAccountsTab) {
navigation.navigateTo(MainView.class, AccountView.class, AltCoinAccountsView.class);
} else if (newValue == traditionalAccountsTab && selectedTab != traditionalAccountsTab) {
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
} else if (newValue == cryptoAccountsTab && selectedTab != cryptoAccountsTab) {
navigation.navigateTo(MainView.class, AccountView.class, CryptoAccountsView.class);
} else if (newValue == notificationTab && selectedTab != notificationTab) {
navigation.navigateTo(MainView.class, AccountView.class, MobileNotificationsView.class);
} else if (newValue == passwordTab && selectedTab != passwordTab) {
@ -202,22 +202,22 @@ public class AccountView extends ActivatableView<TabPane, Void> {
private void onArbitratorRegistrationTabRemoved() {
arbitratorRegistrationTab = null;
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
}
private void onMediatorRegistrationTabRemoved() {
mediatorRegistrationTab = null;
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
}
private void onRefundAgentRegistrationTabRemoved() {
refundAgentRegistrationTab = null;
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
}
private void onSigningTabRemoved() {
signingTab = null;
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
}
@Override
@ -243,10 +243,10 @@ public class AccountView extends ActivatableView<TabPane, Void> {
navigation.navigateTo(MainView.class, AccountView.class, RefundAgentRegistrationView.class);
else if (signingTab != null)
navigation.navigateTo(MainView.class, AccountView.class, SigningView.class);
else if (root.getSelectionModel().getSelectedItem() == fiatAccountsTab)
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
else if (root.getSelectionModel().getSelectedItem() == altcoinAccountsTab)
navigation.navigateTo(MainView.class, AccountView.class, AltCoinAccountsView.class);
else if (root.getSelectionModel().getSelectedItem() == traditionalAccountsTab)
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
else if (root.getSelectionModel().getSelectedItem() == cryptoAccountsTab)
navigation.navigateTo(MainView.class, AccountView.class, CryptoAccountsView.class);
else if (root.getSelectionModel().getSelectedItem() == notificationTab)
navigation.navigateTo(MainView.class, AccountView.class, MobileNotificationsView.class);
else if (root.getSelectionModel().getSelectedItem() == passwordTab)
@ -258,7 +258,7 @@ public class AccountView extends ActivatableView<TabPane, Void> {
else if (root.getSelectionModel().getSelectedItem() == backupTab)
navigation.navigateTo(MainView.class, AccountView.class, BackupView.class);
else
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
}
}
@ -299,10 +299,10 @@ public class AccountView extends ActivatableView<TabPane, Void> {
if (signingTab != null) {
selectedTab = signingTab;
}
} else if (view instanceof FiatAccountsView) {
selectedTab = fiatAccountsTab;
} else if (view instanceof AltCoinAccountsView) {
selectedTab = altcoinAccountsTab;
} else if (view instanceof TraditionalAccountsView) {
selectedTab = traditionalAccountsTab;
} else if (view instanceof CryptoAccountsView) {
selectedTab = cryptoAccountsTab;
} else if (view instanceof MobileNotificationsView) {
selectedTab = notificationTab;
} else if (view instanceof PasswordView) {

View file

@ -15,7 +15,7 @@
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
*/
package haveno.desktop.main.account.content.altcoinaccounts;
package haveno.desktop.main.account.content.cryptoaccounts;
import com.google.inject.Inject;
import haveno.common.crypto.KeyRing;
@ -23,7 +23,7 @@ import haveno.common.file.CorruptedStorageFileHandler;
import haveno.common.proto.persistable.PersistenceProtoResolver;
import haveno.core.account.witness.AccountAgeWitnessService;
import haveno.core.locale.CryptoCurrency;
import haveno.core.locale.FiatCurrency;
import haveno.core.locale.TraditionalCurrency;
import haveno.core.locale.TradeCurrency;
import haveno.core.offer.OpenOfferManager;
import haveno.core.payment.AssetAccount;
@ -43,7 +43,7 @@ import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
class AltCoinAccountsDataModel extends ActivatableDataModel {
class CryptoAccountsDataModel extends ActivatableDataModel {
private final User user;
private final Preferences preferences;
@ -52,13 +52,13 @@ class AltCoinAccountsDataModel extends ActivatableDataModel {
private final AccountAgeWitnessService accountAgeWitnessService;
final ObservableList<PaymentAccount> paymentAccounts = FXCollections.observableArrayList();
private final SetChangeListener<PaymentAccount> setChangeListener;
private final String accountsFileName = "AltcoinPaymentAccounts";
private final String accountsFileName = "CryptoPaymentAccounts";
private final PersistenceProtoResolver persistenceProtoResolver;
private final CorruptedStorageFileHandler corruptedStorageFileHandler;
private final KeyRing keyRing;
@Inject
public AltCoinAccountsDataModel(User user,
public CryptoAccountsDataModel(User user,
Preferences preferences,
OpenOfferManager openOfferManager,
TradeManager tradeManager,
@ -106,14 +106,14 @@ class AltCoinAccountsDataModel extends ActivatableDataModel {
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
if (singleTradeCurrency != null) {
if (singleTradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
if (singleTradeCurrency instanceof TraditionalCurrency)
preferences.addTraditionalCurrency((TraditionalCurrency) singleTradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
} else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
tradeCurrencies.forEach(tradeCurrency -> {
if (tradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
if (tradeCurrency instanceof TraditionalCurrency)
preferences.addTraditionalCurrency((TraditionalCurrency) tradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
});

View file

@ -22,7 +22,7 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<GridPane fx:id="root" fx:controller="haveno.desktop.main.account.content.fiataccounts.FiatAccountsView"
<GridPane fx:id="root" fx:controller="haveno.desktop.main.account.content.cryptoaccounts.CryptoAccountsView"
hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"

View file

@ -15,9 +15,9 @@
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
*/
package haveno.desktop.main.account.content.altcoinaccounts;
package haveno.desktop.main.account.content.cryptoaccounts;
import haveno.asset.AltCoinAccountDisclaimer;
import haveno.asset.CryptoAccountDisclaimer;
import haveno.asset.Asset;
import haveno.asset.coins.Monero;
import haveno.common.util.Tuple2;
@ -31,7 +31,7 @@ import haveno.core.locale.TradeCurrency;
import haveno.core.payment.PaymentAccount;
import haveno.core.payment.PaymentAccountFactory;
import haveno.core.payment.payload.PaymentMethod;
import haveno.core.payment.validation.AltCoinAddressValidator;
import haveno.core.payment.validation.CryptoAddressValidator;
import haveno.core.user.Preferences;
import haveno.core.util.FormattingUtils;
import haveno.core.util.coin.CoinFormatter;
@ -63,10 +63,10 @@ import static haveno.desktop.util.FormBuilder.addTitledGroupBg;
import static haveno.desktop.util.FormBuilder.addTopLabelListView;
@FxmlView
public class AltCoinAccountsView extends PaymentAccountsView<GridPane, AltCoinAccountsViewModel> {
public class CryptoAccountsView extends PaymentAccountsView<GridPane, CryptoAccountsViewModel> {
private final InputValidator inputValidator;
private final AltCoinAddressValidator altCoinAddressValidator;
private final CryptoAddressValidator altCoinAddressValidator;
private final FilterManager filterManager;
private final CoinFormatter formatter;
private final Preferences preferences;
@ -77,9 +77,9 @@ public class AltCoinAccountsView extends PaymentAccountsView<GridPane, AltCoinAc
private int gridRow = 0;
@Inject
public AltCoinAccountsView(AltCoinAccountsViewModel model,
public CryptoAccountsView(CryptoAccountsViewModel model,
InputValidator inputValidator,
AltCoinAddressValidator altCoinAddressValidator,
CryptoAddressValidator altCoinAddressValidator,
AccountAgeWitnessService accountAgeWitnessService,
FilterManager filterManager,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
@ -118,17 +118,17 @@ public class AltCoinAccountsView extends PaymentAccountsView<GridPane, AltCoinAc
if (selectedTradeCurrency != null) {
if (selectedTradeCurrency instanceof CryptoCurrency && ((CryptoCurrency) selectedTradeCurrency).isAsset()) {
String name = selectedTradeCurrency.getName();
new Popup().information(Res.get("account.altcoin.popup.wallet.msg",
new Popup().information(Res.get("account.crypto.popup.wallet.msg",
selectedTradeCurrency.getCodeAndName(),
name,
name))
.closeButtonText(Res.get("account.altcoin.popup.wallet.confirm"))
.closeButtonText(Res.get("account.crypto.popup.wallet.confirm"))
.show();
}
final Optional<Asset> asset = CurrencyUtil.findAsset(selectedTradeCurrency.getCode());
if (asset.isPresent()) {
final AltCoinAccountDisclaimer disclaimerAnnotation = asset.get().getClass().getAnnotation(AltCoinAccountDisclaimer.class);
final CryptoAccountDisclaimer disclaimerAnnotation = asset.get().getClass().getAnnotation(CryptoAccountDisclaimer.class);
if (disclaimerAnnotation != null) {
new Popup()
.width(asset.get() instanceof Monero ? 1000 : 669)
@ -174,7 +174,7 @@ public class AltCoinAccountsView extends PaymentAccountsView<GridPane, AltCoinAc
protected void buildForm() {
addTitledGroupBg(root, gridRow, 2, Res.get("shared.manageAccounts"));
Tuple3<Label, ListView<PaymentAccount>, VBox> tuple = addTopLabelListView(root, gridRow, Res.get("account.altcoin.yourAltcoinAccounts"), Layout.FIRST_ROW_DISTANCE);
Tuple3<Label, ListView<PaymentAccount>, VBox> tuple = addTopLabelListView(root, gridRow, Res.get("account.crypto.yourCryptoAccounts"), Layout.FIRST_ROW_DISTANCE);
paymentAccountsListView = tuple.second;
int prefNumRows = Math.min(4, Math.max(2, model.dataModel.getNumPaymentAccounts()));
paymentAccountsListView.setMinHeight(prefNumRows * Layout.LIST_ROW_HEIGHT + 28);

View file

@ -15,7 +15,7 @@
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
*/
package haveno.desktop.main.account.content.fiataccounts;
package haveno.desktop.main.account.content.cryptoaccounts;
import com.google.inject.Inject;
import haveno.core.payment.PaymentAccount;
@ -23,10 +23,10 @@ import haveno.desktop.common.model.ActivatableWithDataModel;
import haveno.desktop.common.model.ViewModel;
import javafx.collections.ObservableList;
class FiatAccountsViewModel extends ActivatableWithDataModel<FiatAccountsDataModel> implements ViewModel {
class CryptoAccountsViewModel extends ActivatableWithDataModel<CryptoAccountsDataModel> implements ViewModel {
@Inject
public FiatAccountsViewModel(FiatAccountsDataModel dataModel) {
public CryptoAccountsViewModel(CryptoAccountsDataModel dataModel) {
super(dataModel);
}

View file

@ -40,7 +40,7 @@ import haveno.core.user.User;
import haveno.core.util.FormattingUtils;
import haveno.core.util.ParsingUtils;
import haveno.core.util.PriceUtil;
import haveno.core.util.validation.AltcoinValidator;
import haveno.core.util.validation.NonFiatPriceValidator;
import haveno.core.util.validation.FiatPriceValidator;
import haveno.core.util.validation.InputValidator;
import haveno.desktop.common.view.ActivatableView;
@ -313,9 +313,9 @@ public class MobileNotificationsView extends ActivatableView<GridPane, Void> {
TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
selectedPriceAlertTradeCurrency = selectedItem.getCode();
boolean isCryptoCurrency = CurrencyUtil.isCryptoCurrency(selectedPriceAlertTradeCurrency);
priceAlertHighInputTextField.setValidator(isCryptoCurrency ? new AltcoinValidator() : new FiatPriceValidator());
priceAlertLowInputTextField.setValidator(isCryptoCurrency ? new AltcoinValidator() : new FiatPriceValidator());
boolean isFiatCurrency = CurrencyUtil.isFiatCurrency(selectedPriceAlertTradeCurrency);
priceAlertHighInputTextField.setValidator(isFiatCurrency ? new FiatPriceValidator() : new NonFiatPriceValidator());
priceAlertLowInputTextField.setValidator(isFiatCurrency ? new FiatPriceValidator() : new NonFiatPriceValidator());
} else {
selectedPriceAlertTradeCurrency = null;
}

View file

@ -15,7 +15,7 @@
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
*/
package haveno.desktop.main.account.content.fiataccounts;
package haveno.desktop.main.account.content.traditionalaccounts;
import com.google.inject.Inject;
import haveno.common.crypto.KeyRing;
@ -24,7 +24,7 @@ import haveno.common.proto.persistable.PersistenceProtoResolver;
import haveno.core.account.witness.AccountAgeWitnessService;
import haveno.core.locale.CryptoCurrency;
import haveno.core.locale.CurrencyUtil;
import haveno.core.locale.FiatCurrency;
import haveno.core.locale.TraditionalCurrency;
import haveno.core.locale.TradeCurrency;
import haveno.core.offer.OpenOfferManager;
import haveno.core.payment.AssetAccount;
@ -44,7 +44,7 @@ import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
class FiatAccountsDataModel extends ActivatableDataModel {
class TraditionalAccountsDataModel extends ActivatableDataModel {
private final User user;
private final Preferences preferences;
@ -59,7 +59,7 @@ class FiatAccountsDataModel extends ActivatableDataModel {
private final KeyRing keyRing;
@Inject
public FiatAccountsDataModel(User user,
public TraditionalAccountsDataModel(User user,
Preferences preferences,
OpenOfferManager openOfferManager,
TradeManager tradeManager,
@ -108,8 +108,8 @@ class FiatAccountsDataModel extends ActivatableDataModel {
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
if (singleTradeCurrency != null) {
if (singleTradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
if (singleTradeCurrency instanceof TraditionalCurrency)
preferences.addTraditionalCurrency((TraditionalCurrency) singleTradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
} else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
@ -119,8 +119,8 @@ class FiatAccountsDataModel extends ActivatableDataModel {
paymentAccount.setSelectedTradeCurrency(tradeCurrencies.get(0));
tradeCurrencies.forEach(tradeCurrency -> {
if (tradeCurrency instanceof FiatCurrency)
preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
if (tradeCurrency instanceof TraditionalCurrency)
preferences.addTraditionalCurrency((TraditionalCurrency) tradeCurrency);
else
preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
});

View file

@ -22,7 +22,7 @@
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<GridPane fx:id="root" fx:controller="haveno.desktop.main.account.content.altcoinaccounts.AltCoinAccountsView"
<GridPane fx:id="root" fx:controller="haveno.desktop.main.account.content.traditionalaccounts.TraditionalAccountsView"
hgap="5.0" vgap="5.0"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"

View file

@ -15,7 +15,7 @@
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
*/
package haveno.desktop.main.account.content.fiataccounts;
package haveno.desktop.main.account.content.traditionalaccounts;
import haveno.common.config.Config;
import haveno.common.util.Tuple2;
@ -145,7 +145,7 @@ import static haveno.desktop.util.FormBuilder.addTitledGroupBg;
import static haveno.desktop.util.FormBuilder.addTopLabelListView;
@FxmlView
public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccountsViewModel> {
public class TraditionalAccountsView extends PaymentAccountsView<GridPane, TraditionalAccountsViewModel> {
private final BICValidator bicValidator;
private final CapitualValidator capitualValidator;
@ -177,7 +177,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
private int gridRow = 0;
@Inject
public FiatAccountsView(FiatAccountsViewModel model,
public TraditionalAccountsView(TraditionalAccountsViewModel model,
BICValidator bicValidator,
CapitualValidator capitualValidator,
LengthValidator inputValidator,
@ -397,7 +397,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
protected void buildForm() {
addTitledGroupBg(root, gridRow, 2, Res.get("shared.manageAccounts"));
Tuple3<Label, ListView<PaymentAccount>, VBox> tuple = addTopLabelListView(root, gridRow, Res.get("account.fiat.yourFiatAccounts"), Layout.FIRST_ROW_DISTANCE);
Tuple3<Label, ListView<PaymentAccount>, VBox> tuple = addTopLabelListView(root, gridRow, Res.get("account.traditional.yourTraditionalAccounts"), Layout.FIRST_ROW_DISTANCE);
paymentAccountsListView = tuple.second;
int prefNumRows = Math.min(4, Math.max(2, model.dataModel.getNumPaymentAccounts()));
paymentAccountsListView.setMinHeight(prefNumRows * Layout.LIST_ROW_HEIGHT + 28);
@ -421,7 +421,7 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
paymentMethodComboBox.setVisibleRowCount(11);
paymentMethodComboBox.setPrefWidth(250);
List<PaymentMethod> list = PaymentMethod.paymentMethods.stream()
.filter(PaymentMethod::isFiat)
.filter(PaymentMethod::isTraditional)
.sorted()
.collect(Collectors.toList());
paymentMethodComboBox.setItems(FXCollections.observableArrayList(list));

View file

@ -15,7 +15,7 @@
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
*/
package haveno.desktop.main.account.content.altcoinaccounts;
package haveno.desktop.main.account.content.traditionalaccounts;
import com.google.inject.Inject;
import haveno.core.payment.PaymentAccount;
@ -23,10 +23,10 @@ import haveno.desktop.common.model.ActivatableWithDataModel;
import haveno.desktop.common.model.ViewModel;
import javafx.collections.ObservableList;
class AltCoinAccountsViewModel extends ActivatableWithDataModel<AltCoinAccountsDataModel> implements ViewModel {
class TraditionalAccountsViewModel extends ActivatableWithDataModel<TraditionalAccountsDataModel> implements ViewModel {
@Inject
public AltCoinAccountsViewModel(AltCoinAccountsDataModel dataModel) {
public TraditionalAccountsViewModel(TraditionalAccountsDataModel dataModel) {
super(dataModel);
}

View file

@ -259,13 +259,13 @@ class OfferBookChartViewModel extends ActivatableViewModel {
public int getMaxNumberOfPriceZeroDecimalsToColorize(Offer offer) {
return offer.isFiatOffer()
? GUIUtil.FIAT_DECIMALS_WITH_ZEROS
: GUIUtil.ALTCOINS_DECIMALS_WITH_ZEROS;
: GUIUtil.CRYPTOS_DECIMALS_WITH_ZEROS;
}
public int getZeroDecimalsForPrice(Offer offer) {
return offer.isFiatOffer()
? GUIUtil.FIAT_PRICE_DECIMALS_WITH_ZEROS
: GUIUtil.ALTCOINS_DECIMALS_WITH_ZEROS;
: GUIUtil.CRYPTOS_DECIMALS_WITH_ZEROS;
}
public String getPrice(Offer offer) {
@ -307,8 +307,8 @@ class OfferBookChartViewModel extends ActivatableViewModel {
// Offer price can be null (if price feed unavailable), thus a null-tolerant comparator is used.
Comparator<Offer> offerPriceComparator = Comparator.comparing(Offer::getPrice, Comparator.nullsLast(Comparator.naturalOrder()));
// Trading btc-fiat is considered as buying/selling BTC, but trading btc-altcoin is
// considered as buying/selling Altcoin. Because of this, when viewing a btc-altcoin pair,
// Trading xmr-traditional is considered as buying/selling XMR, but trading xmr-crypto is
// considered as buying/selling Crypto. Because of this, when viewing a xmr-crypto pair,
// the buy column is actually the sell column and vice versa. To maintain the expected
// ordering, we have to reverse the price comparator.
boolean isCrypto = CurrencyUtil.isCryptoCurrency(getCurrencyCode());
@ -417,15 +417,15 @@ class OfferBookChartViewModel extends ActivatableViewModel {
private void updateScreenCurrencyInPreferences(OfferDirection direction) {
if (isSellOffer(direction)) {
if (CurrencyUtil.isFiatCurrency(getCurrencyCode())) {
if (CurrencyUtil.isTraditionalCurrency(getCurrencyCode())) {
preferences.setBuyScreenCurrencyCode(getCurrencyCode());
} else if (!getCurrencyCode().equals(GUIUtil.TOP_ALTCOIN.getCode())) {
} else if (!getCurrencyCode().equals(GUIUtil.TOP_CRYPTO.getCode())) {
preferences.setBuyScreenCryptoCurrencyCode(getCurrencyCode());
}
} else {
if (CurrencyUtil.isFiatCurrency(getCurrencyCode())) {
if (CurrencyUtil.isTraditionalCurrency(getCurrencyCode())) {
preferences.setSellScreenCurrencyCode(getCurrencyCode());
} else if (!getCurrencyCode().equals(GUIUtil.TOP_ALTCOIN.getCode())) {
} else if (!getCurrencyCode().equals(GUIUtil.TOP_CRYPTO.getCode())) {
preferences.setSellScreenCryptoCurrencyCode(getCurrencyCode());
}
}

View file

@ -20,8 +20,9 @@ package haveno.desktop.main.market.spread;
import com.google.inject.Inject;
import haveno.common.UserThread;
import haveno.core.locale.Res;
import haveno.core.monetary.Altcoin;
import haveno.core.monetary.CryptoMoney;
import haveno.core.monetary.Price;
import haveno.core.monetary.TraditionalMoney;
import haveno.core.offer.Offer;
import haveno.core.offer.OfferDirection;
import haveno.core.provider.price.MarketPrice;
@ -41,7 +42,6 @@ import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import lombok.Getter;
import lombok.Setter;
import org.bitcoinj.utils.Fiat;
import javax.inject.Named;
import java.math.BigDecimal;
@ -133,7 +133,7 @@ class SpreadViewModel extends ActivatableViewModel {
for (String key : offersByCurrencyMap.keySet()) {
List<Offer> offers = offersByCurrencyMap.get(key);
boolean isFiatCurrency = (offers.size() > 0 && offers.get(0).getPaymentMethod().isFiat());
boolean iTraditionalCurrency = (offers.size() > 0 && offers.get(0).getPaymentMethod().isTraditional());
List<Offer> uniqueOffers = offers.stream().filter(distinctByKey(Offer::getId)).collect(Collectors.toList());
@ -144,7 +144,7 @@ class SpreadViewModel extends ActivatableViewModel {
long a = o1.getPrice() != null ? o1.getPrice().getValue() : 0;
long b = o2.getPrice() != null ? o2.getPrice().getValue() : 0;
if (a != b) {
if (isFiatCurrency) {
if (iTraditionalCurrency) {
return a < b ? 1 : -1;
} else {
return a < b ? -1 : 1;
@ -161,7 +161,7 @@ class SpreadViewModel extends ActivatableViewModel {
long a = o1.getPrice() != null ? o1.getPrice().getValue() : 0;
long b = o2.getPrice() != null ? o2.getPrice().getValue() : 0;
if (a != b) {
if (isFiatCurrency) {
if (iTraditionalCurrency) {
return a > b ? 1 : -1;
} else {
return a > b ? -1 : 1;
@ -184,7 +184,7 @@ class SpreadViewModel extends ActivatableViewModel {
// We never found out which offer it was. So add here a try/catch to get better info if it
// happens again
try {
if (isFiatCurrency)
if (iTraditionalCurrency)
spread = bestSellOfferPrice.subtract(bestBuyOfferPrice);
else
spread = bestBuyOfferPrice.subtract(bestSellOfferPrice);
@ -194,9 +194,9 @@ class SpreadViewModel extends ActivatableViewModel {
if (spread != null && marketPrice != null && marketPrice.isPriceAvailable()) {
double marketPriceAsDouble = marketPrice.getPrice();
final double precision = isFiatCurrency ?
Math.pow(10, Fiat.SMALLEST_UNIT_EXPONENT) :
Math.pow(10, Altcoin.SMALLEST_UNIT_EXPONENT);
final double precision = iTraditionalCurrency ?
Math.pow(10, TraditionalMoney.SMALLEST_UNIT_EXPONENT) :
Math.pow(10, CryptoMoney.SMALLEST_UNIT_EXPONENT);
BigDecimal marketPriceAsBigDecimal = BigDecimal.valueOf(marketPriceAsDouble)
.multiply(BigDecimal.valueOf(precision));

View file

@ -20,7 +20,7 @@ package haveno.desktop.main.market.trades;
import com.google.common.annotations.VisibleForTesting;
import haveno.common.util.MathUtils;
import haveno.core.locale.CurrencyUtil;
import haveno.core.monetary.Altcoin;
import haveno.core.monetary.CryptoMoney;
import haveno.core.trade.statistics.TradeStatistics3;
import haveno.desktop.main.market.trades.charts.CandleData;
import haveno.desktop.util.DisplayUtils;
@ -262,7 +262,7 @@ public class ChartCalculations {
boolean isBullish;
if (CurrencyUtil.isCryptoCurrency(currencyCode)) {
isBullish = close < open;
double accumulatedAmountAsDouble = MathUtils.scaleUpByPowerOf10((double) accumulatedAmount, Altcoin.SMALLEST_UNIT_EXPONENT);
double accumulatedAmountAsDouble = MathUtils.scaleUpByPowerOf10((double) accumulatedAmount, CryptoMoney.SMALLEST_UNIT_EXPONENT);
averagePrice = MathUtils.roundDoubleToLong(accumulatedAmountAsDouble / accumulatedVolume);
} else {
isBullish = close > open;

View file

@ -255,12 +255,12 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
@NotNull
private Optional<PaymentAccount> getAnyPaymentAccount() {
if (CurrencyUtil.isFiatCurrency(tradeCurrency.getCode())) {
return paymentAccounts.stream().filter(paymentAccount1 -> !paymentAccount1.getPaymentMethod().isAltcoin()).findAny();
if (CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode())) {
return paymentAccounts.stream().filter(paymentAccount1 -> !paymentAccount1.getPaymentMethod().isCrypto()).findAny();
} else {
return paymentAccounts.stream().filter(paymentAccount1 -> paymentAccount1.getPaymentMethod().isAltcoin() &&
return paymentAccounts.stream().filter(paymentAccount1 -> paymentAccount1.getPaymentMethod().isCrypto() &&
paymentAccount1.getTradeCurrency().isPresent() &&
!Objects.equals(paymentAccount1.getTradeCurrency().get().getCode(), GUIUtil.TOP_ALTCOIN.getCode())).findAny();
!Objects.equals(paymentAccount1.getTradeCurrency().get().getCode(), GUIUtil.TOP_CRYPTO.getCode())).findAny();
}
}
@ -384,7 +384,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
if (CurrencyUtil.isCryptoCurrency(code)) {
CurrencyUtil.getCryptoCurrency(code).ifPresent(preferences::addCryptoCurrency);
} else {
CurrencyUtil.getFiatCurrency(code).ifPresent(preferences::addFiatCurrency);
CurrencyUtil.getTraditionalCurrency(code).ifPresent(preferences::addTraditionalCurrency);
}
}
}
@ -617,7 +617,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
}
boolean isFiatCurrency() {
return CurrencyUtil.isFiatCurrency(tradeCurrencyCode.get());
return CurrencyUtil.isTraditionalCurrency(tradeCurrencyCode.get());
}
ReadOnlyBooleanProperty getUseMarketBasedPrice() {

View file

@ -49,7 +49,7 @@ import haveno.desktop.components.InputTextField;
import haveno.desktop.components.TitledGroupBg;
import haveno.desktop.main.MainView;
import haveno.desktop.main.account.AccountView;
import haveno.desktop.main.account.content.fiataccounts.FiatAccountsView;
import haveno.desktop.main.account.content.traditionalaccounts.TraditionalAccountsView;
import haveno.desktop.main.overlays.notifications.Notification;
import haveno.desktop.main.overlays.popups.Popup;
import haveno.desktop.main.overlays.windows.OfferDetailsWindow;
@ -295,7 +295,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
.actionButtonTextWithGoTo("navigation.account")
.onAction(() -> {
navigation.setReturnPath(navigation.getCurrentPath());
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
}).show();
}
@ -303,19 +303,19 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
if (OfferViewUtil.isShownAsBuyOffer(direction, tradeCurrency)) {
placeOfferButton.setId("buy-button-big");
if (CurrencyUtil.isFiatCurrency(tradeCurrency.getCode())) {
if (CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode())) {
placeOfferButtonLabel = Res.get("createOffer.placeOfferButton", Res.get("shared.buy"));
} else {
placeOfferButtonLabel = Res.get("createOffer.placeOfferButtonAltcoin", Res.get("shared.buy"), tradeCurrency.getCode());
placeOfferButtonLabel = Res.get("createOffer.placeOfferButtonCrypto", Res.get("shared.buy"), tradeCurrency.getCode());
}
nextButton.setId("buy-button");
fundFromSavingsWalletButton.setId("buy-button");
} else {
placeOfferButton.setId("sell-button-big");
if (CurrencyUtil.isFiatCurrency(tradeCurrency.getCode())) {
if (CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode())) {
placeOfferButtonLabel = Res.get("createOffer.placeOfferButton", Res.get("shared.sell"));
} else {
placeOfferButtonLabel = Res.get("createOffer.placeOfferButtonAltcoin", Res.get("shared.sell"), tradeCurrency.getCode());
placeOfferButtonLabel = Res.get("createOffer.placeOfferButtonCrypto", Res.get("shared.sell"), tradeCurrency.getCode());
}
nextButton.setId("sell-button");
fundFromSavingsWalletButton.setId("sell-button");
@ -695,12 +695,12 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
marketBasedPriceTextField.clear();
volumeTextField.clear();
triggerPriceInputTextField.clear();
if (!CurrencyUtil.isFiatCurrency(newValue)) {
if (!CurrencyUtil.isTraditionalCurrency(newValue)) {
if (model.isShownAsBuyOffer()) {
placeOfferButton.updateText(Res.get("createOffer.placeOfferButtonAltcoin", Res.get("shared.buy"),
placeOfferButton.updateText(Res.get("createOffer.placeOfferButtonCrypto", Res.get("shared.buy"),
model.getTradeCurrency().getCode()));
} else {
placeOfferButton.updateText(Res.get("createOffer.placeOfferButtonAltcoin", Res.get("shared.sell"),
placeOfferButton.updateText(Res.get("createOffer.placeOfferButtonCrypto", Res.get("shared.sell"),
model.getTradeCurrency().getCode()));
}
}
@ -1251,9 +1251,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
int marketPriceAvailable = model.marketPriceAvailableProperty.get();
fixedPriceSelected = fixedPriceSelected || (marketPriceAvailable == 0);
if (marketPriceAvailable == 1) {
model.getDataModel().setUseMarketBasedPrice(!fixedPriceSelected);
}
model.getDataModel().setUseMarketBasedPrice(marketPriceAvailable == 1 && !fixedPriceSelected);
percentagePriceBox.setDisable(fixedPriceSelected);
fixedPriceBox.setDisable(!fixedPriceSelected);
@ -1284,7 +1282,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
}
private void addSecondRow() {
// price as fiat
// price as traditional currency
Tuple3<HBox, InputTextField, Label> priceValueCurrencyBoxTuple = getEditableValueBox(
Res.get("createOffer.price.prompt"));
priceValueCurrencyBox = priceValueCurrencyBoxTuple.first;

View file

@ -24,8 +24,9 @@ import haveno.core.account.witness.AccountAgeWitnessService;
import haveno.core.locale.CurrencyUtil;
import haveno.core.locale.Res;
import haveno.core.locale.TradeCurrency;
import haveno.core.monetary.Altcoin;
import haveno.core.monetary.CryptoMoney;
import haveno.core.monetary.Price;
import haveno.core.monetary.TraditionalMoney;
import haveno.core.monetary.Volume;
import haveno.core.offer.Offer;
import haveno.core.offer.OfferDirection;
@ -46,7 +47,7 @@ import haveno.core.util.PriceUtil;
import haveno.core.util.VolumeUtil;
import haveno.core.util.coin.CoinFormatter;
import haveno.core.util.coin.CoinUtil;
import haveno.core.util.validation.AltcoinValidator;
import haveno.core.util.validation.NonFiatPriceValidator;
import haveno.core.util.validation.FiatPriceValidator;
import haveno.core.util.validation.InputValidator;
import haveno.core.util.validation.MonetaryValidator;
@ -76,7 +77,6 @@ import javafx.scene.control.ListView;
import javafx.util.Callback;
import lombok.extern.slf4j.Slf4j;
import org.bitcoinj.core.Coin;
import org.bitcoinj.utils.Fiat;
import javax.inject.Inject;
import javax.inject.Named;
@ -96,7 +96,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
protected final CoinFormatter btcFormatter;
private final FiatVolumeValidator fiatVolumeValidator;
private final FiatPriceValidator fiatPriceValidator;
private final AltcoinValidator altcoinValidator;
private final NonFiatPriceValidator nonFiatPriceValidator;
protected final OfferUtil offerUtil;
private String amountDescription;
@ -110,7 +110,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
final StringProperty buyerSecurityDepositInBTC = new SimpleStringProperty();
final StringProperty buyerSecurityDepositLabel = new SimpleStringProperty();
// Price in the viewModel is always dependent on fiat/altcoin: Fiat Fiat/BTC, for altcoins we use inverted price.
// Price in the viewModel is always dependent on fiat/crypto: Fiat Fiat/BTC, for cryptos we use inverted price.
// The domain (dataModel) uses always the same price model (otherCurrencyBTC)
// If we would change the price representation in the domain we would not be backward compatible
public final StringProperty price = new SimpleStringProperty();
@ -123,7 +123,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
// Positive % value means always a better price form the maker's perspective:
// Buyer (with fiat): lower price as market
// Buyer (with altcoin): higher (display) price as market (display price is inverted)
// Buyer (with crypto): higher (display) price as market (display price is inverted)
public final StringProperty marketPriceMargin = new SimpleStringProperty();
public final StringProperty volume = new SimpleStringProperty();
final StringProperty volumeDescriptionLabel = new SimpleStringProperty();
@ -184,7 +184,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
public MutableOfferViewModel(M dataModel,
FiatVolumeValidator fiatVolumeValidator,
FiatPriceValidator fiatPriceValidator,
AltcoinValidator altcoinValidator,
NonFiatPriceValidator nonFiatPriceValidator,
XmrValidator btcValidator,
SecurityDepositValidator securityDepositValidator,
PriceFeedService priceFeedService,
@ -197,7 +197,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
this.fiatVolumeValidator = fiatVolumeValidator;
this.fiatPriceValidator = fiatPriceValidator;
this.altcoinValidator = altcoinValidator;
this.nonFiatPriceValidator = nonFiatPriceValidator;
this.xmrValidator = btcValidator;
this.securityDepositValidator = securityDepositValidator;
this.priceFeedService = priceFeedService;
@ -251,15 +251,15 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
private void addBindings() {
if (dataModel.getDirection() == OfferDirection.BUY) {
volumeDescriptionLabel.bind(createStringBinding(
() -> Res.get(CurrencyUtil.isFiatCurrency(dataModel.getTradeCurrencyCode().get()) ?
() -> Res.get(CurrencyUtil.isTraditionalCurrency(dataModel.getTradeCurrencyCode().get()) ?
"createOffer.amountPriceBox.buy.volumeDescription" :
"createOffer.amountPriceBox.buy.volumeDescriptionAltcoin", dataModel.getTradeCurrencyCode().get()),
"createOffer.amountPriceBox.buy.volumeDescriptionCrypto", dataModel.getTradeCurrencyCode().get()),
dataModel.getTradeCurrencyCode()));
} else {
volumeDescriptionLabel.bind(createStringBinding(
() -> Res.get(CurrencyUtil.isFiatCurrency(dataModel.getTradeCurrencyCode().get()) ?
() -> Res.get(CurrencyUtil.isTraditionalCurrency(dataModel.getTradeCurrencyCode().get()) ?
"createOffer.amountPriceBox.sell.volumeDescription" :
"createOffer.amountPriceBox.sell.volumeDescriptionAltcoin", dataModel.getTradeCurrencyCode().get()),
"createOffer.amountPriceBox.sell.volumeDescriptionCrypto", dataModel.getTradeCurrencyCode().get()),
dataModel.getTradeCurrencyCode()));
}
volumePromptLabel.bind(createStringBinding(
@ -357,16 +357,15 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
if (marketPrice != null && marketPrice.isRecentExternalPriceAvailable()) {
percentage = MathUtils.roundDouble(percentage, 4);
double marketPriceAsDouble = marketPrice.getPrice();
final boolean isCryptoCurrency = CurrencyUtil.isCryptoCurrency(currencyCode);
final OfferDirection compareDirection = isCryptoCurrency ?
final OfferDirection compareDirection = CurrencyUtil.isCryptoCurrency(currencyCode) ?
OfferDirection.SELL :
OfferDirection.BUY;
double factor = dataModel.getDirection() == compareDirection ?
1 - percentage :
1 + percentage;
double targetPrice = marketPriceAsDouble * factor;
int precision = isCryptoCurrency ?
Altcoin.SMALLEST_UNIT_EXPONENT : Fiat.SMALLEST_UNIT_EXPONENT;
int precision = CurrencyUtil.isTraditionalCurrency(currencyCode) ?
TraditionalMoney.SMALLEST_UNIT_EXPONENT : CryptoMoney.SMALLEST_UNIT_EXPONENT;
// protect from triggering unwanted updates
ignorePriceStringListener = true;
price.set(FormattingUtils.formatRoundedDoubleWithPrecision(targetPrice, precision));
@ -575,14 +574,14 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
final boolean isBuy = dataModel.getDirection() == OfferDirection.BUY;
boolean isFiatCurrency = CurrencyUtil.isFiatCurrency(tradeCurrency.getCode());
boolean isFiatCurrency = CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode());
if (isFiatCurrency) {
amountDescription = Res.get("createOffer.amountPriceBox.amountDescription",
isBuy ? Res.get("shared.buy") : Res.get("shared.sell"));
} else {
amountDescription = Res.get(isBuy ? "createOffer.amountPriceBox.sell.amountDescriptionAltcoin" :
"createOffer.amountPriceBox.buy.amountDescriptionAltcoin");
amountDescription = Res.get(isBuy ? "createOffer.amountPriceBox.sell.amountDescriptionCrypto" :
"createOffer.amountPriceBox.buy.amountDescriptionCrypto");
}
securityDepositValidator.setPaymentAccount(dataModel.paymentAccount);
@ -1183,15 +1182,15 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
}
private MonetaryValidator getPriceValidator() {
return CurrencyUtil.isCryptoCurrency(getTradeCurrency().getCode()) ? altcoinValidator : fiatPriceValidator;
return CurrencyUtil.isFiatCurrency(getTradeCurrency().getCode()) ? fiatPriceValidator : nonFiatPriceValidator;
}
private MonetaryValidator getVolumeValidator() {
final String code = getTradeCurrency().getCode();
if (CurrencyUtil.isCryptoCurrency(code)) {
return altcoinValidator;
} else {
if (CurrencyUtil.isFiatCurrency(code)) {
return fiatVolumeValidator;
} else {
return nonFiatPriceValidator;
}
}
@ -1253,9 +1252,8 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
double volumeAsDouble = ParsingUtils.parseNumberStringToDouble(volume.get());
double manualPriceAsDouble = dataModel.calculateMarketPriceManual(marketPriceAsDouble, volumeAsDouble, amountAsDouble);
final boolean isCryptoCurrency = CurrencyUtil.isCryptoCurrency(currencyCode);
int precision = isCryptoCurrency ?
Altcoin.SMALLEST_UNIT_EXPONENT : Fiat.SMALLEST_UNIT_EXPONENT;
int precision = CurrencyUtil.isTraditionalCurrency(currencyCode) ?
TraditionalMoney.SMALLEST_UNIT_EXPONENT : CryptoMoney.SMALLEST_UNIT_EXPONENT;
price.set(FormattingUtils.formatRoundedDoubleWithPrecision(manualPriceAsDouble, precision));
setPriceToModel();
dataModel.calculateTotalToPay();

View file

@ -36,7 +36,7 @@ import haveno.desktop.main.offer.createoffer.CreateOfferView;
import haveno.desktop.main.offer.offerbook.BtcOfferBookView;
import haveno.desktop.main.offer.offerbook.OfferBookView;
import haveno.desktop.main.offer.offerbook.OtherOfferBookView;
import haveno.desktop.main.offer.offerbook.TopAltcoinOfferBookView;
import haveno.desktop.main.offer.offerbook.TopCryptoOfferBookView;
import haveno.desktop.main.offer.takeoffer.TakeOfferView;
import haveno.desktop.util.GUIUtil;
import haveno.network.p2p.P2PService;
@ -50,9 +50,9 @@ import java.util.Optional;
public abstract class OfferView extends ActivatableView<TabPane, Void> {
private OfferBookView<?, ?> btcOfferBookView, topAltcoinOfferBookView, otherOfferBookView;
private OfferBookView<?, ?> btcOfferBookView, topCryptoOfferBookView, otherOfferBookView;
private Tab btcOfferBookTab, topAltcoinOfferBookTab, otherOfferBookTab;
private Tab btcOfferBookTab, topCryptoOfferBookTab, otherOfferBookTab;
private final ViewLoader viewLoader;
private final Navigation navigation;
@ -101,11 +101,11 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
} else {
loadView(BtcOfferBookView.class, null, null);
}
} else if (newValue.equals(topAltcoinOfferBookTab)) {
if (topAltcoinOfferBookView != null) {
topAltcoinOfferBookView.onTabSelected(true);
} else if (newValue.equals(topCryptoOfferBookTab)) {
if (topCryptoOfferBookView != null) {
topCryptoOfferBookView.onTabSelected(true);
} else {
loadView(TopAltcoinOfferBookView.class, null, null);
loadView(TopCryptoOfferBookView.class, null, null);
}
} else if (newValue.equals(otherOfferBookTab)) {
if (otherOfferBookView != null) {
@ -118,8 +118,8 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
if (oldValue != null) {
if (oldValue.equals(btcOfferBookTab) && btcOfferBookView != null) {
btcOfferBookView.onTabSelected(false);
} else if (oldValue.equals(topAltcoinOfferBookTab) && topAltcoinOfferBookView != null) {
topAltcoinOfferBookView.onTabSelected(false);
} else if (oldValue.equals(topCryptoOfferBookTab) && topCryptoOfferBookView != null) {
topCryptoOfferBookView.onTabSelected(false);
} else if (oldValue.equals(otherOfferBookTab) && otherOfferBookView != null) {
otherOfferBookView.onTabSelected(false);
}
@ -158,10 +158,10 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
navigation.navigateTo(MainView.class, this.getClass(), BtcOfferBookView.class);
}
GUIUtil.updateTopAltcoin(preferences);
GUIUtil.updateTopCrypto(preferences);
if (topAltcoinOfferBookTab != null) {
topAltcoinOfferBookTab.setText(GUIUtil.TOP_ALTCOIN.getCode());
if (topCryptoOfferBookTab != null) {
topCryptoOfferBookTab.setText(GUIUtil.TOP_CRYPTO.getCode());
}
}
@ -188,16 +188,16 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
loadCreateViewClass(btcOfferBookView, viewClass, childViewClass, btcOfferBookTab, (PaymentMethod) data);
}
tabPane.getSelectionModel().select(btcOfferBookTab);
} else if (viewClass == TopAltcoinOfferBookView.class && topAltcoinOfferBookTab != null && topAltcoinOfferBookView != null) {
} else if (viewClass == TopCryptoOfferBookView.class && topCryptoOfferBookTab != null && topCryptoOfferBookView != null) {
if (childViewClass == null) {
topAltcoinOfferBookTab.setContent(topAltcoinOfferBookView.getRoot());
topCryptoOfferBookTab.setContent(topCryptoOfferBookView.getRoot());
} else if (childViewClass == TakeOfferView.class) {
loadTakeViewClass(viewClass, childViewClass, topAltcoinOfferBookTab);
loadTakeViewClass(viewClass, childViewClass, topCryptoOfferBookTab);
} else {
tradeCurrency = GUIUtil.TOP_ALTCOIN;
loadCreateViewClass(topAltcoinOfferBookView, viewClass, childViewClass, topAltcoinOfferBookTab, (PaymentMethod) data);
tradeCurrency = GUIUtil.TOP_CRYPTO;
loadCreateViewClass(topCryptoOfferBookView, viewClass, childViewClass, topCryptoOfferBookTab, (PaymentMethod) data);
}
tabPane.getSelectionModel().select(topAltcoinOfferBookTab);
tabPane.getSelectionModel().select(topCryptoOfferBookTab);
} else if (viewClass == OtherOfferBookView.class && otherOfferBookTab != null && otherOfferBookView != null) {
if (childViewClass == null) {
otherOfferBookTab.setContent(otherOfferBookView.getRoot());
@ -205,7 +205,7 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
loadTakeViewClass(viewClass, childViewClass, otherOfferBookTab);
} else {
//add sanity check in case of app restart
if (CurrencyUtil.isFiatCurrency(tradeCurrency.getCode())) {
if (CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode())) {
Optional<TradeCurrency> tradeCurrencyOptional = (this.direction == OfferDirection.SELL) ?
CurrencyUtil.getTradeCurrency(preferences.getSellScreenCryptoCurrencyCode()) :
CurrencyUtil.getTradeCurrency(preferences.getBuyScreenCryptoCurrencyCode());
@ -218,12 +218,12 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
if (btcOfferBookTab == null) {
btcOfferBookTab = new Tab(Res.getBaseCurrencyName().toUpperCase());
btcOfferBookTab.setClosable(false);
topAltcoinOfferBookTab = new Tab(GUIUtil.TOP_ALTCOIN.getCode());
topAltcoinOfferBookTab.setClosable(false);
topCryptoOfferBookTab = new Tab(GUIUtil.TOP_CRYPTO.getCode());
topCryptoOfferBookTab.setClosable(false);
otherOfferBookTab = new Tab(Res.get("shared.other").toUpperCase());
otherOfferBookTab.setClosable(false);
tabPane.getTabs().addAll(btcOfferBookTab, topAltcoinOfferBookTab, otherOfferBookTab);
tabPane.getTabs().addAll(btcOfferBookTab, topCryptoOfferBookTab, otherOfferBookTab);
}
if (viewClass == BtcOfferBookView.class) {
btcOfferBookView = (BtcOfferBookView) viewLoader.load(BtcOfferBookView.class);
@ -232,13 +232,13 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
btcOfferBookView.onTabSelected(true);
tabPane.getSelectionModel().select(btcOfferBookTab);
btcOfferBookTab.setContent(btcOfferBookView.getRoot());
} else if (viewClass == TopAltcoinOfferBookView.class) {
topAltcoinOfferBookView = (TopAltcoinOfferBookView) viewLoader.load(TopAltcoinOfferBookView.class);
topAltcoinOfferBookView.setOfferActionHandler(offerActionHandler);
topAltcoinOfferBookView.setDirection(direction);
topAltcoinOfferBookView.onTabSelected(true);
tabPane.getSelectionModel().select(topAltcoinOfferBookTab);
topAltcoinOfferBookTab.setContent(topAltcoinOfferBookView.getRoot());
} else if (viewClass == TopCryptoOfferBookView.class) {
topCryptoOfferBookView = (TopCryptoOfferBookView) viewLoader.load(TopCryptoOfferBookView.class);
topCryptoOfferBookView.setOfferActionHandler(offerActionHandler);
topCryptoOfferBookView.setDirection(direction);
topCryptoOfferBookView.onTabSelected(true);
tabPane.getSelectionModel().select(topCryptoOfferBookTab);
topCryptoOfferBookTab.setContent(topCryptoOfferBookView.getRoot());
} else if (viewClass == OtherOfferBookView.class) {
otherOfferBookView = (OtherOfferBookView) viewLoader.load(OtherOfferBookView.class);
otherOfferBookView.setOfferActionHandler(offerActionHandler);
@ -323,10 +323,10 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
@NotNull
private Class<? extends OfferBookView<?, ?>> getOfferBookViewClassFor(String currencyCode) {
Class<? extends OfferBookView<?, ?>> offerBookViewClass;
if (CurrencyUtil.isFiatCurrency(currencyCode)) {
if (CurrencyUtil.isTraditionalCurrency(currencyCode)) {
offerBookViewClass = BtcOfferBookView.class;
} else if (currencyCode.equals(GUIUtil.TOP_ALTCOIN.getCode())) {
offerBookViewClass = TopAltcoinOfferBookView.class;
} else if (currencyCode.equals(GUIUtil.TOP_CRYPTO.getCode())) {
offerBookViewClass = TopCryptoOfferBookView.class;
} else {
offerBookViewClass = OtherOfferBookView.class;
}

View file

@ -33,7 +33,7 @@ import haveno.desktop.components.HyperlinkWithIcon;
import haveno.desktop.main.offer.offerbook.BtcOfferBookView;
import haveno.desktop.main.offer.offerbook.OfferBookView;
import haveno.desktop.main.offer.offerbook.OtherOfferBookView;
import haveno.desktop.main.offer.offerbook.TopAltcoinOfferBookView;
import haveno.desktop.main.offer.offerbook.TopCryptoOfferBookView;
import haveno.desktop.main.overlays.popups.Popup;
import haveno.desktop.util.GUIUtil;
import javafx.geometry.HPos;
@ -126,10 +126,10 @@ public class OfferViewUtil {
public static Class<? extends OfferBookView<?, ?>> getOfferBookViewClass(String currencyCode) {
Class<? extends OfferBookView<?, ?>> offerBookViewClazz;
if (CurrencyUtil.isFiatCurrency(currencyCode)) {
if (CurrencyUtil.isTraditionalCurrency(currencyCode)) {
offerBookViewClazz = BtcOfferBookView.class;
} else if (currencyCode.equals(GUIUtil.TOP_ALTCOIN.getCode())) {
offerBookViewClazz = TopAltcoinOfferBookView.class;
} else if (currencyCode.equals(GUIUtil.TOP_CRYPTO.getCode())) {
offerBookViewClazz = TopCryptoOfferBookView.class;
} else {
offerBookViewClazz = OtherOfferBookView.class;
}
@ -145,7 +145,7 @@ public class OfferViewUtil {
}
public static boolean isShownAsSellOffer(String currencyCode, OfferDirection direction) {
return CurrencyUtil.isFiatCurrency(currencyCode) == (direction == OfferDirection.SELL);
return CurrencyUtil.isTraditionalCurrency(currencyCode) == (direction == OfferDirection.SELL);
}
public static boolean isShownAsBuyOffer(Offer offer) {
@ -163,7 +163,7 @@ public class OfferViewUtil {
@NotNull
public static Stream<CryptoCurrency> getMainCryptoCurrencies() {
return CurrencyUtil.getMainCryptoCurrencies().stream().filter(cryptoCurrency ->
!Objects.equals(cryptoCurrency.getCode(), GUIUtil.TOP_ALTCOIN.getCode()));
!Objects.equals(cryptoCurrency.getCode(), GUIUtil.TOP_CRYPTO.getCode()));
}
public static void submitTransactionHex(XmrWalletService xmrWalletService,

View file

@ -55,7 +55,7 @@ public class CreateOfferView extends MutableOfferView<CreateOfferViewModel> {
TradeCurrency tradeCurrency,
OfferView.OfferActionHandler offerActionHandler) {
// Invert direction for non-Fiat trade currencies -> BUY BSQ is to SELL Bitcoin
OfferDirection offerDirection = CurrencyUtil.isFiatCurrency(tradeCurrency.getCode()) ? direction :
OfferDirection offerDirection = CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode()) ? direction :
direction == OfferDirection.BUY ? OfferDirection.SELL : OfferDirection.BUY;
super.initWithData(offerDirection, tradeCurrency, offerActionHandler);
}
@ -64,13 +64,13 @@ public class CreateOfferView extends MutableOfferView<CreateOfferViewModel> {
protected ObservableList<PaymentAccount> filterPaymentAccounts(ObservableList<PaymentAccount> paymentAccounts) {
return FXCollections.observableArrayList(
paymentAccounts.stream().filter(paymentAccount -> {
if (model.getTradeCurrency().equals(GUIUtil.TOP_ALTCOIN)) {
return Objects.equals(paymentAccount.getSingleTradeCurrency(), GUIUtil.TOP_ALTCOIN);
} else if (CurrencyUtil.isFiatCurrency(model.getTradeCurrency().getCode())) {
return !paymentAccount.getPaymentMethod().isAltcoin();
if (model.getTradeCurrency().equals(GUIUtil.TOP_CRYPTO)) {
return Objects.equals(paymentAccount.getSingleTradeCurrency(), GUIUtil.TOP_CRYPTO);
} else if (CurrencyUtil.isTraditionalCurrency(model.getTradeCurrency().getCode())) {
return !paymentAccount.getPaymentMethod().isCrypto();
} else {
return paymentAccount.getPaymentMethod().isAltcoin() &&
!Objects.equals(paymentAccount.getSingleTradeCurrency(), GUIUtil.TOP_ALTCOIN);
return paymentAccount.getPaymentMethod().isCrypto() &&
!Objects.equals(paymentAccount.getSingleTradeCurrency(), GUIUtil.TOP_CRYPTO);
}
}).collect(Collectors.toList()));
}

View file

@ -27,7 +27,7 @@ import haveno.core.provider.price.PriceFeedService;
import haveno.core.user.Preferences;
import haveno.core.util.FormattingUtils;
import haveno.core.util.coin.CoinFormatter;
import haveno.core.util.validation.AltcoinValidator;
import haveno.core.util.validation.NonFiatPriceValidator;
import haveno.core.util.validation.FiatPriceValidator;
import haveno.desktop.Navigation;
import haveno.desktop.common.model.ViewModel;
@ -41,7 +41,7 @@ class CreateOfferViewModel extends MutableOfferViewModel<CreateOfferDataModel> i
public CreateOfferViewModel(CreateOfferDataModel dataModel,
FiatVolumeValidator fiatVolumeValidator,
FiatPriceValidator fiatPriceValidator,
AltcoinValidator altcoinValidator,
NonFiatPriceValidator nonFiatPriceValidator,
XmrValidator btcValidator,
SecurityDepositValidator securityDepositValidator,
PriceFeedService priceFeedService,
@ -53,7 +53,7 @@ class CreateOfferViewModel extends MutableOfferViewModel<CreateOfferDataModel> i
super(dataModel,
fiatVolumeValidator,
fiatPriceValidator,
altcoinValidator,
nonFiatPriceValidator,
btcValidator,
securityDepositValidator,
priceFeedService,

View file

@ -51,8 +51,8 @@ public class BtcOfferBookView extends OfferBookView<GridPane, BtcOfferBookViewMo
@Override
protected String getMarketTitle() {
return model.getDirection().equals(OfferDirection.BUY) ?
Res.get("offerbook.availableOffersToBuy", Res.getBaseCurrencyCode(), Res.get("shared.fiat")) :
Res.get("offerbook.availableOffersToSell", Res.getBaseCurrencyCode(), Res.get("shared.fiat"));
Res.get("offerbook.availableOffersToBuy", Res.getBaseCurrencyCode(), Res.get("shared.traditional")) :
Res.get("offerbook.availableOffersToSell", Res.getBaseCurrencyCode(), Res.get("shared.traditional"));
}

View file

@ -84,9 +84,9 @@ public class BtcOfferBookViewModel extends OfferBookViewModel {
return FXCollections.observableArrayList(list.stream()
.filter(paymentMethod -> {
if (showAllTradeCurrenciesProperty.get()) {
return paymentMethod.isFiat();
return paymentMethod.isTraditional();
}
return paymentMethod.isFiat() &&
return paymentMethod.isTraditional() &&
PaymentAccountUtil.supportsCurrency(paymentMethod, selectedTradeCurrency);
})
.collect(Collectors.toList()));
@ -97,11 +97,11 @@ public class BtcOfferBookViewModel extends OfferBookViewModel {
ObservableList<TradeCurrency> allCurrencies) {
// Used for ignoring filter (show all)
tradeCurrencies.add(new CryptoCurrency(GUIUtil.SHOW_ALL_FLAG, ""));
tradeCurrencies.addAll(preferences.getFiatCurrenciesAsObservable());
tradeCurrencies.addAll(preferences.getTraditionalCurrenciesAsObservable());
tradeCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, ""));
allCurrencies.add(new CryptoCurrency(GUIUtil.SHOW_ALL_FLAG, ""));
allCurrencies.addAll(CurrencyUtil.getAllSortedFiatCurrencies());
allCurrencies.addAll(CurrencyUtil.getAllSortedTraditionalCurrencies());
allCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, ""));
}
@ -111,7 +111,7 @@ public class BtcOfferBookViewModel extends OfferBookViewModel {
return offerBookListItem -> {
Offer offer = offerBookListItem.getOffer();
boolean directionResult = offer.getDirection() != direction;
boolean currencyResult = (showAllTradeCurrenciesProperty.get() && offer.isFiatOffer()) ||
boolean currencyResult = (showAllTradeCurrenciesProperty.get() && offer.isTraditionalOffer()) ||
offer.getCurrencyCode().equals(selectedTradeCurrency.getCode());
boolean paymentMethodResult = showAllPaymentMethods ||
offer.getPaymentMethod().equals(selectedPaymentMethod);
@ -124,7 +124,7 @@ public class BtcOfferBookViewModel extends OfferBookViewModel {
TradeCurrency getDefaultTradeCurrency() {
TradeCurrency defaultTradeCurrency = GlobalSettings.getDefaultTradeCurrency();
if (CurrencyUtil.isFiatCurrency(defaultTradeCurrency.getCode()) && hasPaymentAccountForCurrency(defaultTradeCurrency)) {
if (CurrencyUtil.isTraditionalCurrency(defaultTradeCurrency.getCode()) && hasPaymentAccountForCurrency(defaultTradeCurrency)) {
return defaultTradeCurrency;
}
@ -137,7 +137,7 @@ public class BtcOfferBookViewModel extends OfferBookViewModel {
!hasPaymentAccountForCurrency(o2))).collect(Collectors.toList());
return sortedList.get(0);
} else {
return CurrencyUtil.getMainFiatCurrencies().stream().sorted((o1, o2) ->
return CurrencyUtil.getMainTraditionalCurrencies().stream().sorted((o1, o2) ->
Boolean.compare(!hasPaymentAccountForCurrency(o1),
!hasPaymentAccountForCurrency(o2))).collect(Collectors.toList()).get(0);
}
@ -148,6 +148,6 @@ public class BtcOfferBookViewModel extends OfferBookViewModel {
// validate if previous stored currencies are Fiat ones
String currencyCode = direction == OfferDirection.BUY ? preferences.getBuyScreenCurrencyCode() : preferences.getSellScreenCurrencyCode();
return CurrencyUtil.isFiatCurrency(currencyCode) ? currencyCode : null;
return CurrencyUtil.isTraditionalCurrency(currencyCode) ? currencyCode : null;
}
}

View file

@ -68,7 +68,7 @@ public class OfferBookListItem {
SignedWitnessService signedWitnessService) {
if (witnessAgeData == null) {
if (CurrencyUtil.isCryptoCurrency(offer.getCurrencyCode())) {
witnessAgeData = new WitnessAgeData(WitnessAgeData.TYPE_ALTCOINS);
witnessAgeData = new WitnessAgeData(WitnessAgeData.TYPE_CRYPTOS);
} else if (PaymentMethod.hasChargebackRisk(offer.getPaymentMethod(), offer.getCurrencyCode())) {
// Fiat and signed witness required
Optional<AccountAgeWitness> optionalWitness = accountAgeWitnessService.findWitness(offer);
@ -128,7 +128,7 @@ public class OfferBookListItem {
public static final long TYPE_SIGNED_OR_BANNED = 3L;
public static final long TYPE_NOT_SIGNED = 2L;
public static final long TYPE_NOT_SIGNING_REQUIRED = 1L;
public static final long TYPE_ALTCOINS = 0L;
public static final long TYPE_CRYPTOS = 0L;
public WitnessAgeData(long type) {
this(type, 0, null);
@ -175,7 +175,7 @@ public class OfferBookListItem {
}
public boolean isSigningRequired() {
return this.type != TYPE_NOT_SIGNING_REQUIRED && this.type != TYPE_ALTCOINS;
return this.type != TYPE_NOT_SIGNING_REQUIRED && this.type != TYPE_CRYPTOS;
}
@Override

View file

@ -54,8 +54,8 @@ import haveno.desktop.components.PeerInfoIconTrading;
import haveno.desktop.components.TitledGroupBg;
import haveno.desktop.main.MainView;
import haveno.desktop.main.account.AccountView;
import haveno.desktop.main.account.content.altcoinaccounts.AltCoinAccountsView;
import haveno.desktop.main.account.content.fiataccounts.FiatAccountsView;
import haveno.desktop.main.account.content.cryptoaccounts.CryptoAccountsView;
import haveno.desktop.main.account.content.traditionalaccounts.TraditionalAccountsView;
import haveno.desktop.main.funds.FundsView;
import haveno.desktop.main.funds.withdrawal.WithdrawalView;
import haveno.desktop.main.offer.OfferView;
@ -613,10 +613,10 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
.actionButtonText(Res.get("offerbook.setupNewAccount"))
.onAction(() -> {
navigation.setReturnPath(navigation.getCurrentPath());
if (CurrencyUtil.isFiatCurrency(model.getSelectedTradeCurrency().getCode())) {
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
if (CurrencyUtil.isTraditionalCurrency(model.getSelectedTradeCurrency().getCode())) {
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
} else {
navigation.navigateTo(MainView.class, AccountView.class, AltCoinAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, CryptoAccountsView.class);
}
})
.width(725)
@ -749,7 +749,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
private void openPopupForMissingAccountSetup(Offer offer) {
String headline = Res.get("offerbook.warning.noMatchingAccount.headline");
var accountViewClass = offer.isFiatOffer() ? FiatAccountsView.class : AltCoinAccountsView.class;
var accountViewClass = offer.isTraditionalOffer() ? TraditionalAccountsView.class : CryptoAccountsView.class;
new Popup().headLine(headline)
.instruction(Res.get("offerbook.warning.noMatchingAccount.msg"))

View file

@ -396,7 +396,7 @@ abstract class OfferBookViewModel extends ActivatableViewModel {
}
public Optional<Double> getMarketBasedPrice(Offer offer) {
OfferDirection displayDirection = offer.isFiatOffer() ? direction :
OfferDirection displayDirection = offer.isTraditionalOffer() ? direction :
direction.equals(OfferDirection.BUY) ? OfferDirection.SELL : OfferDirection.BUY;
return priceUtil.getMarketBasedPrice(offer, displayDirection);
}
@ -427,7 +427,7 @@ abstract class OfferBookViewModel extends ActivatableViewModel {
}
int getNumberOfDecimalsForVolume(OfferBookListItem item) {
return item.getOffer().isFiatOffer() ? GUIUtil.FIAT_DECIMALS_WITH_ZEROS : GUIUtil.ALTCOINS_DECIMALS_WITH_ZEROS;
return item.getOffer().isFiatOffer() ? GUIUtil.FIAT_DECIMALS_WITH_ZEROS : GUIUtil.CRYPTOS_DECIMALS_WITH_ZEROS;
}
String getPaymentMethod(OfferBookListItem item) {
@ -622,7 +622,7 @@ abstract class OfferBookViewModel extends ActivatableViewModel {
}
private static String getDirectionWithCodeDetailed(OfferDirection direction, String currencyCode) {
if (CurrencyUtil.isFiatCurrency(currencyCode))
if (CurrencyUtil.isTraditionalCurrency(currencyCode))
return (direction == OfferDirection.BUY) ? Res.get("shared.buyingBTCWith", currencyCode) : Res.get("shared.sellingBTCFor", currencyCode);
else
return (direction == OfferDirection.SELL) ? Res.get("shared.buyingCurrency", currencyCode) : Res.get("shared.sellingCurrency", currencyCode);

View file

@ -91,13 +91,13 @@ public class OtherOfferBookViewModel extends OfferBookViewModel {
tradeCurrencies.add(new CryptoCurrency(GUIUtil.SHOW_ALL_FLAG, ""));
tradeCurrencies.addAll(preferences.getCryptoCurrenciesAsObservable().stream()
.filter(withoutTopAltcoin())
.filter(withoutTopCrypto())
.collect(Collectors.toList()));
tradeCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, ""));
allCurrencies.add(new CryptoCurrency(GUIUtil.SHOW_ALL_FLAG, ""));
allCurrencies.addAll(CurrencyUtil.getAllSortedCryptoCurrencies().stream()
.filter(withoutTopAltcoin())
.filter(withoutTopCrypto())
.collect(Collectors.toList()));
allCurrencies.add(new CryptoCurrency(GUIUtil.EDIT_FLAG, ""));
}
@ -107,11 +107,11 @@ public class OtherOfferBookViewModel extends OfferBookViewModel {
TradeCurrency selectedTradeCurrency) {
return offerBookListItem -> {
Offer offer = offerBookListItem.getOffer();
// BUY Altcoin is actually SELL Bitcoin
// BUY Crypto is actually SELL Bitcoin
boolean directionResult = offer.getDirection() == direction;
boolean currencyResult = CurrencyUtil.isCryptoCurrency(offer.getCurrencyCode()) &&
((showAllTradeCurrenciesProperty.get() &&
!offer.getCurrencyCode().equals(GUIUtil.TOP_ALTCOIN.getCode())) ||
!offer.getCurrencyCode().equals(GUIUtil.TOP_CRYPTO.getCode())) ||
offer.getCurrencyCode().equals(selectedTradeCurrency.getCode()));
boolean paymentMethodResult = showAllPaymentMethods ||
offer.getPaymentMethod().equals(selectedPaymentMethod);
@ -124,8 +124,8 @@ public class OtherOfferBookViewModel extends OfferBookViewModel {
TradeCurrency getDefaultTradeCurrency() {
TradeCurrency defaultTradeCurrency = GlobalSettings.getDefaultTradeCurrency();
if (!CurrencyUtil.isFiatCurrency(defaultTradeCurrency.getCode()) &&
!defaultTradeCurrency.equals(GUIUtil.TOP_ALTCOIN) &&
if (!CurrencyUtil.isTraditionalCurrency(defaultTradeCurrency.getCode()) &&
!defaultTradeCurrency.equals(GUIUtil.TOP_CRYPTO) &&
hasPaymentAccountForCurrency(defaultTradeCurrency)) {
return defaultTradeCurrency;
}
@ -152,8 +152,8 @@ public class OtherOfferBookViewModel extends OfferBookViewModel {
}
@NotNull
private Predicate<CryptoCurrency> withoutTopAltcoin() {
private Predicate<CryptoCurrency> withoutTopCrypto() {
return cryptoCurrency ->
!cryptoCurrency.equals(GUIUtil.TOP_ALTCOIN);
!cryptoCurrency.equals(GUIUtil.TOP_CRYPTO);
}
}

View file

@ -19,7 +19,7 @@
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<GridPane fx:id="root" fx:controller="haveno.desktop.main.offer.offerbook.TopAltcoinOfferBookView"
<GridPane fx:id="root" fx:controller="haveno.desktop.main.offer.offerbook.TopCryptoOfferBookView"
hgap="5.0" vgap="5"
xmlns:fx="http://javafx.com/fxml">

View file

@ -34,10 +34,10 @@ import javax.inject.Inject;
import javax.inject.Named;
@FxmlView
public class TopAltcoinOfferBookView extends OfferBookView<GridPane, TopAltcoinOfferBookViewModel> {
public class TopCryptoOfferBookView extends OfferBookView<GridPane, TopCryptoOfferBookViewModel> {
@Inject
TopAltcoinOfferBookView(TopAltcoinOfferBookViewModel model,
TopCryptoOfferBookView(TopCryptoOfferBookViewModel model,
Navigation navigation,
OfferDetailsWindow offerDetailsWindow,
@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
@ -51,13 +51,13 @@ public class TopAltcoinOfferBookView extends OfferBookView<GridPane, TopAltcoinO
@Override
protected String getMarketTitle() {
return model.getDirection().equals(OfferDirection.BUY) ?
Res.get("offerbook.availableOffersToBuy", TopAltcoinOfferBookViewModel.TOP_ALTCOIN.getCode(), Res.getBaseCurrencyCode()) :
Res.get("offerbook.availableOffersToSell", TopAltcoinOfferBookViewModel.TOP_ALTCOIN.getCode(), Res.getBaseCurrencyCode());
Res.get("offerbook.availableOffersToBuy", TopCryptoOfferBookViewModel.TOP_CRYPTO.getCode(), Res.getBaseCurrencyCode()) :
Res.get("offerbook.availableOffersToSell", TopCryptoOfferBookViewModel.TOP_CRYPTO.getCode(), Res.getBaseCurrencyCode());
}
@Override
protected void activate() {
model.onSetTradeCurrency(TopAltcoinOfferBookViewModel.TOP_ALTCOIN);
model.onSetTradeCurrency(TopCryptoOfferBookViewModel.TOP_CRYPTO);
super.activate();
@ -67,6 +67,6 @@ public class TopAltcoinOfferBookView extends OfferBookView<GridPane, TopAltcoinO
@Override
String getTradeCurrencyCode() {
return TopAltcoinOfferBookViewModel.TOP_ALTCOIN.getCode();
return TopCryptoOfferBookViewModel.TOP_CRYPTO.getCode();
}
}

View file

@ -44,12 +44,12 @@ import javax.inject.Named;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class TopAltcoinOfferBookViewModel extends OfferBookViewModel {
public class TopCryptoOfferBookViewModel extends OfferBookViewModel {
public static TradeCurrency TOP_ALTCOIN = GUIUtil.TOP_ALTCOIN;
public static TradeCurrency TOP_CRYPTO = GUIUtil.TOP_CRYPTO;
@Inject
public TopAltcoinOfferBookViewModel(User user,
public TopCryptoOfferBookViewModel(User user,
OpenOfferManager openOfferManager,
OfferBook offerBook,
Preferences preferences,
@ -69,12 +69,12 @@ public class TopAltcoinOfferBookViewModel extends OfferBookViewModel {
@Override
protected void activate() {
super.activate();
TOP_ALTCOIN = GUIUtil.TOP_ALTCOIN;
TOP_CRYPTO = GUIUtil.TOP_CRYPTO;
}
@Override
void saveSelectedCurrencyCodeInPreferences(OfferDirection direction, String code) {
// No need to store anything as it is just one Altcoin offers anyway
// No need to store anything as it is just one Crypto offers anyway
}
@Override
@ -86,8 +86,8 @@ public class TopAltcoinOfferBookViewModel extends OfferBookViewModel {
@Override
void fillCurrencies(ObservableList<TradeCurrency> tradeCurrencies,
ObservableList<TradeCurrency> allCurrencies) {
tradeCurrencies.add(TOP_ALTCOIN);
allCurrencies.add(TOP_ALTCOIN);
tradeCurrencies.add(TOP_CRYPTO);
allCurrencies.add(TOP_CRYPTO);
}
@Override
@ -95,9 +95,9 @@ public class TopAltcoinOfferBookViewModel extends OfferBookViewModel {
TradeCurrency selectedTradeCurrency) {
return offerBookListItem -> {
Offer offer = offerBookListItem.getOffer();
// BUY Altcoin is actually SELL Bitcoin
// BUY Crypto is actually SELL Bitcoin
boolean directionResult = offer.getDirection() == direction;
boolean currencyResult = offer.getCurrencyCode().equals(TOP_ALTCOIN.getCode());
boolean currencyResult = offer.getCurrencyCode().equals(TOP_CRYPTO.getCode());
boolean paymentMethodResult = showAllPaymentMethods ||
offer.getPaymentMethod().equals(selectedPaymentMethod);
boolean notMyOfferOrShowMyOffersActivated = !isMyOffer(offerBookListItem.getOffer()) || preferences.isShowOwnOffersInOfferBook();
@ -107,11 +107,11 @@ public class TopAltcoinOfferBookViewModel extends OfferBookViewModel {
@Override
TradeCurrency getDefaultTradeCurrency() {
return TOP_ALTCOIN;
return TOP_CRYPTO;
}
@Override
String getCurrencyCodeFromPreferences(OfferDirection direction) {
return TOP_ALTCOIN.getCode();
return TOP_CRYPTO.getCode();
}
}

View file

@ -1174,9 +1174,9 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
@NotNull
private String getTakeOfferLabel(Offer offer, String direction) {
return offer.isFiatOffer() ?
return offer.isTraditionalOffer() ?
Res.get("takeOffer.takeOfferButton", direction) :
Res.get("takeOffer.takeOfferButtonAltcoin",
Res.get("takeOffer.takeOfferButtonCrypto",
direction,
offer.getCurrencyCode());
}

View file

@ -150,10 +150,10 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
addBindings();
addListeners();
String buyVolumeDescriptionKey = offer.isFiatOffer() ? "createOffer.amountPriceBox.buy.volumeDescription" :
"createOffer.amountPriceBox.buy.volumeDescriptionAltcoin";
String sellVolumeDescriptionKey = offer.isFiatOffer() ? "createOffer.amountPriceBox.sell.volumeDescription" :
"createOffer.amountPriceBox.sell.volumeDescriptionAltcoin";
String buyVolumeDescriptionKey = offer.isTraditionalOffer() ? "createOffer.amountPriceBox.buy.volumeDescription" :
"createOffer.amountPriceBox.buy.volumeDescriptionCrypto";
String sellVolumeDescriptionKey = offer.isTraditionalOffer() ? "createOffer.amountPriceBox.sell.volumeDescription" :
"createOffer.amountPriceBox.sell.volumeDescriptionCrypto";
if (dataModel.getDirection() == OfferDirection.SELL) {
volumeDescriptionLabel.set(Res.get(buyVolumeDescriptionKey, dataModel.getCurrencyCode()));
@ -193,10 +193,10 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
dataModel.initWithData(offer);
this.offer = offer;
String buyAmountDescriptionKey = offer.isFiatOffer() ? "takeOffer.amountPriceBox.buy.amountDescription" :
"takeOffer.amountPriceBox.buy.amountDescriptionAltcoin";
String sellAmountDescriptionKey = offer.isFiatOffer() ? "takeOffer.amountPriceBox.sell.amountDescription" :
"takeOffer.amountPriceBox.sell.amountDescriptionAltcoin";
String buyAmountDescriptionKey = offer.isTraditionalOffer() ? "takeOffer.amountPriceBox.buy.amountDescription" :
"takeOffer.amountPriceBox.buy.amountDescriptionCrypto";
String sellAmountDescriptionKey = offer.isTraditionalOffer() ? "takeOffer.amountPriceBox.sell.amountDescription" :
"takeOffer.amountPriceBox.sell.amountDescriptionCrypto";
amountDescription = offer.isBuyOffer()
? Res.get(buyAmountDescriptionKey)

View file

@ -193,8 +193,8 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
addTitledGroupBg(gridPane, ++rowIndex, rows, Res.get("shared.Offer"));
String fiatDirectionInfo = "";
String btcDirectionInfo = "";
String counterCurrencyDirectionInfo = "";
String xmrDirectionInfo = "";
OfferDirection direction = offer.getDirection();
String currencyCode = offer.getCurrencyCode();
String offerTypeLabel = Res.get("shared.offerType");
@ -204,25 +204,25 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
if (takeOfferHandlerOptional.isPresent()) {
addConfirmationLabelLabel(gridPane, rowIndex, offerTypeLabel,
DisplayUtils.getDirectionForTakeOffer(direction, currencyCode), firstRowDistance);
fiatDirectionInfo = direction == OfferDirection.BUY ? toReceive : toSpend;
btcDirectionInfo = direction == OfferDirection.SELL ? toReceive : toSpend;
counterCurrencyDirectionInfo = direction == OfferDirection.BUY ? toReceive : toSpend;
xmrDirectionInfo = direction == OfferDirection.SELL ? toReceive : toSpend;
} else if (placeOfferHandlerOptional.isPresent()) {
addConfirmationLabelLabel(gridPane, rowIndex, offerTypeLabel,
DisplayUtils.getOfferDirectionForCreateOffer(direction, currencyCode), firstRowDistance);
fiatDirectionInfo = direction == OfferDirection.SELL ? toReceive : toSpend;
btcDirectionInfo = direction == OfferDirection.BUY ? toReceive : toSpend;
counterCurrencyDirectionInfo = direction == OfferDirection.SELL ? toReceive : toSpend;
xmrDirectionInfo = direction == OfferDirection.BUY ? toReceive : toSpend;
} else {
addConfirmationLabelLabel(gridPane, rowIndex, offerTypeLabel,
DisplayUtils.getDirectionBothSides(direction), firstRowDistance);
}
String btcAmount = Res.get("shared.btcAmount");
if (takeOfferHandlerOptional.isPresent()) {
addConfirmationLabelLabel(gridPane, ++rowIndex, btcAmount + btcDirectionInfo,
addConfirmationLabelLabel(gridPane, ++rowIndex, btcAmount + xmrDirectionInfo,
HavenoUtils.formatXmr(tradeAmount, true));
addConfirmationLabelLabel(gridPane, ++rowIndex, VolumeUtil.formatVolumeLabel(currencyCode) + fiatDirectionInfo,
addConfirmationLabelLabel(gridPane, ++rowIndex, VolumeUtil.formatVolumeLabel(currencyCode) + counterCurrencyDirectionInfo,
VolumeUtil.formatVolumeWithCode(offer.getVolumeByAmount(tradeAmount)));
} else {
addConfirmationLabelLabel(gridPane, ++rowIndex, btcAmount + btcDirectionInfo,
addConfirmationLabelLabel(gridPane, ++rowIndex, btcAmount + xmrDirectionInfo,
HavenoUtils.formatXmr(offer.getAmount(), true));
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.minBtcAmount"),
HavenoUtils.formatXmr(offer.getMinAmount(), true));
@ -232,7 +232,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
!offer.getVolume().equals(offer.getMinVolume()))
minVolume = " " + Res.get("offerDetailsWindow.min", VolumeUtil.formatVolumeWithCode(offer.getMinVolume()));
addConfirmationLabelLabel(gridPane, ++rowIndex,
VolumeUtil.formatVolumeLabel(currencyCode) + fiatDirectionInfo, volume + minVolume);
VolumeUtil.formatVolumeLabel(currencyCode) + counterCurrencyDirectionInfo, volume + minVolume);
}
String priceLabel = Res.get("shared.price");

View file

@ -168,7 +168,7 @@ public class SignPaymentAccountsWindow extends Overlay<SignPaymentAccountsWindow
private List<PaymentMethod> getPaymentMethods() {
return PaymentMethod.paymentMethods.stream()
.filter(PaymentMethod::isFiat)
.filter(PaymentMethod::isTraditional)
.filter(PaymentMethod::hasChargebackRisk)
.collect(Collectors.toList());
}

View file

@ -81,7 +81,7 @@ public class TacWindow extends Overlay<TacWindow> {
" - Leave the \"reason for payment\" field empty. DO NOT put the trade ID or any other text like 'monero', 'XMR', or 'Haveno'.\n" +
" - If the bank of the fiat sender charges fees, the sender (" + Res.getBaseCurrencyCode() + " buyer) has to cover the fees.\n" +
" - You must cooperate with the mediator during the mediation process, and respond to each mediator message within 48 hours.\n" +
" - If either (or both) traders do not accept the mediator's suggested payout, traders can open a refund request from an arbitrator after 10 days in case of altcoin trades\n" +
" - If either (or both) traders do not accept the mediator's suggested payout, traders can open a refund request from an arbitrator after 10 days in case of crypto trades\n" +
" and 20 days for fiat trades.\n" +
" - You should only open a refund request from an arbitrator if you think the mediator's suggested payout is unfair, or if your trading peer is unresponsive.\n" +
" - Opening a refund request from an arbitrator triggers the delayed payout transaction, sending all funds from the deposit transaction to the Haveno receiver\n" +

View file

@ -138,27 +138,27 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
addTitledGroupBg(gridPane, ++rowIndex, rows, Res.get("tradeDetailsWindow.headline"));
boolean myOffer = tradeManager.isMyOffer(offer);
String fiatDirectionInfo;
String btcDirectionInfo;
String counterCurrencyDirectionInfo;
String xmrDirectionInfo;
String toReceive = " " + Res.get("shared.toReceive");
String toSpend = " " + Res.get("shared.toSpend");
String offerType = Res.get("shared.offerType");
if (tradeManager.isBuyer(offer)) {
addConfirmationLabelTextField(gridPane, rowIndex, offerType,
DisplayUtils.getDirectionForBuyer(myOffer, offer.getCurrencyCode()), Layout.TWICE_FIRST_ROW_DISTANCE);
fiatDirectionInfo = toSpend;
btcDirectionInfo = toReceive;
counterCurrencyDirectionInfo = toSpend;
xmrDirectionInfo = toReceive;
} else {
addConfirmationLabelTextField(gridPane, rowIndex, offerType,
DisplayUtils.getDirectionForSeller(myOffer, offer.getCurrencyCode()), Layout.TWICE_FIRST_ROW_DISTANCE);
fiatDirectionInfo = toReceive;
btcDirectionInfo = toSpend;
counterCurrencyDirectionInfo = toReceive;
xmrDirectionInfo = toSpend;
}
addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.btcAmount") + btcDirectionInfo,
addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.btcAmount") + xmrDirectionInfo,
HavenoUtils.formatXmr(trade.getAmount(), true));
addConfirmationLabelTextField(gridPane, ++rowIndex,
VolumeUtil.formatVolumeLabel(offer.getCurrencyCode()) + fiatDirectionInfo,
VolumeUtil.formatVolumeLabel(offer.getCurrencyCode()) + counterCurrencyDirectionInfo,
VolumeUtil.formatVolumeWithCode(trade.getVolume()));
addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.tradePrice"),
FormattingUtils.formatPrice(trade.getPrice()));
@ -306,7 +306,7 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
data += "\n\n" + (trade.getMaker() == trade.getBuyer() ? "Buyer" : "Seller") + " as maker reserve tx hex: " + trade.getMaker().getReserveTxHex();
data += "\n\n" + (trade.getTaker() == trade.getBuyer() ? "Buyer" : "Seller") + " as taker reserve tx hex: " + trade.getTaker().getReserveTxHex();
}
if (offer.isFiatOffer()) {
if (offer.isTraditionalOffer()) {
data += "\n\nBuyers witness hash,pub key ring hash: " + buyerWitnessHash + "," + buyerPubKeyRingHash;
data += "\nBuyers account age: " + buyersAccountAge;
data += "\nSellers witness hash,pub key ring hash: " + sellerWitnessHash + "," + sellerPubKeyRingHash;

View file

@ -29,7 +29,7 @@ import haveno.core.provider.price.PriceFeedService;
import haveno.core.user.Preferences;
import haveno.core.util.FormattingUtils;
import haveno.core.util.coin.CoinFormatter;
import haveno.core.util.validation.AltcoinValidator;
import haveno.core.util.validation.NonFiatPriceValidator;
import haveno.core.util.validation.FiatPriceValidator;
import haveno.desktop.Navigation;
import haveno.desktop.main.offer.MutableOfferViewModel;
@ -44,7 +44,7 @@ class DuplicateOfferViewModel extends MutableOfferViewModel<DuplicateOfferDataMo
public DuplicateOfferViewModel(DuplicateOfferDataModel dataModel,
FiatVolumeValidator fiatVolumeValidator,
FiatPriceValidator fiatPriceValidator,
AltcoinValidator altcoinValidator,
NonFiatPriceValidator nonFiatPriceValidator,
XmrValidator btcValidator,
SecurityDepositValidator securityDepositValidator,
PriceFeedService priceFeedService,
@ -56,7 +56,7 @@ class DuplicateOfferViewModel extends MutableOfferViewModel<DuplicateOfferDataMo
super(dataModel,
fiatVolumeValidator,
fiatPriceValidator,
altcoinValidator,
nonFiatPriceValidator,
btcValidator,
securityDepositValidator,
priceFeedService,

View file

@ -31,7 +31,7 @@ import haveno.core.user.Preferences;
import haveno.core.util.FormattingUtils;
import haveno.core.util.PriceUtil;
import haveno.core.util.coin.CoinFormatter;
import haveno.core.util.validation.AltcoinValidator;
import haveno.core.util.validation.NonFiatPriceValidator;
import haveno.core.util.validation.FiatPriceValidator;
import haveno.desktop.Navigation;
import haveno.desktop.main.offer.MutableOfferViewModel;
@ -44,7 +44,7 @@ class EditOfferViewModel extends MutableOfferViewModel<EditOfferDataModel> {
public EditOfferViewModel(EditOfferDataModel dataModel,
FiatVolumeValidator fiatVolumeValidator,
FiatPriceValidator fiatPriceValidator,
AltcoinValidator altcoinValidator,
NonFiatPriceValidator nonFiatPriceValidator,
XmrValidator btcValidator,
SecurityDepositValidator securityDepositValidator,
PriceFeedService priceFeedService,
@ -56,7 +56,7 @@ class EditOfferViewModel extends MutableOfferViewModel<EditOfferDataModel> {
super(dataModel,
fiatVolumeValidator,
fiatPriceValidator,
altcoinValidator,
nonFiatPriceValidator,
btcValidator,
securityDepositValidator,
priceFeedService,

View file

@ -586,7 +586,7 @@ public class BuyerStep2View extends TradeStepView {
String id = trade.getShortId();
String amount = VolumeUtil.formatVolumeWithCode(trade.getVolume());
if (paymentAccountPayload instanceof AssetAccountPayload) {
message += Res.get("portfolio.pending.step2_buyer.altcoin",
message += Res.get("portfolio.pending.step2_buyer.crypto",
getCurrencyName(trade),
amount);
} else if (paymentAccountPayload instanceof CashDepositAccountPayload) {

View file

@ -92,7 +92,7 @@ public class BuyerStep4View extends TradeStepView {
if (trade.getDisputeState().isNotDisputed()) {
addCompactTopLabelTextField(gridPane, gridRow, getBtcTradeAmountLabel(), model.getTradeVolume(), Layout.TWICE_FIRST_ROW_DISTANCE);
addCompactTopLabelTextField(gridPane, ++gridRow, getFiatTradeAmountLabel(), model.getFiatVolume());
addCompactTopLabelTextField(gridPane, ++gridRow, getTraditionalTradeAmountLabel(), model.getFiatVolume());
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("portfolio.pending.step5_buyer.refunded"), model.getSecurityDeposit());
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("portfolio.pending.step5_buyer.tradeFee"), model.getTradeFee());
}
@ -153,7 +153,7 @@ public class BuyerStep4View extends TradeStepView {
return Res.get("portfolio.pending.step5_buyer.bought");
}
protected String getFiatTradeAmountLabel() {
protected String getTraditionalTradeAmountLabel() {
return Res.get("portfolio.pending.step5_buyer.paid");
}
}

View file

@ -302,9 +302,9 @@ public class SellerStep3View extends TradeStepView {
protected String getInfoText() {
String currencyName = getCurrencyName(trade);
if (model.isBlockChainMethod()) {
return Res.get("portfolio.pending.step3_seller.buyerStartedPayment", Res.get("portfolio.pending.step3_seller.buyerStartedPayment.altcoin", currencyName));
return Res.get("portfolio.pending.step3_seller.buyerStartedPayment", Res.get("portfolio.pending.step3_seller.buyerStartedPayment.crypto", currencyName));
} else {
return Res.get("portfolio.pending.step3_seller.buyerStartedPayment", Res.get("portfolio.pending.step3_seller.buyerStartedPayment.fiat", currencyName));
return Res.get("portfolio.pending.step3_seller.buyerStartedPayment", Res.get("portfolio.pending.step3_seller.buyerStartedPayment.traditional", currencyName));
}
}
@ -389,9 +389,9 @@ public class SellerStep3View extends TradeStepView {
if (paymentAccountPayload instanceof AssetAccountPayload) {
String address = ((AssetAccountPayload) paymentAccountPayload).getAddress();
String explorerOrWalletString = isXmrTrade() ?
Res.get("portfolio.pending.step3_seller.altcoin.wallet", currencyName) :
Res.get("portfolio.pending.step3_seller.altcoin.explorer", currencyName);
message = Res.get("portfolio.pending.step3_seller.altcoin",
Res.get("portfolio.pending.step3_seller.crypto.wallet", currencyName) :
Res.get("portfolio.pending.step3_seller.crypto.explorer", currencyName);
message = Res.get("portfolio.pending.step3_seller.crypto",
part1,
explorerOrWalletString,
address,

View file

@ -37,7 +37,7 @@ public class SellerStep4View extends BuyerStep4View {
}
@Override
protected String getFiatTradeAmountLabel() {
protected String getTraditionalTradeAmountLabel() {
return Res.get("portfolio.pending.step5_seller.received");
}
}

View file

@ -142,8 +142,8 @@ public class MarketPricePresentation {
fillPriceFeedComboBoxItems();
});
} else {
CurrencyUtil.getFiatCurrency(code).ifPresent(fiatCurrency -> {
preferences.addFiatCurrency(fiatCurrency);
CurrencyUtil.getTraditionalCurrency(code).ifPresent(traditionalCurrency -> {
preferences.addTraditionalCurrency(traditionalCurrency);
fillPriceFeedComboBoxItems();
});
}
@ -188,7 +188,7 @@ public class MarketPricePresentation {
final String code = item.currencyCode;
if (selectedPriceFeedComboBoxItemProperty.get() != null &&
selectedPriceFeedComboBoxItemProperty.get().currencyCode.equals(code)) {
isFiatCurrencyPriceFeedSelected.set(CurrencyUtil.isFiatCurrency(code) && CurrencyUtil.getFiatCurrency(code).isPresent() && item.isPriceAvailable() && item.isExternallyProvidedPrice());
isFiatCurrencyPriceFeedSelected.set(CurrencyUtil.isTraditionalCurrency(code) && CurrencyUtil.getTraditionalCurrency(code).isPresent() && item.isPriceAvailable() && item.isExternallyProvidedPrice());
isCryptoCurrencyPriceFeedSelected.set(CurrencyUtil.isCryptoCurrency(code) && CurrencyUtil.getCryptoCurrency(code).isPresent() && item.isPriceAvailable() && item.isExternallyProvidedPrice());
isExternallyProvidedPrice.set(item.isExternallyProvidedPrice());
isPriceAvailable.set(item.isPriceAvailable());

View file

@ -29,7 +29,7 @@ import haveno.core.locale.Country;
import haveno.core.locale.CountryUtil;
import haveno.core.locale.CryptoCurrency;
import haveno.core.locale.CurrencyUtil;
import haveno.core.locale.FiatCurrency;
import haveno.core.locale.TraditionalCurrency;
import haveno.core.locale.LanguageUtil;
import haveno.core.locale.Res;
import haveno.core.locale.TradeCurrency;
@ -128,15 +128,15 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
private final FilterManager filterManager;
private final File storageDir;
private ListView<FiatCurrency> fiatCurrenciesListView;
private ComboBox<FiatCurrency> fiatCurrenciesComboBox;
private ListView<TraditionalCurrency> traditionalCurrenciesListView;
private ComboBox<TraditionalCurrency> traditionalCurrenciesComboBox;
private ListView<CryptoCurrency> cryptoCurrenciesListView;
private ComboBox<CryptoCurrency> cryptoCurrenciesComboBox;
private Button resetDontShowAgainButton, editCustomBtcExplorer;
private ObservableList<String> languageCodes;
private ObservableList<Country> countries;
private ObservableList<FiatCurrency> fiatCurrencies;
private ObservableList<FiatCurrency> allFiatCurrencies;
private ObservableList<TraditionalCurrency> traditionalCurrencies;
private ObservableList<TraditionalCurrency> allTraditionalCurrencies;
private ObservableList<CryptoCurrency> cryptoCurrencies;
private ObservableList<CryptoCurrency> allCryptoCurrencies;
private ObservableList<TradeCurrency> tradeCurrencies;
@ -174,12 +174,12 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
public void initialize() {
languageCodes = FXCollections.observableArrayList(LanguageUtil.getUserLanguageCodes());
countries = FXCollections.observableArrayList(CountryUtil.getAllCountries());
fiatCurrencies = preferences.getFiatCurrenciesAsObservable();
traditionalCurrencies = preferences.getTraditionalCurrenciesAsObservable();
cryptoCurrencies = preferences.getCryptoCurrenciesAsObservable();
tradeCurrencies = preferences.getTradeCurrenciesAsObservable();
allFiatCurrencies = FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies());
allFiatCurrencies.removeAll(fiatCurrencies);
allTraditionalCurrencies = FXCollections.observableArrayList(CurrencyUtil.getAllSortedTraditionalCurrencies());
allTraditionalCurrencies.removeAll(traditionalCurrencies);
initializeGeneralOptions();
initializeDisplayOptions();
@ -331,24 +331,24 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
preferredTradeCurrencyComboBox.setCellFactory(GUIUtil.getTradeCurrencyCellFactory("", "",
FXCollections.emptyObservableMap()));
Tuple3<Label, ListView<FiatCurrency>, VBox> fiatTuple = addTopLabelListView(root, displayCurrenciesGridRowIndex,
Tuple3<Label, ListView<TraditionalCurrency>, VBox> traditionalTuple = addTopLabelListView(root, displayCurrenciesGridRowIndex,
Res.get("setting.preferences.displayFiat"));
int listRowSpan = 6;
GridPane.setColumnIndex(fiatTuple.third, 2);
GridPane.setRowSpan(fiatTuple.third, listRowSpan);
GridPane.setColumnIndex(traditionalTuple.third, 2);
GridPane.setRowSpan(traditionalTuple.third, listRowSpan);
GridPane.setValignment(fiatTuple.third, VPos.TOP);
GridPane.setMargin(fiatTuple.third, new Insets(10, 0, 0, 0));
fiatCurrenciesListView = fiatTuple.second;
fiatCurrenciesListView.setMinHeight(9 * Layout.LIST_ROW_HEIGHT + 2);
fiatCurrenciesListView.setPrefHeight(10 * Layout.LIST_ROW_HEIGHT + 2);
GridPane.setValignment(traditionalTuple.third, VPos.TOP);
GridPane.setMargin(traditionalTuple.third, new Insets(10, 0, 0, 0));
traditionalCurrenciesListView = traditionalTuple.second;
traditionalCurrenciesListView.setMinHeight(9 * Layout.LIST_ROW_HEIGHT + 2);
traditionalCurrenciesListView.setPrefHeight(10 * Layout.LIST_ROW_HEIGHT + 2);
Label placeholder = new AutoTooltipLabel(Res.get("setting.preferences.noFiat"));
placeholder.setWrapText(true);
fiatCurrenciesListView.setPlaceholder(placeholder);
fiatCurrenciesListView.setCellFactory(new Callback<>() {
traditionalCurrenciesListView.setPlaceholder(placeholder);
traditionalCurrenciesListView.setCellFactory(new Callback<>() {
@Override
public ListCell<FiatCurrency> call(ListView<FiatCurrency> list) {
public ListCell<TraditionalCurrency> call(ListView<TraditionalCurrency> list) {
return new ListCell<>() {
final Label label = new AutoTooltipLabel();
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
@ -362,7 +362,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
}
@Override
public void updateItem(final FiatCurrency item, boolean empty) {
public void updateItem(final TraditionalCurrency item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
label.setText(item.getNameAndCode());
@ -370,10 +370,10 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
if (item.equals(preferences.getPreferredTradeCurrency())) {
new Popup().warning(Res.get("setting.preferences.cannotRemovePrefCurrency")).show();
} else {
preferences.removeFiatCurrency(item);
if (!allFiatCurrencies.contains(item)) {
allFiatCurrencies.add(item);
allFiatCurrencies.sort(TradeCurrency::compareTo);
preferences.removeTraditionalCurrency(item);
if (!allTraditionalCurrencies.contains(item)) {
allTraditionalCurrencies.add(item);
allTraditionalCurrencies.sort(TradeCurrency::compareTo);
}
}
});
@ -388,7 +388,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
});
Tuple3<Label, ListView<CryptoCurrency>, VBox> cryptoCurrenciesTuple = addTopLabelListView(root,
displayCurrenciesGridRowIndex, Res.get("setting.preferences.displayAltcoins"));
displayCurrenciesGridRowIndex, Res.get("setting.preferences.displayCryptos"));
GridPane.setColumnIndex(cryptoCurrenciesTuple.third, 3);
GridPane.setRowSpan(cryptoCurrenciesTuple.third, listRowSpan);
@ -398,7 +398,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
cryptoCurrenciesListView = cryptoCurrenciesTuple.second;
cryptoCurrenciesListView.setMinHeight(9 * Layout.LIST_ROW_HEIGHT + 2);
cryptoCurrenciesListView.setPrefHeight(10 * Layout.LIST_ROW_HEIGHT + 2);
placeholder = new AutoTooltipLabel(Res.get("setting.preferences.noAltcoins"));
placeholder = new AutoTooltipLabel(Res.get("setting.preferences.noCryptos"));
placeholder.setWrapText(true);
cryptoCurrenciesListView.setPlaceholder(placeholder);
cryptoCurrenciesListView.setCellFactory(new Callback<>() {
@ -442,13 +442,13 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
}
});
fiatCurrenciesComboBox = addComboBox(root, displayCurrenciesGridRowIndex + listRowSpan);
GridPane.setColumnIndex(fiatCurrenciesComboBox, 2);
GridPane.setValignment(fiatCurrenciesComboBox, VPos.TOP);
fiatCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addFiat"));
fiatCurrenciesComboBox.setButtonCell(new ListCell<>() {
traditionalCurrenciesComboBox = addComboBox(root, displayCurrenciesGridRowIndex + listRowSpan);
GridPane.setColumnIndex(traditionalCurrenciesComboBox, 2);
GridPane.setValignment(traditionalCurrenciesComboBox, VPos.TOP);
traditionalCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addFiat"));
traditionalCurrenciesComboBox.setButtonCell(new ListCell<>() {
@Override
protected void updateItem(final FiatCurrency item, boolean empty) {
protected void updateItem(final TraditionalCurrency item, boolean empty) {
super.updateItem(item, empty);
this.setVisible(item != null || !empty);
@ -459,14 +459,14 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
}
}
});
fiatCurrenciesComboBox.setConverter(new StringConverter<>() {
traditionalCurrenciesComboBox.setConverter(new StringConverter<>() {
@Override
public String toString(FiatCurrency tradeCurrency) {
public String toString(TraditionalCurrency tradeCurrency) {
return tradeCurrency.getNameAndCode();
}
@Override
public FiatCurrency fromString(String s) {
public TraditionalCurrency fromString(String s) {
return null;
}
});
@ -476,7 +476,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
GridPane.setValignment(cryptoCurrenciesComboBox, VPos.TOP);
GridPane.setMargin(cryptoCurrenciesComboBox, new Insets(Layout.FLOATING_LABEL_DISTANCE,
0, 0, 20));
cryptoCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addAltcoin"));
cryptoCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addCrypto"));
cryptoCurrenciesComboBox.setButtonCell(new ListCell<>() {
@Override
protected void updateItem(final CryptoCurrency item, boolean empty) {
@ -485,7 +485,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
if (empty || item == null) {
setText(Res.get("setting.preferences.addAltcoin"));
setText(Res.get("setting.preferences.addCrypto"));
} else {
setText(item.getNameAndCode());
}
@ -711,16 +711,16 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
preferences.setPreferredTradeCurrency(selectedItem);
});
fiatCurrenciesComboBox.setItems(allFiatCurrencies);
fiatCurrenciesListView.setItems(fiatCurrencies);
fiatCurrenciesComboBox.setOnHiding(e -> {
FiatCurrency selectedItem = fiatCurrenciesComboBox.getSelectionModel().getSelectedItem();
traditionalCurrenciesComboBox.setItems(allTraditionalCurrencies);
traditionalCurrenciesListView.setItems(traditionalCurrencies);
traditionalCurrenciesComboBox.setOnHiding(e -> {
TraditionalCurrency selectedItem = traditionalCurrenciesComboBox.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
preferences.addFiatCurrency(selectedItem);
if (allFiatCurrencies.contains(selectedItem)) {
preferences.addTraditionalCurrency(selectedItem);
if (allTraditionalCurrencies.contains(selectedItem)) {
UserThread.execute(() -> {
fiatCurrenciesComboBox.getSelectionModel().clearSelection();
allFiatCurrencies.remove(selectedItem);
traditionalCurrenciesComboBox.getSelectionModel().clearSelection();
allTraditionalCurrencies.remove(selectedItem);
});
}

View file

@ -1198,7 +1198,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
String nrOfDisputes = disputeManager.getNrOfDisputes(true, contract);
long accountAge = accountAgeWitnessService.getAccountAge(item.getBuyerPaymentAccountPayload(), contract.getBuyerPubKeyRing());
String age = DisplayUtils.formatAccountAge(accountAge);
String postFix = CurrencyUtil.isFiatCurrency(item.getContract().getOfferPayload().getCurrencyCode()) ? " / " + age : "";
String postFix = CurrencyUtil.isTraditionalCurrency(item.getContract().getOfferPayload().getCurrencyCode()) ? " / " + age : "";
return buyerNodeAddress.getHostNameWithoutPostFix() + " (" + nrOfDisputes + postFix + ")";
} else
return Res.get("shared.na");
@ -1215,7 +1215,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
String nrOfDisputes = disputeManager.getNrOfDisputes(false, contract);
long accountAge = accountAgeWitnessService.getAccountAge(item.getSellerPaymentAccountPayload(), contract.getSellerPubKeyRing());
String age = DisplayUtils.formatAccountAge(accountAge);
String postFix = CurrencyUtil.isFiatCurrency(item.getContract().getOfferPayload().getCurrencyCode()) ? " / " + age : "";
String postFix = CurrencyUtil.isTraditionalCurrency(item.getContract().getOfferPayload().getCurrencyCode()) ? " / " + age : "";
return sellerNodeAddress.getHostNameWithoutPostFix() + " (" + nrOfDisputes + postFix + ")";
} else
return Res.get("shared.na");

View file

@ -63,7 +63,7 @@ public class CurrencyList {
private List<CurrencyListItem> getPartitionedSortedItems(List<TradeCurrency> currencies) {
Map<TradeCurrency, Integer> tradesPerCurrency = countTrades(currencies);
List<CurrencyListItem> fiatCurrencies = new ArrayList<>();
List<CurrencyListItem> traditionalCurrencies = new ArrayList<>();
List<CurrencyListItem> cryptoCurrencies = new ArrayList<>();
for (Map.Entry<TradeCurrency, Integer> entry : tradesPerCurrency.entrySet()) {
@ -71,8 +71,8 @@ public class CurrencyList {
Integer count = entry.getValue();
CurrencyListItem item = new CurrencyListItem(currency, count);
if (predicates.isFiatCurrency(currency)) {
fiatCurrencies.add(item);
if (predicates.isTraditionalCurrency(currency)) {
traditionalCurrencies.add(item);
}
if (predicates.isCryptoCurrency(currency)) {
@ -81,11 +81,11 @@ public class CurrencyList {
}
Comparator<CurrencyListItem> comparator = getComparator();
fiatCurrencies.sort(comparator);
traditionalCurrencies.sort(comparator);
cryptoCurrencies.sort(comparator);
List<CurrencyListItem> result = new ArrayList<>();
result.addAll(fiatCurrencies);
result.addAll(traditionalCurrencies);
result.addAll(cryptoCurrencies);
return result;
@ -110,7 +110,7 @@ public class CurrencyList {
currencies.forEach(currency -> result.compute(currency, incrementCurrentOrOne));
Set<TradeCurrency> preferred = new HashSet<>();
preferred.addAll(preferences.getFiatCurrencies());
preferred.addAll(preferences.getTraditionalCurrencies());
preferred.addAll(preferences.getCryptoCurrencies());
preferred.forEach(currency -> result.putIfAbsent(currency, 0));

View file

@ -25,7 +25,7 @@ class CurrencyPredicates {
return CurrencyUtil.isCryptoCurrency(currency.getCode());
}
boolean isFiatCurrency(TradeCurrency currency) {
return CurrencyUtil.isFiatCurrency(currency.getCode());
boolean isTraditionalCurrency(TradeCurrency currency) {
return CurrencyUtil.isTraditionalCurrency(currency.getCode());
}
}

View file

@ -117,7 +117,7 @@ public class DisplayUtils {
///////////////////////////////////////////////////////////////////////////////////////////
public static String getDirectionWithCode(OfferDirection direction, String currencyCode) {
if (CurrencyUtil.isFiatCurrency(currencyCode))
if (CurrencyUtil.isTraditionalCurrency(currencyCode))
return (direction == OfferDirection.BUY) ? Res.get("shared.buyCurrency", Res.getBaseCurrencyCode()) : Res.get("shared.sellCurrency", Res.getBaseCurrencyCode());
else
return (direction == OfferDirection.SELL) ? Res.get("shared.buyCurrency", currencyCode) : Res.get("shared.sellCurrency", currencyCode);
@ -131,7 +131,7 @@ public class DisplayUtils {
}
public static String getDirectionForBuyer(boolean isMyOffer, String currencyCode) {
if (CurrencyUtil.isFiatCurrency(currencyCode)) {
if (CurrencyUtil.isTraditionalCurrency(currencyCode)) {
String code = Res.getBaseCurrencyCode();
return isMyOffer ?
Res.get("formatter.youAreAsMaker", Res.get("shared.buyer"), code, Res.get("shared.seller"), code) :
@ -144,7 +144,7 @@ public class DisplayUtils {
}
public static String getDirectionForSeller(boolean isMyOffer, String currencyCode) {
if (CurrencyUtil.isFiatCurrency(currencyCode)) {
if (CurrencyUtil.isTraditionalCurrency(currencyCode)) {
String code = Res.getBaseCurrencyCode();
return isMyOffer ?
Res.get("formatter.youAreAsMaker", Res.get("shared.seller"), code, Res.get("shared.buyer"), code) :
@ -158,7 +158,7 @@ public class DisplayUtils {
public static String getDirectionForTakeOffer(OfferDirection direction, String currencyCode) {
String baseCurrencyCode = Res.getBaseCurrencyCode();
if (CurrencyUtil.isFiatCurrency(currencyCode)) {
if (CurrencyUtil.isTraditionalCurrency(currencyCode)) {
return direction == OfferDirection.BUY ?
Res.get("formatter.youAre", Res.get("shared.selling"), baseCurrencyCode, Res.get("shared.buying"), currencyCode) :
Res.get("formatter.youAre", Res.get("shared.buying"), baseCurrencyCode, Res.get("shared.selling"), currencyCode);
@ -172,14 +172,14 @@ public class DisplayUtils {
public static String getOfferDirectionForCreateOffer(OfferDirection direction, String currencyCode) {
String baseCurrencyCode = Res.getBaseCurrencyCode();
if (CurrencyUtil.isFiatCurrency(currencyCode)) {
if (CurrencyUtil.isTraditionalCurrency(currencyCode)) {
return direction == OfferDirection.BUY ?
Res.get("formatter.youAreCreatingAnOffer.fiat", Res.get("shared.buy"), baseCurrencyCode) :
Res.get("formatter.youAreCreatingAnOffer.fiat", Res.get("shared.sell"), baseCurrencyCode);
Res.get("formatter.youAreCreatingAnOffer.traditional", Res.get("shared.buy"), baseCurrencyCode) :
Res.get("formatter.youAreCreatingAnOffer.traditional", Res.get("shared.sell"), baseCurrencyCode);
} else {
return direction == OfferDirection.SELL ?
Res.get("formatter.youAreCreatingAnOffer.altcoin", Res.get("shared.buy"), currencyCode, Res.get("shared.selling"), baseCurrencyCode) :
Res.get("formatter.youAreCreatingAnOffer.altcoin", Res.get("shared.sell"), currencyCode, Res.get("shared.buying"), baseCurrencyCode);
Res.get("formatter.youAreCreatingAnOffer.crypto", Res.get("shared.buy"), currencyCode, Res.get("shared.selling"), baseCurrencyCode) :
Res.get("formatter.youAreCreatingAnOffer.crypto", Res.get("shared.sell"), currencyCode, Res.get("shared.buying"), baseCurrencyCode);
}
}

View file

@ -63,7 +63,7 @@ import haveno.desktop.components.InfoAutoTooltipLabel;
import haveno.desktop.components.indicator.TxConfidenceIndicator;
import haveno.desktop.main.MainView;
import haveno.desktop.main.account.AccountView;
import haveno.desktop.main.account.content.fiataccounts.FiatAccountsView;
import haveno.desktop.main.account.content.traditionalaccounts.TraditionalAccountsView;
import haveno.desktop.main.overlays.popups.Popup;
import haveno.network.p2p.P2PService;
import javafx.collections.FXCollections;
@ -133,13 +133,13 @@ public class GUIUtil {
public final static int FIAT_DECIMALS_WITH_ZEROS = 0;
public final static int FIAT_PRICE_DECIMALS_WITH_ZEROS = 3;
public final static int ALTCOINS_DECIMALS_WITH_ZEROS = 7;
public final static int CRYPTOS_DECIMALS_WITH_ZEROS = 7;
public final static int AMOUNT_DECIMALS_WITH_ZEROS = 3;
public final static int AMOUNT_DECIMALS = 4;
private static Preferences preferences;
public static TradeCurrency TOP_ALTCOIN = CurrencyUtil.getTradeCurrency("ETH").get();
public static TradeCurrency TOP_CRYPTO = CurrencyUtil.getTradeCurrency("ETH").get();
public static void setPreferences(Preferences preferences) {
GUIUtil.preferences = preferences;
@ -312,7 +312,7 @@ public class GUIUtil {
HBox box = new HBox();
box.setSpacing(20);
Label currencyType = new AutoTooltipLabel(
CurrencyUtil.isFiatCurrency(code) ? Res.get("shared.fiat") : Res.get("shared.crypto"));
CurrencyUtil.isTraditionalCurrency(code) ? Res.get("shared.traditional") : Res.get("shared.crypto"));
currencyType.getStyleClass().add("currency-label-small");
Label currency = new AutoTooltipLabel(code);
@ -438,7 +438,7 @@ public class GUIUtil {
HBox box = new HBox();
box.setSpacing(20);
Label currencyType = new AutoTooltipLabel(
CurrencyUtil.isFiatCurrency(item.getCode()) ? Res.get("shared.fiat") : Res.get("shared.crypto"));
CurrencyUtil.isTraditionalCurrency(item.getCode()) ? Res.get("shared.traditional") : Res.get("shared.crypto"));
currencyType.getStyleClass().add("currency-label-small");
Label currency = new AutoTooltipLabel(item.getCode());
@ -509,7 +509,7 @@ public class GUIUtil {
HBox box = new HBox();
box.setSpacing(20);
Label paymentType = new AutoTooltipLabel(
method.isAltcoin() ? Res.get("shared.crypto") : Res.get("shared.fiat"));
method.isCrypto() ? Res.get("shared.crypto") : Res.get("shared.traditional"));
paymentType.getStyleClass().add("currency-label-small");
Label paymentMethod = new AutoTooltipLabel(Res.get(id));
@ -673,7 +673,7 @@ public class GUIUtil {
.actionButtonTextWithGoTo("navigation.account")
.onAction(() -> {
navigation.setReturnPath(navigation.getCurrentPath());
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
})
.dontShowAgainId(key)
.show();
@ -749,7 +749,7 @@ public class GUIUtil {
.actionButtonTextWithGoTo("navigation.account")
.onAction(() -> {
navigation.setReturnPath(navigation.getCurrentPath());
navigation.navigateTo(MainView.class, AccountView.class, FiatAccountsView.class);
navigation.navigateTo(MainView.class, AccountView.class, TraditionalAccountsView.class);
}).show();
return false;
}
@ -908,7 +908,7 @@ public class GUIUtil {
ComboBox<TradeCurrency> currencyComboBox = FormBuilder.addComboBox(gridPane, ++gridRow,
Res.get("shared.currency"));
currencyComboBox.setPromptText(Res.get("list.currency.select"));
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedTraditionalCurrencies()));
currencyComboBox.setConverter(new StringConverter<>() {
@Override
@ -1039,11 +1039,11 @@ public class GUIUtil {
gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
}
public static void updateTopAltcoin(Preferences preferences) {
public static void updateTopCrypto(Preferences preferences) {
TradeCurrency tradeCurrency = preferences.getPreferredTradeCurrency();
if (CurrencyUtil.isFiatCurrency(tradeCurrency.getCode())) {
if (CurrencyUtil.isTraditionalCurrency(tradeCurrency.getCode())) {
return;
}
TOP_ALTCOIN = tradeCurrency;
TOP_CRYPTO = tradeCurrency;
}
}