mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Add toProtoTradeStatistics2 method
API will use getTradeStatistics and expect TradeStatistics2 not PersistableNetworkPayload
This commit is contained in:
parent
a20449458b
commit
f6b097235f
1 changed files with 8 additions and 5 deletions
|
@ -171,8 +171,7 @@ public final class TradeStatistics2 implements LazyProcessedPayload, Persistable
|
|||
return Hash.getSha256Ripemd160hash(Utilities.objectToJson(this).getBytes(Charsets.UTF_8));
|
||||
}
|
||||
|
||||
@Override
|
||||
public protobuf.PersistableNetworkPayload toProtoMessage() {
|
||||
private protobuf.TradeStatistics2.Builder getBuilder() {
|
||||
final protobuf.TradeStatistics2.Builder builder = protobuf.TradeStatistics2.newBuilder()
|
||||
.setDirection(OfferPayload.Direction.toProtoMessage(direction))
|
||||
.setBaseCurrency(baseCurrency)
|
||||
|
@ -190,12 +189,16 @@ public final class TradeStatistics2 implements LazyProcessedPayload, Persistable
|
|||
.setDepositTxId(depositTxId)
|
||||
.setHash(ByteString.copyFrom(hash));
|
||||
Optional.ofNullable(extraDataMap).ifPresent(builder::putAllExtraData);
|
||||
return protobuf.PersistableNetworkPayload.newBuilder().setTradeStatistics2(builder).build();
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
||||
public protobuf.TradeStatistics2 toProtoTradeStatistics2() {
|
||||
return toProtoMessage().getTradeStatistics2();
|
||||
return getBuilder().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public protobuf.PersistableNetworkPayload toProtoMessage() {
|
||||
return protobuf.PersistableNetworkPayload.newBuilder().setTradeStatistics2(getBuilder()).build();
|
||||
}
|
||||
|
||||
public static TradeStatistics2 fromProto(protobuf.TradeStatistics2 proto) {
|
||||
|
|
Loading…
Add table
Reference in a new issue