forked from sebs/etherscan-api
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.js
More file actions
62 lines (56 loc) · 1.31 KB
/
init.js
File metadata and controls
62 lines (56 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"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
*/
module.exports = function(apiKey, chain, timeout) {
if (!apiKey) {
apiKey = 'YourApiKeyToken';
}
if (!timeout) {
timeout = 10000;
}
var getRequest = require('./get-request')(chain, timeout);
/** @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)
};
};