From 02ba804432637b6186a280139f58a86f7d656c1c Mon Sep 17 00:00:00 2001 From: woodser Date: Tue, 1 Aug 2023 12:29:53 -0400 Subject: [PATCH] fix link to open default monero wallet from deposit view --- core/src/main/java/haveno/core/app/HavenoSetup.java | 1 + .../haveno/desktop/components/AddressTextField.java | 13 ++++++++----- .../src/main/java/haveno/desktop/util/GUIUtil.java | 9 --------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/haveno/core/app/HavenoSetup.java b/core/src/main/java/haveno/core/app/HavenoSetup.java index b921342b..fef2f905 100644 --- a/core/src/main/java/haveno/core/app/HavenoSetup.java +++ b/core/src/main/java/haveno/core/app/HavenoSetup.java @@ -107,6 +107,7 @@ public class HavenoSetup { private final WalletsManager walletsManager; private final WalletsSetup walletsSetup; private final BtcWalletService btcWalletService; + @Getter private final XmrWalletService xmrWalletService; private final P2PService p2PService; private final PrivateNotificationManager privateNotificationManager; diff --git a/desktop/src/main/java/haveno/desktop/components/AddressTextField.java b/desktop/src/main/java/haveno/desktop/components/AddressTextField.java index 210f6a82..94faa415 100644 --- a/desktop/src/main/java/haveno/desktop/components/AddressTextField.java +++ b/desktop/src/main/java/haveno/desktop/components/AddressTextField.java @@ -97,7 +97,7 @@ public class AddressTextField extends AnchorPane { private void openWallet() { try { - Utilities.openURI(URI.create(getBitcoinURI())); + Utilities.openURI(URI.create(getMoneroURI())); } catch (Exception e) { log.warn(e.getMessage()); new Popup().warning(Res.get("addressTextField.openWallet.failed")).show(); @@ -150,12 +150,15 @@ public class AddressTextField extends AnchorPane { // Private /////////////////////////////////////////////////////////////////////////////////////////// - private String getBitcoinURI() { + private String getMoneroURI() { if (amount.get().compareTo(BigInteger.valueOf(0)) < 0) { log.warn("Amount must not be negative"); setAmount(BigInteger.valueOf(0)); } - return GUIUtil.getBitcoinURI(address.get(), HavenoUtils.atomicUnitsToCoin(amount.get()), - paymentLabel.get()); - } + return GUIUtil.getMoneroURI( + address.get(), + amount.get(), + paymentLabel.get(), + HavenoUtils.havenoSetup.getXmrWalletService().getWallet()); +} } diff --git a/desktop/src/main/java/haveno/desktop/util/GUIUtil.java b/desktop/src/main/java/haveno/desktop/util/GUIUtil.java index 7edb9469..8e9d75fd 100644 --- a/desktop/src/main/java/haveno/desktop/util/GUIUtil.java +++ b/desktop/src/main/java/haveno/desktop/util/GUIUtil.java @@ -96,9 +96,7 @@ import monero.daemon.model.MoneroTx; import monero.wallet.MoneroWallet; import monero.wallet.model.MoneroTxConfig; import org.apache.commons.lang3.StringUtils; -import org.bitcoinj.core.Address; import org.bitcoinj.core.Coin; -import org.bitcoinj.uri.BitcoinURI; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -683,13 +681,6 @@ public class GUIUtil { .setNote(label)); } - public static String getBitcoinURI(String address, Coin amount, String label) { - return address != null ? - BitcoinURI.convertToBitcoinURI(Address.fromString(Config.baseCurrencyNetworkParameters(), - address), amount, label, null) : - ""; - } - public static boolean isBootstrappedOrShowPopup(P2PService p2PService) { if (p2PService.isBootstrapped() && p2PService.getNumConnectedPeers().get() > 0) { return true;