public async Task <CommandResult> CreateReport([FromBody] AddressTransactionsReportsRequest input)
        {
            if (!ModelState.IsValid)
            {
                return(CommandResultBuilder.Fail(ModelState.GetErrorsList().ToArray()));
            }

            if (!BitcoinAddressHelper.IsAddress(input.BitcoinAddress, _bcnReportsSettings.UsedNetwork()))
            {
                return(CommandResultBuilder.Fail("Invalid base58 address string."));
            }

            await _addressTransactionsReportMetadataRepository.InsertOrReplace(ReportMetadata.Create(input.BitcoinAddress, queuedAt: DateTime.UtcNow));

            await _commandProducer.CreateCommand(input.BitcoinAddress, input.Email);

            return(CommandResultBuilder.Ok());
        }
示例#2
0
        public async Task <SearchResultType?> GetTypeAsync(string id)
        {
            if (BitcoinAddressHelper.IsAddress(id, _baseSettings.BcnExploler.UsedNetwork()))
            {
                return(SearchResultType.Address);
            }

            var result = await GetFromNinja(id);

            if (result == null)
            {
                var asset = await _assetProvider.GetAssetAsync(id);

                result = asset != null ? (SearchResultType?)SearchResultType.Asset : null;
            }

            if (await _offchainNotificationsService.OffchainTransactionExistsAsync(id))
            {
                return(SearchResultType.OffchainTransaction);
            }

            return(result);
        }