Skip to content

Commit 32b03c0

Browse files
committed
feat(api): return type ID for transaction
1 parent c01d0ee commit 32b03c0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ethportal-api/src/types/execution/transaction.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ impl Transaction {
2121
keccak_hash::keccak(self.encode())
2222
}
2323

24+
pub fn type_id(&self) -> u8 {
25+
let txn_id = match self {
26+
Self::Legacy(_) => TransactionId::Legacy,
27+
Self::AccessList(_) => TransactionId::AccessList,
28+
Self::EIP1559(_) => TransactionId::EIP1559,
29+
};
30+
txn_id as u8
31+
}
32+
2433
pub fn decode(tx: &[u8]) -> Result<Self, DecoderError> {
2534
// at least one byte needs to be present
2635
if tx.is_empty() {

0 commit comments

Comments
 (0)