use of bisq.core.offer.placeoffer.PlaceOfferModel in project bisq-core by bisq-network.
the class OpenOfferManager method placeOffer.
// /////////////////////////////////////////////////////////////////////////////////////////
// API
// /////////////////////////////////////////////////////////////////////////////////////////
public void placeOffer(Offer offer, Coin reservedFundsForOffer, boolean useSavingsWallet, TransactionResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
PlaceOfferModel model = new PlaceOfferModel(offer, reservedFundsForOffer, useSavingsWallet, btcWalletService, tradeWalletService, bsqWalletService, offerBookService, user);
PlaceOfferProtocol placeOfferProtocol = new PlaceOfferProtocol(model, transaction -> {
OpenOffer openOffer = new OpenOffer(offer, openOfferTradableListStorage);
openOffers.add(openOffer);
openOfferTradableListStorage.queueUpForSave();
resultHandler.handleResult(transaction);
if (!stopped) {
startPeriodicRepublishOffersTimer();
startPeriodicRefreshOffersTimer();
} else {
log.debug("We have stopped already. We ignore that placeOfferProtocol.placeOffer.onResult call.");
}
}, errorMessageHandler::handleErrorMessage);
placeOfferProtocol.placeOffer();
}
Aggregations