示例#1
0
        private async Task ProcessBlockNumber(BigInteger newBlock)
        {
            var transactions = await _web3.Eth.Blocks.GetBlockWithTransactionsByNumber
                               .SendRequestAsync(new HexBigInteger(newBlock));

            if (transactions != null)
            {
                foreach (var it in transactions.Transactions)
                {
                    if (string.IsNullOrEmpty(it.To))
                    {
                        continue;
                    }

                    string     to;
                    BigInteger value;

                    if (TokenSignature.IsTransfer(it.Input))
                    {
                        to    = TokenSignature.TransferTo(it.Input);
                        value = TokenSignature.TransferValue(it.Input);
                    }
                    else
                    {
                        to    = it.To;
                        value = it.Value.Value;
                    }

                    if (Addresses.TryGetValue(new HexBigInteger(to).Value, out var notifData))
                    {
                        if (notifData.NotificationsEnabled)
                        {
                            await NotifyEyEmail(it, notifData, to, value);
                        }
                    }
                }
            }
        }