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 tradeDetailsWindow.detailData=Detail data
txDetailsWindow.headline=Transaction Details txDetailsWindow.headline=Transaction Details
txDetailsWindow.btc.note=You have sent BTC. txDetailsWindow.xmr.note=You have sent XMR.
txDetailsWindow.sentTo=Sent to txDetailsWindow.sentTo=Sent to
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Rozhodce/Mediátor
tradeDetailsWindow.detailData=Detailní data tradeDetailsWindow.detailData=Detailní data
txDetailsWindow.headline=Detaily transakce txDetailsWindow.headline=Detaily transakce
txDetailsWindow.btc.note=Poslali jste BTC. txDetailsWindow.xmr.note=Poslali jste BTC.
txDetailsWindow.sentTo=Odesláno na txDetailsWindow.sentTo=Odesláno na
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Vermittler/Mediator
tradeDetailsWindow.detailData=Detaillierte Daten tradeDetailsWindow.detailData=Detaillierte Daten
txDetailsWindow.headline=Transaktionsdetails txDetailsWindow.headline=Transaktionsdetails
txDetailsWindow.btc.note=Sie haben BTC gesendet. txDetailsWindow.xmr.note=Sie haben BTC gesendet.
txDetailsWindow.sentTo=Gesendet an txDetailsWindow.sentTo=Gesendet an
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Árbitro/Mediador
tradeDetailsWindow.detailData=Detalle de datos tradeDetailsWindow.detailData=Detalle de datos
txDetailsWindow.headline=Detalles de transacción txDetailsWindow.headline=Detalles de transacción
txDetailsWindow.btc.note=Ha enviado BTC txDetailsWindow.xmr.note=Ha enviado BTC
txDetailsWindow.sentTo=Enviado a txDetailsWindow.sentTo=Enviado a
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Arbitrator/Mediator
tradeDetailsWindow.detailData=Detail data tradeDetailsWindow.detailData=Detail data
txDetailsWindow.headline=Transaction Details txDetailsWindow.headline=Transaction Details
txDetailsWindow.btc.note=You have sent BTC. txDetailsWindow.xmr.note=You have sent BTC.
txDetailsWindow.sentTo=Sent to txDetailsWindow.sentTo=Sent to
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

@ -1502,7 +1502,7 @@ tradeDetailsWindow.agentAddresses=Arbitre/Médiateur
tradeDetailsWindow.detailData=Données détaillées tradeDetailsWindow.detailData=Données détaillées
txDetailsWindow.headline=Détails de la transaction 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.sentTo=Envoyé à
txDetailsWindow.txId=ID de transaction txDetailsWindow.txId=ID de transaction

View file

@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Arbitro/Mediatore
tradeDetailsWindow.detailData=Detail data tradeDetailsWindow.detailData=Detail data
txDetailsWindow.headline=Transaction Details txDetailsWindow.headline=Transaction Details
txDetailsWindow.btc.note=You have sent BTC. txDetailsWindow.xmr.note=You have sent BTC.
txDetailsWindow.sentTo=Sent to txDetailsWindow.sentTo=Sent to
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

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

View file

@ -1506,7 +1506,7 @@ tradeDetailsWindow.agentAddresses=Árbitro/Mediador
tradeDetailsWindow.detailData=Detail data tradeDetailsWindow.detailData=Detail data
txDetailsWindow.headline=Transaction Details txDetailsWindow.headline=Transaction Details
txDetailsWindow.btc.note=You have sent BTC. txDetailsWindow.xmr.note=You have sent BTC.
txDetailsWindow.sentTo=Sent to txDetailsWindow.sentTo=Sent to
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

@ -1499,7 +1499,7 @@ tradeDetailsWindow.agentAddresses=Árbitro/Mediador
tradeDetailsWindow.detailData=Detail data tradeDetailsWindow.detailData=Detail data
txDetailsWindow.headline=Transaction Details txDetailsWindow.headline=Transaction Details
txDetailsWindow.btc.note=You have sent BTC. txDetailsWindow.xmr.note=You have sent BTC.
txDetailsWindow.sentTo=Sent to txDetailsWindow.sentTo=Sent to
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Arbitrator/Mediator
tradeDetailsWindow.detailData=Detail data tradeDetailsWindow.detailData=Detail data
txDetailsWindow.headline=Transaction Details txDetailsWindow.headline=Transaction Details
txDetailsWindow.btc.note=You have sent BTC. txDetailsWindow.xmr.note=You have sent BTC.
txDetailsWindow.sentTo=Sent to txDetailsWindow.sentTo=Sent to
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

@ -1501,7 +1501,7 @@ tradeDetailsWindow.agentAddresses=Arbitrator/Mediator
tradeDetailsWindow.detailData=Detail data tradeDetailsWindow.detailData=Detail data
txDetailsWindow.headline=Transaction Details txDetailsWindow.headline=Transaction Details
txDetailsWindow.btc.note=You have sent BTC. txDetailsWindow.xmr.note=You have sent BTC.
txDetailsWindow.sentTo=Sent to txDetailsWindow.sentTo=Sent to
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

@ -1503,7 +1503,7 @@ tradeDetailsWindow.agentAddresses=Arbitrator/Mediator
tradeDetailsWindow.detailData=Detail data tradeDetailsWindow.detailData=Detail data
txDetailsWindow.headline=Transaction Details txDetailsWindow.headline=Transaction Details
txDetailsWindow.btc.note=You have sent BTC. txDetailsWindow.xmr.note=You have sent BTC.
txDetailsWindow.sentTo=Sent to txDetailsWindow.sentTo=Sent to
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

