public async Task <ICollection <Transaction> > SearchTransactionByBlockAndEthAddress(IBodyParams @bodyParams, string ethAddress) { //int.TryParse(blockIdStr, out int blockId); //var @params = new EthBlockScanRequestParam("2.0", "eth_getBlockByNumber", new object[] { $"0x{blockId.ToString("X")}", true }, 1); var resultTask = await _apiService.Execute(ApiUrls.GetTransactions, @bodyParams as EthBlockScanRequestParam); var result = resultTask.Result; if (result == null || result.Result == null) { throw new KeyNotFoundException("No result found for that block"); } return(result.Result.Transactions.Where(t => t.From == ethAddress).ToList()); }
public Task <ApiResult <string> > Put(string action, IBodyParams parameters) { throw new NotImplementedException(); }
private Task <ApiResult <string> > SendAndGetResponseAsync(HttpMethod method, string action, IBodyParams parameters) { var content = parameters?.ToJson() ?? string.Empty; _logger.LogInformation($"{action} sending content:{content}"); var request = new HttpRequestMessage(method, " ") { Content = new StringContent(content, Encoding.UTF8, "application/json") }; CorrectUri(request); return(SendAndGetResponseAsync(request, content)); }
public Task <ApiResult <string> > Post(string action, IBodyParams parameters) { _logger.LogInformation("Post request"); return(SendAndGetResponseAsync(HttpMethod.Post, action, parameters)); }