Add getRandomOfferId method

This commit is contained in:
chimp1984 2019-11-14 21:34:14 -05:00
parent e30875eb15
commit 9865c80b96
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3
2 changed files with 12 additions and 6 deletions

View file

@ -17,9 +17,14 @@
package bisq.core.offer;
import bisq.common.app.Version;
import bisq.common.util.Utilities;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.UUID;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@ -40,5 +45,9 @@ public class CreateOfferService {
// API
///////////////////////////////////////////////////////////////////////////////////////////
public String getRandomOfferId() {
return Utilities.getRandomPrefix(5, 8) + "-" +
UUID.randomUUID().toString() + "-" +
Version.VERSION.replace(".", "");
}
}

View file

@ -89,7 +89,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import javax.annotation.Nullable;
@ -169,8 +168,8 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
MakerFeeProvider makerFeeProvider,
Navigation navigation) {
super(btcWalletService);
this.createOfferService = createOfferService;
this.createOfferService = createOfferService;
this.openOfferManager = openOfferManager;
this.bsqWalletService = bsqWalletService;
this.preferences = preferences;
@ -187,9 +186,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
this.makerFeeProvider = makerFeeProvider;
this.navigation = navigation;
offerId = Utilities.getRandomPrefix(5, 8) + "-" +
UUID.randomUUID().toString() + "-" +
Version.VERSION.replace(".", "");
offerId = createOfferService.getRandomOfferId();
shortOfferId = Utilities.getShortId(offerId);
addressEntry = btcWalletService.getOrCreateAddressEntry(offerId, AddressEntry.Context.OFFER_FUNDING);