Exemplo n.º 1
0
        public MessengerIotaClient(List <string> nodeUris, IIotaClient client)
        {
            if (nodeUris.Count == 0)
            {
                nodeUris.Add(DefaultNodeUri);
            }

            this.NodeUris       = nodeUris;
            this.InternalClient = client;
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public CachedIotaRestRepository(
            IIotaClient client,
            IPoWService powService,
            IAddressGenerator addressGenerator       = null,
            IDbConnectionSupplier connectionSupplier = null,
            string databaseFilename = "iotacache.sqlite")
            : base(client, powService, addressGenerator)
        {
            this.ConnectionSupplier = connectionSupplier ?? new DefaultDbConnectionSupplier();
            this.ConnectionString   = $"Data Source={databaseFilename};Version=3;";

            DatabaseInitializer.InitCache(this.ConnectionSupplier, databaseFilename);
        }
        private static IPoWService ResolvePoWType(PoWType powType, IIotaClient client = null)
        {
            switch (powType)
            {
            case PoWType.Remote:
                return(new RestPoWService(client));

            case PoWType.PoWSrv:
                return(new PoWSrvService());

            default:
                return(new PoWService(new CpuPearlDiver()));
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RestIotaRepository"/> class.
 /// </summary>
 /// <param name="client">
 /// The client.
 /// </param>
 /// <param name="powService">
 /// The pow service.
 /// </param>
 /// <param name="addressGenerator">
 /// The address Generator.
 /// </param>
 public RestIotaRepository(IIotaClient client, IPoWService powService, IAddressGenerator addressGenerator = null)
 {
     this.Client           = client;
     this.PoWService       = powService;
     this.AddressGenerator = addressGenerator ?? new AddressGenerator();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RestPoWService"/> class.
 /// </summary>
 /// <param name="client">
 /// The client.
 /// </param>
 public RestPoWService(IIotaClient client)
 {
     this.Client = client;
 }