From 4cc2d7d112ec1d675e5bd7a778a61bf8cc3533b6 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 2 Nov 2023 11:31:37 -0400 Subject: [PATCH] trade history casts trade to get security deposit when available --- .../haveno/core/trade/ClosedTradableFormatter.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/haveno/core/trade/ClosedTradableFormatter.java b/core/src/main/java/haveno/core/trade/ClosedTradableFormatter.java index edaec0817b..bdecf961a1 100644 --- a/core/src/main/java/haveno/core/trade/ClosedTradableFormatter.java +++ b/core/src/main/java/haveno/core/trade/ClosedTradableFormatter.java @@ -85,13 +85,19 @@ public class ClosedTradableFormatter { } public String getBuyerSecurityDepositAsString(Tradable tradable) { - Trade trade = castToTrade(tradable); - return HavenoUtils.formatXmr(trade.getBuyerSecurityDepositBeforeMiningFee()); + if (tradable instanceof Trade) { + Trade trade = castToTrade(tradable); + return HavenoUtils.formatXmr(trade.getBuyerSecurityDepositBeforeMiningFee()); + } + return HavenoUtils.formatXmr(tradable.getOffer().getMaxBuyerSecurityDeposit()); } public String getSellerSecurityDepositAsString(Tradable tradable) { - Trade trade = castToTrade(tradable); - return HavenoUtils.formatXmr(trade.getSellerSecurityDepositBeforeMiningFee()); + if (tradable instanceof Trade) { + Trade trade = castToTrade(tradable); + return HavenoUtils.formatXmr(trade.getSellerSecurityDepositBeforeMiningFee()); + } + return HavenoUtils.formatXmr(tradable.getOffer().getMaxSellerSecurityDeposit()); } public String getTradeFeeAsString(Tradable tradable, boolean appendCode) {