use of bisq.core.proto.CoreProtoResolver in project bisq-core by bisq-network.
the class UserPayloadModelVOTest method testRoundtripFull.
@Ignore("TODO InvalidKeySpecException at bisq.common.crypto.Sig.getPublicKeyFromBytes(Sig.java:135)")
public void testRoundtripFull() {
UserPayload vo = new UserPayload();
vo.setAccountId("accountId");
vo.setDisplayedAlert(new Alert("message", true, "version", new byte[] { 12, -64, 12 }, "string", null));
vo.setDevelopersFilter(new Filter(Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList(), false, Lists.newArrayList(), "string", new byte[] { 10, 0, 0 }, null));
vo.setRegisteredArbitrator(ArbitratorTest.getArbitratorMock());
vo.setRegisteredMediator(MediatorTest.getMediatorMock());
vo.setAcceptedArbitrators(Lists.newArrayList(ArbitratorTest.getArbitratorMock()));
vo.setAcceptedMediators(Lists.newArrayList(MediatorTest.getMediatorMock()));
UserPayload newVo = UserPayload.fromProto(vo.toProtoMessage().getUserPayload(), new CoreProtoResolver());
}
use of bisq.core.proto.CoreProtoResolver in project bisq-core by bisq-network.
the class UserPayloadModelVOTest method testRoundtrip.
@Ignore("TODO InvalidKeySpecException at bisq.common.crypto.Sig.getPublicKeyFromBytes(Sig.java:135)")
public void testRoundtrip() {
UserPayload vo = new UserPayload();
vo.setAccountId("accountId");
UserPayload newVo = UserPayload.fromProto(vo.toProtoMessage().getUserPayload(), new CoreProtoResolver());
}
use of bisq.core.proto.CoreProtoResolver 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