@@ -193,23 +193,23 @@ impl UIfmt for AnyTransactionReceipt {
193
193
194
194
let mut pretty = format ! (
195
195
"
196
- blockHash {}
197
- blockNumber {}
198
- contractAddress {}
199
- cumulativeGasUsed {}
200
- effectiveGasPrice {}
201
- from {}
202
- gasUsed {}
203
- logs {}
204
- logsBloom {}
205
- root {}
206
- status {}
207
- transactionHash {}
208
- transactionIndex {}
209
- type {}
210
- blobGasPrice {}
211
- blobGasUsed {}
212
- authorizationList {}" ,
196
+ blockHash {}
197
+ blockNumber {}
198
+ contractAddress {}
199
+ cumulativeGasUsed {}
200
+ effectiveGasPrice {}
201
+ from {}
202
+ gasUsed {}
203
+ logs {}
204
+ logsBloom {}
205
+ root {}
206
+ status {}
207
+ transactionHash {}
208
+ transactionIndex {}
209
+ type {}
210
+ blobGasPrice {}
211
+ blobGasUsed {}
212
+ authorizationList {}" ,
213
213
block_hash. pretty( ) ,
214
214
block_number. pretty( ) ,
215
215
contract_address. pretty( ) ,
@@ -233,13 +233,11 @@ authorizationList {}",
233
233
) ;
234
234
235
235
if let Some ( to) = to {
236
- pretty. push_str ( & format ! ( "\n to {}" , to. pretty( ) ) ) ;
236
+ pretty. push_str ( & format ! ( "\n to {}" , to. pretty( ) ) ) ;
237
237
}
238
238
239
239
// additional captured fields
240
- for ( key, val) in other. iter ( ) {
241
- pretty. push_str ( & format ! ( "\n {key} {val}" ) ) ;
242
- }
240
+ pretty. push_str ( & other. pretty ( ) ) ;
243
241
244
242
pretty
245
243
}
@@ -1415,4 +1413,63 @@ value 0".to_string();
1415
1413
assert_eq ! ( Some ( "1424182926" . to_string( ) ) , get_pretty_block_attr( & block, "timestamp" ) ) ;
1416
1414
assert_eq ! ( Some ( "163591" . to_string( ) ) , get_pretty_block_attr( & block, "totalDifficulty" ) ) ;
1417
1415
}
1416
+
1417
+ #[ test]
1418
+ fn test_receipt_other_fields_alignment ( ) {
1419
+ let receipt_json = serde_json:: json!(
1420
+ {
1421
+ "status" : "0x1" ,
1422
+ "cumulativeGasUsed" : "0x74e483" ,
1423
+ "logs" : [ ] ,
1424
+ "logsBloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" ,
1425
+ "type" : "0x2" ,
1426
+ "transactionHash" : "0x91181b0dca3b29aa136eeb2f536be5ce7b0aebc949be1c44b5509093c516097d" ,
1427
+ "transactionIndex" : "0x10" ,
1428
+ "blockHash" : "0x54bafb12e8cea9bb355fbf03a4ac49e42a2a1a80fa6cf4364b342e2de6432b5d" ,
1429
+ "blockNumber" : "0x7b1ab93" ,
1430
+ "gasUsed" : "0xc222" ,
1431
+ "effectiveGasPrice" : "0x18961" ,
1432
+ "from" : "0x2d815240a61731c75fa01b2793e1d3ed09f289d0" ,
1433
+ "to" : "0x4200000000000000000000000000000000000000" ,
1434
+ "contractAddress" : null,
1435
+ "l1BaseFeeScalar" : "0x146b" ,
1436
+ "l1BlobBaseFee" : "0x6a83078" ,
1437
+ "l1BlobBaseFeeScalar" : "0xf79c5" ,
1438
+ "l1Fee" : "0x51a9af7fd3" ,
1439
+ "l1GasPrice" : "0x972fe4acc" ,
1440
+ "l1GasUsed" : "0x640"
1441
+ } ) ;
1442
+
1443
+ let receipt: AnyTransactionReceipt = serde_json:: from_value ( receipt_json) . unwrap ( ) ;
1444
+ let formatted = receipt. pretty ( ) ;
1445
+
1446
+ let expected = r#"
1447
+ blockHash 0x54bafb12e8cea9bb355fbf03a4ac49e42a2a1a80fa6cf4364b342e2de6432b5d
1448
+ blockNumber 129084307
1449
+ contractAddress
1450
+ cumulativeGasUsed 7660675
1451
+ effectiveGasPrice 100705
1452
+ from 0x2D815240A61731c75Fa01b2793E1D3eD09F289d0
1453
+ gasUsed 49698
1454
+ logs []
1455
+ logsBloom 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1456
+ root
1457
+ status 1 (success)
1458
+ transactionHash 0x91181b0dca3b29aa136eeb2f536be5ce7b0aebc949be1c44b5509093c516097d
1459
+ transactionIndex 16
1460
+ type 2
1461
+ blobGasPrice
1462
+ blobGasUsed
1463
+ authorizationList
1464
+ to 0x4200000000000000000000000000000000000000
1465
+ l1BaseFeeScalar 5227
1466
+ l1BlobBaseFee 111685752
1467
+ l1BlobBaseFeeScalar 1014213
1468
+ l1Fee 350739202003
1469
+ l1GasPrice 40583973580
1470
+ l1GasUsed 1600
1471
+ "# ;
1472
+
1473
+ assert_eq ! ( formatted. trim( ) , expected. trim( ) ) ;
1474
+ }
1418
1475
}
0 commit comments