Skip to content

Commit

Permalink
feat: add TxKind::into_to (#875)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Feb 15, 2025
1 parent e3071c8 commit cabccd6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/primitives/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ impl TxKind {
}
}

/// Consumes the type and returns the address of the contract that will be called or will
/// receive the transfer.
pub fn into_to(self) -> Option<Address> {
match self {
Self::Create => None,
Self::Call(to) => Some(to),
}
}

/// Returns true if the transaction is a contract creation.
#[inline]
pub const fn is_create(&self) -> bool {
Expand Down

0 comments on commit cabccd6

Please sign in to comment.