Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
refactor: use sf-protos type conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
suchapalaver committed Aug 22, 2024
1 parent 6bbf462 commit a46d148
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 1 addition & 22 deletions src/transactions/tx_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,7 @@ pub enum TransactionTypeError {
Missing,
}

fn tx_to_reth_tx(tx_type: Type) -> TxType {
use TxType::*;
use Type::*;

match tx_type {
TrxTypeLegacy => Legacy,
TrxTypeAccessList => Eip2930,
TrxTypeDynamicFee => Eip1559,
TrxTypeBlob => todo!(),
TrxTypeArbitrumDeposit => unimplemented!(),
TrxTypeArbitrumUnsigned => unimplemented!(),
TrxTypeArbitrumContract => unimplemented!(),
TrxTypeArbitrumRetry => unimplemented!(),
TrxTypeArbitrumSubmitRetryable => unimplemented!(),
TrxTypeArbitrumInternal => unimplemented!(),
TrxTypeArbitrumLegacy => unimplemented!(),
TrxTypeOptimismDeposit => unimplemented!(),
}
}

pub fn map_tx_type(tx_type: &i32) -> Result<TxType, TransactionTypeError> {
let tx_type = Type::try_from(*tx_type).map_err(|_| TransactionTypeError::Missing)?; // 1
let tx_type = tx_to_reth_tx(tx_type);
Ok(tx_type)
Ok(TxType::from(tx_type))
}

0 comments on commit a46d148

Please sign in to comment.