mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Merge pull request #4578 from chimp1984/show-if-maker-has-xmr-autoconf-enabled
Show if maker has xmr autoconf enabled
This commit is contained in:
commit
a1778ed701
9 changed files with 64 additions and 6 deletions
|
@ -203,7 +203,9 @@ public class CreateOfferService {
|
|||
Map<String, String> extraDataMap = OfferUtil.getExtraDataMap(accountAgeWitnessService,
|
||||
referralIdService,
|
||||
paymentAccount,
|
||||
currencyCode);
|
||||
currencyCode,
|
||||
preferences,
|
||||
direction);
|
||||
|
||||
OfferUtil.validateOfferData(filterManager,
|
||||
p2PService,
|
||||
|
|
|
@ -504,6 +504,21 @@ public class Offer implements NetworkPayload, PersistablePayload {
|
|||
return offerPayload.isUseReOpenAfterAutoClose();
|
||||
}
|
||||
|
||||
public boolean isXmrAutoConf() {
|
||||
if (!isXmr()) {
|
||||
return false;
|
||||
}
|
||||
if (getExtraDataMap() == null || !getExtraDataMap().containsKey(OfferPayload.XMR_AUTO_CONF)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getExtraDataMap().get(OfferPayload.XMR_AUTO_CONF).equals(OfferPayload.XMR_AUTO_CONF_ENABLED_VALUE);
|
||||
}
|
||||
|
||||
public boolean isXmr() {
|
||||
return getCurrencyCode().equals("XMR");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
|
|
@ -85,6 +85,9 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
|
|||
// Capability.SIGNED_ACCOUNT_AGE_WITNESS is 11 and Capability.MEDIATION is 12 so if we want to signal that maker
|
||||
// of the offer supports both capabilities we add "11, 12" to capabilities.
|
||||
public static final String CAPABILITIES = "capabilities";
|
||||
// If maker is seller and has xmrAutoConf enabled it is set to "1" otherwise it is not set
|
||||
public static final String XMR_AUTO_CONF = "xmrAutoConf";
|
||||
public static final String XMR_AUTO_CONF_ENABLED_VALUE = "1";
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -31,6 +31,7 @@ import bisq.core.provider.fee.FeeService;
|
|||
import bisq.core.provider.price.MarketPrice;
|
||||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.trade.statistics.ReferralIdService;
|
||||
import bisq.core.user.AutoConfirmSettings;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.coin.CoinUtil;
|
||||
|
@ -333,7 +334,9 @@ public class OfferUtil {
|
|||
public static Map<String, String> getExtraDataMap(AccountAgeWitnessService accountAgeWitnessService,
|
||||
ReferralIdService referralIdService,
|
||||
PaymentAccount paymentAccount,
|
||||
String currencyCode) {
|
||||
String currencyCode,
|
||||
Preferences preferences,
|
||||
OfferPayload.Direction direction) {
|
||||
Map<String, String> extraDataMap = new HashMap<>();
|
||||
if (CurrencyUtil.isFiatCurrency(currencyCode)) {
|
||||
String myWitnessHashAsHex = accountAgeWitnessService.getMyWitnessHashAsHex(paymentAccount.getPaymentAccountPayload());
|
||||
|
@ -351,6 +354,13 @@ public class OfferUtil {
|
|||
|
||||
extraDataMap.put(OfferPayload.CAPABILITIES, Capabilities.app.toStringList());
|
||||
|
||||
if (currencyCode.equals("XMR") && direction == OfferPayload.Direction.SELL) {
|
||||
preferences.getAutoConfirmSettingsList().stream()
|
||||
.filter(e -> e.getCurrencyCode().equals("XMR"))
|
||||
.filter(AutoConfirmSettings::isEnabled)
|
||||
.forEach(e -> extraDataMap.put(OfferPayload.XMR_AUTO_CONF, OfferPayload.XMR_AUTO_CONF_ENABLED_VALUE));
|
||||
}
|
||||
|
||||
return extraDataMap.isEmpty() ? null : extraDataMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ offerbook.offerersAcceptedBankSeats=Accepted seat of bank countries (taker):\n {
|
|||
offerbook.availableOffers=Available offers
|
||||
offerbook.filterByCurrency=Filter by currency
|
||||
offerbook.filterByPaymentMethod=Filter by payment method
|
||||
offerbook.timeSinceSigning=Time since signing
|
||||
offerbook.timeSinceSigning=Signed since
|
||||
offerbook.timeSinceSigning.info=This account was verified and {0}
|
||||
offerbook.timeSinceSigning.info.arbitrator=signed by an arbitrator and can sign peer accounts
|
||||
offerbook.timeSinceSigning.info.peer=signed by a peer, waiting for limits to be lifted
|
||||
|
@ -347,6 +347,7 @@ offerbook.timeSinceSigning.info.signer=signed by peer and can sign peer accounts
|
|||
offerbook.timeSinceSigning.info.banned=account was banned
|
||||
offerbook.timeSinceSigning.daysSinceSigning={0} days
|
||||
offerbook.timeSinceSigning.daysSinceSigning.long={0} since signing
|
||||
offerbook.xmrAutoConf=Is auto-confirm enabled
|
||||
|
||||
offerbook.timeSinceSigning.help=When you successfully complete a trade with a peer who has a signed payment account, your payment account is signed.\n\
|
||||
{0} days later, the initial limit of {1} is lifted and your account can sign other peers'' payment accounts.
|
||||
|
|
|
@ -68,6 +68,7 @@ import org.bitcoinj.core.Coin;
|
|||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import de.jensd.fx.fontawesome.AwesomeIcon;
|
||||
import de.jensd.fx.glyphs.GlyphIcons;
|
||||
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;
|
||||
|
||||
|
@ -867,7 +868,11 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
if (model.isOfferBanned(item.getOffer())) {
|
||||
setGraphic(new AutoTooltipLabel(model.getPaymentMethod(item)));
|
||||
} else {
|
||||
field = new HyperlinkWithIcon(model.getPaymentMethod(item));
|
||||
if (item.getOffer().isXmrAutoConf()) {
|
||||
field = new HyperlinkWithIcon(model.getPaymentMethod(item), AwesomeIcon.ROCKET);
|
||||
} else {
|
||||
field = new HyperlinkWithIcon(model.getPaymentMethod(item));
|
||||
}
|
||||
field.setOnAction(event -> offerDetailsWindow.show(item.getOffer()));
|
||||
field.setTooltip(new Tooltip(model.getPaymentMethodToolTip(item)));
|
||||
setGraphic(field);
|
||||
|
@ -937,6 +942,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
setSortable(false);
|
||||
}
|
||||
};
|
||||
column.getStyleClass().addAll("last-column", "avatar-column");
|
||||
column.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
|
||||
column.setCellFactory(
|
||||
new Callback<>() {
|
||||
|
|
|
@ -433,6 +433,13 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
result = Res.getWithCol("shared.paymentMethod") + " " + Res.get(offer.getPaymentMethod().getId());
|
||||
result += "\n" + Res.getWithCol("shared.currency") + " " + CurrencyUtil.getNameAndCode(offer.getCurrencyCode());
|
||||
|
||||
if (offer.isXmr()) {
|
||||
String isAutoConf = offer.isXmrAutoConf() ?
|
||||
Res.get("shared.yes") :
|
||||
Res.get("shared.no");
|
||||
result += "\n" + Res.getWithCol("offerbook.xmrAutoConf") + " " + isAutoConf;
|
||||
}
|
||||
|
||||
String countryCode = offer.getCountryCode();
|
||||
if (isF2F(offer)) {
|
||||
if (countryCode != null) {
|
||||
|
|
|
@ -87,7 +87,9 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public OfferDetailsWindow(@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, User user, KeyRing keyRing,
|
||||
public OfferDetailsWindow(@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter,
|
||||
User user,
|
||||
KeyRing keyRing,
|
||||
Navigation navigation) {
|
||||
this.formatter = formatter;
|
||||
this.user = user;
|
||||
|
@ -163,6 +165,10 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
|||
if (isF2F)
|
||||
rows += 2;
|
||||
|
||||
if (offer.isXmr()) {
|
||||
rows++;
|
||||
}
|
||||
|
||||
addTitledGroupBg(gridPane, ++rowIndex, rows, Res.get("shared.Offer"));
|
||||
|
||||
String fiatDirectionInfo = "";
|
||||
|
@ -255,6 +261,14 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
|||
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.paymentMethod"), method);
|
||||
}
|
||||
}
|
||||
|
||||
if (offer.isXmr()) {
|
||||
String isAutoConf = offer.isXmrAutoConf() ?
|
||||
Res.get("shared.yes") :
|
||||
Res.get("shared.no");
|
||||
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerbook.xmrAutoConf"), isAutoConf);
|
||||
}
|
||||
|
||||
if (showAcceptedBanks) {
|
||||
if (paymentMethod.equals(PaymentMethod.SAME_BANK)) {
|
||||
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.bankId"), acceptedBanks.get(0));
|
||||
|
|
|
@ -235,7 +235,7 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
|
|||
addConfirmationLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.tradingPeersOnion"),
|
||||
trade.getTradingPeerNodeAddress().getFullAddress());
|
||||
|
||||
if (checkNotNull(trade.getOffer()).getCurrencyCode().equals("XMR") &&
|
||||
if (checkNotNull(trade.getOffer()).isXmr() &&
|
||||
trade.getAssetTxProofResult() != null &&
|
||||
trade.getAssetTxProofResult() != AssetTxProofResult.UNDEFINED) {
|
||||
// As the window is already overloaded we replace the tradingPeersPubKeyHash field with the auto-conf state
|
||||
|
|
Loading…
Add table
Reference in a new issue