Skip to content

Commit

Permalink
feat: Add action query for guild
Browse files Browse the repository at this point in the history
  • Loading branch information
s2quake committed Dec 17, 2024
1 parent 856a271 commit 81d87e9
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions NineChronicles.Headless/GraphTypes/ActionQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -596,6 +598,86 @@ public ActionQuery(StandaloneContext standaloneContext)
context,
new FixToRefundFromNonValidator(targets));
});

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

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

Field<ByteStringType>(
name: "joinGuild",
arguments: new QueryArguments(
new QueryArgument<NonNullGraphType<AddressType>>
{
Name = "guildAddress",
Description = "The guild address to join."
}),
resolve: context =>
{
var address = context.GetArgument<Address>("guildAddress");
var guildAddress = new GuildAddress(address);
return Encode(context, new JoinGuild(guildAddress));
});

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

Field<ByteStringType>(
name: "moveGuild",
arguments: new QueryArguments(
new QueryArgument<NonNullGraphType<AddressType>>
{
Name = "guildAddress",
Description = "The guild address to move."
}),
resolve: context =>
{
var address = context.GetArgument<Address>("guildAddress");
var guildAddress = new GuildAddress(address);
return Encode(context, new MoveGuild(guildAddress));
});

Field<ByteStringType>(
name: "banGuildMember",
arguments: new QueryArguments(
new QueryArgument<NonNullGraphType<AddressType>>
{
Name = "agentAddress",
Description = "The agent address to ban."
}),
resolve: context =>
{
var address = context.GetArgument<Address>("agentAddress");
var agentAddress = new AgentAddress(address);
return Encode(context, new BanGuildMember(agentAddress));
});

Field<ByteStringType>(
name: "unbanGuildMember",
arguments: new QueryArguments(
new QueryArgument<NonNullGraphType<AddressType>>
{
Name = "agentAddress",
Description = "The agent address to unban."
}),
resolve: context =>
{
var address = context.GetArgument<Address>("agentAddress");
var agentAddress = new AgentAddress(address);
return Encode(context, new UnbanGuildMember(agentAddress));
});

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

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

RegisterHackAndSlash();
RegisterHackAndSlashSweep();
Expand Down

0 comments on commit 81d87e9

Please sign in to comment.