@@ -0,0 +1,2852 @@
+package bisq.core.api.model;%0A%0Aimport bisq.core.api.model.builder.TradeInfoV1Builder;%0Aimport bisq.core.offer.Offer;%0Aimport bisq.core.offer.OpenOffer;%0A%0Aimport static bisq.core.api.model.ContractInfo.emptyContract;%0Aimport static bisq.core.api.model.OfferInfo.toMyOfferInfo;%0Aimport static bisq.core.offer.OpenOffer.State.CANCELED;%0Aimport static java.lang.String.format;%0Aimport static org.apache.commons.lang3.StringUtils.capitalize;%0A%0A/**%0A * Builds a TradeInfo instance from an OpenOffer with State = CANCELED.%0A */%0Apublic class CanceledTradeInfo %7B%0A%0A    public static TradeInfo toCanceledTradeInfo(OpenOffer myCanceledOpenOffer) %7B%0A        if (!myCanceledOpenOffer.getState().equals(CANCELED))%0A            throw new IllegalArgumentException(format(%22offer '%25s' is not canceled%22, myCanceledOpenOffer.getId()));%0A%0A        Offer offer = myCanceledOpenOffer.getOffer();%0A        OfferInfo offerInfo = toMyOfferInfo(offer);%0A%0A        return new TradeInfoV1Builder()  // TODO May need to use BsqSwapTradeInfoBuilder?%0A                .withOffer(offerInfo)%0A                .withTradeId(myCanceledOpenOffer.getId())%0A                .withShortId(myCanceledOpenOffer.getShortId())%0A                .withDate(myCanceledOpenOffer.getDate().getTime())%0A                .withRole(%22%22)%0A                .withIsCurrencyForTakerFeeBtc(offer.isCurrencyForMakerFeeBtc())%0A                .withTxFeeAsLong(offer.getTxFee().value)%0A                .withTakerFeeAsLong(offer.getMakerFee().value)%0A                .withTakerFeeTxId(%22%22)               // Ignored%0A                .withDepositTxId(%22%22)                // Ignored%0A                .withPayoutTxId(%22%22)                 // Ignored%0A                .withTradeAmountAsLong(0)           // Ignored%0A                .withTradePrice(offer.getPrice().getValue())%0A                .withTradeVolume(0)                 // Ignored%0A                .withBuyerDeposit(offer.getBuyerSecurityDeposit().value)%0A                .withSellerDeposit(offer.getSellerSecurityDeposit().value)%0A                .withTradingPeerNodeAddress(%22%22)     // Ignored%0A                .withState(%22%22)                      // Ignored%0A                .withPhase(%22%22)                      // Ignored%0A                .withTradePeriodState(%22%22)           // Ignored%0A                .withIsDepositPublished(false)      // Ignored%0A                .withIsDepositConfirmed(false)      // Ignored%0A                .withIsFiatSent(false)              // Ignored%0A                .withIsFiatReceived(false)          // Ignored%0A                .withIsPayoutPublished(false)       // Ignored%0A                .withIsWithdrawn(false)             // Ignored%0A                .withContractAsJson(%22%22)             // Ignored%0A                .withContract(emptyContract.get())  // Ignored%0A                .withStatusDescription(capitalize(CANCELED.name().toLowerCase()))%0A                .build();%0A    %7D%0A%7D%0A

Remove commented code