Skip to content

Commit

Permalink
Merge branch 'main' of github.com:planetarium/NineChronicles.Headless…
Browse files Browse the repository at this point in the history
… into 250-merge-main
  • Loading branch information
ipdae committed Feb 13, 2025
2 parents bac999c + 3569618 commit 5f53c88
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
17 changes: 17 additions & 0 deletions NineChronicles.Headless.Tests/GraphTypes/ActionQueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Nekoyume;
using Nekoyume.Action;
using Nekoyume.Action.Garages;
using Nekoyume.Action.Guild.Migration;
using Nekoyume.Helper;
using Nekoyume.Model;
using Nekoyume.Model.EnumType;
Expand Down Expand Up @@ -1584,5 +1585,21 @@ public async Task IssueToken(bool favExist, bool itemExist)
}
}
}

[Fact]
public async Task MigrateStakeAndJoinGuild()
{
var targetAddress = new PrivateKey().Address;
var query = $"{{migrateStakeAndJoinGuild(targetAddress: \"{targetAddress}\")}}";
var queryResult = await ExecuteQueryAsync<ActionQuery>(query, standaloneContext: _standaloneContext);
Assert.Null(queryResult.Errors);

var data = (Dictionary<string, object>)((ExecutionNode)queryResult.Data!).ToValue()!;
var plainValue = _codec.Decode(ByteUtil.ParseHex((string)data["migrateStakeAndJoinGuild"]));
Assert.IsType<Dictionary>(plainValue);
var polymorphicAction = DeserializeNCAction(plainValue);
var action = Assert.IsType<MigrateStakeAndJoinGuild>(polymorphicAction);
Assert.Equal(targetAddress, action.Target);
}
}
}
15 changes: 15 additions & 0 deletions NineChronicles.Headless/GraphTypes/ActionQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,21 @@ public ActionQuery(StandaloneContext standaloneContext)
name: "claimUnbonded",
resolve: context => Encode(context, new ClaimUnbonded()));

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

RegisterHackAndSlash();
RegisterHackAndSlashSweep();
RegisterDailyReward();
Expand Down

0 comments on commit 5f53c88

Please sign in to comment.