mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-10 23:50:10 -04:00
subtract mining fees from destinations in trade protocol
fixes to scheduling and the deposit view display address usage context fix npe when price is null
This commit is contained in:
parent
13d87a32a5
commit
242bc0e3bb
25 changed files with 273 additions and 280 deletions
|
@ -588,7 +588,7 @@ public class MainViewModel implements ViewModel, HavenoSetup.HavenoSetupListener
|
|||
.width(1000)
|
||||
.actionButtonText(Res.get("shared.removeOffer"))
|
||||
.onAction(() -> {
|
||||
openOfferManager.removeOpenOffer(openOffer, () -> {
|
||||
openOfferManager.cancelOpenOffer(openOffer, () -> {
|
||||
log.info("Invalid open offer with ID {} was successfully removed.", openOffer.getId());
|
||||
}, log::error);
|
||||
|
||||
|
|
|
@ -95,8 +95,23 @@ class DepositListItem {
|
|||
}
|
||||
|
||||
private void updateUsage(int subaddressIndex, List<MoneroTxWallet> cachedTxs) {
|
||||
numTxsWithOutputs = xmrWalletService.getTxsWithIncomingOutputs(addressEntry.getSubaddressIndex(), cachedTxs).size();
|
||||
usage = subaddressIndex == 0 ? "Base address" : numTxsWithOutputs == 0 ? Res.get("funds.deposit.unused") : Res.get("funds.deposit.usedInTx", numTxsWithOutputs);
|
||||
numTxsWithOutputs = xmrWalletService.getNumTxsWithIncomingOutputs(addressEntry.getSubaddressIndex(), cachedTxs);
|
||||
switch (addressEntry.getContext()) {
|
||||
case BASE_ADDRESS:
|
||||
usage = Res.get("funds.deposit.baseAddress");
|
||||
break;
|
||||
case AVAILABLE:
|
||||
usage = numTxsWithOutputs == 0 ? Res.get("funds.deposit.unused") : Res.get("funds.deposit.usedInTx", numTxsWithOutputs);
|
||||
break;
|
||||
case OFFER_FUNDING:
|
||||
usage = Res.get("funds.deposit.offerFunding");
|
||||
break;
|
||||
case TRADE_PAYOUT:
|
||||
usage = Res.get("funds.deposit.tradePayout");
|
||||
break;
|
||||
default:
|
||||
usage = addressEntry.getContext().toString();
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
|
|
|
@ -156,7 +156,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
|
|||
addressColumn.setComparator(Comparator.comparing(DepositListItem::getAddressString));
|
||||
balanceColumn.setComparator(Comparator.comparing(DepositListItem::getBalanceAsBI));
|
||||
confirmationsColumn.setComparator(Comparator.comparingLong(o -> o.getNumConfirmationsSinceFirstUsed(txsWithIncomingOutputs)));
|
||||
usageColumn.setComparator(Comparator.comparingInt(DepositListItem::getNumTxsWithOutputs));
|
||||
usageColumn.setComparator(Comparator.comparing(DepositListItem::getUsage));
|
||||
tableView.getSortOrder().add(usageColumn);
|
||||
tableView.setItems(sortedList);
|
||||
|
||||
|
@ -202,8 +202,8 @@ public class DepositView extends ActivatableView<VBox, Void> {
|
|||
generateNewAddressButton = buttonCheckBoxHBox.first;
|
||||
|
||||
generateNewAddressButton.setOnAction(event -> {
|
||||
boolean hasUnUsedAddress = observableList.stream().anyMatch(e -> e.getSubaddressIndex() != 0 && xmrWalletService.getTxsWithIncomingOutputs(e.getSubaddressIndex()).isEmpty());
|
||||
if (hasUnUsedAddress) {
|
||||
boolean hasUnusedAddress = !xmrWalletService.getUnusedAddressEntries().isEmpty();
|
||||
if (hasUnusedAddress) {
|
||||
new Popup().warning(Res.get("funds.deposit.selectUnused")).show();
|
||||
} else {
|
||||
XmrAddressEntry newSavingsAddressEntry = xmrWalletService.getNewAddressEntry();
|
||||
|
@ -311,7 +311,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
|
|||
// cache incoming txs
|
||||
txsWithIncomingOutputs = xmrWalletService.getTxsWithIncomingOutputs();
|
||||
|
||||
// add available address entries and base address
|
||||
// add address entries
|
||||
xmrWalletService.getAddressEntries()
|
||||
.forEach(e -> observableList.add(new DepositListItem(e, xmrWalletService, formatter, txsWithIncomingOutputs)));
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ class OpenOffersDataModel extends ActivatableDataModel {
|
|||
}
|
||||
|
||||
void onRemoveOpenOffer(OpenOffer openOffer, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||
openOfferManager.removeOpenOffer(openOffer, resultHandler, errorMessageHandler);
|
||||
openOfferManager.cancelOpenOffer(openOffer, resultHandler, errorMessageHandler);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ public class BuyerStep4View extends TradeStepView {
|
|||
|
||||
private void handleTradeCompleted() {
|
||||
closeButton.setDisable(true);
|
||||
model.dataModel.xmrWalletService.swapTradeEntryToAvailableEntry(trade.getId(), XmrAddressEntry.Context.TRADE_PAYOUT);
|
||||
model.dataModel.xmrWalletService.swapAddressEntryToAvailable(trade.getId(), XmrAddressEntry.Context.TRADE_PAYOUT);
|
||||
|
||||
openTradeFeedbackWindow();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue