Skip to content

Commit 296d156

Browse files
committed
JavaDoc Improvements
Final 1.0.0
1 parent 9512b09 commit 296d156

File tree

10 files changed

+161
-26
lines changed

10 files changed

+161
-26
lines changed

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

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

18-
/** Address ETH balance */
18+
/**
19+
* Address ETH balance
20+
* @param address get balance for
21+
* @return balance
22+
* @throws ApiException parent exception class
23+
*/
1924
@NotNull Balance balance(String address) throws ApiException;
2025

21-
/** ERC20 token balance for address */
26+
/**
27+
* ERC20 token balance for address
28+
* @param address get balance for
29+
* @param contract token contract
30+
* @return token balance for address
31+
* @throws ApiException parent exception class
32+
*/
2233
@NotNull TokenBalance balance(String address, String contract) throws ApiException;
2334

2435
/**
2536
* Maximum 20 address for single batch request
26-
* If address > 20, then there will be more than 1 request performed
37+
* If address MORE THAN 20, then there will be more than 1 request performed
38+
* @param addresses addresses to get balances for
39+
* @return list of balances
40+
* @throws ApiException parent exception class
2741
*/
2842
@NotNull List<Balance> balances(List<String> addresses) throws ApiException;
2943

30-
/** All txs */
31-
@NotNull List<Tx> txs(String address) throws ApiException;
32-
@NotNull List<Tx> txs(String address, long startBlock) throws ApiException;
44+
/**
45+
* All txs for given address
46+
* @param address get txs for
47+
* @param startBlock tx from this blockNumber
48+
* @param endBlock tx to this blockNumber
49+
* @return txs for address
50+
* @throws ApiException parent exception class
51+
*/
3352
@NotNull List<Tx> txs(String address, long startBlock, long endBlock) throws ApiException;
53+
@NotNull List<Tx> txs(String address, long startBlock) throws ApiException;
54+
@NotNull List<Tx> txs(String address) throws ApiException;
3455

35-
/** All internal txs */
36-
@NotNull List<TxInternal> txsInternal(String address) throws ApiException;
37-
@NotNull List<TxInternal> txsInternal(String address, long startBlock) throws ApiException;
56+
/**
57+
* All internal txs for given address
58+
* @param address get txs for
59+
* @param startBlock tx from this blockNumber
60+
* @param endBlock tx to this blockNumber
61+
* @return txs for address
62+
* @throws ApiException parent exception class
63+
*/
3864
@NotNull List<TxInternal> txsInternal(String address, long startBlock, long endBlock) throws ApiException;
39-
@NotNull List<TxInternal> txsInternalByHash(String txhash);
65+
@NotNull List<TxInternal> txsInternal(String address, long startBlock) throws ApiException;
66+
@NotNull List<TxInternal> txsInternal(String address) throws ApiException;
4067

41-
/** All token txs */
42-
@NotNull List<TxToken> txsToken(String address) throws ApiException;
43-
@NotNull List<TxToken> txsToken(String address, long startBlock) throws ApiException;
68+
/**
69+
* All internal tx for given transaction hash
70+
* @param txhash transaction hash
71+
* @return internal txs list
72+
* @throws ApiException parent exception class
73+
*/
74+
@NotNull List<TxInternal> txsInternalByHash(String txhash) throws ApiException;
75+
76+
/**
77+
* All token txs for given address
78+
* @param address get txs for
79+
* @param startBlock tx from this blockNumber
80+
* @param endBlock tx to this blockNumber
81+
* @return txs for address
82+
* @throws ApiException parent exception class
83+
*/
4484
@NotNull List<TxToken> txsToken(String address, long startBlock, long endBlock) throws ApiException;
85+
@NotNull List<TxToken> txsToken(String address, long startBlock) throws ApiException;
86+
@NotNull List<TxToken> txsToken(String address) throws ApiException;
4587

46-
/** All blocks mined by address */
88+
/**
89+
* All blocks mined by address
90+
* @param address address to search for
91+
* @return blocks mined
92+
* @throws ApiException parent exception class
93+
*/
4794
@NotNull List<Block> minedBlocks(String address) throws ApiException;
4895
}

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

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

18-
/** Return uncle blocks */
18+
/**
19+
* Return uncle blocks
20+
* @param blockNumber block number form 0 to last
21+
* @return optional uncle blocks
22+
* @throws ApiException parent exception class
23+
*/
1924
@NotNull Optional<UncleBlock> uncles(long blockNumber) throws ApiException;
2025
}

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

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

