public static async Task <ApiResponse> GetDifficulty() { ApiResponse response = new ApiResponse(); try { BlockChainEngine engine = new BlockChainEngine(); BlockDifficultyOM result = await engine.GetDifficulty(); if (result != null) { response.Result = Newtonsoft.Json.Linq.JToken.FromObject(result); } else { response.Result = null; } } catch (ApiCustomException ex) { Logger.Singleton.Error(ex.Message); Logger.Singleton.Error("Api error code is:" + ex.ErrorCode.ToString()); Logger.Singleton.Error("Api error reason is:" + ex.InnerException.ToString()); response.Error = new ApiError(ex.ErrorCode, ex.Message); } catch (Exception ex) { Logger.Singleton.Error(ex.Message); Logger.Singleton.Error("Custom error code is:" + ex.HResult); Logger.Singleton.Error("Custom error reason is:" + ex.InnerException); response.Error = new ApiError(ex.HResult, ex.Message); } return(response); }
public async Task GetDifficulty() { BlockChainEngine engine = new BlockChainEngine(); BlockDifficultyOM result = await engine.GetDifficulty(); Assert.IsNotNull(result); }