mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Use BTC as base currency for BSQ.
Update PersistedEntryMap (trade statistics) Remvoe amountTextField from BSQ receive view. Disable other menu iems in DAO view, show disabled tabs of phase 2. Fix nullpointer with setTradeCurrencyFromPaymentAccount in CreateOfferDataModel.
This commit is contained in:
parent
728dead33c
commit
61b9766052
@ -86,7 +86,7 @@ public class BisqEnvironment extends StandardEnvironment {
|
||||
}
|
||||
|
||||
public static boolean isBaseCurrencySupportingBsq() {
|
||||
return getBaseCurrencyNetwork().getCurrencyCode().equals("LTC");
|
||||
return getBaseCurrencyNetwork().getCurrencyCode().equals("BTC");
|
||||
}
|
||||
|
||||
public static NetworkParameters getParameters() {
|
||||
|
@ -30,7 +30,7 @@ public class TradeStatisticsMigrationTool {
|
||||
|
||||
// We use blocking to be sure to not start reading the persistedTradeStatisticsList before we have set it.
|
||||
// just for migrating the stats....
|
||||
Object fromDisc = jsonFileManager.readJsonFromDisc("trade_statistics1");
|
||||
Object fromDisc = jsonFileManager.readJsonFromDisc("trade_statistics");
|
||||
List<TradeStatistics> persistedTradeStatisticsList = new ArrayList<>();
|
||||
if (fromDisc instanceof JSONArray) {
|
||||
JSONArray array = (JSONArray) fromDisc;
|
||||
|
@ -312,7 +312,7 @@ public class BisqApp extends Application {
|
||||
primaryStage.show();
|
||||
|
||||
// Used only for migrating old trade statistic to new data structure
|
||||
// injector.getInstance(TradeStatisticsMigrationTool.class);
|
||||
//injector.getInstance(TradeStatisticsMigrationTool.class);
|
||||
|
||||
if (!Utilities.isCorrectOSArchitecture()) {
|
||||
String osArchitecture = Utilities.getOSArchitecture();
|
||||
|
@ -57,20 +57,27 @@ public class DaoView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
if (DevEnv.DAO_PHASE2_ACTIVATED) {
|
||||
compensationTab = new Tab(Res.get("dao.tab.compensation"));
|
||||
votingTab = new Tab(Res.get("dao.tab.voting"));
|
||||
compensationTab.setClosable(false);
|
||||
votingTab.setClosable(false);
|
||||
root.getTabs().addAll(compensationTab, votingTab);
|
||||
compensationTab = new Tab(Res.get("dao.tab.compensation"));
|
||||
votingTab = new Tab(Res.get("dao.tab.voting"));
|
||||
compensationTab.setClosable(false);
|
||||
votingTab.setClosable(false);
|
||||
root.getTabs().addAll(compensationTab, votingTab);
|
||||
|
||||
if (!DevEnv.DAO_PHASE2_ACTIVATED) {
|
||||
votingTab.setDisable(true);
|
||||
compensationTab.setDisable(true);
|
||||
}
|
||||
|
||||
bsqWalletTab.setText(Res.get("dao.tab.bsqWallet"));
|
||||
|
||||
navigationListener = viewPath -> {
|
||||
if (viewPath.size() == 3 && viewPath.indexOf(DaoView.class) == 1) {
|
||||
if (compensationTab == null && viewPath.get(2).equals(CompensationView.class))
|
||||
if (compensationTab == null && viewPath.get(2).equals(BsqWalletView.class))
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, BsqDashboardView.class);
|
||||
if (DevEnv.DAO_ACTIVATED)
|
||||
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class);
|
||||
else
|
||||
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, BsqDashboardView.class);
|
||||
else
|
||||
loadView(viewPath.tip());
|
||||
}
|
||||
@ -104,7 +111,10 @@ public class DaoView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||
Tab selectedItem = root.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem == bsqWalletTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class);
|
||||
if (DevEnv.DAO_ACTIVATED)
|
||||
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class);
|
||||
else
|
||||
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, BsqDashboardView.class);
|
||||
else if (selectedItem == compensationTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DaoView.class, CompensationView.class);
|
||||
|
@ -19,6 +19,8 @@ package io.bisq.gui.main.dao.wallet;
|
||||
|
||||
import de.jensd.fx.fontawesome.AwesomeDude;
|
||||
import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||
import io.bisq.common.UserThread;
|
||||
import io.bisq.common.app.DevEnv;
|
||||
import io.bisq.common.locale.Res;
|
||||
import io.bisq.gui.Navigation;
|
||||
import io.bisq.gui.common.view.*;
|
||||
@ -80,6 +82,16 @@ public class BsqWalletView extends ActivatableViewAndModel {
|
||||
receive = new MenuItem(navigation, toggleGroup, Res.get("dao.wallet.menuItem.receive"), BsqReceiveView.class, AwesomeIcon.SIGNIN);
|
||||
transactions = new MenuItem(navigation, toggleGroup, Res.get("dao.wallet.menuItem.transactions"), BsqTxView.class, AwesomeIcon.TABLE);
|
||||
leftVBox.getChildren().addAll(dashboard, send, receive, transactions);
|
||||
|
||||
//TODO
|
||||
if (!DevEnv.DAO_ACTIVATED) {
|
||||
dashboard.setDisable(true);
|
||||
send.setDisable(true);
|
||||
transactions.setDisable(true);
|
||||
UserThread.execute(() -> {
|
||||
receive.setSelected(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,36 +17,30 @@
|
||||
|
||||
package io.bisq.gui.main.dao.wallet.receive;
|
||||
|
||||
import io.bisq.common.app.DevEnv;
|
||||
import io.bisq.common.locale.Res;
|
||||
import io.bisq.core.btc.wallet.BsqWalletService;
|
||||
import io.bisq.gui.common.view.ActivatableView;
|
||||
import io.bisq.gui.common.view.FxmlView;
|
||||
import io.bisq.gui.components.BsqAddressTextField;
|
||||
import io.bisq.gui.components.InputTextField;
|
||||
import io.bisq.gui.main.dao.wallet.BsqBalanceUtil;
|
||||
import io.bisq.gui.util.BsqFormatter;
|
||||
import io.bisq.gui.util.Layout;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.fxmisc.easybind.EasyBind;
|
||||
import org.fxmisc.easybind.Subscription;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static io.bisq.gui.util.FormBuilder.*;
|
||||
import static io.bisq.gui.util.FormBuilder.addLabelBsqAddressTextField;
|
||||
import static io.bisq.gui.util.FormBuilder.addTitledGroupBg;
|
||||
|
||||
@FxmlView
|
||||
public class BsqReceiveView extends ActivatableView<GridPane, Void> {
|
||||
|
||||
private BsqAddressTextField addressTextField;
|
||||
private InputTextField amountTextField;
|
||||
private final BsqWalletService bsqWalletService;
|
||||
private final BsqFormatter bsqFormatter;
|
||||
private final BsqBalanceUtil bsqBalanceUtil;
|
||||
private int gridRow = 0;
|
||||
|
||||
private final String paymentLabelString;
|
||||
private Subscription amountTextFieldSubscription;
|
||||
private int gridRow = 0;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -65,30 +59,23 @@ public class BsqReceiveView extends ActivatableView<GridPane, Void> {
|
||||
public void initialize() {
|
||||
gridRow = bsqBalanceUtil.addGroup(root, gridRow);
|
||||
|
||||
addTitledGroupBg(root, ++gridRow, 2, Res.get("dao.wallet.receive.fundYourWallet"), Layout.GROUP_DISTANCE);
|
||||
addTitledGroupBg(root, ++gridRow, 1, Res.get("dao.wallet.receive.fundYourWallet"), Layout.GROUP_DISTANCE);
|
||||
|
||||
addressTextField = addLabelBsqAddressTextField(root, gridRow, Res.getWithCol("shared.address"),
|
||||
Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
addressTextField.setPaymentLabel(paymentLabelString);
|
||||
|
||||
amountTextField = addLabelInputTextField(root, ++gridRow, Res.getWithCol("dao.wallet.receive.amountOptional")).second;
|
||||
if (DevEnv.DEV_MODE)
|
||||
amountTextField.setText("10");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void activate() {
|
||||
bsqBalanceUtil.activate();
|
||||
|
||||
amountTextFieldSubscription = EasyBind.subscribe(amountTextField.textProperty(), t -> addressTextField.setAmountAsCoin(bsqFormatter.parseToCoin(t)));
|
||||
addressTextField.setAddress(bsqFormatter.getBsqAddressStringFromAddress(bsqWalletService.getUnusedAddress()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deactivate() {
|
||||
bsqBalanceUtil.deactivate();
|
||||
|
||||
amountTextFieldSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,10 +234,8 @@ class CreateOfferDataModel extends ActivatableDataModel {
|
||||
user.getPaymentAccounts() != null &&
|
||||
user.getPaymentAccounts().contains(lastSelectedPaymentAccount)) {
|
||||
account = lastSelectedPaymentAccount;
|
||||
setTradeCurrencyFromPaymentAccount(account);
|
||||
} else {
|
||||
account = user.findFirstPaymentAccountWithCurrency(tradeCurrency);
|
||||
setTradeCurrencyFromPaymentAccount(account);
|
||||
}
|
||||
|
||||
if (account != null && isNotUSBankAccount(account)) {
|
||||
@ -246,13 +244,14 @@ class CreateOfferDataModel extends ActivatableDataModel {
|
||||
Optional<PaymentAccount> paymentAccountOptional = paymentAccounts.stream().findAny();
|
||||
if (paymentAccountOptional.isPresent()) {
|
||||
this.paymentAccount = paymentAccountOptional.get();
|
||||
setTradeCurrencyFromPaymentAccount(paymentAccount);
|
||||
|
||||
} else {
|
||||
log.warn("PaymentAccount not available. Should never get called as in offer view you should not be able to open a create offer view");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
setTradeCurrencyFromPaymentAccount(paymentAccount);
|
||||
tradeCurrencyCode.set(this.tradeCurrency.getCode());
|
||||
|
||||
priceFeedService.setCurrencyCode(tradeCurrencyCode.get());
|
||||
|
Binary file not shown.
@ -17,6 +17,7 @@ public class BtcFeesProvider {
|
||||
|
||||
private final HttpClient httpClient;
|
||||
|
||||
// other: https://estimatefee.com/n/2
|
||||
public BtcFeesProvider() {
|
||||
this.httpClient = new HttpClient("https://bitcoinfees.21.co/api/v1/fees/");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user