From 8b1db3671f24dc30aff11d38f39921089d9a62f7 Mon Sep 17 00:00:00 2001 From: s2quake Date: Tue, 26 Nov 2024 14:24:28 +0900 Subject: [PATCH] feat: Add action mutation for migration planetarium validator --- .../GraphTypes/ActionMutation.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/NineChronicles.Headless/GraphTypes/ActionMutation.cs b/NineChronicles.Headless/GraphTypes/ActionMutation.cs index 6fb5820f6..73fa984d3 100644 --- a/NineChronicles.Headless/GraphTypes/ActionMutation.cs +++ b/NineChronicles.Headless/GraphTypes/ActionMutation.cs @@ -674,6 +674,34 @@ public ActionMutation(NineChroniclesNodeService service) } } ); + Field>("migratePlanetariumValidator", + description: "Migration Planetarium Validator", + resolve: context => + { + try + { + BlockChain? blockChain = service.BlockChain; + if (blockChain is null) + { + throw new InvalidOperationException($"{nameof(blockChain)} is null."); + } + + var actions = new[] { new MigratePlanetariumValidator() }; + 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 =>