Skip to content

Commit cd8e9ea

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # src/main/java/io/api/etherscan/core/IAccountApi.java # src/main/java/io/api/etherscan/core/IBlockApi.java # src/main/java/io/api/etherscan/core/IContractApi.java # src/main/java/io/api/etherscan/core/ILogsApi.java # src/main/java/io/api/etherscan/core/IProxyApi.java # src/main/java/io/api/etherscan/core/IStatisticApi.java # src/main/java/io/api/etherscan/core/ITransactionApi.java # src/main/java/io/api/etherscan/core/impl/EtherScanApi.java # src/main/java/io/api/etherscan/manager/IQueueManager.java # src/test/java/io/api/etherscan/logs/LogQueryBuilderTest.java # src/test/java/io/api/etherscan/proxy/ProxyTxApiTest.java # src/test/java/io/api/etherscan/proxy/ProxyTxReceiptApiTest.java # src/test/java/io/api/manager/QueueManagerTest.java # src/test/java/io/api/util/BasicUtilsTests.java
2 parents 9394bb4 + 08edbb2 commit cd8e9ea

File tree

12 files changed

+203
-163
lines changed

12 files changed

+203
-163
lines changed

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

+45-25
Original file line numberDiff line numberDiff line change
@@ -17,59 +17,79 @@ public interface IAccountApi {
1717

1818
/**
1919
* Address ETH balance
20-
* @param address to look for
20+
* @param address get balance for
2121
* @return balance
22+
* @throws ApiException parent exception class
2223
*/
2324
@NotNull Balance balance(String address) throws ApiException;
2425

2526
/**
2627
* ERC20 token balance for address
27-
* @param address to look for
28-
* @param contract for token
29-
* @return token balance
28+
* @param address get balance for
29+
* @param contract token contract
30+
* @return token balance for address
31+
* @throws ApiException parent exception class
3032
*/
3133
@NotNull TokenBalance balance(String address, String contract) throws ApiException;
3234

3335
/**
3436
* Maximum 20 address for single batch request
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
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
3841
*/
3942
@NotNull List<Balance> balances(List<String> addresses) throws ApiException;
4043

4144
/**
42-
* Find all txs
43-
* @param address to look for txs
44-
* @return tx info
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
4551
*/
46-
@NotNull List<Tx> txs(String address) throws ApiException;
47-
@NotNull List<Tx> txs(String address, long startBlock) throws ApiException;
4852
@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;
4955

5056
/**
51-
* All internal txs
52-
* @param address to look for
53-
* @return internal tx
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
5463
*/
55-
@NotNull List<TxInternal> txsInternal(String address) throws ApiException;
56-
@NotNull List<TxInternal> txsInternal(String address, long startBlock) throws ApiException;
5764
@NotNull List<TxInternal> txsInternal(String address, long startBlock, long endBlock) throws ApiException;
58-
@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;
5967

6068
/**
61-
* All token txs
62-
* @param address to look for
63-
* @return token txs
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
6483
*/
65-
@NotNull List<TxToken> txsToken(String address) throws ApiException;
66-
@NotNull List<TxToken> txsToken(String address, long startBlock) throws ApiException;
6784
@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;
6887

6988
/**
7089
* All blocks mined by address
71-
* @param address to look for
72-
* @return mined blocks
90+
* @param address address to search for
91+
* @return blocks mined
92+
* @throws ApiException parent exception class
7393
*/
7494
@NotNull List<Block> minedBlocks(String address) throws ApiException;
7595
}

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ public interface IBlockApi {
1717

1818
/**
1919
* Return uncle blocks
20-
* @param blockNumber block number
21-
* @return uncle block
20+
* @param blockNumber block number form 0 to last
21+
* @return optional uncle blocks
22+
* @throws ApiException parent exception class
2223
*/
2324
@NotNull Optional<UncleBlock> uncles(long blockNumber) throws ApiException;
2425
}

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ public interface IContractApi {
1515

1616
/**
1717
* Get Verified Contract Sources
18-
* @param address to look for
19-
* @return abi for contract
18+
* @param address to verify
19+
* @return ABI verified
20+
* @throws ApiException parent exception class
2021
*/
2122
@NotNull Abi contractAbi(String address) throws ApiException;
2223
}

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
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
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
2527
*/
2628
@NotNull List<Log> logs(LogQuery query) throws ApiException;
2729
}

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

