@@ -27,19 +27,6 @@ pub enum BeaconClientError {
2727 Deserialization ( serde_json:: Error ) ,
2828}
2929
30- #[ derive( Deserialize , Debug ) ]
31- pub struct GetBlobResponse {
32- pub blobs : Vec < BlobData > ,
33- }
34-
35- impl GetBlobResponse {
36- fn from_response_data ( data : Value ) -> Result < Self , serde_json:: Error > {
37- let blobs = Vec :: < BlobData > :: deserialize ( data) ?;
38-
39- Ok ( Self { blobs } )
40- }
41- }
42-
4330#[ derive( Deserialize , Debug ) ]
4431#[ allow( dead_code) ]
4532pub struct BlobData {
@@ -50,6 +37,7 @@ pub struct BlobData {
5037 pub kzg_commitment_inclusion_proof : Vec < String > ,
5138}
5239
40+ /*
5341#[derive(Deserialize, Debug)]
5442pub struct GetBlockHeadersResponse {
5543 pub blocks: Vec<BeaconBlock>,
@@ -62,7 +50,7 @@ impl GetBlockHeadersResponse {
6250 Ok(Self { blocks })
6351 }
6452}
65-
53+ */
6654#[ derive( Deserialize , Debug ) ]
6755#[ allow( dead_code) ]
6856pub struct BeaconBlock {
@@ -106,11 +94,9 @@ impl BeaconClient {
10694 ) )
10795 . await ?;
10896
109- let res = GetBlockHeadersResponse :: from_response_data ( data)
110- . map_err ( BeaconClientError :: Deserialization ) ?;
97+ let res = Vec :: < BeaconBlock > :: deserialize ( data) . map_err ( BeaconClientError :: Deserialization ) ?;
11198
11299 let block = res
113- . blocks
114100 . into_iter ( )
115101 . find ( |block| block. header . message . parent_root == parent_block_hash_hex) ;
116102
@@ -120,12 +106,12 @@ impl BeaconClient {
120106 pub async fn get_blobs_from_slot (
121107 & self ,
122108 slot : u64 ,
123- ) -> Result < GetBlobResponse , BeaconClientError > {
109+ ) -> Result < Vec :: < BlobData > , BeaconClientError > {
124110 let data = self
125111 . beacon_get ( & format ! ( "/eth/v1/beacon/blob_sidecars/{}" , slot) )
126112 . await ?;
127113
128- GetBlobResponse :: from_response_data ( data) . map_err ( BeaconClientError :: Deserialization )
114+ Vec :: < BlobData > :: deserialize ( data) . map_err ( BeaconClientError :: Deserialization )
129115 }
130116
131117 pub async fn get_blob_by_versioned_hash (
@@ -135,7 +121,7 @@ impl BeaconClient {
135121 ) -> Result < Option < BlobData > , BeaconClientError > {
136122 let res = self . get_blobs_from_slot ( slot) . await ?;
137123
138- let blob = res. blobs . into_iter ( ) . find ( |blob| {
124+ let blob = res. into_iter ( ) . find ( |blob| {
139125 let kzg_commitment_bytes =
140126 hex:: decode ( blob. kzg_commitment . replace ( "0x" , "" ) ) . expect ( "A valid commitment" ) ;
141127
0 commit comments