@@ -15,7 +15,7 @@ func Test_GetBlock0(t *testing.T) {
15
15
cli := NewClient (testnetEndpoint )
16
16
block , err := cli .GetBlock (context .Background (), types.QueryBlockParams {
17
17
Height : util .GetPointer (types .U32 (9758550 )),
18
- }, GetBlockOption {WithTransactions : false , OnlyTransactionID : false })
18
+ }, GetBlockOption {WithTransactions : false , TransactionOnlyID : false , WithConsensus : true })
19
19
assert .NoError (t , err )
20
20
assert .Equal (t , & types.Block {
21
21
Id : types.BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
@@ -40,13 +40,33 @@ func Test_GetBlock0(t *testing.T) {
40
40
},
41
41
},
42
42
}, block )
43
+
44
+ block , err = cli .GetBlock (context .Background (), types.QueryBlockParams {
45
+ Height : util .GetPointer (types .U32 (9758550 )),
46
+ }, GetBlockOption {WithTransactions : false , TransactionOnlyID : false })
47
+ assert .NoError (t , err )
48
+ assert .Equal (t , & types.Block {
49
+ Id : types.BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
50
+ Header : types.Header {
51
+ Id : types.BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
52
+ DaHeight : 5700482 ,
53
+ TransactionsCount : 3 ,
54
+ MessageReceiptCount : 0 ,
55
+ TransactionsRoot : types.Bytes32 {Hash : common .HexToHash ("0x6acba90c0da2a5946cde70bc5d211ca06f1903b0fe7318bf7653ad4de3caf004" )},
56
+ MessageReceiptRoot : types.Bytes32 {Hash : common .HexToHash ("0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" )},
57
+ Height : 9758550 ,
58
+ PrevRoot : types.Bytes32 {Hash : common .HexToHash ("0xe14198c9e1fbc499df5a9dacdb1219135a2d4915011962b5ac379c54b9499b83" )},
59
+ Time : types.Tai64Timestamp {Time : time .Date (2024 , time .April , 15 , 2 , 44 , 2 , 0 , time .UTC )},
60
+ ApplicationHash : types.Bytes32 {Hash : common .HexToHash ("0xe0c1360865782cc46da4f65787896aa264e4e8812b6fdb7864cdf7ef6bf42437" )},
61
+ },
62
+ }, block )
43
63
}
44
64
45
65
func Test_GetBlock1 (t * testing.T ) {
46
66
cli := NewClient (testnetEndpoint )
47
67
block , err := cli .GetBlock (context .Background (), types.QueryBlockParams {
48
68
Height : util .GetPointer (types .U32 (9758550 )),
49
- }, GetBlockOption {WithTransactions : true , OnlyTransactionID : true })
69
+ }, GetBlockOption {WithTransactions : true , TransactionOnlyID : true , WithConsensus : true })
50
70
assert .NoError (t , err )
51
71
assert .Equal (t , & types.Block {
52
72
Id : types.BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
@@ -84,7 +104,7 @@ func Test_GetBlock2(t *testing.T) {
84
104
cli := NewClient (testnetEndpoint )
85
105
block , err := cli .GetBlock (context .Background (), types.QueryBlockParams {
86
106
Id : & types.BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
87
- }, GetBlockOption {WithTransactions : true })
107
+ }, GetBlockOption {WithTransactions : true , WithConsensus : true })
88
108
assert .NoError (t , err )
89
109
assert .Equal (t , & types.Block {
90
110
Id : types.BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
@@ -112,8 +132,7 @@ func Test_GetBlock2(t *testing.T) {
112
132
Id : types.TransactionId {Hash : common .HexToHash ("0x9b7a9353faacd4ce91c47707d66c81ec7e4d547905168a592312a94a5c67b69f" )},
113
133
InputAssetIds : []types.AssetId {{Hash : common .HexToHash ("0x0000000000000000000000000000000000000000000000000000000000000000" )}},
114
134
InputContracts : []types.Contract {{
115
- Id : types.ContractId {Hash : common .HexToHash ("0xd2a93abef5c3f45f48bb9f0736ccfda4c3f32c9c57fc307ab9363ef7712f305f" )},
116
- Salt : "0x572e0502c9ca4347b88a0faf5b4a36bbbbf3c4c62d4f77ea893f4be7541b42e6" ,
135
+ Id : types.ContractId {Hash : common .HexToHash ("0xd2a93abef5c3f45f48bb9f0736ccfda4c3f32c9c57fc307ab9363ef7712f305f" )},
117
136
}},
118
137
Policies : & types.Policies {
119
138
GasPrice : util.GetPointer [types.U64 ](1 ),
@@ -132,8 +151,7 @@ func Test_GetBlock2(t *testing.T) {
132
151
StateRoot : types.Bytes32 {Hash : common .HexToHash ("0x8f36f4ef87d3260fcbbb8b7d047bae772b12265d9c45bb11814855d57fdacee3" )},
133
152
TxPointer : "0094e7550005" ,
134
153
Contract : types.Contract {
135
- Id : types.ContractId {Hash : common .HexToHash ("0xd2a93abef5c3f45f48bb9f0736ccfda4c3f32c9c57fc307ab9363ef7712f305f" )},
136
- Salt : "0x572e0502c9ca4347b88a0faf5b4a36bbbbf3c4c62d4f77ea893f4be7541b42e6" ,
154
+ Id : types.ContractId {Hash : common .HexToHash ("0xd2a93abef5c3f45f48bb9f0736ccfda4c3f32c9c57fc307ab9363ef7712f305f" )},
137
155
},
138
156
},
139
157
}, {
@@ -178,8 +196,7 @@ func Test_GetBlock2(t *testing.T) {
178
196
Pc : util.GetPointer [types.U64 ](11640 ),
179
197
Is : util.GetPointer [types.U64 ](11640 ),
180
198
To : & types.Contract {
181
- Id : types.ContractId {Hash : common .HexToHash ("0xd2a93abef5c3f45f48bb9f0736ccfda4c3f32c9c57fc307ab9363ef7712f305f" )},
182
- Salt : "0x572e0502c9ca4347b88a0faf5b4a36bbbbf3c4c62d4f77ea893f4be7541b42e6" ,
199
+ Id : types.ContractId {Hash : common .HexToHash ("0xd2a93abef5c3f45f48bb9f0736ccfda4c3f32c9c57fc307ab9363ef7712f305f" )},
183
200
},
184
201
Amount : util.GetPointer [types.U64 ](0 ),
185
202
AssetId : & types.AssetId {Hash : common .HexToHash ("0x0000000000000000000000000000000000000000000000000000000000000000" )},
@@ -189,8 +206,7 @@ func Test_GetBlock2(t *testing.T) {
189
206
ReceiptType : "CALL" ,
190
207
}, {
191
208
Contract : & types.Contract {
192
- Id : types.ContractId {Hash : common .HexToHash ("0xd2a93abef5c3f45f48bb9f0736ccfda4c3f32c9c57fc307ab9363ef7712f305f" )},
193
- Salt : "0x572e0502c9ca4347b88a0faf5b4a36bbbbf3c4c62d4f77ea893f4be7541b42e6" ,
209
+ Id : types.ContractId {Hash : common .HexToHash ("0xd2a93abef5c3f45f48bb9f0736ccfda4c3f32c9c57fc307ab9363ef7712f305f" )},
194
210
},
195
211
Pc : util.GetPointer [types.U64 ](44000 ),
196
212
Is : util.GetPointer [types.U64 ](11640 ),
@@ -276,17 +292,15 @@ func Test_GetBlock2(t *testing.T) {
276
292
}, {
277
293
Id : types.TransactionId {Hash : common .HexToHash ("0x1a978dcf45d87d2793d7da58d45244d68241aa6363d6a435a38c5fdfeafff178" )},
278
294
InputContracts : []types.Contract {{
279
- Id : types.ContractId {Hash : common .HexToHash ("0x7777777777777777777777777777777777777777777777777777777777777777" )},
280
- Salt : "0x1bfd51cb31b8d0bc7d93d38f97ab771267d8786ab87073e0c2b8f9ddc44b274e" ,
295
+ Id : types.ContractId {Hash : common .HexToHash ("0x7777777777777777777777777777777777777777777777777777777777777777" )},
281
296
}},
282
297
InputContract : & types.InputContract {
283
298
UtxoId : types.UtxoId {Bytes : common .FromHex ("0xae426ee0c79cac25ffe515ca4148e27086669bee7043b23cd380dce443213eff00" )},
284
299
BalanceRoot : types.Bytes32 {Hash : common .HexToHash ("0x2d19f8c34395032b25ae83bf88cd618a8598c6f2459f137c931879b323a41e04" )},
285
300
StateRoot : types.Bytes32 {Hash : common .HexToHash ("0x0000000000000000000000000000000000000000000000000000000000000000" )},
286
301
TxPointer : "0094e7550006" ,
287
302
Contract : types.Contract {
288
- Id : types.ContractId {Hash : common .HexToHash ("0x7777777777777777777777777777777777777777777777777777777777777777" )},
289
- Salt : "0x1bfd51cb31b8d0bc7d93d38f97ab771267d8786ab87073e0c2b8f9ddc44b274e" ,
303
+ Id : types.ContractId {Hash : common .HexToHash ("0x7777777777777777777777777777777777777777777777777777777777777777" )},
290
304
},
291
305
},
292
306
MintAmount : util.GetPointer [types.U64 ](6379 ),
@@ -314,7 +328,7 @@ func Test_GetBlock3(t *testing.T) {
314
328
cli := NewClient (testnetEndpoint )
315
329
block , err := cli .GetBlock (context .Background (), types.QueryBlockParams {
316
330
Id : & types.BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
317
- }, GetBlockOption {OnlyIdAndHeight : true })
331
+ }, GetBlockOption {HeaderOnlyIdHeight : true })
318
332
assert .NoError (t , err )
319
333
assert .Equal (t , & types.Block {
320
334
Id : types.BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
@@ -374,7 +388,7 @@ func Test_GetBlocks(t *testing.T) {
374
388
Id : & types.BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
375
389
}, {
376
390
Id : & types.BlockId {Hash : common .HexToHash ("0xd00bd892604b2bacff3f0dc485586105caa3826b7818a729ff049eb40d3fb26d" )},
377
- }}, GetBlockOption {OnlyIdAndHeight : true })
391
+ }}, GetBlockOption {HeaderOnlyIdHeight : true })
378
392
assert .NoError (t , err )
379
393
assert .Equal (t , []* types.Block {{
380
394
Id : types.BlockId {Hash : common .HexToHash ("0x5d7f48fc777144b21ea760525936db069329dee2ccce509550c1478c1c0b5b2c" )},
0 commit comments