Search in sources :

Example 1 with PlaceOfferModel

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();
}
Also used : PlaceOfferProtocol(bisq.core.offer.placeoffer.PlaceOfferProtocol) PlaceOfferModel(bisq.core.offer.placeoffer.PlaceOfferModel)

Aggregations

PlaceOfferModel (bisq.core.offer.placeoffer.PlaceOfferModel)1 PlaceOfferProtocol (bisq.core.offer.placeoffer.PlaceOfferProtocol)1