Skip to content

Commit

Permalink
Add conversion TxKind -> Option<Address> (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
emhane committed Sep 28, 2024
1 parent 851824b commit 0cd3a72
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/primitives/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ impl From<Address> for TxKind {
}
}

impl From<TxKind> for Option<Address> {
/// Returns the address of the contract that will be called or will receive the transfer.
#[inline]
fn from(value: TxKind) -> Self {
value.to().copied()
}
}

impl TxKind {
/// Returns the address of the contract that will be called or will receive the transfer.
pub const fn to(&self) -> Option<&Address> {
Expand Down

0 comments on commit 0cd3a72

Please sign in to comment.