Skip to content

Commit fb89239

Browse files
committed
graph: add alloy_transaction_receipt_to_web3_transaction_receipt to conversions
1 parent 0728e7c commit fb89239

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

graph/src/util/conversions.rs

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1+
use std::sync::Arc;
2+
13
use crate::prelude::alloy::primitives::{Address as AlloyAddress, B256};
2-
use crate::prelude::alloy::rpc::types::Log as AlloyLog;
4+
use crate::prelude::alloy::rpc::types::{
5+
Block as AlloyBlock, Log as AlloyLog, TransactionReceipt as AlloyTransactionReceipt,
6+
};
37
/// Type conversion utilities between web3 and alloy types
4-
use crate::prelude::web3::types::{Address as Web3Address, Log as Web3Log, H160, H256, U256, U64};
8+
use crate::prelude::web3::types::{
9+
Address as Web3Address, Block as Web3Block, Log as Web3Log, Transaction as Web3Transaction,
10+
TransactionReceipt as Web3TransactionReceipt, H160, H256, U256, U64,
11+
};
512

6-
/// Converts web3 H256 to alloy B256
13+
/// Converts H256 to alloy B256
714
pub fn h256_to_b256(h: H256) -> B256 {
815
B256::from_slice(h.as_bytes())
916
}
1017

11-
/// Converts alloy B256 to web3 H256
18+
/// Converts alloy B256 to H256
1219
pub fn b256_to_h256(b: B256) -> H256 {
1320
H256::from_slice(b.as_slice())
1421
}
@@ -50,6 +57,26 @@ pub fn alloy_log_to_web3_log(log: AlloyLog) -> Web3Log {
5057
}
5158
}
5259

60+
pub fn alloy_transaction_receipt_to_web3_transaction_receipt(
61+
_receipt: Arc<AlloyTransactionReceipt>,
62+
) -> Arc<Web3TransactionReceipt> {
63+
unimplemented!("TransactionReceipt conversion not yet implemented - will be done when needed")
64+
}
65+
66+
/// Converts alloy Block to web3 Block
67+
pub fn alloy_block_to_web3_block(_block: AlloyBlock) -> Web3Block<Web3Transaction> {
68+
unimplemented!(
69+
"Block conversion from alloy to web3 not yet implemented - will be done when needed"
70+
)
71+
}
72+
73+
/// Converts web3 Block to alloy Block
74+
pub fn web3_block_to_alloy_block(_block: Web3Block<Web3Transaction>) -> AlloyBlock {
75+
unimplemented!(
76+
"Block conversion from web3 to alloy not yet implemented - will be done when needed"
77+
)
78+
}
79+
5380
#[cfg(test)]
5481
mod tests {
5582
use super::*;

0 commit comments

Comments
 (0)