+42-26
Original file line numberDiff line numberDiff line change
@@ -22,115 +22,131 @@ public interface IProxyApi {
2222
* Returns the number of most recent block
2323
* eth_blockNumber
2424
* @return last block number
25+
* @throws ApiException parent exception class
2526
*/
2627
long blockNoLast();
2728

2829
/**
2930
* Returns information about a block by block number
3031
* eth_getBlockByNumber
31-
* @param blockNo block number
32-
* @return block info
32+
* @param blockNo block number from 0 to last
33+
* @return optional block result
34+
* @throws ApiException parent exception class
3335
*/
3436
@NotNull Optional<BlockProxy> block(long blockNo) throws ApiException;
3537

3638
/**
3739
* Returns information about a uncle by block number
3840
* eth_getUncleByBlockNumberAndIndex
39-
* @param blockNo block number
41+
* @param blockNo block number from 0 to last
4042
* @param index uncle block index
41-
* @return block info
43+
* @return optional block result
44+
* @throws ApiException parent exception class
4245
*/
4346
@NotNull Optional<BlockProxy> blockUncle(long blockNo, long index) throws ApiException;
4447

4548
/**
4649
* Returns the information about a transaction requested by transaction hash
4750
* eth_getTransactionByHash
48-
* @param txhash tx hash
49-
* @return tx info
51+
* @param txhash transaction hash
52+
* @return optional tx result
53+
* @throws ApiException parent exception class
5054
*/
5155
@NotNull Optional<TxProxy> tx(String txhash) throws ApiException;
5256

5357
/**
5458
* Returns information about a transaction by block number and transaction index position
5559
* eth_getTransactionByBlockNumberAndIndex
56-
* @param blockNo block number
60+
* @param blockNo block number from 0 to last
5761
* @param index tx index in block
58-
* @return tx info
62+
* @return optional tx result
63+
* @throws ApiException parent exception class
5964
*/
6065
@NotNull Optional<TxProxy> tx(long blockNo, long index) throws ApiException;
6166

6267
/**
6368
* Returns the number of transactions in a block from a block matching the given block number
6469
* eth_getBlockTransactionCountByNumber
65-
* @param blockNo block number
66-
* @return tx count in block
70+
* @param blockNo block number from 0 to last
71+
* @return transaction amount in block
72+
* @throws ApiException parent exception class
6773
*/
6874
int txCount(long blockNo) throws ApiException;
6975

7076
/**
7177
* Returns the number of transactions sent from an address
7278
* eth_getTransactionCount
73-
* @param address to look for
74-
* @return tx send count
79+
* @param address eth address
80+
* @return transactions send amount from address
81+
* @throws ApiException parent exception class
7582
*/
7683
int txSendCount(String address) throws ApiException;
7784

7885
/**
7986
* Creates new message call transaction or a contract creation for signed transactions
8087
* eth_sendRawTransaction
81-
* @param hexEncodedTx tx as hex
82-
* @return result (check eth grpc info)
88+
* @param hexEncodedTx encoded hex data to send
89+
* @return optional string response
90+
* @throws ApiException parent exception class
8391
*/
8492
@NotNull Optional<String> txSendRaw(String hexEncodedTx) throws ApiException;
8593

8694
/**
8795
* Returns the receipt of a transaction by transaction hash
8896
* eth_getTransactionReceipt
89-
* @param txhash tx hash
90-
* @return receipt
97+
* @param txhash transaction hash
98+
* @return optional tx receipt
99+
* @throws ApiException parent exception class
91100
*/
92101
@NotNull Optional<ReceiptProxy> txReceipt(String txhash) throws ApiException;
93102

94103
/**
95104
* Executes a new message call immediately without creating a transaction on the block chain
96105
* eth_call
97-
* @param address to look for
98-
* @param data in tx for call
99-
* @return result (check eth grpc info)
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
100110
*/
101111
@NotNull Optional<String> call(String address, String data) throws ApiException;
102112

103113
/**
104114
* Returns code at a given address
105115
* eth_getCode
106-
* @param address to look for
107-
* @return result (check eth grpc info)
116+
* @param address get code from
117+
* @return optional the code from the given address
118+
* @throws ApiException parent exception class
108119
*/
109120
@NotNull Optional<String> code(String address) throws ApiException;
110121

111122
/**
112123
* (**experimental)
113124
* Returns the value from a storage position at a given address
114125
* eth_getStorageAt
115-
* @param address to look for
126+
* @param address to get storage
116127
* @param position storage position
117-
* @return result (check eth grpc info)
128+
* @return optional the value at this storage position
129+
* @throws ApiException parent exception class
118130
*/
119131
@NotNull Optional<String> storageAt(String address, long position) throws ApiException;
120132

121133
/**
122134
* Returns the current price per gas in wei
123135
* eth_gasPrice
124-
* @return price
136+
* @return estimated gas price
137+
* @throws ApiException parent exception class
125138
*/
126139
@NotNull BigInteger gasPrice() throws ApiException;
127140

141+
128142
/**
129143
* Makes a call or transaction, which won't be added to the blockchain and returns the used gas,
130144
* which can be used for estimating the used gas
131145
* eth_estimateGas
132-
* @return gas estimate
146+
* @param hexData data to calc gas usage for
147+
* @return estimated gas usage
148+
* @throws ApiException parent exception class
133149
*/
134-
@NotNull BigInteger gasEstimated() throws ApiException;
135150
@NotNull BigInteger gasEstimated(String hexData) throws ApiException;
151+
@NotNull BigInteger gasEstimated() throws ApiException;
136152
}

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

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,23 @@ public interface IStatisticApi {
1818

1919
/**
2020
* ERC20 token total Supply
21-
* @param contract to look for
22-
* @return token supply
21+
* @param contract contract address
22+
* @return token supply for specified contract
23+
* @throws ApiException parent exception class
2324
*/
2425
@NotNull BigInteger supply(String contract) throws ApiException;
2526

2627
/**
2728
* Eth total supply
28-
* @return ETH supply
29+
* @return total ETH supply for moment
30+
* @throws ApiException parent exception class
2931
*/
3032
@NotNull Supply supply() throws ApiException;
3133

3234
/**
3335
* Eth last USD and BTC price
34-
* @return last price
36+
* @return last usd/btc price for ETH
37+
* @throws ApiException parent exception class
3538
*/
3639
@NotNull Price lastPrice() throws ApiException;
3740
}

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ public interface ITransactionApi {
1717

1818
/**
1919
* Check Contract Execution Status (if there was an error during contract execution)
20-
* @param txhash to look for
21-
* @return exec status
20+
* @param txhash transaction hash
21+
* @return optional status result
22+
* @throws ApiException parent exception class
2223
*/
2324
@NotNull Optional<Status> execStatus(String txhash) throws ApiException;
2425

2526
/**
2627
* Check Transaction Receipt Status (Only applicable for Post Byzantium fork transactions)
27-
* 0 = Fail, 1 = Pass
28-
* empty value for pre-byzantium fork
29-
* @param txhash to look for
30-
* @return status as boolean
28+
* @param txhash transaction hash
29+
* @return 0 = Fail, 1 = Pass, empty value for pre-byzantium fork
30+
* @throws ApiException parent exception class
3131
*/
3232
@NotNull Optional<Boolean> receiptStatus(String txhash) throws ApiException;
3333
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ public Optional<String> txSendRaw(final String hexEncodedTx) throws ApiException
143143
final StringProxyTO response = postRequest(urlParams, "", StringProxyTO.class);
144144
if(response.getError() != null)
145145
throw new EtherScanException("Error occurred with code " + response.getError().getCode()
146-
+ " with message " + response.getError().getMessage());
146+
+ " with message " + response.getError().getMessage()
147+
+ ", error id " + response.getId() + ", jsonRPC " + response.getJsonrpc());
147148

148149
return Optional.ofNullable(response.getResult());
149150
}

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

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

1313
/**
1414
* Waits in queue for chance to take turn
15-
* @return is turn available
15+
* @return can or can not rake turn
1616
*/
1717
boolean takeTurn();
1818
}

0 commit comments

Comments
 (0)