@@ -170,6 +170,14 @@ impl v1::AvailabilityApi for TestApi {
170170 Ok ( vec ! [ 0xde , 0xad , 0xbe , 0xef ] )
171171 }
172172
173+ async fn stream_namespace_proofs (
174+ & self ,
175+ _from : usize ,
176+ _namespace : u32 ,
177+ ) -> Result < futures:: stream:: BoxStream < ' static , Self :: NamespaceProofQueryData > > {
178+ Ok ( Box :: pin ( futures:: stream:: empty ( ) ) )
179+ }
180+
173181 async fn get_state_cert ( & self , epoch : u64 ) -> Result < Self :: StateCertQueryDataV1 > {
174182 tracing:: info!( "v1: get_state_cert(epoch={})" , epoch) ;
175183 Ok ( vec ! [ 0x01 , 0x02 , 0x03 ] )
@@ -181,6 +189,132 @@ impl v1::AvailabilityApi for TestApi {
181189 }
182190}
183191
192+ // Stub HotShotAvailabilityApi for the example — returns empty/unit data.
193+ #[ async_trait]
194+ impl v1:: HotShotAvailabilityApi for TestApi {
195+ type Leaf = serde_json:: Value ;
196+ type Block = serde_json:: Value ;
197+ type Header = serde_json:: Value ;
198+ type Payload = serde_json:: Value ;
199+ type VidCommon = serde_json:: Value ;
200+ type Transaction = serde_json:: Value ;
201+ type TransactionWithProof = serde_json:: Value ;
202+ type BlockSummary = serde_json:: Value ;
203+ type Limits = serde_json:: Value ;
204+ type Cert2 = serde_json:: Value ;
205+
206+ async fn get_leaf ( & self , _id : v1:: LeafId ) -> Result < Self :: Leaf > {
207+ Ok ( serde_json:: json!( { } ) )
208+ }
209+ async fn get_leaf_range ( & self , _from : usize , _until : usize ) -> Result < Vec < Self :: Leaf > > {
210+ Ok ( vec ! [ ] )
211+ }
212+ async fn get_header ( & self , _id : v1:: BlockId ) -> Result < Self :: Header > {
213+ Ok ( serde_json:: json!( { } ) )
214+ }
215+ async fn get_header_range ( & self , _from : usize , _until : usize ) -> Result < Vec < Self :: Header > > {
216+ Ok ( vec ! [ ] )
217+ }
218+ async fn get_block ( & self , _id : v1:: BlockId ) -> Result < Self :: Block > {
219+ Ok ( serde_json:: json!( { } ) )
220+ }
221+ async fn get_block_range ( & self , _from : usize , _until : usize ) -> Result < Vec < Self :: Block > > {
222+ Ok ( vec ! [ ] )
223+ }
224+ async fn get_payload ( & self , _id : v1:: PayloadId ) -> Result < Self :: Payload > {
225+ Ok ( serde_json:: json!( { } ) )
226+ }
227+ async fn get_payload_range ( & self , _from : usize , _until : usize ) -> Result < Vec < Self :: Payload > > {
228+ Ok ( vec ! [ ] )
229+ }
230+ async fn get_vid_common ( & self , _id : v1:: BlockId ) -> Result < Self :: VidCommon > {
231+ Ok ( serde_json:: json!( { } ) )
232+ }
233+ async fn get_vid_common_range (
234+ & self ,
235+ _from : usize ,
236+ _until : usize ,
237+ ) -> Result < Vec < Self :: VidCommon > > {
238+ Ok ( vec ! [ ] )
239+ }
240+ async fn get_transaction_by_position (
241+ & self ,
242+ _height : u64 ,
243+ _index : u64 ,
244+ ) -> Result < Self :: Transaction > {
245+ Ok ( serde_json:: json!( { } ) )
246+ }
247+ async fn get_transaction_by_hash ( & self , _hash : String ) -> Result < Self :: Transaction > {
248+ Ok ( serde_json:: json!( { } ) )
249+ }
250+ async fn get_transaction_proof_by_position (
251+ & self ,
252+ _height : u64 ,
253+ _index : u64 ,
254+ ) -> Result < Self :: TransactionWithProof > {
255+ Ok ( serde_json:: json!( { } ) )
256+ }
257+ async fn get_transaction_proof_by_hash (
258+ & self ,
259+ _hash : String ,
260+ ) -> Result < Self :: TransactionWithProof > {
261+ Ok ( serde_json:: json!( { } ) )
262+ }
263+ async fn get_block_summary ( & self , _height : usize ) -> Result < Self :: BlockSummary > {
264+ Ok ( serde_json:: json!( { } ) )
265+ }
266+ async fn get_block_summary_range (
267+ & self ,
268+ _from : usize ,
269+ _until : usize ,
270+ ) -> Result < Vec < Self :: BlockSummary > > {
271+ Ok ( vec ! [ ] )
272+ }
273+ async fn get_limits ( & self ) -> Result < Self :: Limits > {
274+ Ok ( serde_json:: json!( { "small_object_range_limit" : 500 , "large_object_range_limit" : 100 } ) )
275+ }
276+ async fn get_cert2 ( & self , _height : u64 ) -> Result < Option < Self :: Cert2 > > {
277+ Ok ( None )
278+ }
279+ async fn stream_leaves (
280+ & self ,
281+ _from : usize ,
282+ ) -> Result < futures:: stream:: BoxStream < ' static , Self :: Leaf > > {
283+ Ok ( Box :: pin ( futures:: stream:: empty ( ) ) )
284+ }
285+ async fn stream_headers (
286+ & self ,
287+ _from : usize ,
288+ ) -> Result < futures:: stream:: BoxStream < ' static , Self :: Header > > {
289+ Ok ( Box :: pin ( futures:: stream:: empty ( ) ) )
290+ }
291+ async fn stream_blocks (
292+ & self ,
293+ _from : usize ,
294+ ) -> Result < futures:: stream:: BoxStream < ' static , Self :: Block > > {
295+ Ok ( Box :: pin ( futures:: stream:: empty ( ) ) )
296+ }
297+ async fn stream_payloads (
298+ & self ,
299+ _from : usize ,
300+ ) -> Result < futures:: stream:: BoxStream < ' static , Self :: Payload > > {
301+ Ok ( Box :: pin ( futures:: stream:: empty ( ) ) )
302+ }
303+ async fn stream_vid_common (
304+ & self ,
305+ _from : usize ,
306+ ) -> Result < futures:: stream:: BoxStream < ' static , Self :: VidCommon > > {
307+ Ok ( Box :: pin ( futures:: stream:: empty ( ) ) )
308+ }
309+ async fn stream_transactions (
310+ & self ,
311+ _from : usize ,
312+ _namespace : Option < u32 > ,
313+ ) -> Result < futures:: stream:: BoxStream < ' static , Self :: Transaction > > {
314+ Ok ( Box :: pin ( futures:: stream:: empty ( ) ) )
315+ }
316+ }
317+
184318// Implement v2::RewardApi (simplified API - latest-only for claim/balance/proof)
185319#[ async_trait]
186320impl v2:: RewardApi for TestApi {
0 commit comments