1
- import { Address , BlockId , ThorId , UInt , Units , VTHO } from '@vechain/sdk-core' ;
1
+ import { Address , BlockId , Gas , ThorId , UInt } from '@vechain/sdk-core' ;
2
2
3
3
interface CommmonBlockResponseJSON {
4
4
number : number ;
@@ -26,10 +26,9 @@ class CommmonBlockResponse {
26
26
readonly size : UInt ;
27
27
readonly parentID : BlockId ;
28
28
readonly timestamp : UInt ;
29
- // to do: use the Gas unit class when it will be available
30
- readonly gasLimit : VTHO ;
29
+ readonly gasLimit : Gas ;
31
30
readonly beneficiary : Address ;
32
- readonly gasUsed : VTHO ;
31
+ readonly gasUsed : Gas ;
33
32
readonly totalScore : UInt ;
34
33
readonly txsRoot : ThorId ;
35
34
readonly txsFeatures : UInt ;
@@ -46,9 +45,9 @@ class CommmonBlockResponse {
46
45
this . size = UInt . of ( json . size ) ;
47
46
this . parentID = BlockId . of ( json . parentID ) ;
48
47
this . timestamp = UInt . of ( json . timestamp ) ;
49
- this . gasLimit = VTHO . of ( json . gasLimit , Units . wei ) ;
48
+ this . gasLimit = Gas . of ( json . gasLimit ) ;
50
49
this . beneficiary = Address . of ( json . beneficiary ) ;
51
- this . gasUsed = VTHO . of ( json . gasUsed , Units . wei ) ;
50
+ this . gasUsed = Gas . of ( json . gasUsed ) ;
52
51
this . totalScore = UInt . of ( json . totalScore ) ;
53
52
this . txsRoot = ThorId . of ( json . txsRoot ) ;
54
53
this . txsFeatures = UInt . of ( json . txsFeatures ) ;
@@ -67,9 +66,9 @@ class CommmonBlockResponse {
67
66
size : this . size . valueOf ( ) ,
68
67
parentID : this . parentID . toString ( ) ,
69
68
timestamp : this . timestamp . valueOf ( ) ,
70
- gasLimit : Number ( this . gasLimit . wei ) ,
69
+ gasLimit : this . gasLimit . valueOf ( ) ,
71
70
beneficiary : this . beneficiary . toString ( ) ,
72
- gasUsed : Number ( this . gasUsed . wei ) ,
71
+ gasUsed : this . gasUsed . valueOf ( ) ,
73
72
totalScore : this . totalScore . valueOf ( ) ,
74
73
txsRoot : this . txsRoot . toString ( ) ,
75
74
txsFeatures : this . txsFeatures . valueOf ( ) ,
0 commit comments