fix link to open default monero wallet from deposit view

This commit is contained in:
woodser 2023-08-01 12:29:53 -04:00
parent a5663e1411
commit 02ba804432
3 changed files with 9 additions and 14 deletions

View File

@ -107,6 +107,7 @@ public class HavenoSetup {
private final WalletsManager walletsManager; private final WalletsManager walletsManager;
private final WalletsSetup walletsSetup; private final WalletsSetup walletsSetup;
private final BtcWalletService btcWalletService; private final BtcWalletService btcWalletService;
@Getter
private final XmrWalletService xmrWalletService; private final XmrWalletService xmrWalletService;
private final P2PService p2PService; private final P2PService p2PService;
private final PrivateNotificationManager privateNotificationManager; private final PrivateNotificationManager privateNotificationManager;

View File

@ -97,7 +97,7 @@ public class AddressTextField extends AnchorPane {
private void openWallet() { private void openWallet() {
try { try {
Utilities.openURI(URI.create(getBitcoinURI())); Utilities.openURI(URI.create(getMoneroURI()));
} catch (Exception e) { } catch (Exception e) {
log.warn(e.getMessage()); log.warn(e.getMessage());
new Popup().warning(Res.get("addressTextField.openWallet.failed")).show(); new Popup().warning(Res.get("addressTextField.openWallet.failed")).show();
@ -150,12 +150,15 @@ public class AddressTextField extends AnchorPane {
// Private // Private
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private String getBitcoinURI() { private String getMoneroURI() {
if (amount.get().compareTo(BigInteger.valueOf(0)) < 0) { if (amount.get().compareTo(BigInteger.valueOf(0)) < 0) {
log.warn("Amount must not be negative"); log.warn("Amount must not be negative");
setAmount(BigInteger.valueOf(0)); setAmount(BigInteger.valueOf(0));
} }
return GUIUtil.getBitcoinURI(address.get(), HavenoUtils.atomicUnitsToCoin(amount.get()), return GUIUtil.getMoneroURI(
paymentLabel.get()); address.get(),
amount.get(),
paymentLabel.get(),
HavenoUtils.havenoSetup.getXmrWalletService().getWallet());
} }
} }

View File

@ -96,9 +96,7 @@ import monero.daemon.model.MoneroTx;
import monero.wallet.MoneroWallet; import monero.wallet.MoneroWallet;
import monero.wallet.model.MoneroTxConfig; import monero.wallet.model.MoneroTxConfig;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin; import org.bitcoinj.core.Coin;
import org.bitcoinj.uri.BitcoinURI;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
@ -683,13 +681,6 @@ public class GUIUtil {
.setNote(label)); .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) { public static boolean isBootstrappedOrShowPopup(P2PService p2PService) {
if (p2PService.isBootstrapped() && p2PService.getNumConnectedPeers().get() > 0) { if (p2PService.isBootstrapped() && p2PService.getNumConnectedPeers().get() > 0) {
return true; return true;