Skip to content

Commit

Permalink
chore: add helper functions for destructing auth types
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jul 8, 2024
1 parent 07d1de5 commit 9229ab8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/eips/src/eip7702/auth_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ impl<S> SignedAuthorization<S> {
pub const fn signature(&self) -> &S {
&self.signature
}

/// Splits the authorization into parts.
pub fn into_parts(self) -> (Authorization, S) {
(self.inner, self.signature)
}
}

#[cfg(feature = "k256")]
Expand Down Expand Up @@ -123,6 +128,11 @@ impl RecoveredAuthorization {
pub const fn authority(&self) -> Option<Address> {
self.authority
}

/// Splits the authorization into parts.
pub fn into_parts(self) -> (Authorization, Option<Address>) {
(self.inner, self.authority)
}
}

impl Deref for RecoveredAuthorization {
Expand Down

0 comments on commit 9229ab8

Please sign in to comment.