@@ -4,10 +4,10 @@ use ethers::types::{
4
4
} ;
5
5
use serde:: { Deserialize , Serialize } ;
6
6
7
- use crate :: { beacon_client:: types:: BlobData , utils:: web3:: calculate_versioned_hash} ;
7
+ use crate :: { beacon_client:: types:: Blob as BeaconBlob , utils:: web3:: calculate_versioned_hash} ;
8
8
9
9
#[ derive( Serialize , Deserialize , Debug ) ]
10
- pub struct BlockEntity {
10
+ pub struct Block {
11
11
pub number : U64 ,
12
12
pub hash : H256 ,
13
13
pub timestamp : U256 ,
@@ -16,7 +16,7 @@ pub struct BlockEntity {
16
16
17
17
#[ derive( Serialize , Deserialize , Debug ) ]
18
18
#[ serde( rename_all = "camelCase" ) ]
19
- pub struct TransactionEntity {
19
+ pub struct Transaction {
20
20
pub hash : H256 ,
21
21
pub from : Address ,
22
22
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
@@ -26,7 +26,7 @@ pub struct TransactionEntity {
26
26
27
27
#[ derive( Serialize , Deserialize , Debug ) ]
28
28
#[ serde( rename_all = "camelCase" ) ]
29
- pub struct BlobEntity {
29
+ pub struct Blob {
30
30
pub versioned_hash : H256 ,
31
31
pub commitment : String ,
32
32
pub data : Bytes ,
@@ -36,7 +36,7 @@ pub struct BlobEntity {
36
36
37
37
#[ derive( Serialize , Deserialize , Debug ) ]
38
38
#[ serde( rename_all = "camelCase" ) ]
39
- pub struct FailedSlotsChunkEntity {
39
+ pub struct FailedSlotsChunk {
40
40
#[ serde( default , skip_serializing_if = "Option::is_none" ) ]
41
41
pub id : Option < u32 > ,
42
42
pub initial_slot : u32 ,
@@ -45,12 +45,12 @@ pub struct FailedSlotsChunkEntity {
45
45
46
46
#[ derive( Serialize , Debug ) ]
47
47
pub struct FailedSlotsChunksRequest {
48
- pub chunks : Vec < FailedSlotsChunkEntity > ,
48
+ pub chunks : Vec < FailedSlotsChunk > ,
49
49
}
50
50
51
51
#[ derive( Deserialize , Debug ) ]
52
- pub struct GetFailedSlotsChunksResponse {
53
- pub chunks : Vec < FailedSlotsChunkEntity > ,
52
+ pub struct FailedSlotsChunksResponse {
53
+ pub chunks : Vec < FailedSlotsChunk > ,
54
54
}
55
55
56
56
#[ derive( Serialize , Deserialize , Debug ) ]
@@ -59,38 +59,37 @@ pub struct RemoveFailedSlotsChunksRequest {
59
59
pub chunk_ids : Vec < u32 > ,
60
60
}
61
61
62
- #[ derive( Serialize , Deserialize , Debug ) ]
63
- pub struct SlotResponse {
62
+ #[ derive( Serialize , Debug ) ]
63
+ pub struct SlotRequest {
64
64
pub slot : u32 ,
65
65
}
66
-
67
- #[ derive( Serialize , Deserialize , Debug ) ]
68
- pub struct SlotRequest {
66
+ #[ derive( Deserialize , Debug ) ]
67
+ pub struct SlotResponse {
69
68
pub slot : u32 ,
70
69
}
71
70
72
- #[ derive( Serialize , Deserialize , Debug ) ]
71
+ #[ derive( Serialize , Debug ) ]
73
72
pub struct IndexRequest {
74
- pub block : BlockEntity ,
75
- pub transactions : Vec < TransactionEntity > ,
76
- pub blobs : Vec < BlobEntity > ,
73
+ pub block : Block ,
74
+ pub transactions : Vec < Transaction > ,
75
+ pub blobs : Vec < Blob > ,
77
76
}
78
77
79
78
#[ derive( Debug , thiserror:: Error ) ]
80
79
pub enum BlobscanClientError {
81
80
#[ error( transparent) ]
82
81
Reqwest ( #[ from] reqwest:: Error ) ,
83
82
84
- #[ error( "Blobscan client error: {0}" ) ]
85
- BlobscanClientError ( String ) ,
83
+ #[ error( "API usage error: {0}" ) ]
84
+ ApiError ( String ) ,
86
85
87
86
#[ error( transparent) ]
88
- JWTError ( #[ from] anyhow:: Error ) ,
87
+ Other ( #[ from] anyhow:: Error ) ,
89
88
}
90
89
91
90
pub type BlobscanClientResult < T > = Result < T , BlobscanClientError > ;
92
91
93
- impl From < ( u32 , u32 ) > for FailedSlotsChunkEntity {
92
+ impl From < ( u32 , u32 ) > for FailedSlotsChunk {
94
93
fn from ( ( initial_slot, final_slot) : ( u32 , u32 ) ) -> Self {
95
94
Self {
96
95
id : None ,
@@ -100,7 +99,7 @@ impl From<(u32, u32)> for FailedSlotsChunkEntity {
100
99
}
101
100
}
102
101
103
- impl < ' a > TryFrom < ( & ' a EthersBlock < EthersTransaction > , u32 ) > for BlockEntity {
102
+ impl < ' a > TryFrom < ( & ' a EthersBlock < EthersTransaction > , u32 ) > for Block {
104
103
type Error = anyhow:: Error ;
105
104
106
105
fn try_from (
@@ -121,9 +120,7 @@ impl<'a> TryFrom<(&'a EthersBlock<EthersTransaction>, u32)> for BlockEntity {
121
120
}
122
121
}
123
122
124
- impl < ' a > TryFrom < ( & ' a EthersTransaction , & ' a EthersBlock < EthersTransaction > ) >
125
- for TransactionEntity
126
- {
123
+ impl < ' a > TryFrom < ( & ' a EthersTransaction , & ' a EthersBlock < EthersTransaction > ) > for Transaction {
127
124
type Error = anyhow:: Error ;
128
125
129
126
fn try_from (
@@ -142,11 +139,11 @@ impl<'a> TryFrom<(&'a EthersTransaction, &'a EthersBlock<EthersTransaction>)>
142
139
}
143
140
}
144
141
145
- impl < ' a > TryFrom < ( & ' a BlobData , u32 , H256 ) > for BlobEntity {
142
+ impl < ' a > TryFrom < ( & ' a BeaconBlob , u32 , H256 ) > for Blob {
146
143
type Error = anyhow:: Error ;
147
144
148
145
fn try_from (
149
- ( blob_data, index, tx_hash) : ( & ' a BlobData , u32 , H256 ) ,
146
+ ( blob_data, index, tx_hash) : ( & ' a BeaconBlob , u32 , H256 ) ,
150
147
) -> Result < Self , Self :: Error > {
151
148
Ok ( Self {
152
149
tx_hash,
@@ -158,9 +155,9 @@ impl<'a> TryFrom<(&'a BlobData, u32, H256)> for BlobEntity {
158
155
}
159
156
}
160
157
161
- impl < ' a > From < ( & ' a BlobData , & ' a H256 , usize , & ' a H256 ) > for BlobEntity {
158
+ impl < ' a > From < ( & ' a BeaconBlob , & ' a H256 , usize , & ' a H256 ) > for Blob {
162
159
fn from (
163
- ( blob_data, versioned_hash, index, tx_hash) : ( & ' a BlobData , & ' a H256 , usize , & ' a H256 ) ,
160
+ ( blob_data, versioned_hash, index, tx_hash) : ( & ' a BeaconBlob , & ' a H256 , usize , & ' a H256 ) ,
164
161
) -> Self {
165
162
Self {
166
163
tx_hash : * tx_hash,
0 commit comments