public async Task <IActionResult> GetExtPubKey([FromQuery] GetExtPubKeyModel request, CancellationToken cancellationToken = default(CancellationToken)) { return(await this.ExecuteAsAsync(request, cancellationToken, (req, token) => this.Json(this.walletManager.GetExtPubKey(new WalletAccountReference(request.WalletName, request.AccountName))))); }
public IActionResult GetExtPubKey([FromQuery] GetExtPubKeyModel request) { Guard.NotNull(request, nameof(request)); // checks the request is valid if (!this.ModelState.IsValid) { return(BuildErrorResponse(this.ModelState)); } try { string result = this.walletManager.GetExtPubKey(new WalletAccountReference(request.WalletName, request.AccountName)); return(this.Json(result)); } catch (Exception e) { this.logger.LogError("Exception occurred: {0}", e.ToString()); return(ErrorHelpers.BuildErrorResponse(HttpStatusCode.BadRequest, e.Message, e.ToString())); } }
public IActionResult GetExtPubKey([FromQuery] GetExtPubKeyModel request) { Guard.NotNull(request, nameof(request)); // checks the request is valid if (!this.ModelState.IsValid) { var errors = this.ModelState.Values.SelectMany(e => e.Errors.Select(m => m.ErrorMessage)); return(ErrorHelpers.BuildErrorResponse(HttpStatusCode.BadRequest, "Formatting error", string.Join(Environment.NewLine, errors))); } try { string result = this.walletManager.GetExtPubKey(new WalletAccountReference(request.WalletName, request.AccountName)); return(this.Json(result)); } catch (Exception e) { this.logger.LogError("Exception occurred: {0}", e.ToString()); return(ErrorHelpers.BuildErrorResponse(HttpStatusCode.BadRequest, e.Message, e.ToString())); } }