Skip to content

Commit 2604d93

Browse files
committed
LogQuery implementation finalized
TransactionProvider & others implemented HttpExecutor supplier in api constructor Refactoring & improvements
1 parent 6d5a02b commit 2604d93

Some content is hidden

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

56 files changed

+743
-437
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package io.api;
22

3-
import io.api.core.EtherScanApi;
3+
import io.api.core.impl.EtherScanApi;
44
import io.api.model.Tx;
55
import io.api.model.TxInternal;
66
import io.api.model.TxToken;
7+
import io.api.model.UncleBlock;
78

89
import java.util.List;
10+
import java.util.Optional;
911

1012
/**
1113
*
@@ -14,8 +16,10 @@ public class App {
1416
public static void main(String[] args) {
1517
EtherScanApi api = new EtherScanApi(args[0]);
1618
List<Tx> txs = api.account().txs("0x8d4426f94e42f721C7116E81d6688cd935cB3b4F");
17-
List<TxInternal> txInternals = api.account().txsInternal("0x2c1ba59d6f58433fb1eaee7d20b26ed83bda51a3");
1819
List<TxToken> txTokens = api.account().txsToken("0xf261B3A60Ef40eE0B369B0705c1a2c58B02799DF");
20+
List<TxInternal> txInternals = api.account().txsInternal("0x2c1ba59d6f58433fb1eaee7d20b26ed83bda51a3");
21+
Optional<UncleBlock> uncles = api.block().uncles(2165403);
22+
Optional<UncleBlock> uncleBlock = api.block().uncles(999965403);
1923
System.out.println("Test");
2024
}
2125
}

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

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/main/java/io/api/core/IAccountProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public interface IAccountProvider {
1818
/** Address ETH balance */
1919
@NotNull Balance balance(String address) throws ApiException;
2020

21+
/** ERC20 token balance for address */
22+
@NotNull Balance balance(String address, String contract) throws ApiException;
23+
2124
/**
2225
* Maximum 20 address for single batch request
2326
* If address > 20, then there will be more than 1 request performed

src/main/java/io/api/core/IBlockProvider.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package io.api.core;
22

3+
import io.api.error.ApiException;
34
import io.api.model.UncleBlock;
5+
import org.jetbrains.annotations.NotNull;
6+
7+
import java.util.Optional;
48

59
/**
610
* EtherScan - API Descriptions
@@ -12,5 +16,5 @@
1216
public interface IBlockProvider {
1317

1418
/** Return uncle blocks */
15-
UncleBlock uncles(long blockNumber);
19+
@NotNull Optional<UncleBlock> uncles(long blockNumber) throws ApiException;
1620
}

src/main/java/io/api/core/IContractProvider.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package io.api.core;
22

3+
import io.api.error.ApiException;
4+
import org.jetbrains.annotations.NotNull;
5+
36
/**
47
* EtherScan - API Descriptions
58
* https://etherscan.io/apis#contracts
@@ -10,5 +13,5 @@
1013
public interface IContractProvider {
1114

1215
/** Get Verified Contract Sources */
13-
String contractAbi(String address);
16+
@NotNull String contractAbi(String address) throws ApiException;
1417
}

src/main/java/io/api/core/ILogsProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package io.api.core;
22

33
import io.api.model.Log;
4+
import io.api.model.builder.LogQuery;
5+
import org.jetbrains.annotations.NotNull;
46

57
import java.util.List;
68

@@ -13,7 +15,5 @@
1315
*/
1416
public interface ILogsProvider {
1517

16-
List<Log> logs(String address);
17-
List<Log> logs(String address, long startBlock);
18-
List<Log> logs(String address, long startBlock, long endBlock);
18+
@NotNull List<Log> logs(LogQuery query);
1919
}

src/main/java/io/api/core/IParityProvider.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
* @since 30.10.2018
99
*/
1010
public interface IParityProvider {
11-
1211
//TODO implement
1312
}

src/main/java/io/api/core/IStatisticProvider.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
import io.api.model.Price;
44
import io.api.model.Supply;
5+
import org.jetbrains.annotations.NotNull;
6+
7+
import java.math.BigInteger;
8+
import java.util.Optional;
59

610
/**
711
* EtherScan - API Descriptions
@@ -12,9 +16,12 @@
1216
*/
1317
public interface IStatisticProvider {
1418

19+
/** ERC20 Total Supply */
20+
@NotNull Optional<BigInteger> supply(String contract);
21+
1522
/** Eth Total Supply */
16-
Supply supply();
23+
@NotNull Supply supply();
1724

1825
/** Eth last USD and BTC price */
19-
Price lastPrice();
26+
@NotNull Price lastPrice();
2027
}

src/main/java/io/api/core/ITokenProvider.java

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/main/java/io/api/core/ITransactionProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.api.core;
22

33
import io.api.model.Status;
4+
import org.jetbrains.annotations.NotNull;
45

56
/**
67
* EtherScan - API Descriptions
@@ -11,7 +12,7 @@
1112
*/
1213
public interface ITransactionProvider {
1314

14-
Status execStatus(String txhash);
15+
@NotNull Status execStatus(String txhash);
1516

1617
boolean receiptStatus(String txhash);
1718
}

0 commit comments

Comments
 (0)