blob_indexer/utils/
alloy.rs1use alloy::{
2 consensus::Transaction as ConsensusTx,
3 primitives::B256,
4 rpc::types::{BlockTransactions, Transaction},
5};
6
7pub trait B256Ext {
8 fn to_full_hex(&self) -> String;
9}
10
11impl B256Ext for B256 {
12 fn to_full_hex(&self) -> String {
13 format!("0x{:x}", self)
14 }
15}
16
17pub trait BlobTransactionExt {
18 fn filter_blob_transactions(&self) -> Vec<&Transaction>;
20}
21
22impl BlobTransactionExt for BlockTransactions<Transaction> {
23 fn filter_blob_transactions(&self) -> Vec<&Transaction> {
24 match self.as_transactions() {
25 Some(txs) => txs
26 .into_iter()
27 .filter(|tx| tx.inner.blob_versioned_hashes().is_some())
28 .collect(),
29 None => vec![],
30 }
31 }
32}