From 32ca5c38366ae9886b4e53874199b2030a267e6f Mon Sep 17 00:00:00 2001 From: Maxim Evtush <154841002+maximevtush@users.noreply.github.com> Date: Thu, 8 Jan 2026 18:34:55 +0200 Subject: [PATCH] Update SetupCli.cs --- tools/SendBlobs/SetupCli.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/SendBlobs/SetupCli.cs b/tools/SendBlobs/SetupCli.cs index af627173441..d6c3275d39f 100644 --- a/tools/SendBlobs/SetupCli.cs +++ b/tools/SendBlobs/SetupCli.cs @@ -201,8 +201,7 @@ public static void SetupDistributeCommand(Command root) parseResult.GetValue(rpcUrlOption)!, SimpleConsoleLogManager.Instance.GetClassLogger()); - string? chainIdString = await rpcClient.Post("eth_chainId") ?? "1"; - ulong chainId = HexConvert.ToUInt64(chainIdString); + ulong chainId = await GetChainIdAsync(rpcClient); Signer signer = new(chainId, new PrivateKey(parseResult.GetValue(privateKeyOption)!), SimpleConsoleLogManager.Instance); @@ -263,8 +262,7 @@ public static void SetupReclaimCommand(Command root) parseResult.GetValue(rpcUrlOption)!, SimpleConsoleLogManager.Instance.GetClassLogger()); - string? chainIdString = await rpcClient.Post("eth_chainId") ?? "1"; - ulong chainId = HexConvert.ToUInt64(chainIdString); + ulong chainId = await GetChainIdAsync(rpcClient); FundsDistributor distributor = new(rpcClient, chainId, parseResult.GetValue(keyFileOption), SimpleConsoleLogManager.Instance); await distributor.ReclaimFunds( @@ -275,6 +273,12 @@ await distributor.ReclaimFunds( root.Add(command); } + private static async Task GetChainIdAsync(IJsonRpcClient rpcClient) + { + string? chainIdString = await rpcClient.Post("eth_chainId") ?? "1"; + return HexConvert.ToUInt64(chainIdString); + } + public static IJsonRpcClient InitRpcClient(string rpcUrl, ILogger logger) => new BasicJsonRpcClient( new Uri(rpcUrl),