Skip to content

Commit

Permalink
feat: Add action queries for validator
Browse files Browse the repository at this point in the history
  • Loading branch information
s2quake committed Jan 22, 2025
1 parent 2859b0d commit 0a410bc
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions NineChronicles.Headless/GraphTypes/ActionQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Lib9c;
using Nekoyume.Action.Guild;
using Nekoyume.TypedAddress;
using System.Globalization;

namespace NineChronicles.Headless.GraphTypes
{
Expand Down Expand Up @@ -571,6 +572,42 @@ public ActionQuery(StandaloneContext standaloneContext)
currency));
});

Field<ByteStringType>(
name: "unjailValidator",
resolve: context => Encode(context, new UnjailValidator()));

Field<ByteStringType>(
name: "delegateValidator",
arguments: new QueryArguments(
new QueryArgument<NonNullGraphType<StringGraphType>>
{
Description = "A string value of guild gold to delegate.",
Name = "amount",
}),
resolve: context =>
{
var fav = FungibleAssetValue.Parse(
currency: Currencies.GuildGold,
value: context.GetArgument<string>("amount"));
return Encode(context, new DelegateValidator(fav));
});

Field<ByteStringType>(
name: "undelegateValidator",
arguments: new QueryArguments(
new QueryArgument<NonNullGraphType<StringGraphType>>
{
Description = "A string value of share to undelegate.",
Name = "share",
}),
resolve: context =>
{
var share = BigInteger.Parse(
value: context.GetArgument<string>("share"),
style: NumberStyles.Number);
return Encode(context, new UndelegateValidator(share));
});

Field<ByteStringType>(
name: "migrateDelegationHeight",
arguments: new QueryArguments(new QueryArgument<LongGraphType>
Expand Down

0 comments on commit 0a410bc

Please sign in to comment.