private async void getReturnAddress(string network) { var apiKey = Read_API(network); string url = "https://block.io/api/v2/get_new_address/" + "?api_key={0}"; string baseUrl = string.Format(url, apiKey); try { HttpClient client = new HttpClient(); string result = await client.GetStringAsync(baseUrl); APIReceive apiData = JsonConvert.DeserializeObject <APIReceive>(result); returnAddress = apiData.data.address; } catch { DisplayMessage("Error Getting Return Address!"); } }
private async void getReceiveAddress(string receiveCurrency) { var apiKey = Read_API(receiveCurrency); string url = "https://block.io/api/v2/get_new_address/" + "?api_key={0}"; string baseUrl = string.Format(url, apiKey); try { HttpClient client = new HttpClient(); string result = await client.GetStringAsync(baseUrl); APIReceive apiData = JsonConvert.DeserializeObject <APIReceive>(result); receiveAddress = apiData.data.address; } catch { } }
private async void Update() { string PickedCurrency = "DogecoinAPIKey"; if (CurrencyPicker == null) { Read_API(PickedCurrency); } else if (CurrencyPicker.SelectedIndex.Equals(1)) { PickedCurrency = "BitcoinAPIKey"; } else if (CurrencyPicker.SelectedIndex.Equals(0)) { PickedCurrency = "DogecoinAPIKey"; } else if (CurrencyPicker.SelectedIndex.Equals(2)) { PickedCurrency = "LitecoinAPIKey"; } HttpClient client = new HttpClient(); var ApiKey = Read_API(PickedCurrency); //https://block.io/api/v2/get_new_address/?api_key= string url = "https://block.io/api/v2/get_new_address/" + "?api_key={0}"; string baseUrl = string.Format(url, ApiKey); try { string result = await client.GetStringAsync(baseUrl); APIReceive apiData = JsonConvert.DeserializeObject <APIReceive>(result); ReceiveAddressBox.Text = apiData.data.address; //https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=Example // CAN USE DOGECHAIN QR API // https://dogechain.info/api/v2/address/qrcode/DTXbfrYymxRakKPC56txP4w4bgD4CpcJdJ string dogechainQR = "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=" + "{0}"; var address = apiData.data.address; string QrUrl = string.Format(dogechainQR, apiData.data.address); //string qrCode = await client.GetStringAsync(QrUrl); QRImageHolder.Source = new BitmapImage(new Uri(QrUrl)); } catch { ReceiveAddressBox.Text = "Error!"; } }