From 2226f4bcea616d9ff5180a8d73d9c6603a521b67 Mon Sep 17 00:00:00 2001 From: s2quake Date: Tue, 17 Dec 2024 14:28:44 +0900 Subject: [PATCH] feat: Add action query for guild --- .../GraphTypes/ActionQuery.cs | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/NineChronicles.Headless/GraphTypes/ActionQuery.cs b/NineChronicles.Headless/GraphTypes/ActionQuery.cs index 9e2803422..2b02225a6 100644 --- a/NineChronicles.Headless/GraphTypes/ActionQuery.cs +++ b/NineChronicles.Headless/GraphTypes/ActionQuery.cs @@ -13,6 +13,8 @@ using Nekoyume.Action.ValidatorDelegation; using Nekoyume.Action.Guild.Migration; using Lib9c; +using Nekoyume.Action.Guild; +using Nekoyume.TypedAddress; namespace NineChronicles.Headless.GraphTypes { @@ -597,6 +599,86 @@ public ActionQuery(StandaloneContext standaloneContext) new FixToRefundFromNonValidator(targets)); }); + Field( + name: "makeGuild", + resolve: context => Encode(context, new MakeGuild())); + + Field( + name: "removeGuild", + resolve: context => Encode(context, new RemoveGuild())); + + Field( + name: "joinGuild", + arguments: new QueryArguments( + new QueryArgument> + { + Name = "guildAddress", + Description = "The guild address to join." + }), + resolve: context => + { + var address = context.GetArgument
("guildAddress"); + var guildAddress = new GuildAddress(address); + return Encode(context, new JoinGuild(guildAddress)); + }); + + Field( + name: "quitGuild", + resolve: context => Encode(context, new QuitGuild())); + + Field( + name: "moveGuild", + arguments: new QueryArguments( + new QueryArgument> + { + Name = "guildAddress", + Description = "The guild address to move." + }), + resolve: context => + { + var address = context.GetArgument
("guildAddress"); + var guildAddress = new GuildAddress(address); + return Encode(context, new MoveGuild(guildAddress)); + }); + + Field( + name: "banGuildMember", + arguments: new QueryArguments( + new QueryArgument> + { + Name = "agentAddress", + Description = "The agent address to ban." + }), + resolve: context => + { + var address = context.GetArgument
("agentAddress"); + var agentAddress = new AgentAddress(address); + return Encode(context, new BanGuildMember(agentAddress)); + }); + + Field( + name: "unbanGuildMember", + arguments: new QueryArguments( + new QueryArgument> + { + Name = "agentAddress", + Description = "The agent address to unban." + }), + resolve: context => + { + var address = context.GetArgument
("agentAddress"); + var agentAddress = new AgentAddress(address); + return Encode(context, new UnbanGuildMember(agentAddress)); + }); + + Field( + name: "claimReward", + resolve: context => Encode(context, new ClaimReward())); + + Field( + name: "claimGuildReward", + resolve: context => Encode(context, new ClaimGuildReward())); + RegisterHackAndSlash(); RegisterHackAndSlashSweep(); RegisterDailyReward();