Esempio n. 1
0
        public async Task <IActionResult> GetByWalletId(
            string walletId,
            [FromQuery] HistoryOperationType?operationType,
            [FromQuery] string assetId,
            [FromQuery] string assetPairId,
            [FromQuery] int take,
            [FromQuery] int skip)
        {
            var clientId = _requestContext.ClientId;

            var wallets = await _clientAccountService.GetWalletsByClientIdAsync(clientId);

            if (!wallets.Any(x => x.Id.Equals(walletId)))
            {
                return(NotFound());
            }

            var response = await _operationsHistoryClient.GetByWalletId(walletId, operationType, assetId, assetPairId, take, skip);

            if (response.Error != null)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, response.Error));
            }

            return(Ok(response.Records.Where(x => x != null).Select(x => x.ToResponseModel())));
        }
        public async Task <IActionResult> GetWallets()
        {
            var wallets = await _clientAccountService.GetWalletsByClientIdAsync(_requestContext.ClientId);

            if (wallets == null)
            {
                return(NotFound());
            }

            var clientKeys = await _hftInternalService.GetKeysAsync(_requestContext.ClientId);

            return(Ok(wallets.Select(wallet => new WalletModel
            {
                Id = wallet.Id,
                Name = wallet.Name,
                Type = wallet.Type,
                Description = wallet.Description,
                ApiKey = clientKeys.FirstOrDefault(x => x.Wallet == wallet.Id)?.Key
            })));
        }