From 0a410bc3b50604f6b407ceab4c3099e256067828 Mon Sep 17 00:00:00 2001 From: s2quake Date: Wed, 22 Jan 2025 11:17:55 +0900 Subject: [PATCH] feat: Add action queries for validator --- .../GraphTypes/ActionQuery.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/NineChronicles.Headless/GraphTypes/ActionQuery.cs b/NineChronicles.Headless/GraphTypes/ActionQuery.cs index c221662fa..c505b5ada 100644 --- a/NineChronicles.Headless/GraphTypes/ActionQuery.cs +++ b/NineChronicles.Headless/GraphTypes/ActionQuery.cs @@ -15,6 +15,7 @@ using Lib9c; using Nekoyume.Action.Guild; using Nekoyume.TypedAddress; +using System.Globalization; namespace NineChronicles.Headless.GraphTypes { @@ -571,6 +572,42 @@ public ActionQuery(StandaloneContext standaloneContext) currency)); }); + Field( + name: "unjailValidator", + resolve: context => Encode(context, new UnjailValidator())); + + Field( + name: "delegateValidator", + arguments: new QueryArguments( + new QueryArgument> + { + Description = "A string value of guild gold to delegate.", + Name = "amount", + }), + resolve: context => + { + var fav = FungibleAssetValue.Parse( + currency: Currencies.GuildGold, + value: context.GetArgument("amount")); + return Encode(context, new DelegateValidator(fav)); + }); + + Field( + name: "undelegateValidator", + arguments: new QueryArguments( + new QueryArgument> + { + Description = "A string value of share to undelegate.", + Name = "share", + }), + resolve: context => + { + var share = BigInteger.Parse( + value: context.GetArgument("share"), + style: NumberStyles.Number); + return Encode(context, new UndelegateValidator(share)); + }); + Field( name: "migrateDelegationHeight", arguments: new QueryArguments(new QueryArgument