use of bisq.core.offer.availability.OfferAvailabilityModel in project bisq-core by bisq-network.
the class Offer method checkOfferAvailability.
// /////////////////////////////////////////////////////////////////////////////////////////
// Availability
// /////////////////////////////////////////////////////////////////////////////////////////
public void checkOfferAvailability(OfferAvailabilityModel model, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
availabilityProtocol = new OfferAvailabilityProtocol(model, () -> {
cancelAvailabilityRequest();
resultHandler.handleResult();
}, (errorMessage) -> {
if (availabilityProtocol != null)
availabilityProtocol.cancel();
log.error(errorMessage);
errorMessageHandler.handleErrorMessage(errorMessage);
});
availabilityProtocol.sendOfferAvailabilityRequest();
}
use of bisq.core.offer.availability.OfferAvailabilityModel in project bisq-core by bisq-network.
the class TradeManager method onTakeOffer.
// First we check if offer is still available then we create the trade with the protocol
public void onTakeOffer(Coin amount, Coin txFee, Coin takerFee, boolean isCurrencyForTakerFeeBtc, long tradePrice, Coin fundsNeededForTrade, Offer offer, String paymentAccountId, boolean useSavingsWallet, TradeResultHandler tradeResultHandler, ErrorMessageHandler errorMessageHandler) {
final OfferAvailabilityModel model = getOfferAvailabilityModel(offer);
offer.checkOfferAvailability(model, () -> {
if (offer.getState() == Offer.State.AVAILABLE)
createTrade(amount, txFee, takerFee, isCurrencyForTakerFeeBtc, tradePrice, fundsNeededForTrade, offer, paymentAccountId, useSavingsWallet, model, tradeResultHandler);
}, errorMessageHandler::handleErrorMessage);
}
Aggregations