2
2
3
3
import io .api .etherscan .util .BasicUtils ;
4
4
5
+ import java .math .BigInteger ;
5
6
import java .time .LocalDateTime ;
6
7
import java .time .ZoneOffset ;
7
8
import java .util .List ;
15
16
public class BlockProxy {
16
17
17
18
private String number ;
19
+ private Long _number ;
18
20
private String hash ;
19
21
private String parentHash ;
20
22
private String stateRoot ;
21
23
private String size ;
24
+ private Long _size ;
22
25
private String difficulty ;
23
26
private String totalDifficulty ;
24
27
private String timestamp ;
@@ -30,7 +33,9 @@ public class BlockProxy {
30
33
private String logsBloom ;
31
34
private String mixHash ;
32
35
private String gasUsed ;
36
+ private BigInteger _gasUsed ;
33
37
private String gasLimit ;
38
+ private BigInteger _gasLimit ;
34
39
35
40
private String sha3Uncles ;
36
41
private List <String > uncles ;
@@ -40,8 +45,10 @@ public class BlockProxy {
40
45
private List <TxProxy > transactions ;
41
46
42
47
//<editor-fold desc="Getters">
43
- public String getNumber () {
44
- return number ;
48
+ public Long getNumber () {
49
+ if (_number == null && !BasicUtils .isEmpty (number ))
50
+ _number = BasicUtils .parseHex (number ).longValue ();
51
+ return _number ;
45
52
}
46
53
47
54
public String getHash () {
@@ -56,8 +63,10 @@ public String getStateRoot() {
56
63
return stateRoot ;
57
64
}
58
65
59
- public String getSize () {
60
- return size ;
66
+ public Long getSize () {
67
+ if (_size == null && !BasicUtils .isEmpty (size ))
68
+ _size = BasicUtils .parseHex (size ).longValue ();
69
+ return _size ;
61
70
}
62
71
63
72
public String getDifficulty () {
@@ -94,12 +103,16 @@ public String getMixHash() {
94
103
return mixHash ;
95
104
}
96
105
97
- public String getGasUsed () {
98
- return gasUsed ;
106
+ public BigInteger getGasUsed () {
107
+ if (_gasUsed == null && !BasicUtils .isEmpty (gasUsed ))
108
+ _gasUsed = BasicUtils .parseHex (gasUsed );
109
+ return _gasUsed ;
99
110
}
100
111
101
- public String getGasLimit () {
102
- return gasLimit ;
112
+ public BigInteger getGasLimit () {
113
+ if (_gasLimit == null && !BasicUtils .isEmpty (gasLimit ))
114
+ _gasLimit = BasicUtils .parseHex (gasLimit );
115
+ return _gasLimit ;
103
116
}
104
117
105
118
public String getSha3Uncles () {
0 commit comments