diff --git a/wallet-fetcher/metadata.yaml b/wallet-fetcher/metadata.yaml index 0e5602d..57339e9 100644 --- a/wallet-fetcher/metadata.yaml +++ b/wallet-fetcher/metadata.yaml @@ -10,7 +10,7 @@ data: connectorSubtype: api connectorType: source definitionId: 1e55cfe0-f591-4281-9a20-18d89d45f685 - dockerImageTag: 0.9.1 + dockerImageTag: 1.0.1 dockerRepository: status-im/airbyte/wallet-fetcher githubIssueLabel: source-wallet-fetcher icon: icon.svg diff --git a/wallet-fetcher/source_wallet_fetcher/source.py b/wallet-fetcher/source_wallet_fetcher/source.py index 4d8160f..f6325c1 100644 --- a/wallet-fetcher/source_wallet_fetcher/source.py +++ b/wallet-fetcher/source_wallet_fetcher/source.py @@ -24,7 +24,9 @@ class SourceWalletFetcher(AbstractSource): bitcoin_wallets.append(wallet) if 'ETH' in wallet['blockchain']: ethereum_wallets.append(wallet) - + api_key='freekey' + if "api_key" in config: + api_key=config["api_key"] return [ BitcoinToken(wallets=bitcoin_wallets), - EthereumToken(wallets=ethereum_wallets)] + EthereumToken(wallets=ethereum_wallets, api_key=api_key)] diff --git a/wallet-fetcher/source_wallet_fetcher/spec.yaml b/wallet-fetcher/source_wallet_fetcher/spec.yaml index bbc5f3e..7868abd 100644 --- a/wallet-fetcher/source_wallet_fetcher/spec.yaml +++ b/wallet-fetcher/source_wallet_fetcher/spec.yaml @@ -7,6 +7,11 @@ connectionSpecification: - wallets additionalProperties: true properties: + api_key: + title: api_key + type: string + description: 'API key for ethplorer' + airbyte_secret: true wallets: title: Wallets description: "List of wallet to scan" diff --git a/wallet-fetcher/source_wallet_fetcher/stream.py b/wallet-fetcher/source_wallet_fetcher/stream.py index 600cda9..38d5e83 100644 --- a/wallet-fetcher/source_wallet_fetcher/stream.py +++ b/wallet-fetcher/source_wallet_fetcher/stream.py @@ -13,9 +13,10 @@ class BlockchainStream(HttpStream): primary_key = None - def __init__(self, wallets: List['str'], **kwargs): + def __init__(self, wallets: List['str'], api_key: str='freekey', **kwargs): super().__init__(**kwargs) self.wallets = wallets + self.api_key = api_key def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str, Any]]]: for wallet in self.wallets: @@ -74,7 +75,7 @@ class EthereumToken(BlockchainStream): url_base = "https://api.ethplorer.io/getAddressInfo/" def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str: - return f"{stream_slice['address']}?apiKey=freekey" + return f"{stream_slice['address']}?apiKey={self.api_key}" def parse_response(self, response: requests.Response,