private void UpdateNode(int roundNumber) { if (roundNumber > 0) { this.repository = DependencyResolver.Resolve <IRepositoryFactory>().Create(roundNumber); } }
public TangleMessenger(Seed seed, int minWeightMagnitude = 14) { this.seed = seed; this.MinWeight = minWeightMagnitude; this.repository = DependencyResolver.Resolve <IRepositoryFactory>().Create(); this.ShortStorageAddressList = new List <string>(); this.sqLite = new SqLiteHelper(); }
public TangleMessenger(Seed seed, int minWeightMagnitude = 14) { this.seed = seed; this.MinWeight = minWeightMagnitude; this.Repository = DependencyResolver.Resolve <IIotaRepository>(); this.ShortStorageAddressList = new List <string>(); this.TransactionCache = DependencyResolver.Resolve <AbstractSqlLiteTransactionCache>(); }
public TangleMessenger(Seed seed, int minWeightMagnitude = 9) { this.seed = seed; this.MinWeight = minWeightMagnitude; var iotaClient = new RestIotaClient(new RestClient("https://nodes.testnet.iota.org:443")); this.repository = new RestIotaRepository(iotaClient, new PoWService(new CpuPearlDiver())); }
/// <summary> /// Initializes a new instance of the <see cref="GetContactsInteractor"/> class. /// </summary> /// <param name="contactRepository"> /// The contact repository. /// </param> /// <param name="transactionCache"> /// The transaction cache. /// </param> /// <param name="iotaRepository"> /// The iota repository. /// </param> public GetContactsInteractor( IContactRepository contactRepository, ITransactionCache transactionCache, IIotaRepository iotaRepository) { this.ContactRepository = contactRepository; this.TransactionCache = transactionCache; this.IotaRepository = iotaRepository; }
public IotaFhirRepository(IIotaRepository repository, IFhirTryteSerializer serializer, IResourceTracker resourceTracker) { this.Serializer = serializer; this.ResourceTracker = resourceTracker; this.ChannelFactory = new MamChannelFactory(CurlMamFactory.Default, CurlMerkleTreeFactory.Default, repository); this.SubscriptionFactory = new MamChannelSubscriptionFactory(repository, CurlMamParser.Default, CurlMask.Default); this.ResultTimes = new List <TimeTrackingEntry>(); this.ReadTimes = new List <ReadTrackingEntry>(); }
public MamService(IIotaRepository repository, IMask mask, Seed seed) { var curl = new Curl(); var treeFactory = new CurlMerkleTreeFactory(new CurlMerkleNodeFactory(curl), new CurlMerkleLeafFactory(new AddressGenerator(seed, SecurityNumber))); var mamFactory = new CurlMamFactory(curl, mask); var mamParser = new CurlMamParser(mask, treeFactory, curl); this.ChannelFactory = new MamChannelFactory(mamFactory, treeFactory, repository); this.SubscriptionFactory = new MamChannelSubscriptionFactory(repository, mamParser); }
/// <inheritdoc /> public InMemoryDeterministicSeedManager( IResourceTracker resourceTracker, ISigningHelper signingHelper, IAddressGenerator addressGenerator, IIotaRepository repository) : base(resourceTracker, signingHelper, addressGenerator, repository) { this.CurrentIndex = -1; this.References = new Dictionary <string, Seed>(); }
public IotaFhirRepository( IIotaRepository repository, IFhirTryteSerializer serializer, IResourceTracker resourceTracker, ISeedManager seedManager) { this.Serializer = serializer; this.ResourceTracker = resourceTracker; this.SeedManager = seedManager; this.ChannelFactory = new MamChannelFactory(CurlMamFactory.Default, CurlMerkleTreeFactory.Default, repository); this.SubscriptionFactory = new MamChannelSubscriptionFactory(repository, CurlMamParser.Default, CurlMask.Default); }
protected DeterministicSeedManager( IResourceTracker resourceTracker, ISigningHelper signingHelper, IAddressGenerator addressGenerator, IIotaRepository repository) { this.ResourceTracker = resourceTracker; this.SigningHelper = signingHelper; this.AddressGenerator = addressGenerator; this.SubscriptionFactory = new MamChannelSubscriptionFactory(repository, CurlMamParser.Default, CurlMask.Default); this.ChannelFactory = new MamChannelFactory(CurlMamFactory.Default, CurlMerkleTreeFactory.Default, repository); }
/// <inheritdoc /> public SeedManager( IResourceTracker resourceTracker, ISigningHelper signingHelper, IAddressGenerator addressGenerator, IIotaRepository repository, IEncryption encryption, string databaseFilename = "iotafhir.sqlite") : base(resourceTracker, signingHelper, addressGenerator, repository) { this.Encryption = encryption; this.ConnectionString = databaseFilename; this.Init(databaseFilename); }
public TanglePublisher(ILogger <TanglePublisher> logger, string seed = "GDVTSMDKOYGGGLVIREISBCSMZXNMPDITXEKDOAERGHQOTOCTPYHGZZZBWDWGUKWILX9SKXYSHZNUYEFWK", string uri = "https://nodes.testnet.iota.org:443") { _logger = logger; _seed = new Seed(seed); _iotaRepository = new RestIotaRepository( new RestIotaClient(new RestClient(uri)), new PoWService(new CpuPearlDiver()) ); }
/// <inheritdoc /> public SqlLiteDeterministicSeedManager( IResourceTracker resourceTracker, ISigningHelper signingHelper, IAddressGenerator addressGenerator, IIotaRepository repository, IEncryption encryption, IDbConnectionSupplier connectionSupplier = null, string databaseFilename = "iotafhir.sqlite") : base(resourceTracker, signingHelper, addressGenerator, repository) { this.Encryption = encryption; this.ConnectionSupplier = connectionSupplier ?? new DefaultDbConnectionSupplier(); this.ConnectionString = $"Data Source={databaseFilename};Version=3;"; DatabaseInitializer.InitFhirDatabase(this.ConnectionSupplier, databaseFilename); }
public static async Task <Bundle> PublishWithAreaCodeAsync(this IIotaRepository repository, TryteString message, IotaAreaCode areaCode, Address address = null) { if (address == null) { address = new Address(Seed.Random().Value); } var bundle = new Bundle(); bundle.AddTransfer(new Transfer { Address = address, Message = message, Tag = new Tag(areaCode.Value), Timestamp = Timestamp.UnixSecondsTimestamp }); bundle.Finalize(); bundle.Sign(); var transactionTrytes = await repository.SendTrytesAsync(bundle.Transactions, 2); return(Bundle.FromTransactionTrytes(transactionTrytes, bundle.Hash)); }
public static async Task <List <Bundle> > FindByAreaCodeAsync(this IIotaRepository repository, IotaAreaCode areaCode) { var result = await repository.FindTransactionsByTagsAsync(new List <Tag> { new Tag(areaCode.Value) }); if (!result.Hashes.Any()) { return(new List <Bundle>()); } var transactionTrytes = await repository.GetTrytesAsync(result.Hashes); var transactions = transactionTrytes.Select(t => Transaction.FromTrytes(t)).ToList(); var bundles = new List <Bundle>(); foreach (var transaction in transactions) { if (bundles.Any(b => b.Hash.Value == transaction.BundleHash.Value)) { bundles.First(b => b.Hash.Value == transaction.BundleHash.Value).Transactions.Add(transaction); } else { var bundle = new Bundle(); bundle.Transactions.Add(transaction); bundles.Add(bundle); } } bundles.ForEach(b => b.Transactions = b.Transactions.OrderBy(t => t.CurrentIndex).ToList()); return(bundles); }
/// <summary> /// Initializes a new instance of the <see cref="Example{T}"/> class. /// </summary> /// <param name="repository"> /// The repository. /// </param> public Example(IIotaRepository repository) { this.Repository = repository; }
public TangleMessenger(IIotaRepository repository) { this.Repository = repository; }
/// <summary> /// Initializes a new instance of the <see cref="MamChannelSubscriptionFactory"/> class. /// </summary> /// <param name="repository"> /// The repository. /// </param> /// <param name="parser"> /// The parser. /// </param> /// <param name="mask"> /// The mask. /// </param> public MamChannelSubscriptionFactory(IIotaRepository repository, IMamParser parser, IMask mask) { this.Repository = repository; this.Parser = parser; this.Mask = mask; }
/// <inheritdoc /> public BroadcastAndStoreTransactionsExample(IIotaRepository repository) : base(repository) { }
public TangleMessenger(IIotaRepository repository, ITransactionCache transactionCache) { this.Repository = repository; this.TransactionCache = transactionCache; }
/// <inheritdoc /> public GetTransfersExample(IIotaRepository repository) : base(repository) { }
/// <inheritdoc /> public GetBundleExample(IIotaRepository repository) : base(repository) { }
/// <inheritdoc /> public PrepareTransferExample(IIotaRepository repository) : base(repository) { }
public TangleMessenger(Seed seed, IIotaRepository repository) { this.seed = seed; this.repository = repository; }
/// <inheritdoc /> public SendTrytesExample(IIotaRepository repository) : base(repository) { }
public MamChannel(IMamFactory mamFactory, IMerkleTreeFactory treeFactory, IIotaRepository repository) { this.MamFactory = mamFactory; this.TreeFactory = treeFactory; this.Repository = repository; }
/// <inheritdoc /> public ReplayBundleExample(IIotaRepository repository) : base(repository) { }
/// <inheritdoc /> public SendTransferExample(IIotaRepository repository) : base(repository) { }
/// <inheritdoc /> public GetInputsExample(IIotaRepository repository) : base(repository) { }
/// <summary> /// Initializes a new instance of the <see cref="AbstractTangleContactRepository"/> class. /// </summary> /// <param name="iotaRepository"> /// The iota repository. /// </param> public AbstractTangleContactRepository(IIotaRepository iotaRepository) { this.IotaRepository = iotaRepository; }