UNPKG

etherscan-api-e

Version:
65 lines (58 loc) 1.6 kB
"use strict"; const log = require('./log'); const proxy = require('./proxy'); const stats = require('./stats'); const block = require('./block'); const transaction = require('./transaction'); const contract = require('./contract'); const account = require('./account'); /** * @module etherscan/api */ /** * @param {string} apiKey - (optional) Your Etherscan APIkey * @param {string} chain - (optional) Testnet chain keys [ropsten, rinkeby, kovan] * @param {number} timeout - (optional) Timeout in milliseconds for requests, default 10000 * @param {string} proxyUrl - (optional) The URL of proxy server to avoid CORS * @param {object} headers - (optional) The object containing custom headers */ module.exports = function(apiKey, chain, timeout, proxyUrl, headers) { if (!apiKey) { apiKey = 'YourApiKeyToken'; } if (!timeout) { timeout = 10000; } var getRequest = require('./get-request')(chain, timeout, proxyUrl, headers); /** @lends module:etherscan/api */ return { /** * @namespace */ log: log(getRequest, apiKey), /** * @namespace */ proxy: proxy(getRequest, apiKey), /** * @namespace */ stats: stats(getRequest, apiKey), /** * @namespace */ block: block(getRequest, apiKey), /** * @namespace */ transaction: transaction(getRequest, apiKey), /** * @namespace */ contract: contract(getRequest, apiKey), /** * @namespace */ account: account(getRequest, apiKey) }; };