1use super::*;2use codec::{Encode, Decode};34#[macro_export]5macro_rules! map_common_err_to_proxy {6 (match $err:ident { $($common_err:ident => $proxy_err:ident),+ }) => {7 $(8 if $err == <CommonError<T>>::$common_err.into() {9 return <Error<T>>::$proxy_err.into()10 } else11 )+ {12 $err13 }14 };15}1617pub trait RmrkDecode<T: Decode + Default, S> {18 fn decode_or_default(&self) -> T;19}2021impl<T: Decode + Default, S> RmrkDecode<T, S> for BoundedVec<u8, S> {22 fn decode_or_default(&self) -> T {23 let mut value = self.as_slice();2425 T::decode(&mut value).unwrap_or_default()26 }27}2829pub trait RmrkRebind<T, S> {30 fn rebind(&self) -> BoundedVec<u8, S>;31}3233impl<T, S> RmrkRebind<T, S> for BoundedVec<u8, T> where BoundedVec<u8, S>: TryFrom<Vec<u8>> {34 fn rebind(&self) -> BoundedVec<u8, S> {35 BoundedVec::<u8, S>::try_from(36 self.clone().into_inner()37 ).unwrap_or_default()38 }39}4041#[derive(Encode, Decode, PartialEq, Eq)]42pub enum CollectionType {43 Regular,44 Resource,45 Base,46}4748#[derive(Encode, Decode, PartialEq, Eq)]49pub enum NftType {50 Regular,51 Resource,52 FixedPart,53 SlotPart,54 Theme55}