From a7b6f1ed89d2c9b7a79450096f262300c54d5bf5 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sat, 15 Feb 2025 18:16:08 +0100 Subject: [PATCH] chore: add into to --- crates/primitives/src/common.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/primitives/src/common.rs b/crates/primitives/src/common.rs index 355165173..f84f34eeb 100644 --- a/crates/primitives/src/common.rs +++ b/crates/primitives/src/common.rs @@ -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
{ + 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 {