Skip to content

Commit

Permalink
Merge pull request #3746 from greymistcube/feature/world-gql-version-…
Browse files Browse the repository at this point in the history
…property

✨ Added version field to world state query
  • Loading branch information
greymistcube authored Apr 17, 2024
2 parents 51705f6 + d209c74 commit 2f233fa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ To be released.
### Added APIs

- (Libplanet.Action) Added `ValidatorSetAccount` class. [[#3745]]
- (Libplanet.Explorer) Added `WorldState.version` field. [[#3746]]

### Behavioral changes

Expand All @@ -56,6 +57,7 @@ To be released.
[#3741]: https://github.com/planetarium/libplanet/pull/3741
[#3742]: https://github.com/planetarium/libplanet/pull/3742
[#3745]: https://github.com/planetarium/libplanet/pull/3745
[#3746]: https://github.com/planetarium/libplanet/pull/3746


Version 4.3.0
Expand Down
2 changes: 2 additions & 0 deletions Libplanet.Explorer.Tests/Queries/StateQueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public async Task World()
world(blockHash: ""01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"") {
stateRootHash
legacy
version
}
}
", source: source);
Expand All @@ -40,6 +41,7 @@ public async Task World()
Assert.IsAssignableFrom<IDictionary<string, object>>(resultDict["world"]);
Assert.NotNull(states["stateRootHash"]);
Assert.True((bool)states["legacy"]);
Assert.Equal(0, states["version"]);
}

[Fact]
Expand Down
6 changes: 6 additions & 0 deletions Libplanet.Explorer/GraphTypes/WorldStateType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public WorldStateType()
resolve: context => context.Source.Legacy
);

Field<NonNullGraphType<IntGraphType>>(
name: "version",
description: "The version of the bakcing data model.",
resolve: context => context.Source.Version
);

Field<NonNullGraphType<AccountStateType>>(
name: "account",
description:
Expand Down

0 comments on commit 2f233fa

Please sign in to comment.