Skip to content

Commit

Permalink
impl from<[u8;32]> for accountid20 (#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
girazoki authored Aug 23, 2023
1 parent 0e48790 commit ba35e15
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions primitives/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ impl From<ecdsa::Public> for AccountId20 {
}
}

impl From<[u8; 32]> for AccountId20 {
fn from(bytes: [u8; 32]) -> Self {
let mut buffer = [0u8; 20];
buffer.copy_from_slice(&bytes[..20]);
Self(buffer)
}
}

#[derive(Eq, PartialEq, Clone, RuntimeDebug, Encode, Decode, TypeInfo)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct EthereumSignature(ecdsa::Signature);
Expand Down

0 comments on commit ba35e15

Please sign in to comment.