예제 #1
0
        public List <Transaction> GetTransaction(string address, int startingblock)
        {
            List <Transaction> listTransactions = new List <Transaction>();

            string APIKEY = "6H3S7JSIPGMQIEE71BCD8AXXK5YCASZE1F";

            try
            {
                //Using EtherScan api for geting transactions
                var etherscan = new EtherScanClient(APIKEY);
                //get all transactions connected with address
                var allTransactions = etherscan.GetTransactions(address);
                if (allTransactions.Result != null)
                {
                    foreach (var item in allTransactions.Result)
                    {
                        //Store only transactions that are happend after starting block
                        if (Convert.ToInt32(item.BlockNumber) >= startingblock)
                        {
                            Transaction _transaction = new Transaction()
                            {
                                TransactionID = item.TxId,
                                AdressFrom    = item.FromId,
                                AdressTo      = item.ToId,
                                HexNumber     = new HexBigInteger(item.BlockNumber),
                                BlockNumber   = item.BlockNumber.ToString(),
                                Value         = item.Value,
                                TimeSpan      = item.TimeStamp.Date
                            };

                            listTransactions.Add(_transaction);
                        }
                    }
                    return(listTransactions);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #2
0
 public ContractsController(KeepIndexerContext context, EtherScanClient etherScanClient)
 {
     _context         = context;
     _etherScanClient = etherScanClient;
 }
예제 #3
0
 public ContractsController(KeepIndexerContext context, EtherScanClient etherScanClient, IConfiguration configuration)
 {
     _context         = context;
     _etherScanClient = etherScanClient;
     _configuration   = configuration;
 }
 public EthereumExporterClient(ILogger <EthereumExporterClient> logger, EthereumExporterConfiguration configuration)
 {
     _logger          = logger;
     _configuration   = configuration;
     _etherScanClient = new EtherScanClient(configuration.EtherscanApiKey);
 }