pub use frame_metadata;
pub use sp_arithmetic;
pub use sp_core;
pub use sp_runtime;
#[derive(Clone, Debug, codec::Encode, codec::Decode, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "std", derive(Hash))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum MultiAddress<AccountId, AccountIndex> {
Id(AccountId),
Index(#[codec(compact)] AccountIndex),
Raw(Vec<u8>),
Address32([u8; 32]),
Address20([u8; 20]),
}
impl<AccountId: Clone, AccountIndex> From<&AccountId> for MultiAddress<AccountId, AccountIndex> {
fn from(other: &AccountId) -> Self {
Self::Id(other.clone())
}
}
impl<AccountId, AccountIndex> From<AccountId> for MultiAddress<AccountId, AccountIndex> {
fn from(other: AccountId) -> Self {
Self::Id(other)
}
}
impl<AccountId, AccountIndex> From<sp_runtime::MultiAddress<AccountId, AccountIndex>>
for MultiAddress<AccountId, AccountIndex>
{
fn from(other: sp_runtime::MultiAddress<AccountId, AccountIndex>) -> Self {
match other {
sp_runtime::MultiAddress::Id(v) => Self::Id(v),
sp_runtime::MultiAddress::Index(v) => Self::Index(v),
sp_runtime::MultiAddress::Raw(v) => Self::Raw(v),
sp_runtime::MultiAddress::Address32(v) => Self::Address32(v),
sp_runtime::MultiAddress::Address20(v) => Self::Address20(v),
}
}
}
impl<AccountId: Clone, AccountIndex: Clone> From<&sp_runtime::MultiAddress<AccountId, AccountIndex>>
for MultiAddress<AccountId, AccountIndex>
{
fn from(other: &sp_runtime::MultiAddress<AccountId, AccountIndex>) -> Self {
Self::from(other.clone())
}
}