public IActionResult GetAllAddresses([FromQuery] GetAllAddressesModel request) { Guard.NotNull(request, nameof(request)); // Checks the request is valid. if (!this.ModelState.IsValid) { return(BuildErrorResponse(this.ModelState)); } try { Wallet wallet = this.walletManager.GetWallet(request.WalletName); HdAccount account = wallet.GetAccountByCoinType(request.AccountName, this.coinType); AddressesModel model = new AddressesModel { Addresses = account.GetCombinedAddresses().Select(address => new AddressModel { Address = address.Address, IsUsed = address.Transactions.Any(), IsChange = address.IsChangeAddress() }) }; return(this.Json(model)); } catch (Exception e) { this.logger.LogError("Exception occurred: {0}", e.ToString()); return(ErrorHelpers.BuildErrorResponse(HttpStatusCode.BadRequest, e.Message, e.ToString())); } }
public async Task <IActionResult> GetAllAddresses([FromQuery] GetAllAddressesModel request, CancellationToken cancellationToken = default(CancellationToken)) { return(await this.Execute(request, cancellationToken, async (req, token) => this.Json(await this.walletService.GetAllAddresses(req, token)))); }
public async Task <IActionResult> GetAllAdresses() { GetAllAddressesModel result = await _addressService.GetAllAsync(User.Identity.Name); return(Ok(result)); }