We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5a4d8b commit d981818Copy full SHA for d981818
lib/init.js
@@ -3,18 +3,24 @@ var restify = require('restify');
3
const querystring = require('querystring');
4
5
const url = 'https://api.etherscan.io/api';
6
+const testUrl = 'testnet.etherscan.io';
7
+
8
9
/**
10
* @module etherscan/api
11
*/
-module.exports = function (apiKey) {
12
13
+ // chain is for testnet
14
+module.exports = function (apiKey, chain) {
15
16
if (!apiKey) {
17
apiKey = 'YourApiKeyToken';
18
}
19
20
var client = restify.createJsonClient({
- url: url,
21
+ // added testnet condition
22
+ url: chain === 'testnet' ? testUrl : url,
23
+ // url: url,
24
version: '*'
25
});
26
0 commit comments