From b61cf45fc7332903eb169d82b96684863fed0d41 Mon Sep 17 00:00:00 2001 From: Satya Date: Mon, 26 Feb 2024 16:21:23 +0800 Subject: [PATCH] feat: #55 Initial commit for GetConstitutionQuery --- .../queries/GetConstitutionQuery.java | 34 +++++++++++++++++++ .../queries/GetConstitutionResult.java | 12 +++++++ 2 files changed, 46 insertions(+) create mode 100644 core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GetConstitutionQuery.java create mode 100644 core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GetConstitutionResult.java diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GetConstitutionQuery.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GetConstitutionQuery.java new file mode 100644 index 0000000..665fd8b --- /dev/null +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GetConstitutionQuery.java @@ -0,0 +1,34 @@ +package com.bloxbean.cardano.yaci.core.protocol.localstate.queries; + +import co.nstant.in.cbor.model.Array; +import co.nstant.in.cbor.model.DataItem; +import co.nstant.in.cbor.model.UnsignedInteger; +import com.bloxbean.cardano.yaci.core.protocol.handshake.messages.AcceptVersion; +import com.bloxbean.cardano.yaci.core.protocol.localstate.api.Era; +import com.bloxbean.cardano.yaci.core.protocol.localstate.api.EraQuery; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class GetConstitutionQuery implements EraQuery { + private Era era; + + public GetConstitutionQuery() { + this(Era.Conway); + } + + @Override + public DataItem serialize(AcceptVersion protocolVersion) { + Array array = new Array(); + array.add(new UnsignedInteger(23)); + + return wrapWithOuterArray(array); + } + + @Override + public GetConstitutionResult deserializeResult(AcceptVersion protocolVersion, DataItem[] di) { + System.out.println(di[0]); + throw new UnsupportedOperationException("Not implemented yet"); + } +} diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GetConstitutionResult.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GetConstitutionResult.java new file mode 100644 index 0000000..bf01511 --- /dev/null +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GetConstitutionResult.java @@ -0,0 +1,12 @@ +package com.bloxbean.cardano.yaci.core.protocol.localstate.queries; + +import com.bloxbean.cardano.yaci.core.protocol.localstate.api.QueryResult; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.ToString; + +@Getter +@AllArgsConstructor +@ToString +public class GetConstitutionResult implements QueryResult { +}