forked from GoodforGod/java-etherscan-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApiRunner.java
More file actions
51 lines (40 loc) · 1.43 KB
/
Copy pathApiRunner.java
File metadata and controls
51 lines (40 loc) · 1.43 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
package io.api;
import io.api.etherscan.core.impl.EtherScanApi;
import io.api.etherscan.manager.impl.QueueManager;
import io.api.etherscan.model.EthNetwork;
import org.junit.Assert;
public class ApiRunner extends Assert {
private static final EtherScanApi api;
private static final EtherScanApi apiRopsten;
private static final EtherScanApi apiRinkeby;
private static final EtherScanApi apiKovan;
private static final String key;
static {
final String apiKey = System.getenv("API_KEY");
key = (apiKey == null || apiKey.isEmpty())
? EtherScanApi.DEFAULT_KEY
: apiKey;
final QueueManager queue = key.equals(EtherScanApi.DEFAULT_KEY)
? QueueManager.DEFAULT_KEY_QUEUE
: new QueueManager(1, 2);
api = new EtherScanApi(key, EthNetwork.MAINNET, queue);
apiRopsten = new EtherScanApi(key, EthNetwork.ROPSTEN, queue);
apiRinkeby = new EtherScanApi(key, EthNetwork.RINKEBY, queue);
apiKovan = new EtherScanApi(key, EthNetwork.KOVAN, queue);
}
public static String getKey() {
return key;
}
public static EtherScanApi getApi() {
return api;
}
public static EtherScanApi getApiRopsten() {
return apiRopsten;
}
public static EtherScanApi getApiRinkeby() {
return apiRinkeby;
}
public static EtherScanApi getApiKovan() {
return apiKovan;
}
}