/// <summary> /// Generates a new address and adds it to the wallet. /// </summary> /// <param name="label">Label to attach to this address</param> /// <returns>An instance of the Address class</returns> /// <exception cref="ServerApiException">If the server returns an error</exception> public async Task <WalletAddress> NewAddressAsync(string label = null) { QueryString queryString = BuildBasicQueryString(); if (label != null) { queryString.Add("label", label); } string route = $"merchant/{identifier}/new_address"; WalletAddress addressObj = await httpClient.GetAsync <WalletAddress>(route, queryString); return(addressObj); }
/// <summary> /// Retrieves an address from the wallet. /// </summary> /// <param name="address"> Address in the wallet to look up</param> /// <returns>An instance of the Address class</returns> /// <exception cref="ServerApiException">If the server returns an error</exception> public async Task <WalletAddress> GetAddressAsync(string address) { if (string.IsNullOrWhiteSpace(address)) { throw new ArgumentNullException(nameof(address)); } QueryString queryString = BuildBasicQueryString(); queryString.Add("address", address); string route = $"merchant/{identifier}/address_balance"; WalletAddress addressObj = await httpClient.GetAsync <WalletAddress>(route, queryString); return(addressObj); }
/// <summary> /// Retrieves an address from the wallet. /// </summary> /// <param name="address"> Address in the wallet to look up</param> /// <param name="confirmations">Minimum number of confirmations transactions /// must have before being included in the balance of addresses (can be 0)</param> /// <returns>An instance of the Address class</returns> /// <exception cref="ServerApiException">If the server returns an error</exception> public async Task <WalletAddress> GetAddressAsync(string address, int confirmations = 0) { if (string.IsNullOrWhiteSpace(address)) { throw new ArgumentNullException(nameof(address)); } if (confirmations < 0) { throw new ArgumentOutOfRangeException(nameof(confirmations), "Confirmations must be a positive number"); } QueryString queryString = BuildBasicQueryString(); queryString.Add("confirmations", confirmations.ToString()); queryString.Add("address", address); string route = $"merchant/{identifier}/address_balance"; WalletAddress addressObj = await httpClient.GetAsync <WalletAddress>(route, queryString); return(addressObj); }