use of bisq.common.proto.ProtobufferException in project bisq-core by bisq-network.
the class TradableList method fromProto.
@Nullable
public static TradableList fromProto(PB.TradableList proto, CoreProtoResolver coreProtoResolver, Storage<TradableList<Tradable>> storage, BtcWalletService btcWalletService) {
log.debug("TradableList fromProto of {} ", proto);
List<Tradable> list = proto.getTradableList().stream().map(tradable -> {
switch(tradable.getMessageCase()) {
case OPEN_OFFER:
return OpenOffer.fromProto(tradable.getOpenOffer());
case BUYER_AS_MAKER_TRADE:
return BuyerAsMakerTrade.fromProto(tradable.getBuyerAsMakerTrade(), storage, btcWalletService, coreProtoResolver);
case BUYER_AS_TAKER_TRADE:
return BuyerAsTakerTrade.fromProto(tradable.getBuyerAsTakerTrade(), storage, btcWalletService, coreProtoResolver);
case SELLER_AS_MAKER_TRADE:
return SellerAsMakerTrade.fromProto(tradable.getSellerAsMakerTrade(), storage, btcWalletService, coreProtoResolver);
case SELLER_AS_TAKER_TRADE:
return SellerAsTakerTrade.fromProto(tradable.getSellerAsTakerTrade(), storage, btcWalletService, coreProtoResolver);
default:
log.error("Unknown messageCase. tradable.getMessageCase() = " + tradable.getMessageCase());
throw new ProtobufferException("Unknown messageCase. tradable.getMessageCase() = " + tradable.getMessageCase());
}
}).collect(Collectors.toList());
return new TradableList<>(storage, list);
}
Aggregations