cs-codex-dist-tests/GethPlugin/GethNodeInfo.cs

48 lines
1.5 KiB
C#
Raw Normal View History

2023-09-15 13:52:02 +00:00
using KubernetesWorkflow;
2023-09-15 14:27:08 +00:00
using Logging;
using NethereumWorkflow;
2023-09-15 13:52:02 +00:00
namespace GethPlugin
{
public interface IGethNodeInfo
{
2023-09-15 14:27:08 +00:00
RunningContainer RunningContainer { get; }
Port DiscoveryPort { get; }
Port HttpPort { get; }
Port WsPort { get; }
NethereumInteraction StartInteraction(ILog log);
2023-09-15 13:52:02 +00:00
}
public class GethNodeInfo : IGethNodeInfo
{
2023-09-15 14:27:08 +00:00
public GethNodeInfo(RunningContainer runningContainer, AllGethAccounts allAccounts, string pubKey, Port discoveryPort, Port httpPort, Port wsPort)
2023-09-15 13:52:02 +00:00
{
RunningContainer = runningContainer;
AllAccounts = allAccounts;
Account = allAccounts.Accounts[0];
PubKey = pubKey;
DiscoveryPort = discoveryPort;
2023-09-15 14:27:08 +00:00
HttpPort = httpPort;
WsPort = wsPort;
2023-09-15 13:52:02 +00:00
}
public RunningContainer RunningContainer { get; }
public AllGethAccounts AllAccounts { get; }
public GethAccount Account { get; }
public string PubKey { get; }
public Port DiscoveryPort { get; }
2023-09-15 14:27:08 +00:00
public Port HttpPort { get; }
public Port WsPort { get; }
2023-09-15 13:52:02 +00:00
2023-09-15 14:27:08 +00:00
public NethereumInteraction StartInteraction(ILog log)
{
var address = RunningContainer.Address;
var account = Account;
2023-09-15 13:52:02 +00:00
2023-09-15 14:27:08 +00:00
var creator = new NethereumInteractionCreator(log, address.Host, address.Port, account.PrivateKey);
return creator.CreateWorkflow();
}
2023-09-15 13:52:02 +00:00
}
}