mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 02:12:00 +01:00
Add new extraMap entry for offer.
If maker is seller and is a xmr offer and has autoConf enabled we set a flag ("1")
This commit is contained in:
parent
20135a1662
commit
7280fb822d
@ -203,7 +203,9 @@ public class CreateOfferService {
|
||||
Map<String, String> extraDataMap = OfferUtil.getExtraDataMap(accountAgeWitnessService,
|
||||
referralIdService,
|
||||
paymentAccount,
|
||||
currencyCode);
|
||||
currencyCode,
|
||||
preferences,
|
||||
direction);
|
||||
|
||||
OfferUtil.validateOfferData(filterManager,
|
||||
p2PService,
|
||||
|
@ -85,6 +85,8 @@ 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";
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -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, "1"));
|
||||
}
|
||||
|
||||
return extraDataMap.isEmpty() ? null : extraDataMap;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user