mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 22:47:56 +00:00
Convert Public to CryptoTypePublicPair (#6014)
* Tabify code * Implement CryptoTypePublicPair in app_crypto * Cleanup redundancy * Introduce to_public_crypto_pair to Public trait * Implement method for test
This commit is contained in:
@@ -262,6 +262,10 @@ macro_rules! app_crypto_public_common {
|
||||
|
||||
impl $crate::Public for Public {
|
||||
fn from_slice(x: &[u8]) -> Self { Self(<$public>::from_slice(x)) }
|
||||
|
||||
fn to_public_crypto_pair(&self) -> $crate::CryptoTypePublicPair {
|
||||
$crate::CryptoTypePublicPair($crypto_type, self.to_raw_vec())
|
||||
}
|
||||
}
|
||||
|
||||
impl $crate::AppPublic for Public {
|
||||
@@ -298,6 +302,21 @@ macro_rules! app_crypto_public_common {
|
||||
<$public as $crate::RuntimePublic>::to_raw_vec(&self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Public> for $crate::CryptoTypePublicPair {
|
||||
fn from(key: Public) -> Self {
|
||||
(&key).into()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&Public> for $crate::CryptoTypePublicPair {
|
||||
fn from(key: &Public) -> Self {
|
||||
$crate::CryptoTypePublicPair(
|
||||
$crypto_type,
|
||||
$crate::Public::to_raw_vec(key),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user