16-
/** Get Verified Contract Sources */
16+
/**
17+
* Get Verified Contract Sources
18+
* @param address to verify
19+
* @return ABI verified
20+
* @throws ApiException parent exception class
21+
*/
1722
@NotNull Abi contractAbi(String address) throws ApiException;
1823
}

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

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ public interface ILogsApi {
1919
/**
2020
* alternative to the native eth_getLogs
2121
* Read at EtherScan API description for full info!
22+
* @param query build log query
23+
* @return logs according to query
24+
* @throws ApiException parent exception class
25+
*
26+
* @see io.api.etherscan.model.query.impl.LogQueryBuilder
2227
*/
2328
@NotNull List<Log> logs(LogQuery query) throws ApiException;
2429
}

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

+46-1
Original file line numberDiff line numberDiff line change
@@ -21,87 +21,132 @@ public interface IProxyApi {
2121
/**
2222
* Returns the number of most recent block
2323
* eth_blockNumber
24+
* @return last block number
25+
* @throws ApiException parent exception class
2426
*/
2527
long blockNoLast();
2628

2729
/**
2830
* Returns information about a block by block number
2931
* eth_getBlockByNumber
32+
* @param blockNo block number from 0 to last
33+
* @return optional block result
34+
* @throws ApiException parent exception class
3035
*/
3136
@NotNull Optional<BlockProxy> block(long blockNo) throws ApiException;
3237

3338
/**
3439
* Returns information about a uncle by block number
3540
* eth_getUncleByBlockNumberAndIndex
41+
* @param blockNo block number from 0 to last
42+
* @param index uncle block index
43+
* @return optional block result
44+
* @throws ApiException parent exception class
3645
*/
3746
@NotNull Optional<BlockProxy> blockUncle(long blockNo, long index) throws ApiException;
3847

3948
/**
4049
* Returns the information about a transaction requested by transaction hash
4150
* eth_getTransactionByHash
51+
* @param txhash transaction hash
52+
* @return optional tx result
53+
* @throws ApiException parent exception class
4254
*/
4355
@NotNull Optional<TxProxy> tx(String txhash) throws ApiException;
4456

4557
/**
4658
* Returns information about a transaction by block number and transaction index position
4759
* eth_getTransactionByBlockNumberAndIndex
60+
* @param blockNo block number from 0 to last
61+
* @param index tx index in block
62+
* @return optional tx result
63+
* @throws ApiException parent exception class
4864
*/
4965
@NotNull Optional<TxProxy> tx(long blockNo, long index) throws ApiException;
5066

5167
/**
5268
* Returns the number of transactions in a block from a block matching the given block number
5369
* eth_getBlockTransactionCountByNumber
70+
* @param blockNo block number from 0 to last
71+
* @return transaction amount in block
72+
* @throws ApiException parent exception class
5473
*/
5574
int txCount(long blockNo) throws ApiException;
5675

5776
/**
5877
* Returns the number of transactions sent from an address
5978
* eth_getTransactionCount
79+
* @param address eth address
80+
* @return transactions send amount from address
81+
* @throws ApiException parent exception class
6082
*/
6183
int txSendCount(String address) throws ApiException;
6284

6385
/**
6486
* Creates new message call transaction or a contract creation for signed transactions
6587
* eth_sendRawTransaction
88+
* @param hexEncodedTx encoded hex data to send
89+
* @return optional string response
90+
* @throws ApiException parent exception class
6691
*/
6792
@NotNull Optional<String> txSendRaw(String hexEncodedTx) throws ApiException;
6893

6994
/**
7095
* Returns the receipt of a transaction by transaction hash
7196
* eth_getTransactionReceipt
97+
* @param txhash transaction hash
98+
* @return optional tx receipt
99+
* @throws ApiException parent exception class
72100
*/
73101
@NotNull Optional<ReceiptProxy> txReceipt(String txhash) throws ApiException;
74102

75103
/**
76104
* Executes a new message call immediately without creating a transaction on the block chain
77105
* eth_call
106+
* @param address to call
107+
* @param data data to call address
108+
* @return optional the return value of executed contract.
109+
* @throws ApiException parent exception class
78110
*/
79111
@NotNull Optional<String> call(String address, String data) throws ApiException;
80112

81113
/**
82114
* Returns code at a given address
83115
* eth_getCode
116+
* @param address get code from
117+
* @return optional the code from the given address
118+
* @throws ApiException parent exception class
84119
*/
85120
@NotNull Optional<String> code(String address) throws ApiException;
86121

87122
/**
88123
* (**experimental)
89124
* Returns the value from a storage position at a given address
90125
* eth_getStorageAt
126+
* @param address to get storage
127+
* @param position storage position
128+
* @return optional the value at this storage position
129+
* @throws ApiException parent exception class
91130
*/
92131
@NotNull Optional<String> storageAt(String address, long position) throws ApiException;
93132

94133
/**
95134
* Returns the current price per gas in wei
96135
* eth_gasPrice
136+
* @return estimated gas price
137+
* @throws ApiException parent exception class
97138
*/
98139
@NotNull BigInteger gasPrice() throws ApiException;
99140

141+
100142
/**
101143
* Makes a call or transaction, which won't be added to the blockchain and returns the used gas,
102144
* which can be used for estimating the used gas
103145
* eth_estimateGas
146+
* @param hexData data to calc gas usage for
147+
* @return estimated gas usage
148+
* @throws ApiException parent exception class
104149
*/
105-
@NotNull BigInteger gasEstimated() throws ApiException;
106150
@NotNull BigInteger gasEstimated(String hexData) throws ApiException;
151+
@NotNull BigInteger gasEstimated() throws ApiException;
107152
}

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

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

