private static async Task <CancelResult> ParseResponseAsync(string response) { CancelResult result = new CancelResult(); using (JsonTextReader jtr = new JsonTextReader(new StringReader(response))) { while (await jtr.ReadAsync().ConfigureAwait(false)) { if (jtr.Value == null) { continue; } else if (jtr.Value.ToString() == "success") { result.Success = true; await jtr.ReadAsync().ConfigureAwait(false); result.Message = jtr.Value.ToString(); } else if (jtr.Value.ToString() == "error") { result.Success = false; await jtr.ReadAsync().ConfigureAwait(false); result.Error = jtr.Value.ToString(); } else { continue; } } } return(result); }
/// <summary> /// Attempts to cancel pending exchange /// </summary> /// <param name="Address">The deposit address associated with the pending transaction.</param> /// <returns>Result of cancel operation.</returns> public static async Task <CancelResult> CancelExchangeAsync(string Address) => await CancelResult.CancelAsync(Address).ConfigureAwait(false);