/// <summary> /// This will set the coin based on the currently open app. Note: this only currently works with Bitcoin based Ledger apps. /// </summary> public async Task SetCoinNumber() { var getCoinVersionResponse = await RequestHandler.SendRequestAsync <GetCoinVersionResponse, GetCoinVersionRequest>(new GetCoinVersionRequest()); if (!getCoinVersionResponse.IsSuccess) { Helpers.HandleErrorResponse(getCoinVersionResponse); } CurrentCoin = CoinUtility.GetCoinInfo(getCoinVersionResponse.ShortCoinName); }
public async Task <ResponseBase> CallAndPrompt <T, T2>(Func <CallAndPromptArgs <T2>, Task <T> > func, CallAndPromptArgs <T2> state) where T : ResponseBase { for (var i = 0; i < PromptRetryCount; i++) { CheckForDisposed(); try { var response = await func.Invoke(state); //Use this to get the response as an array of bytes //var data = string.Join(", ", response.Data.Select(b => b.ToString())); if (response.IsSuccess) { return(response); } if (ErrorPrompt == null) { Helpers.HandleErrorResponse(response); } else { await ErrorPrompt(response.ReturnCode, null, state.MemberName); } } catch (Exception ex) { if (ErrorPrompt == null) { throw; } await ErrorPrompt(null, ex, state.MemberName); } } throw new TooManyPromptsException(PromptRetryCount, state.MemberName); }