separate withdraw tx fee and amount in ui

This commit is contained in:
woodser 2022-12-22 10:48:15 +00:00
parent 11c3a786c9
commit ad17228b38
17 changed files with 30 additions and 27 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=仲裁者 / 調停人
tradeDetailsWindow.detailData=詳細データ
txDetailsWindow.headline=トランザクション詳細
txDetailsWindow.btc.note=BTCを送金しました。
txDetailsWindow.xmr.note=BTCを送金しました。
txDetailsWindow.sentTo=送信先
txDetailsWindow.txId=TxId

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -109,6 +109,9 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
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<Label, InputTextField> 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<VBox, Void> {
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<VBox, Void> {
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<VBox, Void> {
// 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();
}

View File

@ -29,15 +29,16 @@ import static bisq.desktop.util.FormBuilder.*;
public class TxDetails extends Overlay<TxDetails> {
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<TxDetails> {
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;
}
}