private static async Task <ValidateAddress> ParseResponseAsync(string response) { ValidateAddress va = new ValidateAddress(); using (JsonTextReader jtr = new JsonTextReader(new StringReader(response))) { while (await jtr.ReadAsync().ConfigureAwait(false)) { if (jtr.Value == null) { continue; } else if (jtr.Value.ToString() == "isValid") { await jtr.ReadAsync().ConfigureAwait(false); va.IsValid = jtr.Value.ToString() == "true"; } else if (jtr.Value.ToString() == "error") { await jtr.ReadAsync().ConfigureAwait(false); va.Error = jtr.Value.ToString(); } else { continue; } } } return(va); }
/// <summary> /// Validates address belongs to specified currency. /// </summary> /// <param name="Address">Address to check.</param> /// <param name="Symbol">Ticker symbol for currency to check.</param> /// <returns>Validation results.</returns> public static async Task <ValidateAddress> ValidateAddressAsync(string Address, string Symbol) => await ValidateAddress.ValidateAsync(Address, Symbol).ConfigureAwait(false);