aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/data_sources/etherscan/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/pipeline/src/data_sources/etherscan/index.ts')
-rw-r--r--packages/pipeline/src/data_sources/etherscan/index.ts52
1 files changed, 0 insertions, 52 deletions
diff --git a/packages/pipeline/src/data_sources/etherscan/index.ts b/packages/pipeline/src/data_sources/etherscan/index.ts
deleted file mode 100644
index 044fff02e..000000000
--- a/packages/pipeline/src/data_sources/etherscan/index.ts
+++ /dev/null
@@ -1,52 +0,0 @@
-import { default as axios } from 'axios';
-import { BlockParam, BlockParamLiteral } from 'ethereum-types';
-
-const ETHERSCAN_URL = 'https://api.etherscan.io/api';
-
-export class Etherscan {
- private readonly _apiKey: string;
- constructor(apiKey: string) {
- this._apiKey = apiKey;
- }
-
- /**
- * Gets the raw events for a specific contract and block range.
- * @param contractAddress The address of the contract to get the events for.
- * @param fromBlock The start of the block range to get events for (inclusive).
- * @param toBlock The end of the block range to get events for (inclusive).
- * @returns A list of decoded events.
- */
- public async getContractEventsAsync(
- contractAddress: string,
- fromBlock: BlockParam = BlockParamLiteral.Earliest,
- toBlock: BlockParam = BlockParamLiteral.Latest,
- ): Promise<EventsResponse> {
- const fullURL = `${ETHERSCAN_URL}?module=logs&action=getLogs&address=${contractAddress}&fromBlock=${fromBlock}&toBlock=${toBlock}&apikey=${
- this._apiKey
- }`;
- const resp = await axios.get<EventsResponse>(fullURL);
- // TODO(albrow): Check response code.
- return resp.data;
- }
-}
-
-// Raw events response from etherescan.io
-export interface EventsResponse {
- status: string;
- message: string;
- result: EventsResponseResult[];
-}
-
-// Events as represented in the response from etherscan.io
-export interface EventsResponseResult {
- address: string;
- topics: string[];
- data: string;
- blockNumber: string;
- timeStamp: string;
- gasPrice: string;
- gasUsed: string;
- logIndex: string;
- transactionHash: string;
- transactionIndex: string;
-}