Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions tools/SendBlobs/SetupCli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ public static void SetupDistributeCommand(Command root)
parseResult.GetValue(rpcUrlOption)!,
SimpleConsoleLogManager.Instance.GetClassLogger());

string? chainIdString = await rpcClient.Post<string>("eth_chainId") ?? "1";
ulong chainId = HexConvert.ToUInt64(chainIdString);
ulong chainId = await GetChainIdAsync(rpcClient);

Signer signer = new(chainId, new PrivateKey(parseResult.GetValue(privateKeyOption)!),
SimpleConsoleLogManager.Instance);
Expand Down Expand Up @@ -263,8 +262,7 @@ public static void SetupReclaimCommand(Command root)
parseResult.GetValue(rpcUrlOption)!,
SimpleConsoleLogManager.Instance.GetClassLogger());

string? chainIdString = await rpcClient.Post<string>("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(
Expand All @@ -275,6 +273,12 @@ await distributor.ReclaimFunds(
root.Add(command);
}

private static async Task<ulong> GetChainIdAsync(IJsonRpcClient rpcClient)
{
string? chainIdString = await rpcClient.Post<string>("eth_chainId") ?? "1";
return HexConvert.ToUInt64(chainIdString);
}

public static IJsonRpcClient InitRpcClient(string rpcUrl, ILogger logger) =>
new BasicJsonRpcClient(
new Uri(rpcUrl),
Expand Down