private void WorkerAttemptConnection(object sender, DoWorkEventArgs e)
{
while (true)
{
var blockTxHashes = BlockStudioProjectService.BlockStudioProject.Connection.EthereumService.GetBlockFilterChanges(_txHashFilterId);
if (blockTxHashes.Any())
{
// a new block has arrived
foreach (var blockTxHash in blockTxHashes)
{
var block = BlockStudioProjectService.BlockStudioProject.Connection.EthereumService.GetBlockByHash(blockTxHash,true);
var tx = block.TransactionsFull.FirstOrDefault(x => x.Hash == _newTxHash);
// the tx is now on the blockchain
if (tx != null)
{
BlockStudioProjectService.TransactionReceipt = BlockStudioProjectService.BlockStudioProject.Connection.EthereumService.GetTransactionReceipt(tx.Hash);
_consoleTextBox.WriteConsonsoleMessage("Contract mined!: {0}", BlockStudioProjectService.TransactionReceipt.ContractAddress);
}
}
}
Thread.Sleep(500);
}
}