public static void Main(string[] args) { var blockService = new BlockService(); var serverInfoService = new ServerInfoService(); var assetService = new AssetExchangeService(); var currentHeight = serverInfoService.GetBlockchainStatus().Result.NumberOfBlocks; var blockHeight = 335690; Block <Transaction> block = null; if (args.Length > 0 && args[0].Equals("-height", StringComparison.InvariantCultureIgnoreCase)) { int.TryParse(args[1], out blockHeight); } Console.WriteLine("Start scanning blockchain at height: {0}", blockHeight); for (; blockHeight < currentHeight; blockHeight++) { block = blockService.GetBlockIncludeTransactions(BlockLocator.ByHeight(blockHeight)).Result; foreach (var transaction in block.Transactions.Where(transaction => transaction.SubType == TransactionSubType.ColoredCoinsDividendPayment)) { var attachment = (ColoredCoinsDividendPaymentAttachment)transaction.Attachment; var asset = assetService.GetAsset(attachment.AssetId).Result; Console.WriteLine("{0} {1} {2} {3}", transaction.Timestamp.ToString("d"), transaction.TransactionId, asset.Name, attachment.AmountPerQnt.Nxt); } } if (block != null) { Console.WriteLine("Last checked block height: {0} ({1})", blockHeight, block.Timestamp.ToString(CultureInfo.InvariantCulture)); } Console.ReadLine(); }
public ServerInfoTests() { var settingsMock = new Mock <IElasticSearchSettings>(); settingsMock.Setup(m => m.Host).Returns("http://example.com"); _clientMock = new Mock <IHttpClientHelper>(); _service = new ServerInfoService(_clientMock.Object, settingsMock.Object); }