From cf2a853f176984e200141504fe48c8e8f40aa985 Mon Sep 17 00:00:00 2001 From: s2quake Date: Fri, 6 Dec 2024 16:22:23 +0900 Subject: [PATCH] feat: Add MigratePlanetariumGuild action mutation --- .../GraphTypes/ActionMutation.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/NineChronicles.Headless/GraphTypes/ActionMutation.cs b/NineChronicles.Headless/GraphTypes/ActionMutation.cs index 835ce4365..5d492979b 100644 --- a/NineChronicles.Headless/GraphTypes/ActionMutation.cs +++ b/NineChronicles.Headless/GraphTypes/ActionMutation.cs @@ -699,6 +699,34 @@ public ActionMutation(NineChroniclesNodeService service) } } ); + Field>("migratePlanetariumGuild", + description: "Migrate Planetarium Guild", + resolve: context => + { + try + { + BlockChain? blockChain = service.BlockChain; + if (blockChain is null) + { + throw new InvalidOperationException($"{nameof(blockChain)} is null."); + } + + var actions = new[] { new MigratePlanetariumGuild() }; + Transaction tx = blockChain.MakeTransaction( + service.MinerPrivateKey, + actions, + Currencies.Mead * 1, + 1L); + return tx.Id; + } + catch (Exception e) + { + var msg = $"Unexpected exception occurred during {typeof(ActionMutation)}: {e}"; + context.Errors.Add(new ExecutionError(msg, e)); + throw; + } + } + ); Field>("unjailValidator", description: "Unjail validator", resolve: context =>