@ -1502,7 +1502,7 @@ tradeDetailsWindow.agentAddresses=仲裁员/调解员
tradeDetailsWindow.detailData=详情数据 tradeDetailsWindow.detailData=详情数据
txDetailsWindow.headline=Transaction Details txDetailsWindow.headline=Transaction Details
txDetailsWindow.btc.note=You have sent BTC. txDetailsWindow.xmr.note=You have sent BTC.
txDetailsWindow.sentTo=Sent to txDetailsWindow.sentTo=Sent to
txDetailsWindow.txId=TxId txDetailsWindow.txId=TxId

View file

@ -1502,7 +1502,7 @@ tradeDetailsWindow.agentAddresses=仲裁員/調解員
tradeDetailsWindow.detailData=Detail data tradeDetailsWindow.detailData=Detail data
txDetailsWindow.headline=Transaction Details txDetailsWindow.headline=Transaction Details
txDetailsWindow.btc.note=You have sent BTC. txDetailsWindow.xmr.note=You have sent BTC.
txDetailsWindow.sentTo=Sent to txDetailsWindow.sentTo=Sent to
txDetailsWindow.txId=TxId 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")); final TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, rowIndex, 4, Res.get("funds.deposit.withdrawFromWallet"));
titledGroupBg.getStyleClass().add("last"); titledGroupBg.getStyleClass().add("last");
withdrawToTextField = addTopLabelInputTextField(gridPane, ++rowIndex,
Res.get("funds.withdrawal.toLabel", Res.getBaseCurrencyCode())).second;
final Tuple2<Label, InputTextField> amountTuple3 = addTopLabelInputTextField(gridPane, ++rowIndex, final Tuple2<Label, InputTextField> amountTuple3 = addTopLabelInputTextField(gridPane, ++rowIndex,
Res.get("funds.withdrawal.receiverAmount", Res.getBaseCurrencyCode()), Res.get("funds.withdrawal.receiverAmount", Res.getBaseCurrencyCode()),
Layout.COMPACT_FIRST_ROW_DISTANCE); Layout.COMPACT_FIRST_ROW_DISTANCE);
@ -117,9 +120,6 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
amountTextField = amountTuple3.second; amountTextField = amountTuple3.second;
amountTextField.setMinWidth(180); amountTextField.setMinWidth(180);
withdrawToTextField = addTopLabelInputTextField(gridPane, ++rowIndex,
Res.get("funds.withdrawal.toLabel", Res.getBaseCurrencyCode())).second;
withdrawMemoTextField = addTopLabelInputTextField(gridPane, ++rowIndex, withdrawMemoTextField = addTopLabelInputTextField(gridPane, ++rowIndex,
Res.get("funds.withdrawal.memoLabel", Res.getBaseCurrencyCode())).second; 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() MoneroTxWallet tx = xmrWalletService.getWallet().createTx(new MoneroTxConfig()
.setAccountIndex(0) .setAccountIndex(0)
.setAmount(HavenoUtils.coinToAtomicUnits(receiverAmount)) // TODO: rename to centinerosToAtomicUnits()? .setAmount(HavenoUtils.coinToAtomicUnits(receiverAmount)) // TODO: rename to centinerosToAtomicUnits()?
.setAddress(withdrawToAddress) .setAddress(withdrawToAddress));
.setNote(withdrawMemoTextField.getText()));
// create confirmation message // create confirmation message
Coin sendersAmount = receiverAmount;
Coin fee = HavenoUtils.atomicUnitsToCoin(tx.getFee()); Coin fee = HavenoUtils.atomicUnitsToCoin(tx.getFee());
Coin sendersAmount = receiverAmount.add(fee);
String messageText = Res.get("shared.sendFundsDetailsWithFee", String messageText = Res.get("shared.sendFundsDetailsWithFee",
formatter.formatCoinWithCode(sendersAmount), formatter.formatCoinWithCode(sendersAmount),
withdrawToAddress, withdrawToAddress,
@ -212,9 +211,10 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
// relay tx // relay tx
try { try {
xmrWalletService.getWallet().relayTx(tx); 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"; String key = "showTransactionSent";
if (DontShowAgainLookup.showAgain(key)) { 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) .dontShowAgainId(key)
.show(); .show();
} }

View file

@ -29,15 +29,16 @@ import static bisq.desktop.util.FormBuilder.*;
public class TxDetails extends Overlay<TxDetails> { public class TxDetails extends Overlay<TxDetails> {
protected String txId, address, amount, note; protected String txId, address, amount, fee, memo;
protected TxIdTextField txIdTextField; 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; type = Type.Attention;
this.txId = txId; this.txId = txId;
this.address = address; this.address = address;
this.amount = amount; this.amount = amount;
this.note = Res.get("txDetailsWindow.btc.note"); this.fee = fee;
this.memo = memo;
} }
public void show() { public void show() {
@ -57,12 +58,14 @@ public class TxDetails extends Overlay<TxDetails> {
protected void addContent() { protected void addContent() {
GridPane.setColumnSpan( GridPane.setColumnSpan(
addMultilineLabel(gridPane, ++rowIndex, note, 0), 2); addMultilineLabel(gridPane, ++rowIndex, Res.get("txDetailsWindow.xmr.note"), 0), 2);
Region spacer = new Region(); Region spacer = new Region();
spacer.setMinHeight(20); spacer.setMinHeight(20);
gridPane.add(spacer, 0, ++rowIndex); gridPane.add(spacer, 0, ++rowIndex);
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.amount"), amount);
addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("txDetailsWindow.sentTo"), address); 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; txIdTextField = addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("txDetailsWindow.txId"), txId).second;
} }
} }