From 0cd3a72216e270ef4867d8ba7aacef2814aca4e8 Mon Sep 17 00:00:00 2001 From: Emilia Hane Date: Sat, 28 Sep 2024 10:43:23 +0200 Subject: [PATCH] Add conversion `TxKind` -> `Option
` (#750) --- crates/primitives/src/common.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/primitives/src/common.rs b/crates/primitives/src/common.rs index 4eef86cd7..355165173 100644 --- a/crates/primitives/src/common.rs +++ b/crates/primitives/src/common.rs @@ -35,6 +35,14 @@ impl From
for TxKind { } } +impl From for Option
{ + /// 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> {