Skip to content

Commit 0b60b49

Browse files
committed
Other provider contracts introduced
Some models timestamp support improved
1 parent 73fd165 commit 0b60b49

14 files changed

+242
-5
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.api.core;
2+
3+
import io.api.model.UncleBlock;
4+
5+
/**
6+
* EtherScan - API Descriptions
7+
* https://etherscan.io/apis#blocks
8+
*
9+
* @author GoodforGod
10+
* @since 30.10.2018
11+
*/
12+
public interface IBlockProvider {
13+
14+
UncleBlock uncles(long blockNumber);
15+
}

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

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

33
/**
4-
* ! NO DESCRIPTION !
4+
* EtherScan - API Descriptions
5+
* https://etherscan.io/apis#contracts
56
*
67
* @author GoodforGod
78
* @since 28.10.2018
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.api.core;
2+
3+
/**
4+
* EtherScan - API Descriptions
5+
* https://etherscan.io/apis#logs
6+
*
7+
* @author GoodforGod
8+
* @since 30.10.2018
9+
*/
10+
public interface ILogsProvider {
11+
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.api.core;
2+
3+
/**
4+
* EtherScan - API Descriptions
5+
* https://etherscan.io/apis#proxy
6+
*
7+
* @author GoodforGod
8+
* @since 30.10.2018
9+
*/
10+
public interface IParityProvider {
11+
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.api.core;
2+
3+
/**
4+
* EtherScan - API Descriptions
5+
* https://etherscan.io/apis#stats
6+
*
7+
* @author GoodforGod
8+
* @since 30.10.2018
9+
*/
10+
public interface IStatisticProvider {
11+
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package io.api.core;
2+
3+
/**
4+
* EtherScan - API Descriptions
5+
* https://etherscan.io/apis#tokens
6+
*
7+
* @author GoodforGod
8+
* @since 30.10.2018
9+
*/
10+
public interface ITokenProvider {
11+
12+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package io.api.core;
2+
3+
import io.api.model.Status;
4+
5+
/**
6+
* EtherScan - API Descriptions
7+
* https://etherscan.io/apis#transactions
8+
*
9+
* @author GoodforGod
10+
* @since 30.10.2018
11+
*/
12+
public interface ITransactionProvider {
13+
14+
Status execStatus(String txhash);
15+
16+
boolean receiptStatus(String txhash);
17+
}

src/main/java/io/api/model/BaseTx.java

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

3+
import io.api.util.BasicUtils;
4+
35
import java.math.BigInteger;
6+
import java.time.LocalDateTime;
7+
import java.time.ZoneOffset;
48

59
/**
610
* ! NO DESCRIPTION !
@@ -12,6 +16,7 @@ abstract class BaseTx {
1216

1317
private long blockNumber;
1418
private String timeStamp;
19+
private LocalDateTime _timeStamp;
1520
private String hash;
1621
private String from;
1722
private String to;
@@ -26,8 +31,10 @@ public long getBlockNumber() {
2631
return blockNumber;
2732
}
2833

29-
public String getTimeStamp() {
30-
return timeStamp;
34+
public LocalDateTime getTimeStamp() {
35+
if(_timeStamp == null && !BasicUtils.isEmpty(timeStamp))
36+
_timeStamp = LocalDateTime.ofEpochSecond(Long.valueOf(timeStamp), 0, ZoneOffset.UTC);
37+
return _timeStamp;
3138
}
3239

3340
public String getHash() {

src/main/java/io/api/model/Block.java

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

3+
import io.api.util.BasicUtils;
4+
5+
import java.time.LocalDateTime;
6+
import java.time.ZoneOffset;
7+
38
/**
49
* ! NO DESCRIPTION !
510
*
@@ -10,6 +15,7 @@ public class Block {
1015

1116
private String blockNumber;
1217
private String timeStamp;
18+
private LocalDateTime _timeStamp;
1319
private String blockReward;
1420

1521
public Block(String blockNumber, String timeStamp, String blockReward) {
@@ -23,8 +29,10 @@ public String getBlockNumber() {
2329
return blockNumber;
2430
}
2531

26-
public String getTimeStamp() {
27-
return timeStamp;
32+
public LocalDateTime getTimeStamp() {
33+
if(_timeStamp == null && !BasicUtils.isEmpty(timeStamp))
34+
_timeStamp = LocalDateTime.ofEpochSecond(Long.valueOf(timeStamp), 0, ZoneOffset.UTC);
35+
return _timeStamp;
2836
}
2937

3038
public String getBlockReward() {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.api.model;
2+
3+
/**
4+
* ! NO DESCRIPTION !
5+
*
6+
* @author GoodforGod
7+
* @since 30.10.2018
8+
*/
9+
public class Status {
10+
11+
private int isError;
12+
private String errDescription;
13+
14+
public int getIsError() {
15+
return isError;
16+
}
17+
18+
public String getErrDescription() {
19+
return errDescription;
20+
}
21+
}

0 commit comments

Comments
 (0)