19-
/** ERC20 token total Supply */
19+
/**
20+
* ERC20 token total Supply
21+
* @param contract contract address
22+
* @return token supply for specified contract
23+
* @throws ApiException parent exception class
24+
*/
2025
@NotNull BigInteger supply(String contract) throws ApiException;
2126

22-
/** Eth total supply */
27+
/**
28+
* Eth total supply
29+
* @return total ETH supply for moment
30+
* @throws ApiException parent exception class
31+
*/
2332
@NotNull Supply supply() throws ApiException;
2433

25-
/** Eth last USD and BTC price */
34+
/**
35+
* Eth last USD and BTC price
36+
* @return last usd/btc price for ETH
37+
* @throws ApiException parent exception class
38+
*/
2639
@NotNull Price lastPrice() throws ApiException;
2740
}

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

+12-5
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,19 @@
1515
*/
1616
public interface ITransactionApi {
1717

18-
/** Check Contract Execution Status (if there was an error during contract execution) */
18+
/**
19+
* Check Contract Execution Status (if there was an error during contract execution)
20+
* @param txhash transaction hash
21+
* @return optional status result
22+
* @throws ApiException parent exception class
23+
*/
1924
@NotNull Optional<Status> execStatus(String txhash) throws ApiException;
2025

21-
/** Check Transaction Receipt Status (Only applicable for Post Byzantium fork transactions)
22-
* 0 = Fail, 1 = Pass
23-
* empty value for pre-byzantium fork
24-
* */
26+
/**
27+
* Check Transaction Receipt Status (Only applicable for Post Byzantium fork transactions)
28+
* @param txhash transaction hash
29+
* @return 0 = Fail, 1 = Pass, empty value for pre-byzantium fork
30+
* @throws ApiException parent exception class
31+
*/
2532
@NotNull Optional<Boolean> receiptStatus(String txhash) throws ApiException;
2633
}

src/main/java/io/api/etherscan/core/impl/EtherScanApi.java

+7
Original file line numberDiff line numberDiff line change
@@ -82,48 +82,55 @@ public EtherScanApi(final String apiKey,
8282

8383
/**
8484
* API for interactions with account and address
85+
* @return account api
8586
*/
8687
public IAccountApi account() {
8788
return account;
8889
}
8990

9091
/**
9192
* API for verifying contract ABI
93+
* @return contract api
9294
*/
9395
public IContractApi contract() {
9496
return contract;
9597
}
9698

9799
/**
98100
* [BETA] API for interaction with tx statuses
101+
* @return transactions api
99102
*/
100103
public ITransactionApi txs() {
101104
return txs;
102105
}
103106

104107
/**
105108
* [BETA] API for getting block rewards and uncles
109+
* @return block api
106110
*/
107111
public IBlockApi block() {
108112
return block;
109113
}
110114

111115
/**
112116
* [BETA] API for interaction with eth_getLogs
117+
* @return logs api
113118
*/
114119
public ILogsApi logs() {
115120
return logs;
116121
}
117122

118123
/**
119124
* API for interacting with geth/proxy etherscan
125+
* @return proxy api
120126
*/
121127
public IProxyApi proxy() {
122128
return proxy;
123129
}
124130

125131
/**
126132
* API for eth price and supply statistic
133+
* @return statistic api
127134
*/
128135
public IStatisticApi stats() {
129136
return stats;

src/main/java/io/api/etherscan/manager/IQueueManager.java

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public interface IQueueManager {
1212

1313
/**
1414
* Waits in queue for chance to take turn
15+
* @return can or can not rake turn
1516
*/
1617
boolean takeTurn();
1718
}

src/test/java/io/api/manager/QueueManagerTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ public void queueManagerTimeout() {
4646
long start = System.currentTimeMillis();
4747
queueManager.takeTurn();
4848
long end = System.currentTimeMillis();
49-
assertEquals(3, (end - start) / 1000);
49+
assertEquals(3, Math.round((double)(end - start)/1000));
5050
}
5151
}

0 commit comments

Comments
 (0)