From cac8e6fd7221a5ecfaa714129dc5d91457047dfe Mon Sep 17 00:00:00 2001 From: Sotatek-HuyLe3a Date: Tue, 27 Aug 2024 16:09:37 +0700 Subject: [PATCH] chore: rename ConstitutionResult to ConstitutionQueryResult, GovStateResult to GovStateQueryResult --- .../localstate/queries/ConstitutionQuery.java | 6 ++--- ...sult.java => ConstitutionQueryResult.java} | 2 +- .../localstate/queries/GovStateQuery.java | 22 +++++++++---------- ...teResult.java => GovStateQueryResult.java} | 2 +- .../yaci/helper/LocalStateQueryClientIT.java | 8 +++---- 5 files changed, 20 insertions(+), 20 deletions(-) rename core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/{ConstitutionResult.java => ConstitutionQueryResult.java} (85%) rename core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/{GovStateResult.java => GovStateQueryResult.java} (94%) diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/ConstitutionQuery.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/ConstitutionQuery.java index 378718af..a83146cf 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/ConstitutionQuery.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/ConstitutionQuery.java @@ -19,7 +19,7 @@ @AllArgsConstructor @ToString // ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query.hs -public class ConstitutionQuery implements EraQuery { +public class ConstitutionQuery implements EraQuery { @NonNull private Era era; @@ -36,7 +36,7 @@ public DataItem serialize(AcceptVersion protocolVersion) { } @Override - public ConstitutionResult deserializeResult(AcceptVersion protocolVersion, DataItem[] di) { + public ConstitutionQueryResult deserializeResult(AcceptVersion protocolVersion, DataItem[] di) { List dataItemList = ((Array)di[0]).getDataItems(); int type = ((UnsignedInteger)dataItemList.get(0)).getValue().intValue(); //4 @@ -45,6 +45,6 @@ public ConstitutionResult deserializeResult(AcceptVersion protocolVersion, DataI var items = (Array)resultDIList.get(0); Anchor anchor = AnchorSerializer.INSTANCE.deserializeDI(items.getDataItems().get(0)); - return new ConstitutionResult(anchor); + return new ConstitutionQueryResult(anchor); } } diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/ConstitutionResult.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/ConstitutionQueryResult.java similarity index 85% rename from core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/ConstitutionResult.java rename to core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/ConstitutionQueryResult.java index 812f592d..a338de96 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/ConstitutionResult.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/ConstitutionQueryResult.java @@ -9,6 +9,6 @@ @Getter @AllArgsConstructor @ToString -public class ConstitutionResult implements QueryResult { +public class ConstitutionQueryResult implements QueryResult { private Anchor anchor; } diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GovStateQuery.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GovStateQuery.java index d09bfdc5..74c0ee12 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GovStateQuery.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GovStateQuery.java @@ -35,7 +35,7 @@ @Getter @AllArgsConstructor @ToString -public class GovStateQuery implements EraQuery { +public class GovStateQuery implements EraQuery { private Era era; public GovStateQuery() { @@ -51,8 +51,8 @@ public DataItem serialize(AcceptVersion protocolVersion) { } @Override - public GovStateResult deserializeResult(AcceptVersion protocolVersion, DataItem[] di) { - GovStateResult govStateResult = new GovStateResult(); + public GovStateQueryResult deserializeResult(AcceptVersion protocolVersion, DataItem[] di) { + GovStateQueryResult govStateQueryResult = new GovStateQueryResult(); Array array = (Array) di[0]; Array resultArray = (Array) ((Array) array.getDataItems().get(1)).getDataItems().get(0); @@ -60,14 +60,14 @@ public GovStateResult deserializeResult(AcceptVersion protocolVersion, DataItem[ Array committeeResult = (Array) resultArray.getDataItems().get(1); Array committeeDI = (Array) committeeResult.getDataItems().get(0); Committee committee = deserializeCommitteeResult(committeeDI.getDataItems()); - govStateResult.setCommittee(committee); + govStateQueryResult.setCommittee(committee); // constitution Array constitutionArr = (Array) resultArray.getDataItems().get(2); var constitutionDI = constitutionArr.getDataItems().get(0); Constitution constitution = deserializeConstitutionResult(constitutionDI); - govStateResult.setConstitution(constitution); + govStateQueryResult.setConstitution(constitution); // current protocol params Array currentPParams = (Array) resultArray.getDataItems().get(3); @@ -75,13 +75,13 @@ public GovStateResult deserializeResult(AcceptVersion protocolVersion, DataItem[ ProtocolParamUpdate currentProtocolParam = deserializePPResult(paramsDIList); - govStateResult.setCurrentPParams(currentProtocolParam); + govStateQueryResult.setCurrentPParams(currentProtocolParam); Array futurePParams = (Array) resultArray.getDataItems().get(5); if (!futurePParams.getDataItems().isEmpty() && futurePParams.getDataItems().size() > 1) { List futureParamsDIList = ((Array)futurePParams.getDataItems().get(1)).getDataItems(); ProtocolParamUpdate futureProtocolParam = deserializePPResult(futureParamsDIList); - govStateResult.setFuturePParams(futureProtocolParam); + govStateQueryResult.setFuturePParams(futureProtocolParam); } // next ratify state @@ -163,14 +163,14 @@ public GovStateResult deserializeResult(AcceptVersion protocolVersion, DataItem[ .expiredGovActions(expiredGovActions) .build(); - govStateResult.setNextRatifyState(nextRatifyState); + govStateQueryResult.setNextRatifyState(nextRatifyState); // previous protocol params Array prevPParams = (Array) resultArray.getDataItems().get(4); paramsDIList = prevPParams.getDataItems(); ProtocolParamUpdate prevProtocolParam = deserializePPResult(paramsDIList); - govStateResult.setPreviousPParams(prevProtocolParam); + govStateQueryResult.setPreviousPParams(prevProtocolParam); // proposals Array proposalArr = (Array)((Array) resultArray.getDataItems().get(0)).getDataItems().get(1); @@ -184,9 +184,9 @@ public GovStateResult deserializeResult(AcceptVersion protocolVersion, DataItem[ proposals.add(proposal); } - govStateResult.setProposals(proposals); + govStateQueryResult.setProposals(proposals); - return govStateResult; + return govStateQueryResult; } public ProtocolParamUpdate deserializePPResult(List paramsDIList) { diff --git a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GovStateResult.java b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GovStateQueryResult.java similarity index 94% rename from core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GovStateResult.java rename to core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GovStateQueryResult.java index 49fb3c26..c3c8acb5 100644 --- a/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GovStateResult.java +++ b/core/src/main/java/com/bloxbean/cardano/yaci/core/protocol/localstate/queries/GovStateQueryResult.java @@ -15,7 +15,7 @@ @Getter @Setter @ToString -public class GovStateResult implements QueryResult { +public class GovStateQueryResult implements QueryResult { private Committee committee; private Constitution constitution; private ProtocolParamUpdate currentPParams; diff --git a/helper/src/integrationTest/java/com/bloxbean/cardano/yaci/helper/LocalStateQueryClientIT.java b/helper/src/integrationTest/java/com/bloxbean/cardano/yaci/helper/LocalStateQueryClientIT.java index f3a35b12..5ab90f24 100644 --- a/helper/src/integrationTest/java/com/bloxbean/cardano/yaci/helper/LocalStateQueryClientIT.java +++ b/helper/src/integrationTest/java/com/bloxbean/cardano/yaci/helper/LocalStateQueryClientIT.java @@ -326,20 +326,20 @@ void dRepStakeDistributionQuery() { @Test void govStateQuery() { - Mono mono = localStateQueryClient.executeQuery(new GovStateQuery(Era.Conway)); + Mono mono = localStateQueryClient.executeQuery(new GovStateQuery(Era.Conway)); mono = mono.log(); - GovStateResult result = mono.block(Duration.ofSeconds(10)); + GovStateQueryResult result = mono.block(Duration.ofSeconds(10)); assertThat(result.getCommittee()).isNotNull(); assertThat(result.getCurrentPParams()).isNotNull(); } @Test void constitutionQuery() { - Mono mono = localStateQueryClient.executeQuery(new ConstitutionQuery(Era.Conway)); + Mono mono = localStateQueryClient.executeQuery(new ConstitutionQuery(Era.Conway)); mono = mono.log(); - ConstitutionResult result = mono.block(Duration.ofSeconds(5)); + ConstitutionQueryResult result = mono.block(Duration.ofSeconds(5)); assertThat(result).isNotNull(); }