@@ -331,8 +331,8 @@ impl ColdStorageReadHandle {
331331///
332332/// # Read Access
333333///
334- /// All read methods from [`ColdStorageReadHandle`] are available on this
335- /// handle via [`Deref`](std::ops::Deref) .
334+ /// All read methods from [`ColdStorageReadHandle`] are also available
335+ /// directly on this handle .
336336///
337337/// # Usage
338338///
@@ -356,14 +356,6 @@ pub struct ColdStorageHandle {
356356 write_sender : mpsc:: Sender < ColdWriteRequest > ,
357357}
358358
359- impl std:: ops:: Deref for ColdStorageHandle {
360- type Target = ColdStorageReadHandle ;
361-
362- fn deref ( & self ) -> & Self :: Target {
363- & self . reader
364- }
365- }
366-
367359impl ColdStorageHandle {
368360 /// Create a new handle with the given senders.
369361 pub ( crate ) const fn new (
@@ -463,4 +455,182 @@ impl ColdStorageHandle {
463455 . try_send ( ColdWriteRequest :: TruncateAbove { block, resp } )
464456 . map_err ( map_dispatch_error)
465457 }
458+
459+ // ==========================================================================
460+ // Read Operations (delegated to ColdStorageReadHandle)
461+ // ==========================================================================
462+
463+ /// Get a header by specifier.
464+ pub async fn get_header ( & self , spec : HeaderSpecifier ) -> ColdResult < Option < SealedHeader > > {
465+ self . reader . get_header ( spec) . await
466+ }
467+
468+ /// Get a header by block number.
469+ pub async fn get_header_by_number (
470+ & self ,
471+ block : BlockNumber ,
472+ ) -> ColdResult < Option < SealedHeader > > {
473+ self . reader . get_header_by_number ( block) . await
474+ }
475+
476+ /// Get a header by block hash.
477+ pub async fn get_header_by_hash ( & self , hash : B256 ) -> ColdResult < Option < SealedHeader > > {
478+ self . reader . get_header_by_hash ( hash) . await
479+ }
480+
481+ /// Get multiple headers by specifiers.
482+ pub async fn get_headers (
483+ & self ,
484+ specs : Vec < HeaderSpecifier > ,
485+ ) -> ColdResult < Vec < Option < SealedHeader > > > {
486+ self . reader . get_headers ( specs) . await
487+ }
488+
489+ /// Get a transaction by specifier, with block confirmation metadata.
490+ pub async fn get_transaction (
491+ & self ,
492+ spec : TransactionSpecifier ,
493+ ) -> ColdResult < Option < Confirmed < RecoveredTx > > > {
494+ self . reader . get_transaction ( spec) . await
495+ }
496+
497+ /// Get a transaction by hash.
498+ pub async fn get_tx_by_hash ( & self , hash : B256 ) -> ColdResult < Option < Confirmed < RecoveredTx > > > {
499+ self . reader . get_tx_by_hash ( hash) . await
500+ }
501+
502+ /// Get a transaction by block number and index.
503+ pub async fn get_tx_by_block_and_index (
504+ & self ,
505+ block : BlockNumber ,
506+ index : u64 ,
507+ ) -> ColdResult < Option < Confirmed < RecoveredTx > > > {
508+ self . reader . get_tx_by_block_and_index ( block, index) . await
509+ }
510+
511+ /// Get a transaction by block hash and index.
512+ pub async fn get_tx_by_block_hash_and_index (
513+ & self ,
514+ block_hash : B256 ,
515+ index : u64 ,
516+ ) -> ColdResult < Option < Confirmed < RecoveredTx > > > {
517+ self . reader . get_tx_by_block_hash_and_index ( block_hash, index) . await
518+ }
519+
520+ /// Get all transactions in a block.
521+ pub async fn get_transactions_in_block (
522+ & self ,
523+ block : BlockNumber ,
524+ ) -> ColdResult < Vec < RecoveredTx > > {
525+ self . reader . get_transactions_in_block ( block) . await
526+ }
527+
528+ /// Get the transaction count for a block.
529+ pub async fn get_transaction_count ( & self , block : BlockNumber ) -> ColdResult < u64 > {
530+ self . reader . get_transaction_count ( block) . await
531+ }
532+
533+ /// Get a receipt by specifier.
534+ pub async fn get_receipt ( & self , spec : ReceiptSpecifier ) -> ColdResult < Option < ColdReceipt > > {
535+ self . reader . get_receipt ( spec) . await
536+ }
537+
538+ /// Get a receipt by transaction hash.
539+ pub async fn get_receipt_by_tx_hash ( & self , hash : B256 ) -> ColdResult < Option < ColdReceipt > > {
540+ self . reader . get_receipt_by_tx_hash ( hash) . await
541+ }
542+
543+ /// Get a receipt by block number and index.
544+ pub async fn get_receipt_by_block_and_index (
545+ & self ,
546+ block : BlockNumber ,
547+ index : u64 ,
548+ ) -> ColdResult < Option < ColdReceipt > > {
549+ self . reader . get_receipt_by_block_and_index ( block, index) . await
550+ }
551+
552+ /// Get all receipts in a block.
553+ pub async fn get_receipts_in_block ( & self , block : BlockNumber ) -> ColdResult < Vec < ColdReceipt > > {
554+ self . reader . get_receipts_in_block ( block) . await
555+ }
556+
557+ /// Get signet events by specifier.
558+ pub async fn get_signet_events (
559+ & self ,
560+ spec : SignetEventsSpecifier ,
561+ ) -> ColdResult < Vec < DbSignetEvent > > {
562+ self . reader . get_signet_events ( spec) . await
563+ }
564+
565+ /// Get signet events in a block.
566+ pub async fn get_signet_events_in_block (
567+ & self ,
568+ block : BlockNumber ,
569+ ) -> ColdResult < Vec < DbSignetEvent > > {
570+ self . reader . get_signet_events_in_block ( block) . await
571+ }
572+
573+ /// Get signet events in a range of blocks.
574+ pub async fn get_signet_events_in_range (
575+ & self ,
576+ start : BlockNumber ,
577+ end : BlockNumber ,
578+ ) -> ColdResult < Vec < DbSignetEvent > > {
579+ self . reader . get_signet_events_in_range ( start, end) . await
580+ }
581+
582+ /// Get a zenith header by block number.
583+ pub async fn get_zenith_header (
584+ & self ,
585+ block : BlockNumber ,
586+ ) -> ColdResult < Option < DbZenithHeader > > {
587+ self . reader . get_zenith_header ( block) . await
588+ }
589+
590+ /// Get zenith headers by specifier.
591+ pub async fn get_zenith_headers (
592+ & self ,
593+ spec : ZenithHeaderSpecifier ,
594+ ) -> ColdResult < Vec < DbZenithHeader > > {
595+ self . reader . get_zenith_headers ( spec) . await
596+ }
597+
598+ /// Get zenith headers in a range of blocks.
599+ pub async fn get_zenith_headers_in_range (
600+ & self ,
601+ start : BlockNumber ,
602+ end : BlockNumber ,
603+ ) -> ColdResult < Vec < DbZenithHeader > > {
604+ self . reader . get_zenith_headers_in_range ( start, end) . await
605+ }
606+
607+ /// Filter logs by block range, address, and topics.
608+ ///
609+ /// Follows `eth_getLogs` semantics. Returns matching logs ordered by
610+ /// `(block_number, tx_index, log_index)`.
611+ ///
612+ /// # Errors
613+ ///
614+ /// Returns [`ColdStorageError::TooManyLogs`] if the query would produce
615+ /// more than `max_logs` results.
616+ pub async fn get_logs ( & self , filter : Filter , max_logs : usize ) -> ColdResult < Vec < RpcLog > > {
617+ self . reader . get_logs ( filter, max_logs) . await
618+ }
619+
620+ /// Stream logs matching a filter.
621+ ///
622+ /// See [`ColdStorageReadHandle::stream_logs`] for full documentation.
623+ pub async fn stream_logs (
624+ & self ,
625+ filter : Filter ,
626+ max_logs : usize ,
627+ deadline : Duration ,
628+ ) -> ColdResult < LogStream > {
629+ self . reader . stream_logs ( filter, max_logs, deadline) . await
630+ }
631+
632+ /// Get the latest block number in storage.
633+ pub async fn get_latest_block ( & self ) -> ColdResult < Option < BlockNumber > > {
634+ self . reader . get_latest_block ( ) . await
635+ }
466636}
0 commit comments