public static async Task <ApiResponse> GetTransaction(string txId) { ApiResponse response = new ApiResponse(); try { Transaction trans = new Transaction(); List <Payment> list = new List <Payment>(); TransactionOM result = await trans.GetTransaction(txId); if (result != null) { response.Result = Newtonsoft.Json.Linq.JToken.FromObject(result); } else { response.Result = null; } } catch (ApiCustomException ex) { Logger.Singleton.Error(ex.ToString()); response.Error = new ApiError(ex.ErrorCode, ex.ToString()); } catch (Exception ex) { Logger.Singleton.Error(ex.ToString()); response.Error = new ApiError(ex.HResult, ex.ToString()); } return(response); }
public async Task <TransactionOM> GetTransaction(string txId) { AuthenticationHeaderValue authHeaderValue = null; RpcClient client = new RpcClient(new Uri(WalletNetwork.NetWork), authHeaderValue, null, null, "application/json"); RpcRequest request = RpcRequest.WithParameterList("GetTransaction", new List <object> { txId }, 1); RpcResponse response = await client.SendRequestAsync(request); if (response.HasError) { throw new ApiCustomException(response.Error.Code, response.Error.Message); } TransactionOM responseValue = response.GetResult <TransactionOM>(); return(responseValue); }