Exemple #1
0
        public async Task <GetBlockchainAddressInfoResponse> GetBlockchainAddressDetailsAsync(
            GetAddressInfoRequest request)
        {
            var entity = _blockchainDepositAddressReader.Get(
                BlockchainDepositAddressEntity.GeneratePartitionKey(request.AssetSymbol, request.Blockchain,
                                                                    request.Address), BlockchainDepositAddressEntity.GenerateRowKey());

            if (entity != null)
            {
                return new GetBlockchainAddressInfoResponse
                       {
                           Address = new DepositAddress(entity.Address)
                       }
            }
            ;

            return(await _service.GetBlockchainAddressDetailsAsync(request));
        }
    }
Exemple #2
0
        public async Task <GetAddressInfoResponse> GetWalletIdByAddressAsync(GetAddressInfoRequest request)
        {
            var entities = _depositAddressReader.Get();
            var entity   = entities.FirstOrDefault(e =>
                                                   e.Address == request.Address && e.AssetSymbol == request.AssetSymbol &&
                                                   e.Blockchain == request.Blockchain);

            if (entity == null)
            {
                return(new GetAddressInfoResponse()
                {
                    IsInternalAddress = false
                });
            }

            return(new GetAddressInfoResponse()
            {
                IsInternalAddress = true,
                WalletId = entity.WalletId
            });
        }
        public async Task <GetAddressInfoResponse> GetWalletIdByAddressAsync(GetAddressInfoRequest request)
        {
            var entities = await _addressDataWriter.GetAsync();

            var entity =
                entities.FirstOrDefault(e => e.Address == request.Address && e.AssetSymbol == request.AssetSymbol);

            if (entity == null)
            {
                return(new GetAddressInfoResponse()
                {
                    IsInternalAddress = false
                });
            }

            return(new GetAddressInfoResponse()
            {
                IsInternalAddress = true,
                WalletId = entity.WalletId
            });
        }
        public async Task <GetBlockchainAddressInfoResponse> GetBlockchainAddressDetailsAsync(
            GetAddressInfoRequest request)
        {
            try
            {
                await using var ctx = DatabaseContext.Create(_dbContextOptionsBuilder);
                var addressEntity = await ctx.Addresses.Where(t =>
                                                              t.AssetSymbol == request.AssetSymbol && t.Blockchain == request.Blockchain &&
                                                              t.Address == request.Address).FirstOrDefaultAsync();

                return(new GetBlockchainAddressInfoResponse
                {
                    Address = addressEntity == null ? null : new DepositAddress(addressEntity)
                });
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Exception on GetBlockchainAddressDetailsAsync with request: {jsonText}",
                                 JsonConvert.SerializeObject(request));
                throw;
            }
        }