Skip to content

Commit 9394bb4

Browse files
committed
Merge branch 'develop'
2 parents 9512b09 + 9a34b3e commit 9394bb4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1016
-257
lines changed

README.md

+22-13
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ Library supports all available EtherScan *API* calls for all available *Ethereum
1414
<dependency>
1515
<groupId>com.github.goodforgod</groupId>
1616
<artifactId>java-etherscan-api</artifactId>
17-
<version>1.0.0</version>
17+
<version>1.0.1</version>
1818
</dependency>
1919
```
2020

2121
**Gradle**
2222
```groovy
2323
dependencies {
24-
compile 'com.github.goodforgod:java-etherscan-api:1.0.0'
24+
compile 'com.github.goodforgod:java-etherscan-api:1.0.1'
2525
}
2626
```
2727

@@ -40,12 +40,17 @@ dependencies {
4040
- [Version History](#version-history)
4141

4242
## Mainnet and Testnets
43-
API support Ethereum: *[MAINNET](https://etherscan.io), [ROPSTEN](https://ropsten.etherscan.io),
44-
[KOVAN](https://kovan.etherscan.io), [RINKEBY](https://rinkeby.etherscan.io)* networks.
43+
API support Ethereum: *[MAINNET](https://etherscan.io),
44+
[ROPSTEN](https://ropsten.etherscan.io),
45+
[KOVAN](https://kovan.etherscan.io),
46+
[RINKEBY](https://rinkeby.etherscan.io),
47+
[GORLI](https://goerli.etherscan.io),
48+
[TOBALABA](https://tobalaba.etherscan.com)* networks.
4549
```java
46-
EtherScanApi api = new EtherScanApi(EthNetwork.MAINTNET);
47-
EtherScanApi api = new EtherScanApi(EthNetwork.RINKEBY);
48-
EtherScanApi api = new EtherScanApi("YourApiKey", EthNetwork.KOVAN);
50+
EtherScanApi api = new EtherScanApi(EthNetwork.MAINNET); // Default
51+
EtherScanApi apiRinkeby = new EtherScanApi(EthNetwork.RINKEBY);
52+
EtherScanApi apiRopsten = new EtherScanApi(EthNetwork.ROPSTEN);
53+
EtherScanApi apiKovan = new EtherScanApi("YourApiKey", EthNetwork.KOVAN);
4954
```
5055

5156
## Custom HttpClient
@@ -56,10 +61,10 @@ just implement **IHttpExecutor** by your self or initialize it with your values.
5661
```java
5762
int connectionTimeout = 10000;
5863
int readTimeout = 7000;
64+
5965
Supplier<IHttpExecutor> supplier = () -> new HttpExecutor(connectionTimeout);
6066
Supplier<IHttpExecutor> supplierFull = () -> new HttpExecutor(connectionTimeout, readTimeout);
61-
62-
67+
6368
EtherScanApi api = new EtherScanApi(EthNetwork.RINKEBY, supplier);
6469
EtherScanApi apiWithKey = new EtherScanApi("YourApiKey", EthNetwork.MAINNET, supplierFull);
6570
```
@@ -70,14 +75,15 @@ You can read about all API methods on [Etherscan](https://etherscan.io/apis)
7075

7176
*Library support all available EtherScan API.*
7277

73-
You can use API with you key or without key as well (Check API request\sec restrictions).
74-
Library support limit when used without key and will limit requests up to *5 req/sec by itself*.
78+
You can use library *with or without* API key *([Check API request\sec restrictions when used without API key](https://ethereum.stackexchange.com/questions/34190/does-etherscan-require-the-use-of-an-api-key))*.
79+
80+
Library will automatically limit requests up to **5 req/sec** when used *without* key.
7581
```java
7682
EtherScanApi api = new EtherScanApi();
7783
EtherScanApi api = new EtherScanApi("YourApiKey");
7884
```
7985

80-
Below there are examples for each API category.
86+
Below are examples for each API category.
8187

8288
### Account Api
8389
**Get Ether Balance for a single Address**
@@ -121,6 +127,7 @@ LogQuery query = LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70
121127
.setOpTopic0_2(LogOp.OR)
122128
.setOpTopic1_2(LogOp.AND)
123129
.build();
130+
124131
List<Log> logs = api.logs().logs(query);
125132
```
126133

