Exemple #1
0
        public async Task <bool> Execute(string address, BlockchainType blockchain)
        {
            IBlockchainApiClient blockchainClient = _blockchainClientProvider.Get(blockchain);

            try
            {
                return(await blockchainClient.ValidateAddressAsync(address));
            }
            catch (WalletAddressValidationException validationEx)
            {
                await _log.WriteErrorAsync(nameof(BlockchainAddressValidator), nameof(Execute), new
                {
                    Blockchain = validationEx.Blockchain.ToString(),
                    validationEx.Address
                }.ToJson(), validationEx);

                throw;
            }
            catch (UnrecognizedApiResponse responseEx)
            {
                await _log.WriteErrorAsync(nameof(BlockchainAddressValidator), nameof(Execute), new
                {
                    responseEx.ResponseType
                }.ToJson(), responseEx);

                throw;
            }
        }
Exemple #2
0
        public async Task <bool> Execute(string address, BlockchainType blockchain)
        {
            if (!SupportedNetworks.Contains(blockchain))
            {
                throw new BlockchainTypeNotSupported(blockchain);
            }

            IBlockchainApiClient blockchainClient = _blockchainClientProvider.Get(blockchain);

            try
            {
                return(await blockchainClient.ValidateAddressAsync(address));
            }
            catch (WalletAddressValidationException e)
            {
                _log.ErrorWithDetails(e, new
                {
                    Blockchain = e.Blockchain.ToString(),
                    e.Address
                });

                throw;
            }
            catch (UnrecognizedApiResponse e)
            {
                _log.ErrorWithDetails(e, new { e.ResponseType });

                throw;
            }
        }