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; } }
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; } }