@@ -152,12 +159,14 @@ Optional<Boolean> status = api.txs().receiptStatus("0x513c1ba0bebf66436b5fed86ab
152159
```
153160

154161
### Token Api
155-
You can read token API [here](https://etherscan.io/apis#tokens)
162+
You can read about token API [here](https://etherscan.io/apis#tokens)
156163

157164
Token API methods migrated to [Account](#account-api) & [Stats](#stats-api) respectfully.
158165

159166
## Version History
160167

168+
**1.0.1** - Gorli & TOBALABA networks support.
169+
161170
**1.0.0** - Initial project with all API functionality, for all available networks, with tests coverage for all cases.
162171

163172
## License

pom.xml

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.github.goodforgod</groupId>
77
<artifactId>java-etherscan-api</artifactId>
8-
<version>1.0.0</version>
8+
<version>1.0.1</version>
99
<packaging>jar</packaging>
1010

1111
<name>${project.groupId}:${project.artifactId}</name>
@@ -53,7 +53,7 @@
5353
<maven-build-plugin-version>3.0.2</maven-build-plugin-version>
5454
<maven-gpg-plugin-version>1.6</maven-gpg-plugin-version>
5555
<maven-source-plugin-version>3.0.1</maven-source-plugin-version>
56-
<maven-javadoc-plugin-version>2.10.4</maven-javadoc-plugin-version>
56+
<maven-javadoc-plugin-version>3.0.1</maven-javadoc-plugin-version>
5757
<maven-nexus-staging-maven-plugin-version>1.6.8</maven-nexus-staging-maven-plugin-version>
5858
<cobertura-plugin-version>2.7</cobertura-plugin-version>
5959

@@ -157,6 +157,9 @@
157157
</goals>
158158
</execution>
159159
</executions>
160+
<configuration>
161+
<additionalOptions>-html5</additionalOptions>
162+
</configuration>
160163
</plugin>
161164
</plugins>
162165
</build>

src/main/java/io/api/etherscan/App.java

-7
This file was deleted.

src/main/java/io/api/etherscan/core/IAccountApi.java

+34-7
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,61 @@
1515
*/
1616
public interface IAccountApi {
1717

18-
/** Address ETH balance */
18+
/**
19+
* Address ETH balance
20+
* @param address to look for
21+
* @return balance
22+
*/
1923
@NotNull Balance balance(String address) throws ApiException;
2024

21-
/** ERC20 token balance for address */
25+
/**
26+
* ERC20 token balance for address
27+
* @param address to look for
28+
* @param contract for token
29+
* @return token balance
30+
*/
2231
@NotNull TokenBalance balance(String address, String contract) throws ApiException;
2332

2433
/**
2534
* Maximum 20 address for single batch request
26-
* If address > 20, then there will be more than 1 request performed
35+
* If addresses more than 20, then there will be MORE than 1 request performed
36+
* @param addresses to look for
37+
* @return balance[0] for address[0], etc
2738
*/
2839
@NotNull List<Balance> balances(List<String> addresses) throws ApiException;
2940

30-
/** All txs */
41+
/**
42+
* Find all txs
43+
* @param address to look for txs
44+
* @return tx info
45+
*/
3146
@NotNull List<Tx> txs(String address) throws ApiException;
3247
@NotNull List<Tx> txs(String address, long startBlock) throws ApiException;
3348
@NotNull List<Tx> txs(String address, long startBlock, long endBlock) throws ApiException;
3449

35-
/** All internal txs */
50+
/**
51+
* All internal txs
52+
* @param address to look for
53+
* @return internal tx
54+
*/
3655
@NotNull List<TxInternal> txsInternal(String address) throws ApiException;
3756
@NotNull List<TxInternal> txsInternal(String address, long startBlock) throws ApiException;
3857
@NotNull List<TxInternal> txsInternal(String address, long startBlock, long endBlock) throws ApiException;
3958
@NotNull List<TxInternal> txsInternalByHash(String txhash);
4059

41-
/** All token txs */
60+
/**
61+
* All token txs
62+
* @param address to look for
63+
* @return token txs
64+
*/
4265
@NotNull List<TxToken> txsToken(String address) throws ApiException;
4366
@NotNull List<TxToken> txsToken(String address, long startBlock) throws ApiException;
4467
@NotNull List<TxToken> txsToken(String address, long startBlock, long endBlock) throws ApiException;
4568

46-
/** All blocks mined by address */
69+
/**
70+
* All blocks mined by address
71+
* @param address to look for
72+
* @return mined blocks
73+
*/
4774
@NotNull List<Block> minedBlocks(String address) throws ApiException;
4875
}

src/main/java/io/api/etherscan/core/IBlockApi.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
*/
1616
public interface IBlockApi {
1717

18-
/** Return uncle blocks */
18+
/**
19+
* Return uncle blocks
20+
* @param blockNumber block number
21+
* @return uncle block
22+
*/
1923
@NotNull Optional<UncleBlock> uncles(long blockNumber) throws ApiException;
2024
}

src/main/java/io/api/etherscan/core/IContractApi.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
*/
1414
public interface IContractApi {
1515

16-
/** Get Verified Contract Sources */
16+
/**
17+
* Get Verified Contract Sources
18+
* @param address to look for
19+
* @return abi for contract
20+
*/
1721
@NotNull Abi contractAbi(String address) throws ApiException;
1822
}

src/main/java/io/api/etherscan/core/ILogsApi.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
public interface ILogsApi {
1818

1919
/**
20-
* alternative to the native eth_getLogs
20+
* Alternative to the native eth_getLogs
2121
* Read at EtherScan API description for full info!
22+
* @see LogQuery
23+
* @param query for logs (check etherscan specs)
24+
* @return logs
2225
*/
2326
@NotNull List<Log> logs(LogQuery query) throws ApiException;
2427
}

src/main/java/io/api/etherscan/core/IProxyApi.java

+29
Original file line numberDiff line numberDiff line change
@@ -21,86 +21,115 @@ public interface IProxyApi {
2121
/**
2222
* Returns the number of most recent block
2323
* eth_blockNumber
24+
* @return last block number
2425
*/
2526
long blockNoLast();
2627

2728
/**
2829
* Returns information about a block by block number
2930
* eth_getBlockByNumber
31+
* @param blockNo block number
32+
* @return block info
3033
*/
3134
@NotNull Optional<BlockProxy> block(long blockNo) throws ApiException;
3235

3336
/**
3437
* Returns information about a uncle by block number
3538
* eth_getUncleByBlockNumberAndIndex
39+
* @param blockNo block number
40+
* @param index uncle block index
41+
* @return block info
3642
*/
3743
@NotNull Optional<BlockProxy> blockUncle(long blockNo, long index) throws ApiException;
3844

3945
/**
4046
* Returns the information about a transaction requested by transaction hash
4147
* eth_getTransactionByHash
48+
* @param txhash tx hash
49+
* @return tx info
4250
*/
4351
@NotNull Optional<TxProxy> tx(String txhash) throws ApiException;
4452

4553
/**
4654
* Returns information about a transaction by block number and transaction index position
4755
* eth_getTransactionByBlockNumberAndIndex
56+
* @param blockNo block number
57+
* @param index tx index in block
58+
* @return tx info
4859
*/
4960
@NotNull Optional<TxProxy> tx(long blockNo, long index) throws ApiException;
5061

5162
/**
5263
* Returns the number of transactions in a block from a block matching the given block number
5364
* eth_getBlockTransactionCountByNumber
65+
* @param blockNo block number
66+
* @return tx count in block
5467
*/
5568
int txCount(long blockNo) throws ApiException;
5669

5770
/**
5871
* Returns the number of transactions sent from an address
5972
* eth_getTransactionCount
73+
* @param address to look for
74+
* @return tx send count
6075
*/
6176
int txSendCount(String address) throws ApiException;
6277

6378
/**
6479
* Creates new message call transaction or a contract creation for signed transactions
6580
* eth_sendRawTransaction
81+
* @param hexEncodedTx tx as hex
82+
* @return result (check eth grpc info)
6683
*/
6784
@NotNull Optional<String> txSendRaw(String hexEncodedTx) throws ApiException;
6885

6986
/**
7087
* Returns the receipt of a transaction by transaction hash
7188
* eth_getTransactionReceipt
89+
* @param txhash tx hash
90+
* @return receipt
7291
*/
7392
@NotNull Optional<ReceiptProxy> txReceipt(String txhash) throws ApiException;
7493

7594
/**
7695
* Executes a new message call immediately without creating a transaction on the block chain
7796
* eth_call
97+
* @param address to look for
98+
* @param data in tx for call
99+
* @return result (check eth grpc info)
78100
*/
79101
@NotNull Optional<String> call(String address, String data) throws ApiException;
80102

81103
/**
82104
* Returns code at a given address
83105
* eth_getCode
106+
* @param address to look for
107+
* @return result (check eth grpc info)
84108
*/
85109
@NotNull Optional<String> code(String address) throws ApiException;
86110

87111
/**
88112
* (**experimental)
89113
* Returns the value from a storage position at a given address
90114
* eth_getStorageAt
115+
* @param address to look for
116+
* @param position storage position
117+
* @return result (check eth grpc info)
91118
*/
92119
@NotNull Optional<String> storageAt(String address, long position) throws ApiException;
93120

94121
/**
95122
* Returns the current price per gas in wei
96123
* eth_gasPrice
124+
* @return price
97125
*/
98126
@NotNull BigInteger gasPrice() throws ApiException;
99127

100128
/**
101129
* Makes a call or transaction, which won't be added to the blockchain and returns the used gas,
102130
* which can be used for estimating the used gas
103131
* eth_estimateGas
132+
* @return gas estimate
104133
*/
105134
@NotNull BigInteger gasEstimated() throws ApiException;
106135
@NotNull BigInteger gasEstimated(String hexData) throws ApiException;

src/main/java/io/api/etherscan/core/IStatisticApi.java

+13-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,22 @@
1616
*/
1717
public interface IStatisticApi {
1818

19-
/** ERC20 token total Supply */
19+
/**
20+
* ERC20 token total Supply
21+
* @param contract to look for
22+
* @return token supply
23+
*/
2024
@NotNull BigInteger supply(String contract) throws ApiException;
2125

22-
/** Eth total supply */
26+
/**
27+
* Eth total supply
28+
* @return ETH supply
29+
*/
2330
@NotNull Supply supply() throws ApiException;
2431

25-
/** Eth last USD and BTC price */
32+
/**
33+
* Eth last USD and BTC price
34+
* @return last price
35+
*/
2636
@NotNull Price lastPrice() throws ApiException;
2737
}

0 commit comments

Comments
 (0)