From ad17228b381a0f5d40f171ff71362b0dc5ab8473 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 22 Dec 2022 10:48:15 +0000 Subject: [PATCH] separate withdraw tx fee and amount in ui --- .../main/resources/i18n/displayStrings.properties | 2 +- .../resources/i18n/displayStrings_cs.properties | 2 +- .../resources/i18n/displayStrings_de.properties | 2 +- .../resources/i18n/displayStrings_es.properties | 2 +- .../resources/i18n/displayStrings_fa.properties | 2 +- .../resources/i18n/displayStrings_fr.properties | 2 +- .../resources/i18n/displayStrings_it.properties | 2 +- .../resources/i18n/displayStrings_ja.properties | 2 +- .../resources/i18n/displayStrings_pt-br.properties | 2 +- .../resources/i18n/displayStrings_pt.properties | 2 +- .../resources/i18n/displayStrings_ru.properties | 2 +- .../resources/i18n/displayStrings_th.properties | 2 +- .../resources/i18n/displayStrings_vi.properties | 2 +- .../i18n/displayStrings_zh-hans.properties | 2 +- .../i18n/displayStrings_zh-hant.properties | 2 +- .../main/funds/withdrawal/WithdrawalView.java | 14 +++++++------- .../desktop/main/overlays/windows/TxDetails.java | 13 ++++++++----- 17 files changed, 30 insertions(+), 27 deletions(-) diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 3cf0656f17..52b270fc63 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -1972,7 +1972,7 @@ tradeDetailsWindow.agentAddresses=Arbitrator/Mediator tradeDetailsWindow.detailData=Detail data txDetailsWindow.headline=Transaction Details -txDetailsWindow.btc.note=You have sent BTC. +txDetailsWindow.xmr.note=You have sent XMR. txDetailsWindow.sentTo=Sent to txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_cs.properties b/core/src/main/resources/i18n/displayStrings_cs.properties index 8d37cd34b5..05c58ac86c 100644 --- a/core/src/main/resources/i18n/displayStrings_cs.properties +++ b/core/src/main/resources/i18n/displayStrings_cs.properties @@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Rozhodce/Mediátor tradeDetailsWindow.detailData=Detailní data txDetailsWindow.headline=Detaily transakce -txDetailsWindow.btc.note=Poslali jste BTC. +txDetailsWindow.xmr.note=Poslali jste BTC. txDetailsWindow.sentTo=Odesláno na txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_de.properties b/core/src/main/resources/i18n/displayStrings_de.properties index c210eed7d5..fe4741f8c7 100644 --- a/core/src/main/resources/i18n/displayStrings_de.properties +++ b/core/src/main/resources/i18n/displayStrings_de.properties @@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Vermittler/Mediator tradeDetailsWindow.detailData=Detaillierte Daten txDetailsWindow.headline=Transaktionsdetails -txDetailsWindow.btc.note=Sie haben BTC gesendet. +txDetailsWindow.xmr.note=Sie haben BTC gesendet. txDetailsWindow.sentTo=Gesendet an txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_es.properties b/core/src/main/resources/i18n/displayStrings_es.properties index d28c108c73..2af0060abe 100644 --- a/core/src/main/resources/i18n/displayStrings_es.properties +++ b/core/src/main/resources/i18n/displayStrings_es.properties @@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Árbitro/Mediador tradeDetailsWindow.detailData=Detalle de datos txDetailsWindow.headline=Detalles de transacción -txDetailsWindow.btc.note=Ha enviado BTC +txDetailsWindow.xmr.note=Ha enviado BTC txDetailsWindow.sentTo=Enviado a txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_fa.properties b/core/src/main/resources/i18n/displayStrings_fa.properties index 85e320403c..8e70e9bd2a 100644 --- a/core/src/main/resources/i18n/displayStrings_fa.properties +++ b/core/src/main/resources/i18n/displayStrings_fa.properties @@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Arbitrator/Mediator tradeDetailsWindow.detailData=Detail data txDetailsWindow.headline=Transaction Details -txDetailsWindow.btc.note=You have sent BTC. +txDetailsWindow.xmr.note=You have sent BTC. txDetailsWindow.sentTo=Sent to txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_fr.properties b/core/src/main/resources/i18n/displayStrings_fr.properties index 6f275e3b3a..e3f9e9def8 100644 --- a/core/src/main/resources/i18n/displayStrings_fr.properties +++ b/core/src/main/resources/i18n/displayStrings_fr.properties @@ -1502,7 +1502,7 @@ tradeDetailsWindow.agentAddresses=Arbitre/Médiateur tradeDetailsWindow.detailData=Données détaillées txDetailsWindow.headline=Détails de la transaction -txDetailsWindow.btc.note=Vous avez envoyé du BTC. +txDetailsWindow.xmr.note=Vous avez envoyé du BTC. txDetailsWindow.sentTo=Envoyé à txDetailsWindow.txId=ID de transaction diff --git a/core/src/main/resources/i18n/displayStrings_it.properties b/core/src/main/resources/i18n/displayStrings_it.properties index 813269ddad..4c7f48d841 100644 --- a/core/src/main/resources/i18n/displayStrings_it.properties +++ b/core/src/main/resources/i18n/displayStrings_it.properties @@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Arbitro/Mediatore tradeDetailsWindow.detailData=Detail data txDetailsWindow.headline=Transaction Details -txDetailsWindow.btc.note=You have sent BTC. +txDetailsWindow.xmr.note=You have sent BTC. txDetailsWindow.sentTo=Sent to txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_ja.properties b/core/src/main/resources/i18n/displayStrings_ja.properties index 569d982506..2720f5e98d 100644 --- a/core/src/main/resources/i18n/displayStrings_ja.properties +++ b/core/src/main/resources/i18n/displayStrings_ja.properties @@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=仲裁者 / 調停人 tradeDetailsWindow.detailData=詳細データ txDetailsWindow.headline=トランザクション詳細 -txDetailsWindow.btc.note=BTCを送金しました。 +txDetailsWindow.xmr.note=BTCを送金しました。 txDetailsWindow.sentTo=送信先 txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_pt-br.properties b/core/src/main/resources/i18n/displayStrings_pt-br.properties index 3316dd7713..fb0a03b405 100644 --- a/core/src/main/resources/i18n/displayStrings_pt-br.properties +++ b/core/src/main/resources/i18n/displayStrings_pt-br.properties @@ -1506,7 +1506,7 @@ tradeDetailsWindow.agentAddresses=Árbitro/Mediador tradeDetailsWindow.detailData=Detail data txDetailsWindow.headline=Transaction Details -txDetailsWindow.btc.note=You have sent BTC. +txDetailsWindow.xmr.note=You have sent BTC. txDetailsWindow.sentTo=Sent to txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_pt.properties b/core/src/main/resources/i18n/displayStrings_pt.properties index a211926bb0..0b55e62f79 100644 --- a/core/src/main/resources/i18n/displayStrings_pt.properties +++ b/core/src/main/resources/i18n/displayStrings_pt.properties @@ -1499,7 +1499,7 @@ tradeDetailsWindow.agentAddresses=Árbitro/Mediador tradeDetailsWindow.detailData=Detail data txDetailsWindow.headline=Transaction Details -txDetailsWindow.btc.note=You have sent BTC. +txDetailsWindow.xmr.note=You have sent BTC. txDetailsWindow.sentTo=Sent to txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_ru.properties b/core/src/main/resources/i18n/displayStrings_ru.properties index 40f2eac915..53cc9b0028 100644 --- a/core/src/main/resources/i18n/displayStrings_ru.properties +++ b/core/src/main/resources/i18n/displayStrings_ru.properties @@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Arbitrator/Mediator tradeDetailsWindow.detailData=Detail data txDetailsWindow.headline=Transaction Details -txDetailsWindow.btc.note=You have sent BTC. +txDetailsWindow.xmr.note=You have sent BTC. txDetailsWindow.sentTo=Sent to txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_th.properties b/core/src/main/resources/i18n/displayStrings_th.properties index a1ea720675..c7eb251c2f 100644 --- a/core/src/main/resources/i18n/displayStrings_th.properties +++ b/core/src/main/resources/i18n/displayStrings_th.properties @@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Arbitrator/Mediator tradeDetailsWindow.detailData=Detail data txDetailsWindow.headline=Transaction Details -txDetailsWindow.btc.note=You have sent BTC. +txDetailsWindow.xmr.note=You have sent BTC. txDetailsWindow.sentTo=Sent to txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_vi.properties b/core/src/main/resources/i18n/displayStrings_vi.properties index 483f99176e..c5e9e1466f 100644 --- a/core/src/main/resources/i18n/displayStrings_vi.properties +++ b/core/src/main/resources/i18n/displayStrings_vi.properties @@ -1503,7 +1503,7 @@ tradeDetailsWindow.agentAddresses=Arbitrator/Mediator tradeDetailsWindow.detailData=Detail data txDetailsWindow.headline=Transaction Details -txDetailsWindow.btc.note=You have sent BTC. +txDetailsWindow.xmr.note=You have sent BTC. txDetailsWindow.sentTo=Sent to txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_zh-hans.properties b/core/src/main/resources/i18n/displayStrings_zh-hans.properties index fb35b67ece..481bf196af 100644 --- a/core/src/main/resources/i18n/displayStrings_zh-hans.properties +++ b/core/src/main/resources/i18n/displayStrings_zh-hans.properties @@ -1502,7 +1502,7 @@ tradeDetailsWindow.agentAddresses=仲裁员/调解员 tradeDetailsWindow.detailData=详情数据 txDetailsWindow.headline=Transaction Details -txDetailsWindow.btc.note=You have sent BTC. +txDetailsWindow.xmr.note=You have sent BTC. txDetailsWindow.sentTo=Sent to txDetailsWindow.txId=TxId diff --git a/core/src/main/resources/i18n/displayStrings_zh-hant.properties b/core/src/main/resources/i18n/displayStrings_zh-hant.properties index 1ed57722ab..e723b14bd8 100644 --- a/core/src/main/resources/i18n/displayStrings_zh-hant.properties +++ b/core/src/main/resources/i18n/displayStrings_zh-hant.properties @@ -1502,7 +1502,7 @@ tradeDetailsWindow.agentAddresses=仲裁員/調解員 tradeDetailsWindow.detailData=Detail data txDetailsWindow.headline=Transaction Details -txDetailsWindow.btc.note=You have sent BTC. +txDetailsWindow.xmr.note=You have sent BTC. txDetailsWindow.sentTo=Sent to txDetailsWindow.txId=TxId diff --git a/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java b/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java index 54f305f482..09e82ba9cd 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java @@ -109,6 +109,9 @@ public class WithdrawalView extends ActivatableView { final TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, rowIndex, 4, Res.get("funds.deposit.withdrawFromWallet")); titledGroupBg.getStyleClass().add("last"); + withdrawToTextField = addTopLabelInputTextField(gridPane, ++rowIndex, + Res.get("funds.withdrawal.toLabel", Res.getBaseCurrencyCode())).second; + final Tuple2 amountTuple3 = addTopLabelInputTextField(gridPane, ++rowIndex, Res.get("funds.withdrawal.receiverAmount", Res.getBaseCurrencyCode()), Layout.COMPACT_FIRST_ROW_DISTANCE); @@ -117,9 +120,6 @@ public class WithdrawalView extends ActivatableView { amountTextField = amountTuple3.second; amountTextField.setMinWidth(180); - withdrawToTextField = addTopLabelInputTextField(gridPane, ++rowIndex, - Res.get("funds.withdrawal.toLabel", Res.getBaseCurrencyCode())).second; - withdrawMemoTextField = addTopLabelInputTextField(gridPane, ++rowIndex, Res.get("funds.withdrawal.memoLabel", Res.getBaseCurrencyCode())).second; @@ -191,12 +191,11 @@ public class WithdrawalView extends ActivatableView { MoneroTxWallet tx = xmrWalletService.getWallet().createTx(new MoneroTxConfig() .setAccountIndex(0) .setAmount(HavenoUtils.coinToAtomicUnits(receiverAmount)) // TODO: rename to centinerosToAtomicUnits()? - .setAddress(withdrawToAddress) - .setNote(withdrawMemoTextField.getText())); + .setAddress(withdrawToAddress)); // create confirmation message + Coin sendersAmount = receiverAmount; Coin fee = HavenoUtils.atomicUnitsToCoin(tx.getFee()); - Coin sendersAmount = receiverAmount.add(fee); String messageText = Res.get("shared.sendFundsDetailsWithFee", formatter.formatCoinWithCode(sendersAmount), withdrawToAddress, @@ -212,9 +211,10 @@ public class WithdrawalView extends ActivatableView { // relay tx try { xmrWalletService.getWallet().relayTx(tx); + xmrWalletService.getWallet().setTxNote(tx.getHash(), withdrawMemoTextField.getText()); // TODO (monero-java): tx note does not persist when tx created then relayed String key = "showTransactionSent"; if (DontShowAgainLookup.showAgain(key)) { - new TxDetails(tx.getHash(), withdrawToAddress, formatter.formatCoinWithCode(sendersAmount)) + new TxDetails(tx.getHash(), withdrawToAddress, formatter.formatCoinWithCode(sendersAmount), formatter.formatCoinWithCode(fee), xmrWalletService.getWallet().getTxNote(tx.getHash())) .dontShowAgainId(key) .show(); } diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TxDetails.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TxDetails.java index 484753bf83..2f64c161a1 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TxDetails.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TxDetails.java @@ -29,15 +29,16 @@ import static bisq.desktop.util.FormBuilder.*; public class TxDetails extends Overlay { - protected String txId, address, amount, note; + protected String txId, address, amount, fee, memo; protected TxIdTextField txIdTextField; - public TxDetails(String txId, String address, String amount) { + public TxDetails(String txId, String address, String amount, String fee, String memo) { type = Type.Attention; this.txId = txId; this.address = address; this.amount = amount; - this.note = Res.get("txDetailsWindow.btc.note"); + this.fee = fee; + this.memo = memo; } public void show() { @@ -57,12 +58,14 @@ public class TxDetails extends Overlay { protected void addContent() { GridPane.setColumnSpan( - addMultilineLabel(gridPane, ++rowIndex, note, 0), 2); + addMultilineLabel(gridPane, ++rowIndex, Res.get("txDetailsWindow.xmr.note"), 0), 2); Region spacer = new Region(); spacer.setMinHeight(20); gridPane.add(spacer, 0, ++rowIndex); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.amount"), amount); addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("txDetailsWindow.sentTo"), address); + addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.amount"), amount); + addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.txFee"), fee); + if (memo != null && !"".equals(memo)) addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("funds.withdrawal.memoLabel"), memo); txIdTextField = addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("txDetailsWindow.txId"), txId).second; } }