示例#1
0
        public GenericResponse GetBlocks(int fromIndex, int toIndex)
        {
            try
            {
                if (toIndex < fromIndex)
                {
                    return(new GenericResponse(null, ResponseCodes.ViewBlocksInvalidIndex, ResponseMessages.ViewBlocksInvalidIndex));
                }

                if ((toIndex - fromIndex) > 100)
                {
                    return(new GenericResponse(null, ResponseCodes.ViewBlocksTooMany, ResponseMessages.ViewBlocksTooMany));
                }

                ViewerServices viewerService = new ViewerServices();
                var            blocks        = viewerService.GetBlocks(fromIndex, toIndex);

                return(new GenericResponse(blocks, ResponseCodes.Success, ResponseMessages.Success));
            }
            catch (ValidationException vex)
            {
                ApplicationLog.Warn("ValidationException [" + vex.Code + "]: " + vex.Message);
                return(new GenericResponse(null, vex.Code, vex.Message));
            }
            catch (Exception ex)
            {
                ApplicationLog.Exception(ex);
                return(new GenericResponse(null, ResponseCodes.Error, ResponseMessages.Error));
            }
        }
示例#2
0
        public GenericResponse GetPending()
        {
            try
            {
                ViewerServices viewerService = new ViewerServices();
                var            pending       = viewerService.GetPending();

                return(new GenericResponse(pending, ResponseCodes.Success, ResponseMessages.Success));
            }
            catch (ValidationException vex)
            {
                ApplicationLog.Warn("ValidationException [" + vex.Code + "]: " + vex.Message);
                return(new GenericResponse(null, vex.Code, vex.Message));
            }
            catch (Exception ex)
            {
                ApplicationLog.Exception(ex);
                return(new GenericResponse(null, ResponseCodes.Error, ResponseMessages.Error));
            }
        }
示例#3
0
        public GenericResponse GetWalletBalance(string address, string tokenSymbol)
        {
            try
            {
                ViewerServices viewerServices = new ViewerServices();

                decimal?balance = viewerServices.GetWalletBalance(address, tokenSymbol);

                return(new GenericResponse(balance, ResponseCodes.Success, ResponseMessages.Success));
            }
            catch (ValidationException vex)
            {
                ApplicationLog.Warn("ValidationException [" + vex.Code + "]: " + vex.Message);
                return(new GenericResponse(null, vex.Code, vex.Message));
            }
            catch (Exception ex)
            {
                ApplicationLog.Exception(ex);
                return(new GenericResponse(null, ResponseCodes.Error, ResponseMessages.Error));
            }
        }