How to use the ethereum-types.BlockParamLiteral.Earliest function in ethereum-types

To help you get started, we’ve selected a few ethereum-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 0xProject / 0x-monorepo / packages / pipeline / src / data_sources / etherscan / index.ts View on Github external
public async getContractEventsAsync(
        contractAddress: string,
        fromBlock: BlockParam = BlockParamLiteral.Earliest,
        toBlock: BlockParam = BlockParamLiteral.Latest,
    ): Promise {
        const fullURL = `${ETHERSCAN_URL}?module=logs&action=getLogs&address=${contractAddress}&fromBlock=${fromBlock}&toBlock=${toBlock}&apikey=${
            this._apiKey
        }`;
        const resp = await axios.get(fullURL);
        // TODO(albrow): Check response code.
        return resp.data;
    }
}